modelstat 0.0.6 → 0.0.10

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
@@ -1,59 +1,96 @@
1
- # @modelstat/agent
1
+ # modelstat
2
2
 
3
- > Local companion for [modelstat](https://github.com/0xflair/modelstat). Reads
4
- > your AI coding tools' JSONL/SQLite logs (Claude Code, Codex, Cursor,
5
- > Gemini, Aider, …), tokenises events on-device, and uploads them to the
6
- > modelstat backend.
3
+ > **See every AI token your team spends.** Local companion for [modelstat](https://modelstat.ai) — reads the session logs your AI coding tools already write (Claude Code, Codex, Cursor, Cline, Continue, Aider, Windsurf, Zed, Copilot, Claude Desktop), tokenises events on-device, and uploads only metadata to your modelstat dashboard.
7
4
 
8
- **Your prompts never leave your machine.** The agent only uploads
9
- tokenised metadata (token counts, model ids, git remote, tool call
10
- counts, redacted summaries). See the
11
- [source](https://github.com/0xflair/modelstat/tree/main/apps/agent-dev)
12
- — discovery and redaction live in
13
- [`@modelstat/parsers`](https://github.com/0xflair/modelstat/tree/main/packages/parsers).
5
+ **Your prompts never leave your machine.** The agent uploads only token counts, model ids, timestamps, and a provider-assigned session id. Source is auditable on [GitHub](https://github.com/modelstat/modelstat/tree/main/apps/agent-dev).
14
6
 
15
7
  ## Install
16
8
 
9
+ The fastest way:
10
+
11
+ ```bash
12
+ curl -fsSL https://install.modelstat.ai | sh
13
+ ```
14
+
15
+ Or via Homebrew:
16
+
17
17
  ```bash
18
- # npm
19
- npm install -g @modelstat/agent
18
+ brew install modelstat/tap/modelstat
19
+ modelstat connect
20
+ ```
20
21
 
21
- # pnpm
22
- pnpm add -g @modelstat/agent
22
+ Or via npm / pnpm / bun:
23
23
 
24
- # bun
25
- bun install -g @modelstat/agent
24
+ ```bash
25
+ npm install -g @modelstat/agent && modelstat connect
26
+ pnpm add -g @modelstat/agent && modelstat connect
27
+ bun add -g @modelstat/agent && modelstat connect
26
28
  ```
27
29
 
28
- Requires Node 20+.
30
+ `modelstat connect` installs a **launchd user agent** on macOS (at `~/Library/LaunchAgents/ai.modelstat.agent.plist`) or a **systemd user unit** on Linux (at `~/.config/systemd/user/modelstat.service`). The daemon starts automatically on login.
31
+
32
+ Requires Node 20+ (or skip Node entirely with the Homebrew route). macOS and Linux (x86_64, arm64) supported.
29
33
 
30
- ## Connect
34
+ ## Commands
31
35
 
32
36
  ```bash
33
- # 1. Pair with your modelstat account (OAuth device-code)
34
- modelstat connect
37
+ modelstat connect # pair + install background service, then exit
38
+ modelstat status # show pairing + service state
39
+ modelstat paths [--json] # print state file + log paths + API URL
40
+ modelstat stop # stop and uninstall the service
41
+ modelstat scan # one-shot parse + upload of local JSONL
42
+ modelstat watch # foreground watcher (no service install)
43
+ modelstat discover # report detected tool installs + identities
44
+ ```
45
+
46
+ **Programmatic pairing** (used by harness skills for OpenClaw, NanoClaw, etc.):
35
47
 
36
- # It prints a 6-char code; enter it at the URL it opens in your browser.
48
+ ```bash
49
+ modelstat connect --json --no-browser
50
+ ```
51
+
52
+ Emits one NDJSON event per line. Schema documented at [integrations/harness-skills/modelstat-connect/README.md](https://github.com/modelstat/modelstat/tree/main/integrations/harness-skills/modelstat-connect).
37
53
 
38
- # 2. Report detected tool installs + identities
39
- modelstat discover
54
+ ## Shared state across install methods
40
55
 
41
- # 3. One-shot backfill of all local JSONL
42
- modelstat scan
56
+ Installing via both Homebrew and npm on the same laptop produces the **same binary reading the same state file** — on macOS that's `~/Library/Preferences/modelstat-agent-dev-nodejs/config.json`. Your device UUID, bearer token, and pairing state persist across install methods. No duplicate devices on the server side either — the API upserts on `(user_id, machine_id)`.
43
57
 
44
- # 4. Continuous watcher (chokidar + periodic backstop)
45
- modelstat watch
58
+ ## MCP server
59
+
60
+ Pair the agent, then install [`@modelstat/mcp`](https://www.npmjs.com/package/@modelstat/mcp) to query your own spend from inside Claude Desktop, Cursor, Cline, Continue, or Zed:
61
+
62
+ ```bash
63
+ # Claude Code
64
+ claude mcp add modelstat -- npx -y @modelstat/mcp
46
65
  ```
47
66
 
67
+ Full wire-up docs per client: https://modelstat.ai/mcp
68
+
48
69
  ## Self-host
49
70
 
50
- If you're pointing at your own modelstat API (not the hosted SaaS):
71
+ To point the agent at your own modelstat API (not the hosted SaaS):
51
72
 
52
73
  ```bash
53
74
  export AGENT_API_URL=https://your-modelstat-api.example.com
54
75
  modelstat connect
55
76
  ```
56
77
 
78
+ `AGENT_API_URL` can also be set persistently via `.env` or in the systemd/launchd unit.
79
+
80
+ ## Privacy
81
+
82
+ - Agent reads local session logs written by the tools you use. Nothing is intercepted — the tools already write these files.
83
+ - Upload payload: token counts, model name, timestamps, provider-assigned session id, git remote URL (redactable), redacted work-type summary.
84
+ - Never uploaded: prompt text, model responses, file contents, tool-call arguments, environment variables, SSH keys, secrets.
85
+ - Redaction is on-device via [`@modelstat/parsers`](https://github.com/modelstat/modelstat/tree/main/packages/parsers).
86
+ - Offline mode: buffered locally, uploaded when network returns. `modelstat scan --dry-run` for local-only analytics.
87
+
88
+ ## Pricing
89
+
90
+ - **Free**: 100M tokens/month, 1 device, no card.
91
+ - **Team**: $5/seat/month with 250M pooled tokens; overage at $25/billion.
92
+ - **Enterprise**: SSO/SCIM, on-prem ingest, SLAs — contact `hello@modelstat.ai`.
93
+
57
94
  ## License
58
95
 
59
- Apache-2.0 the code that reads files on your machine must be auditable.
96
+ Apache-2.0. Source at https://github.com/modelstat/modelstat/tree/main/apps/agent-dev.