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

2.7 KiB

Context Manager Task 3 Durable Constraint Fix Report

Status

  • Done
  • Fixed the remaining durable-constraint extraction gaps in the context-manager extractor.
  • Kept the change narrowly scoped and preserved the earlier source-stable subject behavior plus the narrowed ambiguous-scope behavior.

Changes

  1. Allowed explicit durable file-specific constraints to remain session-scoped in .pi/agent/extensions/context-manager/src/extract.ts

    • Updated inferConstraintScope() so branch-local cues still win first.
    • Checked durable session-wide phrasing before falling back to file-path-based branch scoping.
    • This keeps ambiguous file-specific lines branch-scoped while allowing explicit durable lines such as Avoid touching docs/extensions.md across the whole session. to resolve to session.
  2. Expanded the constraint trigger in .pi/agent/extensions/context-manager/src/extract.ts

    • Introduced a shared CONSTRAINT_RE.
    • Added support for the spelled-out do not form alongside the existing must, should, don't, avoid, and prefer triggers.
  3. Added regression coverage in .pi/agent/extensions/context-manager/src/extract.test.ts

    • Extended the user-constraint scope test with both:
      • Avoid touching docs/extensions.md.branch
      • Avoid touching docs/extensions.md across the whole session.session
    • Added a dedicated regression test for:
      • Do not add new LLM-facing tools across the whole session. → extracted constraint

Tests

  • cd /home/alex/dotfiles/.worktrees/context-manager-extension/.pi/agent/extensions/context-manager && npx tsx --test src/extract.test.ts
    • Result: 5 tests passed, 0 failed
  • cd /home/alex/dotfiles/.worktrees/context-manager-extension/.pi/agent/extensions/context-manager && npm test
    • Result: 16 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-durable-fix-report.md

Self-Review Findings

  • The fix is limited to constraint detection and scope inference; no public APIs or ledger merge behavior changed.
  • Source-stable subject generation remains untouched.
  • Ambiguous file-specific instructions without explicit durable phrasing still stay branch scoped.
  • Explicit durable session-wide wording now correctly overrides file-path presence for constraint scope.

Concerns

  • Constraint extraction remains heuristic-based by design, so contradictory phrasing that mixes branch-local and session-wide cues will still resolve conservatively to branch.
  • No additional blocking concerns found after the targeted and full test runs.