From 8a873f300c8b44e9ce306cd04b1d5c031edeb242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E5=A4=A9=E8=8E=B2?= <91449279+yitianlian@users.noreply.github.com> Date: Wed, 11 Mar 2026 10:15:43 +0800 Subject: [PATCH] Require memory retrieval after compaction signals --- .agents/skills/memory-manager/SKILL.md | 24 ++++++++++++++++++----- .agents/skills/research-workflow/SKILL.md | 15 +++++++++----- AGENTS.md | 15 +++++++------- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/.agents/skills/memory-manager/SKILL.md b/.agents/skills/memory-manager/SKILL.md index cab38b7..b133d6f 100644 --- a/.agents/skills/memory-manager/SKILL.md +++ b/.agents/skills/memory-manager/SKILL.md @@ -50,10 +50,14 @@ Todo granularity should be task-level (small stages/subtasks), not command-level Retrieve early when useful, but do not block execution: 1. Query by `project`, `task_type`, `error_signature` first. -2. Add tags and FTS when exact filters miss. -3. Prefer `active` procedures/insights when confidence is similar. -4. Flag stale entries with low confidence. -5. If retrieval is low-yield and task is time-sensitive, continue with search/deep research directly. +2. Upgrade retrieval from optional to mandatory before continuing when either of these triggers is present: + - you are modifying `memory-manager` or another Memory-related skill/instruction + - a status, state, or context file contains compaction markers such as `Compact`, `压缩`, `Summary`, or similar summary/compression techniques +3. In mandatory-retrieval cases, read prior Memory first and treat the result as required context recovery rather than a best-effort lookup. +4. Add tags and FTS when exact filters miss. +5. Prefer `active` procedures/insights when confidence is similar. +6. Flag stale entries with low confidence. +7. If retrieval is low-yield and task is time-sensitive, continue with search/deep research directly only when the mandatory-retrieval triggers are absent. ## Writeback Policy @@ -91,7 +95,17 @@ If execution becomes repetitive or confused: 1. Rebuild working state from action and observation logs. 2. Run targeted retrieval by project/task/error signature. -3. Publish compact state summary before continuing. +3. If drift followed a compaction step or summary-style recovery, read prior Memory before publishing or trusting a compact state summary. +4. Publish compact state summary before continuing. + +## Compaction Recovery Policy + +When context may have been compressed: + +1. Inspect available status/state/context files for markers such as `Compact`, `压缩`, `Summary`, or equivalent summary/compression techniques. +2. If any marker is present, call `memory-manager` to read prior Memory before editing instructions, planning next actions, or resuming execution. +3. If prior Memory cannot be read, treat that as an active blocker because key context may be missing. +4. Record the compaction trigger and retrieval result in working state or the next stage report. ## Promotion Policy diff --git a/.agents/skills/research-workflow/SKILL.md b/.agents/skills/research-workflow/SKILL.md index f58560b..0533d74 100644 --- a/.agents/skills/research-workflow/SKILL.md +++ b/.agents/skills/research-workflow/SKILL.md @@ -68,15 +68,20 @@ Repeat this loop until completion: Use these in combination: 1. Treat memory as an optional accelerator, not a hard prerequisite. -2. Use search/deep research directly when topic is time-sensitive, new, or currently blocked. -3. For open-ended research/scoping requests, run deep research before giving decomposition or roadmap recommendations. -4. For unknown errors, use this branch: +2. Override that default and retrieve memory first when either of these is true: + - the current task modifies `memory-manager` or another Memory-related skill/policy + - state/context files show compaction markers such as `Compact`, `压缩`, `Summary`, or equivalent summary/compression techniques +3. In those override cases, call `memory-manager` to read prior Memory before planning, editing, or resuming execution. +4. Use search/deep research directly when topic is time-sensitive, new, or currently blocked. +5. For open-ended research/scoping requests, run deep research before giving decomposition or roadmap recommendations. +6. For unknown errors, use this branch: - local evidence triage (logs, stack trace, recent changes) - targeted search - deep research (debug-investigation) if still unresolved - minimal fix validation -5. If skipping memory before search, record reason in the stage report. -6. If intake information is missing, trigger `human-checkpoint` before deep research or planning. +7. If compaction is detected, treat missing memory retrieval as a workflow violation and recover by reading prior Memory before continuing. +8. If skipping memory before search outside the override cases, record reason in the stage report. +9. If intake information is missing, trigger `human-checkpoint` before deep research or planning. ## Replanning Policy diff --git a/AGENTS.md b/AGENTS.md index 51d42ef..9533ca9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,13 +6,14 @@ This workspace is for AI research and development tasks (reproduction, debugging 1. Start each non-trivial research task with `run-governor` to select mode and initialize `run_id` paths. 2. Use `research-workflow` as the default orchestration loop. 3. Use `memory-manager` to maintain working todo state and long-term memory. -4. Trigger `human-checkpoint` using mode-aware policy, always for major safety risks and shared-memory publication. -5. Use `experiment-execution` only for actual run execution. -6. Use `project-context` to collect and persist per-project private runtime context before experiments or report/eval execution. -7. Use `deep-research` for deep external investigation and evidence synthesis, including early-stage project scoping when a user wants to write a research study or paper on a topic. -8. Base conclusions on evidence only (command outputs, metrics, logs, and file diffs). -9. Prefer small, reversible, verifiable steps over broad speculative changes. -10. Follow `REPO_CONVENTIONS.md` for artifact placement and commit hygiene. +4. If you modify `memory-manager` or any Memory-related skill, or detect compaction markers in state/context files such as `Compact`, `压缩`, `Summary`, or similar summary/compression techniques, invoke `memory-manager` to read prior Memory before continuing so key context is not dropped. +5. Trigger `human-checkpoint` using mode-aware policy, always for major safety risks and shared-memory publication. +6. Use `experiment-execution` only for actual run execution. +7. Use `project-context` to collect and persist per-project private runtime context before experiments or report/eval execution. +8. Use `deep-research` for deep external investigation and evidence synthesis, including early-stage project scoping when a user wants to write a research study or paper on a topic. +9. Base conclusions on evidence only (command outputs, metrics, logs, and file diffs). +10. Prefer small, reversible, verifiable steps over broad speculative changes. +11. Follow `REPO_CONVENTIONS.md` for artifact placement and commit hygiene. ## Skill Paths - `.agents/skills/run-governor`