feat: sharpen compaction memory extraction prompt

Wave 3 of memory quality optimization plan.

- Add good memory examples in buildCompactionPrompt()
- Add bad memory examples to skip (test counts, commit hashes, etc.)
- Add prompt assertions in tests to prevent regression
- Emphasize 'useful if a new agent opens this workspace next week'
This commit is contained in:
Ralph Chang
2026-04-27 14:40:32 +08:00
parent 5fe4955057
commit bfa2972353
2 changed files with 24 additions and 0 deletions
+8
View File
@@ -275,6 +275,14 @@ test("compaction hook sets output.prompt with ---free template", async () => {
// Should contain Memory candidates format
assert.equal(prompt!.includes("Memory candidates:"), true,
"Prompt should include Memory candidates: label");
assert.equal(prompt!.includes("Good memory examples:"), true,
"Prompt should include concrete positive memory examples");
assert.equal(prompt!.includes("Bad memory examples to skip:"), true,
"Prompt should include concrete negative memory examples");
assert.equal(prompt!.includes("42 tests passed"), true,
"Prompt should explicitly reject test-count snapshots");
assert.equal(prompt!.includes("commit 4309cb8"), true,
"Prompt should explicitly reject commit-hash snapshots");
// Should contain our context data (hot session state)
assert.equal(prompt!.includes("Hot session state"), true,