AgentsView CLI
AgentsView syncs sessions from local AI coding agents (Claude Code, Codex,
Cursor, Copilot, Gemini, and many more) into a local SQLite archive and
exposes them through the agentsview binary plus a web UI. Everything is
local; there are no accounts.
This skill covers the CLI surface only — how to run and script agentsview
commands against the installed binary. It is not a guide to developing
agentsview itself; for parser/storage/frontend work, follow the repo's
AGENTS.md task routes instead. Full upstream docs live in this repo under
docs/ (rendered at agentsview.io); the condensed references in
references/ are enough for most CLI tasks.
Before You Run Anything
- Check the installed version. Features land release by release, so a
binary installed via brew or the install script may be older than the docs
describe. Run
agentsview version first; if a command you need is missing
from agentsview help, confirm it exists in the installed version before
assuming the docs are wrong. In this repository the bleeding-edge CLI is
also available via go run ./cmd/agentsview <command>.
- Data is only as fresh as the last sync. The archive is populated by
sync. If results look missing or stale, run
agentsview sync before
concluding data does not exist. Freshness-sensitive commands (usage,
token-use/session usage) sync on demand by default.
- Default to read-only operations. Commands that delete or rebuild data
(
prune, pg push --full, embeddings retire, recall imports) deserve
a preview or explicit confirmation first.
Command Router
| Want to... |
Command |
Details |
| Browse/list sessions |
session list |
references/sessions.md |
| Resume recent work |
session list --resume |
references/sessions.md |
| Read a session's messages |
session messages <id> |
references/sessions.md |
| Search what was said/done |
session search |
references/sessions.md |
| Session metadata/signals |
session get <id>, health [id] |
references/sessions.md |
| Tool calls in a session |
session tool-calls <id> |
references/sessions.md |
| Per-session tokens/cost |
session usage <id> |
references/usage.md |
| Daily cost report |
usage daily |
references/usage.md |
| One-line today spend |
usage statusline |
references/usage.md |
| Active time/concurrency |
activity report |
references/usage.md |
| Workspace analytics |
stats |
references/usage.md |
| Refresh the archive |
agentsview sync |
references/commands.md |
| Serve web UI |
agentsview serve / daemon start |
references/commands.md |
| List projects |
agentsview projects |
references/commands.md |
| Delete sessions by filter |
agentsview prune (use --dry-run first) |
references/commands.md |
| Import Claude.ai/ChatGPT export |
agentsview import --type ... <path> |
references/commands.md |
| Export summaries/reports |
export sessions, export hour|day|digest |
references/commands.md |
| Secret leak scan |
secrets scan / secrets list |
references/commands.md |
| Semantic (meaning-based) search |
embeddings build, --semantic/--hybrid |
references/search.md |
| Durable knowledge layer |
recall query/brief/... |
references/search.md |
| Mirror to PostgreSQL |
pg push / pg serve / pg service |
references/remote-mcp.md |
| Mirror to DuckDB |
duckdb push / duckdb serve |
references/remote-mcp.md |
| Expose history to assistants |
agentsview mcp |
references/remote-mcp.md |
| Diagnose sync problems |
agentsview doctor sync |
references/commands.md |
| Config file, data dir, agent dirs |
~/.agentsview/config.toml, env vars |
references/configuration.md |
Core Workflow
agentsview version # what is installed
agentsview sync # refresh archive (safe, incremental)
agentsview session list --limit 10 --json
Searching history. Exact identifiers (error strings, paths, tool names) →
substring/FTS search. Conceptual questions ("how did we handle X") → hybrid
semantic search when the embedding index is set up, otherwise several short
FTS probes. See references/sessions.md for modes and fallbacks.
agentsview session search "exact error text" --fts --json --limit 8
agentsview session search "deploy pipeline flaky" --hybrid --context 2 --json
Inspecting a hit. A search match is a lead. Center a message window on the
match's ordinal before drawing conclusions:
agentsview session messages <session-id> --around <ordinal> --before 8 --after 8 --json
Costs. usage daily aggregates cost by day (30-day default window).
session usage <id> gives one session's tokens and cost. Both read from the
indexed archive; --offline skips the network pricing fetch.
Deleting. prune requires at least one filter and always preview first:
agentsview prune --project scratch --max-messages 2 --dry-run
Daemon Model (What Happens Under the Hood)
A detached daemon owns SQLite writes for the data directory. Read-only CLI
commands attach to it when running, otherwise open SQLite read-only directly —
so one-off reads stay fast and scripts never fight over the write lock.
Commands that write or need fresh data (sync, session sync, usage,
pg push, duckdb push) auto-start the daemon. Consequences:
- Set
AGENTSVIEW_NO_DAEMON=1 in CI/scripts that must never spawn a daemon;
writes then require acquiring the write-owner lock directly.
- The daemon self-exits after idle timeout (default 20m); long-lived
integrations should tolerate it restarting.
- If a writable daemon is known but unreachable, write commands refuse rather
than double-write. Check
agentsview daemon status.
Conventions
- Structured commands accept
--format json; --json is the alias. Prefer
JSON when piping into scripts; human output is tuned for terminal reading.
- Relative time windows use
--since Nh|Nd|Nw|Nm|Ny — m means calendar
months, not minutes. --date/--date-from/--date-to take YYYY-MM-DD.
--project, --agent, and --machine filters apply across most commands.
- One-shot and automated sessions are excluded from
session list and search
by default; re-include with --include-one-shot / --include-automated.
- Session IDs vary by agent: Claude UUIDs (
550e8400-...), Claude subagents
(agent-a86574e), prefixed forms (codex:my-session-id). Copy IDs from
session list output rather than guessing.
Safety
- Session archives contain prompts, file paths, and possibly credentials.
Treat output as sensitive; never paste secrets from sessions into examples.
secrets list redacts by default; --reveal is localhost-only for a reason.
AGENTSVIEW_DATA_DIR redirects everything (db, config, logs) — useful for
scratch experiments so the production archive is never touched.
1---2name: agentsview-cli3description: Use when running or scripting the agentsview CLI from the command line — querying, searching, syncing, exporting, or reporting on local AI agent session history. Triggers for cost/usage reports, session search and resume, archive sync, prune/import/export, secret scans, pg/duckdb mirroring, the MCP server, or any `agentsview <command>` invocation, even when the user never says "agentsview" and just asks "what did I spend on Claude this week" or "find where I fixed that timeout". Do NOT use for developing the agentsview codebase itself (parsers, storage, frontend, server internals) — this skill covers CLI usage only.4---56# AgentsView CLI78AgentsView syncs sessions from local AI coding agents (Claude Code, Codex,9Cursor, Copilot, Gemini, and many more) into a local SQLite archive and10exposes them through the `agentsview` binary plus a web UI. Everything is11local; there are no accounts.1213This skill covers the CLI surface only — how to run and script `agentsview`14commands against the installed binary. It is not a guide to developing15agentsview itself; for parser/storage/frontend work, follow the repo's16`AGENTS.md` task routes instead. Full upstream docs live in this repo under17`docs/` (rendered at agentsview.io); the condensed references in18`references/` are enough for most CLI tasks.1920## Before You Run Anything21221. **Check the installed version.** Features land release by release, so a23 binary installed via brew or the install script may be older than the docs24 describe. Run `agentsview version` first; if a command you need is missing25 from `agentsview help`, confirm it exists in the installed version before26 assuming the docs are wrong. In this repository the bleeding-edge CLI is27 also available via `go run ./cmd/agentsview <command>`.282. **Data is only as fresh as the last sync.** The archive is populated by29 sync. If results look missing or stale, run `agentsview sync` before30 concluding data does not exist. Freshness-sensitive commands (`usage`,31 `token-use`/`session usage`) sync on demand by default.323. **Default to read-only operations.** Commands that delete or rebuild data33 (`prune`, `pg push --full`, `embeddings retire`, `recall` imports) deserve34 a preview or explicit confirmation first.3536## Command Router3738| Want to... | Command | Details |39| --- | --- | --- |40| Browse/list sessions | `session list` | references/sessions.md |41| Resume recent work | `session list --resume` | references/sessions.md |42| Read a session's messages | `session messages <id>` | references/sessions.md |43| Search what was said/done | `session search` | references/sessions.md |44| Session metadata/signals | `session get <id>`, `health [id]` | references/sessions.md |45| Tool calls in a session | `session tool-calls <id>` | references/sessions.md |46| Per-session tokens/cost | `session usage <id>` | references/usage.md |47| Daily cost report | `usage daily` | references/usage.md |48| One-line today spend | `usage statusline` | references/usage.md |49| Active time/concurrency | `activity report` | references/usage.md |50| Workspace analytics | `stats` | references/usage.md |51| Refresh the archive | `agentsview sync` | references/commands.md |52| Serve web UI | `agentsview serve` / `daemon start` | references/commands.md |53| List projects | `agentsview projects` | references/commands.md |54| Delete sessions by filter | `agentsview prune` (use `--dry-run` first) | references/commands.md |55| Import Claude.ai/ChatGPT export | `agentsview import --type ... <path>` | references/commands.md |56| Export summaries/reports | `export sessions`, `export hour\|day\|digest` | references/commands.md |57| Secret leak scan | `secrets scan` / `secrets list` | references/commands.md |58| Semantic (meaning-based) search | `embeddings build`, `--semantic`/`--hybrid` | references/search.md |59| Durable knowledge layer | `recall query/brief/...` | references/search.md |60| Mirror to PostgreSQL | `pg push` / `pg serve` / `pg service` | references/remote-mcp.md |61| Mirror to DuckDB | `duckdb push` / `duckdb serve` | references/remote-mcp.md |62| Expose history to assistants | `agentsview mcp` | references/remote-mcp.md |63| Diagnose sync problems | `agentsview doctor sync` | references/commands.md |64| Config file, data dir, agent dirs | `~/.agentsview/config.toml`, env vars | references/configuration.md |6566## Core Workflow6768```bash69agentsview version # what is installed70agentsview sync # refresh archive (safe, incremental)71agentsview session list --limit 10 --json72```7374**Searching history.** Exact identifiers (error strings, paths, tool names) →75substring/FTS search. Conceptual questions ("how did we handle X") → hybrid76semantic search when the embedding index is set up, otherwise several short77FTS probes. See references/sessions.md for modes and fallbacks.7879```bash80agentsview session search "exact error text" --fts --json --limit 881agentsview session search "deploy pipeline flaky" --hybrid --context 2 --json82```8384**Inspecting a hit.** A search match is a lead. Center a message window on the85match's ordinal before drawing conclusions:8687```bash88agentsview session messages <session-id> --around <ordinal> --before 8 --after 8 --json89```9091**Costs.** `usage daily` aggregates cost by day (30-day default window).92`session usage <id>` gives one session's tokens and cost. Both read from the93indexed archive; `--offline` skips the network pricing fetch.9495**Deleting.** `prune` requires at least one filter and always preview first:9697```bash98agentsview prune --project scratch --max-messages 2 --dry-run99```100101## Daemon Model (What Happens Under the Hood)102103A detached daemon owns SQLite writes for the data directory. Read-only CLI104commands attach to it when running, otherwise open SQLite read-only directly —105so one-off reads stay fast and scripts never fight over the write lock.106Commands that write or need fresh data (`sync`, `session sync`, `usage`,107`pg push`, `duckdb push`) auto-start the daemon. Consequences:108109- Set `AGENTSVIEW_NO_DAEMON=1` in CI/scripts that must never spawn a daemon;110 writes then require acquiring the write-owner lock directly.111- The daemon self-exits after idle timeout (default 20m); long-lived112 integrations should tolerate it restarting.113- If a writable daemon is known but unreachable, write commands refuse rather114 than double-write. Check `agentsview daemon status`.115116## Conventions117118- Structured commands accept `--format json`; `--json` is the alias. Prefer119 JSON when piping into scripts; human output is tuned for terminal reading.120- Relative time windows use `--since Nh|Nd|Nw|Nm|Ny` — **`m` means calendar121 months, not minutes.** `--date`/`--date-from`/`--date-to` take `YYYY-MM-DD`.122- `--project`, `--agent`, and `--machine` filters apply across most commands.123- One-shot and automated sessions are excluded from `session list` and search124 by default; re-include with `--include-one-shot` / `--include-automated`.125- Session IDs vary by agent: Claude UUIDs (`550e8400-...`), Claude subagents126 (`agent-a86574e`), prefixed forms (`codex:my-session-id`). Copy IDs from127 `session list` output rather than guessing.128129## Safety130131- Session archives contain prompts, file paths, and possibly credentials.132 Treat output as sensitive; never paste secrets from sessions into examples.133- `secrets list` redacts by default; `--reveal` is localhost-only for a reason.134- `AGENTSVIEW_DATA_DIR` redirects everything (db, config, logs) — useful for135 scratch experiments so the production archive is never touched.