cstack is a workflow-first wrapper around Codex CLI.
Current implemented surface:
cstack <intent>discoverspecbuildreviewshipdeliverrerunresumeforkupdaterunsinspect- repo-local config in
.cstack/config.toml - durable run artifacts in
.cstack/runs/<run-id>/ - inferred routing plans and stage lineage for intent runs
- bounded specialist reviews for security, DevSecOps, traceability, audit, and release-pipeline concerns
- bounded discover-time research delegation with a research lead and optional repo, external, and risk tracks
- run ledger views across active and historical runs
- interactive post-run inspection for artifact-grounded follow-up in TTYs
- live in-progress activity output while Codex is running
- ANSI-first operator console for active runs, with plain-line fallback for logs and non-interactive shells
Requirements:
- Node.js 24+
- Codex CLI installed and available on
PATH
Pre-v1 public installs are published through GitHub Releases.
Links:
Recommended install path:
npm install -g "https://github.com/ganesh47/cstack/releases/latest/download/cstack-latest.tgz"Current release example version: v0.17.20
Install directly from a published release tarball:
VERSION=v0.17.20
npm install -g "https://github.com/ganesh47/cstack/releases/download/${VERSION}/cstack-${VERSION#v}.tgz"Download first, then install locally:
VERSION=v0.17.20
curl -LO "https://github.com/ganesh47/cstack/releases/download/${VERSION}/cstack-${VERSION#v}.tgz"
npm install -g "./cstack-${VERSION#v}.tgz"Verify the downloaded tarball:
VERSION=v0.17.20
curl -LO "https://github.com/ganesh47/cstack/releases/download/${VERSION}/SHA256SUMS.txt"
sha256sum -c SHA256SUMS.txtgit clone https://github.com/ganesh47/cstack.git
cd cstack
npm install
npm run build
npm install -g .# Route a high-level task through the inferred front door
cstack "Introduce SSO with audit logging and hardened release checks"
cstack run "Plan a compliance-safe billing migration" --dry-run
# Generate a discovery run
cstack discover "Map the current CLI surface and artifact model"
# Generate a spec run
cstack spec "Design a run artifact model for cstack"
cstack spec --from-run <discover-run-id>
# Launch a build run directly or from a saved planning run
cstack build "Implement the queued billing retry cleanup"
cstack build --from-run <run-id>
cstack build --from-run <run-id> --exec
cstack build --from-run <run-id> --allow-dirty
# Run standalone review and ship workflows
cstack review --from-run <build-run-id> "Review the billing retry cleanup"
cstack ship --from-run <review-run-id> --issue 123 "Ship the billing retry cleanup"
# Launch the umbrella delivery workflow across build, validation, review, and ship
cstack deliver "Implement the queued billing retry cleanup"
cstack deliver --from-run <run-id>
cstack deliver --from-run <run-id> --release --issue 123
# with repo policy enabled, this can push a branch and open or update a PR
# Continue, fork, or replay prior runs
cstack resume <run-id>
cstack fork <run-id> --workflow build
cstack rerun <run-id>
# Check for the latest stable GitHub release or apply it
cstack update --check
cstack update --yes
# List saved runs
cstack runs
cstack runs --active
cstack runs --workflow intent --json
# Inspect the latest run or a specific run id
cstack inspect
cstack inspect <run-id>
cstack inspect <run-id> --interactiveIf you are running from source without a global install, use node ./bin/cstack.js ....
cstack <intent> is now the primary front door for higher-level tasks.
What it does today:
- accepts a natural-language task
- infers an internal stage plan
- persists
routing-plan.jsonandstage-lineage.json - auto-executes downstream
review,ship, ordeliverwhen the inferred plan warrants it - keeps bounded specialist reviews inside the intent run only when the router stops after planning
Current intent behavior:
- implementation and planning prompts still execute
discoverandspecautomatically inside the intent run - broad analysis prompts like
What are the gaps in this projectcan route directly to downstreamreviewto avoid paying full planning overhead first - mixed prompts that also ask
cstackto close or remediate the gaps stay on the implementation path and continue through planning and delivery stages routing-plan.jsonnow records both the winning routing decision and the matched prompt signals socstack inspectcan explain why a broad or mixed prompt took its chosen path- review-shaped analysis prompts auto-run standalone
review - implementation-shaped prompts auto-run
deliver, which carries the work through internalbuild -> validation -> review -> ship - explicit
build,review,ship, anddelivercommands still exist when you want a narrower workflow than the routed front door - intent-level specialist delegates are only used when the router stops after planning instead of handing off into a downstream review-capable workflow
Examples:
# quoted single-argument intent
cstack "Introduce SSO with audit logging and hardened release checks"
# explicit subcommand form
cstack run "Plan a compliance-safe billing migration" --dry-runHow to inspect it:
cstack inspect <run-id>now shows the routing plan, stage lineage, specialist dispositions, and recent activity for intent runscstack inspect <run-id> --interactiveopens an artifact-grounded console for follow-up questions- the run directory includes
routing-plan.json,stage-lineage.json, and specialist artifacts underdelegates/
build and deliver now use an isolated execution checkout by default.
Current contract:
- the executed source snapshot is the current committed
HEAD - uncommitted local source changes are ignored by default
git worktree addis the preferred isolation pathcstackfalls back to a temporary clone fromoriginwhen worktree creation is not possible- if no safe isolated checkout can be prepared, the mutation workflow fails closed
What gets recorded:
execution-context.jsonwith source repo path, source branch, source commit, execution checkout kind, execution checkout path, and cleanup status- build and deliver console summaries that state when local dirt was intentionally ignored
inspecthome view lines for the execution checkout and source snapshot
Current limitation:
- uncommitted local source changes are not copied into the isolated checkout
--allow-dirtyremains the explicit opt-in for source-repo dirty execution
cstack runs is now the run ledger, not just a raw directory listing.
Useful views:
# all known runs, newest first
cstack runs
# currently active runs only
cstack runs --active
# only intent runs
cstack runs --workflow intent
# recent runs as JSON for scripts
cstack runs --recent 10 --jsonEach row shows the run id, workflow, current status, active stage when known, active specialists when known, and a short summary.
cstack inspect works at two levels:
cstack inspect <run-id>prints a one-shot summary of the run, its artifacts, routing, lineage, and recent eventscstack inspect <run-id> --interactiveopens a structured terminal inspector
The interactive inspector is artifact-grounded. It does not silently continue the original Codex reasoning session.
When launched in a TTY, the inspector now opens on a compact home view with:
- an
Observedsection for facts from saved artifacts - a
Plansection with stage and specialist strips - a
Suggested next actionssection - a persistent shortcut footer
Useful inspector commands:
summarystagesspecialistsartifactsshow finalshow routingshow researchshow sessionshow verificationshow validationshow pyramidshow coverageshow ci-validationshow tool-researchshow reviewshow mitigationsshow shipshow mutationshow githubshow child <stage>show delegate <track>show sources <track>mitigatemitigate <n>mitigate <workflow>mitigate <workflow> <n>show stage <name>show specialist <name>show artifact <relative-path>gapswhy deferred <stage>
Failed build inspection is now root-cause-first:
- parent
intentinspection prefers the linked child build failure summary over the aggregate downstream deliver error - failed
deliverinspection shows direct build evidence, including exit code, session visibility, transcript availability, verification status, and fallback-summary status when Codex did not leave a normal final markdown file - later
validation,review, andshipblockage is shown as a consequence of the failed build instead of being repeated as if it were the original cause what remainsresumeforkexit
Shortcuts:
1summary2stages3specialists4artifactsggapsffinal outputrroutingqexit
For TTY runs, cstack may offer Inspect this run now? [Y/n] after the summary. Non-interactive shells skip that prompt.
Interactive inspector quality-of-life:
- tab completion for commands and common
show ...targets - dynamic completion for stage names, specialists, artifact paths, delegate tracks, and linked child stages
- typo suggestions for unknown commands
- analysis-mode reviews surface gap clusters and recommended next slices directly in the summary
cstack update is a GitHub-release self-update command for the installed CLI.
Supported surface:
# Check only
cstack update --check
# Show the exact plan without mutating
cstack update --dry-run
# Apply the latest stable release
cstack update --yes
# Install a specific stable release
cstack update --yes --version 0.3.0Default behavior:
- in a normal interactive terminal,
cstack updatechecks the latest stable GitHub release and prompts before applying it - in non-interactive shells,
cstack updaterefuses mutation unless you pass--yes - the command downloads the exact versioned tarball plus
SHA256SUMS.txt, verifies the checksum locally, and then installs throughnpm
Important limits:
cstack updateupdates the installed CLI package only- it does not rewrite
.cstack/config.toml, prompt assets, or repo files - if you are running
cstackdirectly from a source checkout, self-update is intentionally unsupported in this first version
Manual fallback:
npm install -g "https://github.com/ganesh47/cstack/releases/latest/download/cstack-latest.tgz"cstack is designed to be run from inside the repository you want to work on.
Minimal setup in an existing repo:
cd /path/to/your-repo
mkdir -p .cstack/prompts
cat > .cstack/config.toml <<'EOF'
[codex]
command = "codex"
sandbox = "workspace-write"
[workflows.spec.delegation]
enabled = false
maxAgents = 0
[workflows.build]
mode = "interactive"
verificationCommands = ["npm test"]
allowDirty = false
timeoutSeconds = 900
[workflows.review]
mode = "exec"
[workflows.ship]
mode = "exec"
allowDirty = false
[workflows.deliver.validation]
enabled = true
mode = "smart"
requireCiParity = true
allowWorkflowMutation = true
allowTestScaffolding = true
[workflows.deliver.stageTimeoutSeconds]
build = 900
review = 600
ship = 600
[workflows.discover.delegation]
enabled = true
maxAgents = 2
[workflows.discover.research]
enabled = true
allowWeb = false
EOFThen use cstack from that repo root:
# 1. Start from the inferred front door for broader tasks
cstack "Add feature flags to the billing flow with audit logging"
# 2. Or use explicit stages when you want tighter control
cstack discover "Map the current architecture, key modules, and likely risk areas"
cstack spec "Design a safe migration plan for adding feature flags to the billing flow"
cstack build --from-run <spec-run-id>
# 3. Inspect saved runs and artifacts
cstack runs
cstack inspect
cstack inspect <run-id> --interactiveWhile a run is active in a normal terminal, cstack renders a bounded ANSI dashboard instead of endlessly appending log lines.
The live dashboard shows:
- a header with workflow, run id, status, current stage, live elapsed time, and session
- a stage breadcrumb path
- a specialist strip when relevant
- a single live progress line that summarizes current stdout/stderr/heartbeat signals
- a visible pulse/liveness indicator so you know the run is still moving
- a fixed-height recent milestones pane so the frame stays steady while the run is active
- a footer with artifact and inspection hints
The elapsed timer keeps ticking while the run is active. Color and a few emoji improve scanability in TTYs, but the dashboard still includes text labels so state remains understandable without color.
In non-interactive shells, CI logs, or redirected output, it falls back to plain append-only progress lines such as:
[cstack discover <run-id> +0:00] Starting Codex run
[cstack discover <run-id> +0:01] Session: <session-id>
[cstack discover <run-id> +0:03] Activity (stdout): scanning repository context
This is an activity feed, not private chain-of-thought output. It shows what the wrapper can observe from the Codex process plus wrapper-generated heartbeat updates.
Recommended workflow in an existing codebase:
- Start with
cstack <intent>when the task is broad enough that routing and specialist selection are useful. - Use explicit
discoverandspeccommands when you want to force a specific stage yourself. - Read the saved outputs in
.cstack/runs/<run-id>/before moving on to manual implementation or latercstackworkflows.
Useful repo-local files:
.cstack/config.toml.cstack/prompts/spec.md.cstack/prompts/discover.md
Practical notes:
- run
cstackfrom the repo root so artifact paths and repo docs resolve correctly - keep
.cstack/runs/out of version control; this repo already ignores it - commit
.cstack/config.tomland prompt assets if you want shared team defaults - point
[codex].commandat a custom Codex binary/script only if you need a local wrapper for testing
Repo config lives at .cstack/config.toml.
Current supported settings:
[codex]
command = "codex"
sandbox = "workspace-write"
profile = "default"
model = "gpt-5.4"
[workflows.spec.delegation]
enabled = false
maxAgents = 0
[workflows.build]
mode = "interactive"
verificationCommands = ["npm test"]
allowDirty = false
[workflows.review]
mode = "exec"
[workflows.ship]
mode = "exec"
allowDirty = false
[workflows.deliver.validation]
enabled = true
mode = "smart"
requireCiParity = true
allowWorkflowMutation = true
allowTestScaffolding = true
[workflows.discover.delegation]
enabled = true
maxAgents = 2
[workflows.discover.research]
enabled = true
allowWeb = falseNotes:
commandcan point at the installedcodexbinary or a script path for testing.sandbox,profile,model, andextraArgsare passed through to Codex launches.workflows.build.modeselectsinteractiveorexec; interactive is the default for build runs.workflows.build.verificationCommandsprovides default verification commands recorded into build artifacts.workflows.build.timeoutSecondstime-boxes the Codex-backed build stage.workflows.deliver.stageTimeoutSecondscan time-box internaldeliverstages such asbuild,review, andship.- discover delegation settings are now used to bound discover-time research fan-out.
- discover web research stays opt-in through
[workflows.discover.research].allowWeb.
Each run writes to .cstack/runs/<run-id>/.
Current artifact set:
run.jsonevents.jsonlprompt.mdcontext.mdfinal.mdstdout.logstderr.logrouting-plan.jsonfor intent runsstage-lineage.jsonfor intent runsexecution-context.jsonforbuildanddeliversource-vs-execution lineagesession.jsonfor build runs and any workflow with recorded interactive session lineageartifacts-index.jsonor equivalent artifact inventory derived by the inspectorartifacts/spec.mdforspecartifacts/findings.mdfordiscoverartifacts/build-transcript.logfor best-effort interactive build captureartifacts/change-summary.mdforbuildartifacts/verification.jsonforbuildartifacts/findings.md,artifacts/findings.json, andartifacts/verdict.jsonforreviewartifacts/ship-summary.md,artifacts/release-checklist.md,artifacts/unresolved.md, andartifacts/ship-record.jsonforshipartifacts/delivery-report.mdfordeliverartifacts/github-delivery.jsonfor GitHub-scoped deliver evidenceartifacts/github-mutation.jsonforshipanddeliverartifacts/rerun.jsonfor rerun lineagestages/build/...,stages/validation/...,stages/review/..., andstages/ship/...for deliver stage-local artifactsstages/validation/repo-profile.json,validation-plan.json, andtool-research.jsonfor deliver validation intelligencestages/validation/artifacts/test-pyramid.md,coverage-summary.json,coverage-gaps.md,local-validation.json,ci-validation.json, andgithub-actions-plan.mdfor deliver validation outcomesstages/ship/artifacts/github-state.json,pull-request.json,issues.json,checks.json,actions.json,security.json, andrelease.jsonfor deliver GitHub evidencestages/discover/artifacts/discovery-report.mdfor discover-team synthesisstages/discover/research-plan.jsonfor discover-team activation, capability, and track decisionsstages/discover/delegates/<track>/request.mdfor discover-team delegated research requestsstages/discover/delegates/<track>/result.jsonfor discover-team delegated research resultsstages/discover/delegates/<track>/sources.jsonfor discover-team source provenancedelegates/<specialist>/request.mdfor specialist reviews in intent runsdelegates/<specialist>/result.jsonfor specialist reviews in intent runs
events.jsonl records the live progress feed so cstack inspect can show recent activity after the run has finished. The interactive inspector also derives its artifact inventory from the saved run directory.
Discover-team notes:
repo-explorerstays local to the repoexternal-researcheris only activated when the prompt implies external or unstable facts and web research is allowedrisk-researcheris only activated when the prompt implies a concrete risk domain- the research lead synthesizes the final discover output; delegated tracks remain advisory until accepted
Build notes:
buildis interactive by default and records the observed Codex session id insession.json- if
buildis requested in a non-TTY shell,cstackfalls back toexecand records both requested and observed mode insession.json build --from-run <run-id>links a priorspecorintentrun into the build context without mutating the source runbuildexecutes from an isolated checkout by default and ignores uncommitted local dirt unless--allow-dirtyor repo policy opts into source-repo dirty execution- when
workflows.build.timeoutSecondsis set or left at the shipped default, a stalled Codex-backed build fails with an explicit timeout instead of lingering indefinitely - verification commands are recorded even when they fail so inspection can explain what still remains
- best-effort interactive transcripts are stored at
artifacts/build-transcript.logwhen the interactive path is used
Review notes:
reviewis a standalone critique workflow withfindings.md,findings.json, andverdict.jsonreview --from-run <run-id>links an upstream build or deliver artifact into the critique context- analysis prompts like
What are the gaps in this projectrunreviewin analysis mode and produce gap clusters, likely root causes, confidence, and recommended next slices instead of release-gate phrasing - readiness phrasing like
ready,changes-requested, andblockedis reserved for deliver-stage review and ship-oriented readiness checks - bounded specialist reviewers may run when the prompt implies security, audit, traceability, DevSecOps, or release-pipeline risk
Ship notes:
shipis a standalone GitHub-aware handoff and release-readiness workflowship --from-run <review-run-id>is the cleanest narrow path when build and review already happened separately- if linked review evidence is missing or blocked,
shiprecords that as a blocker rather than pretending readiness shiprequires a clean worktree unless--allow-dirtyor repo policy allows otherwise
Deliver notes:
deliveris the operator-facing umbrella workflow over internalbuild,validation,review, andshipstages- the validation stage profiles the repo, chooses a layered validation strategy, records OSS tool research, and runs the selected local validation commands
- stage-local artifacts live under
stages/build,stages/validation,stages/review, andstages/ship deliverexecutes those mutation-capable stages from an isolated checkout by default and records the source-vs-execution lineage inexecution-context.json- if the internal
buildstage fails,delivernow stops immediately and marksvalidation,review, andshipas blocked/deferred instead of continuing to run them - failed or timed-out build stages now become the root cause shown in both deliver summaries and parent intent inspection
- when repo policy enables it,
delivercan create or reuse a working branch, auto-commit the deliver change set, push it toorigin, and create or update the GitHub pull request delivernow evaluates GitHub-scoped engineering completion, including PR, checks, Actions, issue linkage, release evidence, and security gates when policy requires themdeliverfails closed when required GitHub evidence is missing or blockeddeliver --releaseswitches the run into release-bearing mode and expects tag and release evidencedeliver --issue <n>links a specific GitHub issue into deliver evaluation- uncommitted local source edits are ignored by default for
deliver;--allow-dirtyremains the explicit opt-in for source-repo dirty execution cstack inspect <run-id>supportsshow validation,show pyramid,show coverage,show ci-validation,show tool-research,show review,show ship,show mutation, andshow githubfor deliver runs- when a deliver build fails,
cstack inspectnow separates the root-cause build failure from later blocked stages and surfaces timeout/session/transcript evidence when available
npm install
npm run typecheck
npm test
npm run build
npm run ci:e2e
node ./bin/cstack.js --helpThe binary entrypoint is bin/cstack.js, which loads the built CLI from dist/.
The repo now uses two validation lanes:
CIis the required lane for pull requests andmain. It runstypecheck,test,build, and a deterministic CLI end-to-end pass with the fake Codex and fake GitHub fixtures.Live Codex Smokeis a manual, non-blocking lane intended for a self-hosted runner that already has Codex CLI installed and authenticated. It clonessqlite-metadata-proposal, uses real Codex plus fake GitHub, and smoke-tests the wrapper against a realistic repo without mutating GitHub state.
Useful commands:
npm run ci:e2e
npm run smoke:liveTagged releases are built and published by GitHub Actions.
Release flow:
- dispatch
Prepare Releasefrom the GitHub Actions UI orgh workflow run - the workflow updates
package.json,package-lock.json, and the versioned README examples - the workflow commits to the default branch
- the workflow creates and pushes a matching tag, for example
v0.1.0 Prepare Releasepushes the release-prep commit to the default branchPrepare ReleasedispatchesCIfor that pushed commit and waits for it to succeedPrepare Releasepushes the tag and then dispatchesReleaseReleasereruns validation, smoke-tests the packaged install, and publishes the GitHub Release
Browser dispatch:
- open
Actions - choose
Prepare Release - click
Run workflow - enter a version like
0.1.0
CLI dispatch:
gh workflow run prepare-release.yml --repo ganesh47/cstack -f version=0.1.0
gh run watch --repo ganesh47/cstackPublished release assets:
cstack-<version>.tgzcstack-latest.tgzSHA256SUMS.txt
Implemented:
cstack <intent>discoverspecbuildreviewshipdeliverrerunresumeforkupdaterunsinspect- config loading
- run creation and persistence
- Codex exec adapter
- inferred routing plans and stage lineage
- bounded specialist review artifacts
- run ledger filtering and JSON output
- interactive post-run inspection
- live progress reporting and event logging
- bounded discover-time research delegation with artifact provenance
- GitHub-scoped deliver policy and evidence artifacts
- standalone review and ship artifacts
- wrapper-native session continuation and rerun wrappers
- dirty-worktree consent for mutation workflows
- build, typecheck, and test pipeline