@superbased/observer 1.34.0-rc.8 → 1.36.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/README.md CHANGED
@@ -1,1628 +1,104 @@
1
1
  # @superbased/observer
2
2
 
3
- [![npm](https://img.shields.io/npm/v/@superbased/observer.svg)](https://www.npmjs.com/package/@superbased/observer)
4
- [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
5
- [![Platforms: Linux • macOS • Windows](https://img.shields.io/badge/platforms-linux%20%7C%20macos%20%7C%20windows-blue.svg)](https://github.com/superbasedapp/observer)
6
- [![Website](https://img.shields.io/badge/homepage-superbased.app-2EC4B6.svg)](https://superbased.app/)
7
-
8
- **Homepage:** [https://superbased.app/](https://superbased.app/)
3
+ <img src="https://raw.githubusercontent.com/superbasedapp/observer/main/vscode/media/logo-dark.png" alt="SuperBased logo" height="56">
9
4
 
10
- **Claude Code cost tracking. Cursor token usage. Codex spend.
11
- AI coding agent observability — one local tool, proxy-accurate.**
12
- SuperBased captures, normalizes, and analyzes every AI
13
- coding tool call across **40 adapters** — Claude Code, Codex, Cursor,
14
- Cline + Cline CLI, GitHub Copilot (VS Code) + Copilot CLI, Gemini CLI,
15
- OpenCode, Google Antigravity, Cowork, Nous Research's Hermes Agent,
16
- Kilo Code (legacy IDE extension + CLI), Aider, Goose, Devin, OpenClaw,
17
- Pi, Factory Droid, Open Interpreter, Command Code, and more — in one
18
- local single-binary tool. An optional API proxy
19
- reconciles the *exact* tokens your provider billed (net input, cache
20
- 5m/1h splits, reasoning tokens, long-context surcharges) instead of a
21
- JSONL-derived estimate. No telemetry and no cloud by default - nothing
22
- leaves your machine unless you explicitly opt in to the sign-in beta.
5
+ **Local-first observability for AI coding agents.** See what Claude Code, Codex, Cursor and every
6
+ other coding agent you run really cost, from the tokens your provider actually billed. On your own
7
+ machine, with no account.
23
8
 
24
- **One local binary.** SuperBased captures, normalizes, and analyzes
25
- every AI coding tool call on your machine: proxy-accurate cost,
26
- compression, cache tracking, and session handoff.
9
+ [![npm](https://img.shields.io/npm/v/@superbased/observer.svg)](https://www.npmjs.com/package/@superbased/observer)
10
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/superbasedapp/observer/blob/main/LICENSE)
11
+ [![Website](https://img.shields.io/badge/website-superbased.app-2EC4B6.svg)](https://superbased.app/)
27
12
 
28
- <p align="center">
29
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/infographics/one-local-path.png" alt="One local path for AI coding activity" width="780">
30
- </p>
13
+ ![SuperBased dashboard Overview: sessions, cost over time by billing bucket, top models and coding tools](https://raw.githubusercontent.com/superbasedapp/observer/main/docs/assets/screenshots/01-overview.png)
31
14
 
32
- # Table of contents
15
+ ## Try it without installing
33
16
 
34
- - [Install](#install)
35
- - [Five-minute quickstart](#five-minute-quickstart)
36
- - [Zero-setup cost report: `observer usage`](#zero-setup-cost-report-observer-usage)
37
- - [One local binary](#one-local-binary)
38
- - [Per-AI-client setup](#per-ai-client-setup)
39
- - [Architecture in detail](#architecture-in-detail)
40
- - [Dashboard tour](#dashboard-tour)
41
- - [Terminals — launch, join, and track your AI CLIs](#terminals--launch-join-and-track-your-ai-clis)
42
- - [MCP tools reference](#mcp-tools-reference)
43
- - [Compression mechanisms](#compression-mechanisms)
44
- - [Cost and token math](#cost-and-token-math)
45
- - [Terminology and glossary](#terminology-and-glossary)
46
- - [CLI reference](#cli-reference)
47
- - [Configuration](#configuration)
48
- - [Troubleshooting](#troubleshooting)
49
- - [Security and privacy](#security-and-privacy)
50
- - [Source, contributing, license](#source-contributing-license)
17
+ ```bash
18
+ npx @superbased/observer
19
+ ```
51
20
 
21
+ Reads the session logs your coding agents already keep on disk, prints a 30-day cost table by tool
22
+ and model, and deletes its temporary database on exit. No config, no network.
52
23
 
53
24
  ## Install
54
25
 
55
- **Use a global install** (`-g`) so the `observer` command is available
56
- on your `$PATH` from any directory:
57
-
58
26
  ```bash
59
27
  npm install -g @superbased/observer
60
28
  observer --version
61
29
  ```
62
30
 
63
- If you install locally (without `-g`) the binary lives at
64
- `./node_modules/.bin/observer` and isn't on your `$PATH`. Run it
65
- with `npx`:
66
-
67
- ```bash
68
- npm install @superbased/observer # local install
69
- npx observer --version # ↑ what to use everywhere `observer` is shown below
70
- ```
71
-
72
- A note for shared / CI machines where `npm install -g` may need
73
- `sudo`: see [Troubleshooting → EACCES](#npm-install--g-fails-with-eacces-permission-denied)
74
- for user-writable-prefix and version-manager fixes.
31
+ Prebuilt binaries for Linux (x64, arm64), macOS (Intel, Apple Silicon) and Windows x64. npm fetches
32
+ only the one for your machine; there is no compile step and no postinstall download. Also on
33
+ [PyPI](https://pypi.org/project/superbased-observer/) and the
34
+ [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=superbased.superbased-observer)
35
+ with the same version numbers; install from one channel only.
75
36
 
76
- > **Python users:** `pip install superbased-observer` ships the
77
- > same binary; version numbers are kept in lock-step. See
78
- > [the PyPI page](https://pypi.org/project/superbased-observer/).
79
- > Don't install both globally — whichever directory comes first on
80
- > `$PATH` wins, which gets confusing if their versions drift.
37
+ ## Why SuperBased
81
38
 
82
- Pre-built binaries ship for:
83
-
84
- | Platform | Architecture |
85
- |-----------------------|--------------|
86
- | Linux | x64, arm64 |
87
- | macOS (Intel) | x64 |
88
- | macOS (Apple Silicon) | arm64 |
89
- | Windows | x64 |
90
-
91
- The package uses the `optionalDependencies`-per-platform pattern (same
92
- shape as `esbuild` / `swc` / `@biomejs/biome`) — only the binary
93
- matching your machine downloads. No postinstall network calls, no
94
- compile step.
95
-
96
- If your platform isn't listed, build from source — instructions in
97
- the [main repo](https://github.com/superbasedapp/observer).
98
-
99
-
100
- ## Five-minute quickstart
101
-
102
- **No install at all, just a cost table:**
103
-
104
- ```bash
105
- npx @superbased/observer # a 30-day cost table, right now
106
- npx @superbased/observer usage # the explicit, same-thing form
107
- ```
39
+ **One local binary that tracks Claude Code token usage, Codex cost and Cursor spend side by side,
40
+ and helps you control them.**
108
41
 
109
- On a fresh machine with no SuperBased state yet, bare `npx
110
- @superbased/observer` scans each detected AI tool's own local session
111
- files into a throwaway temp database, prints one tool × model cost
112
- table, and deletes the database again — no daemon, no config written,
113
- no network call. See [Zero-setup cost report](#zero-setup-cost-report-observer-usage)
114
- below for what it does and doesn't do.
42
+ - **Provider-exact cost, not estimates.** An optional local proxy records the tokens your provider
43
+ returned: net input, 5-minute vs 1-hour cache writes, reasoning tokens and long-context repricing.
44
+ - **Every coding agent in one place.** 40 adapters normalize Claude Code, Codex, Cursor, GitHub
45
+ Copilot, Gemini CLI, Cline, Aider, Kiro, Devin, OpenCode, Junie and more into one local database.
46
+ - **Local-first, no account.** No telemetry and no sign-in. Everything lives in one SQLite file
47
+ under `~/.observer/`.
48
+ - **Know the next bill before it lands.** Prompt-cache tracking with expiry warnings, a cost band
49
+ for your next message, and a 5-hour and weekly limit gauge for proxied sessions.
50
+ - **Guardrails on your own agents.** Built-in and custom rules for destructive commands, secrets
51
+ egress, MCP pinning and budgets. Observe mode by default; `observer guard simulate` first.
52
+ - **Your agents as terminals.** Launch agent CLIs from the dashboard, join a running session from a
53
+ paired device over your Tailscale tailnet, and hand a session from one tool to another.
115
54
 
116
- **For the full local tool** — proxy-accurate tokens, live dashboard,
117
- conversation compression, cache tracking:
55
+ ## Get started
118
56
 
119
57
  ```bash
120
- # 1) Install.
121
- npm install -g @superbased/observer
122
-
123
- # 2) Start everything: proxy + watcher + dashboard in one process.
124
- # Hooks auto-register for every detected AI tool, and the
125
- # dashboard opens in your browser (suppress with --no-open).
126
- observer start
127
- ```
128
-
129
- From here the dashboard drives:
130
-
131
- 3. **Route your AI client through the proxy** — on the Compression
132
- tab's **Proxy** banner, click your tool's status pill, then
133
- **Route through the observer proxy…**. The button previews the
134
- exact file change and writes only on confirm. (Every other
135
- routing mechanism — `observer init`, the `observer claude` /
136
- `observer codex` wrappers, plain env vars — is listed in
137
- [Per-AI-client setup](#per-ai-client-setup).)
138
- 4. **Use your AI tool as normal.** The Overview tab's onboarding
139
- checklist tracks your first captured session; cost, compression,
140
- and cache numbers populate within minutes of real activity.
141
-
142
- `observer init` is OPTIONAL — run it only if you want the MCP server
143
- registered with your AI clients (gives them on-demand tools like
144
- `check_file_freshness` / `get_cost_summary`, at the cost of ~1,800
145
- tokens of schema per turn). Skip it for an MCP-free install.
146
-
147
- **What `start` does vs what `init` adds:**
148
-
149
- | Step | Hooks | Proxy listening | Watcher | Dashboard | MCP in AI clients | Codex proxy route |
150
- |---|---|---|---|---|---|---|
151
- | `observer start` alone | auto-registers ✓ | ✓ | ✓ | ✓ | — | — |
152
- | `observer init` + `observer start` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
153
- | `observer init --skip-mcp` + `start` | ✓ | ✓ | ✓ | ✓ | — | ✓ |
154
-
155
- MCP and codex routing are explicit-only because both write per-client
156
- config files. Hooks self-heal on every `start`.
157
-
158
-
159
- ## Zero-setup cost report: `observer usage`
160
-
161
- Before `observer start` and the daemon, there's a one-shot path for
162
- "how much have I spent so far": `observer usage` reads each detected
163
- AI tool's own local session files (JSONL / SQLite — the same files
164
- the watcher normally tails), rolls up the last 30 days into one
165
- tool × model cost table, and prints it. Everything it reads goes into
166
- a throwaway database in a temp directory (foreign-mount adapter
167
- mirrors — e.g. WSL reading a Windows-side tool store — land there too),
168
- deleted again when the command exits — it never creates or touches
169
- `~/.observer`, never writes any AI tool's config, and never opens a
170
- socket. Pricing is embedded in the binary (the same rate sheet the
171
- dashboard's Cost tab uses), so the whole run makes zero network calls.
172
-
173
- On a fresh machine with no SuperBased state yet — no
174
- `~/.observer/observer.db` and no `~/.observer/config.toml` — running
175
- bare `observer` with no arguments runs this same report instead of the
176
- usual welcome screen. Set `OBSERVER_ONESHOT=off` to always get the
177
- welcome screen instead; a default-config daemon can't run without
178
- first creating one of those two files, so there's no separate "is a
179
- daemon listening" check — no port probe, no network activity at all.
180
- Once either file exists on the machine, the fallthrough stops firing
181
- on its own and bare `observer` goes back to the welcome screen —
182
- `observer usage` stays available as an explicit command regardless.
183
-
184
- The report is honest about its own limits: reliability is **log
185
- tier** — parsed from each tool's own self-reported counts, not the
186
- wire-accurate numbers the proxy captures — and every dollar figure is
187
- labeled `estimated list price, not invoiced`. When it's ready for
188
- more, `observer start` is the next step: it keeps the proxy, the
189
- watcher, and the dashboard running so cost, cache, and compression
190
- numbers stay current instead of being recomputed from scratch on
191
- every invocation.
192
-
193
- Flags: `--since` (`7d`/`30d`/`90d`/`all`/an RFC3339 timestamp, default
194
- `30d`), `--group-by` (`tool-model`/`tool`/`model`/`day`), `--tool`,
195
- `--budget` (wall-clock cap on the scan only, default `30s`, `0` =
196
- unlimited — on expiry the table still prints with a `partial:`
197
- footer), `--json`, and `--keep-db <path>` to keep the scratch database
198
- instead of deleting it. See `observer usage --help` for the full
199
- reference.
200
-
201
- ## A wordmarked one-line status: `observer statusline`
202
-
203
- For an always-on glance instead of an on-demand report, `observer
204
- statusline` prints exactly one line — a short `▞ superbased` wordmark plus
205
- (when the data is available that invocation) the current session's
206
- cost, today's total observed spend, and the active model name — sized
207
- for a terminal prompt (Claude Code's `statusLine` contract) or any host
208
- tool that execs a command and reads its stdout. It's fail-open by
209
- design: with no daemon running it degrades to the wordmark alone (and
210
- makes no network call of any kind to find that out), and with a daemon
211
- running the only network-shaped call it makes is a bounded loopback
212
- request to that same-machine daemon. Every dollar figure is an
213
- estimated list-price total, not an invoiced amount. Registration is
214
- opt-in (`observer init --statusline`) — never automatic. See
215
- [`docs/observer-statusline.md`](https://github.com/superbasedapp/observer/blob/main/docs/observer-statusline.md)
216
- for the full reference.
217
-
218
- ## One local binary
219
-
220
- Everything below this line (proxy routing, per-client capture,
221
- compression, cache, MCP tools) is what this package is for: a local
222
- node that watches your own AI coding tools and gives you
223
- proxy-accurate cost and cache numbers, on your own machine.
224
-
225
- ## Per-AI-client setup
226
-
227
- ### Routing through the proxy — the canonical section
228
-
229
- Accurate token counts, conversation compression, and cache tracking
230
- all require your AI client to send its API traffic through the local
231
- proxy on `127.0.0.1:8820`. There is one decision to make — *how* to
232
- route — and four mechanisms that all end at the same proxy. Pick the
233
- first one that fits:
234
-
235
- | Mechanism | What it does | Use it when |
236
- |---|---|---|
237
- | **Dashboard button** *(recommended)* | On the Compression tab's **Proxy** banner, click your tool's status pill, then **Route through the observer proxy…**. It previews the exact file change and writes only on confirm: Claude Code gets `"env": { "ANTHROPIC_BASE_URL": … }` in `~/.claude/settings.json`; Codex gets an `observer` model provider in `~/.codex/config.toml`. Durable — every later session routes automatically, no wrapper, no env vars. Undo: remove the entry, or `observer uninstall --claude-code` / `--codex`. | You have a browser open. This is the default path. |
238
- | **`observer init`** | Writes the same durable routing from the CLI, alongside hooks + MCP registration (each side defaults on; opt out with `--skip-hooks` / `--skip-mcp` / `--skip-proxy-route`). | Headless machines, scripted setups. |
239
- | **Wrapper commands** — `observer claude` / `observer codex` | Launch the tool with routing injected for that session only; nothing is written to any config file. The claude wrapper also re-exports a fresh Pro/Max OAuth token so the SDK's OAuth path can't bypass the proxy (an expired stored token is left alone — Claude Code then refreshes natively). `observer claude --verify` runs the pre-flight checks without launching. | Trying the proxy out, or you don't want config writes. |
240
- | **Env var export** | `export ANTHROPIC_BASE_URL=http://127.0.0.1:8820` (Anthropic clients) or `export OPENAI_BASE_URL=http://127.0.0.1:8820/v1` (OpenAI clients — note the `/v1`) in the shell that launches the tool. | One-off shells; clients without a button or wrapper. |
241
-
242
- Routing is per-tool, not global: route Claude Code and Codex
243
- independently, and both can coexist on one machine — the proxy
244
- routes by URL path.
245
-
246
- > **Claude Code + MCP servers**: set `ENABLE_TOOL_SEARCH=true` in the
247
- > same environment. Claude Code's SDK disables deferred MCP schema
248
- > loading whenever `ANTHROPIC_BASE_URL` is set and eager-inlines every
249
- > registered MCP schema (~+21K tokens/turn) — enough to turn the proxy
250
- > into a net cost. The override restores lazy loading; the proxy
251
- > forwards `tool_reference` blocks byte-identically.
252
-
253
- > **If the daemon is down while a tool is routed**, Claude Code does
254
- > not silently bypass to the real API — it retries the dead port
255
- > (verified live: it hangs rather than failing over). `observer
256
- > doctor` and the dashboard's Health panel flag this state as a
257
- > "proxy routing gap"; bring the daemon back with `observer start`.
258
-
259
- ### Capture modes per client
260
-
261
- The proxy covers the clients that speak the Anthropic / OpenAI wire
262
- APIs. Everything else is captured passively from session logs. The
263
- table below is the full per-client reference.
264
-
265
- | AI client | Env var | Capture mode |
266
- |---------------------------------|-------------------------------------------------------|--------------|
267
- | **Claude Code** | `ANTHROPIC_BASE_URL=http://127.0.0.1:8820` | proxy + JSONL |
268
- | **Cursor** (Anthropic mode) | `ANTHROPIC_BASE_URL=http://127.0.0.1:8820` | proxy + JSONL |
269
- | **Codex** | `OPENAI_BASE_URL=http://127.0.0.1:8820/v1` (note `/v1`) | proxy + JSONL with API-key auth; ChatGPT-plan login currently behaves as JSONL only |
270
- | **Cursor** (OpenAI mode) | `OPENAI_BASE_URL=http://127.0.0.1:8820/v1` | proxy + JSONL |
271
- | **Cline (VS Code) / Roo Code** | `ANTHROPIC_BASE_URL=...` or `OPENAI_BASE_URL=...` per provider | proxy + JSONL |
272
- | **Cline CLI** (npm `cline` 3.0.20+) | (no proxy route yet — the CLI ignores base-URL env vars; per-provider `baseUrl` overrides live in `~/.cline/data/settings/providers.json`, a credentials file only the operator should edit) | JSONL — SQLite session metadata at `~/.cline/data/db/sessions.db` (schema v1, 28 columns) plus per-session `<id>.messages.json` content blocks. Captures `user_prompt` / `assistant_text` / `tool_use` / paired `tool_result` rows + Tier 2 per-API-call token usage from `modelInfo` overrides. Subagent + team linkage via 5 new `ActionMetadata` fields (`ParentSessionID`, `ParentAgentID`, `AgentID`, `IsSubagent`, `TeamName`). 28-tool taxonomy (10 core + 18 `team_*` coordination primitives). WSL2 over `/mnt/c` uses the same `stageMirror` pattern as opencode/kilocode. Tagged `Source=jsonl, Reliability=approximate`. |
273
- | **GitHub Copilot** | (no proxy yet) | JSONL only |
274
- | **OpenCode** ([opencode.ai](https://opencode.ai/)) | (no proxy yet) | SQLite — actual install path is `~/.local/share/opencode/opencode.db` (XDG). Captures **token counts + model + cost** per assistant message from OpenCode's InfoData (`tokens.input/output/reasoning/cache.{read,write}` + `cost`); **subtask** parts → `spawn_subagent` actions; **todo** table → `todo_update` actions; tool-name coverage extended to webfetch/websearch/task/todowrite/todoread/multiedit. Tagged `Source=jsonl, Reliability=approximate`. |
275
- | **OpenClaw** ([openclaw.ai](https://openclaw.ai/)) | (no proxy yet) | JSONL + sqlite — `~/.openclaw/tasks/runs.sqlite` + `~/.openclaw/agents/<agent>/sessions/sessions.json` |
276
- | **Pi** ([pi.dev](https://pi.dev/)) | (no proxy yet) | JSONL — `~/.pi/agent/sessions/--<path>--/*.jsonl` (per upstream `docs/session-format.md` v3). Captures user / assistant / toolResult / `bashExecution` message roles; `usage.cost.total` → per-message USD; terminal `stopReason` (stop/length/error/aborted) → `task_complete` with `success=false` for failures (mid-turn `toolUse` is correctly skipped); `thinking` blocks surface as preceding reasoning. Tagged `Source=jsonl, Reliability=approximate`. |
277
- | **Google Antigravity** | (no proxy yet) | Encrypted protobuf — `~/.gemini/antigravity/conversations/*.pb` (Linux-native) and the matching Windows-side path on WSL2. SuperBased ships a per-OS Chromium-pattern `oscrypt` key fetcher (macOS Keychain / libsecret / DPAPI / WSL2-via-PowerShell helper) and a multi-cipher try-loop for local decryption. Sessions whose ciphers don't validate locally fall back to the language_server's `GetCascadeTrajectory` gRPC endpoint via a built-in helper (`antigravity-bridge.exe` on WSL2 / native gRPC elsewhere) — extracts model + per-turn token counts + Tier 0–6 ToolEvents (file views, artifact edits/writes, user prompts, assistant text, run_command terminal snapshots, structured plan steps, final summaries). State index + per-conversation title/workspace URI read from `state.vscdb` + `state.vscdb.backup`. Tagged `Source=jsonl, Reliability=approximate`. |
278
- | **Kilo Code IDE extension (legacy)** | (no proxy yet) | JSON — `<vsCodeGlobalStorage>/kilocode.kilo-code/tasks/<taskId>/api_conversation_history.json`. The legacy Kilo extension is a Cline + Roo Code fork and shares the Cline parser; emitted rows are re-tagged `Tool="kilo-code"` so dashboard rollups don't blur Kilo activity into Cline. Tagged `Source=jsonl, Reliability=approximate`. |
279
- | **Kilo Code CLI (current)** | (no proxy route yet — base-URL env vars are not honored; a project-scoped `kilo.json` provider `baseURL` override reaches the proxy, but the Gateway provider's model-catalog calls share that base URL and have no upstream there — see `docs/kilo-code-adapter.md`) | SQLite — `~/.local/share/kilo/kilo.db` on every OS (Kilo intentionally mirrors XDG; Windows does NOT use `%APPDATA%`). The new `@kilocode/cli` (npm) is a fork of sst/opencode and uses the same `message`/`part`/`todo` tables shape with Kilo additions (`project`, `workspace`, `event`, `session_message`, `account`, `permission`, `session_share`). Captures **token counts + model + cost** per assistant message from `message.data.tokens = {total, input, output, reasoning, cache: {read, write}}`. Tool name coverage inherits OpenCode's surface (`read` → `read_file`, `bash` → `run_command`, `websearch` → `web_search`, etc.). Tagged `Source=jsonl, Reliability=approximate`. |
280
- | **Gemini CLI** | (no proxy yet) | JSONL or single-object JSON — `~/.gemini/tmp/<hash>/chats/session-*.{json,jsonl}`. Dual-format dispatch: legacy single-object JSON (size-based cursor, cline-style) and proposed JSONL event records (byte-offset cursor, issue [#15292](https://github.com/google-gemini/gemini-cli/issues/15292)). Action mapping covers `read_file` / `write_file` / `edit_file` / `run_command` / `search_files` / `web_fetch` and arbitrary MCP tool calls. Project root falls back through tool-call `cwd` → `~/.gemini/history/<hash>/.git/config` worktree pointer → synthetic `[gemini-cli:<hash>]` key (promoted via ON CONFLICT DO UPDATE on `sessions.project_id` once a future scan supplies a real cwd). Tagged `Source=jsonl, Reliability=approximate`. |
281
- | **Hermes Agent** ([Nous Research](https://github.com/NousResearch/hermes-agent)) | (provider-routed; uses your existing `ANTHROPIC_BASE_URL` / `OPENAI_BASE_URL` when set) | Hooks + SQLite — Python plugin at `~/.hermes/plugins/superbased-observer/` registers `post_tool_call` / `post_api_request` / `on_session_start` / `on_session_end` / `subagent_stop` callbacks (fire-and-forget via `observer hook hermes`); the watcher walks `~/.hermes/state.db` (schema v14, `messages.active = 1` filter) and emits `ToolEvent` + `TokenEvent` rows via `modernc.org/sqlite`. 70+ Hermes tools fold into the normalized action set (`read_file` / `write_file` / `patch` / `terminal` / `search_files` / `web_search` / `web_extract` / `browser_*` / `delegate_task` / `todo` / `clarify` / `memory` + `mcp_call` fall-through). Token bundles lifted from `post_api_request.usage{input/output/cache/reasoning_tokens}`; OpenRouter `:suffix` tails (`:free`, `:beta`, `:fast`) preserved so the dashboard distinguishes paid vs free tiers. Install via `observer init --hermes`; backfill via `observer backfill --hermes-rescan`. Tagged `Source=jsonl, Reliability=approximate`. |
282
- | **Junie** (JetBrains) | (no proxy yet) | Event-sourced JSONL — `~/.junie/sessions/<id>/events.jsonl` on every OS (resumes with `junie --session-id <id>`). Each line is a typed envelope (`SessionA2uxEvent` wrapping `event.agentEvent.kind`); Terminal/FileChanges/Result blocks recur under a stable `stepId` (IN_PROGRESS to COMPLETED/FAILED to a completion rebroadcast) and are collapsed by `stepId`. Captures user prompts, `run_command` / `write_file` / `edit_file` / `task_complete` actions, and per-call **model + NET input tokens + provider-stated cost** from `LlmResponseMetadataEvent.modelUsage[]`. Project root from the session's `CurrentDirectoryUpdatedEvent` with a `sessions/index.jsonl` `projectDir` fallback. Never reads `secure_credentials.json` / `trust/`. Tagged `Source=jsonl, Reliability=accurate`. |
283
-
284
- **JSONL-only** clients are captured passively by the watcher whenever
285
- `observer start` is running. Hooks self-heal on every `start`, so a
286
- fresh install captures the JSONL side without any `init` step. You won't see real-time cost numbers
287
- for them on the Compression tab (those need the proxy), but every tool
288
- call shows up on Sessions / Actions / Discovery / Tools / Patterns and
289
- the JSONL-derived token counts feed the Cost tab. Reliability tagging
290
- is per-adapter: Claude Code emits `unreliable` (the JSONL stream uses
291
- streaming-time placeholder counts per spec §24); Codex / Cline / Cline CLI /
292
- Pi / OpenCode / OpenClaw / Antigravity / Gemini CLI / Hermes / Kilo Code / Kilo Code CLI emit `approximate`
293
- (provider-reported usage that hasn't been reconciled against an
294
- upstream invoice).
295
-
296
- For **Codex specifically**, SuperBased currently has two practical support modes:
297
-
298
- - `Proxy + JSONL`: Codex is routed through `OPENAI_BASE_URL=http://127.0.0.1:8820/v1` and SuperBased can link proxy turns to the session, so live compression metrics are available.
299
- - `JSONL only`: SuperBased can still recover sessions, actions, and approximate token counts from `~/.codex/sessions`, but live proxy compression is currently not available when Codex is logged in with a ChatGPT plan on the local machine.
300
-
301
- ## Architecture in detail
302
-
303
- <p align="center">
304
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/infographics/intelligence-across-tools.png" alt="Shared local intelligence layer across tools" width="780">
305
- </p>
306
-
307
- Five components running side by side:
308
-
309
- ### 1. JSONL adapters (passive ingest)
310
-
311
- Watch `~/.claude/projects/`, `~/.codex/sessions/`,
312
- `~/.gemini/tmp/.../chats/`, `~/.gemini/antigravity/conversations/`
313
- (and the matching Antigravity index `state.vscdb`), etc. for new
314
- session log lines. Normalize per-client tool names to a shared
315
- taxonomy (`read_file`, `run_command`, `spawn_subagent`, …) and write
316
- them into the actions table. Active whenever `observer start` is
317
- running; hooks self-heal on each start so no separate `init` step is
318
- required for capture.
319
-
320
- For Antigravity (which stores conversations as encrypted protobufs),
321
- observer ships a per-OS `oscrypt` key fetcher (Chromium Safe Storage
322
- pattern: macOS Keychain / Linux libsecret + peanuts fallback / Windows
323
- DPAPI / WSL2-via-PowerShell helper) plus a `language_server`-aware
324
- gRPC fallback that calls `GetCascadeTrajectory` through the bundled
325
- `antigravity-bridge.exe` when local decryption can't validate the
326
- ciphertext. Tier 0–6 ToolEvents (file views, artifact edits/writes,
327
- user prompts, assistant text, run_command terminal snapshots,
328
- structured plan steps, final summaries) are extracted from the
329
- trajectory's wire format without committing to specific .proto field
330
- numbers.
331
-
332
- What this gets you: every tool call you've ever run, queryable.
333
-
334
- ### 2. API reverse proxy (active capture)
335
-
336
- A localhost HTTP server (`127.0.0.1:8820`) you point your AI client
337
- at via `ANTHROPIC_BASE_URL` / `OPENAI_BASE_URL`. Intercepts every
338
- request before it hits Anthropic / OpenAI and:
339
-
340
- - Records exact token usage from the upstream `usage` envelope (the
341
- most accurate cost source — proxy beats JSONL parsing here).
342
- - Runs the **conversation compression pipeline** to trim large
343
- `tool_result` blocks and drop low-importance messages before
344
- forwarding upstream.
345
- - Captures the `cost_usd` the upstream reports (when present).
346
-
347
- What this gets you: ground-truth cost numbers and conversation
348
- compression savings you can measure.
349
-
350
- ### 3. SQLite store
351
-
352
- A single file at `~/.observer/observer.db`. Tables include:
353
-
354
- - `projects`, `sessions`, `actions` — the taxonomy
355
- - `api_turns` — one row per proxy-intercepted upstream request
356
- - `token_usage` — JSONL-derived token-row events (deduped via spec §A1)
357
- - `file_state` — content hashes for freshness classification
358
- - `compression_events` — per-event compression detail (post-migration 010)
359
- - `project_patterns` — derived patterns from `observer patterns`
360
- - `failure_context`, `action_excerpts` — diagnostic data
361
-
362
- Pure-Go via `modernc.org/sqlite`, no CGO. WAL mode by default.
363
-
364
- ### 4. Local dashboard (`:8081`)
365
-
366
- Eighteen tabs in four groups — Monitor (Overview, Live, Sessions,
367
- Actions, Trajectories, Evals, Security, Search), Analyze (Cost,
368
- Analysis, Tools), Optimize (Compression, Cache, Suggestions,
369
- Discovery, Patterns), Configure (Privacy, Settings). See
370
- [Dashboard tour](#dashboard-tour).
371
-
372
- A React + TypeScript single-page app (Vite build, Recharts charts),
373
- embedded in the binary and served locally. No analytics, no external
374
- requests.
375
-
376
- ### 5. MCP server (stdio) — opt-in via `observer init`
377
-
378
- 21 read-only tools are always registered — `check_file_freshness`,
379
- `get_last_test_result`, `search_past_outputs`, `search_symbols`,
380
- etc. — plus 4 more (`get_file`, `get_symbols`, `get_relations`,
381
- `retrieve_stashed`) that register conditionally, only when the
382
- capability they depend on (the proxy stash, or the codeintel index)
383
- is actually configured.
384
- Powers cross-client tool sharing: if Claude Code ran `go test`,
385
- Cursor's MCP query for the latest test result will return Claude
386
- Code's run. The code-aware tools (`get_symbols`, `get_relations`,
387
- `search_symbols`) are backed by a native, CGO-free code-intelligence
388
- engine (tree-sitter via wasm) that indexes your repo locally. See
389
- [MCP tools reference](#mcp-tools-reference).
390
-
391
- **Lifecycle**: the MCP server is a stdio subprocess spawned by your
392
- AI tool — not by the observer daemon. It's registered into each AI
393
- client's MCP config only when you run `observer init`. `observer
394
- start` alone does NOT register the MCP server. Adds roughly 1,800
395
- tokens of tool-schema overhead per AI-client turn; opt out with
396
- `observer init --skip-mcp` (registers hooks only) or by simply not
397
- running `init`.
398
-
399
-
400
- ## Dashboard tour
401
-
402
- `observer start` opens the dashboard automatically on interactive
403
- launches (suppress with `--no-open`; the URL is also printed —
404
- `http://127.0.0.1:8081/` by default). Eighteen tabs in four nav groups
405
- (Monitor / Analyze / Optimize / Configure) — the tour below covers the
406
- core surfaces; Live (recent sessions with a real-time action feed),
407
- Trajectories + Evals (OTLP trace/span capture for your own agents),
408
- Search (full-text over captured tool outputs), and Privacy (capture
409
- map + scrub tester) are self-explanatory once you're in. On an empty
410
- database the Overview tab leads with a three-step onboarding
411
- checklist that takes you from zero to your first captured session
412
- without leaving the browser.
413
-
414
- **Just looking?** The empty-database Overview also offers **demo
415
- mode**: one click seeds a temporary synthetic dataset so every chart
416
- and table renders with realistic data — parsed through the real
417
- ingest pipeline into a temp DB; your real `observer.db` is never read
418
- or written. A persistent banner marks demo state, and one click
419
- clears it again. The fastest way to evaluate the dashboard before
420
- routing any real traffic.
421
-
422
- ### Overview tab
423
-
424
- <p align="center">
425
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/01-overview.png" alt="Overview tab" width="900">
426
- </p>
427
-
428
- High-level snapshot of the selected window:
429
-
430
- - **KPI tiles**: Sessions count, API turns (proxy-captured), Token
431
- rows (JSONL-recovered), Failures (24h)
432
- - **Cost over time** chart — daily token volume, split into the four
433
- billable buckets (net input / cache read / cache write / output)
434
- - **Actions over time** chart — total actions vs failures
435
- - **Top models (by tokens)** chart — top-8 models stacked by net
436
- input / cache read / output
437
- - **Top tools (actions over time)** — per-AI-client stacked-area
438
- showing when each client is active
439
-
440
- ### Cost tab
441
-
442
- <p align="center">
443
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/04-cost.png" alt="Cost tab" width="900">
444
- </p>
445
-
446
- Per-model breakdown over the selected window. Tokens split into the
447
- four billing buckets, with computed dollar cost and a reliability
448
- flag. Cost is always computed locally as `tokens × pricing_table[model]`
449
- — neither Anthropic nor OpenAI returns cost in their API responses, so
450
- the proxy can't capture upstream-billed cost. Reliability values:
451
- `accurate` (proxy-captured tokens, exact rate), `approximate` (JSONL-
452
- sourced tokens, rate may be a family-prefix fallback), `unreliable`
453
- (Claude Code JSONL streaming placeholders, ~10% off output), `unknown`
454
- (no pricing entry for the model). Two adapters — OpenCode and Pi —
455
- write their own per-turn cost into `estimated_cost_usd`; the engine
456
- uses those as-is when present. See
457
- `docs/pricing-reference.md` for the rate sheet.
458
-
459
- Hover any column header for tooltip; click for the full definition
460
- in the help drawer.
461
-
462
- ### Analysis tab
463
-
464
- <p align="center">
465
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/05-analysis.png" alt="Analysis tab" width="900">
466
- </p>
467
-
468
- Spending insights for the selected window. Twelve headline KPI
469
- tiles comparing this period to prior: spend Δ%, MTD vs budget with
470
- projection bar, $/M output rate, cache savings + cache efficacy %,
471
- high-context turn count, $/turn, burn rate ($/active hour), top
472
- model concentration %, Discovery waste $, sessions total. Below
473
- the tiles: a daily-spend stacked bar with Model / Project / Tool
474
- dimension toggle, hour-of-day heatmap, top-12 expensive sessions
475
- with explanatory badges (`opus`, `lc_tier`, `many_turns`,
476
- `large_prompt`), period-over-period movers (top increases / decreases
477
- / new entrants), and model right-sizing hints (trivial Opus
478
- sessions that could have used Sonnet).
479
-
480
- ### Sessions tab
481
-
482
- <p align="center">
483
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/02-sessions.png" alt="Sessions tab" width="900">
484
- </p>
485
-
486
- One row per AI-coding session. Each session has a stable ID, a tool
487
- (claude-code / cursor / codex / cline / cline-cli / copilot / copilot-cli /
488
- opencode / openclaw / pi / antigravity / gemini-cli / hermes /
489
- kilo-code / kilo-code-cli), a working-directory project, action
490
- count, sub-agent action count (when the session spawned sub-agents via
491
- the `Agent` tool), per-session **Tokens** and **Cost** columns, and —
492
- if `observer score` has run — quality / errors / redundancy ratios. The `~` suffix on Cost flags rows whose pricing
493
- was tier-fallback rather than billing-grade ("accurate" reliability).
494
-
495
- Click a row to open the session-detail panel:
496
-
497
- <p align="center">
498
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/11-session-detail.png" alt="Session detail slide-over" width="900">
499
- </p>
500
-
501
-
502
- - **Top tiles** — Tool, Started, Actions count (ok/fail), Cost.
503
- - **Action breakdown** — chart of action_type counts.
504
- - **Tokens** — the four billing buckets (Net Input / Cache Read /
505
- Cache Write / Output) for the whole session, per-turn-deduped
506
- (proxy preferred, JSONL fills gaps).
507
- - **Per-model breakdown** — when a session uses multiple models
508
- (Claude Code's main + sub-agent dispatches always do), a row per
509
- model with its tokens and cost.
510
- - **Messages** — per-message timeline keyed on the upstream
511
- Anthropic `msg_xxx`. Each row shows the message id, role, model,
512
- the message's own token bucket, cost, and a `N ▾` pill that
513
- expands inline to show the contained tool calls. Toggle radio at
514
- the top: **Tool messages only** (default — assistant turns with
515
- ≥1 tool call + user prompts) vs **All messages** (also pure-text
516
- assistant replies). Truncated IDs (session_id, message_id)
517
- show a dotted underline on hover and copy the full value to
518
- clipboard on click; truncated text fields (target, error message)
519
- click to expand in-place. Server-side paginated at 50/100/200
520
- messages per page (selectable in the panel footer) — keeps the
521
- browser responsive on multi-thousand-message sessions. Requires
522
- `observer backfill --message-id` on first upgrade for historical
523
- sessions to surface their parent message ids.
524
-
525
- ### Actions tab
526
-
527
- <p align="center">
528
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/03-actions.png" alt="Actions tab" width="900">
529
- </p>
530
-
531
- The flat firehose: every recorded tool call, normalized across
532
- adapters. Filter by action type (`read_file`, `write_file`,
533
- `run_command`, `spawn_subagent`, `todo_update`, `mcp_call`, …).
534
- Pagination caps at 50 rows per page; total count is shown next to
535
- the heading.
536
-
537
- ### Tools tab
538
-
539
- <p align="center">
540
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/06-tools.png" alt="Tools tab" width="900">
541
- </p>
542
-
543
- Per-AI-client (the *client* — claude-code / cursor / codex / etc., not
544
- the per-tool name) aggregates plus three views:
545
-
546
- - **KPI tiles**: Total actions, Distinct tools, Overall success rate,
547
- Busiest tool
548
- - **Activity over time** stacked-area showing per-tool action volume
549
- per day
550
- - **Action-type mix per tool** horizontal stacked bar — what each
551
- tool actually does (read_file vs edit_file vs run_command vs
552
- search_text vs spawn_subagent)
553
- - The full per-tool aggregate table with first/last seen
554
-
555
- ### Compression tab
556
-
557
- <p align="center">
558
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/07-compression.png" alt="Compression tab" width="900">
559
- </p>
560
-
561
- How many tokens and dollars the conversation-compression pipeline
562
- saved by trimming requests before forwarding upstream:
563
-
564
- - **KPI tiles**: Tokens saved (est.), Dollars saved (est.), Bytes
565
- saved, Turns compressed
566
- - **Savings per day** chart — daily tokens-saved (left axis) and
567
- bytes-saved (right axis)
568
- - **Savings by mechanism** stacked bar — segments per mechanism
569
- (json / code / logs / text / diff / html / drop). **Toggle the
570
- y-axis between tokens and bytes** with the chart-header switch.
571
- - **Per-model breakdown table** — tokens saved ~, $ saved ~, bytes
572
- saved, saved %, turns, tool-results compressed, dropped, markers
573
- - **Recent compression events** — paginated per-event detail with
574
- mechanism, original / compressed / saved bytes, message slot, importance
575
- score (for drops), and a **Source** column showing whether the
576
- event came from a main-thread or sub-agent runtime call
577
-
578
- ### Cache tab
579
-
580
- <p align="center">
581
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/08-cache.png" alt="Cache tab" width="900">
582
- </p>
583
-
584
- Anthropic prompt-cache observation, attribution, and forecasting —
585
- how well your sessions are reusing provider-cached prefixes.
586
-
587
- - **KPI tiles**: Cache ratio (cache_read ÷ cache_write tokens; the
588
- headline cache-payback signal), Cache read, Cache write, and
589
- Avoidable spend / Event count. The avoidable-spend tile is the
590
- dollar overhead of cache rewrites that wouldn't have happened on
591
- a perfectly cache-friendly session — it surfaces in warn tone when
592
- non-zero.
593
- - **By model + By project tables** — for each rollup dimension: R%/W%
594
- mix bars + absolute Read / Write / Events + cache Ratio + Avoidable
595
- $. Identifies the model or repo that's pulling the most overhead.
596
- - **Top causes histogram** — proportional bar list of `cache_events.cause`
597
- values. Healthy baseline is `suffix_growth` + `hit` dominating
598
- (info-toned warm prefix growth). Real invalidations (`system_changed`,
599
- `expiry_rewrite`, `model_switch_rewrite`) render in warn tone. Causes
600
- that legitimately fire on real operator toggles — currently
601
- `tools_changed` on MCP server connect/disconnect — render with a
602
- neutral "flagged" pill rather than alarm-red.
603
- - **Worst sessions table** — ranked by rewrite count; click a row to
604
- open the session's Cache panel with the full per-turn timeline.
605
-
606
- #### How the cache data gets captured
607
-
608
- Two capture paths feed the same engine; both write the same three
609
- local-only tables (`cache_segments`, `cache_entries`, `cache_events`;
610
- migrations 036 + 037 — node-local only, never leaving the machine, pinned by
611
- `tests/invariant/privacy_test.go::TestSelectUnpushedSinceExcludesCacheTables`):
612
-
613
- 1. **Tier-1 (proxy)** — point your AI client at the local proxy
614
- (`ANTHROPIC_BASE_URL=http://127.0.0.1:8820` for Claude Code;
615
- `OPENAI_BASE_URL=http://127.0.0.1:8820/v1` for codex and
616
- copilot-cli). The proxy reads the upstream usage envelope
617
- (`cache_read_input_tokens` + `cache_creation_input_tokens`) and the
618
- cachetrack engine attributes each turn live as it streams. Every
619
- claude-code prompt-cache event surfaces here in real time.
620
- 2. **Tier-2 (transcript watcher)** — the watcher tails claude-code
621
- JSONL transcripts and feeds the same engine retroactively for
622
- sessions that didn't route through the proxy. Run
623
- `observer backfill --cache-rescan` to retrofit pre-cachetrack
624
- history.
625
-
626
- #### How to enable / disable
627
-
628
- - **Default-on.** Per spec §11, the loader merges `[cachetrack].enabled = true`
629
- if the section is absent. No action needed for a fresh install.
630
- - To disable: set `[cachetrack].enabled = false` in
631
- `~/.observer/config.toml` and restart `observer start`.
632
- - Inspect engine health: `observer cache-health --json` — §10 grading
633
- gate + read:write consistency + cause-concentration WARNs.
634
- - 90-day retention is on by default
635
- (`[cachetrack].retention_days = 90`); the maintenance tick prunes
636
- stale `cache_*` rows alongside the existing retention pass.
637
-
638
- Operator reference: [superbased.app/docs/guides/cache-tracking](https://superbased.app/docs/guides/cache-tracking).
639
-
640
- ### Suggestions tab
641
-
642
- The **advisor** — a prescriptive suggestions engine that turns the
643
- window's captured activity into ranked, dollar- or minute-quantified
644
- recommendations. **On by default** and entirely local: detectors are
645
- pure reads over data the observer already stores, recomputed fresh on
646
- every view — zero LLM calls, zero network.
647
-
648
- Nineteen detectors across four categories:
649
-
650
- - **cost** — session balloons (one session's context growth dominating
651
- spend), idle re-cache (cache rewrites after idle gaps), long-context
652
- tier crossings, trivial sessions on expensive models, cache hit-rate,
653
- cache-write waste, prefix thrash, read-heavy sessions on expensive
654
- models, effort overprovisioning, cross-session stale reads,
655
- web-search spend, spend spikes ("today is 3× your daily average" —
656
- the while-it's-still-happening check, linking to the Live view).
657
- - **latency** — fast-tier premium (sessions that paid the 2× fast-tier
658
- rate without needing it).
659
- - **quality** — unrecovered failures, quality regressions.
660
- - **hygiene** — MCP schema overhead vs. actual MCP calls, compression
661
- off while proxied traffic flows, capture running without proxy
662
- routing, guard observing idle (recurring high-severity verdicts
663
- with zero approvals or tuning — linking to the Security page).
664
-
665
- Each card carries the quantified claim ($ or minutes, with a
666
- **show math** toggle exposing the arithmetic), a confidence score, a
667
- scope chip (window / project / session — session scopes deep-link to
668
- the session detail), and — when a dashboard control can fix the
669
- finding — an action button that navigates to the right surface
670
- (writes only ever happen behind that surface's own consent flow).
671
- `snooze 7d` quiets a card temporarily; `dismiss` retires it, with a
672
- 7-day cooldown so the same finding doesn't re-nag. The all-clear
673
- state means exactly what it says: nothing worth nagging about in
674
- this window.
675
-
676
- Tune it under Settings → Advisor (`[advisor]` in config.toml):
677
- evidence window (default 14 days), confidence floor (0.5), minimum
678
- claimed savings ($1), and the opt-in **session digest** — when
679
- `session_digest = true`, the Claude Code session-start hook injects a
680
- ≤400-token digest of the top suggestions into new sessions (off by
681
- default; the hook only reads a pre-computed snapshot, refreshed every
682
- 30 minutes). CLI twin: `observer advise`.
683
-
684
- ### Discovery tab
685
-
686
- <p align="center">
687
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/09-discovery.png" alt="Discovery tab" width="900">
688
- </p>
689
-
690
- Wasted-effort signals:
691
-
692
- - **Stale rereads** — files re-read after they changed inside the
693
- same session. KPI tiles show count, ~Tokens wasted, ~$ wasted (at
694
- your blended input rate), affected files. The **CROSS-THREAD**
695
- column flags re-reads that crossed the parent ↔ sub-agent
696
- boundary — these are the "pass content via Agent's prompt
697
- parameter" candidates.
698
- - **Repeated commands** — commands run multiple times with no
699
- relevant inputs changed in between (e.g. you ran `go test` three
700
- times without editing anything between runs).
701
- - **Cross-tool overlap** — files touched by ≥2 AI clients in the
702
- window (e.g. claude-code AND cursor both edited `auth.ts`). This
703
- is the visible side of cross-platform tool-call sharing via the
704
- MCP server.
705
-
706
- ### Patterns tab
707
-
708
- Repeatable behaviours the observer noticed across your sessions —
709
- "after running `go test`, you almost always run `go vet`", "when
710
- working on `auth.ts`, you also touch `login.tsx`", etc. Each pattern
711
- has a confidence score (decay-weighted: more observations + recent
712
- observations push it higher) and an observation count.
713
-
714
- `observer patterns` derives them; `observer suggest` writes the
715
- high-confidence ones into `CLAUDE.md` / `AGENTS.md` / `.cursorrules`
716
- so new sessions inherit your habits.
717
-
718
- ### Security tab
719
-
720
- The guard layer's operating surface — not just a verdict viewer.
721
- Posture tiles (mode, verdict counts, audit-chain check) over a
722
- filterable verdict timeline (rule / severity / decision / session,
723
- with rule IDs resolved to their full definitions), then the routine
724
- workflows end to end: a consent-gated **mode control** that shows the
725
- simulate evidence before you flip enforce, the **enforce-readiness
726
- card** (a replay of your real history under the enforce projection,
727
- with per-rule blocking concentration), the **approvals register**
728
- (scoped, expiring exceptions — DB writes, live immediately), a
729
- **lint-gated policy editor** for your user rules (malformed files are
730
- refused with the problems listed; `.bak` undo), **budget guardrails**
731
- suggested from your own observed spend with a daily burn-down meter,
732
- MCP pin approvals, and one-click **compliance evidence** downloads
733
- (report / JSONL / CEF / audit verification).
734
-
735
- ### Settings tab
736
-
737
- <p align="center">
738
- <img src="https://github.com/superbasedapp/observer/raw/main/docs/assets/screenshots/10-settings.png" alt="Settings tab" width="900">
739
- </p>
740
-
741
- Fully editable visual editor for everything in `config.toml`, plus
742
- the operational panels a config file can't express:
743
-
744
- - **Config sections** — schema-driven forms for Watcher, Freshness,
745
- Retention, Hooks, Proxy, Compression, Intelligence, Advisor, Cache
746
- tracking, Secrets scrubbing, MCP, Profiles, Org share, and OTel.
747
- Each section is honest about reload semantics: pricing and profile
748
- changes apply hot, MCP settings apply to the next AI session, and
749
- restart-gated sections raise a persistent restart-pending banner
750
- that names the exact command and clears itself only when the
751
- daemon actually restarts.
752
- - **Connected tools** — one row per detected AI client (detected /
753
- capturing / hooks / MCP / proxied), a per-tool setup wizard that
754
- previews every config write and applies each one only on its own
755
- consent click, and a Launch button (with a copy-paste fallback)
756
- for opening a routed session.
757
- - **Health** — the full `observer doctor` check set with remediation
758
- hints, plus recent command failures (recovered vs not).
759
- - **Backfill** — every `observer backfill` mode as a click-to-run
760
- job with live streamed output, plus a full-rescan card with an
761
- adapter picker.
762
- - **Storage** — what's actually taking the space: per-table database
763
- size breakdown (index and FTS5 shadow-table bytes folded into the
764
- table they serve), vacuum and online backup as click-to-run jobs,
765
- and the documented restore procedure (restore is deliberately
766
- manual: stop the daemon, swap the file, start). CLI twin:
767
- `observer db stats|vacuum|backup`.
768
- - **Config file card** — view the active file; one-click restore of
769
- the automatic `.bak` taken before every save.
770
-
771
- ### Help drawer
772
-
773
- Press `?` anywhere on the dashboard or click the **? Help** button in
774
- the topbar. Every column header, KPI tile, chart label, and filter
775
- control on every tab is annotated — hover any element to see a
776
- one-liner tooltip; click to open the drawer at the matching glossary
777
- entry.
778
-
779
- The drawer has full descriptions, formulas, data sources, examples,
780
- "why it matters", "what to do", and cross-links. Search at the top.
781
- Deep-linkable via URL fragment — `#help/metric.stale_count` opens
782
- the drawer at that entry.
783
-
784
- Each compression mechanism (json / code / logs / text / diff / html
785
- / drop) has a "Full methodology · see more" expandable section
786
- explaining the actual algorithm.
787
-
788
-
789
- ## Terminals — launch, join, and track your AI CLIs
790
-
791
- The dashboard is also a terminal host. Instead of tracking your AI
792
- CLIs from the outside, you can launch them *inside* observer, watch
793
- their live telemetry alongside the session they produce, and — new in
794
- v1.25.0 — join a running one from a second browser tab. The terminal
795
- surfaces are read-only where they touch your files and single-writer
796
- where they touch your keyboard; nothing here mutates a repo or lets
797
- two people type at once.
798
-
799
- ### Launch any supported AI CLI as a real terminal
800
-
801
- Twenty-seven CLI launchers — claude, codex, opencode, cursor, copilot-cli,
802
- kilo, cline-cli, hermes, gemini, openclaw, pi, antigravity, qwen,
803
- kiro, grok, kimi, devin, qoder, goose, droid, open-interpreter,
804
- command-code, muse, prime-agent, zcode, vibe (mistral-code), freebuff —
805
- start from the dashboard's
806
- **Launch here** control or from the command line as `observer <verb>`
807
- (`observer claude`, `observer codex`, and so on). Each opens a **real
808
- PTY** — a native pseudo-terminal on Linux and macOS, and a native
809
- ConPTY on Windows 10 1809+ and Windows 11 (no WSL required). If the
810
- tool's binary isn't on your `$PATH`, the launcher offers a guided
811
- one-click install rather than failing. Dashboard launching is gated by
812
- `[handoff].allow_dashboard_launch` (default `true`).
813
-
814
- (The count is twenty-seven *launchers*, not the adapter count — observer
815
- tracks 40 adapters in total, but only these twenty-seven ship a
816
- first-class terminal launcher.)
817
-
818
- ### Attach-by-default
819
-
820
- As of v1.25.0, `observer <verb>` runs the child **daemon-owned** so the
821
- dashboard can join it, while the native terminal you launched from stays
822
- fully interactive as seat #1 — you lose nothing by getting the extra
823
- reach. Opt out per-run with `--no-attach`, or globally with
824
- `[terminal.attach].default_on = false`; scripted or piped runs never
825
- attach.
826
-
827
- A daemon-owned child forwards more than the routing above: it also
828
- carries over your shell's values for each tool's
829
- registry-documented credential env keys — `ANTHROPIC_API_KEY` for
830
- claude-code, `OPENAI_API_KEY` for codex and pi, `OPENROUTER_API_KEY`
831
- for hermes, `XAI_API_KEY` for grok, `GEMINI_API_KEY`/`GOOGLE_API_KEY`
832
- for gemini-cli, `COPILOT_PROVIDER_API_KEY` for copilot-cli, and others
833
- with registry-documented key envs — so a shell-exported API key works
834
- under attach exactly as it would bare. This is gated by
835
- `[terminal.attach].forward_auth_env` (default `true`); values transit
836
- the owner-only attach socket once per launch and are never logged or
837
- persisted. One honest caveat remains: tools without a registry-documented
838
- credential env (config-file, OAuth, or keychain auth) still see only
839
- the **daemon's** environment, and dashboard-launched terminals always
840
- do (there's no client shell to forward from) — for those, either
841
- export the credential where `observer start` runs, or use
842
- `--no-attach` to keep the child in your shell's environment.
843
-
844
- ### Jump in — multi-seat terminals
845
-
846
- Every live daemon-owned run is joinable from any dashboard tab, whether
847
- that tab is local or a paired remote device, as an extra seat. A
848
- terminal holds up to **8 viewers** but exactly **one writer** at a time.
849
- The writer lease moves seamlessly across the native terminal, a local
850
- dashboard tab, and a remote dashboard tab — type into the native
851
- terminal to reclaim it; an authenticated remote can take over with a
852
- read-only fallback and a take-back for the seat it displaced. A freshly
853
- launched run correlates to its observer session in roughly 10–30
854
- seconds, after which its live telemetry lines up with the captured data.
855
-
856
- ### Per-terminal Files & Git panels
857
-
858
- Each AI-tool terminal carries a read-only **Files** panel — a file tree
859
- plus a text viewer rooted at that terminal's project root — and a
860
- read-only **Git** panel showing branch, upstream, ahead/behind counts,
861
- working-tree status, and a 100-commit log. Right-click to copy a path or
862
- paste it into a live terminal. This is a read-only view in v1: no file
863
- mutations, no diff view.
864
-
865
- ### Session Cockpit
866
-
867
- Toggle the **⊙ Session** control on any AI-tool terminal for a
868
- draggable, live panel of everything observer knows about that run:
869
-
870
- - **Last activity** and **tokens/sec**, tagged with a measured-vs-
871
- estimated badge
872
- - **Live cost** with the AI-vs-tool split, plus the **next-message
873
- cost band**
874
- - **Context fill** against the model's context budget, and — for
875
- proxy-routed sessions — the **5h / 7d rate-limit gauge**
876
- - **Prompt-cache expiry chips** for the caches this session is keeping
877
- warm
878
- - **CPU / memory / disk sparklines** and the spawned-process tree for
879
- the terminal
880
- - The **last five turns**, each deep-linked into the full session
881
- detail view
882
-
883
- ### Workspace grid
884
-
885
- Run up to **9 concurrent tiles** (`[terminal].max_concurrent`),
886
- drag and resize them, and your layout persists across reloads. On a
887
- paired remote device the grid is read-only.
888
-
889
- ### Restarts & continuity
890
-
891
- Twenty-six of the twenty-seven launchers **auto-resume the same
892
- transcript** after a daemon restart — a verified native resume, so the
893
- conversation continues where it left off. openclaw is the sole holdout:
894
- its resume is picker-only, so its attached session ends when the daemon
895
- restarts. To pick any session back up — including openclaw's — fork it
896
- with `observer <verb> --continue-from <session-id>`. That opens a new
897
- session id and seeds a distilled handover of the prior session as its
898
- first prompt — it works for all twenty-seven launchers.
899
-
900
- ### Remote posture
901
-
902
- Remote terminal access is opt-in, **tailnet-only** (served over your
903
- private Tailscale network as private HTTPS), and off by default — there
904
- is no public-internet exposure. It splits into a view tier and an
905
- execute tier: `[remote].allow_terminal` (default `false`) governs remote
906
- *keyboard* control, while `[remote].allow_terminal_view` (default
907
- `true`) governs read-only viewing. Pairing is phone-first via QR code,
908
- and the dashboard is mobile-friendly for checking in from a phone.
909
-
910
-
911
- ## MCP tools reference
912
-
913
- Once you've run `observer init` (it's opt-in — `observer start`
914
- alone does NOT register the MCP server), every connected AI client
915
- gets 21 tools registered as an MCP server always, plus 4 more
916
- (`get_file`, `get_symbols`, `get_relations`, `retrieve_stashed`) that
917
- register conditionally, only when the capability they depend on is
918
- actually configured. They're **read-only** queries against the
919
- unified database, so any agent can read any other agent's recorded
920
- work — true cross-platform tool-call sharing.
921
-
922
- | Tool | Purpose |
923
- |-----------------------------------|---------|
924
- | `check_file_freshness` | Has this file been read in the current session? Has it changed since? |
925
- | `get_file_history` | Full read/edit history of a file across all sessions and clients |
926
- | `get_session_summary` | Roll-up stats for a session: action count, success rate, cost, token buckets |
927
- | `search_past_outputs` | Full-text search across recorded tool outputs (FTS5-indexed) |
928
- | `get_last_test_result` | Most recent `go test` / `npm test` / `pytest` etc. output |
929
- | `get_failure_context` | Recent failures: which command, which file, which session |
930
- | `get_action_details` | One specific action's full record (target, args, output excerpt) |
931
- | `check_command_freshness` | Has this command been run in the current session? With what result? |
932
- | `get_session_recovery_context` | Recent activity for resuming a paused session |
933
- | `get_project_patterns` | High-confidence patterns derived from this project's history |
934
- | `get_cost_summary` | Daily / per-model / per-session cost rollups |
935
- | `get_redundancy_report` | Stale rereads, repeated commands, cross-tool overlap for the project |
936
- | `list_actions_around` | ±N actions adjacent to a pivot `action_id` — browse a session's local timeline cheaply |
937
- | `search_symbols` | Fuzzy symbol search across the project's codeintel index (Tier-C) |
938
- | `get_output_composition` | Code vs. explanation split of a session's output, by bytes, with the code:explanation ratio and languages used |
939
- | `get_suggestions` | Top dollar/time-quantified cost & quality suggestions from the local advisor |
940
- | `cache_status` | Live prompt-cache health: which caches are warm, expiring, or cold, with value-at-risk |
941
- | `get_model_recommendation` | Evidence-backed model suggestion per turn-kind, from the local Model Value Report |
942
- | `get_routing_status` | Model-routing layer state: phase, available policy templates, tier-table size, decision-log counters |
943
- | `continue_session` | A distilled, scrubbed handover of a session from another AI tool, so you can continue its work here |
944
- | `get_session_message` | One full, un-excerpted message from a session's transcript — pulls the complete body a handover excerpt truncated |
945
- | `get_file` _(conditional)_ | The file's current bytes (or at a given commit), with a path-safety gate + audit |
946
- | `get_symbols` _(conditional)_ | Resolve a symbol name + range to its file path + body (codeintel-backed) |
947
- | `get_relations` _(conditional)_ | Codeintel BFS — who calls / is called by this symbol |
948
- | `retrieve_stashed` _(conditional)_| Pulls original bytes of a tool_result the proxy compressed away. Only registered when `[compression.conversation].stash` is configured. |
949
-
950
- **Cost trade-off**: with the MCP registered, the AI client sends the
951
- full tool-schema payload (~7.2 KB / ~1,800 tokens) in its system
952
- context on every turn — whether or not the model actually invokes
953
- any tool. To eliminate this overhead, run `observer init --skip-mcp`
954
- (registers hooks only) or skip `init` entirely.
955
-
956
- **Cross-tool sharing**: when `observer init` registers the MCP server
957
- with Claude Code AND Cursor (and Codex…), all of them call the same
958
- tools against the same database. Cursor's `get_last_test_result`
959
- returns Claude Code's last test run; Codex's `check_file_freshness`
960
- reflects edits made by Cursor.
961
-
962
-
963
- ## Sign in and Cloud Intelligence (beta, experimental)
964
-
965
- Optional, opt-in, and **beta (experimental)**. Nothing is sent anywhere
966
- unless you run `observer cloud login` and enrol a session yourself -
967
- the `observer cloud` CLI is the only outbound trigger, and it touches
968
- the network only while one of its commands is running. **Signed-in
969
- Free** gives up to 20 session enrichments per day (100 per month) on
970
- GPT-5.6 Luna (xhigh reasoning). **Plus (beta)** runs enrichments on
971
- GPT-5.6 Sol (xhigh reasoning), capped at 120 per month, USD 15/month
972
- with a 7-day trial. An enrichment returns a narrative summary of the
973
- session: what was done, which plans were implemented, which issues or
974
- bugs were found, what failed, and what to do next. Behaviour,
975
- allowances, and pricing may change. The local daemon - proxy, watcher,
976
- dashboard, MCP - needs no account and is unaffected by any of it. Full
977
- detail: [`docs/cloud-intelligence.md`](https://github.com/superbasedapp/observer/blob/main/docs/cloud-intelligence.md).
978
-
979
-
980
- ## Compression mechanisms
981
-
982
- The conversation-compression pipeline runs inside the proxy on every
983
- upstream request. It tries to fit the request body within
984
- `target_ratio × original_bytes` (default 0.85) without breaking the
985
- conversation's referential integrity.
986
-
987
- Two passes, in order:
988
-
989
- ### Pass 1 — per-content-type compression
990
-
991
- Each `tool_result` block is sniffed for content type, then routed to
992
- a content-aware compressor. Six compressors:
993
-
994
- | Mechanism | What it does | When it fires |
995
- |-----------|--------------|---------------|
996
- | **json** | Replaces every scalar value with a type sentinel (`"<string>"`, `"<number>"`, …) preserving structure (keys, arrays, nesting). Arrays of length > 1 collapse to one element with `_len: N`. | API responses, structured logs, telemetry exports. JSON tool_results are usually the biggest savings target. |
997
- | **code** | Heuristic skeleton: keeps top-of-file imports + signature lines (function / method / class / struct / interface / type), drops bodies. | Source code files. **On by default** as of v1.7.23 in the `claude-code` profile (V7-24 empirical winner). |
998
- | **logs** | Two-pass: collapses adjacent identical lines to `<line> [×N]`, then head+tail-truncates to 200 lines if still long. | Log-shaped output — `go test ./...`, `npm run build`, polling/retry loops. Lossless on distinct lines; only the truncate pass is lossy. |
999
- | **text** | Catch-all for content not classified as code/json/logs/diff/html. Head+tail truncation: keeps 40 + 40 lines on inputs over 80 lines. | Markdown bodies, README excerpts, narrative descriptions. |
1000
- | **diff** | Strips unified-diff context beyond ±1 line of each change. Keeps every header, every `+`/`-` line, drops the rest with elision markers. | `git diff`, patch tool outputs. Lossless on changes; lossy only on the cheap-to-rebuild context. |
1001
- | **html** | Three regex passes: strips `<script>`, `<style>`, and HTML comments. Tag attributes + visible text + structural elements survive. | `web_fetch` results pulling whole HTML pages — usually 80%+ scripts/styles. |
1002
-
1003
- ### Pass 2 — drop with marker
1004
-
1005
- If Pass 1's compressed body is still over budget, the budget enforcer
1006
- ranks remaining messages by **importance score** (a deterministic
1007
- weighted sum) and drops the lowest-scored non-preserved ones until
1008
- the budget is met. Each dropped message is replaced by a single
1009
- marker block (a placeholder text) so the conversation flow stays
1010
- intact for the model.
1011
-
1012
- **Importance score** = `0.4 × recency + 0.3 × reference + 0.15 × density + 0.15 × role`
1013
-
1014
- - **Recency** = `(i+1) / n` — newest message scores 1.0, oldest scores 1/n
1015
- - **Reference** = `1.0` if any of the message's `tool_use_ids` is
1016
- cited by a later `tool_result`, OR any of its `referenced_ids` points
1017
- to a live tool_use; `0.0` otherwise. Tool-pair-live messages always
1018
- get full weight regardless of position.
1019
- - **Density** = fraction of non-whitespace runes (whitespace-padded
1020
- outputs get dropped first)
1021
- - **Role** = `system 1.0`, `user 0.9`, `assistant 0.7`, `tool 0.5`
1022
- (tool outputs are the most-compressible by policy)
1023
-
1024
- **Preserved messages** (never droppable):
1025
- - The last `PreserveLastN` messages (default 4)
1026
- - Any `system` role message
1027
- - **Tool-pair-live messages**: any message whose `tool_use_id` is
1028
- referenced by a later tool_result (parent side), AND any
1029
- `tool_result` message whose `referenced_id` points to a live
1030
- tool_use (consumer side)
1031
-
1032
- Tool-pair preservation is symmetric — dropping either side leaves an
1033
- orphan that Anthropic rejects with 400.
1034
-
1035
- ### Per-event detail
1036
-
1037
- Every drop and every per-type compression is recorded as a row in
1038
- the `compression_events` table (post migration 010). The Compression
1039
- tab's "Recent compression events" view surfaces these with
1040
- mechanism, original / compressed / saved bytes, message slot, and
1041
- importance score (for drops).
1042
-
1043
- ### Tuning — profiles pick the parameters for you
1044
-
1045
- Compression parameters are supplied by **profiles**: named parameter
1046
- sets resolved per traffic class at the proxy boundary. The moment you
1047
- enable compression, Anthropic-path traffic gets the `claude-code`
1048
- profile and OpenAI-path traffic gets `codex-safe` — each tool gets
1049
- its tuned parameters simultaneously; there is no recipe-picking step.
1050
- Inspect with `observer profile list` / `observer profile show
1051
- <name>`; reassign per class or per tool (`observer profile assign
1052
- openai codex-variant`, `observer profile assign tool:kilo-code-cli
1053
- codex-safe`); build your own (`observer profile create mine --from
1054
- claude-code`, or Settings → Profiles in the dashboard). Per-tool
1055
- assignment needs the proxy to identify the connecting tool: hook-fed
1056
- identity (Claude Code) is exact, and Codex, Kilo CLI, opencode, and
1057
- Claude Code are also recognized by their request headers; clients
1058
- that send no distinctive headers (e.g. Cline CLI) fall back to the
1059
- per-provider profile. Profile
1060
- edits apply to **new sessions without a daemon restart**. A repo can
1061
- also carry `<root>/.observer/config.toml` with `[profiles]` /
1062
- `[compression]` keys to override per project — project files can turn
1063
- compression *off* for their traffic, never on.
1064
-
1065
- The master config (`~/.observer/config.toml`) keeps the one on/off
1066
- switch and the fallback parameters used by the `default` profile:
1067
-
1068
- ```toml
1069
- [compression.conversation]
1070
- enabled = true # THE switch — profiles never flip this
1071
- mode = "cache_aware" # "token" | "cache" | "cache_aware" — default cache_aware; see matrix below
1072
- target_ratio = 0.85
1073
- preserve_last_n = 5 # never drop the most recent N messages
1074
- compress_types = ["json", "logs", "code"] # default; add "text", "diff", "html" to opt in
58
+ observer start # proxy + watcher + dashboard; opens http://localhost:8081
59
+ observer scan # backfill history from the session logs already on disk
60
+ observer doctor # check the install
1075
61
  ```
1076
62
 
1077
- High importance scores on dropped events (≥0.5) suggest the threshold
1078
- is too aggressive — raise `target_ratio` (e.g. 0.9 or 0.95).
1079
-
1080
- ### Choosing a mode: Anthropic vs Codex
1081
-
1082
- Per-type `tool_result` compression runs in every mode; `mode` only changes how
1083
- messages are dropped and whether an Anthropic `cache_control` marker is injected.
1084
-
1085
- | `mode` | What it does | Claude Code (Anthropic) | Codex / OpenAI |
1086
- |---|---|---|---|
1087
- | `token` | Per-type compress, then drop lowest-scored messages to hit `target_ratio`. | ✅ Works. | ✅ Clearest choice for Codex/OpenAI. |
1088
- | `cache` | Restrict drops to the tail half + inject a `cache_control` marker at the prefix boundary. | ✅ Anthropic-specific. | ⚠️ No effect beyond `token`. |
1089
- | `cache_aware` *(default)* | Skip drops, narrow compression to `tool_result` blocks, no marker; keep history byte-stable across turns so Anthropic's prefix cache keeps hitting. | ✅ **Recommended for Anthropic Pro/Max** — and the shipped default. | ⚠️ No effect beyond `token`. |
1090
-
1091
- The shipped default is `cache_aware` (`token` is just the internal fallback when
1092
- `mode` is empty). The cache modes exist for **Anthropic's content-hash prefix
1093
- cache** (`cache_control` is an Anthropic Messages API concept). OpenAI/Codex
1094
- prompt caching is **automatic and server-side** — nothing to mark or tune, so
1095
- the proxy's OpenAI path is mode-agnostic (the default `cache_aware` behaves like
1096
- `token` there). So: keep `cache_aware` for Claude Code; `mode = "token"` reads
1097
- honestly for a Codex/OpenAI-only setup.
1098
-
1099
- Beyond the keys above, three opt-in sub-features have their own tables —
1100
- `[compression.conversation.stash]` (Compressed-Content Retrieval),
1101
- `[compression.conversation.rolling]` (rolling summarisation, with a per-provider
1102
- summary model: `summary_model` for Anthropic, `openai_summary_model` for
1103
- OpenAI/Codex), and `[compression.conversation.compaction]`. The full knob
1104
- reference lives in `docs/compression-modes.md`.
1105
-
1106
- ### Measured savings (v1.7.23)
63
+ For provider-exact tokens, route your agent through the proxy: in the dashboard open Compression,
64
+ click your tool's status pill and choose **Route through the observer proxy** (it previews the
65
+ config change and writes only when you confirm), or run `observer claude` / `observer codex` for a
66
+ one-off proxied session. `observer init` additionally registers the opt-in MCP server.
1107
67
 
1108
- We A/B every shipped profile against an OFF baseline on a real refactor
1109
- workload (`lumen` TypeScript codebase, 408-line Zustand store →
1110
- 4 domain sub-stores) on the v1.7.22 binary tip. The numbers below are
1111
- the **most recent statistically-meaningful measurements**.
68
+ ## What you get
1112
69
 
1113
- The first two profiles are what the per-provider auto-assignment
1114
- applies (Anthropic → `claude-code`, OpenAI → `codex-safe`);
1115
- `codex-variant` is the manual pick for `-codex`-family models:
70
+ - A local dashboard for sessions, cost, cache, security and live activity, filterable by tool and
71
+ project.
72
+ - Cost per session, model, project and tool, with cache read/write splits down to each API turn.
73
+ - An opt-in MCP server so your agents can query their own history across tools.
74
+ - Waste detection: stale re-reads, repeated commands and files several agents fight over.
75
+ - Dashboard terminals with multi-seat join and native resume.
76
+ - A CLI for everything: `observer usage`, `cost`, `predict`, `tail`, `statusline`.
1116
77
 
1117
- | Profile | Use when your model is… | Workload | n | Δ vs OFF (mean cost) | What's compressed |
1118
- |---|---|---|---|---|---|
1119
- | **`claude-code`** *(default)* | Any Anthropic Claude model — `claude-sonnet-4-6`, `claude-opus-4-7`, `claude-haiku-4-5`, … | Refactor, Claude Sonnet 4.6 via Claude Code 2.1.158 | n=8 B vs n=4 OFF | **−6.9%** (CV 7.6%; tighter than OFF's 7.5%) | json + logs + code bodies + tool-defs trim (A2-adopted 2026-06-11: −12.5% vs the pre-A2 set, zero `tools_changed` cache events); cache-aware; stash disabled |
1120
- | **`codex-variant`** | OpenAI's `-codex` reasoning fork — `gpt-5.3-codex`, `gpt-5.4-codex`, `gpt-5-codex-agent`, anything matching `*-codex*` | Refactor, gpt-5.3-codex | n=10 B vs n=10 OFF | **−10%** ($0.270 vs $0.300) | Tools-defs trim; cache-aware; no per-type compression |
1121
- | **`codex-safe`** | Plain OpenAI GPT under the codex CLI — `gpt-5.4`, `gpt-5.4-mini`, `gpt-5.5`, `gpt-4o`, any non-`-codex` | Refactor, gpt-5.4 + `apply_patch` | n=3 B vs n=4 OFF | not statistically distinguishable on this workload | logs + tools-defs trim (A6-adopted 2026-06-11: fired on 117/117 candidate requests, ~0.8KB/request of definition prose, task-completion parity + no cache degradation at n=9 vs n=7; effect scales with envelope bulk — MCP-registered installs save more); token mode |
78
+ ## Privacy
1122
79
 
1123
- The word **"variant"** in `codex-variant` refers to the *model variant* (the `-codex` reasoning fork of GPT), NOT a variant of the codex CLI. Both codex profiles are for the codex CLI; they differ only in which model family they assume. `codex-safe` is so named because plain GPT models tolerate logs trimming safely — it's not "safer than codex-variant."
80
+ No telemetry and no account. SuperBased stores paths, commands and short excerpts, scrubs secrets
81
+ before writing, and binds the proxy and dashboard to `127.0.0.1` by default. The proxy forwards your
82
+ own requests, unchanged, to the provider you already use. See
83
+ [PRIVACY.md](https://github.com/superbasedapp/observer/blob/main/PRIVACY.md).
1124
84
 
1125
- **Honest caveats:**
1126
-
1127
- - **Workload-dependent.** The `codex-safe` row on gpt-5.4 was
1128
- inconclusive because the test workload used `apply_patch` (classified
1129
- as `code`, not `logs`) so `compress_types=["logs"]` never fired —
1130
- the proxy was a functional no-op and the cost variance was session
1131
- noise. A Bash-heavy workload would tell a different story.
1132
- - **`claude-code` requires `ENABLE_TOOL_SEARCH=true`** in your shell.
1133
- Without it, Claude Code's SDK disables ToolSearch under
1134
- `ANTHROPIC_BASE_URL` and eager-inlines all MCP schemas (~+21K
1135
- tokens per turn). The proxy then becomes a net loss instead of
1136
- the −6.9% above. Setup steps cover this; verify with
1137
- `printenv ENABLE_TOOL_SEARCH`.
1138
- - **`stash` stays disabled by default for Anthropic** (V7-25 finding:
1139
- +25% cost on n=1 due to prefix-cache miss; stash markers break
1140
- Anthropic's content-hash cache). Operators can opt in for a measured
1141
- workload but should A/B their own.
1142
- - **Historic claims of higher savings are retracted.** The v1.4.38
1143
- release notes cited −14.8%; the project itself walked that back
1144
- after a deeper repro showed it was within noise. The numbers above
1145
- are the post-retraction floor.
1146
-
1147
- **Reproduce it yourself:** the numbers above are workload-specific, not a
1148
- guarantee — A/B your own traffic with `observer profile show <name>` and
1149
- an OFF-baseline comparison before relying on any of them in production.
1150
-
1151
-
1152
- ## Cost and token math
1153
-
1154
- Anthropic's usage envelope reports four token buckets per request,
1155
- each at a different rate:
1156
-
1157
- | Bucket | What it is | Bills at |
1158
- |--------------------|------------------------------------------------------------------------------|-----------------------------|
1159
- | `net_input` | Fresh prompt tokens not served from cache | model's standard input rate |
1160
- | `cache_read` | Prompt tokens served from Anthropic's ephemeral cache | ~10% of input rate |
1161
- | `cache_creation` | Tokens written to ephemeral cache | 1.25× input (5m tier) or 2× input (1h tier) |
1162
- | `output` | What the model generated | typically 5× input rate |
1163
-
1164
- `prompt_context = net_input + cache_read + cache_creation`
1165
- `total_tokens = prompt_context + output`
1166
-
1167
- The cost engine (`internal/intelligence/cost`) computes USD via:
1168
-
1169
- ```
1170
- cost_usd = (net_input × p.input + cache_read × p.cache_read +
1171
- cache_creation_5m × p.cache_creation +
1172
- cache_creation_1h × p.cache_creation_1h +
1173
- output × p.output) ÷ 1,000,000
1174
- ```
1175
-
1176
- When the upstream API returns `cost_usd` in the response envelope
1177
- (proxy-sourced rows), that value is preferred over the computed one —
1178
- ground truth, reliability=high.
1179
-
1180
- ### Blended input rate
1181
-
1182
- The Discovery tab's "~$ wasted" tile uses a **blended input rate**
1183
- computed from your last-30d api_turns mix: each model's input rate
1184
- weighted by the prompt-token volume it consumed. Example: if you
1185
- spent 70% of prompt tokens on opus-4-7 ($15/1M) and 30% on
1186
- haiku-4-5 ($1/1M), the blended rate is `0.7 × 15 + 0.3 × 1 = $10.80/1M`.
1187
-
1188
- Falls back to $3/1M (claude-sonnet-4 input) on fresh installs with
1189
- no proxy data.
1190
-
1191
- ### JSONL dedup
1192
-
1193
- When the proxy isn't engaged, observer falls back to parsing the AI
1194
- client's on-disk session log. Clients echo the same cumulative usage
1195
- on every content block of a multi-block response, so naive parsing
1196
- counts one API call 2-4×. Two layers of dedup catch this:
1197
-
1198
- 1. **Adapter-level**: dedupes on Anthropic `message.id` at write time
1199
- 2. **Cost-engine-level**: dedupes on `(source_file, model, timestamp-bucketed-to-minute, tokens)` at read time
1200
-
1201
- Migration 007 ran a one-time pass collapsing pre-fix duplicates.
1202
-
1203
-
1204
- ## Security & control layer (guard)
1205
-
1206
- The guard evaluates every captured agent action against a
1207
- table-driven policy — built-in rules (destructive commands, project
1208
- boundaries, secrets egress, MCP pinning, taint/dataflow, budgets)
1209
- plus your own TOML rules — records each verdict in a hash-chained,
1210
- tamper-evident audit table, and on the channels that support it can
1211
- block before execution. It ships **observe-only by default**: a fresh
1212
- install records and alerts, and never blocks anything until you
1213
- explicitly flip enforce.
1214
-
1215
- What makes it different from standalone command-guards:
1216
-
1217
- - **One policy, every tool.** The same rules evaluate Claude Code,
1218
- Codex, Cursor, Cline and the rest through one engine — and
1219
- `observer init --guard` additionally *compiles* the policy into
1220
- each client's own native permission dialect, so the client itself
1221
- enforces even when the observer daemon is down.
1222
- - **Replay before you enforce.** `observer guard simulate --since 168h`
1223
- replays your real captured history against current policy and shows
1224
- what last week WOULD have flagged or blocked — a confidence check
1225
- only a tool that already has your history can run.
1226
- - **Proxy-level secrets egress scanning.** Clients routed through the
1227
- observer proxy get outbound API bodies scanned for credentials,
1228
- with mask/deny enforcement — an egress point no other local-first
1229
- tool sits on.
1230
- - **Auditable, honestly.** Verdicts are hash-chained
1231
- (tamper-EVIDENT, not tamper-proof — the docs say exactly what that
1232
- means), exportable as JSONL/CEF for your SIEM, and summarized by
1233
- `observer guard report` into a compliance evidence pack mapped to
1234
- SOC 2 / NIST 800-53.
1235
- - **Operable from the dashboard, not just the CLI.** The Security
1236
- page runs the routine workflows end to end: a consent-gated mode
1237
- control that shows the simulate evidence before you flip enforce,
1238
- an Enforce-readiness replay over your real history, the approvals
1239
- register (scoped, expiring exceptions — live immediately), a
1240
- lint-gated policy editor for your user rules (malformed files are
1241
- refused before they touch disk, with `.bak` undo), budget
1242
- guardrails suggested from your own observed spend (p95 + headroom)
1243
- with a daily burn-down meter, MCP pin approvals, and one-click
1244
- compliance evidence downloads.
1245
- - **Alerting, not just logging.** Guard verdicts and budget/obs-alert
1246
- crossings can push out through desktop toast notifications
1247
- (`[guard.alerts] desktop = true`) and outbound webhooks — generic,
1248
- Slack, Discord, or PagerDuty (`[[guard.cloud.webhooks]]` for guard
1249
- events) — each behind its own opt-in, routed through one egress
1250
- worker with an endpoint allowlist and a payload cap. Nothing fires
1251
- until you configure it.
1252
- - **Optional process observability.** `[observer.process]` (opt-in,
1253
- off by default) attaches the OS-level process tree — Linux eBPF or
1254
- Windows ETW — beneath each captured session, for runtime side
1255
- effects hooks alone can't see.
1256
-
1257
- Honest scope: hooks see declared commands, not side effects (use OS
1258
- sandboxes for containment — the guard detects and recommends them);
1259
- most adapters are watcher-channel and can only flag post-hoc; the
1260
- proxy scan only covers proxy-routed clients. The full capability
1261
- matrix is on the dashboard's Security page, and the no-network
1262
- invariant holds — nothing leaves your machine unless you opt into
1263
- OTel export or the cloud alerting tier, each individually.
1264
-
1265
- Quick start:
1266
-
1267
- ```
1268
- observer guard status # mode, rules, recent verdicts, chain check
1269
- observer guard test "rm -rf ./build" # would this block?
1270
- observer guard simulate --since 168h # what would last week have flagged?
1271
- observer guard enable --enforce # flip to enforce when ready
1272
- ```
1273
-
1274
- Full reference: [superbased.app/docs/guides/security-guard](https://superbased.app/docs/guides/security-guard)
1275
- (concepts, modes, the observe→enforce path, the honest
1276
- "what guard does NOT do" list). The rule catalog, policy-authoring cookbook,
1277
- enforce runbook, and SOC 2 / NIST compliance mapping ship as
1278
- `docs/guard-rules.md`, `docs/guard-policy-authoring.md`,
1279
- `docs/guard-enforce-runbook.md`, and `docs/guard-compliance.md` in the
1280
- source repository.
1281
-
1282
- ## Terminology and glossary
1283
-
1284
- Quick reference; the in-platform help drawer (press `?` on the
1285
- dashboard) has the full versions with cross-links.
1286
-
1287
- - **Action** — one normalized tool call recorded by an adapter. Action
1288
- types are taxonomic and cross-client: `read_file`, `write_file`,
1289
- `edit_file`, `run_command`, `search_text`, `search_files`,
1290
- `web_search`, `web_fetch`, `mcp_call`, `spawn_subagent`,
1291
- `todo_update`, `ask_user`, `task_complete`, `user_prompt`,
1292
- `api_error`, `turn_aborted` (interrupted before completion —
1293
- distinct from task_complete/success=false; v1.4.22+),
1294
- `context_compacted` (upstream-emitted compaction marker, not
1295
- searchable like file edits; v1.4.22+), `system_prompt`
1296
- (system/developer/user-envelope content; v1.4.23+), `unknown`.
1297
- - **API turn** — one HTTP request captured by the local proxy. Records
1298
- one row in `api_turns` per request, with the upstream usage envelope
1299
- intact.
1300
- - **Cache 5m vs 1h tier** — Anthropic's prompt cache has two TTLs.
1301
- Default is 5 minutes; `cache_control: {type: ephemeral, ttl: 3600}`
1302
- extends to 1 hour at 2× the write cost. Reads bill the same rate
1303
- regardless of tier.
1304
- - **Compression event** — one individual compression decision (one
1305
- per-type compress, or one drop) recorded post migration 010.
1306
- - **Conversation compression** — pre-forward trimming of API request
1307
- bodies. Pass 1 = per-content-type compression, Pass 2 = drop with
1308
- marker. See [Compression mechanisms](#compression-mechanisms).
1309
- - **Cross-platform tool calling** — every AI client connected via
1310
- `observer init` can call the 25 MCP tools (21 always-on + 4
1311
- conditional) against the unified
1312
- database. So Cursor's `get_last_test_result` can return a `go test`
1313
- Claude Code ran an hour earlier.
1314
- - **Cross-thread reread** — the parent thread re-reads a file the
1315
- sub-agent already saw (or vice versa) within the same session. Fix:
1316
- pass content via the Agent tool's `prompt` parameter rather than
1317
- letting the child re-read.
1318
- - **Freshness state** — per-read tag from the freshness engine: `fresh`
1319
- (first read in this session, OR re-read with same content),
1320
- `stale` (re-read after change in same session), `missing` (file no
1321
- longer exists), `modified-elsewhere` (file changed by something
1322
- other than an observable AI action).
1323
- - **Mechanism** — one of `json`, `code`, `logs`, `text`, `diff`,
1324
- `html` (per-content-type compressor) or `drop` (low-importance
1325
- message replaced by a marker).
1326
- - **Pattern** — a derived behaviour: `command_pair` (X often
1327
- followed by Y), `cross_tool_file` (file touched by multiple
1328
- clients), `knowledge_snippet` (consistent topic-specific habit),
1329
- `failure_correlation` (X often precedes a failure of Y),
1330
- `session_summary`. Each has a decay-weighted confidence score 0-1.
1331
- - **Project** — working-directory root that owns sessions and
1332
- actions. Derived from cwd at session start; `/.git/worktrees/...`
1333
- paths fold back to the working-tree root.
1334
- - **Proxy vs JSONL** — proxy intercepts upstream HTTP calls (ground
1335
- truth, reliability=high). JSONL parses the AI client's on-disk
1336
- session log (works without configuring a base URL, but client
1337
- echoes cumulative usage on every block, requiring dedup —
1338
- reliability=unreliable for token counts on Claude Code).
1339
- - **Reliability** — cost-engine confidence: `high` (upstream-
1340
- reported), `medium` (computed from known pricing), `low` (some
1341
- buckets estimated), `unreliable` (no pricing entry).
1342
- - **Session** — one continuous AI-coding conversation in a single
1343
- tool, scoped to one working directory. Has a stable ID (Claude
1344
- Code's UUID, Codex's rollout ID, …).
1345
- - **Sidechain** — actions emitted inside a sub-agent runtime spawned
1346
- via the parent's `Agent` tool. Sub-agents share the parent's
1347
- session_id; the `is_sidechain` column distinguishes them. The
1348
- Discovery tab's CROSS-THREAD column counts stale rereads that
1349
- crossed this boundary.
1350
- - **Stale reread** — same-session re-read of a file whose content
1351
- changed between reads. Cross-session reads are excluded (a fresh
1352
- session has no memory of a prior session's read).
1353
- - **Tool** — in this dashboard, "tool" means the *AI client*
1354
- (claude-code, cursor, codex, cline, cline-cli, copilot, copilot-cli,
1355
- opencode, openclaw, pi, antigravity, gemini-cli, hermes, kilo-code,
1356
- kilo-code-cli), not the per-tool name (`read_file`,
1357
- `run_command`). The latter is "Tool name" on the Actions tab.
1358
- - **Tool-pair integrity** — Anthropic requires every `tool_result`
1359
- block to have a corresponding `tool_use` block in a preceding
1360
- message. The compression pipeline preserves both sides of every
1361
- live pair to satisfy this constraint.
1362
-
1363
-
1364
- ## CLI reference
1365
-
1366
- Every command supports `--help` for the full surface.
1367
-
1368
- | Subcommand | Purpose |
1369
- |------------------------------------|---------|
1370
- | `observer init` | Register hooks + MCP server + durable proxy routes with installed AI clients (each side defaults on; opt out with `--skip-hooks` / `--skip-mcp` / `--skip-proxy-route`). With **zero flags on a terminal** it runs an interactive checklist instead: detects your tools, previews each pending config write, and asks consent one write at a time (MCP never pre-selected). Any flag or redirected stdio keeps the batch behaviour. |
1371
- | `observer uninstall` | Reverse `observer init` |
1372
- | `observer start` | Run watcher + dashboard + proxy in one process (recommended). Auto-opens the dashboard on interactive launches. Flags: `--dashboard-addr ADDR` (default `127.0.0.1:8081`; for a durable setting use `[dashboard].addr` in config or the `OBSERVER_DASHBOARD_ADDR` env var — precedence flag > env > config > default), `--no-dashboard` to skip the HTTP UI, `--no-open` to skip the browser. |
1373
- | `observer claude [-- args…]` | Launch Claude Code routed through the proxy for that session only (no config writes; fresh Pro/Max OAuth token re-exported so the SDK can't bypass). `--verify` runs pre-flight checks without launching. |
1374
- | `observer codex [-- args…]` | Launch Codex routed through the proxy for that session only (injects `openai_base_url` via argv; no config writes). |
1375
- | `observer watch` | Long-running JSONL watcher only |
1376
- | `observer dashboard --addr ADDR` | HTTP dashboard only. `--addr`/`--port` still win when passed; otherwise falls back to `OBSERVER_DASHBOARD_ADDR` > `[dashboard].addr` config > default. |
1377
- | `observer proxy start` | Reverse proxy only |
1378
- | `observer scan` | One-shot ingest of existing JSONL files (catch-up after install) |
1379
- | `observer status` | DB stats + recent activity |
1380
- | `observer doctor` | Diagnostic — checks paths, schemas, hook registration |
1381
- | `observer tail` | Live tail of incoming events |
1382
- | `observer cost` | Per-model cost summary CLI |
1383
- | `observer score` | Compute quality_score / error_rate / redundancy_ratio for sessions |
1384
- | `observer discover` | Stale rereads + repeated commands report (CLI version of the Discovery tab) |
1385
- | `observer patterns` | Derive patterns from session history |
1386
- | `observer learn` | Adapter for ingesting external JSONL exports |
1387
- | `observer suggest` | Write high-confidence patterns into CLAUDE.md / AGENTS.md / .cursorrules |
1388
- | `observer summarize` | Roll-up summary across sessions |
1389
- | `observer export` | Export DB to xlsx / json |
1390
- | `observer prune` | Manual retention pass (delete old data) |
1391
- | `observer db stats\|vacuum\|backup` | Storage manager. `stats`: per-table size breakdown (index + FTS5 shadow bytes folded into the table they serve). `vacuum`: reclaim free pages, reports bytes freed (can report SQLITE_BUSY against a busy daemon — re-run in a quiet moment). `backup <path>`: online snapshot via SQLite `VACUUM INTO` — safe while the daemon runs, refuses to overwrite. Restore is manual by design: stop daemon, swap file, start. |
1392
- | `observer db import <path>` | Merge another `observer.db` into this node's (a stranded install from another OS or home directory). Set-based, single-transaction, idempotent — re-running adds nothing twice; project identities remap by root path. `--dry-run` executes the same transaction and rolls it back, so its per-table counts are exact. Migrates the source schema first — point it at a copy. Node-local state (cache tracking, watcher cursors, advisor state) doesn't transfer. |
1393
- | `observer backfill --is-sidechain` | Re-walk JSONL to populate `actions.is_sidechain` (added by migration 010) on pre-migration rows. |
1394
- | `observer backfill --cache-tier` | Re-walk JSONL to populate `cache_creation_1h_tokens` (added by migration 008) on pre-migration rows. Run once after upgrading to v1.4.16+ to correct historical 1h-tier cache writes that were silently billed at the cheaper 5m rate. |
1395
- | `observer backfill --message-id` | Re-walk JSONL to populate `message_id` on `actions` and `token_usage` (added by migration 012). Required by the per-message timeline view in the Sessions modal. |
1396
- | `observer backfill --all` | Run every supported backfill in one invocation. Idempotent — safe to re-run. |
1397
- | `observer profile list\|show\|assign\|create\|delete\|set` | Compression profiles: inspect built-ins, reassign per traffic class or per tool (`assign tool:cline codex-safe`), create/edit custom profiles. Edits apply to new sessions hot. |
1398
- | `observer config set <key> <value>` | Dotted-key config setter (`compression.conversation.enabled true`). `--project <root>` writes a per-repo override file instead. |
1399
- | `observer advise` | Prescriptive cost/quality suggestions from captured activity (the Suggestions tab, in the CLI) |
1400
- | `observer cache-health` | Prompt-cache engine health: grading gate, read:write consistency, cause concentration |
1401
- | `observer metrics` | Prometheus-format metrics endpoint |
1402
- | `observer serve` | MCP server (stdio JSON-RPC) — usually invoked by `observer init` registration |
1403
- | `observer completion <shell>` | Generate shell completions (bash / zsh / fish / powershell) — e.g. `observer completion zsh > "${fpath[1]}/_observer"` |
1404
-
1405
-
1406
- ## Configuration
1407
-
1408
- `~/.observer/config.toml` — created with defaults on first run.
1409
-
1410
- ```toml
1411
- [paths]
1412
- db_path = "~/.observer/observer.db"
1413
- log_dir = "~/.observer/logs"
1414
-
1415
- [proxy]
1416
- listen_addr = "127.0.0.1"
1417
- port = 8820
1418
- anthropic_upstream = "https://api.anthropic.com"
1419
- openai_upstream = "https://api.openai.com"
1420
-
1421
- [dashboard]
1422
- # Durable dashboard listen address as host:port. Empty/omitted = the built-in
1423
- # 127.0.0.1:8081 default. Precedence: `observer start --dashboard-addr` flag >
1424
- # OBSERVER_DASHBOARD_ADDR env var > this value > default. Binds at daemon start
1425
- # (restart to apply). A non-loopback host still fails closed unless [remote] is
1426
- # armed.
1427
- addr = "127.0.0.1:8081"
1428
-
1429
- [compression.conversation]
1430
- enabled = false # opt-in; default off
1431
- mode = "cache_aware" # default; "token" | "cache" | "cache_aware" (see "Choosing a mode")
1432
- target_ratio = 0.85
1433
- preserve_last_n = 5
1434
- compress_types = ["json", "logs", "code"] # default; add "text"/"diff"/"html" to opt in
1435
-
1436
- [compression.shell]
1437
- enabled = true
1438
- # per-command filters configured under [compression.shell.filters]
1439
-
1440
- [retention]
1441
- prune_on_startup = true
1442
- max_actions = 5_000_000
1443
- max_age_days = 365
1444
-
1445
- [pricing]
1446
- # Per-model overrides if the baked-in pricing is wrong for you.
1447
- # [pricing.models."claude-opus-4-7"]
1448
- # input = 15
1449
- # output = 75
1450
- # cache_read = 1.5
1451
- # cache_creation = 18.75
1452
- ```
85
+ ## Learn more
1453
86
 
87
+ - [Documentation](https://superbased.app/docs) and [quickstart](https://superbased.app/docs/getting-started/quickstart)
88
+ - [Supported agents and per-tool setup](https://superbased.app/docs/track/overview)
89
+ - [How SuperBased compares](https://superbased.app/docs/compare/overview)
90
+ - [Source, issues and changelog](https://github.com/superbasedapp/observer)
1454
91
 
1455
92
  ## Troubleshooting
1456
93
 
1457
- ### `npm install -g` fails with `EACCES: permission denied`
1458
-
1459
- Default npm puts globals under `/usr/local/lib/node_modules` which
1460
- Homebrew-managed Node owns as root on macOS. Three fixes; pick one:
1461
-
1462
- ```bash
1463
- # 1) RECOMMENDED — point npm at a user-writable prefix.
1464
- mkdir -p ~/.npm-global
1465
- npm config set prefix '~/.npm-global'
1466
- echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
1467
- source ~/.zshrc
1468
- npm install -g @superbased/observer
1469
-
1470
- # 2) Use a Node version manager — fnm / nvm install Node into your
1471
- # home directory and dodge the permission issue entirely.
1472
- brew install fnm
1473
- fnm install --lts
1474
- npm install -g @superbased/observer
1475
-
1476
- # 3) sudo (works but you'll fight permissions on every update).
1477
- sudo npm install -g @superbased/observer
1478
- ```
1479
-
1480
- ### `observer: command not found` after install
1481
-
1482
- The shim binary is at `~/.npm-global/bin/observer` (or wherever your
1483
- npm prefix points). Make sure that directory is on `$PATH`:
1484
-
1485
- ```bash
1486
- echo $PATH | tr ':' '\n' | grep -E 'npm|node'
1487
- # add the prefix's bin/ to PATH if missing — see fix above
1488
- ```
1489
-
1490
- If you installed only a platform package (e.g. `@superbased/observer-darwin-x64`)
1491
- without the main `@superbased/observer`, the shim doesn't get created
1492
- — there's no `bin` field. Install the main package; npm picks up the
1493
- right platform binary automatically via `optionalDependencies`.
1494
-
1495
- ### `observer init` says "no tools selected and none auto-detected"
1496
-
1497
- Auto-detection looks for the AI clients' default session-log dirs
1498
- (`~/.claude/projects/`, `~/.codex/sessions/`, `~/.cursor/`, etc.).
1499
- On a fresh machine where no client has run yet, those dirs don't
1500
- exist. Pass the flag explicitly:
1501
-
1502
- ```bash
1503
- observer init --claude-code # or --codex / --cursor / --cline / --all
1504
- ```
1505
-
1506
- This registers hooks regardless — the next time the client runs,
1507
- its dirs get created and the watcher picks them up.
1508
-
1509
- ### Empty dashboard / "No proxy traffic"
1510
-
1511
- Session/action data populates passively whenever `observer start` is
1512
- running, but ground-truth cost / compression numbers require the
1513
- proxy. Route your tool through it — the quickest way is the
1514
- dashboard's Compression tab → **Proxy** banner → **Route through the
1515
- observer proxy…** button; every other mechanism (wrappers, env vars,
1516
- `observer init`) is listed under
1517
- [Per-AI-client setup](#per-ai-client-setup).
1518
-
1519
- Verify with `observer status | grep api_turns` — count should
1520
- climb during AI-client activity.
1521
-
1522
- ### `observer --version` says `dev`
1523
-
1524
- You're on a non-released build. Reinstall with `npm install -g @superbased/observer` or rebuild with the workflow's `-X main.version=$VERSION` ldflag.
1525
-
1526
- ### `tool_result block must have a corresponding tool_use block`
1527
-
1528
- Anthropic 400. Means the conversation-compression pipeline dropped
1529
- a `tool_use` while keeping its matching `tool_result`. Versions
1530
- prior to 1.3.2 had this bug; upgrade. If you're on 1.3.2+ and still
1531
- see it, file an issue with the conversation prefix.
1532
-
1533
- ### `tool use concurrency issues`
1534
-
1535
- Anthropic 400 surfaced in Claude Code as this message. Means the
1536
- parallel-tool-use case (multiple `tool_use` blocks in one assistant
1537
- message) isn't paired correctly with the multi-block tool_result
1538
- that follows. Versions prior to 1.3.2 had this bug; upgrade.
1539
-
1540
- ### Cross-thread numbers are 0
1541
-
1542
- Pre-migration data was ingested without the `is_sidechain` flag.
1543
- Run `observer backfill --is-sidechain` once to re-walk JSONL and
1544
- populate the flag on existing rows.
1545
-
1546
- ### Migration error: `duplicate column name`
1547
-
1548
- Race condition between concurrent daemon startups, fixed in 1.4.1.
1549
- Upgrade. If you still see it, run daemons serially: `observer
1550
- watch`, wait, then `observer dashboard`, then `observer proxy
1551
- start` (or just use `observer start` which runs all three in one
1552
- process — proxy + watcher + dashboard).
1553
-
1554
- ### `observer start` log says only `proxy + observer` — no `:8081`
1555
-
1556
- You're on a pre-1.4.7 build. Earlier versions ran only proxy +
1557
- watcher under `observer start`; the dashboard had to be started
1558
- separately via `observer dashboard --addr 127.0.0.1:8081`. Upgrade
1559
- to 1.4.7+ — the dashboard goroutine is now part of `observer start`
1560
- and the log line confirms all three: `proxy <addr> + watcher +
1561
- dashboard http://127.0.0.1:8081`. Pass `--no-dashboard` to opt out.
1562
-
1563
- ### "address already in use" on port 8820
1564
-
1565
- Another `observer proxy start` or `observer start` is still running.
1566
- Find it with `pgrep -af 'observer (proxy|start)'` and `kill <pid>`.
1567
- On macOS:
1568
-
1569
- ```bash
1570
- lsof -nP -iTCP:8820 -sTCP:LISTEN
1571
- kill <pid>
1572
- ```
1573
-
1574
- ### Dashboard port already in use
1575
-
1576
- ```bash
1577
- observer dashboard --addr 127.0.0.1:8082 # pick a different port
1578
- # or
1579
- [dashboard]
1580
- port = 8082 # in config.toml
1581
- ```
1582
-
1583
-
1584
- ## Security and privacy
1585
-
1586
- **Local-only. No telemetry. No remote anything.** The watcher, hook
1587
- handler, dashboard, MCP server, and CLI never make an outbound network
1588
- call on observer's behalf. The only code paths that touch the network
1589
- are the optional API proxy (which forwards **your** requests unchanged
1590
- to the AI provider you already use) and a handful of explicit opt-in
1591
- features (message-summary LLM, codeintel MCP).
1592
-
1593
- The full privacy statement — what observer stores, what it reads,
1594
- what it never stores, the explicit list of outbound-network call sites
1595
- gated behind config, and how to verify "no telemetry" yourself with
1596
- `grep`, `strings`, and a network-namespaced shell — lives in
1597
- [`PRIVACY.md`](https://github.com/superbasedapp/observer/blob/main/PRIVACY.md).
1598
-
1599
- Operational shorthand:
1600
-
1601
- - **Local-only HTTP.** The proxy and dashboard bind to `127.0.0.1`
1602
- by default. Don't bind to `0.0.0.0` unless you've thought about
1603
- it — there's no auth.
1604
- - **Secrets scrubbing.** Tool inputs and outputs pass through
1605
- `internal/scrub/` before persistence; review the regex set if your
1606
- secrets follow non-default formats.
1607
- - **Database.** `~/.observer/observer.db` is a SQLite file with the
1608
- same security posture as your `~/.claude/` and `~/.codex/` session
1609
- logs (which already hold the same content). Encrypt the disk if
1610
- your threat model needs that.
1611
- - **Full delete.** `rm -rf ~/.observer/` removes everything observer
1612
- ever stored — no traces elsewhere on your system.
1613
-
1614
-
1615
- ## Source, contributing, license
94
+ - **`EACCES` on `npm install -g`:** point npm at a user prefix
95
+ (`npm config set prefix ~/.npm-global` and add `~/.npm-global/bin` to `PATH`) or use a Node version
96
+ manager such as fnm or nvm.
97
+ - **`observer: command not found`:** make sure your npm global `bin` directory is on `PATH`, and that
98
+ you installed `@superbased/observer` itself, not only a platform package.
99
+ - **Port 8820 or 8081 already in use:** another `observer start` is running; stop it first.
1616
100
 
1617
- - **Source**: https://github.com/superbasedapp/observer
1618
- - **Specification**: `superbased-final-spec-v2.md` in the repo
1619
- - **Issues**: https://github.com/superbasedapp/observer/issues
1620
- - **License**: [Apache 2.0](https://github.com/superbasedapp/observer/blob/main/LICENSE)
1621
- - **Author**: Santosh Kathira <contact@superbased.app>
101
+ ## License
1622
102
 
1623
- This npm package is a thin Node.js shim that resolves the right
1624
- pre-built binary at runtime and spawns it. Same shape as `esbuild` /
1625
- `swc` / `@biomejs/biome`. The Go source lives in the main repo;
1626
- binaries are cross-compiled per release tag via GitHub Actions and
1627
- published as `@superbased/observer-<platform>-<arch>` per-platform
1628
- packages.
103
+ Apache 2.0. This package is a small Node.js shim that runs the prebuilt binary from the matching
104
+ `@superbased/observer-<platform>-<arch>` package.