Files
dotfiles/.pi/reviews/context-manager-task3-fix-report.md
2026-04-09 23:14:57 +01:00

42 lines
2.6 KiB
Markdown

# Context Manager Task 3 Fix Report
## Status
- Done
- Fixed the Task 3 review findings in the extractor and strengthened coverage around extractor/ledger interaction.
## Changes
1. **Stopped cross-slice subject collisions in extracted memory**
- Updated `.pi/agent/extensions/context-manager/src/extract.ts` so synthetic subjects for decisions, constraints, and active tasks include the source `entryId` (for example `decision-u1-0`).
- This keeps independently extracted facts from different transcript slices in separate ledger slots without changing public APIs or the ledger merge contract.
2. **Refined user-constraint scoping**
- Added a small `inferConstraintScope()` heuristic.
- User constraints now default to `branch` scope unless they include durable session-wide signals.
- Branch-local cues such as `this branch`, `for now`, `in this file`, or explicit file references stay branch-scoped.
- Durable cues such as `whole session`, `across branches`, `MVP`, or `context window` stay session-scoped.
3. **Strengthened regression coverage**
- Expanded `.pi/agent/extensions/context-manager/src/extract.test.ts` to verify source metadata, stable per-slice subject generation, extractor/ledger interaction, and the refined scope heuristic.
- Added regression coverage proving independently extracted constraints, decisions, and active tasks all remain active after `mergeCandidates()`.
## Tests
- Focused extractor tests:
- `cd /home/alex/dotfiles/.worktrees/context-manager-extension/.pi/agent/extensions/context-manager && npx tsx --test src/extract.test.ts`
- Result: 4 tests passed
- Full extension suite:
- `cd /home/alex/dotfiles/.worktrees/context-manager-extension/.pi/agent/extensions/context-manager && npm test`
- Result: 15 tests passed
## Files Changed
- Modified: `.pi/agent/extensions/context-manager/src/extract.ts`
- Modified: `.pi/agent/extensions/context-manager/src/extract.test.ts`
- Created: `.pi/reviews/context-manager-task3-fix-report.md`
## Self-Review Findings
- The fix stays focused on Task 3 behavior and keeps all public function signatures unchanged.
- No ledger changes were needed; Task 2 deterministic merge behavior remains covered by the existing ledger tests and the full suite still passes.
- The new interaction test exercises the real extractor-to-ledger path that the review flagged as missing.
## Concerns
- The extractor still uses heuristic subject generation for independently extracted items, so semantically related decisions restated in different messages will coexist unless a future task adds stronger semantic matching. That is intentional for this focused fix and avoids the reported overwrite bug.