diff --git a/.claude/helpers/context-persistence-hook.mjs b/.claude/helpers/context-persistence-hook.mjs index 0723398d41..3527239f51 100644 --- a/.claude/helpers/context-persistence-hook.mjs +++ b/.claude/helpers/context-persistence-hook.mjs @@ -1690,38 +1690,24 @@ async function doPreCompact() { const instructions = buildCompactInstructions(chunks, sessionId, archiveResult); process.stdout.write(instructions); - // Context Autopilot: block AUTO compaction, allow MANUAL (/compact) + // Context Autopilot: track state and log archival status + // NOTE: Claude Code 2.0.76 executePreCompactHooks uses executeHooksOutsideREPL + // which does NOT support exit code 2 blocking. Compaction always proceeds. + // Our "infinite context" comes from archive + restore, not blocking. if (AUTOPILOT_ENABLED) { const state = loadAutopilotState(); const pct = state.lastPercentage || 0; const bar = buildProgressBar(pct); - if (trigger === 'manual') { - // Manual /compact: allow it — user explicitly requested compression - process.stderr.write( - `[ContextAutopilot] ${bar} ${(pct * 100).toFixed(1)}% | MANUAL compact allowed — ${chunks.length} turns archived before compression.\n` - ); - // Reset autopilot state for post-compaction fresh start - state.lastTokenEstimate = 0; - state.lastPercentage = 0; - state.warningIssued = false; - saveAutopilotState(state); - // Exit 0 = proceed with compaction - } else { - // Auto compaction: BLOCK — autopilot manages context - process.stderr.write( - `[ContextAutopilot] ${bar} ${(pct * 100).toFixed(1)}% | BLOCKING auto-compaction — all ${chunks.length} turns archived safely. Use /compact to manually compress.\n` - ); - process.exit(2); - } - } - - // Legacy: exit code 2 blocks compaction (opt-in via env var) - if (BLOCK_COMPACTION && trigger === 'auto') { process.stderr.write( - `[ContextPersistence] BLOCKING auto-compaction (CLAUDE_FLOW_BLOCK_COMPACTION=true). All ${chunks.length} turns archived.\n` + `[ContextAutopilot] ${bar} ${(pct * 100).toFixed(1)}% | ${trigger} compact — ${chunks.length} turns archived. Context will be restored after compaction.\n` ); - process.exit(2); + + // Reset autopilot state for post-compaction fresh start + state.lastTokenEstimate = 0; + state.lastPercentage = 0; + state.warningIssued = false; + saveAutopilotState(state); } } diff --git a/agents/architect.yaml b/agents/architect.yaml index 8dd45186dd..e977a9f920 100644 --- a/agents/architect.yaml +++ b/agents/architect.yaml @@ -8,4 +8,4 @@ capabilities: optimizations: - context-caching - memory-persistence -createdAt: "2026-02-10T19:02:16.500Z" +createdAt: "2026-02-10T19:56:57.432Z" diff --git a/agents/coder.yaml b/agents/coder.yaml index 7667836fb3..e1a187686a 100644 --- a/agents/coder.yaml +++ b/agents/coder.yaml @@ -8,4 +8,4 @@ capabilities: optimizations: - flash-attention - token-reduction -createdAt: "2026-02-10T19:02:16.500Z" +createdAt: "2026-02-10T19:56:57.432Z" diff --git a/agents/reviewer.yaml b/agents/reviewer.yaml index c32df83d91..431fb0fe4b 100644 --- a/agents/reviewer.yaml +++ b/agents/reviewer.yaml @@ -7,4 +7,4 @@ capabilities: - best-practices optimizations: - incremental-analysis -createdAt: "2026-02-10T19:02:16.500Z" +createdAt: "2026-02-10T19:56:57.432Z" diff --git a/agents/security-architect.yaml b/agents/security-architect.yaml index ef50586c20..c6b2a9fd70 100644 --- a/agents/security-architect.yaml +++ b/agents/security-architect.yaml @@ -7,4 +7,4 @@ capabilities: - security-review optimizations: - pattern-matching -createdAt: "2026-02-10T19:02:16.500Z" +createdAt: "2026-02-10T19:56:57.432Z" diff --git a/agents/tester.yaml b/agents/tester.yaml index e0df54d674..6f6dfc5eff 100644 --- a/agents/tester.yaml +++ b/agents/tester.yaml @@ -7,4 +7,4 @@ capabilities: - coverage optimizations: - parallel-execution -createdAt: "2026-02-10T19:02:16.500Z" +createdAt: "2026-02-10T19:56:57.432Z"