Skip to main content

Crate csd

Crate csd 

Source
Expand description

csd (Claude Session Driver) — drive an interactive claude REPL in a detached tmux session on the flat-rate subscription seat, inject input reliably, and detect session state, emitting JSON for programmatic consumers (copad, life-assistant). See docs/poc-findings.md for the empirical basis and ~/dev/copad/docs/decisions.md #49 for why this exists.

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

backend
Backend abstraction. csd drives claude today and is designed to drive codex later (decision #49: keep the dispatch backend swappable so a forced move off the interactive REPL is a config flip, not a rewrite). Everything release-dependent — the spawn command and the capture-pane gate markers — lives behind this trait in ONE place (PoC gotcha #4).
cli
Command-line surface (clap derive). Kept declarative; main maps these onto crate::commands.
commands
Command implementations — the orchestration layer between the CLI (crate::cli) and the primitives (crate::tmux, crate::session, crate::backend, crate::detect).
detect
The hybrid state detector. No single source is sufficient (PoC §3): the transcript is reliable for questions/turns but lags TUI-interrupt gates; capture-pane catches the gates but its markers shift per release; the plan file holds plan content. detect combines all three.
error
session
Session metadata sidecar + path derivation.
tmux
Thin wrappers over the tmux CLI. Every call shells out to the user’s tmux server.