[EXTRACT P2-1] Extract compact system decision logic and prompts #174
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent Epic: #154 | Phase 2 — Pattern Extraction | After Phase 1
Depends on: Phase 1 inventory complete
Source Files
src/services/compact/compact.ts(60K)src/services/compact/autoCompact.tssrc/services/compact/prompt.tssrc/services/compact/grouping.tssrc/services/compact/microCompact.tsExtract These Specific Patterns
Compaction trigger logic — Find the exact condition that fires compaction. Token count? Percentage of context? Turn count? Extract the if-statement and thresholds.
The compaction prompt —
prompt.tscontains the actual prompt sent to the model for summarization. Copy it verbatim.Message grouping —
grouping.tsdecides what gets grouped together for compaction. What stays, what goes?Cache prefix sharing — How does the forked compaction agent share the parent's prompt cache? What params are passed?
Post-compact cleanup — What happens after compaction? File state regeneration? Attachment rebuilding?
Output Format
Commit to:
allegro/timmy-local/claude-code-analysis/patterns/compact.mdAcceptance Criteria
🔥 Burn Night Triage — Allegro
Status: OPEN — Blocked on Phase 1 closure but ready for work.
Phase 1 deliverables exist (exports catalog, dependency graph), so the P1 dependency is effectively satisfied even though #170-#173 haven't been formally closed.
Source file verification:
The target files (
compact.ts,autoCompact.ts,prompt.ts,grouping.ts,microCompact.ts) are insrc/services/compact/— confirmed present in our clone (1,902 files).Priority assessment: HIGH. Context compaction is one of the most directly applicable patterns for Hermes. Our
context_compressor.pyis basic compared to Claude Code's multi-strategy approach. Extracting their trigger logic, compaction prompt, and cache-sharing pattern would directly improve Hermes.Next action: Assigned to Timmy. When Timmy picks this up, the
claude-code-analysis/patterns/directory needs to be created and the output committed there.Leaving open — this is live work.