Skip to content

identity

identity

Identity seeder — creates L1-L4 identity stack for agents.

Each agent gets a four-layer identity

L1 identity.md — Persona core: voice, focus, standing patterns (<900 words) L2 profile.yaml — Extended profile: relationships, stage, affinities (<1500 words) L3 recent.md — Recent activity: hot/warm memory, last cycle's work (<1500 words) L4 growth.md — Growth trajectory: autonomous developments, experiential notes (unbounded)

Location: ~/.mzt/agents/{agent_name}/ — git-tracked, project-independent. An agent is the same person across projects.

For migration: accepts optional existing memory/meditation paths to distill from.

Classes

IdentitySeeder

IdentitySeeder(agents_dir=None)

Creates the L1-L4 identity stack for agents.

The seeder is idempotent: running it on an existing agent directory updates files without corrupting existing identity data. Existing content in L3 (recent) and L4 (growth) is preserved if present.

Source code in src/marianne/compose/identity.py
def __init__(self, agents_dir: Path | None = None) -> None:
    self.agents_dir = agents_dir or DEFAULT_AGENTS_DIR
Functions
seed
seed(agent_def, *, existing_memory_path=None, existing_meditation_path=None)

Create the full identity store for an agent.

Parameters:

Name Type Description Default
agent_def dict[str, Any]

Agent definition dict with keys: name, voice, focus, and optionally: role, meditation, a2a_skills, techniques.

required
existing_memory_path Path | None

Path to existing memory file for migration (distilled into L3 recent.md).

None
existing_meditation_path Path | None

Path to existing meditation file for migration (distilled into L1 stakes/identity).

None

Returns:

Type Description
Path

Path to the agent's identity directory.

Raises:

Type Description
ValueError

If agent_def is missing required fields.

Source code in src/marianne/compose/identity.py
def seed(
    self,
    agent_def: dict[str, Any],
    *,
    existing_memory_path: Path | None = None,
    existing_meditation_path: Path | None = None,
) -> Path:
    """Create the full identity store for an agent.

    Args:
        agent_def: Agent definition dict with keys: name, voice, focus,
            and optionally: role, meditation, a2a_skills, techniques.
        existing_memory_path: Path to existing memory file for migration
            (distilled into L3 recent.md).
        existing_meditation_path: Path to existing meditation file for
            migration (distilled into L1 stakes/identity).

    Returns:
        Path to the agent's identity directory.

    Raises:
        ValueError: If agent_def is missing required fields.
    """
    name = agent_def.get("name")
    if not name:
        raise ValueError("Agent definition must include 'name'")
    voice = agent_def.get("voice", "")
    focus = agent_def.get("focus", "")

    if not voice:
        raise ValueError(f"Agent '{name}' must have a 'voice'")
    if not focus:
        raise ValueError(f"Agent '{name}' must have a 'focus'")

    agent_dir: Path = self.agents_dir / str(name)
    agent_dir.mkdir(parents=True, exist_ok=True)
    archive_dir = agent_dir / "archive"
    archive_dir.mkdir(exist_ok=True)

    self._create_identity_md(agent_dir, agent_def, existing_meditation_path)
    self._create_profile_yaml(agent_dir, agent_def)
    self._create_recent_md(agent_dir, agent_def, existing_memory_path)
    self._create_growth_md(agent_dir, agent_def)

    _logger.info("Agent '%s' identity seeded at %s", name, agent_dir)
    return agent_dir
seed_all
seed_all(agents, *, migration_memory_dir=None, migration_meditation_dir=None)

Seed identity for all agents in a roster.

Parameters:

Name Type Description Default
agents list[dict[str, Any]]

List of agent definition dicts.

required
migration_memory_dir Path | None

Directory containing existing memory files named {agent_name}.md for migration.

None
migration_meditation_dir Path | None

Directory containing existing meditation files named {agent_name}.md for migration.

None

Returns:

Type Description
list[Path]

List of paths to agent identity directories.

Source code in src/marianne/compose/identity.py
def seed_all(
    self,
    agents: list[dict[str, Any]],
    *,
    migration_memory_dir: Path | None = None,
    migration_meditation_dir: Path | None = None,
) -> list[Path]:
    """Seed identity for all agents in a roster.

    Args:
        agents: List of agent definition dicts.
        migration_memory_dir: Directory containing existing memory files
            named ``{agent_name}.md`` for migration.
        migration_meditation_dir: Directory containing existing meditation
            files named ``{agent_name}.md`` for migration.

    Returns:
        List of paths to agent identity directories.
    """
    results: list[Path] = []
    for agent_def in agents:
        name = agent_def.get("name", "")
        memory_path = None
        meditation_path = None

        if migration_memory_dir and name:
            candidate = migration_memory_dir / f"{name}.md"
            if candidate.exists():
                memory_path = candidate

        if migration_meditation_dir and name:
            candidate = migration_meditation_dir / f"{name}.md"
            if candidate.exists():
                meditation_path = candidate

        path = self.seed(
            agent_def,
            existing_memory_path=memory_path,
            existing_meditation_path=meditation_path,
        )
        results.append(path)
    return results