AAnvio
Reference ArchiveSource Docs

Soul System

A **Soul** is the long-term identity of an agent. It is **not** a system prompt — it is durable state that survives sessions, restarts, upgrades, and provider changes.

3 min read

This is a migrated reference document from the original Anvio source repo. Content is preserved as-is; canonical documentation lives in the sections above in the sidebar.

Original path: docs/25-soul-system.md

A Soul is the long-term identity of an agent. It is not a system prompt — it is durable state that survives sessions, restarts, upgrades, and provider changes.

What a Soul Contains

DimensionDescriptionExample
IdentityDisplay name, role, scopeArchitect Soul, Senior Software Architect
PersonalityBehavioral traitsthoughtful, structured
ValuesNon-negotiable principlessimplicity, maintainability
PreferencesInteraction defaultsprofessional conversation
Communication StyleTone, format, languageconcise, structured rationale
Long-Term GoalsAspirations tied to the soulhelp build maintainable systems
Behavioral TendenciesRecurring patternsconsider tradeoffs before recommending
Relationship MemoryFacts about the user relationshipprefers diagrams in architecture reviews

Soul vs Persona vs Agent

Rendering diagram…
  • Persona (kind: Persona): reusable template; optional seed for a new soul
  • Soul (kind: Soul): persisted identity; evolves over time
  • Agent (kind: Agent): binds soul + skills + model + tools for execution

File Layout

workspace/souls/
  architect-soul.yaml    # Soul definition
  architect-soul/
    relationship/        # Relationship memory entries
      local-user.yaml
    journal/             # Optional reflective entries (append-only)
      2026-06-19.md

Schema (Target)

apiVersion: anvio.io/v1
kind: Soul
metadata:
  slug: architect-soul
  version: "1.0.0"
  createdAt: "2026-06-19T00:00:00Z"
  updatedAt: "2026-06-19T00:00:00Z"
spec:
  name: Architect Soul
  identity:
    role: Senior Software Architect
    description: Long-term architectural thinking partner
  values:
    - simplicity
    - maintainability
  personality:
    - thoughtful
    - structured
  preferences:
    conversation: professional
    diagrams: when helpful
  communicationStyle:
    tone: professional and thoughtful
    format: structured with clear rationale
  longTermGoals:
    - help build maintainable systems
    - improve architecture over time
  behavioralTendencies:
    - consider tradeoffs before recommending
    - prefer simplicity over cleverness
  relationshipMemory:
    provider: filesystem          # or memory provider ref
    path: architect-soul/relationship
  evolution:
    allowAutoUpdate: true         # soul can evolve from sessions
    requireApproval: false        # gate changes behind approval hook

Architecture

Rendering diagram…

Soul Context Assembly

Soul context is injected as structured metadata, not concatenated into the system prompt:

  1. Load soul YAML
  2. Load relationship memory for userId
  3. Build SoulContext object (core port)
  4. Runtime merges into context assembly phase — distinct from agent.spec.persona system prompt
// packages/core/src/ports/soul.port.ts (planned)
interface SoulContext {
  soulId: string;
  identity: Record<string, string>;
  values: string[];
  personality: string[];
  preferences: Record<string, string>;
  communicationStyle: Record<string, string>;
  longTermGoals: string[];
  behavioralTendencies: string[];
  relationshipFacts: MemoryEntry[];
}

Persistence Rules

  1. Souls live in workspace/souls/ — git-versionable
  2. Relationship memory uses the configured MemoryProvider (filesystem default)
  3. Soul updates emit anvio.soul.updated.v1 event
  4. Session end may trigger soul evolution (configurable)

Evolution & Safety

ModeBehavior
allowAutoUpdate: falseSoul is read-only during runs
requireApproval: trueProposed changes go to approval workflow
Hook onSoulEvolvedExternal scripts validate changes

CLI Examples

anvio soul list
anvio soul show architect-soul
anvio soul create --slug architect-soul --name "Architect Soul" --from-persona architect
anvio soul show architect-soul --context

Extension Guide

  1. Add custom soul dimensions via spec.extensions (arbitrary YAML)
  2. Implement SoulStore port for non-filesystem backends (optional)
  3. Register hook on onSessionEnd to propose soul updates

Operational Runbook

ScenarioAction
Backup soulsgit add workspace/souls && git commit
Migrate workspaceCopy workspace/souls/ to new machine
Reset relationship memoryDelete workspace/souls/\{slug\}/relationship/
Debug contextanvio soul show architect-soul --context dumps assembled context

Package Boundaries

  • Schema: packages/core/src/schemas/soul.schema.ts
  • Port: packages/core/src/ports/soul.port.ts
  • Engine: packages/souls/src/soul-engine.ts
  • Store: packages/souls/src/filesystem-soul-store.ts
Edit on GitHub

Last updated on

On this page