Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@

<div align="center">

# πŸ‹πŸ”₯ DeepSeek Prefix Cache
# πŸŒΏβœ‚οΈ /eco Token Compression

# Run long agentic coding sessions for *pennies*
# Same session, **80% fewer** Bash-output tokens

### Cache-hit input bills at **`~$0.0435` / 1M tokens** β€” about **230Γ— cheaper** than Claude Fable 5 (`$10` / 1M).
### Measured, not estimated: 27 real command outputs replayed through the production pipeline β€” **92,989 β†’ 17,767 tokens (-80%)**. Failure summaries keep the error lines that matter; anything lossy is teed to disk, one `tail` away.

ClawCodex keeps your request prefix **byte-stable**, so DeepSeek's prompt cache covers your whole
`system + tools + history` span across turns. **The longer you code, the more you save.**
One toggle, deterministic filters β€” failure-focused test summaries, `git`/`pip`/`npm` ceremony
stripping, log dedup, recoverable head-caps β€” guarded to be **never worse** than the raw rendering.
Stacks with the DeepSeek prefix cache: the cache makes your stable prefix nearly free, `/eco`
shrinks the fresh suffix every turn actually pays for. **[See the measured benchmark ↓](#eco-benchmark)**

</div>

Expand Down Expand Up @@ -101,6 +103,7 @@ The `session`, `settings`, and `env` blocks are optional β€” sensible defaults a

## πŸ“° News

- **2026-07-13:** **`/eco` token compression β€” -80% Bash-output tokens, measured, now the headline (#708, #712)** β€” a new session toggle compresses the model-bound rendering of every Bash result with deterministic filters ported from [RTK](https://github.com/rtk-ai/rtk)'s method set: failure-focused test summaries (kept error lines are never rewritten), `git`/`pip`/`npm` ceremony stripping, log dedup with `[Γ—N]` counts, and a recoverable head-cap β€” all behind a **never-worse** guard, with every lossy compression teeing the full output to disk behind a runnable recovery hint (#708). A reproducible benchmark (`eval/eco/`) replays 27 real command outputs through the exact production pipeline and counts real tokenizer tokens: **92,989 β†’ 17,767 (-80%)** corpus-wide, -88% on filter hits, plus an honestly conservative recompute of RTK's own 30-minute-session model (-19% under their averaged assumptions β€” real sessions are fat-tailed) (#712). Full tables: the [`/eco` section](#eco-benchmark) and [`eval/eco/results/`](eval/eco/results/results.md).
- **2026-07-12 (v1.1.0):** **ClawCodex v1.1.0 β€” run OpenAI *and* Claude models on your subscription, not metered API billing** β€” the headline of 1.1.0 is **subscription auth for the two biggest model families**, so you can point ClawCodex at a plan you already pay for. **Sign in with ChatGPT (#698):** `clawcodex login β†’ openai β†’ subscription` (browser, device-code, or import from an existing Codex CLI login) routes requests through the ChatGPT Codex backend's Responses API β€” `gpt-5.5`, `gpt-5.4`, `gpt-5.4-mini`, and `gpt-5.3-codex-spark` on your Plus/Pro allowance, with encrypted-reasoning replay across turns and **$0** metered cost. **Claude Pro/Max (#697):** `clawcodex login β†’ anthropic β†’ subscription` connects a Claude subscription via OAuth (PKCE) with automatic token refresh and the same $0 accounting; follow-ups repaired the login after Anthropic moved its OAuth endpoints to `platform.claude.com` (#702) and stopped sending adaptive thinking to models that don't support it (#699). A configured API key always wins, and subscription usage reports `billing_mode: subscription`. **More models:** a Meta (`api.meta.ai`) provider with the 1M-context `muse-spark-1.1` reasoning model (#692) and refreshed MiniMax parameters (#696). **Workflow & TUI:** `/plan` mode with implicit plan-mode entry/exit (#676), `--worktree/-w` session isolation for parallel runs in separate git worktrees (#672), the `/memory` picker + `$EDITOR` spawn (#693), config/state directories rebranded `.claude β†’ .clawcodex` with a one-time migration (#678), `/logo` startup color schemes (#677), plus TUI polish β€” Tab accepts the suggested placeholder (#690), past inputs get the Claude-Code highlight band (#691), clickable agent URLs (#694), and a per-terminal link-open affordance (#701). **Quality:** semantic tool-input coercion with parity validation errors (#700) and looser, Claude-Code-faithful permission granting (#673).
- **2026-07-07:** **`/loop` scheduled tasks now actually fire β€” full port of Claude Code's session-scoped scheduler (#680)** β€” the bundled `/loop` skill finally has a real engine behind it: a new `src/scheduled_tasks` module parses standard 5-field cron expressions and fires due prompts **between turns** from the agent-server's idle poll. `CronCreate`/`CronList`/`CronDelete` register real firing jobs (8-char IDs, 50-job cap, deterministic jitter, 7-day recurring expiry with one final fire), and the new **`ScheduleWakeup`** tool drives self-paced `/loop` mode β€” the model picks each next delay (1 min–1 hr), `stop: true` ends the loop, and a ~20-minute fallback wakeup catches iterations that forget to reschedule. Typed skill slash commands now reach the backend (new `skill_command` control), so `/loop 5m check ci` works from the composer with completion + argument hint; the TUI shows a live countdown indicator (`⟳ loop wakeup in 2m 14s Β· ⏰ 1 scheduled`) and **Esc while idle stops a waiting loop**. `/clear` drops session tasks, `--resume` restores unexpired ones, `CLAWCODEX_DISABLE_CRON=1` disables the scheduler. 117 new tests; verified live over stdio NDJSON and a real PTY TUI drive (typed dispatch β†’ CronCreate β†’ a real wakeup fire between turns β†’ Esc-stop).
- **2026-07-07:** **Bounded the ESC-cancel chunk queue in OpenAI-compatible streaming (#278)** β€” `OpenAICompatibleProvider.chat_stream_response`'s worker-thread queue (added in #148) was an unbounded `queue.Queue`. A non-graceful disconnect from a proxy that keeps sending bytes after ESC (and never closes the SDK iterator) let the orphaned worker thread accumulate chunks in memory indefinitely. The queue is now capped at 64 chunks, so `put()` blocks the worker once full instead of growing without bound.
Expand All @@ -110,7 +113,6 @@ The `session`, `settings`, and `env` blocks are optional β€” sensible defaults a
- **2026-06-23:** **One-click installer** β€” `curl -fsSL https://clawcodex.app/install.sh | bash` installs uv (no sudo), provisions Python 3.10+, clones to `~/.clawcodex`, creates a lock-pinned venv, and registers `clawcodex` on PATH; ships status / doctor / verify / update / uninstall subcommands, is safe to re-run, and works on macOS / Linux / WSL.
- **2026-06-21:** **18 new LLM providers β€” the registry grows 7 β†’ 25 (#377)** β€” a data-driven `ProviderSpec` registry adds 18 OpenAI-compatible backends (nvidia-nim, fireworks, together, moonshot/Kimi, novita, siliconflow, deepinfra, stepfun, arcee, huggingface, volcengine, xiaomi-mimo, atlascloud, wanjie-ark, plus local ollama / vllm / sglang) alongside the hand-written providers; alias-aware config resolution, standard env-var key fallback (e.g. `TOGETHER_API_KEY`), and keyless local servers.
- **2026-06-18:** **DeepSeek prefix-cache exploitation β€” a HUGE token-cost win (#363)** β€” ClawCodex now keeps its request prefix **byte-stable** across turns so DeepSeek's automatic prompt-prefix cache covers the entire `system + tools + history` span. Per-request-volatile sections (env, the mutable `MEMORY.md` body, plan-mode, etc.) are relocated to a trailing `<system-reminder>` *after* the conversation history, so the cached prefix never breaks even when memory/env change. We also register DeepSeek's **1M-token context window**, map its prompt-cache usage onto the Anthropic `cache_read_input_tokens` convention, and surface a per-model **prompt-cache hit-rate** + cost in `/cost`. **Why this is enormous β€” the token economics:** Claude Fable 5 runs **$10 / $50** per 1M input/output tokens, while **DeepSeek-V4-Pro is just $0.435 / $0.87** β€” already **~23Γ— cheaper on input** and **~57Γ— cheaper on output**. And because **cache-hit input is billed at only 10%** of the normal input rate, the long, context-heavy sessions that agentic coding actually produces pay just **~$0.0435 per 1M input tokens** β€” roughly **230Γ— cheaper than Fable 5 input**. The token efficiency ClawCodex unlocks here is **HUGE**. Everything is gated to the `deepseek` provider β€” every other provider's request is byte-for-byte unchanged. Follow-up: truncated tool-call argument JSON is now best-effort recovered in the shared OpenAI-compatible layer, so an interrupted DeepSeek stream keeps its partial tool args instead of dropping them to `{}` (#364).
- **2026-06-16:** **Z.ai GLM-5.2 support (#343)** β€” new `zai` provider for Z.ai's OpenAI-compatible GLM Coding Plan (`https://api.z.ai/api/coding/paas/v4`), shipping `GLM-5.1` and the `GLM-5.2` preview; GLM-5.2 delivers coding capability comparable to Claude Opus 4.7. First app built end-to-end with GLM-5.2 β€” a [FIFA World Cup 2026 intro page](demos/wc26-intro/index.html) (animated hero + live countdown, three host nations, 16 stadiums, tournament format, and record-breaking facts).
πŸ“š Older items have moved to the full **[News archive](docs/NEWS.md)**.

***
Expand Down Expand Up @@ -147,6 +149,8 @@ Reproduce locally β€” see [`eval/README.md`](eval/README.md) for the full workfl

***

<a id="eco-benchmark"></a>

## 🌿 `/eco` Token Compression β€” **-80% Bash-output tokens, measured**

Long agentic sessions drown in tool output: failing test logs, `git` progress spam,
Expand Down Expand Up @@ -256,8 +260,8 @@ rewriting commands.
interrupted runs are never altered; any filter exception falls back to passthrough.

`/eco status` shows per-filter savings for the session. Compression stacks with the
[DeepSeek prefix cache](#-deepseek-prefix-cache): the cache makes the stable prefix
nearly free, `/eco` shrinks the fresh suffix every turn actually pays for. Reproduce:
**DeepSeek prefix cache** (see [News](#-news), 2026-06-18): the cache makes the stable
prefix nearly free, `/eco` shrinks the fresh suffix every turn actually pays for. Reproduce:

```bash
python3 eval/eco/capture_corpus.py --workdir /tmp/eco-bench # capture real outputs
Expand Down
1 change: 1 addition & 0 deletions docs/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Full news history for ClawCodex. The [README News section](../README.md#-news) keeps only the 10 most recent items.

- **2026-07-13:** **`/eco` token compression β€” -80% Bash-output tokens, measured, now the headline (#708, #712)** β€” a new session toggle compresses the model-bound rendering of every Bash result with deterministic filters ported from [RTK](https://github.com/rtk-ai/rtk)'s method set: failure-focused test summaries (kept error lines are never rewritten), `git`/`pip`/`npm` ceremony stripping, log dedup with `[Γ—N]` counts, and a recoverable head-cap β€” all behind a **never-worse** guard, with every lossy compression teeing the full output to disk behind a runnable recovery hint (#708). A reproducible benchmark (`eval/eco/`) replays 27 real command outputs through the exact production pipeline and counts real tokenizer tokens: **92,989 β†’ 17,767 (-80%)** corpus-wide, -88% on filter hits, plus an honestly conservative recompute of RTK's own 30-minute-session model (-19% under their averaged assumptions β€” real sessions are fat-tailed) (#712). Full tables: the [`/eco` section](../README.md#eco-benchmark) and [`eval/eco/results/`](../eval/eco/results/results.md).
- **2026-07-12 (v1.1.0):** **ClawCodex v1.1.0 β€” run OpenAI *and* Claude models on your subscription, not metered API billing** β€” the headline of 1.1.0 is **subscription auth for the two biggest model families**, so you can point ClawCodex at a plan you already pay for. **Sign in with ChatGPT (#698):** `clawcodex login β†’ openai β†’ subscription` (browser, device-code, or import from an existing Codex CLI login) routes requests through the ChatGPT Codex backend's Responses API β€” `gpt-5.5`, `gpt-5.4`, `gpt-5.4-mini`, and `gpt-5.3-codex-spark` on your Plus/Pro allowance, with encrypted-reasoning replay across turns and **$0** metered cost. **Claude Pro/Max (#697):** `clawcodex login β†’ anthropic β†’ subscription` connects a Claude subscription via OAuth (PKCE) with automatic token refresh and the same $0 accounting; follow-ups repaired the login after Anthropic moved its OAuth endpoints to `platform.claude.com` (#702) and stopped sending adaptive thinking to models that don't support it (#699). A configured API key always wins, and subscription usage reports `billing_mode: subscription`. **More models:** a Meta (`api.meta.ai`) provider with the 1M-context `muse-spark-1.1` reasoning model (#692) and refreshed MiniMax parameters (#696). **Workflow & TUI:** `/plan` mode with implicit plan-mode entry/exit (#676), `--worktree/-w` session isolation for parallel runs in separate git worktrees (#672), the `/memory` picker + `$EDITOR` spawn (#693), config/state directories rebranded `.claude β†’ .clawcodex` with a one-time migration (#678), `/logo` startup color schemes (#677), plus TUI polish β€” Tab accepts the suggested placeholder (#690), past inputs get the Claude-Code highlight band (#691), clickable agent URLs (#694), and a per-terminal link-open affordance (#701). **Quality:** semantic tool-input coercion with parity validation errors (#700) and looser, Claude-Code-faithful permission granting (#673).
- **2026-07-07:** **`/loop` scheduled tasks now actually fire β€” full port of Claude Code's session-scoped scheduler (#680)** β€” the bundled `/loop` skill finally has a real engine behind it: a new `src/scheduled_tasks` module parses standard 5-field cron expressions and fires due prompts **between turns** from the agent-server's idle poll. `CronCreate`/`CronList`/`CronDelete` register real firing jobs (8-char IDs, 50-job cap, deterministic jitter, 7-day recurring expiry with one final fire), and the new **`ScheduleWakeup`** tool drives self-paced `/loop` mode β€” the model picks each next delay (1 min–1 hr), `stop: true` ends the loop, and a ~20-minute fallback wakeup catches iterations that forget to reschedule. Typed skill slash commands now reach the backend (new `skill_command` control), so `/loop 5m check ci` works from the composer with completion + argument hint; the TUI shows a live countdown indicator (`⟳ loop wakeup in 2m 14s Β· ⏰ 1 scheduled`) and **Esc while idle stops a waiting loop**. `/clear` drops session tasks, `--resume` restores unexpired ones, `CLAWCODEX_DISABLE_CRON=1` disables the scheduler. 117 new tests; verified live over stdio NDJSON and a real PTY TUI drive (typed dispatch β†’ CronCreate β†’ a real wakeup fire between turns β†’ Esc-stop).
- **2026-07-07:** **Bounded the ESC-cancel chunk queue in OpenAI-compatible streaming (#278)** β€” `OpenAICompatibleProvider.chat_stream_response`'s worker-thread queue (added in #148) was an unbounded `queue.Queue`. A non-graceful disconnect from a proxy that keeps sending bytes after ESC (and never closes the SDK iterator) let the orphaned worker thread accumulate chunks in memory indefinitely. The queue is now capped at 64 chunks, so `put()` blocks the worker once full instead of growing without bound.
Expand Down
Loading
Loading