claude-code-infinite 1.0.21 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -44
- package/dist/claude-env.d.ts +14 -1
- package/dist/claude-env.d.ts.map +1 -1
- package/dist/claude-env.js +17 -1
- package/dist/claude-env.js.map +1 -1
- package/dist/cli-args.d.ts +15 -0
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +17 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-lifecycle.d.ts +4 -0
- package/dist/cli-lifecycle.d.ts.map +1 -1
- package/dist/cli-lifecycle.js +18 -0
- package/dist/cli-lifecycle.js.map +1 -1
- package/dist/cli-main.js +174 -51
- package/dist/cli-main.js.map +1 -1
- package/dist/cli-output.d.ts +15 -0
- package/dist/cli-output.d.ts.map +1 -0
- package/dist/cli-output.js +26 -0
- package/dist/cli-output.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/count-tokens.d.ts.map +1 -1
- package/dist/count-tokens.js +7 -1
- package/dist/count-tokens.js.map +1 -1
- package/dist/diagnostics-schema.d.ts +44 -0
- package/dist/diagnostics-schema.d.ts.map +1 -0
- package/dist/diagnostics-schema.js +162 -0
- package/dist/diagnostics-schema.js.map +1 -0
- package/dist/diagnostics.d.ts +116 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +316 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/first-tree.d.ts +11 -0
- package/dist/first-tree.d.ts.map +1 -0
- package/dist/first-tree.js +45 -0
- package/dist/first-tree.js.map +1 -0
- package/dist/hooks.d.ts +37 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +69 -9
- package/dist/hooks.js.map +1 -1
- package/dist/link-command.d.ts +50 -0
- package/dist/link-command.d.ts.map +1 -0
- package/dist/link-command.js +168 -0
- package/dist/link-command.js.map +1 -0
- package/dist/memtree-links.d.ts +2 -0
- package/dist/memtree-links.d.ts.map +1 -1
- package/dist/memtree-links.js +4 -0
- package/dist/memtree-links.js.map +1 -1
- package/dist/memtree-mcp-config.d.ts +28 -5
- package/dist/memtree-mcp-config.d.ts.map +1 -1
- package/dist/memtree-mcp-config.js +116 -47
- package/dist/memtree-mcp-config.js.map +1 -1
- package/dist/memtree-mcp.js +1 -1
- package/dist/memtree-newest.d.ts +1 -0
- package/dist/memtree-newest.d.ts.map +1 -1
- package/dist/memtree-newest.js +1 -1
- package/dist/memtree-newest.js.map +1 -1
- package/dist/memtree.d.ts +7 -0
- package/dist/memtree.d.ts.map +1 -1
- package/dist/memtree.js +8 -0
- package/dist/memtree.js.map +1 -1
- package/dist/prefix-store.js +3 -0
- package/dist/prefix-store.js.map +1 -1
- package/dist/proxy.d.ts +28 -2
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +88 -9
- package/dist/proxy.js.map +1 -1
- package/dist/reqlog.d.ts +17 -1
- package/dist/reqlog.d.ts.map +1 -1
- package/dist/reqlog.js.map +1 -1
- package/dist/resume-hint.d.ts +25 -0
- package/dist/resume-hint.d.ts.map +1 -0
- package/dist/resume-hint.js +36 -0
- package/dist/resume-hint.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -17,10 +17,27 @@ follows it down to the original messages.
|
|
|
17
17
|
* **Search across every session.** Claude can find what was decided, tried or ruled out in any of
|
|
18
18
|
your past sessions, by exact words or by meaning, filtered by project and date
|
|
19
19
|
* **Browse each session's MemTree** in your browser, from the link `ccc` prints in the terminal
|
|
20
|
-
* **
|
|
21
|
-
full
|
|
22
|
-
([details](#long-session-benchmark))
|
|
20
|
+
* **Never loses anything vs Claude Code.** Sessions are sent word for word until near the context
|
|
21
|
+
limit; past it, MemTree matched full context (69 vs 69) and beat `/compact` by 20 ([benchmark](#long-session-benchmark))
|
|
23
22
|
* **Unlimited-length sessions**, with relevant past information recalled automatically
|
|
23
|
+
* **A local proxy, so no slowdown.** Requests go straight from your machine to Anthropic and
|
|
24
|
+
MemTree indexes in the background; only the occasional compression step, when a session
|
|
25
|
+
outgrows the context budget, waits on MemTree
|
|
26
|
+
|
|
27
|
+
The magic starts past the context limit. Keep one session going for days and it learns how you
|
|
28
|
+
work: your priorities, the nuances of your projects, your company and your environment. Where
|
|
29
|
+
`/compact` would wipe that detail, MemTree keeps it, so the thread becomes an expert in you. Let it
|
|
30
|
+
orchestrate dozens of subagents on your behalf.
|
|
31
|
+
|
|
32
|
+
> [!IMPORTANT]
|
|
33
|
+
> Requires a Claude Pro or Max subscription.
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<picture>
|
|
37
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/crizCraig/claude-code-infinite/main/docs/images/benchmark-dark.svg">
|
|
38
|
+
<img width="600" alt="Long-session benchmark, judged score out of 100: Claude Code Infinite 69, full context 69, /compact 49" src="https://raw.githubusercontent.com/crizCraig/claude-code-infinite/main/docs/images/benchmark-light.svg">
|
|
39
|
+
</picture>
|
|
40
|
+
</p>
|
|
24
41
|
|
|
25
42
|
## Search across sessions
|
|
26
43
|
|
|
@@ -67,14 +84,11 @@ tokens; `/compact`'s exclude the one-time `/compact` step. This is one task fami
|
|
|
67
84
|
|
|
68
85
|
* [node.js 20.3 or newer](https://nodejs.org/en/download/)
|
|
69
86
|
* [Claude Code (the terminal version)](https://code.claude.com/docs/en/quickstart)
|
|
70
|
-
* **Claude
|
|
87
|
+
* **A Claude Pro or Max subscription**
|
|
71
88
|
|
|
72
|
-
|
|
89
|
+
<sub>Also works with an Anthropic API key, but that's far costlier than Pro or Max.</sub>
|
|
73
90
|
|
|
74
|
-
|
|
75
|
-
> No Claude subscription? Use an Anthropic API key exactly as with vanilla Claude Code
|
|
76
|
-
> (`ANTHROPIC_API_KEY` or a Console login). `ccc` forwards it unchanged to api.anthropic.com, and
|
|
77
|
-
> you pay Anthropic per token.
|
|
91
|
+
## Setup
|
|
78
92
|
|
|
79
93
|
1. Install (Node ≥ 20.3; no git needed)
|
|
80
94
|
```bash
|
|
@@ -96,6 +110,40 @@ The tool supports multiple environments (this selects the MemTree compression AP
|
|
|
96
110
|
|
|
97
111
|
Each environment maintains its own separate API key.
|
|
98
112
|
|
|
113
|
+
## Commands
|
|
114
|
+
|
|
115
|
+
Type these inside a `ccc` session (the `ccc:` prefix is optional). `ccc` answers them
|
|
116
|
+
locally, so they cost no model turn.
|
|
117
|
+
|
|
118
|
+
| Command | What it does |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| `/ccc:memtree` | Lists the MemTree commands and links your usage dashboard. |
|
|
121
|
+
| `/ccc:memtree-view` | Shows the link to this session's MemTree page. |
|
|
122
|
+
| `/ccc:memtree-compact [tokens]` | Compacts the session on your next message (to half the budget, or a target such as `400k`) and keeps the compressed history. |
|
|
123
|
+
| `/ccc:memtree-compact off` | Goes back to sending the conversation whole. |
|
|
124
|
+
|
|
125
|
+
From a shell or script (no session needed):
|
|
126
|
+
|
|
127
|
+
| Command | What it does |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `ccc link <session-id>` | Prints the session's newest MemTree page URL on stdout, one line and nothing else. `--json` prints `{session_id, url, tree, updated_at}` instead (`updated_at` is the session's last activity). Exit status 0 printed, 1 no saved key or the server could not be reached (5 s timeout), 2 bad invocation, 3 the session has no MemTree yet (or no session with that id on your key; stderr says which). Only your own sessions (those of your saved key) are found. `ccc staging link` / `ccc local link` use that environment's key. |
|
|
130
|
+
| `ccc fetch <memtree-url>` | Prints one of your MemTree pages as JSON, using your saved key. |
|
|
131
|
+
|
|
132
|
+
Environment variables, set when launching `ccc`:
|
|
133
|
+
|
|
134
|
+
| Variable | What it does |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `CCC_COMPACT_TARGET=500k` | Compaction target for every session (useful for headless `-p` runs); `off` starts every session with compaction off. |
|
|
137
|
+
| `CCC_MEMTREE_MCP=0` | Turns off the `memtree` MCP tools ([details](#memory-tools)), in interactive and headless (`-p`) runs. |
|
|
138
|
+
| `CCC_MEMTREE_LINK` | Where the MemTree link appears: `turn` (default, end of a turn with a new page), `message` (under every reply), `stop` (end of every turn), `success` (only after an optimized turn), or `off`. |
|
|
139
|
+
| `CCC_AUTO_COMPACT=1` | Restores Claude Code's own auto-compaction setting ([details](#claude-code-auto-compaction)). |
|
|
140
|
+
| `CCC_NO_UPDATE_CHECK=1` | Turns off the update check, and with it automatic updates ([details](#upgrading)). |
|
|
141
|
+
| `CCC_DISABLE_AUTOUPDATE=1` | Keeps the update notice but never installs ([details](#automatic-updates)). |
|
|
142
|
+
| `CCC_NO_DIAGNOSTICS=1` | Turns off diagnostics ([details](#diagnostics)). So do `DO_NOT_TRACK=1`, Claude Code's `DISABLE_TELEMETRY=1` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`, and `"diagnostics": false` in `~/.claude-code-infinite/config.json`. |
|
|
143
|
+
|
|
144
|
+
Links are clickable in terminals that support OSC 8 hyperlinks (iTerm2, Ghostty, WezTerm,
|
|
145
|
+
kitty, VS Code, JetBrains, Windows Terminal); elsewhere you get the plain URL.
|
|
146
|
+
|
|
99
147
|
## Claude Code auto-compaction
|
|
100
148
|
|
|
101
149
|
`ccc` disables Claude Code's automatic conversation compaction for the Claude process it launches. MemTree manages the context sent to the model, so letting Claude Code independently summarize the full local transcript can compact a conversation MemTree already reduced. Manual `/compact` remains available.
|
|
@@ -105,6 +153,13 @@ above a fixed 100k-token threshold, even when the active model has a 1M window
|
|
|
105
153
|
and auto-compaction is disabled. `ccc` suppresses that resume-time
|
|
106
154
|
recommendation as well; it does not disable the manual `/compact` command.
|
|
107
155
|
|
|
156
|
+
With auto-compaction off, Claude Code still refuses a request itself, without
|
|
157
|
+
sending it, once its own estimate reaches the window minus 23k (977k on a 1M
|
|
158
|
+
window). MemTree compresses at 900k, so a single large tool round could reach that
|
|
159
|
+
refusal before `ccc` ever saw the request. `ccc` sets
|
|
160
|
+
`CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE` (unless you exported your own) so such a
|
|
161
|
+
request reaches the proxy, which compresses it mid-turn.
|
|
162
|
+
|
|
108
163
|
A session whose last response reached the verified local refusal threshold
|
|
109
164
|
(for example one sent whole while MemTree was unavailable) would otherwise be
|
|
110
165
|
refused locally with "Context limit reached" on every prompt after a resume.
|
|
@@ -141,28 +196,45 @@ Claude Code ──▶ localhost proxy (ccc)
|
|
|
141
196
|
- Anthropic requests go directly from the local proxy to api.anthropic.com using the authentication Claude Code supplied. PolyChat never sees that credential or Anthropic traffic.
|
|
142
197
|
- If MemTree is unreachable, slow, or your MemTree plan needs payment, `ccc` degrades to a transparent passthrough so your session is never interrupted.
|
|
143
198
|
|
|
144
|
-
###
|
|
199
|
+
### Diagnostics
|
|
145
200
|
|
|
146
|
-
|
|
201
|
+
`ccc` sends a few diagnostics to MemTree so we can see why a session fails to start or stalls:
|
|
147
202
|
|
|
148
|
-
-
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
|
|
203
|
+
- versions (ccc, Claude Code, Node), how ccc was installed (npm, npx, linked), OS and CPU
|
|
204
|
+
architecture, terminal type and locale;
|
|
205
|
+
- lifecycle events (first run, sign-in prompt shown, key accepted or rejected, session start,
|
|
206
|
+
the MemTree-paused notice shown, update hint or background update result);
|
|
207
|
+
- errors as codes, status numbers, sizes and timings (an Anthropic 401, a MemTree 402, a
|
|
208
|
+
compression timeout).
|
|
152
209
|
|
|
153
|
-
|
|
210
|
+
Never sent: your prompts or any conversation content, file paths, project or repository names,
|
|
211
|
+
hostnames, usernames, environment values, keys or tokens, or error message text. Each event is
|
|
212
|
+
checked against a fixed allowlist on your machine before it is queued, and again by the server.
|
|
213
|
+
They are tied to your MemTree key when you have one, otherwise to a random install id in
|
|
214
|
+
`~/.claude-code-infinite/install_id`. Sending is batched in the background and never slows a
|
|
215
|
+
request; a failed send is dropped.
|
|
154
216
|
|
|
155
|
-
|
|
217
|
+
Turn diagnostics off with any of: `CCC_NO_DIAGNOSTICS=1`, `"diagnostics": false` in
|
|
218
|
+
`~/.claude-code-infinite/config.json`, `DO_NOT_TRACK=1`, or Claude Code's own
|
|
219
|
+
`DISABLE_TELEMETRY=1` / `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`.
|
|
156
220
|
|
|
157
|
-
|
|
221
|
+
### Memory tools
|
|
158
222
|
|
|
159
|
-
`ccc`
|
|
223
|
+
Every `ccc` session, interactive or headless (`-p` and non-TTY runs), gets a small MCP server, `memtree`, with four read-only tools (see [Search across sessions](#search-across-sessions)): `mcp__memtree__search` (`query`; optional `tree`, `"current"` for this session or omitted for all of your sessions; `mode` `text` (default, free) or `vector` (meaning, first page charged); `project`, `since`, `until`, `cursor`, `limit` (default 10, at most 50)), `mcp__memtree__read_node` (`node`, an address `<tree>#<id>` from search, or `id` with optional `tree`: summary, path from the root, children, leaf line range), `mcp__memtree__read_lines` (a leaf's `node`, or `block`, `start`, `end` with optional `tree`: exact transcript lines, at most 400 lines / 40k characters per call) (with `tail: true` instead, the newest messages after the tree that are not indexed yet) and `mcp__memtree__list` (your sessions, most recently active first; `since`, `until`, `project`, `q`, `cursor`, `limit`). Other sessions' trees are named explicitly by reference and authorized by your MemTree key. This session's tree (`tree: "current"`, or no `tree` on `read_node`/`read_lines`) is the one the current request was served from: the server asks the `ccc` proxy for `GET $ANTHROPIC_BASE_URL/memtree/current?session=<id>` (only that session's compression source page, or its stored source page on resume; `current.json?session=<id>` returns the page itself). Completed pages are cached. If the proxy temporarily serves an older prefix while a newer tree is indexing, the tools reuse that prefix during a 45-second cooldown, then check the page again. `ccc` registers it with `--mcp-config=<temp file>`, which keeps working under `--strict-mcp-config`, and pre-allows the four read-only tools; `CCC_MEMTREE_MCP=0` turns it off. The MCP process requires `CLAUDE_CODE_SESSION_ID` and checks that both the pointer and page belong to it. If Claude Code retains an MCP process with an old session ID after `/clear` or a session switch, reconnect the MCP server with the current session ID; it cannot infer a new identity from another session using the proxy. Your own choices win: if your `--mcp-config` already names a server `memtree`, `ccc` adds and pre-allows nothing (if it runs `ccc memtree-mcp`, or `ccc staging memtree-mcp`, the tools work as usual); `--allowedTools` lists are added together, so yours is kept and only the four memtree tools are pre-allowed; tools named by `--disallowedTools` (one tool, `mcp__memtree`, or `mcp__memtree__*`) are neither pre-allowed nor advertised. With `--continue`, Claude Code starts MCP servers under a new session id before it switches to the continued session, so this session's tree fails closed (`list` and searches across sessions still work); use `--resume <id>` instead. Whenever the tools are configured, compress calls carry `x-memtree-tools: search,read_node,read_lines,list` so MemTree tells the model how to use them.
|
|
160
224
|
|
|
161
|
-
|
|
225
|
+
### Headless / agents
|
|
162
226
|
|
|
163
|
-
|
|
227
|
+
`ccc -p` works like `claude -p`, so an agent or orchestrator can drive it. Keep one Claude Code session per long-lived agent and resume it on every call, so MemTree keeps compacting and indexing one growing conversation:
|
|
164
228
|
|
|
165
|
-
|
|
229
|
+
```bash
|
|
230
|
+
ccc -p --resume <session-id> --output-format json "…"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Start the session with `ccc -p --session-id <uuid> "…"` (or take `session_id` from the first JSON result). Never run two `ccc` processes on one session at the same time: both would append to the same transcript. Headless runs have the [memory tools](#memory-tools) with no extra flags (`CCC_MEMTREE_MCP=0` turns them off; they can read all of the sessions your MemTree key owns, so give each user of a shared agent platform their own key). Stdout carries only Claude Code's output, so `--output-format json` and `stream-json` parse as with `claude`; `ccc`'s own lines (banner, mode, request log path) go to stderr. `--mcp-config` takes several values, so pass your own as `--mcp-config=<file>` or put the prompt before it; otherwise it swallows a prompt that follows it.
|
|
234
|
+
|
|
235
|
+
To show an agent's memory after a run, `ccc link "$sid"` prints the session's newest MemTree page URL (exit 3 when it has no tree yet). It can trail the run by one call: a `-p` run's newest tree is built as it exits.
|
|
236
|
+
|
|
237
|
+
The full guide for agent platforms (setup, output parsing, memory tools, tree links, older versions) is [docs/headless.md](docs/headless.md).
|
|
166
238
|
|
|
167
239
|
## How it works
|
|
168
240
|
|
|
@@ -173,7 +245,7 @@ Interactive `ccc` sessions also get a small MCP server, `memtree`, with four rea
|
|
|
173
245
|
|
|
174
246
|
When you send a message, we retrieve relevant details and summaries from the prior messages in your thread. These details and summaries populate a **memory message**. Following the memory message, we append a compressed version of your recent message history. The resulting context-window is dramatically smaller, allowing Claude to process your request with much greater efficacy, lower latency, and reduced cost.
|
|
175
247
|
|
|
176
|
-
**Compaction keeps a stable prefix.** While a conversation fits the model's budget (
|
|
248
|
+
**Compaction keeps a stable prefix.** While a conversation fits the model's budget (900k tokens for Opus 5.5, where plain Claude Code would auto-compact at 967k), it is sent whole. When a request reaches the budget, `ccc` compresses it once, to half the budget (or your `/memtree-compact N`), and keeps those compressed bytes as the session's prefix. Every later request, human turns included, is that same prefix followed by the messages that came after it, verbatim, with no compression call (MemTree still indexes in the background). Because the prefix does not change, Anthropic reads it from the prompt cache on every turn after the one that compacted, instead of writing the whole compressed context again. `ccc` compresses again only when prefix plus newer turns reach the budget (measured from the size Anthropic reported for the previous request, plus an estimate for what was added), or when the messages the prefix stands for change (rewind, edit, fork, `/clear`). If that recompression fails, the turn is sent on the old prefix rather than the whole history. The prefix is also kept on disk, one file per session under `~/.claude-code-infinite/stable-prefixes/` (mode 600 in a private directory, at most 64 sessions and 256 MB, oldest dropped first), so the first turn after `ccc --resume` rides it instead of waiting on a fresh compression. A stored prefix belongs to the MemTree backend and key that wrote it (identified by a hash, never the key itself) and is never used with another. It is used only if the resumed history still matches what it replaced; a main-thread history that no longer matches discards it, while side requests (such as Claude Code's web-search helper) leave it alone. Only the main thread's prefix is stored, never a subagent's. The budget is the one MemTree reports for the model; until the server reports one, `ccc` uses 90% of the context window on Opus 5.5, Opus 5, Opus 4.8 and Fable 5 and 5.1 with a 1M window, and 80% otherwise. `CCC_BUDGET_TOKENS=60k` overrides it for testing. Every `requests.jsonl` line carries the `pid` of the `ccc` process that wrote it, which tells apart concurrent sessions sharing the log. The same rule holds inside a tool loop, so a long single turn (a headless `-p` run, or a long agentic loop) is compacted as it grows rather than only when you next type: each tool request under the budget goes out with no compression call, the one that reaches it is compressed once and becomes the stable prefix, and later tool requests and your next message ride that prefix until it reaches the budget again. `requests.jsonl` shows the `compaction` of each main-thread human turn and of every tool turn (budget, its source, the size estimate, and the reason for a compaction: `budget`, `prefix-mismatch`, `manual` or `target-change`); a human turn sent on the stable prefix is `turnType: "followup-prefix"`, a tool turn `tool-memory` (on its route) or `tool-prefix` (on the prefix directly), and a tool turn that compacted `tool-recompressed`.
|
|
177
249
|
|
|
178
250
|
That compressed context stays in force for the rest of the turn: the tool loop it kicks off, and the matching Count Tokens calls, are routed through the same compressed prefix. The Count Tokens part matters — Claude Code sizes its context from those replies, so counting the uncompressed history would make it auto-compact a conversation memory had already shrunk. A mismatched or resumed conversation shape drops the route rather than grafting one session's prefix onto another.
|
|
179
251
|
|
|
@@ -258,27 +330,40 @@ For `ccc --resume <id>`, an automatic, best-effort repair can unblock a transcri
|
|
|
258
330
|
|
|
259
331
|
## Releasing
|
|
260
332
|
|
|
261
|
-
Releases are
|
|
262
|
-
token, passkey or
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
`
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
`
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
333
|
+
Releases are published by GitHub Actions through npm Trusted Publishing (OIDC): no npm
|
|
334
|
+
token, passkey or staging step. Each one waits for approval of the `npm` GitHub environment
|
|
335
|
+
(reviewer: crizCraig). That approval is a GitHub permission: anything holding a maintainer's
|
|
336
|
+
GitHub token with `repo` scope (including an agent using `gh`) can grant it, so keep such
|
|
337
|
+
tokens out of untrusted sessions.
|
|
338
|
+
|
|
339
|
+
1. [release-please](https://github.com/googleapis/release-please) keeps a **Release x.y.z**
|
|
340
|
+
pull request open on `main` ([`.github/workflows/release.yml`](.github/workflows/release.yml)).
|
|
341
|
+
It bumps `package.json`, `package-lock.json` and `.release-please-manifest.json` and adds
|
|
342
|
+
a `CHANGELOG.md` entry, and it updates itself on every push to `main`.
|
|
343
|
+
2. Merge it when you want to release. release-please then tags `vX.Y.Z`, creates the GitHub
|
|
344
|
+
release and starts [`.github/workflows/publish.yml`](.github/workflows/publish.yml) on the
|
|
345
|
+
tag. That checks that the tagged commit is on `main` and that the tag equals
|
|
346
|
+
`package.json`'s version, runs the full CI matrix (`ci.yml`), and checks that the committed
|
|
347
|
+
`dist/` matches a fresh build.
|
|
348
|
+
3. Approve the `npm` environment (one tap in the GitHub mobile app, or **Review deployments**
|
|
349
|
+
on the run). The job then runs `npm publish --provenance --access public`.
|
|
350
|
+
|
|
351
|
+
Commits: release-please only opens the PR, and only lists a commit in the changelog, for
|
|
352
|
+
conventional prefixes: `feat:`, `fix:`, `perf:`, `refactor:`, `revert:` or `deps:` (a scope
|
|
353
|
+
is fine, e.g. `fix(exit): ...`). Other subjects such as `Exit: ...` or `README: ...` are
|
|
354
|
+
allowed and ship in the release, but are not listed. Every release is a patch bump. For a
|
|
355
|
+
minor or major release, or to release with no listed commit, push an empty commit:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
git commit --allow-empty -m "chore: release 1.1.0" -m "Release-As: 1.1.0"
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
The trusted publisher on npmjs.com is bound to the workflow file `publish.yml` and the GitHub
|
|
362
|
+
environment `npm`; renaming either breaks publishing. `./publish.sh --local [patch|minor|major]`
|
|
363
|
+
is the emergency path: from a `main` that matches `origin/main`, it publishes directly from
|
|
364
|
+
your machine with npm web auth, then pushes the release commit (including the release-please
|
|
365
|
+
manifest) and the tag in one atomic push, and creates the GitHub release.
|
|
366
|
+
publish.yml still tests that tag but skips publishing, since the version is already on npm.
|
|
282
367
|
|
|
283
368
|
## Troubleshooting
|
|
284
369
|
|
package/dist/claude-env.d.ts
CHANGED
|
@@ -17,9 +17,22 @@
|
|
|
17
17
|
* DISABLE_AUTO_COMPACT. Suppress that ccc-inappropriate recommendation with an
|
|
18
18
|
* effectively unreachable finite threshold; manual `/compact` remains available.
|
|
19
19
|
*
|
|
20
|
+
* With auto-compaction off, Claude Code still refuses a request itself once
|
|
21
|
+
* its own estimate (last reported usage plus the new messages) reaches the
|
|
22
|
+
* window minus 23k (977k on a 1M window; 2.1.302, measured) and never sends
|
|
23
|
+
* it: "Prompt is too long", and every later message is refused the same way.
|
|
24
|
+
* MemTree compresses at a budget near the window (900k), so one large tool
|
|
25
|
+
* round could otherwise strand a session there before ccc sees the request.
|
|
26
|
+
* CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE lifts that refusal: the request reaches
|
|
27
|
+
* the proxy, which compresses it mid-turn or, failing that, refuses it with
|
|
28
|
+
* its own bounded retry/400. A value the user already exported is kept.
|
|
29
|
+
*
|
|
20
30
|
* `CCC_AUTO_COMPACT=1` is an escape hatch: remove ccc's override and let the
|
|
21
|
-
* user's native Claude Code setting decide whether auto-compaction is enabled
|
|
31
|
+
* user's native Claude Code setting decide whether auto-compaction is enabled
|
|
32
|
+
* (Claude Code's own limits then apply unchanged).
|
|
22
33
|
*/
|
|
34
|
+
/** Claude Code's local refusal limit under ccc: effectively never reached. */
|
|
35
|
+
export declare const UNREACHABLE_BLOCKING_LIMIT = "1000000000";
|
|
23
36
|
export declare function claudeChildEnv(parentEnv: NodeJS.ProcessEnv, anthropicBaseUrl: string): NodeJS.ProcessEnv;
|
|
24
37
|
/**
|
|
25
38
|
* Keep the proxy's MemTree budget in lockstep with Claude Code's own context
|
package/dist/claude-env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-env.d.ts","sourceRoot":"","sources":["../src/claude-env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claude-env.d.ts","sourceRoot":"","sources":["../src/claude-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,CAAC,UAAU,EAC5B,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAAC,UAAU,CAuBnB;AAOD;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,MAAM,CAAC,UAAU,GAC3B,OAAO,CAET"}
|
package/dist/claude-env.js
CHANGED
|
@@ -17,9 +17,22 @@
|
|
|
17
17
|
* DISABLE_AUTO_COMPACT. Suppress that ccc-inappropriate recommendation with an
|
|
18
18
|
* effectively unreachable finite threshold; manual `/compact` remains available.
|
|
19
19
|
*
|
|
20
|
+
* With auto-compaction off, Claude Code still refuses a request itself once
|
|
21
|
+
* its own estimate (last reported usage plus the new messages) reaches the
|
|
22
|
+
* window minus 23k (977k on a 1M window; 2.1.302, measured) and never sends
|
|
23
|
+
* it: "Prompt is too long", and every later message is refused the same way.
|
|
24
|
+
* MemTree compresses at a budget near the window (900k), so one large tool
|
|
25
|
+
* round could otherwise strand a session there before ccc sees the request.
|
|
26
|
+
* CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE lifts that refusal: the request reaches
|
|
27
|
+
* the proxy, which compresses it mid-turn or, failing that, refuses it with
|
|
28
|
+
* its own bounded retry/400. A value the user already exported is kept.
|
|
29
|
+
*
|
|
20
30
|
* `CCC_AUTO_COMPACT=1` is an escape hatch: remove ccc's override and let the
|
|
21
|
-
* user's native Claude Code setting decide whether auto-compaction is enabled
|
|
31
|
+
* user's native Claude Code setting decide whether auto-compaction is enabled
|
|
32
|
+
* (Claude Code's own limits then apply unchanged).
|
|
22
33
|
*/
|
|
34
|
+
/** Claude Code's local refusal limit under ccc: effectively never reached. */
|
|
35
|
+
export const UNREACHABLE_BLOCKING_LIMIT = "1000000000";
|
|
23
36
|
export function claudeChildEnv(parentEnv, anthropicBaseUrl) {
|
|
24
37
|
const childEnv = {
|
|
25
38
|
...parentEnv,
|
|
@@ -36,6 +49,9 @@ export function claudeChildEnv(parentEnv, anthropicBaseUrl) {
|
|
|
36
49
|
}
|
|
37
50
|
else {
|
|
38
51
|
childEnv.DISABLE_AUTO_COMPACT = "1";
|
|
52
|
+
if (!childEnv.CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE) {
|
|
53
|
+
childEnv.CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE = UNREACHABLE_BLOCKING_LIMIT;
|
|
54
|
+
}
|
|
39
55
|
}
|
|
40
56
|
return childEnv;
|
|
41
57
|
}
|
package/dist/claude-env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-env.js","sourceRoot":"","sources":["../src/claude-env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claude-env.js","sourceRoot":"","sources":["../src/claude-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEvD,MAAM,UAAU,cAAc,CAC5B,SAA4B,EAC5B,gBAAwB;IAExB,MAAM,QAAQ,GAAsB;QAClC,GAAG,SAAS;QACZ,kBAAkB,EAAE,gBAAgB;QACpC,wCAAwC,EAAE,GAAG;QAC7C,kCAAkC,EAAE,YAAY;KACjD,CAAC;IAEF,gEAAgE;IAChE,OAAO,QAAQ,CAAC,gBAAgB,CAAC;IAEjC,IAAI,SAAS,CAAC,gBAAgB,KAAK,GAAG,EAAE,CAAC;QACvC,oEAAoE;QACpE,iCAAiC;QACjC,OAAO,QAAQ,CAAC,oBAAoB,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,QAAQ,CAAC,oBAAoB,GAAG,GAAG,CAAC;QACpC,IAAI,CAAC,QAAQ,CAAC,mCAAmC,EAAE,CAAC;YAClD,QAAQ,CAAC,mCAAmC,GAAG,0BAA0B,CAAC;QAC5E,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,cAAc,CAAC,KAAyB;IAC/C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACzE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAClD,SAA4B;IAE5B,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/cli-args.d.ts
CHANGED
|
@@ -5,6 +5,20 @@ export interface WrapperArgs {
|
|
|
5
5
|
}
|
|
6
6
|
/** Whether Claude's own print mode was requested before its `--` separator. */
|
|
7
7
|
export declare function isPrintInvocation(args: string[]): boolean;
|
|
8
|
+
/** ccc's own subcommands, which start no Claude session. */
|
|
9
|
+
declare const SUBCOMMANDS: readonly ["fetch", "memtree-mcp", "link"];
|
|
10
|
+
export type CccEnvironment = "production" | "staging" | "local";
|
|
11
|
+
/** The environment a leading `local`/`staging` word selects (else production). */
|
|
12
|
+
export declare function environmentOf(args: readonly string[]): CccEnvironment;
|
|
13
|
+
/**
|
|
14
|
+
* A ccc subcommand and its arguments: the first word, or the word after
|
|
15
|
+
* `local`/`staging` (`ccc staging memtree-mcp` is the same server as
|
|
16
|
+
* `ccc memtree-mcp`; the environment is the proxy's, from its base URL).
|
|
17
|
+
*/
|
|
18
|
+
export declare function subcommandArgs(args: readonly string[]): {
|
|
19
|
+
name: (typeof SUBCOMMANDS)[number];
|
|
20
|
+
args: string[];
|
|
21
|
+
} | undefined;
|
|
8
22
|
/**
|
|
9
23
|
* Consume ccc's own flags only before the conventional `--` separator. Values
|
|
10
24
|
* after it are literal Claude arguments/prompts, even when they look like ccc
|
|
@@ -29,4 +43,5 @@ export declare function compactTargetFromEnv(raw: string | undefined, parseToken
|
|
|
29
43
|
value: number | null | undefined;
|
|
30
44
|
warning?: string;
|
|
31
45
|
};
|
|
46
|
+
export {};
|
|
32
47
|
//# sourceMappingURL=cli-args.d.ts.map
|
package/dist/cli-args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAMzD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,CAmB5D;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;AACnF,eAAO,MAAM,uBAAuB,EAAE,SAAS,oBAAoB,EAMlE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,oBAAoB,GAAG,SAAS,CAKlC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EACjD,SAAS,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAWxD"}
|
|
1
|
+
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,WA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@@ -8,6 +8,23 @@ export function isPrintInvocation(args) {
|
|
|
8
8
|
}
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
|
+
/** ccc's own subcommands, which start no Claude session. */
|
|
12
|
+
const SUBCOMMANDS = ["fetch", "memtree-mcp", "link"];
|
|
13
|
+
const ENVIRONMENT_WORDS = ["local", "staging"];
|
|
14
|
+
/** The environment a leading `local`/`staging` word selects (else production). */
|
|
15
|
+
export function environmentOf(args) {
|
|
16
|
+
return args[0] === "local" ? "local" : args[0] === "staging" ? "staging" : "production";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A ccc subcommand and its arguments: the first word, or the word after
|
|
20
|
+
* `local`/`staging` (`ccc staging memtree-mcp` is the same server as
|
|
21
|
+
* `ccc memtree-mcp`; the environment is the proxy's, from its base URL).
|
|
22
|
+
*/
|
|
23
|
+
export function subcommandArgs(args) {
|
|
24
|
+
const start = ENVIRONMENT_WORDS.includes(args[0] ?? "") ? 1 : 0;
|
|
25
|
+
const name = SUBCOMMANDS.find((command) => command === args[start]);
|
|
26
|
+
return name ? { name, args: args.slice(start + 1) } : undefined;
|
|
27
|
+
}
|
|
11
28
|
/**
|
|
12
29
|
* Consume ccc's own flags only before the conventional `--` separator. Values
|
|
13
30
|
* after it are literal Claude arguments/prompts, even when they look like ccc
|
package/dist/cli-args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAMA,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAC/B,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;IACrD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;G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QAC9E,CAAC,CAAE,UAAmC;QACtC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAuB,EACvB,WAAiD,EACjD,SAAiB;IAEjB,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACrD,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACtD,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,GAAG,SAAS,EAAE,CAAC;QAC/C,OAAO;YACL,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,oCAAoC,GAAG,2CAA2C,SAAS,GAAG,IAAI,IAAI;SAChH,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/cli-lifecycle.d.ts
CHANGED
|
@@ -14,4 +14,8 @@ export interface SignalShutdownActions {
|
|
|
14
14
|
* Dependencies are injected so this policy can be tested without process.exit.
|
|
15
15
|
*/
|
|
16
16
|
export declare function createSignalShutdownHandler(actions: SignalShutdownActions): (signal: ShutdownSignal) => void;
|
|
17
|
+
/** Resolves once `text` is handed to the OS (or the write fails); never rejects. */
|
|
18
|
+
export declare function writeStdout(text: string, stream?: Pick<NodeJS.WriteStream, "write">): Promise<void>;
|
|
19
|
+
/** Waits for `pending` at most `ms`; a bound for cleanup that must not hang exit. */
|
|
20
|
+
export declare function settleWithin(pending: Promise<unknown>, ms: number): Promise<void>;
|
|
17
21
|
//# sourceMappingURL=cli-lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-lifecycle.d.ts","sourceRoot":"","sources":["../src/c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gB,2BAA2B,CACzC,OAAO,EAAE,qBAAqB,GAC7B,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CASlC;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAkB,GACzD,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjF"}
|
package/dist/cli-lifecycle.js
CHANGED
|
@@ -27,4 +27,22 @@ export function createSignalShutdownHandler(actions) {
|
|
|
27
27
|
actions.forceExit(code);
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
/** Resolves once `text` is handed to the OS (or the write fails); never rejects. */
|
|
31
|
+
export function writeStdout(text, stream = process.stdout) {
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
try {
|
|
34
|
+
stream.write(text, () => resolve());
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
resolve();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** Waits for `pending` at most `ms`; a bound for cleanup that must not hang exit. */
|
|
42
|
+
export function settleWithin(pending, ms) {
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
const timer = setTimeout(resolve, ms);
|
|
45
|
+
pending.then(() => { clearTimeout(timer); resolve(); }, () => { clearTimeout(timer); resolve(); });
|
|
46
|
+
});
|
|
47
|
+
}
|
|
30
48
|
//# sourceMappingURL=cli-lifecycle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-lifecycle.js","sourceRoot":"","sources":["../src/cli-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AAInD,4EAA4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