feat(consolidate): claude -p backend — works without an API key (0.20.0)#37
Merged
Merged
Conversation
The 0.19.0 consolidate was API-key-only, which left it unusable for anyone on a Claude subscription without an ANTHROPIC_API_KEY (bd tj-09r8xz1kwa). consolidate::summarize now selects a backend: direct Haiku API when ANTHROPIC_API_KEY is set (cheapest, ~1c/run), else the local `claude -p` binary via run_claude_json + ClaudeBinaryStdinRunner (subscription auth, no key; recursion guard already set by base_claude_command), else Ok(None) so the caller skips cleanly. TJ_CONSOLIDATE_BACKEND=none force-disables. Still manual-only, one call per run, never on a hook → cannot spend automatically. No backend => writes nothing, no heuristic fallback. Tests: existing 5 core + 2 CLI green (mock test still exercises the API path; skip test forces TJ_CONSOLIDATE_BACKEND=none so it's deterministic even where `claude` is on PATH). Clean on default and --no-default-features. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
0.19.0's
consolidatewas API-key-only — unusable for anyone on a Claude subscription without anANTHROPIC_API_KEY. This adds the localclaude -ppath.consolidate::summarizenow selects a backend:ANTHROPIC_API_KEYset → direct Haiku API (cheapest, ~1¢/run).claudeon PATH →claude -p(your subscription login, no API key needed; post-2026-06-15 bills extra + boots the env per call, so pricier).Reuses the classifier's
run_claude_json+ClaudeBinaryStdinRunner(recursion guard already set bybase_claude_command).TJ_CONSOLIDATE_BACKEND=noneforce-disables.Still manual-only, one call per run, never on a hook → cannot spend automatically.
Tests
Existing 5 core + 2 CLI green — the mock test still exercises the API path; the skip test forces
TJ_CONSOLIDATE_BACKEND=noneso it's deterministic even whereclaudeis on PATH. Clean on default and--no-default-features.🤖 Generated with Claude Code