---
source_hash: 0bcf47ebef9a0b95efa9aa768121a25587f72eba0d71162a8a6ea2d70aab276f
post: /posts/memory/cortex
shape: doctrinal
---

# Context Pack: Cortex

Agent reference for the rewritten memory-layer essay. Only the quoted excerpts below are verbatim. Component figures are illustrative data, not measured guarantees for every corpus.

## Verbatim excerpts

> The system around the AI is the intelligence.

> Mechanical logs and tool noise stay out of the memory index.

> If two memories keep being retrieved together, the system creates a permanent edge between them.

> A token budget caps the material inserted into the session, and results remain grouped by region.

## Five rules

1. Files remain canonical; the index is derived. Retain the sources and any durable inputs needed to prove the rebuild path.
2. Decay changes retrieval ranking, not record existence. Retained items still lead to their sources.
3. Retrieve at session start and re-index on file change, rather than relying on a person to remember a command.
4. Index useful reasoning, decisions, prompts and outputs. Mechanical logs and tool noise are excluded.
5. Keep the memory contract independent of the model, with an appropriate adapter for each consumer.

The brain analogy organises the software; it is not a claim that a vector index behaves like a human brain or always retrieves the right answer.

## Structure and ranking

Known edges connect prompts to answers, images to descriptions, and every item to every other item in the same project. Repeated co-retrieval creates permanent edges. Unused edge weights may decay while the edges remain. Identity and core rules are exempt from decay.

The current project, recent material and task form the ordinary session-start query. Retrieve semantic candidates, then rank with four signals: region/layer, importance, co-activation and graph walk. A selected mode reweights the signals. Cap the result by tokens and group it by region before injecting it into turn one. A selection score is not an answer guarantee.

## Component reference data

`apps/web/components/blocks/CortexRegionMap.tsx` illustrates five categories: Language (`language`), Vision (`vision`), Episodic (`episodic`), Structure (`structure`) and Identity (`identity`). The hero SVG depicts four. Neither is a complete runtime schema or a decay contract. The older Cortex essay describes identity/core decay exemption as a design invariant; the separately inspected public ARI-OS implementation does not provide that exemption in its dream decay pass. See the source-checked [brain guide](/documents/ari-os/brain) for that implementation.

`apps/web/components/blocks/ConsolidationCompressor.tsx` defines five illustrative tiers:

| Key | Tier | Tokens per year in the illustration |
|---|---|---:|
| raw | Raw | 22,000,000 |
| session | Session | 8,000,000 |
| daily | Daily | 3,200,000 |
| weekly | Weekly | 1,400,000 |
| fact | Fact | 600,000 |

The ratio 22,000,000 / 600,000 is about 36.67, hence the design's roughly 37-fold figure. It is not a universal benchmark or a guarantee of lossless summarisation. Keep lineage through the compressed layers to the original material. The prose's longer-lived signal corresponds to the weekly tier.

`apps/web/components/blocks/BlindVsBrainBoot.tsx` illustrates turn-one context with identity, episodic and project groups. It is demonstration content, not live system configuration.

## Seven setup moves

1. Keep source notes, transcripts and files authoritative.
2. Build a derived index, such as SQLite plus a vector extension; chunk, embed and tag region/layer.
3. Add deterministic edges, including all-to-all connections within a project.
4. Form permanent co-retrieval edges; decay unused weights while retaining edges.
5. Retrieve and inject a bounded, region-grouped set at session start.
6. Re-index on changes and consolidate on a schedule, such as nightly.
7. Expose the contract via injected context, a thin adapter or MCP.

The code example names `index.db`, `session-start`, `on-change`, `nightly`, `injected-context` and `mcp-server`. Local defaults can run offline without a paid API. Different model consumers still need compatible interfaces.

## Verification and limits

Start with a small project. In a fresh session, inspect which items the hook supplies, why they were selected, whether their sources are reachable and whether they help the task. Verify index reconstruction from retained inputs. Do not describe retrieval as perfect recall or summarisation as preserving every detail.

The one-page Cortex download remains a commented placeholder, not a working download or a public asset. Do not invent its URL.

## Related reading

- [The model is the replaceable part](/documents/tools-and-plugins/the-model-is-the-replaceable-part)
- [Build your workspace once](/documents/workspaces/build-your-workspace-once)
