MCP Knowledge Graph & Shared Memory
MCP Knowledge Graph & Shared Memory
Version: 2.0 Last Updated: 2026-03-15 Status: Active operational policy
This document defines how agents must use the project-local AIM Knowledge Graph for shared Jorvis memory.
Purpose
The project-local KG is the durable shared-memory layer for:
- approved sequencing decisions
- GO / NO-GO outcomes
- verified runtime or deploy truth
- active blockers
- role-routing facts that matter across sessions
It is not the source of truth for every fast-moving repo or PR detail.
Canonical Sources and Precedence
Current-state precedence:
- live git and live PR state
- project-local AIM KG (
location="project",context="jorvis") docs/handoff/HANDOFF_TO_NEXT_AGENT.mddocs/agent_ops/TASK_BOARD.mddocs/agent_ops/GO_NO_GO.md
Use the KG to preserve durable shared context. Use live git / GitHub state for exact review heads, CI status, and mergeability.
Canonical Store
- Location:
project - Context:
jorvis - Backing file:
.aim/memory-jorvis.jsonl
Do not write Jorvis runtime state to global memory without explicit Gatekeeper GO.
Session Bootstrap
At session start:
- call
aim_memory_list_stores() - confirm project-local detection
- read only the relevant compact
*_Currententities withaim_memory_get(...) - stop and escalate if project mode is not active
Recommended current entities:
Knowledge_Graph_Runtime_PolicyJorvis_Project_CurrentJorvis_Runtime_CurrentJorvis_Prod_Parity_CurrentJorvis_Roles_Current
Read additional entities only when they are directly relevant to the task.
Reread Cadence
Reread the relevant KG entities:
- after a merge, rebase, base-SHA refresh, or worktree switch
- before gate/test/deploy/final recommendations when live state may have changed
- after a long-running executor/tester lane
- before writing a new coordination packet if repo or PR state changed while drafting
What Belongs in Memory
Write only durable, important facts such as:
- GO / NO-GO outcomes
- ADRs and architecture decisions
- verified runtime/deploy truth
- active blockers
- approved sequencing changes
- role-routing changes that matter beyond the current turn
What Does Not Belong in Memory
Do not write all of the following by default:
- every CI rerun
- exact current PR head SHA
- mergeable / CLEAN / green / pending status
- branch-local scratch notes
- repeated review loops already captured in OUTBOX
- transient observations that will stale after the next merge
Exception:
- a transient fact may be stored when it is itself the active blocker being tracked
Durable Formatting Rules
Jorvis_*_Current entities must be written to survive routine docs-only merges and
review-head churn.
Good current-memory facts:
- "Prod parity is blocked by the active deploy-script idempotency bug."
- "PR-C must not start until prod parity is restored and SSOT is refreshed."
- "Tester owns post-deploy smoke by default."
Bad current-memory facts:
- "origin/main is exact SHA X" as a long-lived current-memory fact
- "PR #507 is green on head SHA Y" unless that exact live PR state is the blocker
- "mergeable=CLEAN" as persistent memory
Exact heads, CI state, and mergeability should normally be re-read from live git / GitHub state.
Compaction and Cleanup Rules
- Keep
*_Currententities compact. - Move detailed lineage and command output to OUTBOX/docs.
- Historical/task/dated entities should be short outcome summaries, not long per-commit logs.
- If a fact becomes stale, duplicated, or irrelevant, update or remove it instead of appending more drift.
- Prefer
aim_memory_remove_facts,aim_memory_forget, or compact replacements over uncontrolled growth.
Worktree Rules
- Worktrees must still resolve the canonical project-local memory files.
- The checked-out repo-root
MEMORY.mdremains the bootstrap note inside worktrees. - Do not trust worktree memory if project-local detection is broken.
Commit Policy
.aim/*.jsonl files are runtime state. Do not stage or commit them.
Operational Pattern
Use this pattern:
- read live git / PR state
- read relevant compact KG current entities
- reconcile conflicts explicitly
- act or draft based on live truth
- update KG only if durable truth changed
- compact stale memory during closeout when needed
Detailed Evidence
Put detailed logs, command output, and review chains in:
docs/agent_ops/OUTBOX/- SSOT docs
- task specs / ADRs
Use the KG for durable summaries, not raw evidence dumps.