Company context

L3. Company state, knowledge and memory are three different things. One deterministic builder turns them into one brief.

1 min read Updated Aug 12, 2026

Company context

L3. The layer that knows.

Three stores, and they are not the same store. Company state is what is true now. Knowledge is what the company holds. Memory is what happened before.

L3 COMPANY CONTEXT — three stores, one deterministic builder, one brief
L3 COMPANY CONTEXT — three stores, one deterministic builder, one brief
THREE STORES — they share storage, and they never share meaning
THREE STORES — they share storage, and they never share meaning
Company state
what is true now
CRM · product · engineering
operations · finance
Company statewhat is true nowCRM · product · engineeringoperations · finance
Knowledge
what the company holds
docs · policies · playbooks · research
Knowledgewhat the company holdsdocs · policies · playbooks · research
Memory
what happened before
preferences · observations
Memorywhat happened beforepreferences · observations
Context policy
from the agent row
Context policyfrom the agent row
Context builder
deterministic · no model call
retrieve, rank, trim
Context builderdeterministic · no model callretrieve, rank, trim
One brief
ranked, trimmed to budget
every claim names its source
One briefranked, trimmed to budgetevery claim names its source
Agent
reads the brief
Agentreads the brief
what to retrieve
what to retrieve
PRECEDENCE — company state beats knowledge, and knowledge beats memory
without an order, three stores disagree and the agent picks the one that reads best
PRECEDENCE — company state beats knowledge, and knowledge beats memorywithout an order, three stores disagree and the agent picks the one that reads best
LEGEND
LEGEND
costs an LLM call
costs an LLM call
deterministic plumbing
deterministic plumbing
what the agent receives
what the agent receives
a store, or its policy
a store, or its policy
a grouping, not a component
a grouping, not a component
Text is not SVG - cannot display
L3 COMPANY CONTEXT — three stores, one deterministic builder, one brief
L3 COMPANY CONTEXT — three stores, one deterministic builder, one brief
THREE STORES — they share storage, and they never share meaning
THREE STORES — they share storage, and they never share meaning
Company state
what is true now
CRM · product · engineering
operations · finance
Company statewhat is true nowCRM · product · engineeringoperations · finance
Knowledge
what the company holds
docs · policies · playbooks · research
Knowledgewhat the company holdsdocs · policies · playbooks · research
Memory
what happened before
preferences · observations
Memorywhat happened beforepreferences · observations
Context policy
from the agent row
Context policyfrom the agent row
Context builder
deterministic · no model call
retrieve, rank, trim
Context builderdeterministic · no model callretrieve, rank, trim
One brief
ranked, trimmed to budget
every claim names its source
One briefranked, trimmed to budgetevery claim names its source
Agent
reads the brief
Agentreads the brief
what to retrieve
what to retrieve
PRECEDENCE — company state beats knowledge, and knowledge beats memory
without an order, three stores disagree and the agent picks the one that reads best
PRECEDENCE — company state beats knowledge, and knowledge beats memorywithout an order, three stores disagree and the agent picks the one that reads best
LEGEND
LEGEND
costs an LLM call
costs an LLM call
deterministic plumbing
deterministic plumbing
what the agent receives
what the agent receives
a store, or its policy
a store, or its policy
a grouping, not a component
a grouping, not a component
Text is not SVG - cannot display
Three stores, one deterministic builder driven by a context policy, and one brief. The precedence rule sits under all of it.

Components

ComponentJob
Company stateThe structured state of the business, by domain.
KnowledgeDurable documents the company holds, and their retrieval index.
MemoryWhat happened before, and what was learned.
Context builderRead the three stores and return one brief for one run.

Company state

Company state is the structured state of the business. It is one model with several domains. Each entity has exactly one owning domain.

TEXT
Company state
  ├── CRM          companies · people · leads · opportunities
  ├── Product      features · usage · adoption · releases
  ├── Engineering  errors · incidents · deploys · latency
  ├── Operations   tasks · projects · processes · decisions
  └── Finance      revenue · costs · transactions

The CRM is one domain, not the whole model. A CRM-shaped company model has no place to put a goal, a project, a release or a decision, so those facts end up in documents and in spreadsheets. Then no agent can read them.

Cross-domain entities sit above the domains: goals, metrics and activities each refer to records in any domain.

Metrics and external ids

Two tables carry everything that comes from outside.

metrics holds one number, for one key, at one period. Every source writes the same shape, so one query and one chart component serve finance, product and engineering alike.

TEXT
metric   key · source · domain · grain · at · value · unit
         dimensions · definition · observed_at · source_ref

external_refs maps one of our records to one vendor id. It is what lets a CRM company know its Stripe customer, without mirroring any part of Stripe. A vendor record is never copied into company state.

The full worked example, including the three connectors and the ingest rules, is on Metrics and connectors.

Knowledge and memory

They answer two different questions, and mixing them is the common failure.

KnowledgeMemory
QuestionWhat do we know?What happened before?
SourceA person or a system wrote it downA run produced it
ExamplesCompany docs, product docs, policies, playbooks, research, meeting notesA preference, an observation, a past decision, a correction
LifetimeUntil someone changes itUntil it is superseded, or it expires
Write pathDirect, by a person or an ingest jobProposed by a run, confirmed before it persists

They may share storage. They must not share meaning. A playbook that an agent invented is not a playbook.

Memory has four kinds, and only one of them needs a table.

KindWhere it lives
Working memoryThe run. It ends when the run ends.
Episodic memoryA query over runs and run_events.
Durable memoryThe memories table: one preference or observation.
Decision memoryA decisions record in company state. A decision is a business fact, not a note.

The context builder

An agent must not receive one large static context. The builder assembles a brief for each run.

TEXT
                  run starts
                       │
                       ▼
              ┌─────────────────┐
              │ Context builder │◄──── context policy, from the agent row
              └────────┬────────┘
                       │
        ┌──────────────┼──────────────┐
        ▼              ▼              ▼
  Company state    Knowledge        Memory
        │              │              │
        └──────────────┼──────────────┘
                       ▼
                 one brief, ranked and trimmed to budget
                       │
                       ▼
                     Agent

The builder is deterministic. A context policy on the agent row states what to retrieve, from where, and how much. The agent does not choose. An agent that decides what to retrieve is a second reasoning hop, and the one-hop rule forbids it.

The builder is the one component that reads company state directly, and not through a tool. It is deterministic infrastructure, not a capability an agent selects. It obeys the same row-level security as every tool.

Precedence

Three stores can disagree about the same fact. The order is fixed.

TEXT
Company state  beats  Knowledge  beats  Memory

Without an order, an agent picks the version that reads best. With it, a stale document never overrides a live record, and a remembered preference never overrides a written policy.

Rules

  • Each fact has one owner. Company state owns business facts. Knowledge owns documents. Memory owns preferences and observations.
  • A run writes to company state only through a tool. The builder reads directly. Nothing writes directly.
  • A memory is proposed, then confirmed. A run proposes. A person or a rule confirms. An unconfirmed memory never enters a brief.
  • A brief carries its provenance. Every claim in a brief names its source record, so a person can check it.
  • A brief has a budget. The policy sets a token ceiling, and the builder trims to it. It does not overflow and truncate at random.
  • Nothing in this layer calls a model, except the embedder. Ranking is a query. Retrieval is a query.

Data model

TableHolds
documentsOne durable knowledge document, its source, its owner and its version.
document_chunksOne embedded passage of a document, for retrieval.
memoriesOne preference or observation, its scope, the run that proposed it, and its confirmation state.

Company state adds one table per business entity: companies, people, opportunities, projects, tasks, goals, metrics, activities, decisions, plus external_refs for the vendor id of any of them.

Working memory and episodic memory add no table. Working memory is the run. Episodic memory is a query over runs and run_events. A copy of either would go stale.

Risks

RiskMitigation
Memory poisoning: a run writes a false observation, and later runs read it as factPropose and confirm on the write path, provenance on every memory, and an expiry
Knowledge goes stale, and an agent quotes a policy that was replacedA document carries an owner and a review date. Precedence puts company state above it
The brief grows until it costs more than the workA token budget per agent, enforced by the builder
An agent reaches company state directly, "for performance"Only the builder reads directly. Every write is a tool call. Row-level security holds either way
Domains multiply until company state is a second CRM per teamOne owning domain per entity, decided when the entity is added
A vendor record is copied in "just this once", and it goes staleexternal_refs maps an id. A record detail is read live, and never stored

Open questions

  1. Who confirms a proposed memory? A person for every one is too slow, and a rule for every one is too loose.
  2. What is the expiry for a durable memory? A preference is not a fact, and it should decay.
  3. Does knowledge ingest run as a workflow, so it gets retry and audit for free?
  4. How does the builder rank across three stores with one score? A single relevance score across a record, a passage and an observation is not obviously meaningful.

Diagram source. ac-docs/diagrams/mission-control-layers.drawio, page mission-control-context. Edit that page, then run ./scripts/export-diagrams.sh mission-control-layers. Update this page and the diagram together.