Skip to content

Commit e8c95a6

Browse files
committed
docs(memory): document conservative quality cleanup migration
1 parent 56d7ef9 commit e8c95a6

3 files changed

Lines changed: 28 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [1.4.0] - 2026-04-28
99

10-
### Added
11-
12-
- Unified memory quality gate in `src/memory-quality.ts` as the single source of truth for all memory quality rules.
13-
- CRITICAL MEMORY RULES in compaction prompt with explicit good/bad examples.
14-
- Auto-supersede migration `2026-04-28-quality-cleanup` that marks low-quality compaction memories as superseded on first load.
15-
16-
### Changed
10+
### Memory Quality Cleanup
1711

18-
- Memory quality rules now apply to all memory types, not just project entries.
19-
- Compaction prompt explicitly instructs model that most compactions should produce zero memories.
20-
- Low-quality compaction memories (progress snapshots, implementation notes, session-internal notes) are automatically superseded during workspace memory normalization.
12+
- Unified quality gate for compaction memory candidates and cleanup checks.
13+
- Rewritten compaction memory prompt to reduce over-production of low-quality memories.
14+
- Conservative one-time quality cleanup migration (`2026-04-28-quality-cleanup`) that supersedes only high-confidence garbage patterns: progress snapshots, raw errors, commit/CI snapshots, temporary status notes, active file snapshots, code/API signatures, path-heavy entries, and empty entries.
15+
- Soft heuristic failures (`bad_feedback`, `bad_decision`) are intentionally excluded from automatic migration cleanup to protect durable declarative memories such as branding rules, API facts, release rules, and architecture decisions.
16+
- Migration audit log: `~/.local/share/opencode-working-memory/migration-logs/2026-04-28-quality-cleanup.jsonl`.
17+
- Extraction rejection log: `~/.local/share/opencode-working-memory/extraction-rejections.jsonl`.
2118

22-
### Migration Notes
19+
### Recovery note
2320

24-
- Existing low-quality `source: "compaction"` entries will be marked as `superseded` once on first load after upgrade.
25-
- Explicit and manual memories are never affected by quality cleanup.
26-
- Superseded entries are retained on disk with `quality_cleanup` tags for audit purposes.
27-
- Migration is idempotent and runs exactly once per workspace.
21+
The cleanup migration changes matching entries to `status: "superseded"`; it does not delete the entry. If a useful memory is superseded, inspect the migration audit log and restore by changing that entry back to `status: "active"` in the workspace's `workspace-memory.json`. The migration runs once per workspace.
2822

2923
## [1.3.3] - 2026-04-28
3024

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ It includes guards for:
174174

175175
The goal is to remember durable facts, not every detail.
176176

177+
Historical cleanup is intentionally conservative: extraction-time filtering may reject more aggressively, but one-time migration cleanup only supersedes high-confidence garbage patterns. This protects existing durable memories written in declarative style, such as "API endpoint is X" or "Product branding is Y".
178+
177179
## Configuration
178180

179181
OpenCode Working Memory works out of the box.

scripts/dev/dry-run-migration.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { loadWorkspaceMemory } from "../../src/workspace-memory.ts";
2+
3+
const roots = [
4+
"/Users/sd_wo/work/opencode-working-memory",
5+
"/Users/sd_wo/Documents/projects/Pre-cancer-atlas",
6+
"/Users/sd_wo/work/opencode-record",
7+
"/Users/sd_wo/work/pathology-agent-reports",
8+
"/Users/sd_wo/work/pathology-extraction",
9+
];
10+
11+
for (const root of roots) {
12+
console.log(`Loading workspace memory: ${root}`);
13+
const store = await loadWorkspaceMemory(root);
14+
const active = store.entries.filter(entry => entry.status !== "superseded").length;
15+
const superseded = store.entries.filter(entry => entry.status === "superseded").length;
16+
console.log(` active=${active} superseded=${superseded} migrations=${(store.migrations ?? []).join(",")}`);
17+
}

0 commit comments

Comments
 (0)