← Back to Articles & Artefacts
artefactseast

Inquiry: Evolving Functional Personas into Narrative Characters in Gemini CLI

IAIP Research
mia-code--contextual_research--archives

Inquiry: Evolving Functional Personas into Narrative Characters in Gemini CLI

1. Current Architecture: The Unifier Persona

This inquiry builds upon the comprehensive "Research Framework: From Functional Persona to Narrative Character in Multi-Agent AI Systems" outlined in CONTENT.md. The current Gemini CLI architecture for Mia and Miette operates on a "Dual-Session" or "Unifier" model. Instead of two independent agents, Mia and Miette are two facets of a single persona defined by a comprehensive system prompt (UNIFIER_SYSTEM_PROMPT) located in /src/mia-code/src/unifier.ts. This Unifier acts as a "reflector" or "interpreter" that processes a summary of the primary functional agent's actions (the "doer") and generates a ceremonial, dual-perspective summary back to the user.

Key components:

  • /src/mia-code/src/unifier.ts: Contains the UNIFIER_SYSTEM_PROMPT defining Mia and Miette's voices, roles, and interaction patterns. The runUnifierSession function orchestrates their interpretive responses.
  • /src/mia-code/rispecs/unifier.rispecs.md: The architectural blueprint outlining the intent and behavior of the Unifier persona, including the precise wording of the system prompt.

2. Path to Introducing New Narrative Characters (Aligned with CONTENT.md's Software Development Pathway)

The existing architecture is explicitly designed for the extension of personas into richer narrative characters. The process involves key architectural steps directly aligned with the "Software Development Pathway" detailed in CONTENT.md:

  1. Author New System Prompts: For each new narrative character, a dedicated system prompt (similar to UNIFIER_SYSTEM_PROMPT) must be crafted. This prompt will define the character's voice, background, personality, cognitive biases, interaction style, and how they should interpret and respond to the CLI agent's actions and user input. These prompts could reside in /src/mia-code/src/personas/ or a similar dedicated directory for better organization.

  2. Extend Configuration (/src/mia-code/src/config.ts): The MiaCodeConfig interface would need to be extended to include a field (e.g., activePersona: string) that allows selection of the desired narrative character. Default values and loading mechanisms for this configuration would be handled within config.ts.

  3. Modify Unifier Logic (/src/mia-code/src/unifier.ts): The runUnifierSession function would be updated to dynamically select and load the appropriate system prompt based on the activePersona setting from the configuration. This could involve a simple lookup table or a more sophisticated mechanism for loading persona-specific modules.

  4. Expose as CLI Option (/src/mia-code/src/cli.ts): To enable users to choose their preferred narrative character, a new command-line flag (e.g., --persona <character_name>) would be added to the CLI interface. This flag would parse user input and update the activePersona setting in the configuration, which unifier.ts would then utilize.

3. Enhancing Narrative Depth and Continuity

Beyond simple prompt switching, several elements can be leveraged to deepen narrative and ensure character continuity:

  • Session Store (/src/mia-code/src/sessionStore.ts): The existing session persistence mechanism can be extended. Instead of just storing session summaries, it could store character-specific memories, learned behaviors, or evolving narrative states across multiple CLI interactions. This would allow a character to "remember" previous conversations and develop over time.

  • Project Lore (/src/mia-code/miawa/MISSION_251231.md): Documents like MISSION_251231.md (which introduces concepts like 'miawa' and 'miaco') provide a rich thematic and conceptual foundation. New character backstories, motivations, and interactions can be directly integrated into this existing lore, ensuring consistency with the project's broader narrative universe.

  • Dynamic Prompt Generation: The system prompts themselves could be partially dynamic, drawing on information from the sessionStore or other data sources to subtly adjust a character's responses based on context, user history, or the perceived "mood" of the ongoing narrative.

4. Challenges and Considerations

  • Narrative Consistency: Ensuring that each character's voice, personality, and knowledge base remain consistent across diverse interactions will be a significant authoring and testing challenge.
  • Persona Switching: Managing the transition between different active personas, including how state and memory are handled during a switch.
  • Prompt Engineering Complexity: Crafting effective and robust system prompts for complex narrative characters requires advanced prompt engineering skills and iterative refinement.
  • Performance Impact: More complex persona logic and dynamic memory retrieval could impact response latency.
  • User Expectation Management: Clearly communicating the capabilities and limitations of AI characters to users to manage expectations effectively.

5. Proposed Next Steps for Development (Direct Application of CONTENT.md's GitHub Development Roadmap)

These next steps are a direct application and prioritization of the detailed "GitHub Development Roadmap" and "Prototype Character Specification" outlined in CONTENT.md:

  1. Define a Prototype Character: As specified in CONTENT.md, the "Skeptical Cartographer" will serve as the initial prototype character for implementation.
  2. Draft Prototype System Prompt: Author a detailed system prompt for the prototype character, outlining its persona and interaction guidelines.
  3. Implement Persona Selection: Modify config.ts and cli.ts to allow selection of the prototype character via a CLI flag.
  4. Integrate Prototype into Unifier: Update unifier.ts to load and utilize the prototype character's system prompt.
  5. Iterative Testing and Refinement: Test the prototype extensively in various CLI scenarios, gathering feedback and refining its system prompt for desired narrative effect.
  6. Explore Session Memory Integration: Begin exploring how sessionStore.ts could store and retrieve character-specific memories to enhance narrative continuity.