Skip to content

Latest commit

 

History

History
2184 lines (1511 loc) · 81.5 KB

cli-reference.md

File metadata and controls

2184 lines (1511 loc) · 81.5 KB

CLI Reference

Soul Protocol ships a command-line interface with 44 commands for creating, inspecting, exporting, and managing souls — plus the org-layer commands added in v0.3.1 (soul org, soul template, soul user, soul create). Built on Click with Rich output formatting.

Installation

pip install soul-protocol

The soul command is registered as a console script. Verify it works:

soul --version

Commands

soul init

Initialize a .soul/ folder in the current directory. This is the recommended way to start using Soul Protocol in a project -- like git init for identity.

Tip: After soul init, run soul inject claude-code (or your platform) to push soul context directly into your agent's config file. See soul inject below.

# Interactive -- prompts for name
soul init

# Provide name, archetype, and values
soul init "Aria" --archetype "The Coding Expert" --values "creativity,precision"

# Seed from an existing .soul file
soul init --from-file aria.soul

# Custom directory name (default: .soul)
soul init "Aria" --dir .my-soul

Arguments:

Argument Required Description
NAME No Soul name. If omitted, the CLI prompts interactively.

Options:

Option Short Description
--archetype TEXT -a Character archetype. Defaults to "The Companion".
--values TEXT -v Comma-separated core values. Defaults to "curiosity,empathy,honesty".
--from-file PATH -f Seed from an existing .soul file, .yaml, .json, or .md.
--dir PATH -d Directory to create. Defaults to .soul.

Output: Creates a .soul/ folder with the following structure:

.soul/
├── soul.json           # Identity, DNA, config
├── state.json          # Current mood, energy, focus, social battery
├── dna.md              # Human-readable personality markdown
└── memory/
    ├── core.json       # Persona definition + human knowledge
    ├── episodic.json   # Experience log
    ├── semantic.json   # Extracted facts
    ├── procedural.json # Learned patterns
    ├── graph.json      # Knowledge graph
    ├── self_model.json # Self-concept
    └── general_events.json

If a .soul/ folder already exists with a soul.json, the CLI asks for confirmation before overwriting.

After initialization, all other soul commands work with the .soul/ directory:

soul inspect .soul/
soul status .soul/
soul export .soul/ -o aria.soul

soul inject

Inject soul context (identity, core memory, state, recent memories) directly into an agent platform's config file. This is the fast, CLI-based alternative to running an MCP server -- ~50ms vs ~500ms per operation, no server process needed, works offline.

The injected block is idempotent: running soul inject again replaces the existing section without duplicating content.

# Inject into Claude Code's CLAUDE.md
soul inject claude-code

# Inject a specific soul into Cursor's config
soul inject cursor --soul guardian

# Include more memories (default: 10)
soul inject vscode --memories 20

# Custom soul directory
soul inject windsurf --dir ~/my-project/.soul

# Quiet mode (no console output)
soul inject cline --quiet

Arguments:

Argument Required Description
TARGET Yes Platform to inject into. One of: claude-code, cursor, vscode, windsurf, cline, continue.

Options:

Option Short Description
--soul TEXT Soul name to inject. Default: first soul found in the directory.
--dir PATH -d Soul directory path. Default: .soul/ in the current working directory.
--memories INT -m Number of recent memories to include. Default: 10.
--quiet -q Suppress console output.

Target config files:

Target Config file
claude-code .claude/CLAUDE.md
cursor .cursorrules
vscode .github/copilot-instructions.md
windsurf .windsurfrules
cline .clinerules
continue .continuerules

What gets injected:

The command writes a markdown block between <!-- SOUL-CONTEXT-START --> and <!-- SOUL-CONTEXT-END --> markers containing:

  • Soul identity (name, archetype, DID, core values)
  • Current state (mood, energy, lifecycle stage)
  • Core memory (persona definition, knowledge about the human)
  • Recent episodic memories (configurable count, truncated at 120 chars)
  • Injection timestamp

When to use inject vs MCP:

Use soul inject when... Use MCP when...
You want fast, static context You need real-time memory updates during conversation
MCP server keeps disconnecting The agent needs to call soul_observe or soul_remember
You're scripting or automating You're using Claude Desktop (no CLI integration)
You want to version-control the context You want the soul to evolve during the session

Both approaches work together. Use soul inject for baseline context and MCP for live memory operations.


soul birth

Create a new soul. Generates a DID, initializes the OCEAN personality model with defaults, and exports the result as a .soul file.

# Interactive -- prompts for name if not provided
soul birth

# Provide name and archetype directly
soul birth "Aria" --archetype "The Compassionate Creator"

# Create from an existing SOUL.md, YAML, or JSON file
soul birth --from-file persona.md --output aria.soul

# Custom output path
soul birth "Sage" --archetype "The Wise Advisor" --output sage.soul

Arguments:

Argument Required Description
NAME No Soul name. If omitted, the CLI prompts interactively.

Options:

Option Short Description
--archetype TEXT -a Character archetype. Defaults to "The Companion".
--from-file PATH -f Create from an existing soul definition file (.md, .yaml, .json). The file must exist.
--output PATH -o Output file path. Defaults to ./{name}.soul.

Output: Prints the soul's name and DID, then saves the .soul file.


soul inspect

Display detailed information about a soul file: identity, personality traits, current state.

soul inspect aria.soul
soul inspect ./souls/sage.yaml

Arguments:

Argument Required Description
PATH Yes Path to a .soul, .yaml, .json, or .md file.

Options:

Option Description
--password / -p Decrypt an encrypted .soul file (prompts interactively for password).

Output: A formatted table showing:

  • Identity: DID, archetype, born date, age in days, lifecycle stage
  • State: Mood, energy (%), focus, social battery (%)
  • Personality (OCEAN): Openness, Conscientiousness, Extraversion, Agreeableness, Neuroticism (each 0.00-1.00)

Example with encrypted soul:

soul inspect encrypted.soul --password
# Prompts: Decryption password: ****

soul status

Show the soul's current emotional and energy state in a compact panel.

soul status aria.soul

Arguments:

Argument Required Description
PATH Yes Path to a soul file.

Output: A bordered panel displaying mood, energy level (color-coded: green above 50%, red below), focus, and social battery percentage.


soul export

Export a soul to a different format. Reads from any supported format and writes to the target.

# Export to portable .soul archive (default)
soul export aria.yaml --output aria.soul

# Export to JSON
soul export aria.soul --output aria.json --format json

# Export to YAML
soul export aria.soul --output aria.yaml --format yaml

# Export to human-readable Markdown (DNA only)
soul export aria.soul --output aria.md --format md

# Include private signing key (for device migration only)
soul export aria.soul -o aria.soul --include-keys

Arguments:

Argument Required Description
SOURCE Yes Source soul file (.soul, .yaml, .json, .md).

Options:

Option Short Description
--output PATH -o Output file path. Required.
--format FORMAT -f Target format: soul (zip archive), json, yaml, md (markdown). Defaults to soul.
--password / -p Encrypt the .soul archive with AES-256-GCM using a scrypt-derived key. All files except manifest.json are encrypted (.enc extension). Only applies to soul format.

Format details:

Format Contents Use case
soul Zip archive with soul.json, dna.md, state.json, memory/*.json, manifest.json Portable transfer between machines. Pass --include-keys to carry signing power.
json Full SoulConfig as indented JSON API integration, programmatic access
yaml Full SoulConfig as YAML Human-editable configuration
md DNA markdown (identity + personality + communication + biorhythms) Documentation, sharing personality specs

soul migrate

Migrate from a SOUL.md markdown file to the structured .soul archive format. Useful for converting legacy soul definitions.

soul migrate SOUL.md --output aria.soul

Arguments:

Argument Required Description
SOURCE Yes Path to a SOUL.md file.

Options:

Option Short Description
--output PATH -o Output .soul file path. Required.

soul unpack

Unpack a .soul file into a browsable directory. Creates a folder with readable YAML/JSON files you can browse in VS Code, diff with git, and edit directly.

soul unpack guardian.soul              # → .soul/soul/
soul unpack guardian.soul -d guardian/  # → guardian/

Arguments:

Argument Required Description
SOURCE Yes Path to a .soul file.

Options:

Option Short Description
--dir PATH -d Target directory (default: .soul/<name>/).

soul retire

Retire a soul gracefully. By default, saves all memories before transitioning the soul to a RETIRED lifecycle state. Prompts for confirmation.

soul retire aria.soul
soul retire aria.soul --preserve-memories

Arguments:

Argument Required Description
PATH Yes Path to the soul file to retire.

Options:

Option Description
--preserve-memories Save memories before retiring. On by default.

Behavior: The CLI prompts "Are you sure you want to retire {name}?" before proceeding. On confirmation, it persists the soul (if --preserve-memories is active), sets the lifecycle to RETIRED, clears working memory, and resets state.


soul delete

Delete a .soul file from disk. Refuses for souls with role="root" (use soul org destroy instead). Prompts for confirmation unless --yes is supplied.

soul delete aria.soul
soul delete aria.soul --yes

Arguments:

Argument Required Description
PATH Yes Path to the .soul file to delete.

Options:

Option Description
--yes Skip confirmation prompt.

soul list

List all souls saved in the default storage directory (~/.soul/).

soul list

Arguments: None.

Output: A table of soul IDs found under ~/.soul/. Each entry corresponds to a subdirectory containing a soul.json file. If no souls are found, prints a notice.


soul import-soulspec

Import a soul from a SoulSpec directory. Reads SOUL.md, IDENTITY.md, STYLE.md, and soul.json from the given directory and creates a new Soul with the mapped data.

# Import from a SoulSpec directory
soul import-soulspec ./my-character/

# Specify output path
soul import-soulspec ./specs/ -o aria.soul

Arguments:

Argument Required Description
SOURCE Yes Path to a SoulSpec directory.

Options:

Option Short Description
--output PATH -o Output .soul file path. Defaults to ./{name}.soul.

soul export-soulspec

Export a soul to SoulSpec directory format. Creates a directory with SOUL.md, IDENTITY.md, STYLE.md, and soul.json files compatible with the SoulSpec format (soulspec.org).

# Export to SoulSpec directory
soul export-soulspec aria.soul

# Specify output directory
soul export-soulspec .soul/ -o ./output/

Arguments:

Argument Required Description
SOURCE Yes Path to a .soul file or soul directory.

Options:

Option Short Description
--output PATH -o Output directory. Defaults to ./{name}-soulspec.

soul import-tavernai

Import a soul from a TavernAI Character Card V2. Reads a Character Card V2 JSON file or PNG with embedded character data. Automatically detects whether the source is JSON or PNG.

# Import from JSON
soul import-tavernai character.json

# Import from PNG with embedded card
soul import-tavernai avatar.png -o aria.soul

Arguments:

Argument Required Description
SOURCE Yes Path to a TavernAI Character Card V2 file (.json or .png).

Options:

Option Short Description
--output PATH -o Output .soul file path. Defaults to ./{name}.soul.

soul export-tavernai

Export a soul to TavernAI Character Card V2 format. Creates a Character Card V2 JSON file. Optionally embeds the card in a PNG file with --png.

# Export to JSON
soul export-tavernai aria.soul

# Export with PNG embedding
soul export-tavernai .soul/ -o card.json --png avatar.png

Arguments:

Argument Required Description
SOURCE Yes Path to a .soul file or soul directory.

Options:

Option Short Description
--output PATH -o Output JSON file path. Defaults to ./{name}-card.json.
--png PATH Also export as PNG with embedded card data.

soul import-a2a

Create a soul from an A2A Agent Card JSON file. Reads an Agent Card and creates a new soul with the card's identity, personality (from extensions.soul), and skills.

# Import from Agent Card
soul import-a2a agent-card.json

# Specify output
soul import-a2a card.json -o my-agent.soul

Arguments:

Argument Required Description
FILE Yes Path to an A2A Agent Card JSON file.

Options:

Option Short Description
--output PATH -o Output .soul file path. Defaults to ./{name}.soul.

soul export-a2a

Generate an A2A Agent Card from a soul. Reads a .soul file or directory and outputs a JSON Agent Card compatible with Google's Agent-to-Agent protocol.

# Export to Agent Card
soul export-a2a .soul/

# With endpoint URL
soul export-a2a aria.soul -o card.json --url https://aria.example.com

Arguments:

Argument Required Description
SOURCE Yes Path to a .soul file or soul directory.

Options:

Option Short Description
--output PATH -o Output JSON file path. Defaults to ./{name}-agent-card.json.
--url TEXT -u Agent endpoint URL for the card.

soul remember (deprecated)

Deprecated alias for direct memory writes. Prefer soul note <path> "<fact>", which routes through dedup-aware reconciliation.

# Semantic by default — facts the soul should know
soul remember aria.soul "User prefers Python over JavaScript" --importance 8

# Episodic — events that happened
soul remember aria.soul "Shipped v0.3 today" --type episodic --importance 8

# Procedural — how to do things
soul remember aria.soul "To deploy: run make deploy" --type procedural

# Social — relationship memories (#41)
soul remember aria.soul "Alice prefers async messages" --type social

# With emotion tagging
soul remember aria.soul "Had a productive session" --emotion happy

# Domain-scoped memory (#41)
soul remember aria.soul "Q3 revenue up 12 percent" --domain finance --importance 8
soul remember aria.soul "NDA expires in March" --domain legal --importance 7

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
TEXT Yes The memory content to store.

Options:

Option Default Description
--importance, -i INT 5 Importance score 1-10.
--emotion, -e TEXT Emotion tag (e.g. happy, sad, excited).
--type, -t [episodic|semantic|procedural|social] semantic Memory tier. social added in v0.4.0 (#41).
--domain, -d TEXT default Domain sub-namespace inside the layer (#41), e.g. finance or legal.

Memory tiers:

  • episodic — what happened. Events, sessions, shipped work, decisions. Use when the memory answers "when did that happen?"
  • semantic — what the soul knows. Facts, preferences, project knowledge. Use when the memory answers "what do I know about X?"
  • procedural — how to do things. Commands, recipes, debugging tips. Use when the memory answers "how do I...?"
  • social — relationship memories (#41). Communication preferences, trust signals, per-user context.

Core memory (persona and human knowledge) is not writable through remember. Use soul edit-core instead.

Output: A confirmation panel showing the stored text, tier, domain, importance, emotion, and memory ID. The soul is saved automatically.

Deprecation: soul remember emits a deprecation warning and points to soul note. Scheduled for removal in v0.7.0. Use soul note --no-dedup when you explicitly want legacy raw-append behavior.


soul note (v0.5.0, #231)

Note a fact in a soul, routing the new content through the dedup pipeline before it lands in the store. Use this when a script, hook, or human is writing a single fact-shaped string and you want the soul to skip near-duplicates and merge enriched supersets instead of accumulating duplicates.

soul note differs from the other two memory writers as follows:

  • vs soul remember — remember is a blunt append. Every call adds a fresh MemoryEntry, even when the content is byte-identical to something already stored. note runs the new content through reconcile_fact() (Jaccard + containment over tokenized strings) and applies the resulting SKIP / MERGE / CREATE decision. Pass --no-dedup to opt out and get the legacy remember behaviour.
  • vs soul observe — observe is the cognitive interaction pipeline. It takes a --user-input + --agent-output pair and runs the full sentiment / significance / entity-extraction stack on top of the memory write. note takes a single fact-shaped string and skips fact extraction (the caller already provided the fact). Use note when you have a fact, observe when you have a conversation turn.
# Semantic by default — facts the soul should know
soul note aria.soul "User prefers dark mode"
soul note aria.soul "Likes Python" --importance 7

# Procedural — how to do things
soul note aria.soul "To deploy: run make deploy" --type procedural

# Episodic — events that happened (dedup is bypassed for episodic)
soul note aria.soul "Shipped v0.5 today" --type episodic --importance 8

# Domain-scoped (#41) — dedup is restricted to the same domain when non-default
soul note aria.soul "Q3 revenue up 12 percent" --domain finance --importance 8

# Force a blunt write — bypass dedup
soul note aria.soul "always store this raw" --no-dedup

Dedup pipeline:

For each call against the matching tier store, note computes a Jaccard-with-containment similarity against the existing (non-superseded) entries and picks one of three actions:

  • CREATE (similarity below 0.6) — a genuinely new fact. Stored as a new MemoryEntry. Returned as {"action": "CREATE", "id": "<new>", "existing_id": null, "similarity": null}.
  • SKIP (similarity above 0.85) — the new text duplicates an existing entry. Nothing is written. Returned as {"action": "SKIP", "id": null, "existing_id": "<existing>", "similarity": 0.92}.
  • MERGE (similarity 0.6 to 0.85) — the new text enriches an existing entry. The new content is stored, the old entry's superseded_by field points at the new id, and only the new entry shows in default recalls. Returned as {"action": "MERGE", "id": "<new>", "existing_id": "<old>", "similarity": 0.75}.

Episodic memories bypass dedup entirely (events are unique by time). The --no-dedup flag falls through to the blunt remember path for callers that want to force a write.

Examples by action:

# CREATE — first time the fact is seen
soul note aria.soul "user prefers dark mode in the editor"
# panel: CREATED

# SKIP — second call with identical text
soul note aria.soul "user prefers dark mode in the editor"
# panel: SKIPPED, existing id, similarity 1.00

# MERGE — second call enriches the first
soul note aria.soul "Aria likes Python"
soul note aria.soul "Aria likes Python and async code"
# panel on second call: MERGED, existing id, similarity 0.75

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
TEXT Yes The fact text to note.

Options:

Option Default Description
--importance, -i INT 5 Importance score 1-10.
--emotion, -e TEXT Emotion tag (e.g. happy, sad).
--type, -t [episodic|semantic|procedural|social] semantic Memory tier. Episodic bypasses dedup.
--domain, -d TEXT default Domain sub-namespace (#41). When non-default, dedup is restricted to entries with the same domain.
--no-dedup off Bypass the dedup pipeline and write unconditionally. Restores the legacy remember behaviour.
--no-contradictions off Skip contradiction detection on stored facts. (Wiring is plumbed but disabled by default — see #231.)

Output: A panel showing the action taken (CREATED / SKIPPED / MERGED), the relevant memory IDs, similarity score (when applicable), tier, domain, importance, and emotion. Border colour signals the action: green for CREATE, yellow for SKIP, cyan for MERGE.

Naming note. Issue #231 originally proposed soul observe for this command, but soul observe is already taken by the cognitive interaction pipeline. The command ships as soul note to match the runtime method (Soul.note()); a follow-up issue tracks the longer-term consolidation.


soul recall

Query a soul's memories by text, or list the most recent memories. Returns ranked results using activation-based relevance (recency + importance + match strength).

# Text query
soul recall aria.soul "user preferences"
soul recall aria.soul "python" --limit 5 --min-importance 7

# Recent memories
soul recall aria.soul --recent 10

# LLM-friendly output
soul recall aria.soul "python" --full            # Untruncated content
soul recall aria.soul "python" --json            # Machine-readable JSON
soul recall aria.soul --recent 5 --json          # Recent memories as JSON

# Multi-user (#46) — scope recall to one user
soul recall aria.soul "preferences" --user alice
soul recall aria.soul --recent 10 --user alice

# Layer + domain filters (#41)
soul recall aria.soul "revenue" --layer semantic --domain finance
soul recall aria.soul "alice" --layer social
soul recall aria.soul --recent 5 --domain legal

# Graded relevance floor (#247) — drop weak query matches
soul recall aria.soul "python deployment docker" --min-relevance 0.3

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
QUERY No Search text. If omitted, use --recent N instead.

Options:

Option Default Description
--limit, -n INT 10 Maximum results to return.
--min-importance INT 0 Filter out memories below this importance score.
--recent, -r INT Show N most recent memories instead of searching.
--full off Return untruncated content (for LLM consumption).
--json off Return results as JSON (for scripting).
--user TEXT Filter results to memories attributed to this user_id (#46). Legacy entries with no user_id are also returned.
--layer TEXT Filter to one layer (episodic, semantic, procedural, social, or any custom layer name) (#41).
--domain, -d TEXT Filter to one domain sub-namespace, e.g. finance (#41).
--min-relevance FLOAT 0.0 Graded relevance floor (0.0-1.0). Drops weak query matches whose token overlap is below this fraction. Default 0.0 keeps every match (#247).

Output: A table of ranked memories with type, content, importance, emotion, and timestamp. Use --full or --json when an agent or script needs machine-readable output. The JSON payload includes user_id, layer, domain, and score fields per entry. The score is the entry's activation score for the query (null for --recent output, which has no query to score against).


soul layers

Inspect a soul's memory layers (#41). Lists every populated layer with per-domain entry counts. Useful for verifying that domain isolation worked as expected and for spotting unexpected custom layers.

soul layers aria.soul
soul layers .soul/ --json

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--json Output as a JSON object with shape {"soul": "<name>", "layers": {"<layer>": {"<domain>": count}}}.

Output: A table of layer / per-domain counts. Built-in layers (episodic, semantic, procedural, social) appear first, then any user-defined layers in alphabetical order.


soul observe

Process an interaction through the full cognitive pipeline. Runs sentiment detection, significance gating, memory storage, entity extraction, self-model updates, and evolution triggers.

soul observe .soul/ --user-input "Hello" --agent-output "Hi there!"
soul observe aria.soul --user-input "Tell me a joke" --agent-output "Why did..." --channel discord

# Multi-user (#46) — attribute the memory to one user
soul observe aria.soul --user-input "Hi" --agent-output "Hello!" --user alice

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--user-input TEXT User's message. Required.
--agent-output TEXT Agent's response. Required.
--channel TEXT Channel name. Defaults to cli.
--user TEXT Attribute observed memories to this user_id (#46). The per-user bond is strengthened instead of the default bond.

Output: Prints the soul's mood and energy after processing the interaction. Saves the soul automatically.


soul reflect

Trigger memory consolidation and reflection. The soul reviews recent interactions, extracts themes, creates summaries, and updates its self-understanding. Call periodically (e.g., every 10-20 interactions, or at session end). Requires a CognitiveEngine (LLM) for full power.

soul reflect .soul/
soul reflect aria.soul --no-apply

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--no-apply Don't consolidate results into memory (dry run).

Output: A panel with themes, summaries, emotional patterns, and self-insights. Saves the soul automatically unless --no-apply is set.


soul dream

Run an offline dream cycle — batch memory consolidation. Dreaming reviews accumulated episodes to detect topic patterns, extract recurring procedures, consolidate the knowledge graph, and propose personality evolution from behavioral trends.

Unlike soul reflect (which only summarizes recent episodes via LLM), soul dream performs cross-tier synthesis: episodes → procedures, entities → evolution, and graph → cleanup. No LLM required — all pattern detection is heuristic-based.

soul dream .soul/
soul dream pocketpaw.soul --since 2026-04-01
soul dream .soul/ --json
soul dream .soul/ --no-archive --no-synthesize

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--since DATETIME Only review episodes after this datetime.
--no-archive Skip archiving old memories.
--no-synthesize Skip creating procedural memories and evolution insights.
--json Output as machine-readable JSON.

Output: A panel with topic clusters, recurring patterns, behavioral trends, consolidation stats, and evolution insights. Saves the soul automatically.

Dream phases:

  1. Gather — Collect episodes (optionally filtered by --since)
  2. Detect patterns — Topic clustering (Jaccard token overlap), procedure detection (action signature frequency), behavioral trend analysis (first-half vs second-half token drift)
  3. Consolidate — Archive old memories, deduplicate semantic facts, merge duplicate graph entities, prune expired/duplicate edges
  4. Synthesize — Convert detected patterns into procedural memories, analyze OCEAN trait drift from behavioral data
  5. Report — Full DreamReport with all findings and actions taken

soul feel

Update a soul's emotional state directly.

soul feel .soul/ --mood excited
soul feel aria.soul --energy -10
soul feel .soul/ --mood focused --energy 5
soul feel .soul/ --focus max
soul feel .soul/ --focus auto

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--mood TEXT Set mood. One of: neutral, curious, focused, tired, excited, contemplative, satisfied, concerned.
--energy FLOAT Adjust energy (can be negative, e.g. -10). Applied as a delta.
--focus TEXT Lock focus to one of low, medium, high, max. Pass auto to clear the lock and re-enable density-driven focus (default behavior).

At least one of --mood, --energy, or --focus is required.

Focus modes:

By default, focus is computed from a sliding window of recent interactions (1 hour, configurable via Biorhythms.focus_window_seconds). Bands are: low (no interactions in window), medium (1-2), high (3-9), max (10+). Setting --focus <level> pins the value until you pass --focus auto.

Output: Prints the updated mood and energy. Saves the soul automatically.


soul prompt

Generate and print the full system prompt for a soul. Outputs to stdout with no Rich formatting, so it can be piped to other commands or captured in a variable.

soul prompt .soul/
soul prompt aria.soul > prompt.txt
soul prompt .soul/ | pbcopy

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Output: Plain text system prompt string including DNA, identity, core memory, current state, and self-model.


soul forget

Forget memories by ID, query, entity, or timestamp.

v0.5.0 (#192) semantic shift. As of 0.5.0 soul forget no longer hard-deletes — it drops MemoryEntry.retrieval_weight to 0.05 (below the recall floor of 0.1) so the entry stops surfacing but stays on disk. Use soul reinstate to restore. For genuine deletion (GDPR / privacy / safety), use soul purge — that command keeps the older hard-delete behaviour with .soul.bak backup.

Dry-run by default — preview shows what would be forgotten without touching the soul. Pass --apply to commit. A .soul.bak backup is written before the save when the soul is a single-file .soul archive.

soul forget .soul/ "credit card"                         # preview by query
soul forget .soul/ "credit card" --apply                  # prompt + delete
soul forget aria.soul --entity "John Doe" --apply --confirm
soul forget .soul/ --before 2026-01-01T00:00:00 --apply
soul forget .soul/ --id bf0ee3453983 --apply              # surgical single-id

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
QUERY No Search query for memories to delete.

Options:

Option Description
--id TEXT Delete a single memory by exact ID. Mutually exclusive with QUERY, --entity, --before.
--entity TEXT Delete by entity name instead of query.
--before TEXT Delete memories before an ISO timestamp.
--apply Actually execute the deletion. Without this flag, forget is a preview only.
--confirm Skip the confirmation prompt (requires --apply).

Exactly one of QUERY, --id, --entity, or --before is required. Without --apply you get a count + per-tier breakdown without changes. With --apply, the runtime confirms (unless --confirm), writes a .soul.bak, deletes, saves, and reports.

Output: A preview line (or post-action line) of the form would forget N memories from <name> (or Forgot N memories ...), followed by per-tier counts. Per-tier display reads from the result dict's episodic / semantic / procedural / social lists; if you script the runtime API directly the same shape is returned.


soul supersede

Mark a memory as superseded by a new one. The old entry is preserved in storage so provenance is not lost — search filters out superseded entries by default, so recall surfaces the new memory.

soul supersede .soul/ "X actually shipped on 2026-04-21" \
    --old-id bf0ee345 --reason "verified against current code"

soul supersede aria.soul "User now prefers light mode" \
    --old-id 4c19e2 --type semantic -i 7

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
NEW_CONTENT Yes The corrected memory text.

Options:

Option Description
--old-id TEXT ID of the memory being superseded. Required.
--reason TEXT Why the old memory is wrong or out-of-date (recorded in the supersede audit).
--importance / -i INT Importance score for the new memory (1-10, default: 5).
--emotion / -e TEXT Emotion tag for the new memory.
--type / -t {episodic,semantic,procedural,social} Tier for the new memory. Defaults to the old entry's tier.

Output: A panel showing the old ID, new ID, tier, reason, and the new content. Saves the soul automatically. Exits non-zero if --old-id does not resolve.

Audit: Every successful supersede writes an entry to the supersede audit trail, exposed via Soul.supersede_audit. Internal supersession (dream-cycle dedup, contradiction resolution during learn) does not write to this trail — it is for explicit user intent only.

v0.5.0 (#192): the new entry's supersedes back-edge is set to the old id, and the chain entry now carries prediction_error. Default PE is 0.85 — the supersede band. Lower PE raises PredictionErrorOutOfBandError because update is the right verb for that range.


soul confirm (v0.5.0, #192)

Refresh activation on a memory you have just verified.

Bumps the entry's last_accessed, increments access_count, and clamps retrieval_weight back toward 1.0 if it had decayed. Appends a memory.confirm chain entry. The "this is still right" verb — no PE supplied, no window check.

soul confirm .soul/ bf0ee3453983
soul confirm aria.soul abc123def --user prakash

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
MEMORY_ID Yes ID of the memory to confirm.

Options:

Option Description
--user TEXT Optional user_id recorded on the chain entry.

soul update (v0.5.0, #192)

Patch a memory in place inside the reconsolidation window (PE in [0.2, 0.85)).

The window opens whenever a recall surfaces this id and stays open for one hour. Outside the window an in-place update is unsafe — the call raises and the caller should switch to soul supersede. The CLI runs a small recall against the current entry content first so the window opens in this single invocation; you do not need to call soul recall separately.

soul update .soul/ bf0ee3453983 --patch "ships in July, not May"
soul update aria.soul abc123def --patch "..." --prediction-error 0.4

PE bands (locked):

  • PE < 0.2 → use soul confirm
  • PE in [0.2, 0.85) → soul update (this command)
  • PE >= 0.85 → use soul supersede

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
MEMORY_ID Yes ID of the memory to patch.

Options:

Option Description
--patch TEXT Replacement content for the entry. Required.
--prediction-error FLOAT PE in [0.2, 0.85). Default 0.5.
--user TEXT Optional user_id recorded on the chain entry.

Exits non-zero on PE band violation or closed window.


soul purge (v0.5.0, #192)

Hard delete a memory (GDPR / privacy / safety).

Genuinely removes the entry from storage. Defaults to dry-run preview — pass --apply to commit. The trust chain still records the purge with the prior payload hash so verifiers can later prove the entry once existed and was deleted, without storing the deleted content.

soul reinstate cannot recover a purged entry — for non-destructive suppression, use soul forget instead.

soul purge .soul/ --id bf0ee3453983              # preview only
soul purge .soul/ --id bf0ee3453983 --apply --confirm

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--id TEXT ID of the memory to hard-delete. Required.
--apply Commit the deletion. Without this flag, purge is a preview.
--confirm Skip the confirmation prompt (requires --apply).
--user TEXT Optional user_id recorded on the chain entry.

soul reinstate (v0.5.0, #192)

Restore a forgotten memory to full retrieval weight.

The inverse of soul forget. Sets retrieval_weight back to 1.0 so recall surfaces the entry again. No-op for entries already at full weight; cannot recover a purged entry.

soul reinstate .soul/ bf0ee3453983
soul reinstate aria.soul abc123def --user prakash

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.
MEMORY_ID Yes ID of the memory to reinstate.

Options:

Option Description
--user TEXT Optional user_id recorded on the chain entry.

soul upgrade (v0.5.0, #192)

Upgrade a soul archive's memory schema to a newer format. The 0.4.x → 0.5.0 upgrade derives the supersedes back-edge from the existing superseded_by reverse map. Pydantic v2 backfills retrieval_weight=1.0 and prediction_error=None at load time, so the only field this command actually persists is the back-edge.

Idempotent — re-running on a 0.5.0 soul is a no-op.

soul upgrade aria.soul --to 0.5.0
soul upgrade aria.soul --to 0.5.0 --dry-run

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--to TEXT Target soul format version. Default 0.5.0.
--dry-run Print the migration plan without writing.

soul edit-core

Edit a soul's core memory — the always-loaded persona and human knowledge sections.

soul edit-core .soul/ --persona "I am a helpful coding assistant"
soul edit-core aria.soul --human "User prefers Python and dark mode"
soul edit-core .soul/ --persona "New persona" --human "New human"

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--persona TEXT Set the persona text.
--human TEXT Set the human knowledge text.

At least one of --persona or --human is required.

Output: A panel showing the updated core memory. Saves the soul automatically.


soul evolve

Manage soul evolution — propose, approve, reject, or list mutations.

# Propose a mutation
soul evolve .soul/ --propose --trait communication.warmth --value high --reason "User prefers warmth"

# List pending and historical mutations
soul evolve .soul/ --list

# Approve or reject
soul evolve .soul/ --approve abc123
soul evolve .soul/ --reject abc123

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--propose Propose a new mutation. Requires --trait, --value, and --reason.
--trait TEXT Trait to mutate (with --propose).
--value TEXT New value for trait (with --propose).
--reason TEXT Reason for mutation (with --propose).
--approve ID Approve a pending mutation by ID.
--reject ID Reject a pending mutation by ID.
--list List pending mutations and evolution history.

soul evaluate

Evaluate an interaction against a rubric. Scores the interaction, stores learning as procedural memory, and adjusts skill XP based on the score.

soul evaluate .soul/ --user-input "Explain recursion" --agent-output "Recursion is..."
soul evaluate aria.soul --user-input "Fix this bug" --agent-output "Here's the fix" --domain coding

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--user-input TEXT User's message. Required.
--agent-output TEXT Agent's response. Required.
--domain TEXT Domain for rubric selection.

Output: A panel showing overall score, rubric ID, individual criteria results, and extracted learning.


soul learn

Evaluate an interaction and create a learning event if notable. Combines evaluation with the learning pipeline — extracts lessons, grants XP, and stores procedural memory.

soul learn .soul/ --user-input "Explain recursion" --agent-output "Recursion is..."
soul learn aria.soul --user-input "Fix this bug" --agent-output "Here's the fix" --domain coding

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--user-input TEXT User's message. Required.
--agent-output TEXT Agent's response. Required.
--domain TEXT Domain for rubric selection.

Output: A panel showing the lesson, domain, confidence, score, and associated skill. Prints a notice if no notable learning was found.


soul skills

View a soul's skills with level, XP, and progress bars.

soul skills .soul/
soul skills aria.soul

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Output: A table showing each skill's name, level, current XP, XP to next level, and a progress bar.


soul bond

View or modify the soul's bond with its bonded entity.

soul bond .soul/
soul bond aria.soul --strengthen 5.0

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Description
--strengthen FLOAT Strengthen the bond by this amount.

Output: A panel showing bonded entity, bond strength (with progress bar), interaction count, and bond start date.


soul events

View general events (Conway's autobiographical memory hierarchy). Shows themed event clusters from the soul's history.

soul events .soul/
soul events aria.soul --recent 20

Arguments:

Argument Required Description
PATH Yes Path to a soul file or .soul/ directory.

Options:

Option Short Description
--recent INT -n Number of recent events to show. Defaults to 10.

Output: A table showing each event's theme, episode count, start date, and last update date.


soul context

LCM (Lossless Context Management) operations — ingest messages, assemble context windows, search history, and view metadata. Works standalone with an in-memory SQLite store.

# Ingest a message
soul context --ingest --role user --content "Hello there"

# Assemble a context window
soul context --assemble --max-tokens 4000

# Search context history
soul context --grep "hello"

# View store metadata
soul context --describe

Arguments:

Argument Required Description
PATH No Path to a soul file (optional, for soul-scoped context).

Options:

Option Description
--ingest Ingest a message into context. Requires --role and --content.
--role TEXT Message role (with --ingest).
--content TEXT Message content (with --ingest).
--assemble Assemble a context window from stored messages.
--max-tokens INT Token budget (with --assemble).
--grep PATTERN Search context history by regex pattern.
--describe Show context store metadata (message count, tokens, date range).

Org Layer (v0.3.1)

The soul org, soul template, soul user, and soul create command groups ship in v0.3.1. See also Org Management for the bootstrap walkthrough and Org Journal Spec for the wire-level contract.

soul org init

Bootstrap an empty directory into a working org. Creates a root governance soul, generates an Ed25519 signing keypair, opens a SQLite WAL journal, and writes the genesis events (org.created, one scope.created per first-level scope). Optionally seeds a starter fleet.

soul org init --org-name "Acme" --purpose "AI tooling" --non-interactive
soul org init --org-name "Acme" --values "audit,velocity,kindness" \
  --founder-name "Pat" --founder-email "pat@acme.com" \
  --scopes "org:sales,org:ops" --fleet sales --non-interactive

Options:

Option Default Description
--org-name TEXT Organization name. Required in --non-interactive mode.
--purpose TEXT Mission statement. Lands in the root soul's persona.
--values TEXT Comma-separated org values (3-5 recommended).
--founder-name TEXT Founder's display name.
--founder-email TEXT Founder's email.
--scopes TEXT Comma-separated first-level scopes, e.g. org:sales,org:ops.
--fleet [sales|support|solo|skip] skip Starter fleet to seed.
--data-dir PATH ~/.soul/ Where to create the org. Also honors $SOUL_DATA_DIR.
--users-dir PATH nested under --data-dir Where founder user souls live. Also honors $SOUL_USERS_DIR.
--force off Overwrite an existing non-empty data-dir.
--non-interactive off Fail instead of prompting. Requires --org-name.

Re-running init against an initialized directory refuses to proceed unless --force is passed. Every step emits a journal event so the org state is reconstructable from the event log alone.


soul org status

Print a human-readable snapshot of an initialized org: DID, journal head, event count, data-dir location, root soul seal status. Read-only.

soul org status
soul org status --data-dir /path/to/org
soul org status --json

Options:

Option Description
--data-dir PATH Org dir to inspect. Defaults to ~/.soul/ or $SOUL_DATA_DIR.
--json Emit machine-readable JSON instead of a Rich panel.

soul org destroy

Tarball the org to the archives dir, then wipe the data-dir. Terminal — there is no undo. Requires two explicit flags plus (in interactive mode) typing the org name at a prompt.

soul org destroy --confirm --i-mean-it
soul org destroy --confirm --i-mean-it --non-interactive  # tests, scripted teardown

Options:

Option Default Description
--data-dir PATH ~/.soul/ Org dir to destroy. Also honors $SOUL_DATA_DIR.
--archives-dir PATH ~/.soul-archives/ Where the tarball lands. Sibling of the org dir by default, so the archive survives the wipe. Also honors $SOUL_ARCHIVES_DIR.
--confirm Required guard rail.
--i-mean-it Required guard rail (second one).
--non-interactive Skip the typed-name prompt.

The destroy path writes the archive first and removes the data-dir only on success. If the archive write fails, the org is left intact.


soul template list

List every bundled role archetype. v0.3.1 ships Arrow, Flash, Cyborg, and Analyst — each with pre-baked DNA, communication style, and scope defaults.

soul template list

soul template show

Print the raw YAML for a single bundled template. Useful for copying into your own overrides.

soul template show arrow

soul create

Instantiate a new .soul/ directory from a bundled template. Pairs with soul template list — pick a name, stamp it out.

soul create --template arrow
soul create --template analyst --name Sage --dir .sage --format zip

Options:

Option Default Description
--template TEXT Required Bundled template name (arrow, flash, cyborg, analyst).
--name TEXT template default Override the soul's display name.
--dir TEXT .soul Directory to write the new soul to.
--format [dir|zip] dir Write as an unpacked directory or a .soul zip archive.

soul user invite

Placeholder for the org invite flow. Accepted today so hooks can wire it up in advance; the real implementation lands in a follow-up PR. Prints a hint and exits non-zero so callers don't mistake it for a completed invite.

soul user invite pat@acme.com

Journal (#189)

The soul journal command group exposes the org-level event journal (the SQLite WAL backend behind soul org init) to shell hooks, CI scripts, and non-Python runtimes. Three subcommands cover the shell cases: init, append, query. The Python API stays the only surface for advanced cases (custom backends, typed payload models per action).

This is the right answer when you want a queryable, append-only, hash-chained log keyed by action — not the same shape as soul remember (BM25 fuzzy memory). See Org Journal Spec for the wire-level contract.

soul journal init

Bootstrap a standalone SQLite WAL journal file at <path>. Distinct from soul org init — no root soul, no founder, no scope tree. Useful for an event log without the full org bootstrap, like a workspace session log, a CI audit trail, or a migration scratch pad.

soul journal init ./.journal.db
soul journal init /tmp/ci-audit.db --force
Option Description
--force Overwrite an existing journal file (and the -wal / -shm sidecars).

soul journal append

Append one or more events to a journal. Single-event mode takes flags; --stdin reads one JSON object per line and batches them into a single Journal session. The committed EventEntry is echoed to stdout as JSON (with backend-assigned seq and prev_hash), so scripts can capture the event id for a follow-up --causation-id chain.

soul journal append ./.journal.db \
    --action session.pr.merged.pocketpaw \
    --actor '{"kind":"agent","id":"did:soul:claude-code"}' \
    --payload '{"pr":1021,"sha":"abc"}' \
    --scope session:abc123 --scope repo:pocketpaw

# Stdin batch
echo '{"action":"foo","scope":["s:1"],"payload":{}}' \
    | soul journal append ./.journal.db --stdin
Option Required Description
--action TEXT yes (single mode) Dot-separated action name. Action namespace is open — see Org Journal Spec for the catalog.
--actor JSON no JSON object matching Actor (kind + id). Defaults to {"kind":"system","id":"cli"}.
--payload JSON no JSON object stored as the event payload. Defaults to {}.
--scope TEXT yes (single mode) Scope tag. Repeatable. Events without scope are rejected.
--causation-id UUID no UUID of the prior event that caused this one (decision-trace chains).
--correlation-id UUID no UUID grouping this event with related events (session/flow id).
--stdin no Read JSONL events from stdin instead of using the flags. Mutually exclusive with the other event flags.

In --stdin mode each line is a JSON object with the same field names as the flag form (action, scope, actor, payload, causation_id, correlation_id, optional id, optional ts). Blank lines are skipped. Malformed lines abort the batch with a non-zero exit code so callers don't silently drop events.

soul journal query

Query events from a journal. Default output is a Rich table; --json emits a JSON array of EventEntry records.

soul journal query ./.journal.db --action-prefix session.pr.
soul journal query ./.journal.db --since 2026-04-24T00:00:00Z
soul journal query ./.journal.db --at 2026-04-20T12:00:00Z
soul journal query ./.journal.db --scope session:abc123 --limit 50 --json
Option Description
--action TEXT Exact action match.
--action-prefix TEXT Match action and any descendant in the dotted namespace. Trailing dot tolerated (session.pr. and session.pr are equivalent). Mutually exclusive with --action.
--scope TEXT Scope tag to match. Repeatable; conjunction.
--correlation-id UUID Filter to a single correlation_id (session/flow id).
--since ISO8601 Lower bound on timestamp (inclusive).
--until ISO8601 Upper bound on timestamp (inclusive).
--at ISO8601 Point-in-time replay — only return events <= this. Mutually exclusive with --until.
--limit INT Max results (default 100).
--offset INT Pagination offset.
--json Emit a JSON array instead of the Rich table.

Shell-hook example

A minimal post-commit hook in .git/hooks/post-commit that records every commit into a per-workspace journal:

#!/usr/bin/env bash
set -e
SHA=$(git rev-parse HEAD)
TITLE=$(git log -1 --pretty=%s)
soul journal append ./.journal.db \
    --action session.commit.pushed \
    --actor "{\"kind\":\"agent\",\"id\":\"did:soul:$USER\"}" \
    --payload "{\"sha\":\"$SHA\",\"title\":\"$TITLE\"}" \
    --scope "repo:$(basename "$PWD")" \
    --scope "session:$(date +%Y-%m-%d)" >/dev/null

A next-session soul journal query ./.journal.db --action-prefix session. returns clean structured history.


Environment Variables

The CLI resolves paths in this order: explicit flag > environment variable > default. All three variables are honored by soul org init, soul org status, soul org destroy, and any other command that touches the org data-dir.

Variable Affects Default Description
SOUL_DATA_DIR --data-dir ~/.soul/ Root directory for the org: root.soul, keys/, journal.db.
SOUL_USERS_DIR --users-dir nests under --data-dir (so --data-dir /tmp/foo yields /tmp/foo/users/); falls back to ~/.soul/users/ when neither is set Where founder and invited user souls live. Pre-v0.3.1 this was hardcoded to ~/.soul/users/, which silently polluted home directories during isolated demos and CI runs.
SOUL_ARCHIVES_DIR --archives-dir ~/.soul-archives/ Archive destination for soul org destroy. Sibling of the org dir so it survives the wipe.

These are also documented in Configuration.


Soul Maintenance (v0.2.7)

soul health <path>

Audit a soul's health — memory tiers, duplicates, orphan graph nodes, skills, bond.

soul health .soul/

Shows a panel with:

  • Memory tier counts (episodic, semantic, procedural, social)
  • Knowledge graph nodes, skills, evaluation history count
  • Bond strength and interaction count
  • Issues: duplicates (>80% overlap), orphan graph nodes, skill/bond integrity

soul cleanup <path>

Remove duplicates, stale evaluations, and orphan graph nodes.

soul cleanup .soul/ --dry-run          # preview without changes
soul cleanup .soul/ --auto             # apply all cleanups
soul cleanup .soul/ --no-dedup         # skip duplicate removal
soul cleanup .soul/ --low-importance 2 # remove memories with importance ≤ 2
Option Description
--dry-run Preview what would be cleaned without changing anything
--auto Apply all cleanups without prompting
--dedup / --no-dedup Toggle near-duplicate removal (default: on)
--stale-evals / --no-stale-evals Toggle stale evaluation procedural cleanup (default: on)
--orphan-nodes / --no-orphan-nodes Toggle orphan graph node cleanup (default: on)
--low-importance N Remove memories with importance ≤ N (default: 0 = skip)

soul repair <path>

Targeted fixes for corrupted or stale soul state.

soul repair .soul/ --reset-energy      # energy + social battery → 100%
soul repair .soul/ --reset-bond        # bond strength → 50.0
soul repair .soul/ --rebuild-graph     # re-extract entities from all memories
soul repair .soul/ --clear-evals       # wipe evaluation history
soul repair .soul/ --clear-skills      # wipe all learned skills
soul repair .soul/ --clear-procedural  # wipe procedural memories
Option Description
--reset-energy Reset energy and social battery to 100%
--reset-bond Reset bond strength to 50.0
--rebuild-graph Clear graph and re-extract entities from all memories
--clear-evals Clear evaluation history
--clear-skills Clear all learned skills
--clear-procedural Clear all procedural memories

Eternal Storage

soul archive

Archive a .soul file to eternal storage tiers (IPFS, Arweave, Blockchain). Uses mock providers by default.

soul archive my-soul.soul
soul archive .soul/ -t ipfs -t arweave

Arguments:

Argument Required Description
PATH Yes Path to a .soul file or .soul/ directory.

Options:

Option Short Description
--tiers TIER -t Storage tiers to archive to (repeatable). If omitted, archives to all mock providers.

Output: A table showing each tier's name, reference hash (truncated), cost, and whether storage is permanent. Archive references are persisted into the .soul manifest.


soul recover

Recover a soul from eternal storage by its reference hash.

soul recover QmRef123... --tier ipfs --output recovered.soul
soul recover arweave_ref_456 --tier arweave --output my-soul.soul

Arguments:

Argument Required Description
REFERENCE Yes The storage reference hash returned by soul archive.

Options:

Option Short Description
--tier TIER -t Which tier to recover from: ipfs, arweave, or blockchain. Default: ipfs.
--output PATH -o Output file path (required).

Output: Writes the recovered .soul file to the output path and prints the byte count.


soul eternal-status

Show eternal storage references for a .soul file. Reads the manifest inside the archive and displays any previously archived tiers and their references.

soul eternal-status my-soul.soul
soul eternal-status .soul/

Arguments:

Argument Required Description
PATH Yes Path to a .soul file or .soul/ directory.

Output: A table showing each archived tier, its reference, and timestamp.


Trust chain (#42)

soul verify

Verify the trust chain integrity of a soul. Exits 0 on a valid chain, 1 on tampering.

soul verify <path>
soul verify <path> --json

Arguments:

Argument Required Description
PATH Yes Path to a .soul file or .soul/ directory.

Options:

Option Type Default Description
--json flag false Emit machine-readable JSON.

Examples:

soul verify .soul/
soul verify aria.soul
soul verify aria.soul --json | jq .valid

Human output: soul name, chain length, signer count, and time span between first/last entry.

JSON output: {soul, did, valid, length, signers, first_failure, time_span_seconds}.


soul audit

Print a human-readable timeline of every signed action on the soul's trust chain.

soul audit <path>
soul audit <path> --filter memory.
soul audit <path> --limit 20
soul audit <path> --json
soul audit <path> --no-summary  # hash-only view

Arguments:

Argument Required Description
PATH Yes Path to a .soul file or .soul/ directory.

Options:

Option Type Default Description
--filter <prefix> str none Filter to actions starting with <prefix> (e.g. memory.).
--limit <N> int none Show only the most recent N entries.
--json flag false Emit machine-readable JSON.
--no-summary flag false Hide the Summary column and show the hash only (#201).

The default output is a Rich table with columns Seq, Timestamp, Action, Actor, Summary, Payload Hash. The Summary column shows a short human-readable description per entry — for example, 3 memories for a memory.write action or +0.50 for alice for bond.strengthen. Pass --no-summary for the hash-only view that 0.4.0 shipped with.

JSON output always includes summary on each row; --no-summary only affects the human table. Pre-#201 entries that have no summary field stored on disk return summary="" after Pydantic loads the legacy shape.

Payloads are stored as hashes only — the table shows what changed when, not what was written.


soul eval

Run YAML-driven soul-aware evals against a freshly seeded soul. The eval framework lets you pin the soul's state (memories, OCEAN, bonds, mood, energy) before each test runs, so you can measure memory-driven behaviour rather than just stateless input-output.

It also scores plain prompts and skill outputs. A case with mode: prompt skips the soul and scores the case text verbatim — point it at a workspace prompt or a skill's output (for example /humanize) to catch regressions when that prompt or skill changes. See eval-format.md for the full schema, including the prompt mode and the humanizer_skill.yaml reference spec.

soul eval <path>
soul eval <directory>
soul eval <path> --filter "creative"
soul eval <path> --json
soul eval <path> --judge-engine module:attr

Arguments:

Argument Required Description
TARGET Yes Path to a .yaml / .yml eval file, or a directory of them.

Options:

Option Type Default Description
--filter <substring> str none Run only cases whose name contains <substring>.
--judge-engine <module:attr> str none Engine for judge and respond-mode cases. The attribute can be a class (instantiated with no args) or a callable returning an engine. Without one, judge cases are marked SKIP.
--json flag false Emit machine-readable JSON instead of the Rich table.
--verbose / -v flag false Include per-case details / errors in table rows.

Examples:

soul eval tests/eval_examples/personality_expression.yaml
soul eval tests/eval_examples/                                  # all .yaml in dir
soul eval tests/eval_examples/ --filter "creative"
soul eval my_eval.yaml --json | jq '.specs[].cases'
soul eval my_eval.yaml --judge-engine my_module:make_engine

# Score the /humanize skill (prompt-mode spec). The judge cases need an
# engine; without one they SKIP and only the deterministic checks run.
soul eval tests/eval_examples/humanizer_skill.yaml --judge-engine my_module:make_engine

Output: one Rich table per spec (Case, Status, Score, Time, optional Details), plus a summary footer with totals. --json returns {specs: [...], duration_ms, pass_count, fail_count, skip_count, error_count}.

Exit codes: 0 when every case passes (skipped cases don't fail the run); 1 when any case fails or any spec errors out.


soul optimize

Run the autonomous self-improvement loop against a soul (v0.5.0, issue #142). Reads an eval spec, identifies failing cases, proposes knob changes (OCEAN traits, persona text, memory thresholds, bond strength), applies and re-scores. Improvements are kept; everything else is reverted. Defaults to dry-run — no soul state mutates unless you pass --apply. See soul-optimize.md for the full concept overview.

soul optimize <soul-path> <eval.yaml>
soul optimize <soul-path> <eval.yaml> --iterations 20 --target 0.9
soul optimize <soul-path> <eval.yaml> --apply
soul optimize <soul-path> <eval.yaml> --json
soul optimize <soul-path> <eval.yaml> --engine module:Class

Arguments:

Argument Required Description
SOUL_PATH Yes Path to a .soul file or .soul/ directory.
EVAL_SPEC_PATH Yes Path to a .yaml / .yml eval spec.

Options:

Option Type Default Description
--iterations / -n <N> int 10 Maximum optimization iterations.
--target <X> float 1.0 Stop early when the eval score reaches this threshold.
--apply flag false Keep the winning trajectory and append soul.optimize.applied trust-chain entries. Without this flag every change reverts at end.
--engine <module:attr> str none Engine for judge cases and the LLM-assisted proposer. Without an engine the heuristic proposer fires and judge cases skip.
--json flag false Emit the full OptimizeResult as JSON instead of the Rich table.

Examples:

# Dry-run preview against the personality-expression eval
soul optimize aria.soul tests/eval_examples/personality_expression.yaml

# Apply the winning trajectory; trust chain records each kept change
soul optimize aria.soul eval.yaml --apply

# Tighter convergence target
soul optimize aria.soul eval.yaml --iterations 20 --target 0.9

# Pipe the JSON output for downstream processing
soul optimize aria.soul eval.yaml --json | jq '.steps | map(select(.kept))'

Output: a Rich table with one row per trial (iteration, knob, before, after, score change, kept) plus a summary line baseline X → final Y (Δ) · ran/converged · N knobs touched · duration · APPLIED|dry-run. --json returns the full OptimizeResult Pydantic dump (baseline_score, final_score, target_score, iterations_run, convergence_iteration, steps, knobs_touched, applied, duration_ms).

Exit codes: always 0 on a successful run — the loop is informational. Inspect the JSON output for hard pass/fail logic.

Safety rails: --apply is opt-in. The default dry-run reverts every change applied during the run so the soul on disk stays byte-identical. With --apply, only changes that strictly improved the eval score are kept, and each kept change appends one signed soul.optimize.applied trust-chain entry with payload {knob_name, before, after, score_delta} for full audit.


soul prune-chain

Compress old trust-chain history into a signed chain.pruned marker (v0.5.0, issue #203). Dry-run by default — pass --apply to mutate the chain. Genesis (seq=0) is always preserved.

soul prune-chain <path>                       # preview, uses biorhythm cap
soul prune-chain <path> --keep 100            # preview, custom threshold
soul prune-chain <path> --keep 100 --apply    # execute the prune
soul prune-chain <path> --json --apply        # machine-readable output

Arguments:

Argument Required Description
PATH Yes Path to a .soul file or .soul/ directory.

Options:

Option Type Default Description
--keep <N> int from Biorhythms.trust_chain_max_entries Length threshold. When the chain has more than N entries, every non-genesis entry is compressed into a single signed marker.
--apply flag false Actually run the prune. Without this flag, the command previews only.
--reason <str> str manual Free-form label written onto the marker payload.
--json flag false Emit machine-readable JSON.

When the chain is already at or below --keep, the command reports applied=False with a zero-count summary.

JSON output: {soul, did, applied, summary, chain_length, keep}. summary carries {count, low_seq, high_seq, reason, marker_seq}.

This is the touch-time stub. The full archival design (separate trust_chain/archive/ directory with checkpoint entries) is deferred to v0.5.x. See docs/trust-chain.md.

Exit codes: 0 on success (whether or not anything was pruned); 2 when no --keep is provided AND the soul has no biorhythm cap (auto-prune disabled).


Diff (#191)

soul diff <left> <right>

Compare two soul files at the soul level — identity, OCEAN, state, core memory, memories, bond, skills, trust chain, self-model, evolution. Read-only; never modifies either input. Works for any combination of zip and dir formats.

soul diff aria.soul aria-after-week.soul
soul diff aria.soul aria-after-week.soul --json
soul diff aria.soul aria-after-week.soul --section memory
soul diff aria.soul aria-after-week.soul --include-superseded
soul diff aria.soul aria-after-week.soul --format markdown

Options:

Option Description
--format [text|json|markdown] Output format. text is the default Rich panel; json emits a SoulDiff dict; markdown emits a paste-ready table for PR bodies.
--json Shortcut for --format json.
--section <name> Narrow to one section. Accepts identity, ocean (alias dna), state, core (alias core-memory), memory, bond, skills, trust (alias trust-chain), self (alias self-model), evolution.
--include-superseded Show the supersession chain explicitly. By default, memories whose superseded_by field changed are filtered out of the modified list since they still live in the file — but reviewers usually want to see the new memory, not the chain.
--summary-only Print per-section counts instead of the full diff.

Output structure (text mode):

Soul diff: aria → aria-after-week

Identity
  (no changes — section omitted)

OCEAN / DNA
  openness          ↑ 0.020
  conscientiousness ↓ 0.010

Memories
  Layer counts
    semantic   2 → 4
    procedural 0 → 1
  + semantic   id=34e53f imp=8: 'Second test memory: this is the kind of...'
  ~ semantic   id=78ef90: importance 7 → 9
  + procedural id=11223344 imp=5: 'New how-to: ...'

Bond
  user            Strength             Interactions
  (default)       50.0 ↑ 53.5          0 → 7
  alice           50.0 ↑ 51.2          0 → 3
  + new bonded users: alice

Skills
  + analyst (level 1, 0 XP)

Sections are omitted when empty so a no-op diff stays terse. JSON output always includes the full structure.

Schema mismatch:

Different schema versions on the two souls error out cleanly:

$ soul diff old.soul new.soul
error: Schema version mismatch: left='1.0.0', right='1.1.0'. Soul diff
requires both files to share a schema version. Migrate the older soul
with `soul migrate <path>` first.

Programmatic use:

from soul_protocol.runtime import Soul, diff_souls

left = await Soul.awaken("aria.soul")
right = await Soul.awaken("aria-after-week.soul")
diff = diff_souls(left, right, include_superseded=False)
print(diff.summary())
# {"identity": 0, "memories_added": 2, "bonds": 1, ...}

The returned SoulDiff is a Pydantic model — see API reference for the full field list.


Graph layer (#108, #190)

soul graph is a subcommand group for inspecting the knowledge graph. Five subcommands cover listing, traversal, and human-readable rendering.

soul graph nodes <path>

soul graph nodes <path> [--type TYPE] [--match SUBSTRING] [--limit N] [--json]

List nodes in the graph. The default output is a Rich table with id, type, and provenance (the memory ids that produced the entity). Pass --json for machine-readable output.

Option Type Default Description
--type str none Filter by entity type (built-in or custom).
--match str none Case-insensitive substring filter on entity name.
--limit int none Cap the number of rows.
--json flag false Emit JSON.
soul graph nodes mysoul.soul --type person --json
soul graph nodes mysoul.soul --match alice

soul graph edges <path>

soul graph edges <path> [--source X] [--target Y] [--relation R] [--json]

List active edges. Filters can be combined.

Option Type Default Description
--source str none Filter by source entity id.
--target str none Filter by target entity id.
--relation str none Filter by relation predicate.
--json flag false Emit JSON.
soul graph edges mysoul.soul --source Alice
soul graph edges mysoul.soul --relation owned_by --json

soul graph neighbors <path> <node_id>

soul graph neighbors <path> <node_id> [--depth N] [--types t1,t2] [--json]

List nodes within --depth hops of node_id (default 1). The starting node is always included with depth=0.

Option Type Default Description
--depth int 1 Maximum hops out from node_id.
--types str none Comma-separated whitelist of entity types for non-source nodes.
--json flag false Emit JSON.
soul graph neighbors mysoul.soul Alice --depth 2 --types person,tool

soul graph path <path> <source_id> <target_id>

soul graph path <path> <source_id> <target_id> [--max-depth N] [--json]

Find the shortest chain of edges from source_id to target_id. Returns the chain in traversal order. JSON output carries a found flag plus edges list.

Option Type Default Description
--max-depth int 4 Maximum hops to consider.
--json flag false Emit JSON.
soul graph path mysoul.soul Captain PR-1024 --max-depth 6

Exit code is 0 whether or not a path exists — the JSON found flag (or the textual "No path" message) signals the answer.

soul graph mermaid <path>

soul graph mermaid <path>

Print the full graph as a Mermaid graph LR block. Pipe into a Mermaid renderer (e.g. mmdc) for a visual:

soul graph mermaid mysoul.soul | mmdc -i - -o graph.png

Exit Codes

Code Meaning
0 Success
1 Error (missing file, invalid format, user cancelled, chain verification failed)
2 Configuration error (e.g. soul prune-chain invoked with no --keep and no biorhythm cap)

File Format Support

The CLI reads and writes these formats:

Extension Read Write Notes
.soul Yes Yes Zip archive, primary portable format
.yaml / .yml Yes Yes Human-editable config
.json Yes Yes Full SoulConfig serialization
.md Yes Yes Markdown (read: SOUL.md parser; write: DNA-only export)