Commit graph

19 commits

Author SHA1 Message Date
jedarden
3b00711bff gap-review round 10: 3 gaps fixed
G-1 (HIGH): Argo param syntax fixed in build-musl — {{}} not $()
G-2 (HIGH): SIGTERM row in signal table now includes 'SIGTERM child (per HR-8 mirror)'
G-3 (HIGH): Phase 11 now includes deferred install.sh end-to-end download test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 14:24:50 -04:00
jedarden
fd7436b6a9 gap-review round 9: 7 gaps fixed
G-1 (HIGH): stream-json error output table now includes claude_version in inline example
G-2 (HIGH): build-musl rewritten as single-container bash script with git clone + mv renames
G-3 (HIGH): manual CI submission snippet now includes required repo parameter
G-4 (MEDIUM): revision parameter description corrected; git clone uses checkout for SHA support
G-5 (MEDIUM): Phase 2 entry adds OQ-5+OQ-6 gates; Phase 6 entry adds OQ-4 gate
G-6 (MEDIUM): Phase 9 completion criterion no longer requires GitHub Release (impossible pre-Phase 11)
G-7 (MEDIUM): AGENTS.md version compat clarified — claude_version absent in stream-json success path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 14:21:35 -04:00
jedarden
5e2b592df7 gap-review round 8: 9 gaps fixed
G-1 (CRITICAL): stream-json success path clarified — forwarded verbatim, no claude_version injection
G-2 (CRITICAL): invoke_template now includes --output-format json (needle-transform-claude compat)
G-3 (HIGH): Phase 11 CI criterion switched to --check; AS-1 is manual pre-release step
G-4 (HIGH): Phase 1 now includes claude-print-ci.yaml stub + ArgoCD sync completion criterion
G-5 (HIGH): MOCK_SILENT=1 added to env var table; large-prompt scenario note added
G-6 (HIGH): build-musl expanded with git-clone init, mock_claude build, both artifacts renamed
G-7 (MEDIUM): cargo audit CI requirement clarified; Phase 11 checklist item added
G-8 (MEDIUM): Phase 9 completion criterion now includes README/--help sync check
G-9 (MEDIUM): Argo Events webhook scope clarified as 'out of scope for v1.0'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 14:14:39 -04:00
jedarden
d556c9a343 Add CI/CD and documentation sections to plan
CI/CD: claude-print-ci WorkflowTemplate (iad-ci/Argo Workflows); verify-only on branch
push, verify+build-musl+github-release on v* tags; asset named claude-print-linux-amd64;
Phase 1 stub, Phase 11 full release pipeline.

Documentation: README.md spec (10 sections, human + agent audiences); AGENTS.md spec
(8 sections for AI agent consumers — invocation, per-format output, exit codes, anti-patterns);
docs/ organization map; Phase 1 stub README, Phase 9 complete README+AGENTS.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 14:07:27 -04:00
jedarden
e23f500a9b gap-review round 7: 7 gaps fixed
G-1 (CRITICAL): initial poll set corrected to 2 fds (master_fd + self_pipe_read)
G-2 (HIGH): --check flag added to CLI table and Phase 9 checklist
G-3 (HIGH): 45s timeout generalized to 'WAITING state ≥ 45s AND bytes < 200'
G-4 (HIGH): stream-json 5s file-open timeout expiry behavior specified
G-5 (MEDIUM): stream-json error result template now includes claude_version
G-6 (MEDIUM): SIGCHLD reference replaced with poll+EIO+waitpid(WNOHANG) spec
G-7 (MEDIUM): OQ-3 split into OQ-3a (resolved) + OQ-3b (blocks Phase 5)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 14:04:48 -04:00
jedarden
5b9f1e3095 gap-review round 6: 7 gaps fixed
G-1: claude_version claim narrowed — appears only in json/stream-json error, not text
G-2: claude_version runtime source specified — run binary once pre-fork, cache result
G-3: TRUST_DISMISSED idle-wait upper bound documented — wall-clock timeout is the only exit
G-4: keeper write-end fd close-before-waitpid added to all non-Stop exit paths
G-5: hook ordering claim softened to "likely first (unverified per OQ-1)"; OQ-1 expanded
G-6: ANSI stripping in last_assistant_message fallback extended to stream-json mode
G-7: parent fd 0 close after prompt read specified in PTY Spawner §3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 13:54:52 -04:00
jedarden
4648111fc3 gap-review round 5: fix 8 gaps (1 critical, 2 high, 5 medium)
Critical:
- G-1: State Machine + Error Handling table: SIGINT now sends SIGINT to child (not SIGTERM); consistent with HR-8 and Signal Handling table

High:
- G-2: stream-json reader thread exit on SIGINT/timeout: Sender-drop causes receiver Err → immediate exit
- G-3: Event Loop fd count: self_pipe_read is always-present 2nd fd; ADR-002 corrected to match

Medium:
- G-4: Rollout criteria now requires AS-1 through AS-6 (was AS-1–5)
- G-5: config.toml inherit_hooks comment clarified — default mode omits --setting-sources entirely
- G-6: MOCK_STOP_BEFORE_INJECT=1 added to mock table + EC-7 integration test scenario
- G-7: Phase 3 checklist corrected: master_fd + self_pipe_read initially; stop_fifo added dynamically
- G-8: 45s startup timeout definition unified: "total bytes == 0 after 45s" across all 4 locations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 13:43:50 -04:00
jedarden
15ba79b50e gap-review round 4: fix 13 gaps (1 critical, 4 high, 7 medium, 1 low)
Critical:
- G-1: HR-8 vs Signal Handling contradiction resolved — SIGINT handler now sends SIGINT (not SIGTERM) to child

High:
- G-2: Event Loop timer is not a timerfd; Instant::elapsed() with poll() timeout parameter instead
- G-3: Signal handler safety specified: AtomicBool, kill(2), self-pipe to wake blocked poll()
- G-4: NEEDLE invoke_template now includes --no-inherit-hooks; AS-3 pass criterion now achievable
- G-5: Error output per format: text→stderr only; json→stdout JSON; stream-json→final error line

Medium:
- G-6: Child resets SIGINT+SIGTERM to SIG_DFL before execvp (signal handler inheritance)
- G-7: "weekly schedule" claim removed; version-compat tests run on every push (CI already covers it)
- G-8: needle-transform-claude defined as NEEDLE's built-in transform for claude JSON output
- G-9: Integration tests use --claude-binary <path-to-mock_claude> via CARGO_MANIFEST_DIR
- G-10: XTVERSION probe accepts both ESC[>q and ESC[>0q (parameterized form)
- G-11: Install Script renumbered 1-8 with clean integers (removed decimal 2.5/3.5 steps)
- G-12: T-6 threat (PATH hijack) added to threat model

Low:
- G-13: Config path respects $XDG_CONFIG_HOME when set

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 13:33:25 -04:00
jedarden
800ffc1b11 gap-review round 3: fix 13 gaps (1 critical, 5 high, 6 medium, 1 low)
Critical:
- G-1: OQ-1 Blocks column corrected from Phase 6 to Phase 2

High:
- G-2: Phase 5 entry criterion now gates on OQ-3 resolution
- G-3: Stop Poller single-fire assumption documented; multi-turn Stop behavior added to OQ-1 checklist
- G-4: duration_ms defined as wall-clock ms from main() entry to emitter write (includes model latency)
- G-5: Install Script step 5 → --check; step 6 → --version (resolves contradiction with Doctor section)
- G-6: SKIP_MOCK_CLAUDE=1 conflict with --check: install.sh uses --version; --check warns and continues

Medium:
- G-7: Integration test scenarios standardized to MOCK_ prefix throughout; MOCK_RESPONSE scenario added
- G-8: SIGTERM exit 130 explicit in Signal Handling table + Error Handling table row added
- G-9: session_id derivation defined (payload → transcript basename → null); uuid crate marked v1.0 unused
- G-10: Startup Sequencer §6 /read relay expanded with idle-wait re-entry and no-acknowledgment note
- G-11: hook.sh template now includes 2>/dev/null || true to guarantee exit 0 on write failure
- G-12: stream-json JoinHandle stored as Option<JoinHandle<()>> with conditional join on all exit paths

Low:
- G-13: Doctor --check step 5: scan $TMPDIR for orphaned claude-print-* dirs older than 1 hour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 13:22:38 -04:00
jedarden
1f64e37345 gap-review round 2: fix 22 gaps (6 high, 10 medium, 6 low)
High:
- G-1: Hook Installer §2 — single-quote validation for temp dir path now explicit
- G-2: large-prompt /read relay — encoding (UTF-8), response flow, and dedup of duplicate note
- G-3: State Machine — early Stop before prompt injection is now error (exit 2), not valid path
- G-4: stream-json reader — file-not-yet-exists retry loop (50ms, 5s timeout) specified
- G-5: Stop Poller /exit\r — explain no bracketed paste, 5s wait, fallback to SIGTERM
- G-6: PO-1 (--settings merge) verification moved to Phase 2 entry, removed from Phase 6

Medium:
- G-7: hook inheritance tests parameterized for --setting-sources= or --setting-sources=none
- G-8: Stop payload with no transcript_path AND no cwd — explicit error path added
- G-9: Event Loop §4 — dynamic fd registration (Vec<pollfd>, FIFO added at transition)
- G-10: Hook Inheritance section — add (OQ-1, unverified) caveat to --settings merge claim
- G-11: stream-json emits ALL raw lines (no dedup), matching claude -p behavior; noted for callers
- G-12: SIGTERM-to-SIGKILL 2s grace period adds to observed wall-clock timeout
- G-13: XTVERSION response — ambiguous backtick replaced with \x1bP>|claude-print\x1b\\
- G-14: mock_claude — SKIP_MOCK_CLAUDE=1 opt-out; --check resolves path relative to binary
- G-15: Phase 10 scope — clarified it adds only tests not written in Phases 2-9

Low:
- G-16: Hook Installer §2 — 0700 mode requirement now stated at component level
- G-17: --version flag — respects --claude-binary; defines fallback for claude-not-found
- G-18: cwd-slug ambiguity for hyphen-containing paths documented
- G-19: inherit_hooks = false in config triggers same --setting-sources= forwarding
- G-20: NEEDLE invoke_template max-turns 30 hardcodes over config.toml (noted)
- G-21: cost_usd always 0 — documented as known limitation
- G-22: Delivery section updated with all 4 artifacts (claude-print, mock_claude, yaml, install.sh)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 13:07:24 -04:00
jedarden
5dda1c0b2d gap-review round 1: fix 24 gaps (3 critical, 9 high, 7 medium, 5 low)
Critical:
- G-1: Stop poller exit seq: replace malformed \x1b[201~\r/exit\r with /exit\r
- G-2: EC-7 (Stop before prompt) is unreachable after EC-11 unsets session vars; now errors
- G-3: hook.sh FIFO path written as single-quoted shell string to prevent injection
- G-9: FIFO O_NONBLOCK ENXIO prevention: keeper write-end fd held until Stop fires
- G-12: SIGTERM now installs handler (mirrors SIGINT) so TempDir drops cleanly

High:
- G-4: stream-json offset defined as byte offset via seek(End) at prompt injection
- G-5: /read is a built-in slash command, not an MCP tool; no allowedTools needed
- G-6: hook merge ordering documented (sequential, user hooks first, per-hook timeout)
- G-7: mock_claude built in Phase 2 (not Phase 10) so integration tests run in all phases
- G-8: install.sh step 3.5 installs mock_claude; doctor --check references ~/.local/bin/mock_claude
- G-10: cwd-slug algorithm documented (strip leading /, replace / with -) + unit test directive
- G-11: model precedence chain defined (--model > config.toml > compiled-in default)

Medium/Low:
- G-13: idle fallback timer is one-shot; deactivated after any transition
- G-14: --setting-sources= marked unverified (per OQ-2) in all three mentions
- G-15: /read sandboxing note added (not filesystem-restricted in standard installs)
- G-16: mock_claude added to CI artifact list and Cargo.toml workspace note
- G-17: ClaudePrintError variant → JSON subtype mapping table added
- G-18: fingerprint dedup false-negative for identical-usage consecutive turns documented
- G-19: install.sh step 2.5 preserves previous binary as claude-print.prev
- G-20: window size probe order defined (STDOUT→STDIN→/dev/tty→fallback 220×50)
- G-21: scenario count "20+" changed to open-ended; MOCK_DELAY_STOP usage noted
- G-22: settings.json schema verification added to OQ-1 checklist
- G-23: NEEDLE stdin delivery connected to CLI stdin-as-prompt behavior
- G-24: PO-4 noted in Phase 4 entry; PO-5 acknowledged in Phase 7 entry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 12:57:13 -04:00
jedarden
ef6b7b42e8 Add missing plan sections: scope, acceptance, architecture, security, ops, risk
Addresses all MISSING/PARTIAL items from the plan review:
- Glossary, Non-Goals, Hard Requirements, What It Is Not, Scope Lock
- Acceptance scenarios (AS-1 through AS-6) with pass/fail criteria
- Module layout (src/ file tree), state machine diagrams, concurrency model
- Cross-cutting concerns: error propagation, signals, temp dir, log boundary
- Tech stack rationale column on crate table
- Edge case catalog (EC-1..12), anti-patterns, invariants (INV-1..8)
- Proof obligations (PO-1..6) with named recovery per assumption
- Phase entry/exit criteria and LOC estimates for all 11 phases
- Conformance harness + definition of done + all-gates policy in Testing
- Security section: threat model (T-1..5), untrusted input policy, supply chain
- Performance section: budgets, benchmark contract, CI size gate
- Operations section: migration plan, semver stance, rollout/rollback, doctor command
- Risk register (R-1..7) with likelihood/impact/mitigation
- ADRs (ADR-001..003) for the three churn-magnet decisions
- Open Questions updated with phase dependencies and resolution deadlines
- Phase 6 renamed from duplicate "Hook installer" to "Stop poller"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 12:35:12 -04:00
jedarden
af79068a05 Remove all prior art repo references from docs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 11:05:03 -04:00
jedarden
97d167a993 Inherit user hooks by default; no CLAUDE_CONFIG_DIR; add --no-inherit-hooks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 11:03:34 -04:00
jedarden
0ab3b42e13 Add sandbox isolation: CLAUDE_CONFIG_DIR, transcript forwarding, isolation tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 10:49:00 -04:00
jedarden
b03e3b3e37 Rewrite plan: single Rust binary, version-resilience tests, mock-claude fixture
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 10:45:48 -04:00
jedarden
8ab946e1ef Add PTY mechanics and Claude Code internals research
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 10:41:46 -04:00
jedarden
30af5c4421 Remove prior art references; expand plan to full feature set and test coverage
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 10:35:10 -04:00
jedarden
134af23bbf Initial scaffold: claude-print PTY wrapper for subscription billing 2026-06-07 10:30:31 -04:00