token-furnace 0.1.6 → 0.1.8

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 CHANGED
@@ -3,9 +3,8 @@
3
3
  [![npm version](https://img.shields.io/npm/v/token-furnace)](https://www.npmjs.com/package/token-furnace)
4
4
  [![Node.js](https://img.shields.io/node/v/token-furnace)](https://www.npmjs.com/package/token-furnace)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
- [![npm downloads](https://img.shields.io/npm/dm/token-furnace)](https://www.npmjs.com/package/token-furnace)
7
6
 
8
- Where the token budget actually went. `token-furnace` reads your local Claude Code and Codex
7
+ Where the token budget actually went. `token-furnace` reads your local Claude Code, Codex and OpenCode
9
8
  transcripts, finds token leaks, and shows the result in your terminal, as JSON for agents, and in a
10
9
  local dashboard. Transcript data never leaves your machine.
11
10
 
@@ -19,7 +18,15 @@ Each card has a target. A red dot means the target is missed and a green dot mea
19
18
 
20
19
  ## Quick start
21
20
 
22
- Requires **Node.js 22.13 or newer** and local Claude Code or Codex transcripts.
21
+ Requires **Node.js 22.13 or newer** and local Claude Code, Codex or OpenCode transcripts.
22
+
23
+ The CLI and local dashboard use Node.js APIs on Linux, macOS and Windows. Setup and
24
+ configuration repair use the OS home directory when `HOME` is unset; custom agent directories
25
+ are respected. Windows setup uses directory junctions on NTFS. Use `setup --rollback` to restore
26
+ backups on any platform; the generated `restore.sh` additionally requires Bash.
27
+
28
+ Platform CI is configured to run the tests and installed-package smoke checks on Linux, Windows and macOS,
29
+ with Node 22.13 and 24. Live agent hooks and macOS Keychain access need separate verification.
23
30
 
24
31
  Run it without installing:
25
32
 
@@ -34,7 +41,7 @@ npx token-furnace@latest serve
34
41
  ```
35
42
 
36
43
  Visit **http://127.0.0.1:8765**. The first scan measures local usage; later scans reuse a metadata cache.
37
- Choose Claude Code or Codex independently for each chart, and pin a selection to remember it on reload.
44
+ Choose Claude Code, Codex or OpenCode independently for each chart, and pin a selection to remember it on reload.
38
45
 
39
46
  Export a report for scripts or sharing:
40
47
 
@@ -56,7 +63,7 @@ npm install -g token-furnace
56
63
 
57
64
  | Command | Result |
58
65
  |---|---|
59
- | `token-furnace [days] [--source claude\|codex]` | Ranked verdict on stdout. `days` defaults to 7. Exits 1 on leaks or no data. |
66
+ | `token-furnace [days] [--source claude\|codex\|opencode]` | Ranked verdict on stdout. `days` defaults to 7. Exits 1 on leaks or no data. |
60
67
  | `token-furnace --full` | Full text report. |
61
68
  | `token-furnace --json` | The `Report` JSON on stdout, for agents and scripts. Exits 0 even when leaks are present. |
62
69
  | `token-furnace --html <path>` | Writes a static HTML report with the report JSON inlined. It does not change the exit code. |
@@ -71,13 +78,28 @@ Options:
71
78
  - `--weekly-budget <M>` — weekly budget in millions of weighted tokens. `TOKEN_FURNACE_WEEKLY_BUDGET`
72
79
  sets the same value.
73
80
  - `--no-cache` — parse every file and write no cache.
74
- - `--no-plan-usage` — never call `api.anthropic.com`. A saved reading is still used.
81
+ - `--no-plan-usage` — never fetch Anthropic or OpenCode Go usage. A saved reading is still used.
75
82
  - `-h`, `--help` — usage text.
76
83
 
84
+ ## OpenCode
85
+
86
+ Current SQLite sessions are read from `$XDG_DATA_HOME/opencode/opencode.db` (default
87
+ `~/.local/share/opencode/opencode.db`). Set `OPENCODE_DATA_DIR` to override that directory.
88
+ The database is opened read-only, including live WAL updates. Legacy JSON session stores
89
+ are not supported. Assistant message usage counts once; step-finish usage is not added again.
90
+
91
+ OpenCode Go reads the local `auth.json` entry for `opencode-go` (or `OPENCODE_API_KEY`)
92
+ and fetches the real weekly utilization and reset from `https://opencode.ai/zen/go/v1/usage`.
93
+ The weekly dashboard uses that reading to calibrate local weighted tokens; burn projections
94
+ are estimates, not billed dollars. OpenCode sessions from other providers are included in
95
+ local totals; only `opencode-go` sessions calibrate the Go quota. The 5-hour and monthly meters
96
+ are not displayed. Unknown models keep the existing unpriced-model warning.
97
+ No OpenCode configuration is changed by Auto Fixes.
98
+
77
99
  ## Context targets
78
100
 
79
101
  The analysis targets context sizes of **Claude Code 400k** and
80
- **Codex 300k**. Checkup, session flags, dashboard KPIs, hourly spend charts, benchmark estimates,
102
+ **Codex 300k**, with a **128k OpenCode diagnostic target** (not a model context limit). Checkup, session flags, dashboard KPIs, hourly spend charts, benchmark estimates,
81
103
  and configuration repair all use these values. A turn exactly at its provider target is within
82
104
  target. Mixed-provider charts compare each turn against its own provider target.
83
105
 
@@ -124,9 +146,7 @@ injects an escalation prompt at the 4th, 7th, and 10th edit.
124
146
  - Transcript data stays on this machine. The tool sends no telemetry.
125
147
  - The local cache stores metadata only: session titles, token counts, timestamps, models, tool
126
148
  names, and file paths. It never stores message text.
127
- - One network call exists: plan usage. It runs only when a Claude Code login exists on the machine.
128
- It sends the plan auth token to `api.anthropic.com` and nowhere else. `--no-plan-usage` turns it
129
- off.
149
+ - Plan usage can contact Anthropic with a local Claude Code login, or the OpenCode Go usage endpoint with a local Go key. Keys go only to their own provider; `--no-plan-usage` disables network calls.
130
150
  - The server binds to `127.0.0.1` only. It rejects a `Host` header that is not loopback.
131
151
 
132
152
  ## Cache
package/SKILL.md CHANGED
@@ -180,7 +180,7 @@ snapshot restores by running its own `restore.sh`.
180
180
 
181
181
  What it does:
182
182
 
183
- 1. **Skills** — links `token-furnace`, `prd-creator` and `prd-manager` into
183
+ 1. **Skills** — links `token-furnace`, `save-tokens-creator`, `prd-creator` and `prd-manager` into
184
184
  `~/.claude/skills/` and `~/.codex/skills/` from one shared checkout, so both agents read
185
185
  the same file and an update lands in both.
186
186
  2. **The always-on line** — appends one line to `~/.claude/CLAUDE.md` and