Part I · Reference
Architecture
CNS gives coding agents separate tools for supervising sessions, routing model requests, remembering useful knowledge, checking project rules and navigating code. You can use an organ on its own or connect them through a coding harness. This page explains what passes between them during a task; the organ manuals cover everyday use.
1. Why Five Bounded Organs?
Monolithic agent frameworks conflate session orchestration, model routing, long-term memory, static code analysis and invariant verification. CNS separates those responsibilities so that a change to one does not require replacing the others.
- Cortex (repository access may be required) — Agent sessions and supervision
- Assign work to a seat—an agent identity with its own work context—then follow its conversations and steer its work. Cortex's daemon keeps session state; its interfaces connect you to the agents.
- Web and Slack are supervisory surfaces; the planned macOS and iOS native apps are specified client designs, not shipped applications.
- Keeps supervision controls separate from what the agent reads: routing state, voice settings and access holds stay outside the seat's cognitive context.
- Thalamus (repository access may be required) — Model relay
- Owns where configured neural requests land. Consumers require explicit endpoints; no organ invents a model host or model name.
- Separates the Intelligence plane (System 2 reasoning and session affinity), Verification plane (stateless System 1 rubric decisions via
/v1/systemone) and Knowledge plane (embedding and reranking). - Illustrative deployments may use several reasoning nodes and co-located verification/retrieval services. Node counts, model selections, cache-hit rates and latency are deployment-dependent, not guarantees.
- Engram (repository access may be required) — Reusable memory across sessions
- Record and recall selected decisions, procedures and lessons, together with their evidence. An OTE (Ontology, Topology, Epistemology) manifest sets the seat's memory budget, providers and five memory rings:
M0: Fleet canon (read_only).M1: Role archetype (read_nominate).M2: Repository / domain (read_write_nominate).M3: Mission / rig blackboard (read_write).M4: Seat overlay (owner_read_write).
- Tracks Beta(α, β) posteriors, renders a token-budgeted
<engram-block>and runs deterministic sleep consolidation. - Graduation requires attested evidence. Both the full posterior and
B_strong(only verified, attestedsealed_test/humanoutcomes, with a Beta(1, 1) prior) must meet the configured lower confidence bound (LCB) and minimum-sample thresholds. Structural, lint and rubric signals alone cannot graduate a memory. Without an attestation trust anchor, new graduation is blocked; imported graduations also require locally verified evidence. Seedocs/CONTRACTS.md§3.
- Record and recall selected decisions, procedures and lessons, together with their evidence. An OTE (Ontology, Topology, Epistemology) manifest sets the seat's memory budget, providers and five memory rings:
- Soma (repository access may be required) — Project rules and change checks
- Owns what must remain true. Authored invariants live in Git-tracked
docs/soma/README.mdanddocs/soma/concerns/*.md; generated maps and anchor manifests live in Git-excluded.soma/. - Binds concerns to source anchors and structural graph patterns. It reads Axon's change-set-bound
DeltaReportV1to identify relevant concerns. - Runs structural closeout verification. The System 1 rubric is optional and explicitly enabled; a rubric pass never clears structural red, and unavailable requested work is not evaluated, not passed.
- Owns what must remain true. Authored invariants live in Git-tracked
- Axon (repository access may be required) — Code navigation and change impact
- Find the code behind a behavior, follow its dependencies, and inspect what an edit could affect. Axon indexes symbols, calls, entry points and module dependencies in
.axon/axon.db(schema v18). - Provides
axon anchor-search,axon trace,axon deps-impact,axon feature-pathandaxon delta. Structural indexing and traversal are local; neural retrieval requires configured providers. - Each linked Git worktree has its own database. Matching
(content_hash, model)embeddings can be seeded from the main worktree rather than sharing its database.
- Find the code behind a behavior, follow its dependencies, and inspect what an edit could affect. Axon indexes symbols, calls, entry points and module dependencies in
Hippocampus is a separate local session archive, not part of this integrated workflow. Its current collector accepts synthetic fixtures only. Unlike Engram, it preserves records rather than selecting reusable knowledge.
2. End-to-End Task Lifecycle
The paths below identify the sender and receiver at each boundary. They are an integration outline: harnesses with shell access invoke the CLIs directly rather than requiring Cortex to dispatch every command.
-
Orient
Operator → Cortex or coding harness: dispatch a task to a seat or local session.
Seat / harness → Engram and Soma: load the OTE and memory block, then read generated maps and curated concerns. Engram supplies complete processes and addressable incomplete cues; Soma supplies structural orientation.
-
Retrieve
Seat / harness → Axon and Engram: search code anchors, trace call tracts and recall relevant memories.
Axon / Engram → Thalamus → configured Knowledge providers: optionally request embeddings and reranking. Results return to the requesting organ, which combines them with local lexical evidence; Thalamus does not search the memory store itself.
-
Execute
Cortex / configured harness → Thalamus → Intelligence provider: send reasoning requests with session affinity. Model responses return through the relay; the seat or harness executes tools and edits code locally.
-
Closeout gate
Operator / harness → cns gate → Axon and Soma: refresh an existing index, verify anchors and check concerns against Axon's DeltaReportV1.
Soma → Thalamus → Verification provider: only after explicit rubric opt-in, evaluate triggered questions. The gate returns pass, red or requested-oracle-not-evaluated; a rubric pass never clears structural red.
-
Consolidate
Harness / operator → Engram: record memories and attributable outcomes. cns curate → Axon, Soma and Engram: refresh maps, check recall and tolerance, and run memory maintenance and sleep.
Authorized attestor → Engram: supply signed sealed-test or human evidence against the configured trust anchor. Graduation requires both full and attested-strong posteriors to satisfy thresholds; structural or model-judged passes alone never suffice.
3. Operator Boundaries
Orient and retrieve
At session start, a configured harness renders Engram's <engram-block> within the OTE token budget (the example template uses 2,000 tokens). The seat reads .soma/codemap.md, .soma/arteries.md, .soma/registry.md and docs/soma/concerns/*.md when present.
For remote retrieval, Axon and Engram resolve explicit organ overrides, manifest/CLI configuration or THALAMUS_URL in that order. No endpoint is supplied by default. Local providers stay local. Hybrid retrieval combines lexical and dense candidates, then optionally reranks and diversifies them; see docs/CONTRACTS.md §1 and §3.
Execute
Thalamus derives a session fingerprint from an explicit session header or deterministic prompt prefix and pins reasoning requests to a configured provider. Contention-aware work stealing may move a request when a peer has capacity. Provider topology and tuning belong to deployment configuration; the architecture does not establish live fleet availability.
Close out
cns gate runs in a Soma-initialised repository:
- Run
axon indexwhen.axon/axon.dbexists. - Optionally run the project's own deterministic oracles,
typecheckandtests, configured in[gate.typecheck]/[gate.tests]of.cns/config.tomland requested inoracles. Their commands receive the changed files, the changed files plus 1-hop dependents, or the impacted tests fromaxon delta --json. - Run
soma verifyandsoma concerns check --check, retaining structural gating. - Evaluate concerns in the form certified at the change's merge base. Added or edited concerns are shadow-only for that run; an active base version still gates when edited or deleted.
- Optionally request the live rubric with
CNS_ORACLES=structural,rubricor top-leveloracles = ["structural", "rubric"]in.cns/config.toml. WithTHALAMUS_URLconfigured, discover a healthy verification model and call/v1/systemone. A typecheck or tests red skips it: System 1 does not score code that already failed deterministically. - Return exit 0 only when requested checks ran and passed, exit 1 for structural, typecheck, tests or rubric red, or exit 3 for requested work not evaluated. Exit 3 takes precedence over exit 1 while retaining the red reason.
cns gate runs only the commands configured for those oracles, within its budget; it is not a universal test runner, so run the full suite (cargo test, npm test, PHPUnit or others) separately as required. docs/CONTRACTS.md §5 is authoritative for model discovery, budgets and exit codes.
Consolidate without overstating evidence
Outcomes update attributable memories' α or β evidence; negative evidence can step an unreliable memory down. Sleep consolidates and nominates eligible memories according to the configured topology, not a universal M4 → M3 → M2 → M1 → M0 path. Nomination is distinct from graduation and does not imply automatic writes into read-only fleet canon.
Attested sealed_* / human_* outcomes cannot be supplied through MCP. They enter through engram outcome --attestation <ssh-signature> and must verify against the configured OpenSSH allowed-signers trust anchor. The seat does not need the attestor's private key. Guards are enforced locally, require signed overrides, and do not propagate by sync.