The bootstrap and memory system is fully connected to the system prompt flow. Files are automatically loaded and injected into all interactions — in chat mode as well as in
/agent and /coder modes.Bootstrap Files
Bootstrap files are Markdown documents automatically loaded into the agent’s system prompt. They define who the assistant is, how it behaves, and which rules it should follow.Supported Files
ChatCLI loads exactly 5 bootstrap files, in this order. All are optional — if they don’t exist, they are simply skipped:| File | Purpose | When to use |
|---|---|---|
AGENTS.md | Sub-agent definitions and their roles | When you want to instruct the orchestrator about available agents and how to use them |
SOUL.md | Assistant personality, tone and style | To define “who” the assistant is — how it speaks, thinks and behaves |
USER.md | User preferences and project context | To inform the stack, conventions, preferred tools and project context |
IDENTITY.md | Agent identity and capabilities | To define “what” the assistant is — name, capabilities, limitations |
RULES.md | Explicit rules and restrictions | For strict guardrails — what it MUST and MUST NOT do |
Loading Priority
Files are searched at two levels, with the workspace taking priority:
If the same file exists at both levels, the workspace version prevails. Global files serve as fallback.
Detailed Examples
- SOUL.md
- USER.md
- IDENTITY.md
- RULES.md
- AGENTS.md
Defines personality and tone. Place at
~/.chatcli/SOUL.md (global) or ./SOUL.md (project):Where to Place Files
Smart Cache
Bootstrap files use mtime-based (modification time) caching:- On the first read, the content is cached in memory
- Subsequent reads check if the mtime has changed
- If the file was modified, the cache is automatically invalidated
IsStale()checks if any file has changed since the last load
Persistent Memory
The memory system maintains context across ChatCLI sessions, allowing the agent to “remember” facts, decisions, and patterns over time.Storage Structure
All memory lives in~/.chatcli/memory/:
Daily notes are stored directly in
YYYYMM/ subdirectories under ~/.chatcli/memory/, named as YYYYMMDD.md. There is no daily/ subdirectory.MEMORY.md — Long-Term Memory
~/.chatcli/memory/MEMORY.md stores persistent facts the agent receives in every interaction:
Daily Notes — Temporal Journaling
Daily notes record what happened each day. ChatCLI automatically loads the last 3 notes into the prompt. Each entry gets an automatic timestamp (hour:minute):How Memories Are Created
Memories are written automatically by a background worker. You don’t need to do anything.Automatic Annotation (Background Memory Worker)
ChatCLI runs a background worker that periodically analyzes conversation history and uses the AI to extract annotations:- After each AI response (in any mode: chat, agent, coder), the worker is nudged
- If there are 4+ new messages since the last extraction and at least 2 minutes since the last run, the worker fires
- The worker sends the new messages to the AI with a structured extraction prompt
- The AI returns two blocks: DAILY (what was done) and LONGTERM (new facts to remember)
- Results are automatically saved to
MEMORY.mdand the daily note - A subtle
⟳ updating memory...indicator briefly appears (only when the prompt is idle)
The process is completely transparent — you don’t need to intervene. The AI decides on its own what’s important to annotate. Facts already in MEMORY.md are not duplicated.
/memory Command — View and Load Notes
Use /memory to view and load annotations:
| Subcommand | Description |
|---|---|
/memory or /memory today | Show today’s notes |
/memory yesterday | Show yesterday’s notes |
/memory 2026-03-04 | Show notes from a specific date |
/memory week | Show notes from the last 7 days |
/memory longterm | Show MEMORY.md content |
/memory list | List all memory files |
/memory load <date> | Load a day’s notes into the current conversation context |
/memory load is especially useful for resuming work from previous days:
What goes in MEMORY.md vs daily notes?
What goes in MEMORY.md vs daily notes?
- MEMORY.md: Stable and long-lasting facts — architectural decisions, project patterns, team conventions, confirmed preferences. Accumulates across many sessions.
- Daily notes (
YYYYMM/YYYYMMDD.md): Temporal and specific records — what was done that day, errors found, files modified, tasks in progress.
Can I edit memories manually?
Can I edit memories manually?
Yes! The files are plain Markdown — edit with any editor:Changes are picked up automatically on the next interaction (cache invalidates by mtime).
What information does the AI extract automatically?
What information does the AI extract automatically?
The extraction worker asks the AI to identify:Daily notes (DAILY):
- Files read, modified or created (with paths)
- Commands executed and their outcomes
- Errors encountered and how they were resolved
- Tasks completed or in progress
- Architectural decisions made
- Patterns or conventions discovered/established
- User preferences expressed
- Insights about project structure
- Gotchas and technical constraints
What Gets Injected into the Prompt
The ContextBuilder assembles the following block and injects it as a system prompt prefix:Configuration
- Environment Variables
- Via Helm Chart
Context Injection Optimization (Prompt Caching)
ChatCLI optimizes token costs when contexts are attached using three complementary strategies:Unified System Prompt with Cache Hints
Contexts attached via/context attach are injected as system prompt, not as user messages. This enables provider-level prompt caching:
| Provider | Mechanism | Discount |
|---|---|---|
| Anthropic | cache_control: ephemeral | ~90% |
| OpenAI | Automatic prompt caching | ~50% |
| Context caching API | Variable |
- Bootstrap (SOUL.md, USER.md, etc.)
- Memory (MEMORY.md + daily notes)
- Attached Contexts (new — previously injected as user messages)
- K8s Watcher (if active)
Smart Compaction
Injected context messages (/memory load, summarized contexts) are automatically truncated during compaction (Level 1 — trimming). This prevents old reference context from consuming valuable token budget.
Token Visibility
The/context attached command now shows:
- Estimated tokens per context
- Total tokens per turn
- Cache hints per provider
- Warnings for oversized contexts
/context attach, the feedback includes the estimated cost per turn.
Best Practices
Global SOUL.md, per-project USER.md
Keep your preferred personality globally and technical context per project.
Keep MEMORY.md concise
Keep only stable and confirmed facts — not session-specific ones.
Daily notes for journaling
Use them to record decisions, solved problems, and temporal context.
Don't duplicate CLAUDE.md
If you already use CLAUDE.md or project instructions, avoid duplicating them in bootstrap.