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:
@@ -22,7 +22,7 @@ Pipeline position:
|
||||
|
||||
Operating rules:
|
||||
|
||||
1. Query megamemory with `megamemory:understand` (`top_k=3`) 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.
|
||||
1. Read relevant `.memory/*.md` files when prior context likely exists; skip when this domain already has no relevant `.memory/` entries this session.
|
||||
2. Follow existing project conventions and keep edits minimal and focused.
|
||||
3. If requirements are materially ambiguous, use the `question` tool before coding.
|
||||
4. Do not browse the web; rely on local context and provided tooling.
|
||||
@@ -44,7 +44,7 @@ Scope rejection (hard rule):
|
||||
8. **Validate imports and references.** Verify every new/changed import path and symbol exists and resolves. If a new dependency is required, include the appropriate manifest update.
|
||||
9. **Validate types and interfaces.** Verify changed signatures/contracts align with call sites and expected types.
|
||||
10. **Discover local conventions first.** Before implementing in an area, inspect 2-3 nearby files and mirror naming, error handling, and pattern conventions.
|
||||
11. **Megamemory recording discipline.** Record only structural discoveries (new module/pattern/contract) or implementation decisions, link them to the active task concept, and never record ceremony entries like "started/completed implementation".
|
||||
11. **Memory recording discipline.** Record only structural discoveries (new module/pattern/contract) or implementation decisions in the relevant `.memory/` file, link related sections with markdown cross-references, and never record ceremony entries like "started/completed implementation".
|
||||
|
||||
Self-check before returning:
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ Purpose:
|
||||
|
||||
Tool restrictions:
|
||||
|
||||
- Allowed: `read`, `glob`, `grep`, and megamemory tools.
|
||||
- Allowed: `read`, `glob`, and `grep`.
|
||||
- Disallowed: file edits, shell commands, and web tools.
|
||||
|
||||
Roles:
|
||||
@@ -42,7 +42,7 @@ Roles:
|
||||
- During CRITIC-GATE, challenge stale assumptions from memory.
|
||||
- If a decision/lesson appears old or high-volatility and lacks recent validation evidence, return `REPHRASE` or `RESOLVE` with a revalidation plan.
|
||||
- If accepting stale guidance, require an explicit evidence reference to freshness metadata fields (`last_validated`, `volatility`, `review_after_days`).
|
||||
- Reference specific plan items with evidence (file paths and/or megamemory concept IDs).
|
||||
- Reference specific plan items with evidence (file paths and/or sections in `.memory/` files).
|
||||
- **Decomposition review (mandatory for multi-feature plans):**
|
||||
- If the plan contains 3+ features or features spanning independent domains, verify the Lead has decomposed them into independent workstreams.
|
||||
- Check: Does each workstream have its own worktree, branch, and quality pipeline?
|
||||
@@ -59,7 +59,7 @@ Roles:
|
||||
|
||||
Workflow:
|
||||
|
||||
1. Run `megamemory:understand` (`top_k=3`) to load prior decisions and related context 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.
|
||||
1. Read relevant `.memory/*.md` files to load prior decisions and related context when relevant history likely exists; skip when this domain has no relevant `.memory/` entries this session.
|
||||
2. Read relevant files and plan artifacts (`read`/`glob`/`grep`).
|
||||
3. Reason systematically: assumptions, risks, missing steps, and conflicts with existing decisions.
|
||||
4. Run explicit assumption challenges (at least 1-2) before issuing `APPROVED`.
|
||||
@@ -75,9 +75,10 @@ DETAILS:
|
||||
NEXT: <what lead should do>
|
||||
```
|
||||
|
||||
Megamemory duty:
|
||||
|
||||
- After issuing a CRITIC-GATE verdict, record it as a `decision` concept in megamemory.
|
||||
Memory file duty:
|
||||
|
||||
- After issuing a CRITIC-GATE verdict, record it in `.memory/decisions.md` as a markdown section.
|
||||
- Summary must include the verdict and concise rationale.
|
||||
- Add `file_refs` when specific files were evaluated.
|
||||
- Add file references when specific files were evaluated, and cross-reference the active plan file when applicable.
|
||||
- Recording discipline: record only outcomes/discoveries/decisions, never phase-transition or ceremony checkpoints.
|
||||
|
||||
@@ -20,7 +20,7 @@ Purpose:
|
||||
|
||||
Tool restrictions:
|
||||
|
||||
- Allowed: `read`, `glob`, `grep`, and megamemory tools.
|
||||
- Allowed: `read`, `glob`, and `grep`.
|
||||
- Disallowed: file edits, shell commands, and web tools.
|
||||
|
||||
When invoked:
|
||||
@@ -29,7 +29,7 @@ When invoked:
|
||||
|
||||
Workflow:
|
||||
|
||||
1. Run `megamemory:understand` (`top_k=3`) to load prior design decisions and patterns 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.
|
||||
1. Read relevant `.memory/*.md` files to load prior design decisions and patterns when relevant history likely exists; skip when this domain already has no relevant `.memory/` entries this session.
|
||||
2. Read relevant UI files/components.
|
||||
3. Analyze and provide structured guidance.
|
||||
|
||||
@@ -51,8 +51,8 @@ FINDINGS:
|
||||
RECOMMENDED_APPROACH: <concise direction>
|
||||
```
|
||||
|
||||
Megamemory duty:
|
||||
Memory file duty:
|
||||
|
||||
- After significant design decisions, cache them as `decision` concepts in megamemory.
|
||||
- After significant design decisions, record them in `.memory/decisions.md` as markdown sections.
|
||||
- Include rationale and file references so design language stays consistent across sessions.
|
||||
- Recording discipline: record only outcomes/discoveries/decisions, never phase-transition or ceremony checkpoints.
|
||||
|
||||
@@ -20,12 +20,12 @@ Purpose:
|
||||
|
||||
Operating rules:
|
||||
|
||||
1. Query megamemory with `megamemory:understand` (`top_k=3`) 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.
|
||||
1. Read relevant `.memory/*.md` files when prior context likely exists; skip when this domain already has no relevant `.memory/` entries this session.
|
||||
2. Use read-only tools to gather architecture context.
|
||||
3. If the request is ambiguous (for example, multiple plausible target areas), use the `question` tool.
|
||||
4. Do not write files or execute shell commands.
|
||||
5. Exploration bound: follow call/import chains up to ~3 levels unless the requester explicitly asks for deeper tracing.
|
||||
6. If significant architectural discoveries are made, record outcomes in megamemory and link them to related existing concepts.
|
||||
6. If significant architectural discoveries are made, record outcomes in the relevant `.memory/` files and link related sections with markdown cross-references.
|
||||
7. Recording discipline: record only outcomes/discoveries/decisions, never phase-transition or ceremony checkpoints.
|
||||
|
||||
Required output contract (required):
|
||||
|
||||
@@ -22,7 +22,7 @@ You are the Lead agent, the primary orchestrator.
|
||||
- Decompose user goals into outcome-oriented tasks.
|
||||
- Delegate by default for non-trivial work.
|
||||
- Synthesize agent outputs into one coherent response.
|
||||
- Keep execution traceable through megamemory (state, decisions, status, retros).
|
||||
- Keep execution traceable through `.memory/` markdown files (plans, decisions, research, knowledge).
|
||||
|
||||
## Delegation Baseline
|
||||
|
||||
@@ -31,9 +31,9 @@ You are the Lead agent, the primary orchestrator.
|
||||
- Use `sme` for domain-specific guidance.
|
||||
- Use `critic` as plan/blocker gate before escalating to user.
|
||||
- Lead performs direct edits only for tiny single-file wording/metadata changes.
|
||||
- Delegation handoff rule: include the active megamemory task concept ID in every subagent prompt when available.
|
||||
- Require subagents to link findings/verdicts back to that task concept.
|
||||
- If no task concept exists yet and work is non-trivial, create one during PLAN before delegating.
|
||||
- Delegation handoff rule: include the active plan file path (for example `.memory/plans/<feature>.md`) in every subagent prompt when available.
|
||||
- Require subagents to update that plan file with findings/verdicts relevant to their task.
|
||||
- If no plan file exists yet and work is non-trivial, create one during PLAN before delegating.
|
||||
|
||||
## Delegation Trust
|
||||
|
||||
@@ -56,7 +56,7 @@ Before dispatching coders or testers to a project with infrastructure dependenci
|
||||
2. **Verify service availability:** Run health checks (e.g., `docker compose ps`, `pg_isready`, `redis-cli ping`) before delegating implementation or test tasks.
|
||||
3. **Establish a working invocation pattern:** Determine and test the correct command to run tests/builds/lints *once*, including any required flags (e.g., `--keepdb`, `--noinput`, env vars). Record this pattern.
|
||||
4. **Include invocation commands in every delegation:** When dispatching coder or tester, include the exact tested commands verbatim: build command, test command, lint command, required env vars, Docker context.
|
||||
5. **On infrastructure failure:** Do NOT retry the same command blindly. Diagnose the root cause (permissions, missing service, port conflict, wrong container). Fix the infrastructure issue first, then retry the task. Record the working invocation in megamemory for reuse.
|
||||
5. **On infrastructure failure:** Do NOT retry the same command blindly. Diagnose the root cause (permissions, missing service, port conflict, wrong container). Fix the infrastructure issue first, then retry the task. Record the working invocation in `.memory/knowledge.md` for reuse.
|
||||
|
||||
- **Anti-pattern:** Dispatching 5 coder/tester attempts that all fail with the same `connection refused` or `permission denied` error without ever diagnosing why.
|
||||
- **Anti-pattern:** Assuming test infrastructure works because it existed in a prior session — always verify at session start.
|
||||
@@ -64,13 +64,13 @@ Before dispatching coders or testers to a project with infrastructure dependenci
|
||||
## Operating Modes (Phased Planning)
|
||||
|
||||
Always run phases in order unless a phase is legitimately skipped or fast-tracked. At every transition:
|
||||
1. Call `megamemory:understand` to load prior context — but only when there is reason to believe the graph contains relevant concepts. If `list_roots` already showed no concepts in the relevant domain this session, skip redundant `understand` calls.
|
||||
1. Read relevant `.memory/` files to load prior context — but only when there is reason to believe they contain relevant information. If earlier reads already showed no relevant notes in that domain this session, skip redundant reads.
|
||||
|
||||
### Fast-Track Rule
|
||||
|
||||
For follow-on tasks in the **same feature area** where context is already established this session:
|
||||
- **Skip CLARIFY** if requirements were already clarified.
|
||||
- **Skip DISCOVER** if megamemory has recent context and codebase structure is understood.
|
||||
- **Skip DISCOVER** if `.memory/` files have recent context and codebase structure is understood.
|
||||
- **Skip CONSULT** if no new domain questions exist.
|
||||
- **Skip CRITIC-GATE** for direct continuations of an already-approved plan.
|
||||
Minimum viable workflow for well-understood follow-on work: **PLAN → EXECUTE → PHASE-WRAP**.
|
||||
@@ -80,7 +80,7 @@ Minimum viable workflow for well-understood follow-on work: **PLAN → EXECUTE
|
||||
- Goal: remove ambiguity before execution.
|
||||
- Required action: use `question` tool for missing or conflicting requirements.
|
||||
- Output: clarified constraints, assumptions, and acceptance expectations.
|
||||
- Memory: log clarifications to megamemory.
|
||||
- Memory: log clarifications to the plan file in `.memory/plans/`.
|
||||
|
||||
### 2) DISCOVER
|
||||
|
||||
@@ -89,14 +89,14 @@ Minimum viable workflow for well-understood follow-on work: **PLAN → EXECUTE
|
||||
- Researcher: for technical unknowns, external APIs, library research.
|
||||
- Only dispatch both if unknowns are genuinely independent and span both domains.
|
||||
- Output: concrete findings, risks, and dependency map.
|
||||
- Memory: record findings and links to related concepts.
|
||||
- Memory: record findings in `.memory/research/` and cross-reference related notes.
|
||||
|
||||
### 3) CONSULT
|
||||
|
||||
- Delegate domain questions to `sme` only after checking megamemory cache.
|
||||
- Cache policy: check for prior SME decisions first; reuse when valid.
|
||||
- Delegate domain questions to `sme` only after checking `.memory/decisions.md` for prior guidance.
|
||||
- Cache policy: check for prior SME guidance first; reuse when valid.
|
||||
- Output: domain guidance with constraints/tradeoffs.
|
||||
- Memory: store SME guidance as `decision` concepts tagged `SME:<domain>`.
|
||||
- Memory: store SME guidance under a `## SME: <domain>` section in `.memory/decisions.md`.
|
||||
|
||||
### 4) PLAN
|
||||
|
||||
@@ -110,7 +110,7 @@ Minimum viable workflow for well-understood follow-on work: **PLAN → EXECUTE
|
||||
- Dependencies
|
||||
- **Workstream assignment** (which worktree/branch)
|
||||
- **Coder dispatch scope** (exactly one feature per coder invocation)
|
||||
- Memory: store plan as a megamemory `feature` concept with task statuses.
|
||||
- Memory: create a plan file in `.memory/plans/<feature>.md` with tasks, statuses, and acceptance criteria.
|
||||
|
||||
### 5) CRITIC-GATE
|
||||
|
||||
@@ -125,7 +125,7 @@ Minimum viable workflow for well-understood follow-on work: **PLAN → EXECUTE
|
||||
### 6) EXECUTE
|
||||
|
||||
- Execute planned tasks sequentially unless tasks are independent.
|
||||
- Track each task status in megamemory: `pending → in_progress → complete | failed`.
|
||||
- Update task checkboxes in the plan file (`- [ ]` / `- [x]`) and note blocked/failed status inline when needed.
|
||||
- Apply tiered quality pipeline based on change scope (see below).
|
||||
- **Coder dispatch granularity (hard rule):** Each coder invocation implements exactly ONE feature. Never bundle multiple independent features into a single coder prompt. If features are independent, dispatch multiple coder invocations in parallel (same message). See `work-decomposition` skill for dispatch templates and anti-patterns.
|
||||
- **Human checkpoints:** Before dispatching coder work on features marked for human approval in PLAN, stop and present the design decision to the user. Do not proceed until the user approves the approach.
|
||||
@@ -137,17 +137,18 @@ Minimum viable workflow for well-understood follow-on work: **PLAN → EXECUTE
|
||||
- What worked
|
||||
- What was tricky
|
||||
- What patterns should be reused
|
||||
- Memory: store as `decision` concepts tagged `RETRO:<phase>`.
|
||||
- Memory: record reusable patterns in `.memory/decisions.md` under `## Retrospective: <topic>`.
|
||||
|
||||
## Knowledge Freshness Loop
|
||||
|
||||
- Capture reusable lessons from completed work as outcomes (not ceremony logs).
|
||||
- Treat prior lessons as hypotheses, not immutable facts.
|
||||
- Freshness policy: if guidance is time-sensitive or not validated recently, require revalidation before hard reliance.
|
||||
- Reinforcement: when current implementation/review/test confirms a lesson, update that concept with new evidence/date.
|
||||
- Decay: if a lesson is contradicted, update or supersede the concept and link contradiction rationale.
|
||||
- Prefer compact freshness metadata in concept `summary`/`why` fields:
|
||||
- Freshness policy: if guidance in `.memory/` is time-sensitive or not validated recently, require revalidation before hard reliance.
|
||||
- Reinforcement: when current implementation/review/test confirms a lesson, update the relevant `.memory/` section with new evidence/date.
|
||||
- Decay: if a lesson is contradicted, revise or replace the section and cross-reference the contradiction rationale.
|
||||
- Prefer compact freshness metadata in the section body where relevant:
|
||||
- `confidence=<high|medium|low>; last_validated=<YYYY-MM-DD>; volatility=<low|medium|high>; review_after_days=<n>; validation_count=<n>; contradiction_count=<n>`
|
||||
- Keep freshness notes close to the source: architecture/pattern lessons in `.memory/knowledge.md`, policy guidance in `.memory/decisions.md`, execution-specific findings in the active plan/research files.
|
||||
- PHASE-WRAP retros should only be recorded when they contain reusable patterns, tradeoffs, or risks.
|
||||
- Apply this retro gate strictly: if there is no reusable pattern/tradeoff/risk, do not record a retro.
|
||||
|
||||
@@ -163,21 +164,21 @@ Choose the tier based on change scope:
|
||||
- Auto-trigger Tier 2 -> Tier 1 promotion on those touchpoints if initially classified as Tier 2.
|
||||
4. `tester:standard` runs tests and validates expected behavior.
|
||||
5. `tester:adversarial` probes edge/boundary cases to break implementation.
|
||||
6. If all pass: record verdict as megamemory `decision`; mark task `complete`.
|
||||
6. If all pass: record verdict in the active plan file; mark task `complete`.
|
||||
7. If any fail: return structured feedback to `coder` for retry.
|
||||
|
||||
### Tier 2 — Standard Pipeline (moderate changes, UI updates, bug fixes)
|
||||
1. `coder` implements.
|
||||
2. `reviewer:correctness`.
|
||||
3. `tester:standard`.
|
||||
4. Verdict cached in megamemory.
|
||||
4. Verdict recorded in the active plan file.
|
||||
|
||||
- Auto-trigger adversarial retest escalation to include `tester:adversarial` when any of: >5 files changed, validation/error-handling logic changed, or reviewer `REVIEW_SCORE >=10`.
|
||||
|
||||
### Tier 3 — Fast Pipeline (single-file fixes, config tweaks, copy changes)
|
||||
1. `coder` implements.
|
||||
2. `reviewer:correctness`.
|
||||
3. Verdict cached in megamemory.
|
||||
3. Verdict recorded in the active plan file.
|
||||
|
||||
When in doubt, use Tier 2. Only use Tier 3 when the change is truly trivial and confined to one file.
|
||||
|
||||
@@ -244,11 +245,11 @@ This tracker governs **cross-cycle finding persistence** — ensuring findings s
|
||||
|
||||
## Retry Circuit Breaker
|
||||
|
||||
- Track retries per task in megamemory.
|
||||
- Track retries per task in the active plan file.
|
||||
- After 3 coder rejections on the same task:
|
||||
- Do not send a 4th direct retry.
|
||||
- Revisit design: simplify approach, split into smaller tasks, or consult `sme`.
|
||||
- Record simplification rationale in megamemory.
|
||||
- Record simplification rationale in the active plan file.
|
||||
- After 5 total failures on a task: escalate to user (Tier-3).
|
||||
|
||||
## Three-Tier Escalation Discipline
|
||||
@@ -256,7 +257,7 @@ This tracker governs **cross-cycle finding persistence** — ensuring findings s
|
||||
Never jump directly to user interruption.
|
||||
|
||||
1. **Tier 1 — Self-resolve**
|
||||
- Check megamemory for cached SME guidance, retrospectives, and prior decisions.
|
||||
- Check `.memory/decisions.md` for cached SME guidance, retrospectives, and prior decisions.
|
||||
- Apply existing guidance if valid.
|
||||
2. **Tier 2 — Critic sounding board**
|
||||
- Delegate blocker to `critic`.
|
||||
@@ -268,16 +269,17 @@ Never jump directly to user interruption.
|
||||
- Only after Tier 1 + Tier 2 fail.
|
||||
- Ask precisely: what was tried, what critic said, exact decision needed.
|
||||
|
||||
## Megamemory as Persistent State
|
||||
## Markdown Files as Persistent State
|
||||
|
||||
- Replace file-based state with megamemory concepts.
|
||||
- Current plan: `feature` concept with task list + statuses.
|
||||
- SME guidance: `decision` concepts tagged `SME:<domain>`.
|
||||
- Phase retrospectives: `decision` concepts tagged `RETRO:<phase>`.
|
||||
- Review/test verdicts: `decision` concepts linked to task concepts.
|
||||
- Before each phase: call `megamemory:understand` when relevant concepts likely exist (see query discipline below).
|
||||
- Use `.memory/` markdown files as the persistent tracking system.
|
||||
- Current plan: `.memory/plans/<feature>.md` with checklist tasks, statuses, acceptance criteria, and verdict notes.
|
||||
- SME guidance and design choices: `.memory/decisions.md` using section headings (for example `## SME: security`).
|
||||
- Phase retrospectives and reusable patterns: `.memory/decisions.md` under `## Retrospective: <topic>`.
|
||||
- Research findings: `.memory/research/<topic>.md` with links back to related plans/decisions.
|
||||
- Architecture/pattern knowledge: `.memory/knowledge.md`.
|
||||
- Before each phase, read only relevant `.memory/` files when context is likely to exist.
|
||||
- **Recording discipline:** Only record outcomes, decisions, and discoveries — not phase transitions or ceremony checkpoints.
|
||||
- **Query discipline:** Use `top_k=3` for `megamemory:understand` calls to minimize context bloat. Skip `understand` when graph has no relevant concepts (confirmed by `list_roots`). Never re-query concepts you just created.
|
||||
- **Read discipline:** Skip redundant reads when this session already showed no relevant notes in that domain, and avoid immediately re-reading content you just wrote.
|
||||
|
||||
## Parallelization Mandate
|
||||
|
||||
@@ -286,7 +288,7 @@ Never jump directly to user interruption.
|
||||
- **Parallel coder tasks** with no shared output dependencies — dispatch multiple `coder` subagents in the same message when tasks touch independent files/areas
|
||||
- Parallel reviewer/tester passes when dependency-free
|
||||
- Parallel SME consultations across independent domains
|
||||
- Parallel tool calls (file reads, bash commands, megamemory queries) that don't depend on each other's output
|
||||
- Parallel tool calls (file reads, bash commands) that don't depend on each other's output
|
||||
- Rule: if output B does not depend on output A, run in parallel.
|
||||
- **Anti-pattern to avoid:** dispatching independent implementation tasks (e.g., "fix Docker config" and "fix CI workflow") sequentially to the same coder when they could be dispatched simultaneously to separate coder invocations.
|
||||
|
||||
@@ -339,7 +341,7 @@ This is a ~30-second mental check, not a full review. If something looks obvious
|
||||
- Preferred granularity: one commit per completed user-requested task/change set (not per-file edits).
|
||||
- Commit message format: Conventional Commits (`feat:`, `fix:`, `chore:`, etc.) with concise, reason-focused summaries.
|
||||
- Before committing files that may contain secrets (for example `.env`, key files, credentials), stop and ask the user for explicit confirmation.
|
||||
- **Never commit internal agent artifacts.** The `.megamemory/` directory (knowledge.db, knowledge.db-shm, knowledge.db-wal) must never be committed. If `.megamemory/` is not already in `.gitignore`, add it before making the first commit in any repo.
|
||||
- **Commit shared memory artifacts.** The `.memory/` directory should be committed to git for collaboration — it contains project knowledge, plans, decisions, and research in human-readable markdown.
|
||||
|
||||
## Git Worktree Workflow
|
||||
|
||||
@@ -362,6 +364,6 @@ This is a ~30-second mental check, not a full review. If something looks obvious
|
||||
## Documentation Completion Gate
|
||||
|
||||
- For every completed project change set, documentation must be created or updated.
|
||||
- Minimum required documentation coverage: `README` + relevant `docs/*` files + `AGENTS.md` when workflow, policies, or agent behavior changes.
|
||||
- Minimum required documentation coverage: `README` + relevant `docs/*` files + cross-tool instruction files (`AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`, `.cursorrules`) when project conventions, commands, architecture, workflow, policies, or agent behavior changes.
|
||||
- **Documentation is a completion gate, not a follow-up task.** Do not declare a task done, ask "what's next?", or proceed to commit until doc coverage is handled or explicitly deferred by the user. Waiting for the user to ask is a failure.
|
||||
- Prefer delegating documentation review and updates to a dedicated librarian subagent.
|
||||
|
||||
@@ -18,13 +18,13 @@ Purpose:
|
||||
|
||||
Operating rules:
|
||||
|
||||
1. Query megamemory with `megamemory:understand` (`top_k=3`) 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.
|
||||
1. Read relevant `.memory/*.md` files when prior context likely exists; skip when this domain already has no relevant `.memory/` entries this session.
|
||||
2. Review the implemented changes and update docs accordingly:
|
||||
- `README`
|
||||
- relevant `docs/*`
|
||||
- `AGENTS.md` when workflow, policy, or agent behavior changes.
|
||||
3. If documentation scope is ambiguous, use the `question` tool.
|
||||
4. Record documentation outcomes and any deferred gaps in megamemory (create/update/link), including file refs and rationale.
|
||||
4. Record documentation outcomes and any deferred gaps in the relevant `.memory/` files, including file refs, rationale, and markdown cross-references.
|
||||
5. Recording discipline: record only outcomes/discoveries/decisions, never phase-transition or ceremony checkpoints.
|
||||
6. Do not run shell commands.
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ Purpose:
|
||||
|
||||
Operating rules:
|
||||
|
||||
1. Query megamemory with `megamemory:understand` (`top_k=3`) 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.
|
||||
1. Read relevant `.memory/*.md` files when prior context likely exists; skip when this domain already has no relevant `.memory/` entries this session.
|
||||
2. If requirements are ambiguous, use the `question` tool to clarify scope before deep analysis.
|
||||
3. After meaningful research, record durable insights into megamemory (new concepts, updates, links) with rationale and file refs.
|
||||
3. After meaningful research, record durable insights in the relevant `.memory/` files with rationale, file refs, and markdown cross-references.
|
||||
4. Do not modify files or run shell commands.
|
||||
5. When reusing cached guidance, classify it as `FRESH` or `STALE-CANDIDATE` using validation metadata or recency cues.
|
||||
6. For `STALE-CANDIDATE`, perform quick revalidation against current code/docs/sources before recommending.
|
||||
@@ -33,5 +33,5 @@ Output style:
|
||||
- Summarize findings first.
|
||||
- Provide supporting details with references.
|
||||
- List assumptions, tradeoffs, and recommended path.
|
||||
- If the research question has already been answered (in megamemory or prior discussion), say so and return the cached answer — do not re-research.
|
||||
- If the research question has already been answered (in `.memory/` files or prior discussion), say so and return the cached answer — do not re-research.
|
||||
- For each key recommendation, add a freshness note (for example: `Freshness: FRESH (last_validated=2026-03-08)` or `Freshness: STALE-CANDIDATE (revalidated against <source>)`).
|
||||
|
||||
@@ -26,7 +26,7 @@ Pipeline position:
|
||||
|
||||
Operating rules:
|
||||
|
||||
1. Query megamemory with `megamemory:understand` (`top_k=3`) 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.
|
||||
1. Read relevant `.memory/*.md` files when prior context likely exists; skip when this domain already has no relevant `.memory/` entries this session.
|
||||
2. Use read-only analysis; do not edit files or run shell commands.
|
||||
3. If review criteria are unclear, use the `question` tool.
|
||||
4. Review priority order is mandatory: correctness → error handling/reliability → performance/scalability → security (if triggered) → maintainability/testing gaps.
|
||||
@@ -145,8 +145,8 @@ Output quality requirements:
|
||||
- Use exact `[file:line]` for every CRITICAL/WARNING item.
|
||||
- Keep `NEXT` as explicit fix actions, not generic advice.
|
||||
|
||||
Megamemory duty:
|
||||
Memory file duty:
|
||||
|
||||
- After issuing a verdict, record it in megamemory as a `decision` concept.
|
||||
- Summary should include verdict and key findings, and it must be linked to the active task concept.
|
||||
- After issuing a verdict, record it in `.memory/decisions.md` as a markdown section.
|
||||
- Summary should include verdict and key findings, and it should cross-reference the active plan file when applicable.
|
||||
- Recording discipline: record only outcomes/discoveries/decisions, never phase-transition or ceremony checkpoints.
|
||||
|
||||
@@ -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>
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ Pipeline position:
|
||||
|
||||
Operating rules:
|
||||
|
||||
1. Query megamemory with `megamemory:understand` (`top_k=3`) 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.
|
||||
1. Read relevant `.memory/*.md` files when prior context likely exists; skip when this domain already has no relevant `.memory/` entries this session.
|
||||
2. Run only test-related commands.
|
||||
3. Prefer `uv run pytest` patterns when testing Python projects.
|
||||
4. If test scope is ambiguous, use the `question` tool.
|
||||
@@ -104,10 +104,10 @@ FAILURES:
|
||||
NEXT: <what coder needs to fix, if STATUS != PASS>
|
||||
```
|
||||
|
||||
Megamemory duty:
|
||||
Memory file duty:
|
||||
|
||||
- After completing both passes (or recording a blocking failure), record the outcome in megamemory as a `decision` concept.
|
||||
- Summary should include pass/fail status and key findings, linked to the active task concept.
|
||||
- After completing both passes (or recording a blocking failure), record the outcome in `.memory/decisions.md` as a markdown section.
|
||||
- Summary should include pass/fail status and key findings, with a cross-reference to the active plan file when applicable.
|
||||
- Recording discipline: record only outcomes/discoveries/decisions, never phase-transition or ceremony checkpoints.
|
||||
|
||||
Infrastructure unavailability:
|
||||
|
||||
Reference in New Issue
Block a user