You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(classifier): subscription-native agent-sdk backend via Haiku
Add a CLI-backed classifier that reaches an LLM through the local,
already-authenticated `claude` binary — no ANTHROPIC_API_KEY needed.
Resurrects the v0.7.x cli path that was dropped in v0.8.0, this time
documented honestly: since 2026-06-15 a headless `claude -p` draws from
the separate Agent SDK credit pool, not the interactive Pro/Max pool.
- ClaudeCliClassifier (classifier/agent_sdk.rs) runs
`claude -p <prompt> --model claude-haiku-4-5 --output-format json
--strict-mcp-config`, parses the envelope's `result`, reuses the shared
parse_verdict. Command execution injected via a CommandRunner trait so
the parse path is unit-testable without shelling out. from_env() returns
None unless `claude` is on PATH; model overridable via TJ_AGENT_SDK_MODEL.
- Factor http.rs's fence-strip+serde parse into classifier::parse_verdict,
reused by both http and agent_sdk so they never diverge.
- Hybrid is now an ordered LLM chain: heuristic >= 0.7 -> agent-sdk (if
claude on PATH) -> api (if key) -> pending/. Reorder via
TJ_HYBRID_LLM_ORDER (default agent-sdk,api).
- Wire `agent-sdk` into --backend for ingest-hook and classify-worker, and
add --backend to install-hooks (baked into the generated hook command).
- README Configuration + doctor note + --backend help document the backend
and the Agent SDK credit caveat.
Tests: agent_sdk parse/threshold/fence/error (fake runner, no live claude);
hybrid proves uncertain -> agent-sdk wins and http is never touched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@@ -181,10 +181,32 @@ The MCP server exposes five tools to Claude Code (and any MCP client):
181
181
182
182
## Configuration
183
183
184
+
### Classifier backends
185
+
186
+
The auto-capture classifier (a best-effort backstop — explicit self-tagging via the
187
+
MCP tools is the primary path) has a heuristic stage plus an optional LLM stage. The
188
+
LLM stage has **two** ways to reach a model, pick via `--backend` on `install-hooks`
189
+
or `ingest-hook`:
190
+
191
+
-**`agent-sdk`** — classify via the local, already-logged-in `claude` binary. **No
192
+
`ANTHROPIC_API_KEY` needed** — it rides your Claude subscription. Pinned to Haiku.
193
+
⚠️ Since **2026-06-15** a headless `claude -p` run draws from the separate **Agent
194
+
SDK** monthly credit pool (~$20 Pro / $100 Max 5x / $200 Max 20x, at API rates),
195
+
not the interactive pool. Classification is Haiku-class and tiny (a few hundred
196
+
tokens per chunk), so the credit lasts a long time — but it is not strictly free.
197
+
-**`api`** — call the Anthropic API directly. Requires `ANTHROPIC_API_KEY`.
198
+
199
+
`--backend=hybrid` (the default) runs the heuristic first, then falls through the LLM
200
+
chain `agent-sdk → api`, using whichever backends are available. Reorder the chain
201
+
with `TJ_HYBRID_LLM_ORDER` (e.g. `api,agent-sdk` to prefer the API key). With no LLM
202
+
backend available, the heuristic still runs and ambiguous chunks queue in `pending/`.
203
+
184
204
| Env var | Effect | Default |
185
205
|---------|--------|---------|
186
-
|`ANTHROPIC_API_KEY`| Powers the API stage of `--backend=hybrid` (default) and is required for `--backend=api`. Without it, only the offline heuristic runs and ambiguous chunks land in the local pending queue. |_unset_|
187
-
|`TJ_CLASSIFIER_MODEL`| Override the Anthropic model used by the API stage. |`claude-haiku-4-5-20251001`|
206
+
|`ANTHROPIC_API_KEY`| Enables the `api` LLM backend (and the `api` link of the hybrid chain). Optional — the `agent-sdk` backend needs no key. |_unset_|
207
+
|`TJ_AGENT_SDK_MODEL`| Override the model the `agent-sdk` backend passes to `claude --model`. |`claude-haiku-4-5`|
208
+
|`TJ_HYBRID_LLM_ORDER`| Comma-separated fallback order for `--backend=hybrid`. |`agent-sdk,api`|
209
+
|`TJ_CLASSIFIER_MODEL`| Override the Anthropic model used by the `api` backend. |`claude-haiku-4-5-20251001`|
188
210
|`TJ_AUTO_OPEN_TASKS`| Set to `0` / `false` to disable auto-opening a task from `UserPromptSubmit` when no open task exists. |`1`|
0 commit comments