Skip to content
GitHub stars

CLI Reference

Commands

agentsview / agentsview serve

Start the HTTP server with embedded web UI.

Terminal window
agentsview [flags]
agentsview serve [flags]
FlagDefaultDescription
-host127.0.0.1Host to bind to
-port8080Port to listen on
-browserfalseOpen browser on startup
-no-update-checkfalseDisable automatic update checks
-public-urlPublic URL for hostname or proxy access
-public-originTrusted browser origin (repeatable/comma-separated)
-proxyManaged proxy mode (caddy)
-caddy-bincaddyCaddy binary path
-proxy-bind-host127.0.0.1Interface for managed proxy
-public-port8443External port for managed proxy
-tls-certTLS certificate path
-tls-keyTLS key path
-allowed-subnetClient CIDR allowlist (repeatable/comma-separated)

The server auto-discovers an available port if 8080 is busy. See Remote Access for details on the remote access and proxy flags.

Examples:

Terminal window
agentsview # defaults
agentsview -port 9090 # custom port
agentsview -browser # open browser on startup
agentsview -public-url https://agents.example.com # remote access

On startup, the server:

  1. Loads or creates ~/.agentsview/sessions.db
  2. Runs initial sync across all discovered session directories
  3. Starts the file watcher (500ms debounce)
  4. Starts periodic sync (every 15 minutes)
  5. Serves the Svelte SPA and REST API

The server shuts down cleanly on Ctrl+C, flushing the database and stopping file watchers.


agentsview sync

Run the sync engine to populate the database, then exit without starting the HTTP server. Useful for scripting, CI, or refreshing data after config changes.

Terminal window
agentsview sync [flags]
FlagDefaultDescription
-fullfalseForce a full resync regardless of data version

Examples:

Terminal window
agentsview sync # incremental sync and exit
agentsview sync -full # full resync and exit

After syncing, a summary of session and message counts is printed to stdout.


agentsview prune

Delete sessions matching one or more filters. At least one filter is required.

Terminal window
agentsview prune [flags]
FlagDefaultDescription
-projectSessions whose project contains this substring
-max-messages-1Sessions with at most N messages
-beforeSessions that ended before this date (YYYY-MM-DD)
-first-messageSessions whose first message starts with this text
-dry-runfalseShow what would be pruned without deleting
-yesfalseSkip confirmation prompt

Examples:

Terminal window
# Preview what would be deleted
agentsview prune -project "scratch" -dry-run
# Delete short sessions from before 2025
agentsview prune -max-messages 2 -before 2025-01-01
# Delete sessions starting with a specific message
agentsview prune -first-message "test" -yes
# Combine filters (AND logic)
agentsview prune -project "old-project" -max-messages 5 -before 2025-06-01

The prune command displays the number of sessions deleted and disk space reclaimed. Use -dry-run first to verify the filter matches what you expect.


agentsview version

Print the version, git commit, and build date.

Terminal window
agentsview version
agentsview v0.1.0 (abc1234) built 2025-01-15

agentsview token-use

Print machine-readable token usage data for a single session.

Terminal window
agentsview token-use <session-id>

Use this command when you want structured token usage output for shell scripts, CI jobs, or other automation. Pass a session ID from the session detail header.

Session ID format depends on the agent. For example, Claude root sessions usually use UUIDs like 550e8400-e29b-41d4-a716-446655440000, Claude subagents use IDs like agent-a86574e, and some other agents use prefixes such as codex:my-session-id.

If the AgentsView server is already running, the command reads the current database state. If no server is running, it performs an on-demand sync for the requested session first, then returns the stored token totals.

The JSON output format is experimental and may change.

Example:

Terminal window
agentsview token-use 550e8400-e29b-41d4-a716-446655440000
{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"agent": "claude",
"project": "my-project",
"total_output_tokens": 15230,
"peak_context_tokens": 84000,
"server_running": false
}

total_output_tokens is the session’s total generated output tokens. peak_context_tokens is the highest context-token count seen during that session. server_running indicates whether the command used an already-running AgentsView server rather than falling back to an on-demand session sync.


agentsview pg push

Sync sessions from local SQLite to PostgreSQL. See PostgreSQL Sync for full documentation.

Terminal window
agentsview pg push [flags]
FlagDefaultDescription
-fullfalseForce full local resync and re-push
-projectsComma-separated projects to push (inclusive)
-exclude-projectsComma-separated projects to exclude from push
-all-projectsfalseIgnore configured project filters for this run

See PostgreSQL Sync — Project Filtering for details on how filtering interacts with the push watermark.


agentsview pg status

Show PostgreSQL sync status.

Terminal window
agentsview pg status

agentsview pg serve

Start a read-only web UI backed by PostgreSQL. See PostgreSQL Sync for full documentation.

Terminal window
agentsview pg serve [flags]

Accepts the same serve flags (-host, -port, -proxy, etc.) plus PostgreSQL configuration from config.toml.


agentsview projects

List all projects in the local database with their session counts.

Terminal window
agentsview projects [flags]
FlagDefaultDescription
-jsonfalseOutput as a JSON array

Examples:

Terminal window
agentsview projects # tabular output
agentsview projects -json # JSON array

agentsview import

Import Claude.ai or ChatGPT conversations into the local database. See Chat Import for full documentation.

Terminal window
agentsview import --type <type> <path>
FlagDefaultDescription
--typeImport type: claude-ai or chatgpt (required)

The path can be a .zip file, a conversations.json file (Claude.ai only), or a directory containing the extracted export.

Examples:

Terminal window
agentsview import --type claude-ai ~/Downloads/claude.zip
agentsview import --type chatgpt ~/Downloads/chatgpt.zip
agentsview import --type claude-ai ./conversations.json

agentsview help

Print usage information.

Terminal window
agentsview help

Environment Variables

VariableDefaultDescription
CLAUDE_PROJECTS_DIR~/.claude/projectsClaude Code projects directory
CODEX_SESSIONS_DIR~/.codex/sessionsCodex sessions directory
COPILOT_DIR~/.copilotCopilot CLI sessions directory
CURSOR_PROJECTS_DIR~/.cursor/projectsCursor transcripts directory
GEMINI_DIR~/.geminiGemini CLI directory
OPENCODE_DIR~/.local/share/opencodeOpenCode data directory
AMP_DIR~/.local/share/amp/threadsAmp threads directory
VSCODE_COPILOT_DIR(platform-specific)VS Code Copilot sessions directory
OPENCLAW_DIR~/.openclaw/agentsOpenClaw agents directory
PI_DIR~/.pi/agent/sessionsPi sessions directory
IFLOW_DIR~/.iflow/projectsiFlow projects directory
ZENCODER_DIR~/.zencoder/sessionsZencoder sessions directory
KIMI_DIR~/.kimi/sessionsKimi sessions directory
WARP_DIR(platform-specific)Warp database directory
HERMES_SESSIONS_DIR~/.hermes/sessionsHermes Agent sessions directory
CORTEX_DIR~/.snowflake/cortex/conversationsCortex Code conversations directory
KIRO_SESSIONS_DIR~/.kiro/sessions/cliKiro CLI sessions directory
KIRO_IDE_DIR(platform-specific)Kiro IDE sessions directory
AGENT_VIEWER_DATA_DIR~/.agentsviewData directory (database, config)
AGENTSVIEW_PG_URLPostgreSQL connection URL
AGENTSVIEW_PG_MACHINEMachine name for PG push sync
AGENTSVIEW_PG_SCHEMAagentsviewPostgreSQL schema name
AGENTSVIEW_DISABLE_UPDATE_CHECKSet to 1 to disable the update check

Environment variables override the built-in defaults. Set them in your shell profile or pass them inline:

Terminal window
AGENT_VIEWER_DATA_DIR=/tmp/av-test agentsview