Skip to content

CLI command overview

Agentmine (agentmine) exposes its corpus through browse, search, pipeline, and maintenance commands. This page covers the common commands rather than every flag. All commands emit an agent-friendly JSON envelope — see the Agent CLI contract.

Browse

CommandPurpose
agentmine statsCorpus overview
agentmine sessions --limit 20List sessions
agentmine sessions --root-only --since 1dList top-level sessions without child workers or reviewers
agentmine sessions --parent <session-id>List one session’s direct children
agentmine sessions --agent-type guardianList automatic Codex action-review sessions
agentmine session <session-id> --mdRender a session as Markdown
agentmine session <id> --turn-range 10:20Inspect a compact slice of a session
agentmine top files --limit 20Rank most-touched files
agentmine top commands --failed --limit 20Rank commands, optionally failed-only
agentmine top corrections --by kindRank user corrections by kind
agentmine top skillsRank skills used
agentmine top tokens --by model|project|session|day|sourceRank by token volume + USD cost (run prices sync first; incomplete prices make cost_usd a lower bound and increment unpriced_sessions)
agentmine top sequences --project '/path/to/repo%' --n 3Re-aggregate ngrams scoped to a project_path LIKE pattern
agentmine timeline --bucket weekActivity timeline
agentmine workflows --sort tokensRank Claude Code workflow runs by start time, tokens, duration, agents, or name
agentmine workflow <run-id>Inspect one workflow run’s rollups, phases, and per-agent rows
agentmine versionReport Agentmine, runtime, target, Bun, and source-commit metadata
agentmine schemaInspect the result-envelope schema, exit codes, and top-level command registry
agentmine schema --tablesList database tables and views
agentmine schema --table messagesInspect DB columns before writing SQL
Terminal window
agentmine fts "error text or phrase"
agentmine similar "task description"
agentmine similar "today's task" --root-only --since 1d

See Similarity search for similar’s auto/hybrid/embedding modes, time and lineage filters, and injected-message behavior.

FTS5 hyphen gotcha: FTS5 parses agent-first as agent MINUS first. Wrap hyphenated phrases in double quotes:

Terminal window
agentmine fts '"agent-first"'

Ad-hoc SQL

Terminal window
agentmine query "SELECT source, count(*) AS n FROM sessions GROUP BY source"

Ad-hoc SQL is read-only. Only SELECT, WITH, and EXPLAIN queries are accepted.

Pipeline

CommandPurpose
agentmine ingestsync -> normalize -> extract in one step
agentmine daemonKeep the corpus current continuously, instead of importing on demand
agentmine syncMirror known local transcript stores into the session data directory
agentmine normalizeParse transcripts into canonical sessions (content-hash cached)
agentmine normalize --since 1dIncremental: only parse files touched in the last day (mtime-filtered walk)
agentmine extractRebuild derived fact tables in transactions
agentmine embed --provider ollama --model nomic-embed-text --dry-runPlan a local semantic index without writing

agentmine ingest --source claude-code|cursor|codex|gemini|qwen|cline|pi|droid|vibe runs the three file-based stages for one installed CLI. Current OpenCode, Kilo Code, and Goose use agentmine normalize --source opencode-db, agentmine normalize --source kilo, or agentmine normalize --source goose, followed by agentmine extract for a source-specific import; their live SQLite stores are not sync targets. An unfiltered agentmine ingest includes available live databases during its normalize stage.

agentmine daemon runs those same stages for you, on its own, for as long as it is running, so a query reflects what your agents were doing seconds ago rather than whenever you last ran ingest. Detection cadence, running it as a service, and how upgrades behave are covered in Keeping the corpus current.

Terminal window
agentmine daemon # every installed CLI
agentmine daemon --only claude-code,codex # just these
agentmine daemon --no-extract # import sessions, skip fact tables
agentmine daemon --print-service # generate a service definition
agentmine daemon --install-service # write it, print how to enable

Maintenance

CommandPurpose
agentmine backupSnapshot the complete SQLite corpus before normalize --force or other rebuilds
agentmine compact --dry-runPlan the one-time 0.8.x corpus storage split and check required disk space
agentmine compactMove verbatim payload into compressed sibling archives; resumable after interruption
agentmine prices syncLoad model_prices from the vendored LiteLLM snapshot (offline); --online fetches live LiteLLM
agentmine prices lsList the loaded price table (USD per 1M tokens)
agentmine purge --project-path-allow <substring>Dry-run purge of sessions outside an allowlist
agentmine purge --project-path-allow <substring> --yesDelete sessions outside an allowlist

Agentmine 0.9 refuses normal corpus commands when it finds the pre-0.9 single-database layout. Run agentmine compact --dry-run, then agentmine compact. agentmine backup and the two compact forms remain available before migration so the recovery path never depends on a successful write.