Agent World Model
The agent is the primary author of its own brain. You're the editor. This doc covers the core concepts and the two ways to use Nervous Machine — autonomous mode where the agent learns on its own, and controlled mode where you define exactly what gets learned.
Overview
Every agent session starts from zero unless you give it something to build on. Nervous Machine is the learning layer — a structured model of what the agent has learned, with certainty scores that reflect how confident it is in each signal.
Nervous Machine is an MCP server your agent connects to over HTTP. Your agent calls tools — save_event, apply_learning, get_pod_summary — and Nervous Machine handles persistence. The pod lives on the server, not in the agent's context window, so it survives across sessions, models, and tools. Two things connect to every pod simultaneously: the agent (via tool calls) and the human (via chat). Any MCP-compatible client works — Claude, Gemini, Cursor, custom agents all connect to the same pod.
The key insight: the agent doesn't need you to write its brain for it. Given the right system prompt, it will observe what's relevant, save it, and build the knowledge graph on its own. The human role is alignment — auditing what the agent learned, correcting drift, and adding context the agent can't observe.
One agent, multiple lanes. Lanes describe what kind of context you're building — not separate systems. A real coding agent draws from the coding lane for codebase knowledge, the workflow lane for deployment patterns, and the chat lane for user preferences — all signals in one pod, all retrievable together via get_relevant_context. Mix them freely.
Two Modes
| Autonomous | Controlled | |
|---|---|---|
| Setup | Add system prompt snippet — done | Wire explicit tool calls into lifecycle hooks |
| Who decides what to save | The agent | You |
| Best for | Most use cases — let it learn naturally | When you need specific events, relationships, or precision |
| Human role | Align via chat — audit, correct, extend | Design the schema + align via chat |
| Code required | No — system prompt only | Yes — Python/JS/curl |
Most agents start in autonomous mode and add controlled saves for specific high-value signals as they mature. You don't have to choose one — they compose.
Autonomous Mode
Drop this into your system prompt. The agent handles the rest — loading context at session start, observing signals mid-session, surfacing curiosity triggers, and persisting what it learned at the end.
System prompt — drop in and adaptThat's it for most use cases. The agent will build its own model from sessions. The human aligns via chat. The pod compounds over time without any additional code.
Controlled Mode
Use controlled saves when you want to define specific events, build explicit relationships between signals, or attach resources to context. Controlled and autonomous compose — add explicit saves on top of the system prompt for signals you care about precisely.
Save a specific eventSee individual lane docs for controlled-mode patterns specific to coding, workflow, multi-agent, and device contexts. See the reference for the full tool index.
Lifecycle Hooks (Controlled Mode)
If you're wiring explicit code rather than relying on the system prompt, these four functions cover the full lifecycle. Each is drop-in Python — replace call_pod with your MCP client's tool call method.
Init — session start
Observe — mid-session signal
Error magnitude reference
| What happened | Magnitude | Direction |
|---|---|---|
| Independent corroboration | 0.05–0.1 | increase |
| Same-source repetition | 0.02–0.05 | increase |
| Specificity upgrade | 0.1–0.15 | increase |
| Temporal confirmation | ~0.1 | increase |
| User contradiction or correction | 0.2–0.4 | decrease |
Curiosity — periodic probe
Shutdown — session end
Signal Types
| Type | What it tracks | Example key |
|---|---|---|
| competence | Skill or knowledge level | python, distributed-systems |
| preference | Communication or work style | verbosity, code-before-explanation |
| claim | Tracked proposition or belief | microservices-preferred |
| entity | Named person, org, or tool | tool-terraform, company-acme |
| event | Incident, milestone, decision | auth-refactor-completed |
| metric | Measurable quantity | api-latency-p99 |
| pattern | Recurring behavior or trend | prefers-examples-over-theory |
| state | Current status or phase | project-alpha-status |
Certainty & Learning
Every event has a certainty score between 0 and 1. The system is agile where ignorant and stable where certain — learning rate adapts automatically. You set direction and magnitude; the system handles the rate.
| Range | Meaning | Behavior |
|---|---|---|
| 0.0 – 0.3 | Low — new or weakly supported | Updates fast, open to revision |
| 0.3 – 0.6 | Medium — building confidence | Moderate update rate |
| 0.6 – 0.8 | High — well-supported | Resists noise |
| 0.8 – 1.0 | Very high — established | Moves only on strong contradiction |
Always start new events at 0.3. Don't manually assign high certainty — let corroboration earn it.
Human Alignment
The agent builds what it can observe. Humans add what it can't — institutional context, intent, decisions made outside the session. The chat interface is the alignment layer for both modes. No code required on the human's end.
Design your agent to invite alignment. Surface curiosity triggers as natural conversation. Show what was saved at session end. Offer the Mermaid diagram periodically so humans can spot misalignments visually. The faster humans correct, the faster certainty converges on truth.