Fix #512: Auto-persist consultation output to project directory#519
Merged
waleedkadous merged 2 commits intomainfrom Feb 22, 2026
Merged
Conversation
When running in a builder worktree without --output, the consult command now auto-generates a persistent output path in the project directory (codev/projects/<id>-<name>/<id>-<phase>-iter<N>-<model>.txt) so results survive Claude Code's temp file cleanup. Also fixes getBuilderProjectState() to handle non-numeric project IDs like "bugfix-512" and extracts phase/iteration from status.yaml.
Prevents misrouting output when architect-mode consult (--issue) runs from inside a builder worktree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When consultations run as background tasks without
--output, results were only captured in Claude Code temp files that get cleaned up mid-session. This fix makes theconsultcommand auto-generate persistent output paths in the project directory when running in a builder context.Fixes #512
Root Cause
The
consultcommand wrote results only to stdout when--outputwasn't explicitly provided. Claude Code captures background task stdout in temp files that get aggressively cleaned up. Forbuild_verifyphases, porch already passes--output, but foroncephases (bugfix, tick) and manually-run consultations, no--outputwas passed.Additionally,
getBuilderProjectState()had a regex that only matched numeric project IDs, missing bugfix-style IDs likebugfix-512.Fix
Auto-persist in builder context: When
--outputis not provided and running in a builder worktree with protocol mode (--type), the consult command now auto-generates a persistent output path:codev/projects/<id>-<name>/<id>-<phase>-iter<N>-<model>.txtExtended project state:
getBuilderProjectState()now returnsphase,iteration, andprojectDir(and handles non-numeric IDs)Path compatibility: The auto-generated path matches the pattern used by porch's
findReviewFiles()andgetReviewFilePath(), so porch can find the resultsTest Plan
persistent-output.test.ts)CMAP Review
(To be added after review)