2.4 KiB
2.4 KiB
Work: Session Hygiene Extension
Intent
Link to: docs/intent/2026-01-24-session-hygiene.md
Approach
Link to: docs/approach/2026-01-24-session-hygiene.md
Checklist
Phase 1: Widget + git_commit Tool
-
W001: Create extension directory structure
- Verification:
ls ~/.pi/agent/extensions/session-hygiene/index.ts
- Verification:
-
W002: Implement git status helper
-
W003: Implement footer widget showing dirty file count
- Verification:
pi -e ~/.pi/agent/extensions/session-hygiene -p "test" 2>&1 | head -5(no syntax errors)
- Verification:
-
W003: Implement footer widget showing dirty file count
- Verification: Start pi in a dirty repo, observe widget shows file count
-
W004: Hook tool_result to update widget after bash/write/edit
- Verification: In pi, write a file, observe widget count increases
-
W005: Implement git_commit tool (stage files + commit)
- Verification:
pi -p "Use git_commit to commit README.md with message 'test: verify tool'"in test repo
- Verification:
Phase 2: /commit Command
-
W006: Implement session context extraction (recent messages, file touchpoints)
- Verification:
/commitin pi shows context being gathered (log or notify)
- Verification:
-
W007: Implement /commit command that injects context and triggers LLM
- Verification:
/commitin dirty repo triggers LLM response with grouping proposal
- Verification:
-
W008: Verify full flow: /commit → LLM groups → git_commit calls → widget updates
- Verification: End-to-end test in a repo with 5+ changed files across different paths
Verification Evidence
- (2026-01-24 23:xx) W001:
ls ~/.pi/agent/extensions/session-hygiene/index.ts→ exists - (2026-01-24 23:xx) W002: jiti load fails on missing module (expected) — syntax valid
- (2026-01-24 23:xx) W003: Widget shows "4 files" in dim gray, disappears after commit
- (2026-01-24 23:xx) W004: Widget updates after file writes
- (2026-01-24 23:xx) W005: git_commit tool worked — committed docs, widget disappeared
Notes
- Extension location:
~/.pi/agent/extensions/session-hygiene/ - Will use
belowEditorwidget placement — need to verify it looks right - For /commit context injection, use
pi.sendUserMessage()orbefore_agent_startmessage injection - Model for grouping: use whatever model is currently active (no separate API key needed)