tokenjam 0.5.7 → 0.6.0

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.
Files changed (3) hide show
  1. package/README.md +6 -14
  2. package/bin/tj.js +16 -8
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -11,17 +11,15 @@
11
11
 
12
12
  </div>
13
13
 
14
- TokenJam ingests telemetry data about your agents from a multitude of sources and provides you a quick and easy way to visualize and optimize cost so that you get the most out of the tokens you pay for. This package is the zero-install launcher: one command, no pip environment, no config.
14
+ TokenJam ingests telemetry data about your agents from a multitude of sources and provides you a quick and easy way to visualize and optimize cost so that you get the most out of the tokens you pay for. This package is the zero-install launcher: no pip environment, no manual config.
15
15
 
16
16
  ```bash
17
- npx tokenjam
17
+ npx tokenjam onboard # or: pipx install tokenjam && tj onboard
18
18
  ```
19
19
 
20
20
  ## What you get
21
21
 
22
- Bare `npx tokenjam` reads the session logs you already have (Claude Code today; more sources land in the full CLI) and prints a 15-second, read-only report: quota composition (what share of your tokens went to re-reading history and context vs. net-new work) plus a session timeline. Nothing is installed, nothing is kept.
23
-
24
- For the full setup, run `npx tokenjam onboard`: it wires up live capture, all six analyzers, the Lens dashboard, and the zero-token statusline in one command.
22
+ `tj onboard` is guided setup: it writes a config, generates an ingest secret, and asks how you use AI agents (Claude Code, Codex, or your own SDK/API agents) to wire the right path. For Claude Code and Codex that means backfilling recent history and installing a statusline and hooks for live capture; restart and you're live. Onboarding unlocks all six analyzers, the Lens dashboard, and the zero-token statusline in one command.
25
23
 
26
24
  ## Commands
27
25
 
@@ -29,20 +27,14 @@ All arguments pass straight through to the Python CLI, so any `tj` subcommand an
29
27
 
30
28
  | Command | What it does |
31
29
  |---|---|
32
- | `npx tokenjam` | Zero-install first run: quota composition and a session timeline from your existing session logs. |
30
+ | `npx tokenjam onboard` | Guided setup: writes a config, generates an ingest secret, and optionally installs the background daemon for live capture. |
33
31
  | `npx tokenjam context` | Where your quota goes: re-read vs. net-new share, recurring inclusions, `/compact` candidates. |
34
32
  | `npx tokenjam optimize` | Cost-saving candidates: model downsizing, cache opportunities, prompt trimming, workflow reuse, subagent right-sizing. |
35
- | `npx tokenjam onboard` | Guided setup: writes a config, generates an ingest secret, and optionally installs the background daemon for live capture. |
33
+ | `npx tokenjam` | Bare run: still works, still zero-install, still a reference passthrough to the Python CLI. |
36
34
 
37
35
  ## Go deeper
38
36
 
39
- `npx tokenjam` is the no-setup front door. One command sets up live capture, the local Lens dashboard, and the zero-token statusline:
40
-
41
- ```bash
42
- npx tokenjam onboard # or: pipx install tokenjam && tj onboard
43
- ```
44
-
45
- `tj onboard` asks how you use AI agents (Claude Code, Codex, or your own SDK/API agents) and wires the right path. For Claude Code and Codex that means backfilling recent history plus a statusline and hooks; restart and you're live. From there:
37
+ `tj onboard` sets up live capture, the local Lens dashboard, and the zero-token statusline in one command. From there:
46
38
 
47
39
  ```bash
48
40
  tj optimize # cost-saving candidates from your actual usage
package/bin/tj.js CHANGED
@@ -7,8 +7,9 @@
7
7
  * `npx <tool>` first. `npx tokenjam` here resolves a Python launcher with NO pip env,
8
8
  * NO daemon, NO onboarding — it shells out to the Python CLI via the first
9
9
  * available runner and hands every argument straight through. Bare `npx tokenjam`
10
- * (no subcommand) routes to `tj quickstart`: where your Claude Code quota goes,
11
- * from the same ~/.claude/projects/*.jsonl files ccusage reads, in one command.
10
+ * (no subcommand) prints the zero-install report: where your Claude Code quota
11
+ * goes, from the same ~/.claude/projects/*.jsonl files ccusage reads, in one
12
+ * command.
12
13
  *
13
14
  * Runner preference (first that exists wins):
14
15
  * 1. `uvx --from tokenjam tj …` — fully ephemeral, downloads nothing global
@@ -112,13 +113,19 @@ function markRefreshed() {
112
113
  }
113
114
 
114
115
  function main() {
115
- // Bare `npx tokenjam` IS the zero-install first run — route it to
116
- // `tj quickstart` (the quota report the docs promise). The branded home
117
- // screen that bare LOCAL `tj` prints assumes an installed CLI and would
118
- // dead-end an npx user ("You're set up", suggesting commands they don't
119
- // have). Any explicit args pass through untouched.
116
+ // Bare `npx tokenjam` IS the zero-install first run — the quota report the
117
+ // docs promise. The branded home screen that bare LOCAL `tj` prints assumes
118
+ // an installed CLI and would dead-end an npx user ("You're set up",
119
+ // suggesting commands they don't have). Any explicit args pass through
120
+ // untouched; a bare invocation stays bare (no synthetic subcommand — there
121
+ // is no public/typeable command for this) and instead sets an env var that
122
+ // the Python CLI's own no-subcommand branch reads to pick the report over
123
+ // the home screen.
120
124
  const argv = process.argv.slice(2);
121
- const passthrough = argv.length ? argv : ["quickstart"];
125
+ const passthrough = argv;
126
+ const childEnv = argv.length
127
+ ? process.env
128
+ : { ...process.env, TJ_NPX_ZERO_INSTALL_REPORT: "1" };
122
129
 
123
130
  for (const { bin, prefix } of runners()) {
124
131
  if (!has(bin)) continue;
@@ -127,6 +134,7 @@ function main() {
127
134
  const args = doRefresh ? ["--refresh", ...prefix] : prefix;
128
135
  const result = spawnSync(bin, [...args, ...passthrough], {
129
136
  stdio: "inherit",
137
+ env: childEnv,
130
138
  });
131
139
  if (result.error) continue; // try the next runner on spawn failure
132
140
  if (doRefresh && result.status === 0) markRefreshed();
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tokenjam",
3
- "version": "0.5.7",
4
- "description": "Zero-install launcher for TokenJam (tj): npx tokenjam runs the Python CLI via uvx/pipx and prints where your AI agent's token quota actually goes, no setup required.",
3
+ "version": "0.6.0",
4
+ "description": "Zero-install launcher for TokenJam (tj): npx tokenjam runs the Python CLI via uvx/pipx and reports the recurring mistakes your AI agent keeps repeating, no setup required.",
5
5
  "keywords": [
6
6
  "claude-code",
7
7
  "ccusage",
8
8
  "tokens",
9
- "cost",
9
+ "cost-optimization",
10
10
  "llm",
11
11
  "agents",
12
12
  "observability",
@@ -14,7 +14,7 @@
14
14
  "anthropic",
15
15
  "claude",
16
16
  "token-usage",
17
- "cost-tracking",
17
+ "agent-behavior",
18
18
  "cli",
19
19
  "statusline",
20
20
  "opentelemetry",