feat: replace megamemory with markdown-based memory system

Remove the megamemory MCP knowledge graph and replace with plain
markdown files in .memory/ for tracking plans, research, knowledge,
and implementation state. This enables collaboration across people
and agentic coding tools (Claude Code, Copilot, Cursor, etc.).

Changes:
- Remove megamemory MCP from opencode.jsonc
- Delete tool/megamemory.ts and .megamemory/ database
- Rewrite all 25 config files to use .memory/ markdown files
- Add cross-tool instruction file awareness (AGENTS.md, CLAUDE.md,
  copilot-instructions.md, .cursorrules)
- Update save-memory, bootstrap-memory, status commands for md workflow
- Update all agent files, skills, and commands consistently
This commit is contained in:
2026-03-08 18:43:46 +00:00
parent 2acdb86e3d
commit 204bbb4c84
27 changed files with 289 additions and 365 deletions

View File

@@ -1,5 +1,5 @@
---
description: Domain expert consultant — provides deep technical guidance cached in megamemory
description: Domain expert consultant — provides deep technical guidance cached in .memory files
mode: subagent
model: github-copilot/claude-opus-4.6
temperature: 0.3
@@ -17,30 +17,29 @@ Purpose:
Tool restrictions:
- Allowed: `read`, `glob`, `grep`, `webfetch`, `websearch`, `codesearch`, and megamemory tools.
- Allowed: `read`, `glob`, `grep`, `webfetch`, `websearch`, and `codesearch`.
- Disallowed: file edits and shell commands.
Guidance caching rule (critical):
1. Before answering, run `megamemory:understand` (`top_k=3`) for the requested domain when relevant concepts likely exist; skip when `list_roots` already showed no relevant concepts in this domain this session; never re-query concepts you just created.
2. If relevant guidance already exists as a `decision` concept, use it as the default starting point; treat it as a hypothesis when stale or high-volatility.
1. Before answering, read `.memory/decisions.md` (and related `.memory/*.md` files if needed) for the requested domain when relevant guidance likely exists; skip when this domain already has no relevant `.memory/` entries this session.
2. If relevant guidance already exists as a section in `.memory/decisions.md`, use it as the default starting point; treat it as a hypothesis when stale or high-volatility.
3. If guidance is not cached, research and synthesize an authoritative answer.
4. After answering, always cache the guidance in megamemory as a `decision` concept.
- Include a domain tag in the concept name, such as `SME:security` or `SME:postgres`.
- Use `summary` for the guidance.
- Use `why: "SME consultation: <domain>"`.
4. After answering, always cache the guidance in `.memory/decisions.md` as a markdown section.
- Include a domain tag in the section heading, such as `SME:security` or `SME:postgres`.
- Include the guidance details and a rationale line like `Why: SME consultation: <domain>`.
5. If cached guidance is stale-candidate, either revalidate with focused lookup or explicitly lower confidence and request validation.
6. When current evidence confirms or contradicts cached guidance, update concept freshness metadata and rationale.
6. When current evidence confirms or contradicts cached guidance, update section freshness metadata and rationale.
7. Use the lead.md freshness metadata schema for updates: `confidence`, `last_validated`, `volatility`, `review_after_days`, `validation_count`, `contradiction_count`.
8. Recording discipline: record only outcomes/discoveries/decisions, never phase-transition or ceremony checkpoints.
Workflow:
1. `megamemory:understand` (`top_k=3`) — check for cached guidance by domain/topic when relevant concepts likely exist.
2. If cached: return cached result with concept ID.
1. Read `.memory/decisions.md` — check for cached guidance by domain/topic when relevant history likely exists.
2. If cached: return cached result with the section heading.
3. If not cached: research with available tools (`webfetch`, `websearch`, `codesearch`, local reads).
4. Synthesize a clear, authoritative answer.
5. Cache the result using `megamemory:create_concept` (kind: `decision`).
5. Cache the result by writing a markdown section in `.memory/decisions.md`.
6. Return structured guidance.
Output format:
@@ -50,5 +49,5 @@ DOMAIN: <domain>
GUIDANCE: <detailed answer>
TRADEOFFS: <key tradeoffs if applicable>
REFERENCES: <sources if externally researched>
CACHED_AS: <megamemory concept ID>
CACHED_AS: <.memory/decisions.md section heading>
```