@compaction/cli 0.1.1 → 0.1.2
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 +138 -273
- package/dist/cli/index.js +24 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,332 +1,197 @@
|
|
|
1
1
|
# @compaction/cli
|
|
2
2
|
|
|
3
|
-
**The free, local-first CLI for capturing and measuring AI agent traces.** It
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- **Show input/output tokens and estimated spend.** `analyze` and the local report
|
|
25
|
-
show input/output token counts and a per-run **estimated** cost. Token counts are
|
|
26
|
-
**provider-reported** only when the captured run carries provider usage metadata;
|
|
27
|
-
otherwise they are a **local estimate (chars/4)**. Cost is a **price-table
|
|
28
|
-
estimate** labeled `local estimate` / `token-estimated cost` — **never
|
|
3
|
+
**The free, local-first CLI for capturing and measuring AI agent traces.** It captures
|
|
4
|
+
supported agent sessions on your own machine, shows input/output tokens and estimated spend
|
|
5
|
+
with honest labels, and writes local reports and redacted share bundles. Everything runs
|
|
6
|
+
locally and writes local files only — **no account, no telemetry, no upload by default.**
|
|
7
|
+
|
|
8
|
+
> **The free CLI captures, measures, inspects, reports, and redacts.** Optimization, advanced
|
|
9
|
+
> verification, apply guidance, policies, and team reporting are **not** in the free CLI — they
|
|
10
|
+
> are the **opt-in Compaction API**, which is **not a live hosted service yet**.
|
|
11
|
+
|
|
12
|
+
## What the CLI does
|
|
13
|
+
|
|
14
|
+
Everything below runs on your machine and writes local files only:
|
|
15
|
+
|
|
16
|
+
- **Capture supported agent sessions.** Claude Code is the primary supported workflow
|
|
17
|
+
(`capture claude-code`); OpenAI Agents SDK (`capture openai-agents`) and Codex / local-file
|
|
18
|
+
traces (`import`) are also supported. These are local capture/import integrations — **not**
|
|
19
|
+
native SDK instrumentation.
|
|
20
|
+
- **Show input/output tokens and estimated spend.** `analyze` shows input/output token counts
|
|
21
|
+
and a per-run **estimated** cost. Token counts are **provider-reported** only when the captured
|
|
22
|
+
run carries provider usage metadata; otherwise they are a **local estimate (chars/4)**. Cost is
|
|
23
|
+
a **price-table estimate** labeled `local estimate` / `token-estimated cost` — **never
|
|
29
24
|
billing-confirmed**.
|
|
30
|
-
- **
|
|
31
|
-
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
labels.
|
|
25
|
+
- **Inspect spend and roll up runs.** `spend`, `summary`, and `aggregate` summarize where context
|
|
26
|
+
spend came from and roll up local runs — local files only, no hosted dashboard.
|
|
27
|
+
- **Write local reports.** `analyze` writes local JSON + Markdown reports under an
|
|
28
|
+
operator-chosen output directory. Local files only.
|
|
29
|
+
- **Create redacted, content-free share bundles.** `feedback --redact` writes a redacted,
|
|
30
|
+
privacy-safe bundle as a **local file only — never uploaded**, and only with an explicit write
|
|
31
|
+
gesture (`--yes`).
|
|
32
|
+
- **No upload by default.** There is **no telemetry**. The **only** network call in the free CLI
|
|
33
|
+
is the explicitly operator-invoked, read-only `capture provider-usage` (credential supplied via
|
|
34
|
+
an environment variable only; aggregate usage/cost figures only, no prompt/completion content).
|
|
35
|
+
|
|
36
|
+
The free CLI deliberately answers the first-value question — *"where is my context being wasted,
|
|
37
|
+
and roughly what does it cost?"* — entirely locally, with honest labels.
|
|
43
38
|
|
|
44
39
|
## What requires the Compaction API (opt-in — not in the free CLI)
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
Compaction API**:
|
|
41
|
+
These are **not** part of the free local CLI:
|
|
48
42
|
|
|
49
43
|
- **Optimization** — producing a compacted context from a captured trace.
|
|
50
44
|
- **Advanced verification** — stronger checks on what a compacted context retains.
|
|
51
|
-
- **Apply guidance** — a readiness verdict and a review/approval path before any
|
|
52
|
-
|
|
53
|
-
- **Team reporting** — cross-run / cross-session reporting when enabled.
|
|
54
|
-
|
|
55
|
-
> **The Compaction API is not broadly hosted yet.** There is **no live hosted
|
|
56
|
-
> service today**. The API path is **designed to** optimize and verify **when you
|
|
57
|
-
> opt in** — this README does **not** claim those run as a live service. Until the
|
|
58
|
-
> API is available, these capabilities are **on the roadmap / opt-in**, not present
|
|
59
|
-
> in the free CLI.
|
|
60
|
-
|
|
61
|
-
When the API is available, the honesty rails carry over unchanged: cost stays an
|
|
62
|
-
**estimate** unless billing-confirmed (no figure carries that label today);
|
|
63
|
-
verification is **deterministic recoverability, NOT semantic/meaning preservation**;
|
|
64
|
-
integration stays **Level 1/2**; and there is **no auto-apply** — every application
|
|
65
|
-
is an explicit operator gesture.
|
|
66
|
-
|
|
67
|
-
## The free local loop (recommended first run: your OWN workflow)
|
|
68
|
-
|
|
69
|
-
**capture → analyze / measure → (local report) → redact / share**
|
|
70
|
-
|
|
71
|
-
The recommended first run is on **your own** captured/imported workflow — **not a
|
|
72
|
-
demo**. Synthetic/demo traces exist only as illustration; they are never the
|
|
73
|
-
recommended first value.
|
|
74
|
-
|
|
75
|
-
1. **Capture** a real workflow trace. **Claude Code is the primary supported
|
|
76
|
-
workflow** (`capture claude-code --session <path>`, Level 2 command-wrapper).
|
|
77
|
-
Also supported: OpenAI Agents SDK (`capture openai-agents`, Level 2) and Codex
|
|
78
|
-
local-file import (`import`, Level 1).
|
|
79
|
-
2. **Analyze / measure** input/output tokens and estimated spend, and see where the
|
|
80
|
-
spend came from (`analyze`).
|
|
81
|
-
3. **Local report** — read the local JSON / Markdown report written under your
|
|
82
|
-
chosen output directory.
|
|
83
|
-
4. **Redact / share** — `feedback --redact` writes a redacted, content-free bundle
|
|
84
|
-
you can hand a teammate or founder. Local file only, never uploaded.
|
|
85
|
-
|
|
86
|
-
> **Optimization, advanced verification, apply guidance, and team reporting** are
|
|
87
|
-
> the **opt-in Compaction API**, not steps of the free local CLI (see the section
|
|
88
|
-
> above).
|
|
45
|
+
- **Apply guidance** — a readiness verdict and a review/approval path before any context is applied.
|
|
46
|
+
- **Policies & team reporting** — configurable behavior controls and cross-run / team reporting.
|
|
89
47
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
| **local estimate** | chars/4 token heuristics and price-table cost approximations computed locally |
|
|
97
|
-
| **provider-reported token delta** | token counts read from the provider's own API response/usage metadata (operator-entered or captured); input tokens are deterministic for a fixed context+prompt |
|
|
98
|
-
| **token-estimated cost** | a price-table estimate applied to provider-reported token counts (`price_table_estimate`) — an estimate, never a billed figure |
|
|
99
|
-
| **operator-entered billing record** | billed costs the operator read from their own provider console; recorded, not provider-verified by this tool |
|
|
100
|
-
| **billing-confirmed** | only with real provider billing/invoice evidence **AND** the accepted measurement criterion met on those billed runs (N ≥ 3 runs per arm AND the delta-of-means ±2·SE interval excludes zero) — the statistical criterion alone is a bar on operator-entered figures, not proof of billing, so it is never sufficient by itself — **no figure in this repository currently carries this label** |
|
|
101
|
-
|
|
102
|
-
**What is NOT claimed:** no billing-confirmed savings claim; no invoice savings claim; no general savings claim (all results are workflow-scoped and caveated); no auto-apply (every application is an explicit operator gesture); no hosted service or control plane (the free CLI is local-first, file-based); no universal "no context is lost" claim; no semantic/meaning preservation claim (it stays `not_evaluated`); no native/production/Level 3 integration claim.
|
|
48
|
+
> **The Compaction API is not broadly hosted yet.** There is **no live hosted service today**.
|
|
49
|
+
> Until the API is available, these capabilities are **on the roadmap / opt-in**, not present in
|
|
50
|
+
> the free CLI. The honesty rails carry over unchanged: cost stays an **estimate** unless
|
|
51
|
+
> billing-confirmed (no figure carries that label today); verification is **deterministic
|
|
52
|
+
> recoverability, NOT semantic/meaning preservation**; and there is **no auto-apply** — every
|
|
53
|
+
> application is an explicit operator gesture.
|
|
103
54
|
|
|
104
55
|
## Install
|
|
105
56
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
`capture provider-usage`, and only when the operator supplies a credential via
|
|
109
|
-
an environment variable. There is no telemetry.
|
|
110
|
-
|
|
111
|
-
### npm / npx — LIVE NOW (`@compaction/cli@0.1.1` is published)
|
|
57
|
+
A local-first CLI. It makes no network calls by default; the only command that reaches the
|
|
58
|
+
network is the explicitly operator-invoked `capture provider-usage`. There is no telemetry.
|
|
112
59
|
|
|
113
|
-
|
|
114
|
-
or run it with no global install via `npx`:
|
|
60
|
+
### npm / npx
|
|
115
61
|
|
|
116
62
|
```bash
|
|
117
|
-
# Published and live now (v0.1.1):
|
|
118
63
|
npm install -g @compaction/cli # then: compaction init
|
|
119
64
|
npx @compaction/cli init # no global install
|
|
120
65
|
npx @compaction/cli --help # no install at all
|
|
121
66
|
```
|
|
122
67
|
|
|
123
68
|
The installed binary is `compaction`. After a global install, sanity-check with
|
|
124
|
-
`compaction --version` (→ `0.1.
|
|
69
|
+
`compaction --version` (→ `0.1.2`) and `compaction --help`.
|
|
125
70
|
|
|
126
|
-
### curl one-liner
|
|
71
|
+
### curl one-liner
|
|
127
72
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
73
|
+
The hosted installer at `https://cli.compaction.dev/install` is served as `text/plain` and its
|
|
74
|
+
only network call is the `npm install` of the published package. It uses **no `sudo` by default**
|
|
75
|
+
(installs into a user-writable prefix), collects **no telemetry**, supports macOS + Linux, and
|
|
76
|
+
**fails clearly** rather than faking success. Read it first, then run it:
|
|
131
77
|
|
|
132
78
|
```bash
|
|
133
|
-
#
|
|
134
|
-
# Inspect it first (recommended): pipe to `less`, or download and read, before sh.
|
|
79
|
+
# Inspect it first (recommended):
|
|
135
80
|
curl -fsSL https://cli.compaction.dev/install | less
|
|
136
|
-
#
|
|
81
|
+
# Install:
|
|
137
82
|
curl -fsSL https://cli.compaction.dev/install | sh
|
|
83
|
+
# Or preview exactly what it would do without installing anything:
|
|
84
|
+
curl -fsSL https://cli.compaction.dev/install | sh -s -- --dry-run
|
|
138
85
|
```
|
|
139
86
|
|
|
140
|
-
|
|
141
|
-
and readable now: it uses **no `sudo` by default** (installs into a user-writable
|
|
142
|
-
prefix), makes **no network call except the npm install** of the published package
|
|
143
|
-
(no telemetry), supports macOS + Linux, and **fails clearly** rather than faking
|
|
144
|
-
success. Preview exactly what it would do without installing anything:
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
sh scripts/install.sh --dry-run
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
See [`docs/ops/install-readiness.md`](docs/ops/install-readiness.md) for the full
|
|
151
|
-
install-readiness contract (hosting, package name, version pinning, platforms) and
|
|
152
|
-
[`docs/ops/cli-install-domain-readiness.md`](docs/ops/cli-install-domain-readiness.md)
|
|
153
|
-
for the curl-route deploy/DNS execution record.
|
|
154
|
-
|
|
155
|
-
This repository is licensed under **AGPL-3.0-only** (see [`LICENSE`](LICENSE)). The
|
|
156
|
-
npm **package name is `@compaction/cli`** (scoped, public; the installed binary
|
|
157
|
-
stays `compaction`) and it is **published and live now** (v0.1.1). The **npm/npx and
|
|
158
|
-
curl install paths are all live.**
|
|
159
|
-
|
|
160
|
-
### From source — for contributors / local development
|
|
161
|
-
|
|
162
|
-
(For just running the tool, the **npm / npx** path above is now the simplest. Build
|
|
163
|
-
from source when you want to hack on the CLI itself.)
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
git clone <repo-url>
|
|
167
|
-
cd compaction-dev
|
|
168
|
-
npm ci
|
|
169
|
-
npm run build
|
|
170
|
-
# optional: expose the `compaction` binary on your PATH
|
|
171
|
-
npm link
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
For reproducible local validation, use `npm ci` (not `npm install`).
|
|
87
|
+
## Quick start
|
|
175
88
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
The package is on npm now (use the npm / npx path above for the normal case). This
|
|
179
|
-
packed-tarball path remains useful for an offline / air-gapped install or to verify
|
|
180
|
-
the exact published layout locally — a **fallback**, not the intended public path:
|
|
89
|
+
Run on **your own** captured/imported workflow — not a demo. The recommended free local loop is
|
|
90
|
+
**capture → analyze → (local report) → redact / share**:
|
|
181
91
|
|
|
182
92
|
```bash
|
|
183
|
-
|
|
184
|
-
|
|
93
|
+
compaction init # one-time local scaffold (writes nothing until you capture)
|
|
94
|
+
# 1. Capture a real workflow (Claude Code shown; --discover lists local sessions):
|
|
95
|
+
compaction capture claude-code --discover
|
|
96
|
+
compaction capture claude-code --session <session.jsonl> --out ./my-trace
|
|
97
|
+
# 2. Measure tokens + estimated spend, and see where it came from:
|
|
98
|
+
compaction analyze ./my-trace/captured-trace.json
|
|
99
|
+
compaction spend ./my-trace/captured-trace.json
|
|
100
|
+
# 3. Share a redacted, content-free bundle (local file only, never uploaded):
|
|
101
|
+
compaction feedback --redact --yes
|
|
185
102
|
```
|
|
186
103
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
`compaction --help`, `compaction init`, and a capture → compact step from the
|
|
190
|
-
installed binary. The packed tarball ships the local CLI, `README.md`, and
|
|
191
|
-
`LICENSE` only.
|
|
104
|
+
Optimization, verification, and apply guidance are the opt-in Compaction API — not steps of the
|
|
105
|
+
free local CLI.
|
|
192
106
|
|
|
193
|
-
|
|
107
|
+
## Supported local workflows
|
|
194
108
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
109
|
+
- **Claude Code** (`capture claude-code`) — captures a real Claude Code session JSONL (optionally
|
|
110
|
+
including subagent transcripts), preserving provider-reported token usage from the session's own
|
|
111
|
+
API response metadata. `--discover` scans the local projects directory read-only (no network).
|
|
112
|
+
**Integration Readiness Level 2** (local command-wrapper) — not native SDK instrumentation.
|
|
113
|
+
Captured traces may contain local file content — review before sharing.
|
|
114
|
+
- **OpenAI Agents SDK** (`capture openai-agents`) — runs a local command or reads a local JSONL
|
|
115
|
+
export of Agents-SDK trace/span events and normalizes them. **Level 2.** Distinguishes
|
|
116
|
+
provider-reported usage from local estimates; never invents token metadata.
|
|
117
|
+
- **Codex / local-file import** (`import`) — reads a local trace-like JSON/JSONL file (including a
|
|
118
|
+
`codex exec --json` export) and normalizes it. **Level 1.** Codex token counts on this path are
|
|
119
|
+
**locally estimated (chars/4)**, not provider-reported. `compaction import --list-sources` lists
|
|
120
|
+
supported sources.
|
|
198
121
|
|
|
199
|
-
|
|
122
|
+
There is **no** native/Level 3 SDK instrumentation, no production proxy, no model routing, and no
|
|
123
|
+
consumer-app (ChatGPT/Claude desktop) support.
|
|
200
124
|
|
|
201
|
-
|
|
125
|
+
## Commands
|
|
202
126
|
|
|
203
127
|
```bash
|
|
204
|
-
compaction init #
|
|
128
|
+
compaction init # one-time local scaffold
|
|
205
129
|
compaction capture claude-code --session <session.jsonl> [--include-subagents] --out <dir>
|
|
206
130
|
compaction capture claude-code --discover [--projects-dir <path>]
|
|
207
131
|
compaction capture openai-agents --out <dir> -- <command> [args...]
|
|
208
|
-
compaction capture openai-agents --out <dir> --export <local-jsonl-export>
|
|
209
132
|
compaction capture provider-usage --endpoint <url> [--credential-env-var <NAME>] [--out <dir>]
|
|
210
133
|
compaction import <trace-file> --source <source> --out <dir>
|
|
211
134
|
compaction import --list-sources
|
|
212
135
|
compaction analyze <trace-file>
|
|
213
|
-
compaction
|
|
136
|
+
compaction spend <trace-or-optimization-path> # context-spend attribution
|
|
137
|
+
compaction summary # roll up local run reports
|
|
138
|
+
compaction aggregate # per-session / cross-session local rollups
|
|
139
|
+
compaction feedback --redact [--yes] # redacted, local-only share bundle
|
|
214
140
|
```
|
|
215
141
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
Captures a real Claude Code session JSONL (optionally including subagent
|
|
219
|
-
transcripts) into the internal trace format, preserving provider-reported token
|
|
220
|
-
usage from the session's own API response metadata. `--discover` scans the local
|
|
221
|
-
Claude Code projects directory read-only and lists sessions with metadata (no
|
|
222
|
-
network, no upload). This is **Integration Readiness Level 2** (local
|
|
223
|
-
command-wrapper) — not Level 3 native SDK instrumentation. Captured traces may
|
|
224
|
-
contain local file content — review before sharing.
|
|
225
|
-
|
|
226
|
-
### `capture openai-agents` (Level 2 command-wrapper)
|
|
227
|
-
|
|
228
|
-
Runs a local command or reads a local JSONL export containing OpenAI Agents
|
|
229
|
-
SDK-style trace/span events, normalizes the supported events into the internal
|
|
230
|
-
trace format, and writes capture evidence locally. It distinguishes
|
|
231
|
-
provider-reported usage from local estimates: when supported events carry provider
|
|
232
|
-
token fields, those values are labeled provider-reported; when absent, token
|
|
233
|
-
metadata is marked `missing`/`unknown` and **never invented**. This is local
|
|
234
|
-
capture only (Level 2) — it does **not** scrape the ChatGPT app, use undocumented
|
|
235
|
-
APIs, upload traces, proxy provider/model calls, switch providers/models, or add a
|
|
236
|
-
dashboard/auth/billing.
|
|
237
|
-
|
|
238
|
-
### `capture provider-usage` (the only network call)
|
|
239
|
-
|
|
240
|
-
Explicitly operator-invoked, read-only read of aggregate usage/cost from a provider
|
|
241
|
-
usage API. The credential comes from an environment variable only (never a flag
|
|
242
|
-
value, never logged, never written into artifacts); absence is a clean refusal. It
|
|
243
|
-
captures aggregate token/cost figures only — no prompt/completion content. The
|
|
244
|
-
resulting record is classified as provider-usage evidence.
|
|
142
|
+
`compaction --help` lists the free local commands.
|
|
245
143
|
|
|
246
|
-
|
|
144
|
+
## Privacy and security
|
|
247
145
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
146
|
+
- **No telemetry; no upload by default.** The free CLI is local-first and file-based.
|
|
147
|
+
- **One network call only.** `capture provider-usage` is explicitly operator-invoked and read-only;
|
|
148
|
+
its credential comes from an **environment variable only** (never a flag value, never logged,
|
|
149
|
+
never written into artifacts), and it captures **aggregate** usage/cost figures only — no
|
|
150
|
+
prompt/completion content. Its absence is a clean refusal.
|
|
151
|
+
- **Captured traces can contain local content.** Capturing a session may include local file
|
|
152
|
+
content — review a trace before sharing it.
|
|
153
|
+
- **Redacted sharing.** `feedback --redact` produces a redacted, content-free bundle as a local
|
|
154
|
+
file; writing it requires an explicit `--yes` gesture. There is no upload path.
|
|
155
|
+
- **No sudo by default** in the installer; it installs into a user-writable prefix.
|
|
254
156
|
|
|
255
|
-
|
|
256
|
-
provider-reported. Live provider/runtime integrations (native Claude Code/Cursor
|
|
257
|
-
instrumentation, live Codex launching, hosted provider APIs) remain future work; the
|
|
258
|
-
Codex support here is intentionally local/export-file based only (Level 1).
|
|
259
|
-
|
|
260
|
-
### `analyze`
|
|
157
|
+
## Evidence levels and claims
|
|
261
158
|
|
|
262
|
-
|
|
263
|
-
an estimated local cost, conservative waste findings, and suggested
|
|
264
|
-
duplicate-output compaction opportunities (advisory only — the free CLI does **not**
|
|
265
|
-
apply them; optimization is the opt-in Compaction API).
|
|
159
|
+
Every figure this tool produces carries one of these labels — and nothing stronger:
|
|
266
160
|
|
|
267
|
-
|
|
161
|
+
| Label | Meaning |
|
|
162
|
+
|---|---|
|
|
163
|
+
| **local estimate** | chars/4 token heuristics and price-table cost approximations computed locally |
|
|
164
|
+
| **provider-reported token delta** | token counts read from the provider's own API response/usage metadata (operator-entered or captured); input tokens are deterministic for a fixed context+prompt |
|
|
165
|
+
| **token-estimated cost** | a price-table estimate applied to provider-reported token counts (`price_table_estimate`) — an estimate, never a billed figure |
|
|
166
|
+
| **operator-entered billing record** | billed costs the operator read from their own provider console; recorded, not provider-verified by this tool |
|
|
167
|
+
| **billing-confirmed** | only with real provider billing/invoice evidence **AND** the accepted measurement criterion met on those billed runs (N ≥ 3 runs per arm AND the delta-of-means ±2·SE interval excludes zero) — the statistical criterion alone is a bar on operator-entered figures, not proof of billing, so it is never sufficient by itself — **no figure in this repository currently carries this label** |
|
|
268
168
|
|
|
269
|
-
|
|
270
|
-
uploaded**. Redaction is best-effort and the bundle's own README states what is
|
|
271
|
-
included/excluded; writing the bundle requires an explicit write gesture
|
|
272
|
-
(`--yes`/`--confirm`). There is no upload path.
|
|
169
|
+
**What is NOT claimed:** no billing-confirmed savings claim; no invoice savings claim; no general savings claim (all results are workflow-scoped and caveated); no auto-apply (every application is an explicit operator gesture); no hosted service or control plane (the free CLI is local-first, file-based); no universal "no context is lost" claim; no semantic/meaning preservation claim (it stays `not_evaluated`); no native/production/Level 3 integration claim.
|
|
273
170
|
|
|
274
171
|
## Known limitations
|
|
275
172
|
|
|
276
|
-
- **The free CLI captures and measures; it does not optimize or verify.**
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
- **
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
the opt-in API is **fail-closed and scoped** to supported developer-agent
|
|
302
|
-
workflows — never a universal guarantee, and never a semantic/meaning claim.
|
|
303
|
-
|
|
304
|
-
## Product constraints
|
|
305
|
-
|
|
306
|
-
- CLI-first, not web-app-first. No web framework, no database, no auth or billing, no
|
|
307
|
-
streaming.
|
|
308
|
-
- No provider integrations in the free CLI except the explicitly operator-invoked,
|
|
309
|
-
read-only `capture provider-usage` (env-only credential; aggregate usage/cost only).
|
|
310
|
-
No proxying, no model routing, no live-call interception.
|
|
311
|
-
- No hosted service or control plane in the free CLI; no full observability dashboard.
|
|
312
|
-
|
|
313
|
-
**On the roadmap / opt-in API (NOT in the free CLI; reads as future/opt-in anywhere
|
|
314
|
-
public):** the Compaction API's optimization and advanced verification, apply
|
|
315
|
-
guidance, and team reporting; a hosted dashboard / control plane; native (Level 3)
|
|
316
|
-
SDK instrumentation; model routing / provider switching / live-call interception; an
|
|
317
|
-
IDE plugin; true model replay; semantic / meaning preservation (today not
|
|
318
|
-
evaluated); and billing-confirmed savings (no figure in this repository carries that
|
|
319
|
-
label). **The Compaction API is not broadly hosted yet** — never imply a live hosted
|
|
320
|
-
service exists.
|
|
321
|
-
|
|
322
|
-
## Contributing / internal docs
|
|
323
|
-
|
|
324
|
-
Repository development, the marketing/docs website (`apps/web`), and contributor
|
|
325
|
-
workflows live in the repo's internal documentation, **not** in this npm-facing
|
|
326
|
-
README:
|
|
327
|
-
|
|
328
|
-
- `AGENTS.md` — the agent operating contract.
|
|
329
|
-
- `ROADMAP.md` — canonical strategy and the long-term path.
|
|
330
|
-
- `docs/product/product-index.md` — the product-docs entry point (`mvp-plan.md`,
|
|
331
|
-
`decisions.md`).
|
|
332
|
-
- `docs/ops/install-readiness.md` — the install/publish readiness contract.
|
|
173
|
+
- **The free CLI captures and measures; it does not optimize or verify.** Optimization, advanced
|
|
174
|
+
verification, apply guidance, policies, and team reporting are the **opt-in Compaction API** —
|
|
175
|
+
not the free local CLI. The API is **not broadly hosted yet**.
|
|
176
|
+
- **Cost figures are estimates or operator-entered records, not billing-confirmed.** Locally
|
|
177
|
+
computed cost figures are price-table estimates; provider-usage records carry operator-entered/
|
|
178
|
+
captured console figures (not provider-verified by this tool). **No figure is billing-confirmed.**
|
|
179
|
+
- **Token counts are local estimates unless provider-reported usage is captured.** The default is a
|
|
180
|
+
chars/4 estimate, labeled as such. Unknown stays unknown — output tokens, provider, or cost the
|
|
181
|
+
data does not carry are never inferred.
|
|
182
|
+
- **Integrations are Level 1/2, not native/production.** Claude Code and OpenAI Agents capture are
|
|
183
|
+
Level 2 local command-wrappers; Codex/local-file import is Level 1. There is **no** native/Level 3
|
|
184
|
+
SDK instrumentation, no production proxy, no model routing, and no consumer-app support.
|
|
185
|
+
- **Verification (opt-in API) is deterministic recoverability, not semantic preservation.** Where
|
|
186
|
+
the opt-in API verifies a compacted context, it checks deterministic recoverability for a
|
|
187
|
+
supported workflow; it does **not** evaluate meaning or task equivalence and does **not** re-run
|
|
188
|
+
your agent through a model. Semantic / meaning preservation remains **not evaluated**; true model
|
|
189
|
+
replay is future work.
|
|
190
|
+
- **No universal "no context is lost" guarantee.** Any apply-guidance verdict from the opt-in API
|
|
191
|
+
is **fail-closed and scoped** to supported developer-agent workflows — never a universal
|
|
192
|
+
guarantee, and never a semantic/meaning claim.
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
[AGPL-3.0-only](LICENSE). The npm package name is `@compaction/cli` (scoped, public); the installed
|
|
197
|
+
binary is `compaction`.
|
package/dist/cli/index.js
CHANGED
|
@@ -27,7 +27,7 @@ const program = new Command();
|
|
|
27
27
|
program
|
|
28
28
|
.name("compaction")
|
|
29
29
|
.description("CLI-first trace compaction tools for AI agent workflows.")
|
|
30
|
-
.version("0.1.
|
|
30
|
+
.version("0.1.2");
|
|
31
31
|
registerAnalyzeCommand(program);
|
|
32
32
|
registerAdapterCommand(program);
|
|
33
33
|
registerAggregateCommand(program);
|
|
@@ -51,6 +51,29 @@ registerReviewCommand(program);
|
|
|
51
51
|
registerRunCommand(program);
|
|
52
52
|
registerSpendCommand(program);
|
|
53
53
|
registerSummaryCommand(program);
|
|
54
|
+
// Clean default `--help` surface (v0.1.2): show ONLY the free, local-first commands
|
|
55
|
+
// that work without the private engine / Compaction API. Everything else (engine-gated,
|
|
56
|
+
// API-adjacent, and internal/operator commands) is HIDDEN from the top-level command
|
|
57
|
+
// list — NOT removed. Hidden commands remain fully registered and invokable by name
|
|
58
|
+
// (e.g. `compaction compact …`), preserving backward compatibility; engine-gated ones
|
|
59
|
+
// still degrade gracefully with the sanctioned message when the engine is absent.
|
|
60
|
+
const PUBLIC_COMMANDS = new Set([
|
|
61
|
+
"init",
|
|
62
|
+
"capture",
|
|
63
|
+
"import",
|
|
64
|
+
"analyze",
|
|
65
|
+
"spend",
|
|
66
|
+
"summary",
|
|
67
|
+
"aggregate",
|
|
68
|
+
"feedback"
|
|
69
|
+
]);
|
|
70
|
+
for (const cmd of program.commands) {
|
|
71
|
+
if (cmd.name() === "help" || PUBLIC_COMMANDS.has(cmd.name()))
|
|
72
|
+
continue;
|
|
73
|
+
// commander hides a command from help via its internal `_hidden` flag; the command
|
|
74
|
+
// stays parseable/runnable. (No public setter exists for an already-created command.)
|
|
75
|
+
cmd._hidden = true;
|
|
76
|
+
}
|
|
54
77
|
program.parseAsync(process.argv).catch((error) => {
|
|
55
78
|
const message = error instanceof Error ? error.message : String(error);
|
|
56
79
|
console.error(message);
|