Nerva is designed as an agent runtime, not only a prompt wrapper.
The orchestration surface is intentionally visible so a project can change how the agent plans, gathers evidence, uses tools, recalls memory, compacts context, delegates to subagents, and reacts to runtime events.
High-level flow:
- CLI parses args and interactive controls.
- Bootstrap assembles settings, provider registry, tools, skills, extensions, MCP runtime, session state, and theme.
- Agent builds outbound context from system fragments, session transcript, memory recall, attached files, and prompt input.
- Provider adapter streams or returns model output.
- Tool, skill, MCP, and subagent calls are routed through the runtime.
- Turn trace records what happened.
- Context and memory systems decide what should survive.
Relevant source areas:
src/bootstrap/
src/agent/
src/app/
src/control/
src/events/
src/extensions/
src/subagents/
Built-in prompt fragments live in:
src/bootstrap/builtin/prompts/
They define the default posture for:
- orchestration
- workflow and verification
- tool and skill discipline
- code structure
- context and memory
- browser workflows
Project and user prompt fragments can be added under:
./.nerva/prompts/
~/.nerva/prompts/
Nerva exposes role tools that make workflow state visible:
plandevelopreviewfinish
The intent is to keep the model honest about what phase it is in and what proof is still missing.
Subagents let Nerva split work into child activity streams while preserving a parent session.
Useful controls:
/subagents
/subagent <id>
/subagent back
/subagent close <id>
The model-visible subagent tool is registered by default.
Extensions can observe or intercept runtime events.
Hook modes:
observeintercept
Intercept hooks can return actions:
call_toolcall_skillcall_mcpprompt_as_user
This makes extensions a practical orchestration layer without requiring an in-process plugin ABI.
See Extension SDK for the full hook contract.
MCP servers extend the tool surface through stdio servers.
Project config:
./.nerva/mcp.json
Controls:
/mcp servers
/mcp capabilities
/mcp init
/mcp reload
Nerva keeps context and memory separate:
- context is active working state for the next request
- memory is durable workspace knowledge that should survive turns
Context controls:
/context
/context full
/context diff
/compact
Memory tools:
memory_addmemory_searchmemory_delete
For a project-specific agent setup:
- Add
./.nerva/settings.json. - Add
./.nerva/prompts/for project rules. - Add
./.nerva/skills/for repeatable reasoning workflows. - Add
./.nerva/extensions/for commands, tools, and hooks. - Add
./.nerva/mcp.jsonfor external tool ecosystems. - Use
/context fulland/toolsto verify what the model can actually see.