# Context Manager Task 3 Scope Fix Report ## Status - Done - Tightened the remaining user-constraint scope heuristic so ambiguous constraint lines stay `branch` scoped. - Preserved the source-stable subject behavior introduced in the prior Task 3 fix. ## Changes 1. **Narrowed durable session promotion in `.pi/agent/extensions/context-manager/src/extract.ts`** - Removed the bare-keyword session promotion behavior for terms such as `MVP` and `context window`. - Kept `session` scope promotion limited to clearer durability signals such as `whole session`, `across branches`, `session-wide`, `project-wide`, and similar explicit phrasing. 2. **Strengthened local-scope detection** - Treated `this module` / `in this module` as branch-local cues so module-local rename instructions do not leak across branch switches. 3. **Added regression coverage in `.pi/agent/extensions/context-manager/src/extract.test.ts`** - Updated the existing extraction expectation so `We must adapt to the active model context window.` remains `branch` scoped. - Added explicit regression assertions for the reviewer’s false-positive examples: - `We should keep the MVP branch experimental.` → `branch` - `We should rename the context window helper in this module.` → `branch` - Kept a durable-session control case to verify explicit session phrasing still promotes correctly. ## 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, 0 failed - `cd /home/alex/dotfiles/.worktrees/context-manager-extension/.pi/agent/extensions/context-manager && npm test` - Result: 15 tests passed, 0 failed ## 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-scope-fix-report.md` ## Self-Review Findings - The fix stays narrowly scoped to `inferConstraintScope()` heuristics and targeted regression coverage. - Public APIs and exported function signatures are unchanged. - The previously fixed source-stable `subject` generation remains untouched. - The updated tests cover both the reviewer’s concrete false positives and an existing ambiguous `context window` example. ## Concerns - Constraint scoping remains heuristic-based by design, so the extractor is intentionally conservative: unclear user constraints now stay `branch` scoped unless the text explicitly signals broader durability. - No additional blocking concerns found after the targeted and full test runs.