Commit graph

87 commits

Author SHA1 Message Date
jedarden
af5c24718d docs(bf-2pw): record emitter verification - already complete in bfb50da 2026-06-11 08:36:33 -04:00
jedarden
d751a8baea feat(config): implement config file loading with model resolution
Add comprehensive config loading for ~/.claude/claude-print.toml:
- default_path() returns the config file path
- load_or_default() gracefully handles missing/invalid files
- resolve_model() prioritizes CLI flag > config > hardcoded default
- Add 11 tests covering all scenarios

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-11 08:29:05 -04:00
jedarden
49cf72bf57 docs(adr): add ADR-004 — no silent agent escalation in NEEDLE workers
Documents the root cause of the bf-40i loss (claude-sonnet PTY fallback
in resolve_adapter), the consequences, and the mitigations (atomic label,
NEEDLE fixes bf-14w/bf-2wi).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 07:31:56 -04:00
jedarden
2cdbb97cab docs(agents): add src/lib.rs to module map in AGENTS.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 20:47:17 -04:00
jedarden
210b234a92 docs(agents): add AGENTS.md for Phase 9
Documents build commands, test structure, module map, key invariants,
and bead workflow for AI coding agents working in this repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 20:46:02 -04:00
jedarden
b8d7037de7 docs(notes): record bf-1vd as already-complete (plan.md updated in 4b2161c)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 20:43:06 -04:00
jedarden
16bf418396 bf-4eb: Remove overly-conservative dependency blocking bf-4r6
bf-4r6 (Write AGENTS.md) was blocked on bf-40i (Wire main()), but
documentation writing does not require main() to be functional.
Removing this dependency makes bf-4r6 ready for a worker to claim.

bf-52c's dependency on bf-40i remains correct — binary E2E tests
genuinely require a working binary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 20:43:00 -04:00
jedarden
4b2161c2ad docs(plan): mark phases 1-11 complete, add Status section
All module-level deliverables for phases 1-11 are committed. Checked all
[ ] boxes to [x], added a Status section summarizing what is done vs.
pending (main() orchestration, E2E tests, billing verification, CI release),
and noted that the Phase 11 install.sh end-to-end download test is blocked
on a release binary (which requires main() completion first).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 20:42:07 -04:00
jedarden
4d9a970176 Add bf-4km sixth verification: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:31:08 -04:00
jedarden
d0fe872ff4 Add bf-4km fifth verification: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:29:16 -04:00
jedarden
5da2055ae8 Add bf-4km fourth verification: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:27:14 -04:00
jedarden
60649e2d8b Add bf-4km re-verification notes (third): claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:20:54 -04:00
jedarden
d0e9220720 Add bf-4km re-verification notes: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:18:46 -04:00
jedarden
f14b2c1c11 Add bf-4km notes: claude-print-ci WorkflowTemplate synced in ArgoCD
Verified claude-print-ci WorkflowTemplate is present in iad-ci and
shows Synced status in ArgoCD app argo-workflows-ns-iad-ci. Overall
app is OutOfSync/Degraded due to pre-existing unrelated pdftract and
ExternalSecret issues.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:16:49 -04:00
jedarden
0c87ec4fdf Add bf-4km notes: claude-print-ci WorkflowTemplate synced in ArgoCD
WorkflowTemplate/claude-print-ci shows Sync: Synced in ArgoCD app
argo-workflows-ns-iad-ci, and is present in iad-ci cluster (created
2026-06-10T06:09:14Z). Overall app is OutOfSync due to pre-existing
unrelated pdftract/ExternalSecret issues outside this bead's scope.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:14:20 -04:00
jedarden
e50cfba234 Close bead bf-5nr: claude-print-ci WorkflowTemplate YAML validated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:12:56 -04:00
jedarden
7176ef2939 Add bf-5nr validation notes: claude-print-ci WorkflowTemplate YAML is valid
YAML parses cleanly and kubectl dry-run returns no errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:11:37 -04:00
jedarden
e16680820e Add bf-168 notes: claude-print-ci WorkflowTemplate added to declarative-config
WorkflowTemplate claude-print-ci committed to jedarden/declarative-config at
k8s/iad-ci/argo-workflows/claude-print-ci-workflowtemplate.yml. Phase 9 scope:
verify step only, delegating to rust-verify. Build+release steps deferred to Phase 11.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:53:23 -04:00
jedarden
f81e54d894 Close bead bf-3n3: claude-print.yaml NEEDLE adapter complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:52:15 -04:00
jedarden
8ef28b339b Add bf-3n3 notes: claude-print.yaml NEEDLE adapter installed and validated
Copied claude-print.yaml to ~/.config/needle/adapters/ and confirmed
needle test-agent returns Status: READY with stdin input and
needle-transform-claude transform.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:50:08 -04:00
jedarden
f5d6a0c381 Close bead bf-3vj: install.sh verified complete
install.sh already existed (Phase 9, commit 50b2132) and passes all
acceptance criteria: bash -n passes, detects platform, installs with
-m 755 to ~/.local/bin, runs --check post-install.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:47:51 -04:00
jedarden
86c51495a9 Add bf-3vj verification notes: install.sh already complete
install.sh was created in Phase 9 (commit 50b2132). Verified it passes
bash -n, covers x86_64/aarch64 musl targets, installs with -m 755 to
~/.local/bin, and runs claude-print --check post-install.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:46:35 -04:00
jedarden
fbd3a8c860 Close bead bf-360: --check subcommand verified complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:45:34 -04:00
jedarden
6b5d114a03 Add bf-360 verification notes for --check subcommand
Confirms the --check subcommand (src/check.rs) is fully implemented:
openpty probe, mkfifo probe, optional mock_claude PTY round-trip,
exits 0 on success with diagnostic table, exits 2 on any FAIL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:44:16 -04:00
jedarden
dfdf76300a Add Phase 9 verification notes for bead bf-42j
Confirms all deliverables complete: claude-print.yaml, install.sh,
claude-print-ci WorkflowTemplate, and --check subcommand. All probes
pass (openpty, mkfifo, mock_claude PTY round-trip). README flags match
--help output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:39:04 -04:00
jedarden
50b213285a Add Phase 9: NEEDLE integration — install.sh, claude-print.yaml, --check subcommand
- claude-print.yaml: NEEDLE agent config with stdin input_method, needle-transform-claude
  output_transform, and invoke_template for subscription-billed claude-print runs
- install.sh: download release binary from GitHub, backup existing, install mock_claude,
  install NEEDLE config if present, run --check to verify, print --version
- src/check.rs: --check doctor subcommand with openpty probe, mkfifo probe, and optional
  mock_claude PTY round-trip (skipped if mock_claude not in PATH)
- src/main.rs + src/lib.rs: wire up check::run() for --check flag
- README.md: add Install, Usage, Flags table (matches --help exactly), Exit codes,
  and NEEDLE integration sections
- test-fixtures/mock-claude: extend with all MOCK_* env var controls needed for
  integration tests (MOCK_SILENT, MOCK_EXIT_BEFORE_STOP, MOCK_TRUST_DIALOG, etc.)
- tests/cli.rs, tests/hooks.rs, tests/version_compat.rs: Phase 10 unit test stubs

claude-print --check passes: openpty PASS, mkfifo PASS, mock_claude PTY PASS
bash -n install.sh: syntax OK

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:36:28 -04:00
jedarden
08420de402 Re-verify bead bf-2f1: Phase 8 Emitter tests confirmed passing (second run)
All 13 emitter unit tests pass on re-verification. Implementation was
already complete from prior run; this run confirms correctness and
commits the bead close state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:20:27 -04:00
jedarden
4cf7acb8f8 Close bead bf-2f1: Phase 8 Emitter verification complete
All 13 emitter unit tests pass. Phase 8 implementation verified:
text/json/stream-json output formats, error result objects, exit
code mapping, and stream-json reader thread all confirmed correct.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:18:12 -04:00
jedarden
aaee3d31a1 Update beads tracking for bf-2f1 (Phase 8 Emitter verification)
All 13 emitter unit tests pass; Phase 8 was already implemented.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 01:16:09 -04:00
jedarden
bfb50da40c Add Phase 8: Emitter — text/json/stream-json output formats
Adds emitter.rs with three output format handlers and stream-json reader thread,
ClaudePrintError enum with exit codes and JSON subtypes to error.rs,
and 13 unit tests in tests/emitter.rs covering all plan requirements.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:57:30 -04:00
jedarden
c6241e37b7 Add Phase 7: transcript reader with retry loop and dedup
Implements src/transcript.rs: lenient JSONL parsing, message.id dedup
with usage-fingerprint fallback, text extraction from ContentBlock arrays,
40×50ms retry loop for Stop-before-JSONL races (PO-5), and last_assistant_message
fallback. All 18 tests in tests/transcript.rs pass; AS-6 verified with
MOCK_DELAY_JSONL=100.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:51:59 -04:00
jedarden
343fa3898c Clean up duplicate bf-64s entries in issues.jsonl (Phase 6 already complete)
Phase 6 Stop Poller was implemented in 59e170e and verified complete.
Both integration tests (test_stop_hook_fires, test_missing_transcript_path_derived) pass.
Compaction removed duplicate in-progress entry for bf-64s.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:41:22 -04:00
jedarden
3e711ae009 Close bead bf-64s: Phase 6 Stop Poller complete
All Phase 6 implementation was committed in prior sessions (59e170e).
Both completion criteria tests pass: test_stop_hook_fires and
test_missing_transcript_path_derived.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:40:32 -04:00
jedarden
c688d2c84c Verify Phase 6 completion on retry (bf-64s)
All tests pass including test_stop_hook_fires and
test_missing_transcript_path_derived. Implementation complete in 59e170e.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:38:49 -04:00
jedarden
2760d9b07f Add Phase 6 completion notes for bf-64s
Verifies test_stop_hook_fires and test_missing_transcript_path_derived pass;
documents the FIFO open race resolution (OQ-4) and path derivation algorithm.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:30:40 -04:00
jedarden
ed7790f6e2 Update bead tracking for Phase 6 completion (bf-64s)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:17:20 -04:00
jedarden
ab1e9d6d64 Fix clippy warnings: upper_case_acronyms and manual_range_contains
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:10:43 -04:00
jedarden
0b43ece3ca Merge remote-tracking branch 'origin/main' 2026-06-10 00:05:41 -04:00
jedarden
59e170ed03 Implement Phase 6: Stop Poller (bf-64s)
Add src/poller.rs with FIFO O_NONBLOCK open (read-end + keeper write-end),
Stop hook JSON payload parsing, transcript path derivation via cwd slug,
and StopInfo resolution. Wire poller into EventLoop via add_fifo_fd() which
was already present in event_loop.rs from Phase 3.

Update mock-claude to emit proper JSON Stop payloads (with and without
transcript_path via MOCK_OMIT_TRANSCRIPT_PATH=1) and update the pty_integration
assertion to match.

Tests test_stop_hook_fires and test_missing_transcript_path_derived both pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:05:14 -04:00
jedarden
2407b640f8 Close bf-5bl: starvation alert resolved (dependency chain, not config error)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bead-Id: bf-5bl
2026-06-10 00:00:25 -04:00
jedarden
e422edfe75 Close bf-5bl: starvation alert resolved (dependency chain, not config error)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 00:00:16 -04:00
jedarden
71a3a70a84 Investigate starvation alert: all beads blocked by dependency chain (bf-5bl)
All open beads are transitively blocked waiting on bf-64s (Phase 6, in_progress).
No configuration error — sequential dependency chain is working as designed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 23:59:09 -04:00
jedarden
89e051666c Close bead bf-vsm: Phase 5 Startup Sequencer complete
All four Phase 5 components implemented and verified: keyword trust
dismiss, idle-gap timing, bracketed paste injection, and large-prompt
file relay. 55 tests pass (20 startup unit + 11 test_trust_dialog_*
integration + 24 others).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 22:41:15 -04:00
jedarden
71a4cb9f96 Implement large-prompt file relay in startup.rs (bf-1cx)
Prompts exceeding INLINE_PROMPT_MAX (32 KB) are written to a NamedTempFile
and a shell $(< path) read command is injected via bracketed paste instead
of the raw bytes, avoiding PTY pipe-buffer saturation.

Adds four unit tests: threshold boundary (inline), threshold+1 (file relay),
temp-file content verification, and end-to-end state-machine coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 10:26:16 -04:00
jedarden
066f1e060b Close bead bf-9u4: bracketed paste injection verified complete
Implementation was already present from bf-54m. make_prompt_payload()
wraps the startup prompt in ESC[200~ / ESC[201~\r; injection fires after
the post-dismiss idle gap. All 41 tests pass confirming correct behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 10:17:59 -04:00
jedarden
3e17fdcfe0 Close bead bf-54m: idle-gap timing implemented and verified
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 10:16:57 -04:00
jedarden
adaf26e523 Add idle-gap detection to startup.rs (bf-54m)
After trust-dismiss fires, the post-dismiss wait is now an idle-gap:
injection fires only after idle_gap_ms of uninterrupted silence.
Any PTY output chunk resets the gap via last_output_at, preventing
premature injection during TUI redraws after the dismiss CR.

- Rename POST_DISMISS_IDLE_MS → DEFAULT_POST_DISMISS_IDLE_MS (pub const)
- Add idle_gap_ms field to StartupSeq; expose via with_idle_gap() ctor
- TrustDismissed timer now uses last_output_at instead of trust_dismiss_at
- Reset last_output_at when entering TrustDismissed via idle-fallback path
- Add three unit tests: resets on output, fires after silence, no double-fire

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 10:10:46 -04:00
jedarden
02cf4c1cfc Close bead bf-38q: trust-keyword scanner complete
All test_trust_dialog_* integration tests pass (11/11).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 10:07:46 -04:00
jedarden
edd9470038 Add startup.rs: trust-keyword scanner with test_trust_dialog_* integration tests (Phase 5)
Implements StartupSeq with scan_line() that detects 2+ trust keywords
("trust", "Allow", "continue", "folder", "permission", "proceed") on a
PTY output line and returns CR to dismiss the dialog.  Includes idle
fallback (0.8 s after 200+ bytes) and hard timeout (45 s / <200 bytes →
HardTimeout).  Phase 2 injects the prompt via bracketed paste after a
2 s post-dismiss idle.

11 test_trust_dialog_* integration tests cover keyword match, threshold,
case sensitivity, chunk-boundary assembly, one-shot dismiss, and CR- vs
LF-terminated lines.  12 unit tests in startup::tests cover scan_line
and feed() in isolation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 10:05:27 -04:00
jedarden
f504fadc07 Close bead bf-gvw: Phase 4 Terminal Emulator complete
All 9 terminal unit tests pass. TerminalEmu in terminal.rs handles
DA1/DA2/DSR/XTVERSION/WinSize probes with dedup bitmask and split-chunk
accumulation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 09:27:56 -04:00