token-studio 4.8.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.
- package/.nvmrc +1 -0
- package/CHANGELOG.md +89 -0
- package/Dockerfile +17 -0
- package/LICENSE +22 -0
- package/NOTICE.md +21 -0
- package/PRIVACY.md +68 -0
- package/README.en.md +220 -0
- package/README.md +220 -0
- package/config/collectors.json +54 -0
- package/data/.gitkeep +1 -0
- package/docker-compose.yml +17 -0
- package/docs/assets/.gitkeep +1 -0
- package/docs/assets/token-studio-v44-dashboard.png +0 -0
- package/docs/assets/token-studio-v44-live.png +0 -0
- package/docs/assets/token-studio-v44-review-mobile.png +0 -0
- package/docs/assets/token-studio-v44-review.png +0 -0
- package/docs/assets/token-studio-v45-dashboard.png +0 -0
- package/docs/assets/token-studio-v45-live.png +0 -0
- package/docs/assets/token-studio-v45-review-mobile.png +0 -0
- package/docs/assets/token-studio-v45-review.png +0 -0
- package/docs/blog-case-study.md +34 -0
- package/docs/collector-support-matrix.md +65 -0
- package/docs/competitive-notes.md +87 -0
- package/docs/demo-data/README.md +12 -0
- package/docs/demo-data/token-studio-v2-demo.json +146 -0
- package/docs/demo-flow.md +39 -0
- package/docs/first-run.md +95 -0
- package/docs/local-collectors.md +49 -0
- package/docs/public-launch-checklist.md +45 -0
- package/docs/resume-bullets.md +7 -0
- package/docs/statusline.md +52 -0
- package/index.html +16 -0
- package/package.json +36 -0
- package/render.yaml +17 -0
- package/src/auto-attribution.mjs +396 -0
- package/src/ccusage-bridge.mjs +74 -0
- package/src/ccusage-import.mjs +415 -0
- package/src/cli.mjs +643 -0
- package/src/client/dashboard/App.jsx +1734 -0
- package/src/client/dashboard/annotation-presets.js +138 -0
- package/src/client/dashboard/attribution.js +328 -0
- package/src/client/dashboard/components-charts.jsx +622 -0
- package/src/client/dashboard/components-tables.jsx +1531 -0
- package/src/client/dashboard/components-top.jsx +307 -0
- package/src/client/dashboard/import-budget.js +41 -0
- package/src/client/dashboard/model-usage.js +108 -0
- package/src/client/dashboard/onboarding.js +80 -0
- package/src/client/dashboard/styles.css +2606 -0
- package/src/client/live/LiveApp.jsx +226 -0
- package/src/client/live/styles.css +446 -0
- package/src/client/main.jsx +20 -0
- package/src/client/review/ReviewApp.jsx +507 -0
- package/src/client/review/closure-progress.js +165 -0
- package/src/client/review/markdown-report.js +401 -0
- package/src/client/review/model-strategy.js +273 -0
- package/src/client/review/roi-advisor.js +255 -0
- package/src/client/review/roi-evidence.js +78 -0
- package/src/client/review/savings-simulator.js +252 -0
- package/src/client/review/sections-1.jsx +277 -0
- package/src/client/review/sections-2.jsx +927 -0
- package/src/client/review/styles.css +2321 -0
- package/src/client/review/utils.js +345 -0
- package/src/client/shared/utils.js +236 -0
- package/src/closure-check.mjs +537 -0
- package/src/closure-import.mjs +646 -0
- package/src/collect.mjs +247 -0
- package/src/collector-config.mjs +82 -0
- package/src/collector-registry.mjs +333 -0
- package/src/collectors/claude-code.mjs +355 -0
- package/src/collectors/codex.mjs +418 -0
- package/src/collectors/copilot.mjs +19 -0
- package/src/collectors/cursor.mjs +23 -0
- package/src/collectors/gemini.mjs +530 -0
- package/src/collectors/goose.mjs +15 -0
- package/src/collectors/hermes.mjs +206 -0
- package/src/collectors/kimi.mjs +15 -0
- package/src/collectors/openclaw.mjs +400 -0
- package/src/collectors/opencode.mjs +349 -0
- package/src/collectors/qwen.mjs +15 -0
- package/src/collectors/structured-usage.mjs +437 -0
- package/src/collectors/utils.mjs +93 -0
- package/src/db.mjs +1397 -0
- package/src/demo-seed.mjs +39 -0
- package/src/dev.mjs +43 -0
- package/src/live.mjs +428 -0
- package/src/model-policy.mjs +147 -0
- package/src/pricing.mjs +434 -0
- package/src/privacy-check.mjs +126 -0
- package/src/server.mjs +1240 -0
- package/src/source-health.mjs +195 -0
- package/src/statusline.mjs +156 -0
- package/src/terminal-report.mjs +245 -0
- package/src/update-pricing.mjs +8 -0
- package/test/annotation-presets.test.mjs +137 -0
- package/test/api-annotations.test.mjs +202 -0
- package/test/api-auto-attribution.test.mjs +169 -0
- package/test/api-source-health.test.mjs +109 -0
- package/test/api-v2.test.mjs +278 -0
- package/test/api-v43.test.mjs +151 -0
- package/test/api-v44.test.mjs +128 -0
- package/test/attribution-summary.test.mjs +164 -0
- package/test/auto-attribution.test.mjs +116 -0
- package/test/ccusage-bridge.test.mjs +36 -0
- package/test/ccusage-import.test.mjs +93 -0
- package/test/cli-v43.test.mjs +64 -0
- package/test/cli-v45.test.mjs +34 -0
- package/test/cli-v46.test.mjs +129 -0
- package/test/cli-v47.test.mjs +98 -0
- package/test/closure-check.test.mjs +202 -0
- package/test/closure-import.test.mjs +263 -0
- package/test/collector-config.test.mjs +25 -0
- package/test/collector-registry.test.mjs +56 -0
- package/test/csv.test.mjs +19 -0
- package/test/db-annotations.test.mjs +186 -0
- package/test/db-v2.test.mjs +200 -0
- package/test/db-v4.test.mjs +178 -0
- package/test/experimental-collectors.test.mjs +103 -0
- package/test/fixtures/collectors/copilot/usage.jsonl +2 -0
- package/test/fixtures/collectors/cursor/usage.jsonl +2 -0
- package/test/fixtures/collectors/goose/usage.jsonl +2 -0
- package/test/fixtures/collectors/kimi/usage.jsonl +2 -0
- package/test/fixtures/collectors/qwen/usage.jsonl +2 -0
- package/test/import-budget.test.mjs +40 -0
- package/test/live.test.mjs +256 -0
- package/test/markdown-report.test.mjs +193 -0
- package/test/model-policy.test.mjs +34 -0
- package/test/model-strategy.test.mjs +116 -0
- package/test/model-usage.test.mjs +99 -0
- package/test/official-pricing.test.mjs +70 -0
- package/test/onboarding.test.mjs +55 -0
- package/test/privacy-check.test.mjs +33 -0
- package/test/review-closure-progress.test.mjs +99 -0
- package/test/roi-advisor.test.mjs +188 -0
- package/test/roi-evidence.test.mjs +48 -0
- package/test/roi-summary.test.mjs +101 -0
- package/test/savings-simulator.test.mjs +141 -0
- package/test/source-health.test.mjs +62 -0
- package/test/statusline.test.mjs +148 -0
- package/vite.config.js +23 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enabledCollectors": [
|
|
3
|
+
"claude",
|
|
4
|
+
"codex",
|
|
5
|
+
"gemini",
|
|
6
|
+
"opencode",
|
|
7
|
+
"openclaw",
|
|
8
|
+
"hermes"
|
|
9
|
+
],
|
|
10
|
+
"scheduledCollect": {
|
|
11
|
+
"enabled": false,
|
|
12
|
+
"intervalSeconds": 300,
|
|
13
|
+
"runOnStart": false,
|
|
14
|
+
"device": null
|
|
15
|
+
},
|
|
16
|
+
"collectors": {
|
|
17
|
+
"claude": {
|
|
18
|
+
"roots": [
|
|
19
|
+
"~/.config/claude",
|
|
20
|
+
"~/.claude"
|
|
21
|
+
],
|
|
22
|
+
"includeDesktopLocalAgent": true,
|
|
23
|
+
"desktopLocalAgentBase": "~/Library/Application Support/Claude/local-agent-mode-sessions"
|
|
24
|
+
},
|
|
25
|
+
"codex": {
|
|
26
|
+
"homes": [
|
|
27
|
+
"~/.codex"
|
|
28
|
+
],
|
|
29
|
+
"sessionSubdirs": [
|
|
30
|
+
"sessions",
|
|
31
|
+
"archived_sessions"
|
|
32
|
+
],
|
|
33
|
+
"headlessRoots": [
|
|
34
|
+
"~/.config/token-studio-roi/headless",
|
|
35
|
+
"~/Library/Application Support/token-studio-roi/headless"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"hermes": {
|
|
39
|
+
"dbPath": "~/.hermes/state.db"
|
|
40
|
+
},
|
|
41
|
+
"opencode": {
|
|
42
|
+
"dataDir": "~/.local/share/opencode",
|
|
43
|
+
"extraDbPaths": []
|
|
44
|
+
},
|
|
45
|
+
"openclaw": {
|
|
46
|
+
"agentRoots": [
|
|
47
|
+
"~/.openclaw/agents",
|
|
48
|
+
"~/.clawdbot/agents",
|
|
49
|
+
"~/.moltbot/agents",
|
|
50
|
+
"~/.moldbot/agents"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
package/data/.gitkeep
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
services:
|
|
2
|
+
token-studio-roi:
|
|
3
|
+
build: .
|
|
4
|
+
ports:
|
|
5
|
+
- "4173:4173"
|
|
6
|
+
environment:
|
|
7
|
+
HOST: "0.0.0.0"
|
|
8
|
+
PORT: "4173"
|
|
9
|
+
INGEST_TOKEN: "${INGEST_TOKEN:?Set INGEST_TOKEN before starting the hub}"
|
|
10
|
+
HOME: /collector-home
|
|
11
|
+
SCHEDULED_COLLECT_ENABLED: "${SCHEDULED_COLLECT_ENABLED:-false}"
|
|
12
|
+
SCHEDULED_COLLECT_INTERVAL_SECONDS: "${SCHEDULED_COLLECT_INTERVAL_SECONDS:-${COLLECT_INTERVAL_SECONDS:-300}}"
|
|
13
|
+
SCHEDULED_COLLECT_RUN_ON_START: "${SCHEDULED_COLLECT_RUN_ON_START:-false}"
|
|
14
|
+
COLLECT_DEVICE: "${COLLECT_DEVICE:-docker-collector}"
|
|
15
|
+
volumes:
|
|
16
|
+
- ./data:/app/data
|
|
17
|
+
- "${TOKEN_STUDIO_COLLECTOR_HOME:-.}:/collector-home:ro"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Blog Case Study Notes
|
|
2
|
+
|
|
3
|
+
## Positioning
|
|
4
|
+
|
|
5
|
+
Token Studio ROI turns local AI coding usage into a private weekly review loop: cost, projects, work attribution, output evidence, ROI advice, and model policy.
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
Most token dashboards answer "how much did I use?" Token Studio ROI asks "what did that usage produce, and how should I change my model strategy next week?"
|
|
10
|
+
|
|
11
|
+
## Product Decisions
|
|
12
|
+
|
|
13
|
+
- Local-first by default.
|
|
14
|
+
- No conversation content storage.
|
|
15
|
+
- Official-price conversion only.
|
|
16
|
+
- Unpriced models stay unpriced.
|
|
17
|
+
- Demo mode uses synthetic data.
|
|
18
|
+
- Experimental collectors are opt-in and skip rows without explicit token fields.
|
|
19
|
+
|
|
20
|
+
## Engineering Highlights
|
|
21
|
+
|
|
22
|
+
- Node.js `node:sqlite` local data store.
|
|
23
|
+
- Collector registry with stable, experimental, detected-only, and unsupported states.
|
|
24
|
+
- Lightweight `/live` monitor for recent burn rate without transcript access.
|
|
25
|
+
- Loopback-only local write APIs.
|
|
26
|
+
- Privacy scanner for public readiness.
|
|
27
|
+
- ROI Evidence Score for evidence completeness.
|
|
28
|
+
- Markdown model policy export.
|
|
29
|
+
|
|
30
|
+
## Honest Limits
|
|
31
|
+
|
|
32
|
+
- Cost conversion is not a provider invoice.
|
|
33
|
+
- Rules do not understand task quality like a human reviewer.
|
|
34
|
+
- Real ROI improves only when sessions have real attribution and output links.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Collector Support Matrix
|
|
2
|
+
|
|
3
|
+
Token Studio ROI prefers trustworthy token metadata over broad but unreliable coverage.
|
|
4
|
+
|
|
5
|
+
| Source | Status | Data source | Reads conversation content | Token reliability | Default |
|
|
6
|
+
|---|---|---|---:|---|---:|
|
|
7
|
+
| Claude Code | stable | local metadata/log files | No | native token fields | Yes |
|
|
8
|
+
| Codex CLI | stable | local JSONL session metadata | No | native token fields | Yes |
|
|
9
|
+
| Gemini CLI | stable | local session metadata | No | native token fields | Yes |
|
|
10
|
+
| OpenCode | stable | local data directory | No | native token fields | Yes |
|
|
11
|
+
| OpenClaw | stable | local agent metadata | No | native token fields | Yes |
|
|
12
|
+
| Hermes Agent | stable | local SQLite metadata | No | native token fields | Yes |
|
|
13
|
+
| Cursor | experimental | explicit structured usage JSON/JSONL only | No | explicit token fields only | No |
|
|
14
|
+
| GitHub Copilot CLI | experimental | explicit structured usage JSON/JSONL only | No | explicit token fields only | No |
|
|
15
|
+
| Qwen Code | experimental | explicit structured usage JSON/JSONL only | No | explicit token fields only | No |
|
|
16
|
+
| Kimi / Moonshot Coding CLI | experimental | explicit structured usage JSON/JSONL only | No | explicit token fields only | No |
|
|
17
|
+
| Goose | experimental | explicit structured usage JSON/JSONL only | No | explicit token fields only | No |
|
|
18
|
+
| ccusage JSON / CLI Bridge | import-only | documented ccusage JSON output or explicit `ccusage --json --no-cost` bridge | No | external structured token fields | No |
|
|
19
|
+
| Amp | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
20
|
+
| Droid | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
21
|
+
| Codebuff | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
22
|
+
| pi-agent | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
23
|
+
| Roo Code | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
24
|
+
| Zed Agent | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
25
|
+
| Antigravity | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
26
|
+
| Cline | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
27
|
+
| Kiro | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
28
|
+
| Grok Build | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
29
|
+
| Kilo | detected-only | local path detection only | No | unknown; no usage import | No |
|
|
30
|
+
|
|
31
|
+
Experimental collectors are opt-in. They skip records without explicit token fields and never infer usage from message text, prompts, responses, diffs, or full file paths.
|
|
32
|
+
|
|
33
|
+
Import-only sources are explicit. Saved ccusage JSON does not scan local logs. The CLI bridge runs ccusage as an external local scanner only after confirmation or `--yes`; Token Studio receives structured JSON, rejects conversation-like fields, and recomputes official-price costs:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx token-studio import-usage --format=ccusage-json --file ccusage.json --dry-run
|
|
37
|
+
npx token-studio import-usage --format=ccusage-json --file ccusage.json --apply
|
|
38
|
+
npx token-studio import-usage --format=ccusage-cli --report=session --dry-run --yes
|
|
39
|
+
npx token-studio import-usage --format=ccusage-cli --report=blocks --apply --yes
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The Dashboard ccusage CLI Bridge panel only builds these copyable commands. It does not run ccusage from the browser or through a new server-side scanner API.
|
|
43
|
+
|
|
44
|
+
Detected-only sources only report whether likely local paths exist. They do not write `daily_usage`, `session_usage`, or `token_events` until a later audit proves reliable token/model/time/session metadata.
|
|
45
|
+
|
|
46
|
+
## Collector Audit
|
|
47
|
+
|
|
48
|
+
Token Studio collector audit provides:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx token-studio collectors --audit --json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The audit checks experimental collector roots and returns only safe counts:
|
|
55
|
+
|
|
56
|
+
- candidate files
|
|
57
|
+
- usable structured token records
|
|
58
|
+
- skipped records with no token fields
|
|
59
|
+
- skipped conversation-like records
|
|
60
|
+
- skipped oversized files
|
|
61
|
+
- parse errors
|
|
62
|
+
|
|
63
|
+
It does not write SQLite, does not print full paths, and does not output prompt, response, diff, transcript, or message content. A collector should only move from experimental to stable after audit results show reliable token/model/time/session metadata on real local files. Detected-only collectors must first move to experimental with fixture coverage before they can ever become stable.
|
|
64
|
+
|
|
65
|
+
From a cloned repository, replace `npx token-studio` with `node src/cli.mjs` for local development.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Competitive Notes
|
|
2
|
+
|
|
3
|
+
Token Studio ROI is positioned as a local AI coding ROI review system, not only a token counter.
|
|
4
|
+
|
|
5
|
+
## Referenced Projects
|
|
6
|
+
|
|
7
|
+
| Project | Public focus | Coverage strength | Launch strength | Token Studio ROI difference |
|
|
8
|
+
|---|---|---|---|---|
|
|
9
|
+
| [ccusage](https://ccusage.com/) | Local CLI usage and estimated cost across many coding agents | Broad collector coverage, offline pricing, cache token accounting | Strong CLI workflow | Token Studio ROI adds work attribution, output links, ROI evidence score, and weekly review exports. |
|
|
10
|
+
| [CodeBurn](https://github.com/getagentseal/codeburn) | Interactive TUI for Claude Code, Codex, and Cursor cost observability | Claude, Codex, Cursor oriented | Fast `npx` terminal experience | Token Studio ROI uses a browser review workspace with work items and advisor actions. |
|
|
11
|
+
| [token-dashboard](https://github.com/nateherkai/token-dashboard) | Local Claude Code JSONL dashboard with cost analytics, heatmaps, and tips | Deep Claude Code analytics | Clear dashboard story | Token Studio ROI keeps transcript content out of the product and focuses on project/task/output ROI. |
|
|
12
|
+
| [Claude Code Usage Monitor](https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor) | Real-time terminal monitoring with burn rate and prediction | Claude Code focused | Strong live monitoring | Token Studio ROI treats live monitoring as a lightweight guardrail and keeps weekly ROI review as the main surface. |
|
|
13
|
+
| [TokenTracker](https://github.com/mm7894215/TokenTracker) | Local-first dashboard, native tray/menu bar, widgets, many coding tools | Very broad tool coverage | Desktop packaging and zero-config story | Token Studio ROI is lighter-weight today but has deeper work/output attribution and publishable review artifacts. |
|
|
14
|
+
|
|
15
|
+
## Differentiation
|
|
16
|
+
|
|
17
|
+
- Work attribution: project alias, task type, output status, work purpose, stage, value, and notes.
|
|
18
|
+
- Output evidence: PR, commit, article, deploy, document, screenshot, or other URL without fetching linked content.
|
|
19
|
+
- Work item layer: multiple sessions can roll up into one deliverable.
|
|
20
|
+
- ROI Evidence Score: separates manually confirmed work, auto/high-confidence work, missing fields, output links, and high-cost gaps.
|
|
21
|
+
- ROI Savings Simulator: compares model switching scenarios for exploration, testing, context prep, low-value, and abandoned work using official-price conversion, not invoice claims.
|
|
22
|
+
- ROI Advisor: local explainable rules that recommend annotation, model switching, context compression, stop-loss, output links, and policy changes.
|
|
23
|
+
- Advisor Action Loop: recommendations can become open/done/dismissed actions and appear in weekly reports.
|
|
24
|
+
- Model Policy export: produces a reusable Markdown strategy for when to use light, mid, or heavy models.
|
|
25
|
+
- ccusage JSON Import: uses ccusage documented output as an import bridge for broader structured coverage while recomputing official-price costs locally.
|
|
26
|
+
- Budget Guardrails: custom source-level token/cost windows, burn projection, and near/over/exceeded warnings without pretending to know provider subscription quotas.
|
|
27
|
+
- Collector Audit: safely checks experimental collector viability before upgrading support level, instead of inflating source count with unreliable estimates.
|
|
28
|
+
- Terminal ROI Report: quick CLI summary of total tokens, official-price cost, project/model ranking, budget risks, and Advisor Actions.
|
|
29
|
+
- Public safety: demo mode, privacy-check, `NOTICE.md`, no real SQLite in git, no prompt/response export.
|
|
30
|
+
- Launch path: `npx token-studio demo` after npm publication, with `git clone && npm run demo` kept as the source checkout path.
|
|
31
|
+
- v4.1 coverage path: experimental Cursor, Copilot CLI, Qwen Code, Kimi, and Goose collectors skip records without explicit token fields.
|
|
32
|
+
|
|
33
|
+
## v4.3 High-ROI Product Bet
|
|
34
|
+
|
|
35
|
+
The fastest way to improve Token Studio ROI is to close the biggest visible gaps without diluting the ROI product wedge. ccusage, tokscale, and TokenTracker still lead on breadth and quick-start monitoring. CodeBurn and Claude Code Usage Monitor remain stronger in terminal-first live burn-rate workflows.
|
|
36
|
+
|
|
37
|
+
v4.3 narrows that gap by using ccusage JSON as an import bridge, adding source-level budget guardrails, and adding terminal reports. It still deepens the question those tools usually stop short of: **what should I change next week to spend fewer tokens on low-value work and preserve expensive models for high-value output?**
|
|
38
|
+
|
|
39
|
+
v4.3 therefore prioritizes:
|
|
40
|
+
|
|
41
|
+
- ccusage import before reimplementing every collector.
|
|
42
|
+
- Custom budget guardrails before claiming exact subscription limits.
|
|
43
|
+
- Advisor Actions before generic tips.
|
|
44
|
+
- Terminal ROI report before a full TUI.
|
|
45
|
+
- Collector matrix breadth with detected-only/import-only honesty before fake stable support.
|
|
46
|
+
|
|
47
|
+
## v4.6 Bridge And Statusline Bet
|
|
48
|
+
|
|
49
|
+
The remaining gap after v4.5 is not the browser review workflow; it is quick terminal access and broad source ingestion. ccusage already documents JSON reports for daily, weekly, monthly, session, and blocks, and it can be run directly with `npx ccusage@latest`. Token Studio ROI should not duplicate every collector immediately.
|
|
50
|
+
|
|
51
|
+
v4.6 therefore adds:
|
|
52
|
+
|
|
53
|
+
- ccusage CLI Bridge: run ccusage explicitly, request `--json --no-cost`, reject unsafe conversation-like fields, and recompute costs with Token Studio official-price logic.
|
|
54
|
+
- Statusline Guardrails: a compact read-only summary for terminal prompt, tmux, or Claude Code statusline use.
|
|
55
|
+
- No desktop widget, leaderboard, subscription-quota prediction, account system, or background daemon.
|
|
56
|
+
|
|
57
|
+
This narrows the most visible competitive gap while keeping Token Studio ROI focused on work evidence, model strategy, and Advisor Actions.
|
|
58
|
+
|
|
59
|
+
## v4.7 Usability Catch-Up
|
|
60
|
+
|
|
61
|
+
v4.7 keeps the same product wedge but makes the catch-up features easier to use:
|
|
62
|
+
|
|
63
|
+
- ccusage Bridge UX: the Dashboard generates copyable commands for saved JSON or CLI bridge workflows, but the browser never runs external scanners.
|
|
64
|
+
- Quota Profiles v2: custom guardrails now support rolling and fixed reset windows, reset countdowns, and editable warning thresholds.
|
|
65
|
+
- Statusline Integration Pack: documented snippets for Claude Code statusline, tmux, PowerShell prompts, and JSON scripts.
|
|
66
|
+
- ROI Playbook Export: `token-studio policy --format=markdown|claude-md|agents-md` turns Model Policy into copyable operating rules without editing user files.
|
|
67
|
+
|
|
68
|
+
This closes practical gaps with terminal-first competitors while preserving the main differentiation: ROI evidence, work outputs, and explicit action loops.
|
|
69
|
+
|
|
70
|
+
## v4.8 npm And Source Health Bet
|
|
71
|
+
|
|
72
|
+
v4.8 makes the public launch path easier to try and easier to explain:
|
|
73
|
+
|
|
74
|
+
- npm one-command launch: `npx token-studio demo` should get a new user into synthetic demo data within 30 seconds.
|
|
75
|
+
- Source Health Center: show native stable, experimental, detected-only, and ccusage import-bridge support honestly, including detected status, recent rows, token-field trust, and privacy boundaries.
|
|
76
|
+
- ccusage bridge as coverage shortcut: use ccusage's broad ecosystem through explicit JSON/CLI import while still recomputing costs with Token Studio official-price logic.
|
|
77
|
+
- README first screen: position Token Studio ROI around Work Evidence, Savings Simulator, and Model Policy instead of competing only as a token meter.
|
|
78
|
+
|
|
79
|
+
This narrows the most visible competitor gap, one-command startup and coverage clarity, without pretending that detected-only sources are real collectors.
|
|
80
|
+
|
|
81
|
+
## Remaining Gaps
|
|
82
|
+
|
|
83
|
+
- Collector depth is still behind the broadest multi-tool products. v4.8 improves breadth through Source Health plus ccusage JSON/CLI bridge and detected-only coverage, but Token Studio's own stable collectors remain narrower than ccusage or TokenTracker.
|
|
84
|
+
- Live monitoring is intentionally lightweight; it is a guardrail for current burn rate, not an exact subscription predictor.
|
|
85
|
+
- Desktop packaging is not included. Keep the public story focused on local browser + CLI first.
|
|
86
|
+
- Automatic attribution is rule-based and should always display provenance and confidence.
|
|
87
|
+
- Savings simulation depends on official public token prices and structured metadata; it is useful for strategy, not proof of actual invoice savings.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Token Studio ROI Demo Data
|
|
2
|
+
|
|
3
|
+
`token-studio-v2-demo.json` contains synthetic data for screenshots, blog posts, and local demos.
|
|
4
|
+
|
|
5
|
+
It is not real local AI usage data. It contains no conversation content.
|
|
6
|
+
|
|
7
|
+
The file has two sections:
|
|
8
|
+
|
|
9
|
+
- `usageSeed`: synthetic daily/session usage rows that mirror the local collector shape.
|
|
10
|
+
- `annotationBackup`: import/export-shaped annotations, output links, and project alias rules.
|
|
11
|
+
|
|
12
|
+
The import API expects matching sessions to already exist in SQLite because annotations are keyed by `device + source + session_id`.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"synthetic": true,
|
|
4
|
+
"generatedFor": "Token Studio ROI public demo",
|
|
5
|
+
"notes": [
|
|
6
|
+
"This file contains synthetic demo records only.",
|
|
7
|
+
"It does not contain real local AI session data or conversation content.",
|
|
8
|
+
"annotationBackup can be used as the shape for /api/import/annotations after matching sessions exist in the local SQLite database."
|
|
9
|
+
],
|
|
10
|
+
"usageSeed": {
|
|
11
|
+
"daily": [
|
|
12
|
+
{
|
|
13
|
+
"device": "demo-laptop",
|
|
14
|
+
"source": "Codex CLI",
|
|
15
|
+
"usageDate": "2026-06-10",
|
|
16
|
+
"model": "codex-mini",
|
|
17
|
+
"inputTokens": 180000,
|
|
18
|
+
"outputTokens": 62000,
|
|
19
|
+
"cacheCreationTokens": 9000,
|
|
20
|
+
"cacheReadTokens": 54000,
|
|
21
|
+
"reasoningOutputTokens": 12000,
|
|
22
|
+
"totalTokens": 317000,
|
|
23
|
+
"costUSD": 5.84
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"device": "demo-laptop",
|
|
27
|
+
"source": "Claude Code",
|
|
28
|
+
"usageDate": "2026-06-09",
|
|
29
|
+
"model": "claude-sonnet",
|
|
30
|
+
"inputTokens": 220000,
|
|
31
|
+
"outputTokens": 71000,
|
|
32
|
+
"cacheCreationTokens": 16000,
|
|
33
|
+
"cacheReadTokens": 61000,
|
|
34
|
+
"reasoningOutputTokens": 0,
|
|
35
|
+
"totalTokens": 368000,
|
|
36
|
+
"costUSD": 8.15
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"sessions": [
|
|
40
|
+
{
|
|
41
|
+
"device": "demo-laptop",
|
|
42
|
+
"source": "Codex CLI",
|
|
43
|
+
"sessionId": "demo:codex:token-studio-roi",
|
|
44
|
+
"lastActivity": "2026-06-10T09:20:00.000Z",
|
|
45
|
+
"projectPath": "D:/Projects/token-studio-roi-demo",
|
|
46
|
+
"inputTokens": 180000,
|
|
47
|
+
"outputTokens": 62000,
|
|
48
|
+
"cacheCreationTokens": 9000,
|
|
49
|
+
"cacheReadTokens": 54000,
|
|
50
|
+
"reasoningOutputTokens": 12000,
|
|
51
|
+
"totalTokens": 317000,
|
|
52
|
+
"costUSD": 5.84
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"device": "demo-laptop",
|
|
56
|
+
"source": "Claude Code",
|
|
57
|
+
"sessionId": "demo:claude:resume-polish",
|
|
58
|
+
"lastActivity": "2026-06-09T16:40:00.000Z",
|
|
59
|
+
"projectPath": "D:/Projects/resume-roi-demo",
|
|
60
|
+
"inputTokens": 220000,
|
|
61
|
+
"outputTokens": 71000,
|
|
62
|
+
"cacheCreationTokens": 16000,
|
|
63
|
+
"cacheReadTokens": 61000,
|
|
64
|
+
"reasoningOutputTokens": 0,
|
|
65
|
+
"totalTokens": 368000,
|
|
66
|
+
"costUSD": 8.15
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"device": "demo-laptop",
|
|
70
|
+
"source": "Codex CLI",
|
|
71
|
+
"sessionId": "demo:codex:abandoned-spike",
|
|
72
|
+
"lastActivity": "2026-06-08T12:10:00.000Z",
|
|
73
|
+
"projectPath": "D:/Projects/abandoned-spike-demo",
|
|
74
|
+
"inputTokens": 90000,
|
|
75
|
+
"outputTokens": 24000,
|
|
76
|
+
"cacheCreationTokens": 5000,
|
|
77
|
+
"cacheReadTokens": 22000,
|
|
78
|
+
"reasoningOutputTokens": 3000,
|
|
79
|
+
"totalTokens": 144000,
|
|
80
|
+
"costUSD": 2.12
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"annotationBackup": {
|
|
85
|
+
"version": 2,
|
|
86
|
+
"sessionAnnotations": [
|
|
87
|
+
{
|
|
88
|
+
"device": "demo-laptop",
|
|
89
|
+
"source": "Codex CLI",
|
|
90
|
+
"sessionId": "demo:codex:token-studio-roi",
|
|
91
|
+
"projectAlias": "Token Studio",
|
|
92
|
+
"taskType": "功能开发",
|
|
93
|
+
"outputStatus": "已发布",
|
|
94
|
+
"note": "v2 本地 ROI 复盘闭环"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"device": "demo-laptop",
|
|
98
|
+
"source": "Claude Code",
|
|
99
|
+
"sessionId": "demo:claude:resume-polish",
|
|
100
|
+
"projectAlias": "简历优化工具",
|
|
101
|
+
"taskType": "问题修复",
|
|
102
|
+
"outputStatus": "已完成",
|
|
103
|
+
"note": "修复结果页证据展示"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"device": "demo-laptop",
|
|
107
|
+
"source": "Codex CLI",
|
|
108
|
+
"sessionId": "demo:codex:abandoned-spike",
|
|
109
|
+
"projectAlias": "废弃 Spike",
|
|
110
|
+
"taskType": "技术调研",
|
|
111
|
+
"outputStatus": "已废弃",
|
|
112
|
+
"note": "方向不值得继续投入"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"sessionOutputs": [
|
|
116
|
+
{
|
|
117
|
+
"device": "demo-laptop",
|
|
118
|
+
"source": "Codex CLI",
|
|
119
|
+
"sessionId": "demo:codex:token-studio-roi",
|
|
120
|
+
"outputUrl": "https://github.com/example/token-studio/pull/12",
|
|
121
|
+
"outputLabel": "v2 PR"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"device": "demo-laptop",
|
|
125
|
+
"source": "Claude Code",
|
|
126
|
+
"sessionId": "demo:claude:resume-polish",
|
|
127
|
+
"outputUrl": "https://example.com/resume-demo",
|
|
128
|
+
"outputLabel": "Demo 页面"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"projectAliasRules": [
|
|
132
|
+
{
|
|
133
|
+
"pattern": "D:/Projects/token-studio-roi-demo",
|
|
134
|
+
"matchType": "prefix",
|
|
135
|
+
"projectAlias": "Token Studio",
|
|
136
|
+
"enabled": true
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"pattern": "D:/Projects/resume-roi-demo",
|
|
140
|
+
"matchType": "prefix",
|
|
141
|
+
"projectAlias": "简历优化工具",
|
|
142
|
+
"enabled": true
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Token Studio ROI Demo Flow
|
|
2
|
+
|
|
3
|
+
This flow is for public GitHub screenshots, blog posts, and resume walkthroughs.
|
|
4
|
+
|
|
5
|
+
## 1. Start Synthetic Demo
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npm run demo
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The demo command seeds `data/demo.sqlite` from `docs/demo-data/token-studio-v2-demo.json` and starts the local UI.
|
|
13
|
+
|
|
14
|
+
## 2. Show The Story
|
|
15
|
+
|
|
16
|
+
1. Open the dashboard and point out the `Demo Mode` badge.
|
|
17
|
+
2. Show source/model filtering and project/session attribution.
|
|
18
|
+
3. Open `/review`.
|
|
19
|
+
4. Show ROI Evidence Score before the detailed sections.
|
|
20
|
+
5. Show ROI Advisor and model strategy.
|
|
21
|
+
6. Export the Markdown review report.
|
|
22
|
+
7. Open `/api/model-policy.md` to show the generated model policy.
|
|
23
|
+
|
|
24
|
+
## 3. Privacy Script
|
|
25
|
+
|
|
26
|
+
Run:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run privacy:check
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The public demo should not include real SQLite databases, local AI log directories, `.env` files, generated exports, personal paths, or raw conversation content.
|
|
33
|
+
|
|
34
|
+
## Demo Boundary
|
|
35
|
+
|
|
36
|
+
- Synthetic demo data is not real usage history.
|
|
37
|
+
- Real local mode requires explicit collection confirmation.
|
|
38
|
+
- Token Studio ROI does not read conversation content.
|
|
39
|
+
- Official-price conversion is not a provider invoice.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# First Run Guide
|
|
2
|
+
|
|
3
|
+
This guide gets a new user from an empty checkout to a useful ROI review in about five minutes.
|
|
4
|
+
|
|
5
|
+
## 1. Start Safely With Demo Data
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx token-studio demo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Demo mode uses synthetic data and does not scan `.claude`, `.codex`, Cursor, Copilot, or any other local AI logs.
|
|
12
|
+
|
|
13
|
+
From a cloned repository, use:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install
|
|
17
|
+
npm run demo
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 2. Try The Import Flow Without Writing
|
|
21
|
+
|
|
22
|
+
Open the Dashboard and choose **导入/预算**.
|
|
23
|
+
|
|
24
|
+
Paste ccusage JSON or choose a local JSON file, then click **Dry-run 预检**. Token Studio reports the detected shape, daily rows, sessions, token events, ignored third-party cost fields, and unsafe conversation-like fields.
|
|
25
|
+
|
|
26
|
+
Only click **Apply 写入 SQLite** after the dry-run looks correct. Apply creates a SQLite backup before writing.
|
|
27
|
+
|
|
28
|
+
CLI equivalent:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx token-studio import-usage --format=ccusage-json --file ccusage.json --dry-run
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If you already use ccusage and want Token Studio to invoke it for you, use the explicit bridge:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx token-studio import-usage --format=ccusage-cli --report=session --dry-run --yes
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This runs `ccusage session --json --no-cost` through the configured bridge. Token Studio rejects conversation-like fields, ignores ccusage cost fields, and only writes SQLite when you switch from `--dry-run` to `--apply`.
|
|
41
|
+
|
|
42
|
+
The Dashboard also has a **ccusage CLI Bridge** command builder. It only generates a copyable terminal command; the browser does not run ccusage or any external scanner.
|
|
43
|
+
|
|
44
|
+
## 3. Create A Custom Budget Window
|
|
45
|
+
|
|
46
|
+
In **导入/预算**, create a source-level budget such as:
|
|
47
|
+
|
|
48
|
+
- source: `Codex CLI`
|
|
49
|
+
- window type: `rolling` or `fixed`
|
|
50
|
+
- window: `60` minutes, `300` minutes, or your own target
|
|
51
|
+
- reset anchor: fixed windows only
|
|
52
|
+
- warning threshold: for example `0.75`
|
|
53
|
+
- token budget: your own target
|
|
54
|
+
- USD budget: optional official-price conversion target
|
|
55
|
+
|
|
56
|
+
Token Studio does not ship provider subscription quota presets. Budgets are your own guardrails, not vendor plan limits.
|
|
57
|
+
|
|
58
|
+
## 4. Review ROI
|
|
59
|
+
|
|
60
|
+
Open `/review` and check:
|
|
61
|
+
|
|
62
|
+
- ROI Evidence Score
|
|
63
|
+
- Savings Simulator
|
|
64
|
+
- ROI Advisor
|
|
65
|
+
- Advisor Actions
|
|
66
|
+
- Markdown report export
|
|
67
|
+
|
|
68
|
+
The first useful action is usually to add one or two recommendations to the action list, then review whether similar work uses fewer tokens next week.
|
|
69
|
+
|
|
70
|
+
## 5. Optional Terminal Statusline
|
|
71
|
+
|
|
72
|
+
For a compact live guardrail in a terminal prompt, tmux bar, or Claude Code statusline:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx token-studio statusline --format=text --window-minutes=15
|
|
76
|
+
npx token-studio statusline --format=json --window-minutes=15
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The statusline command only reads SQLite. It does not scan logs or start a background process. Copyable Claude Code, tmux, and PowerShell snippets are in [statusline.md](statusline.md).
|
|
80
|
+
|
|
81
|
+
## 6. Optional ROI Playbook Export
|
|
82
|
+
|
|
83
|
+
Export a model-use playbook without editing `CLAUDE.md`, `AGENTS.md`, or project files:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx token-studio policy --format=markdown
|
|
87
|
+
npx token-studio policy --format=claude-md
|
|
88
|
+
npx token-studio policy --format=agents-md
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Use the output as a review artifact or copy the relevant section manually into your local project rules.
|
|
92
|
+
|
|
93
|
+
## Privacy Boundary
|
|
94
|
+
|
|
95
|
+
Token Studio does not store prompts, responses, transcripts, command bodies, diffs, or full file paths. Costs are official public token-price conversions and simulations, not provider invoices.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Local Collectors
|
|
2
|
+
|
|
3
|
+
Token Studio ROI uses a collector registry instead of ad-hoc collector labels.
|
|
4
|
+
|
|
5
|
+
## Stable v4.0 Sources
|
|
6
|
+
|
|
7
|
+
- Claude Code
|
|
8
|
+
- Codex CLI
|
|
9
|
+
- Gemini CLI
|
|
10
|
+
- OpenCode
|
|
11
|
+
- OpenClaw
|
|
12
|
+
- Hermes Agent
|
|
13
|
+
|
|
14
|
+
These sources can produce normalized `daily_usage` and `session_usage` rows when their local metadata stores exist.
|
|
15
|
+
|
|
16
|
+
## Experimental v4.1 Sources
|
|
17
|
+
|
|
18
|
+
- Cursor
|
|
19
|
+
- GitHub Copilot CLI
|
|
20
|
+
- Qwen Code
|
|
21
|
+
- Kimi / Moonshot Coding CLI
|
|
22
|
+
- Goose
|
|
23
|
+
|
|
24
|
+
Experimental sources are opt-in. They import only explicit structured token fields from JSON/JSONL metadata and skip records without reliable token fields.
|
|
25
|
+
|
|
26
|
+
See [collector-support-matrix.md](collector-support-matrix.md) for status, privacy, and token reliability.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
node src/cli.mjs doctor
|
|
32
|
+
node src/cli.mjs collectors
|
|
33
|
+
node src/cli.mjs collect --sources=claude,codex
|
|
34
|
+
node src/cli.mjs collect --sources=cursor --yes
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`collect` requires explicit confirmation. Non-interactive shells refuse to scan local AI logs unless `--yes` is provided.
|
|
38
|
+
|
|
39
|
+
## Environment
|
|
40
|
+
|
|
41
|
+
- `TOKEN_STUDIO_COLLECTORS=claude,codex,gemini`
|
|
42
|
+
- `TOKEN_STUDIO_CONFIG=config/collectors.json`
|
|
43
|
+
- `TOKEN_STUDIO_HEADLESS_DIR=/path/to/headless/events`
|
|
44
|
+
|
|
45
|
+
Older `AI_TOKEN_DASHBOARD_*` variables are accepted only as backward-compatible fallbacks.
|
|
46
|
+
|
|
47
|
+
## Privacy
|
|
48
|
+
|
|
49
|
+
Collectors should normalize token metadata only. They must not store prompt text, response text, full transcripts, full file paths, command bodies, or diff content.
|