What an agent forgets between sessions
An AI coding agent has near-perfect recall inside a session and near-total amnesia between them. That amnesia has a shape, and it's expensive.
It writes a second persistence module because it never knew the first one existed. Duplicate seams, drift, wasted runs.
Last week it chose threading.Lock over
asyncio.Lock for a reason. This week that reasoning is gone — so it "fixes" the deliberate choice.
The methodology lives in a README nobody re-reads. Reviews get skipped, states get jumped, no audit trail survives.
Commit messages and doc prose don't fix this: they record what changed, rarely why, and they aren't queryable as decisions. Context Graph closes the loop by making the project's decision lineage a first-class, queryable memory — every edge can carry who decided it, why, via which channel, under which policy, and whether it still holds — and by turning the team's methodology into data the graph enforces rather than a document it ignores.
The development loop
Working with Context Graph is three habits around one shared memory. They compound: every recorded decision makes the next "does this exist / why is it like this" query sharper.
The project as a graph
Onboarding installs a dev-shaped ontology: the object types an agentic project actually has, and the typed relationships between them. This is the structure query-before-build searches and the shape governed actions write into.
Because relations are open-world, a keyword the ontology hasn't seen is a warning, not an error — the graph keeps growing while the ontology stays a guide rather than a straitjacket.
Five governance layers
The methodology isn't prose — it's five composable, per-workspace layers. Each is optional; each mirrors the same shape (schema · store · service); together they turn "please follow the process" into something the graph checks.
What can exist
Object types, their properties, and the legal relationships between them. The vocabulary every other layer speaks. Guide →
What to check
A concept-matching DSL (sim() over embeddings) that flags a decision for review,
passes it, or rejects it. Advisory by default. Guide →
What you can do
Typed operations bound to object types — ProposeModule, RecordDecision,
AdvanceTask — each validated, gated, and audited. Guide →
Who may do it
Opt-in, deny-by-default within a policy, fully permissive when none is set — so a single-agent project needs zero config, and a multi-agent team gets real boundaries.
What order it happens in
Declarative state machines per object type. A completed task can't jump back to pending; an
illegal transition is refused with 409. The guardrail that keeps state honest.
What an agent is told
GET /workspace/manifest?role= assembles ontology + actions (RBAC-filtered to the
role) + rules + lifecycle + skills into one self-describing bundle.
One action, five guards
Every governed action runs the same ordered pipeline. The ordering is the point: authorization and legality are checked before anything is written or done, and the whole thing lands as an audit record on the graph.
action: provenance — see the Action Layer.# discover what you can do, then do it — both over MCP
get_manifest() # role-filtered actions, object types, lifecycle
invoke_action(action="ProposeModule", object_ref="state.sqlite_store",
args={"name": "state.sqlite_store"}) # → PASS | FLAG (reuse-check)
invoke_action(action="AdvanceTask", object_ref="task-42",
args={"to": "completed"}) # → 409 if the jump is illegal
Onboarding & backfill
Two paths in, depending on whether the project is new or already has history.
new project POST /onboard
Describe the project in natural language. NL authors tailor the ontology and the methodology rules to what you said, install the layers, and hand back the manifests. Minutes, not a config sprint.
existing repo backfill_git.py
For a project that predates the flow: a deterministic import of its reality — modules from
source dirs, the author, recent commits (and the modules they touched), the docs, and with --code
the source itself — so the graph knows the codebase from day one.
The agent pulls its own playbook
No files to hand-copy into a repo. The server serves everything an agent needs to bootstrap itself, generated live from the workspace's installed config — so the guide lists the real object types, the real actions with their params, and the real guardrails, never a stale template. The whole greenfield flow is read one URL:
- Read the bootstrap bundle —
GET /workspace/bootstrapreturns the.mcp.jsonto write, the backfill command, links to the playbook and manifest, and the ordered next steps (JSON, for machine init). - Wire MCP — write the returned
mcp_configto.mcp.jsonand connect. One surface, done. - Backfill if the repo isn't empty —
curl $SERVER/workspace/backfill-script | python - --repo . --workspace <ws> --code. The server serves the script; the agent runs it against its own checkout (the server can't reach your filesystem). - Read the playbook —
GET /workspace/playbookreturns a Markdown operating guide (the three habits, your actions, the signals) rendered from this workspace's live manifest. - Start the loop.
Onboarding a new workspace first? POST /onboard tailors the config and returns
the same bootstrap bundle — the wizard hands the agent its entry points in one call.
What backfill imports
- Structural facts (no LLM): source directories →
Modulenodes, git author →Developer, recent commits →Commitnodes linked to the modules they changed. - Semantic layer: README +
docs/ingested through the extraction pipeline so the architecture and the prose "why" become query-able with provenance. - Code layer (
--code): source files ingested full-content, so file- and symbol-level questions ("where isclear_on_starthandled?") resolve from the code, not guesswork.
/query (and query_auto)
blend the decision store into every answer — semantically and by exact name — so asking
"explain adr-m2-concurrency" returns the recorded ADR with its full rationale, in the same session it
was written.
One surface: MCP
An agent shouldn't juggle a dozen REST calls. Everything — querying, recording decisions, discovering what it can
do, and invoking governed actions — is a single MCP tool surface, wired once via .mcp.json. (The
same operations exist as REST endpoints if you ever want to curl them.)
| Habit | MCP tools | What it gives the agent |
|---|---|---|
| query | query_auto · query_cgr3 ·
search_precedents · get_entity_context |
Grounding: what exists, why it's like this, and precedents for the call it's about to make. |
| record | record_decision ·
ingest_decision_summary |
Durable, structured why — the ADR a future session would otherwise lose. |
| act | get_manifest · invoke_action |
Discover the role's governed actions, then run one — validated, authorized, audited. |
| inspect | list_decisions · get_edge_context |
The audit trail: what was decided, by whom, under which rule. |
→ Deeper walkthrough of the agent-side setup and one feature end to end: The Project Graph — Onboarding, Flow & Data.
Field-validated on a real project
We onboarded a separate, single-agent project (an OSINT investigator) onto Context Graph and had its dev agent ship three real features entirely through the loop — grumbling freely into a feedback file the whole time. The honest read:
threading.Lock-over-asyncio.Lock rationale a later session would have "fixed"open → in progress → closed held as a real, enforced audit trailThe exercise also drove real fixes back into the product — an MCP request-body bug, a mis-firing query route, and the read-your-writes gap on recorded decisions (a decision is now query-able the instant it's recorded). That feedback-to-fix loop is the methodology working on itself.
Generic by design
None of this is hard-wired. Context Graph is a generic, decision-aware knowledge graph; AI-agent development is
a use case, expressed entirely as data — an agentic-dev preset of ontology, rules, actions, seed,
RBAC, and lifecycle files. The core ships none of those verbs.
This distinguishes it from code-indexing tools: those map the codebase; Context Graph remembers the decisions made across it and enforces how the next one gets made. The graph is a control plane, not an index.
Where it sits · try it
This page is the map. The deeper documents:
- The Project Graph — Methodology Actor — the design discussion: roles as identities, methodology-as-data, the worked "don't rebuild that API" example, and the full gap analysis.
- Onboarding, Flow & Data — new-project onboarding and one feature carried end to end through the graph.
- Per-layer guides: Ontology · Business Rules Engine · Action Layer.
- Context Graph — Technical Field Guide — the full reference for the whole system, and The Fourth Element for the concept behind it.