Skip to content

Consultation output files deleted mid-session by Claude Code temp file cleanup #512

@waleedkadous

Description

@waleedkadous

Bug

When porch runs consultations via background tasks, the output files are written to temp paths that Claude Code aggressively cleans up during the same session. By the time porch tries to read the consultation results, the files are gone.

Root Cause

Claude Code manages background task output files in temp directories and cleans them up aggressively. Porch uses --output pointing to these temp paths, and the files get deleted before they can be consumed.

Fix

Porch should write consultation output to a persistent location in the project filesystem rather than relying on temp paths. The natural location is:

codev/projects/<id>-<name>/<id>-<phase>-iter<N>-<model>.txt

This is within the builder's worktree but on the actual filesystem, not in a temp directory. The files survive the session.

Separate Question (Not This Issue)

Whether these files should be attached to the PR, checked into the codebase, or handled some other way for long-term preservation is a separate design decision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions