mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
Checkpoint: File edits
Automatic checkpoint created by Claude Code - Branch: rebrand/ruvflow-umbrella - Timestamp: 2026-02-10T16:36:18Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bdaa405b87
commit
d0fbd5aab4
1 file changed
+23
@@ -76,6 +76,29 @@ bridge retrieves and injects the most relevant archived context.
|
||||
5. **Budget-Constrained**: Restored context fits within a configurable character
|
||||
budget (default 4000 chars) to avoid overwhelming the new context window
|
||||
6. **Non-Blocking**: Hook failures are silently caught -- compaction always proceeds
|
||||
7. **Smart Compaction Gate**: PreCompact exit code 0 outputs custom instructions
|
||||
guiding what Claude preserves; exit code 2 optionally blocks compaction entirely
|
||||
|
||||
## SDK Compaction Mechanics (Discovered via Deep Review)
|
||||
|
||||
The Claude Code SDK (`cli.js`) processes PreCompact hooks with three exit code behaviors:
|
||||
|
||||
| Exit Code | SDK Behavior |
|
||||
|-----------|-------------|
|
||||
| **0** | stdout is appended as **custom compact instructions** (guides preservation) |
|
||||
| **2** | **Blocks compaction entirely** (hook can prevent compaction) |
|
||||
| Other | stderr shown to user, compaction continues normally |
|
||||
|
||||
The `_H0` function (line 4700) executes all PreCompact hooks, collecting
|
||||
`newCustomInstructions` from exit code 0 hooks. The `NJ1` function (line 1769)
|
||||
performs actual compaction, using these instructions to guide the summary.
|
||||
|
||||
This enables our **Smart Compaction Gate**:
|
||||
- **Default mode**: Exit code 0 with custom instructions listing archived files,
|
||||
tools, decisions, and recent turns -- Claude's compaction summary preserves
|
||||
the most important details
|
||||
- **Block mode** (`CLAUDE_FLOW_BLOCK_COMPACTION=true`): Exit code 2 on auto-trigger
|
||||
to prevent compaction when proactive archiving has captured everything
|
||||
|
||||
## Architecture
|
||||
|
||||
|
||||
Reference in new issue
Block a user