Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/deep-consolidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,16 @@ export async function deepConsolidate(
let response: string;
try {
writeFileSync(tmpFile, prompt);
// CRITICAL: run from tmpdir() so the inner `claude --print` does NOT inherit
// the outer agent's cwd. Without this, the inner Claude loads the outer
// agent's project CLAUDE.md + SessionStart hooks (e.g. state-continuity
// pointing at the agent's state pin), gets steered toward agent-style
// behavior, and returns prose instead of the requested JSON array.
// Symptom: "[snarc] Deep consolidation: no JSON array in response".
response = execSync(
`cat "${tmpFile}" | claude --print -`,
{
cwd: tmpdir(),
timeout: 60_000,
encoding: 'utf-8',
stdio: ['pipe', 'pipe', 'pipe'],
Expand Down