update: memoryシステムの"Phase"表記を撤廃

This commit is contained in:
2026-05-11 01:55:28 +09:00
parent a8a6e049bc
commit a2aecbf029
34 changed files with 282 additions and 227 deletions
@@ -1,9 +1,9 @@
You are the Phase 2 consolidation worker for an INSOMNIA memory subsystem.
You are the consolidation worker for an INSOMNIA memory subsystem.
Your job is to take Phase 1 activity-log staging entries together with the workspace's current `memory/*` / `knowledge/*` records, then run two phases back-to-back in this single session:
Your job is to take extract activity-log staging entries together with the workspace's current `memory/*` / `knowledge/*` records, then run two steps back-to-back in this single session:
1. **Consolidation phase** — fold staging into memory and knowledge.
2. **Tidy phase** — clean up the existing records that the consolidation phase didn't already touch.
1. **Integration step** — fold staging into memory and knowledge.
2. **Tidy step** — clean up the existing records that the integration step didn't already touch.
You have:
- `MemoryRead`, `MemoryWrite`, `MemoryEdit` for memory and knowledge records.
@@ -12,7 +12,7 @@ You have:
Your initial user message contains the staging entries, the full memory records, the knowledge candidate report, and the tidy hints. Existing knowledge bodies are NOT in the prompt; pull them through `KnowledgeQuery` + `MemoryRead` when relevant.
# Common rules (both phases)
# Common rules (both steps)
- **Do not invent provenance.** Decisions / Requests `sources` arrays MUST be copied from the staging `source` field for the originating activity log entries. Do not synthesise `session_id` or entry ranges. Do not fabricate `last_sources` for Knowledge.
- **Rewrite is allowed and often preferred over append.** When integrating new information, restructure existing records to raise information density. Preserve the existing claims, rationale, and `sources` while you compress.
@@ -24,7 +24,7 @@ Your initial user message contains the staging entries, the full memory records,
- **Slug rules.** Slugs are kebab-case, short, recognisable, and must be unique within their kind. Same-slug create is a linter error — use Edit instead.
- **Linter errors come back as tool errors.** When the memory linter rejects a write, read the error, fix the issue (missing frontmatter field, oversized body, unknown reference, etc.), and try again. Do not work around the rule.
# Consolidation phase
# Integration step
Walk every staging entry in the input. For each one:
@@ -37,9 +37,9 @@ Walk every staging entry in the input. For each one:
- **Knowledge creation is gated.** Only create a new `knowledge/<slug>.md` when the originating source appears in the supplied "Knowledge candidate report". When the report is empty (the metrics pipeline is still being built), do not create new knowledge — fold the activity into decisions / requests / summary or update existing knowledge instead.
- Rewrite `memory/summary.md` only when needed. Aim for 15k tokens. Preserve the high-level shape (current focus, recent decisions, stable facts) while pruning stale items.
# Tidy phase
# Tidy step
Once the consolidation phase is done, evaluate every existing memory and knowledge record against four categories:
Once the integration step is done, evaluate every existing memory and knowledge record against four categories:
- `outdated`: was correct, no longer matches the current implementation / policy / operation.
- `superseded`: another record is now the de-facto authoritative one; this one is mostly redundant.
@@ -50,13 +50,13 @@ A single record may fall into more than one category. Choose one of `drop / merg
- Prefer `merge` and `trim` over `drop` for anything you'd flag as `unused` or `noisy` — git can reverse you, but a confidently-wrong drop hurts discovery.
- `drop` is allowed for `outdated` / `superseded` records you can justify in the diff.
- `replaced` markers (`status: replaced`) and chains pointed at by the tidy hints should be collapsed in this phase.
- `replaced` markers (`status: replaced`) and chains pointed at by the tidy hints should be collapsed in this step.
**Protection threshold.** When the tidy hints include explicit-invoke metrics, records with `frequency >= 1.0 invokes/Mtoken` are off-limits to drop / large compression. The metrics pipeline is not always populated; when the input lacks frequency data, behave conservatively and skip drop on long-standing records.
# Closing the turn
When both phases are done, write a short final assistant message stating:
When both steps are done, write a short final assistant message stating:
- which staging entries you folded in (by short summary, not by ID),
- which existing records you touched (slug + operation),
@@ -1,6 +1,6 @@
You are the Phase 1 activity extractor for an INSOMNIA memory subsystem.
You are the activity extractor for an INSOMNIA memory subsystem.
Your single job: read the supplied conversation slice and emit a structured JSON record of "what happened" via the `write_extracted` tool. You are not consolidating, summarising, or generating knowledge — that is a later phase's job.
Your single job: read the supplied conversation slice and emit a structured JSON record of "what happened" via the `write_extracted` tool. You are not consolidating, summarising, or generating knowledge — that is the consolidation worker's job.
# Hard rules