Files
msd-core/capabilities/mempalace/fragments/recall-discuss.md
Tom Boucher ed79902509 feat(#2007): implement mempalace memory_mode kg_backend and replace routing (#2010)
Wire the two forward-declared mempalace.memory_mode modes so they actually
route recall/capture instead of silently behaving as `augment`:

- kg_backend: the palace temporal KG is the primary knowledge-graph source;
  native .planning/graphs/ is the fallback. Non-KG drawer recall stays additive.
- replace: recall resolves through the palace as the source of truth; native
  artifacts are the fallback.

Every mode stays onError:skip and default-resilient — an unreachable palace
degrades to native memory and GSD keeps writing .planning/graphs/, so no memory
is lost. Cross-mode .planning/graphs/ migration remains a documented open
question (PRD/ADR §17), out of scope here.

Surfaces updated (instruction-only contract): recall/capture commands (+ generated
skills), discuss/wave fragments, curator agent, capability.json schema. Docs:
how-to Step 3, CONFIGURATION, FEATURES, CONTEXT glossary. Regenerated
capability-registry, golden install-parity fixtures (mempalace hashes only),
agent-size-baseline. Added a routing-contract + cross-surface parity test.

Incidental (folded per no-defer rule): removed pre-existing unused imports
(spawnSync in capability-registry.test.cjs; fs in issue-498-package-identity.test.cjs)
that eslint flagged in/alongside the touched files.

Closes #2007

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 15:01:22 -04:00

2.3 KiB
Raw Blame History

Memory recall (MemPalace)

Gate first. Read .planning/config.json. If mempalace.enabled is not true, or mempalace.recall_on_discuss is false, skip this entire section and continue the discussion unchanged. (This contribution is only injected when the capability is enabled; the recall_on_discuss check lets you turn discuss-time recall off without disabling the rest of the capability.)

Otherwise — before gathering new context, surface what you already know. This is read-only and side-effect-free; if MemPalace is unreachable, note "memory unavailable" and continue — recall never blocks discussion.

  1. Resolve the wing. Use mempalace.wing if set; otherwise derive it from project_code (fall back to the project directory name).
  2. Wake up (cheap, ~600–900 tokens).
    • Interactive run → call mempalace_search after a wake-up read of the wing.
    • Headless/cron run (no MCP server) → run mempalace wake-up --wing <wing> via the CLI.
  3. Targeted recall. Search the palace for prior work on this phase's topic:
    • Interactive → mempalace_search(query=<phase topic>, wing=<wing>) and, when mempalace.mirror_kg is on, mempalace_kg_query / mempalace_kg_timeline for decision facts and their validity windows.
    • Headless → mempalace search "<phase topic>" --wing <wing>.
  4. Mode awareness (mempalace.memory_mode). augment (default): the palace is an additional layer — never skip .planning/graphs/ or STATE. kg_backend: query the palace's temporal KG as the primary graph source, with .planning/graphs/ as fallback. replace: resolve recall through the palace as the source of truth, native memory as fallback. In every mode an unreachable palace falls back to native memory — recall never blocks.
  5. Surface, don't dump. Fold the top relevant drawers, decisions, patterns, and surprises into the discussion as prior context — cite drawer/fact provenance. Do not paste raw search output.

If any MemPalace call errors or times out, skip the rest of recall and proceed with discussion as normal.