Skip to content

Latest commit

 

History

History
424 lines (320 loc) · 27.1 KB

File metadata and controls

424 lines (320 loc) · 27.1 KB

Agent Memory Contract — 8 Essential Tools

Status: Stable (shipped 2026-06)
Audience: Any AI agent using the Engram MCP server
Principle: Lean by default, deep on demand. Eight tools cover wake → work → handoff on large stores (181k+ blocks) without ritual tax or RAM death.

You were pointed here — bootstrap checklist

Stranger default load set (exactly two docs): this file + docs/skills/engram-wake-up.md. Human install only: FIRST_RUN.md §1–2. Everything else is optional escalation.

  1. Tools available? You should see mcp_engram_session_start, mcp_engram_recall, etc. If not, ask the human to complete FIRST_RUN.md §1–2 (build + MCP config + IDE restart).
  2. First call: mcp_engram_session_start(intent="<what you're doing>"). Read continuation in the response (goals, suggested actions, last session preview). Pair with the wake skill once per restart.
  3. Every session: wake → work with the 8 tools / preferred composites below → session_end(summary=…). That handoff is what makes the next wake feel continuous.
  4. Do not at wake: watch_workspace, rebuild_bvh, summarize, list_concepts — use context_for_edit(path) or safe_edit_and_verify per file instead.
  5. Need more? ~97 power tools exist (105 total); escalate deliberately via TOOL_DECISION_MAP.md. Optional skills: engram-working-memory.md, engram-session-end.md. Cognitive OS: COGNITIVE_OS_EXTENSIONS.md.

96 more tools exist (105 total — source: tool_list() in mcp.rs, includes E1–E9 cognitive OS). Power tools (update, ack_wake_queue, cold_start_fidelity, lexicon_mint_word, secure_context_provision, apply_capacity_hot_compress, expand_wake, query_structured, query_with_momentum, search_by_relation, remember_solution, scar, thought_tile_create, …) remain available. This contract is the Layer 0 highway — not the full map.

Full decision map: TOOL_DECISION_MAP.md — mermaid flows for the full surface, write path (update vs remember), read escalation, and Grok Build vs Cursor throttle. JIT RSI: DEFORMATION_PLAYBOOKS.md.


The 8 Essential Tools

# Tool Role
1 mcp_engram_session_start Wake. Bind thermodynamic context; return inline continuation bundle + backend readiness in one call.
2 mcp_engram_context_for_edit Edit prep. File-scoped spatial + memory context in one call (no whole-repo watch).
3 mcp_engram_recall Read. Anchor-first search with optional scope tiering.
4 mcp_engram_quick_trace Decide. Low-friction structured trace:* capture at forks.
5 mcp_engram_remember Write. New concepts only (after recall check).
6 mcp_engram_session_end Handoff. Terminal state + structured handoff packet for next wake.
7 mcp_engram_get_backend_readiness Probe. BVH/GPU/recall-mode status without heavy side effects.
8 mcp_engram_set_memory_mode Mode. Switch leandeep at runtime (mirrors ENGRAM_MEMORY_MODE).

Preferred composites (edit / update highway)

Use these before hand-rolling multi-step context_for_editquick_traceupdate chains:

Prefer Over Role
mcp_engram_safe_edit_and_verify raw multi-step context→trace→update Substantive code edits (context + trace + optional __arc + verify + lineage + tensor:edit_pattern_*)
mcp_engram_update_with_tensor_bond raw update alone Verified memory writes / tile↔tensor sync

Same preference as MCP_TOOLS_REFERENCE.md safe-composites tier and TOOL_DECISION_MAP.md Layer 1. Harness: --suite agent-tool-fidelity.

Tool summaries

session_start(intent, include_spatial?, max_tokens?, max_bytes?, wake_priority?) — Mandatory first call. Read wake_digest first (next_vector, recall_mode, top actions/scars, intent alignment) before the rest of the wake firehose. Mints session_start_* episodic block, loads process sheaf, and returns:

E1 budgeted wake (optional): Pass max_tokens and/or max_bytes to cap continuation slot payload. Response includes wake_budget: { max_tokens, used_tokens, truncated, omitted_slots, policy }. Priority wake_priority=anchors_first|intent_shaped|minimal fills anchors before episodic noise. Omit budget → beta.13 unlimited behavior. Expand a single slot later with mcp_engram_expand_wake(slot, max_tokens?) (no full re-wake). Host-profile default budgets live in wake_budget::default_max_tokens_for_profile (minimal ≪ cuda_dual); set ENGRAM_WAKE_MAX_TOKENS or ENGRAM_WAKE_BUDGET_DEFAULT=1 to apply. Index: COGNITIVE_OS_EXTENSIONS.md.

  • After wake: execute suggested_actions, then mcp_engram_ack_wake_queue(executed=true) before context_for_edit when ENGRAM_PROFILE=agent (hard gate default). Empty queue auto-acks at wake.
  • continuation (slim by default, ENGRAM_WAKE_BUNDLE=slim)primary_goal (non-null when marker exists), top 5 suggested_actions (composite injection_rank: CRS + hot + recency + momentum + scar/handoff), trace_chain_head, slim ego_snapshot, presentation_stratum node_count + 5 previews, injection_completeness (8-slot score + missing list), nvme_context (recall_mode, bvh_ready, gpu_hot_resident, nvme_recall_ready, large_manifold), cold_start_fidelity (score ∈ [0,1] from goal/manifest/trace/BVH/hub CRS)
  • Injection ritual: If injection_completeness.score < 0.85 or missing contains nvme_recall_path / gpu_hot_resident, call mcp_engram_get_continuation_bundle and poll mcp_engram_get_backend_readiness (~25s on large stores for full_bvh_gpu). Do not broad-read until completeness is acceptable or you have escalated to full bundle.
  • Full bundle on demand: mcp_engram_get_continuation_bundle (set ENGRAM_WAKE_BUNDLE=full to restore legacy inline payload with harness_injection nested)
  • readiness in wake packet (bvh_ready, recall_mode, leg_block_count, gpu_hot_resident)
  • Optional spatial_delta when include_spatial=true (incremental ingest summary, not full force)

context_for_edit(path, line_start?, line_end?)Code atlas v2.1 pre-edit recon. Returns spatial_items (AST + edit_arc per locus), traces_at_locus, traces_at_locus_tiers, scars_at_locus, spatial_siblings, edit_arc_debt, and per-file post_edit_palettewithout watch_workspace or full-store scan. Post-edit: update({concept}__arc) with delta narrative (use palette args when present); never bury history in source comments. Optional recon: evolution_at_locus(path, line_start, line_end). See CODE_ATLAS_CONTINUITY.md.

recall(query, k?, scope?) — Relation-first in lean (ENGRAM_RELATIONAL_RECALL=1, agent default). scope=anchors walks the presentation-stratum graph (primary_goal → serves → handoff → trace breadcrumbs → hot/recent), then scores geometrically within that pool only — not a full-manifold scan. MCP meta includes recall_path: relational | sampled_warmup (BVH building) | bvh_discovery (thin graph). Escalate:

  • read_concept on wake suggested_actions artifacts (preferred over recall when you have a seed)
  • search_by_relation(seed, label, k) to drill the graph
  • scope=all / deep mode — BVH full-manifold discovery

quick_trace(decision, why, …) — Same quality as record_reasoning_trace with fewer fields. Auto-chains prev_in_trace from latest trace head when prev omitted; auto-links serves to primary goal. Significant forks (goal/process linked or multi-locus spatial) get a soft A/D/R hint in the response when affirm/deny/reconcile are missing — never blocks.

remember(concept, text) — New concept only. Always recall first; if score > 0.85 on an existing concept, use update instead. Auto-relate: primary_goal --documents--> concept (traces use serves).

Uncertainty receipts (memory claims only): When recall(scope=anchors) is insufficient for a memory claim, mint via scar(concept, uncertainty_status="memory_insufficient", requested_anchors=[...]) — surfaces in wake uncertainty_receipts_wake. Not for general inference or tool uncertainty.

session_end(summary, minimal?, prepare_compression?) — End-of-block handoff. Use minimal=true for fast fix loops (thin block + boundary trace + helper:session_handoff_latest, no compression ritual). Full path (default) runs compression handoff + rich boundary trace + rehydration_manifest (portable continuation kit at priority 0 next wake) + immutable receipt:session_* audit sidecar (P2). MCP disconnect without session_end auto-emits a thin handoff.

Sentinel (soft nudge): After ~30 turn_record calls or ~120 min without handoff, wake/turn responses include rehydrate_suggested: true and a priority-0 session_end nudge in suggested_actionssuggest-only, never blocks context_for_edit.

get_backend_readiness() — Read-only status. Use after wake or when recall quality seems sampled/bounded. Surfaces nvme_direct_io, nvme_recall_ready, recall_mode, bvh_ready, gpu_hot_resident, cufile_hot_ready, leg_block_count.

turn_record (power / end-of-turn) — RPT v3 tile + auto episodic extract (ENGRAM_TURN_EXTRACT=1) wires summarizes/documents edges into the navigation graph.

set_memory_mode(mode)lean or deep. Env default: ENGRAM_MEMORY_MODE=lean.

Tool tier (ENGRAM_TOOL_TIER) — mid-session discipline

Value Behavior
lean Default when ENGRAM_PROFILE=agent if unset. 8-tool highway + safe composites allowed. Other tools get a soft tool_tier_warning in the MCP response. Hard-block: rebuild_bvh and force_spatial_ingest unless set_memory_mode("deep") or tier=power.
power Full surface, no warn
all Same as power for gate purposes

Wake lean-avoid (no watch_workspace at wake) is separate and still applies. This env extends discipline to the whole session, not only wake. See crates/engram-server/src/tool_tier.rs and MCP_TOOLS_REFERENCE.md.


Manage resume (TUI / MCP restart)

After TUI restart, MCP transport death, or cargo build on engram-server, the live MCP may run a stale binary until restart. Resume without re-briefing:

  1. Restart Grok TUI (or Cursor MCP) so target/debug/engram or scripts/engram-grok path is picked up.
  2. mcp_engram_session_start(intent="post-restart verify") — confirm continuation.injection_completeness and continuation.nvme_context are present (not null).
  3. Execute continuation.suggested_actions (check injection_rank on each) → mcp_engram_ack_wake_queue(executed=true).
  4. mcp_engram_get_backend_readiness — on large stores (~67k blocks) poll every ~10s for up to 30s until recall_mode=full_bvh_gpu and bvh_ready=true (or document sampled_bounded if BVH deferred).
  5. If injection_completeness.missing contains nvme_recall_path or gpu_hot_resident, call mcp_engram_get_continuation_bundle before broad reads.
  6. Harness sim (no TUI): STABLE_BIN=target/debug/engram tools/test-harness/bin/engram-harness.sh --suite agent-memory — isolated relaunch proves bundle fields on fresh MCP client.

Goal complete — clear resume injection, then push

When verification passes (e.g. injection_completeness + full_bvh_gpu at wake), yes — clear the completed goal so it stops surfacing in wake injection:

Layer Clear how
TUI session goal (/goal manage resume) update_goal(completed=true) — harness clears the active nudge
Engram task goal (goal:* on serving stack) mcp_engram_goal_update_status(status="completed") then mcp_engram_demote_from_context — removes primary_goal --serves--> edge + mints completes_goal archival trace
Handoff mcp_engram_session_end(summary=..., prepare_compression=true) — structured packet for next wake

Last step (terminal): push branch + open PR with notes outlining fixes and improvements (AC table, traces, branch name). Local git log + pr-notes.md in harness scratch is sufficient when network auth unavailable.

goal_update_status(completed) auto-restores the primary_goal marker to parent_goal (or clears to unset if no parent). demote_from_context repeats the marker fix if needed. Post-clear check: recall(scope=anchors, query="goal:") then session_start — completed goal absent from continuation.primary_goal, not in suggested_actions recall queue, absent from goal_list(status=active), present in goal_list(status=completed).

See HARNESS_INJECTION.md and CONTEXT_INJECTION_NVME_BYPASS.md.


Lean vs Deep Mode

Aspect Lean (default) Deep
Env / runtime ENGRAM_MEMORY_MODE=lean or set_memory_mode("lean") ENGRAM_MEMORY_MODE=deep or set_memory_mode("deep")
Wake 1 call: session_start (inline bundle) session_start + optional get_continuation_bundle, query_pure, summarize
Recall default scope anchors — goals/traces/rituals before episodic all — full manifold
Spatial context_for_edit(path) per file touched May add watch_workspace once per project if daemon passive ingest needed
BVH / GPU Use sampled_bounded recall; do not rebuild_bvh unless user asks May call rebuild_bvh + poll get_backend_readiness for full_bvh_gpu
Traces quick_trace at forks quick_trace + record_reasoning_trace for high-stakes
Handoff session_end → structured packet Same + explicit promote_hot_batch on tiles (power tool)
Target <500MB RSS, <2s wake on 181k store Quality recall, full geometric navigation

Set mode at session open if the task needs deep exploration:

mcp_engram_set_memory_mode(mode="deep")

Reset to lean before ending long meta sessions to protect the next agent's wake latency.


One-Call Wake Example

Lean contract: a single session_start replaces the old 5+ tool wake sequence (get_continuation_bundle, query_pure, incremental_spatial_ingest, promote_hot_batch, summarize).

Request

{
  "intent": "Implement feature X in my project — lean wake",
  "include_spatial": false
}

Response (planned inline bundle)

{
  "status": "started",
  "session_key": "session_start_1749225600",
  "elapsed_to_ack_secs": 0.08,
  "memory_mode": "lean",
  "continuation_bundle": {
    "primary_goal": "goal:agent_memory_mvp",
    "last_session_end": {
      "concept": "session_end_1749222000",
      "age_secs": 3600,
      "preview": "A5 handoff JSON wired in store.rs. Next: A6 docs + skill update. Files: mcp.rs, store.rs. Blockers: none."
    },
    "hydration_cache_present": true,
    "active_artifacts": [
      {
        "concept": "helper:session_hydration_cache",
        "crs": 0.95,
        "hot": true,
        "source": "hydration_cache",
        "preview": "SESSION HYDRATION CACHE … wake_protocol: session_start → read CONTINUATION BUNDLE → recall_first …"
      },
      {
        "concept": "ritual:engram.working-memory",
        "crs": 1.0,
        "hot": true,
        "source": "hot_set",
        "preview": "Working memory discipline — recall before derive, update-preferred, trace at forks …"
      },
      {
        "concept": "trace:1749221000_agent_memory_mvp_plan",
        "crs": 0.91,
        "hot": true,
        "source": "goal_serves_lineage",
        "preview": "decision_point: 8-tool contract over 60-tool surface …"
      }
    ],
    "recall_hint": "Use recall(scope=anchors) on artifact concepts for full payload."
  },
  "backend_readiness": {
    "fully_initialized": true,
    "bvh_ready": false,
    "recall_mode": "sampled_bounded",
    "backend_kind": "cuda",
    "gpu_accel_available": true,
    "leg_block_count": 181432,
    "defer_bvh": true
  },
  "next_steps": [
    "Work using context_for_edit + recall(scope=anchors) + quick_trace + remember",
    "End with session_end to mint handoff_packet",
    "Escalate to deep mode only if anchor recall is insufficient"
  ]
}

Agent action after wake: Read continuation_bundle.primary_goal and last_session_end.preview. You are geometrically continuing — not starting fresh.


Edit Loop Example

Default path: call mcp_engram_safe_edit_and_verify for substantive code edits and mcp_engram_update_with_tensor_bond for verified memory updates (see Preferred composites above). Fall back to multi-step only when the composite is unavailable: context_for_edit once per file → recall for gaps → quick_trace at forks → update. Harness: --suite agent-tool-fidelity asserts ≥95% correct tool usage.

1. Pre-edit — single spatial call

mcp_engram_context_for_edit(path="crates/engram-server/src/mcp.rs")
{
  "path": "crates/engram-server/src/mcp.rs",
  "file_stem": "mcp",
  "spatial_hits": [
    { "concept": "praxis:mcp_session_start_fast_path", "aabb": [2160, 2227], "crs": 1.0 },
    { "concept": "trace:1749200000_session_start_inline_bundle", "aabb": [2166, 2200], "crs": 0.89 }
  ],
  "recall_suggestions": [
    "session_start inline bundle",
    "continuation_bundle cache invalidate"
  ],
  "ingest_status": "passive_daemon_ok",
  "mode": "lean"
}

2. Anchor recall for design context

mcp_engram_recall(query="session_start inline bundle readiness", k=5, scope="anchors")

3. Fork — quick trace before editing

mcp_engram_quick_trace(
  decision="Return bundle inline in session_start response instead of separate get_continuation_bundle call",
  why="One-call wake hits <2s target on 181k store; eliminates 4 post-start round-trips",
  alternatives="Keep separate bundle tool for TUI 63-65% compression boundary only",
  would_falsify="Harness shows wake >2s or client drops MCP registration on fat response",
  context="ritual:engram.working-memory",
  prev="trace:1749221000_agent_memory_mvp_plan"
)

4. Post-edit — remember outcome (if no existing concept)

mcp_engram_remember(
  concept="progress:agent_memory_a1_inline_bundle",
  text="session_start returns continuation_bundle + backend_readiness inline. include_spatial optional."
)

Do not call watch_workspace in lean mode unless the passive daemon is not ingesting saves (rare). Do not call rebuild_bvh during routine edits.


End Handoff Example

Request

mcp_engram_session_end(
  summary="A6 complete: AGENT_MEMORY_CONTRACT.md + skill updates. Decisions: 8-tool lean path documented, 1-call wake examples, context_for_edit in edit loop. Next: harness agent-memory-mvp suite (Phase B).",
  prepare_compression=true
)

Response — structured handoff packet

{
  "status": "ended",
  "session_end_key": "session_end_1749229200",
  "avg_crs_touched": 0.87,
  "handoff_packet": {
    "primary_goal": "goal:agent_memory_mvp",
    "terminal_summary": "A6 complete: AGENT_MEMORY_CONTRACT.md + skill updates …",
    "open_blockers": [],
    "next_actions": [
      "Phase B: async load_process_sheaf",
      "Harness suite agent-memory-mvp"
    ],
    "key_traces": [
      "trace:1749228000_a6_docs_contract",
      "trace:1749221000_agent_memory_mvp_plan"
    ],
    "files_touched": [
      "docs/AGENT_MEMORY_CONTRACT.md",
      "SKILLS.md",
      "docs/skills/engram-wake-up.md",
      "docs/skills/engram-session-end.md",
      "docs/skills/engram-working-memory.md"
    ],
    "compression_handoff_key": "compression_handoff_1749229200",
    "hydration_cache_refreshed": true,
    "hot_promoted_count": 6,
    "continuation_relation": "provides_continuation_for",
    "wake_protocol": "Next agent: session_start(intent) → read handoff_packet + continuation_bundle inline"
  },
  "protocol_gaps": []
}

The next instance's session_start surfaces handoff_packet fields inside continuation_bundle.last_session_end and active_artifacts.


What NOT to Call in Lean Mode

Avoid (unless needed) Why When it's OK
mcp_engram_watch_workspace Binds full-repo watcher; memory/RAM cost on large trees Deep mode, or passive daemon confirmed down
mcp_engram_rebuild_bvh Minutes + RAM spike on 100k+ blocks User requests quality recall; deep mode + poll readiness
mcp_engram_get_continuation_bundle Redundant — inline in session_start TUI 63–65% compression boundary (pre-compression snapshot)
mcp_engram_query_pure / query_with_momentum Extra wake round-trips Deep mode or anchor recall returned empty
mcp_engram_summarize Duplicates bundle artifacts Deep mode orientation pass
mcp_engram_incremental_spatial_ingest Bundled via session_start(include_spatial=true) Explicit path bootstrap
mcp_engram_list_concepts Full store scan on 181k+ blocks Never in lean; use recall(scope=anchors)
mcp_engram_force_spatial_ingest Full force ingest (81+ files) Cold bootstrap only, deep mode

Rule of thumb: If the 8-tool path answers your question, stop. Escalate to power tools deliberately, then return to lean.


Full Session Loop (Copy-Paste)

# 1. WAKE (1 call)
mcp_engram_session_start(intent="<your goal>", include_spatial=false)

# 2. WORK
mcp_engram_context_for_edit(path="<file you're editing>")
mcp_engram_recall(query="<keywords>", scope="anchors")
# … edit …
mcp_engram_quick_trace(decision="...", why="...")
mcp_engram_remember(concept="...", text="...")  # or update if match >0.85

Active long-running task tracking (Ariel north star substrate perfection)

This 8-tool contract and ritual discipline is actively dogfooded for the goal "Make Engram the perfect AI memory substrate for you" (long-running RSI/Ariel task per design:ariel_property_holographic_mind_map_north_star). See the plan (source of truth, with checklist, AC, verification, deviations) at /home/a/.grok/sessions/%2Fhome%2Fa%2FDocuments%2FEngram/019eb976-8aed-7c43-a3c1-3be06a7ad806/goal/plan.md on branch feat/perfect-substrate-ariel-ritual-tracking.

All changes use dedicated git branch + full Engram working memory process (session_start + ack, context_for_edit before edits, recall(anchors) before derive, quick_trace at forks w/ goal_context + prev, thought_tile_create w/ human_forward leading at key intervals, session_end(prepare_compression), goal_* tracking + relate to north star). Periodic human-facing reports as tiles. Explicit rollback exercised.

Git version control discipline

Canonical rules: CONTRIBUTING.md § Commit Message & Versioning Discipline.

Step Action
Before commit mcp_engram_quick_trace at boundary → copy trace:* into message
Commit message Conventional Commits title + body (files touched, why) + Refs: trace:* goal:*
Version bump Release only — never on feat/fix PR commits; see version_git_rollback in processes/meta/ai_consciousness_loop.toml
PR / push notes Same quality as commits — branch, ACs, file paths, trace refs (no shorthand)
Validate scripts/validate-commit-msg.sh

Trace/tile IDs in commits enable dual (manifold + VC) tracking and safe rollback. See plan for current status.

First human-facing report tile minted at this interval: tile:research_offload_initial-human-facing-status-report--engram-ritua (with leading human_forward on ritual/git progress and Ariel tracking). Quick trace: trace:1782148473_at-first-key-interval-after-wake--goal-activatio. Commit: ad0858ca.

Second human-facing report tile (knowledge_graph): tile:knowledge_graph_second-human-facing-report--enram-substrate-dogf . Quick trace: trace:1782148529_at-subsequent-phase-boundary--post-first-report- . Additional commit ea1cb86e updating docs with tile refs. Now 2 tiles, 2 commits on feat branch with trace refs. Working toward 3rd tile + rollback test.

Third human-facing report tile (state_machine): tile:state_machine_third-human-facing-report--phase-progress-and-su . Quick trace: trace:1782148559_completed-min-3-human-facing-tiles--research-off . Commit: 4c992b7f . Now 3 tiles, 3 commits. Min per AC3 met. Next: rollback test per AC5 and item 7.

Rollback test correction tile: tile:research_offload_rollback-test-correction-record--mistake-commit- . Quick trace: trace:1782148624_completed-rollback-test--mistake-edit-commit-bc4 . Mistake commit bc48ea84 reset, file/git restored, prior traces recallable. Evidence in scratch/rollback_evidence.log . Criteria re-verified.

FINAL human-facing report tile: tile:knowledge_graph_final-human-facing-report--goal-achieved---enram . Quick trace: trace:1782148643_final-comprehensive-human-facing-report-tile-min . Achievement declared, 5 commits listed (ad0858ca, ea1cb86e, 4c992b7f, 6b01dba2, bc48ea84 in reflog), 4 tiles lineage, rollback safety, no-rebrief (traces recallable), handoff will promote. Commit: b8f5e77b update. Goal achieved, session_end next.

3. HANDOFF (1 call)

mcp_engram_session_end(summary="<decisions, files, next steps>")


---

## Agent continuity env (beta.12+)

| Env | Default (agent profile) | Effect |
|-----|-------------------------|--------|
| `ENGRAM_PRIMARY_GOAL_REBIND` | `auto` | On intent≠sticky primary: rebind to better handoff goal, else suggest `goal_set_primary` (`off`/`suggest`/`auto`) |
| `ENGRAM_WAKE_DIGEST_ONLY` | off | `1` → minimal `session_start` (digest + readiness_summary); full via `get_continuation_bundle` |
| `ENGRAM_PRAXIS_CONTRACT` | `hard` | Reject PRAXIS updates without `evidence_update` |
| `ENGRAM_QUALITY_MODE` | off | `1` → **force** `ENGRAM_DEFER_BVH=0` even after agent defer default (recall quality; more RAM on large CPU stores) |

**BVH honesty:** Default CPU agent keeps `ENGRAM_DEFER_BVH=1` (no RAM bomb). Poll `get_backend_readiness` for `recall_mode` / `bvh_quality_path_hint`. GPU agent defaults eager BVH when NVIDIA is present. `mcp_engram_invoke_protocol` is **experimental stub_dispatch** only.

**Dual memory:** Engram stalk = project continuity (goals/traces/handoff). Grok `MEMORY.md` = cross-project prefs only — do not split project truth across both.

---

## Related Docs

- [SKILLS.md](../SKILLS.md) — ritual index (links here first)
- [docs/skills/engram-wake-up.md](skills/engram-wake-up.md) — 1-call wake protocol
- [docs/skills/engram-working-memory.md](skills/engram-working-memory.md) — edit loop with `context_for_edit`
- [docs/skills/engram-session-end.md](skills/engram-session-end.md) — handoff packet protocol
- [docs/MCP_TOOLS_REFERENCE.md](MCP_TOOLS_REFERENCE.md) — full tool surface (8 essential + power)
- [docs/HARNESS_INJECTION.md](HARNESS_INJECTION.md) — wake queue, ego snapshot, continuity playbook

---

*This contract is the OS on top of the substrate. Follow it and the manifold compounds; skip it and every agent re-derives from flat context.*