CLI commands

The devbot command-line interface — lifecycle, management, and reporting commands.

3 commands · 4 tools

The devbot CLI is the single entry point for installing, configuring and running DevBot. It is installed to $PATH by make install and delegates each subcommand to a lifecycle script under bin/.

Quick start

Installs to ~/.local/share/dev-bot and links the devbot CLI into ~/.local/bin (override the location with --install-dir or DEV_BOT_INSTALL_DIR). Re-running the install command is idempotent — it pulls the latest version and reinstalls in place; use devbot update to refresh an existing install.

Install once, then in any project:

devbot init                  # wire the project (writes .devbot.project.jsonc)
devbot                       # start the harness (opencode or claudecode)

Commands

devbot — start the harness

Run with no subcommand inside a project to start the configured harness (opencode or claudecode, per the harness setting) after running devbot up. Harness flags (-*, including the -- separator) are forwarded; any other unknown command is refused with a usage error. Outside an initialised project it refuses to start and tells you to run devbot init there first — unless herdr takes the terminal, which it does from any folder: herdr restores its own panes, and each one starts its harness in its own project. When the herdr module is enabled and its binary is missing, the boot installs it first and then hands over — a binary already in ~/.local/bin counts as installed even when that directory is not on PATH, so it installs once; --gui, harness arguments and a herdr pane never install anything.

A warm machine is not started twice. A bare start skips devbot up — one line says so, and the harness starts immediately — when this project’s own start has already completed here and every docker service its enabled modules declare is still running. The skip is per project and per wiring: a project’s first start, a config change or a devbot update runs the sequence once, which is what converges the work the compose scan cannot see (the datasources gateway is rendered and started per project by its module up.sh). A skipped start also leaves image rebuilds, the Ollama GPU reconcile and the module up.sh scripts (datasources gateway, codebase-memory priming, model pulls, external-module sync) to the next cold start or an explicit devbot up. The stamp is only as good as the state it describes: it is cleared the moment a start begins and written only by a start that completes, so a failed compose step, a module up.sh that failed, a gateway mount root that moved, or any container the start brought up that has since stopped sends the next start through the sequence again. A start that overlaps another one waits on an install-level lock and re-checks when it is released, so the second start skips once the first completed instead of running a second sequence against the shared containers. Anything the check cannot answer — no docker daemon, an unresolvable compose model, no service declared — falls back to the normal start. devbot up / make up still always run the sequence; they now wait for an in-flight up rather than overlapping it, and proceed with a warning if that wait is exceeded — re-checking first, so a start that finished at the boundary still skips (DEVBOT_UP_LOCK_WAIT sets the wait).

Auto-update. Before wiring, a bare start runs devbot update --auto — a quiet no-op when already on the newest release. A version change rewrites the global config’s version, which triggers a per-project reinit on this project’s start and on every other project’s next start. Set the global auto_update to false to opt out. A failed update (offline, conflict) warns and the start continues on the current version.

Startup delegates to the harness module’s start.sh (src/harnesses/<harness>/start.sh), which launches the harness binary with no forced agent — the session agent comes from the project’s default (opencode.jsonc default_agent / .claude/settings.json agent), which init creates with devbot by default and only asks to change when an existing config chose a different agent. Before launching, start.sh rotates the previous session’s .agents/logs/*.log files to .agents/logs/rotated/<date>-<name>-<NNN>.log (old logs preserved); when the harness exits it scans the fresh logs for error-level entries, alerts you if any were written, and preserves the harness’s exit code.

Harness-arg passthrough. Anything after the first -- is forwarded verbatim to the harness binary; tokens before it are devbot’s own and are never forwarded. Without --, a leading flag (-*) is forwarded unchanged — a bare unknown word is refused (treated as a mistyped subcommand). This is the escape hatch for flags that collide with devbot’s own (-h/--help/--version and known subcommand names):

devbot -- -h                 # opencode/claude help (not devbot help)
devbot -- run "fix the bug"  # opencode run; claude -p style one-shot
devbot -c "msg"              # no --: a leading flag forwards as today
devbot --stop -- -c "msg"    # --stop is consumed; only -c "msg" reaches the harness

Only the first -- splits — a later -- is a literal part of the harness argv. Arguments keep their boundaries (quoting survives the split).

Desktop app instead of the CLI (--gui). devbot --gui runs the usual start sequence (auto-update, reinit, devbot up), then opens the harness’s desktop app on the project instead of starting its CLI:

Harness App Opened with
claudecode Claude desktop claude://code/new?folder=<project>
opencode OpenCode desktop opencode://open-project?directory=<project>

The app is addressed by bundle id through macOS open -b, so --gui is macOS-only, and when the app is not installed the start fails with a clear error (it does not fall back to the CLI). --gui is devbot’s own flag — it is never forwarded — and it takes no harness arguments: devbot --gui -- <args> is refused before anything starts, because the app takes a folder, not CLI arguments.

The terminal stays attached: devbot --gui keeps its session registered until you press Ctrl-C, because the CLI is what normally marks a session’s lifetime and open returns immediately. Releasing it earlier would let the last session out remove the docker services (MCP servers, memory index) from under the app. Ctrl-C releases the session with exit code 0 and runs the normal last-session teardown.

OpenCode desktop loads plugins with Node, which cannot resolve dev-bot’s extensionless TypeScript imports: as of OpenCode desktop 1.19, on-hooks.ts (guards, formatters), mcp-sync.ts and the opencode-pty plugin fail to load there, so those do not run in the app. devbot --gui prints this as a warning. The Claude desktop app runs Claude Code with the project’s own .claude/settings.json, so the harness hooks and MCP servers apply as they do in the CLI.

Session teardown on exit. Each devbot start registers a session in an install-level registry (storage/run/sessions/, gitignored) and holds a flock on its own file for the session’s lifetime. When a session exits — normally, via Ctrl-C, or kill (the flock auto-releases even on SIGKILL) — it removes its file and, if no other devbot session remains live, runs devbot down to remove the devbot containers. If another session is still running (e.g. a second terminal in another project), the containers stay up — an explicit devbot down run in that state warns and keeps them, so it can never tear down a live session’s containers. Containers are install-level (compose project devbot), shared by every session regardless of project, which is why the registry is install-level too. Volumes/mounted data (storage/ollama) are never touched. devbot up/make up alone start services without registering a session, so they are not auto-downed by a later harness exit.

devbot help

Show the full command reference.

devbot install

Install all tools. Idempotent — safe to re-run. Writes .devbot.global.jsonc on first run.

devbot update [tag] [--auto]

Move the install to the newest release tag (or an explicit tag: devbot update <tag> pins/downgrades). Fetches tags from origin, and is a clean no-op when already on the newest tag. On a real move it refreshes tools, agentic modules, and external modules, then records the release in the global config’s version so every project reinits on its next start. The reinit it runs is capped like init --all: DEV_BOT_INIT_JOBS sets the width, otherwise half of nproc (2–16), and a nested project still waits for its ancestor. Each release carries its notes as the annotated tag message, so the run ends by printing the notes of every version it crossed — from the version it left (exclusive) to the one it landed on (inclusive), oldest first; a downgrade shows only the target’s notes, and a tag without recorded notes is listed as such. --auto is the quiet, non-interactive form used by the bare devbot start — a single-line no-op that never prompts; without it the usual update output is printed.

devbot init [path] [--all|-a] [--full|-f] [-j|--jobs N]

Initialize dev-bot in a project directory (default: current directory). Writes .devbot.project.jsonc and wires modules into .opencode/ and .agents/.

Idempotent: a directory that already carries .devbot.project.jsonc is reset first — every module reset.sh, the generated module memory and the pre-modules memory files — and then wired, so re-running it rebuilds the wiring from scratch. A directory without that config is wired directly.

--all initializes every project registered in the global config (mutually exclusive with a path); --full also drops the project’s QMD collection and opencodebase-index data.

-j/--jobs N sets how many of those projects are wired at once; it defaults to half of nproc (2–16) and DEV_BOT_INIT_JOBS overrides it. -j 1 is the serial run. A project nested inside another is wired after its ancestor — a nested project writes no plugin package an ancestor already supplies — while projects that are not nested in each other run together. With more than one job the machine-wide steps are hoisted out of the workers and run once at the end — the global registry is written in one batch, the shared memory store is rebuilt once per distinct engine and store, and the external-module mirror is pruned once. Each project’s output goes to storage/.init-all/<NN>.log; the run prints one line per project and names the log of any that failed. A failing project does not stop the others, and the run exits non-zero.

devbot reinit [args...]

Deprecated alias for devbot init — same arguments, same detection, same behaviour.

devbot up / devbot down

Start / stop the Docker services via auto-discovered compose files across all modules (src/tools, src/agentic, src/harnesses).

devbot up / devbot down — start and stop the devbot containers. Neither takes an owner flag: every holder of the stack is a devbot session (see Session teardown on exit), because devbot launches herdr itself rather than a shell wrapper launching it.

devbot up is consumer-driven: a compose file is only included when its module is enabled — and enabled is resolved over every registered project, not the one you ran it from. Containers are install-level, so a module only another registered project enables still has to be up: its session would otherwise find the service missing from a stack this project started. A module that needs a provider’s service without running a container of its own ships a compose fragment that include:s the provider’s compose — so enabling the consumer boots the provider even when the provider module is disabled (e.g. opencodebase-index’s fragment boots ollama, which is disabled by default). When no enabled module ships a compose file, the Docker section is skipped entirely and nothing is started. GPU detection (gpu_enabled) runs from devbot install/update, not the ollama module install, so it survives ollama being disabled.

devbot down is not module-scoped, and not project-scoped. Containers are install-level (one compose project devbot, shared by every session), so a module disabled here may still own a container another project needs — removal therefore selects every discovered compose and runs down --remove-orphans (which also collects the datasources gateway, whose generated compose sits outside the discovery path). That is the same operation the last-session teardown runs. It is gated on two locks. It takes the install-level up lock first — a start holds it for its whole sequence, and waiting on it after the registry lock would invert the order a start uses — so a down typed during a devbot up waits up to 30 s (DEVBOT_DOWN_UP_LOCK_WAIT) and then refuses rather than tearing the stack down mid-up; the last-session teardown, which already holds the registry lock, takes it without waiting and leaves the containers to that start. Then it checks what still needs the containers: while any devbot session is alive it removes nothing and warns instead, because those containers serve that session too. There is no override flag: the containers are shared, and a live session is exactly the state the gate exists to protect.

Every dev-bot compose file declares name: devbot — the compose project name is read from the first -f file, and a consumer fragment is often first, so declaring the same name everywhere keeps all containers (ollama, litellm) in a single devbot project regardless of which fragment is merged first (otherwise ollama would boot under the fragment’s directory name and down/orphan management would break). A test enforces the convention.

Because each container has a fixed container_name (dev-bot-*), a container left behind by a different compose project — e.g. one created before the project was renamed to devbot, or by a manual docker run — is invisible to down --remove-orphans yet blocks recreation with a name conflict. devbot up removes such containers before starting, so it self-heals instead of failing.

devbot tool <name> [args...]

Run a dev-bot tool by name (e.g. devbot tool tree, devbot tool git-report). Run devbot tool with no name to list available tools.

devbot tool wait --title "<what>" [--message "<why>"] --duration <30s|5m|1h|seconds> waits for a fixed duration. It prints when it started, how long it will wait and how much time is left to stderr, then one wake-up line naming the title, the message and the time it waited to stdout. Run it on the harness’s long-running channel so its exit notification wakes the agent, instead of a hand-rolled sleep; durations are capped at 1h.

devbot tool wait --title "deploy check" --message "verify staging" --duration 90s

devbot tool project-for-path <path> resolves a file or directory to the registered project that owns it — the longest projects entry containing the path — and reports that project’s effective commit_memory, workflow, devbot_dir, datasources, modules, workspace type and configured MCP servers. Use it in a polyrepo session before any project-scoped action; see Polyrepo sessions. Format the output with --json, or read one value with --key <name>. An unregistered path exits 3.

devbot tool project-for-path src/index.ts --key workflow

devbot tool project-memory <path> loads the always-on memory of the project that owns the path: its AGENTS.md and/or CLAUDE.md when present, then <devbot_dir>/memory/active/**/*.md recursively in sorted path order, each labelled by file (a symlinked file also shows its resolved target). Run it once per project, before the first read or edit there in a polyrepo session — the output states that the memory applies only within that project. An unregistered path exits 3; a project with no memory prints a notice and exits 0.

devbot tool project-memory platform/src/index.php

devbot kctl env|contexts|run|exec [path]

Reach a project’s Kubernetes clusters through the kubeconfig the k8s module generated for it (~/.kube/devbot/<project_name>-<hash>.yaml). The filename and the context names are derived, so this command resolves them instead of making the caller reconstruct them.

Form Does
env [path] Prints KUBECONFIG and the context name — never credentials
contexts [path] Lists the cluster name, context and region the project opted into
run [path] -- <kubectl args> Runs kubectl against the project’s kubeconfig
exec <cluster> [path] -- <kubectl args> Runs kubectl against one cluster, applying its context

path defaults to the current directory. run prints the target context to stderr first, so a mutating command always shows which cluster it is about to change; pass --context <name> to override. exec takes the cluster name from the catalogue, applies that cluster’s context itself and refuses a caller --context — it is the cluster-scoped form the kctl-<key> MCP servers call, so one cluster’s server cannot reach another.

devbot kctl contexts observability
devbot kctl run observability -- get pods -n core
devbot kctl exec obs-prod observability -- get pods -n core

Never use ~/.kube/config for these clusters: its contexts are SSO exec contexts that expire, while the generated ones use the devbot profile. The files are rendered, not read live — run devbot reinit <path> after changing the project’s kubectl selection or the global catalogue. Agents do not call this from a shell at all: the module’s memory and the shipped guards block kubectl, and the kctl-<key> MCP servers are the permitted path. See the k8s-access skill for the RBAC boundaries.

devbot list <type> [-a|--all]

List agentic artifacts as a markdown table. type is one of:

Type What it lists
commands Slash commands
agents Agent definitions
skills Skills
hooks OpenCode plugin hooks
mcps MCP servers
tools Tools (the devbot-tools MCP tool set)

-a / --all includes artifacts from disabled modules.

devbot prune [days] [--all|-a]

Prune old OpenCode sessions (default: 30 days).

devbot prune --db [days] [--force]

Prune the OpenCode SQLite database itself, machine-wide (default: 30 days, or DEVBOT_OPENCODE_DB_RETENTION_DAYS). Two passes, then a single VACUUM:

  1. Strip diagnostics bloat. OpenCode attached a state.metadata.diagnostics map covering every file in the workspace to each write/edit tool part — ~18 MB per call in a multi-repo checkout, stored twice (part and the event replay journal). It is ~99% of a large session payload and the reason opening an old session takes tens of seconds. The field is removed from both tables; messages, tool inputs and outputs are untouched.
  2. Delete aged rows. Sessions older than the cutoff and their events. project rows are never age-pruned.

Then VACUUMs the file to reclaim disk. Skips when OpenCode is running unless --force is given. VACUUM rewrites the whole file, so on a multi-gigabyte database the command takes minutes — it is not run automatically.

src/harnesses/opencode/strip_opencode_diagnostics.py is the standalone, dry-run-first form of step 1: it reports what it would reclaim and changes nothing until --apply, and it takes a database copy before applying. Use it directly when you want that backup (devbot prune --db does not make one).

devbot stats [--days=N] [--project=DIR] [--all|-a] [--harness=HARNESS]

Report tool usage, MCP-server usage, tool grades, and the most-used arguments for bash/pty_spawn/skill/grep/glob, as a Markdown report for the last N days (default: 30).

The command is harness-agnostic: it detects the harness (the harness setting, or --harness), delegates data gathering to that harness’s stats adapter (src/harnesses/<harness>/stats.sh), validates the canonical JSON it returns, and renders the report. Without an adapter for the detected harness the command fails with a FATAL.

When the install-level grade matrix exists (.agents/logs/tools-grades.csv, written by devbot:grade-tools), the report gains a Tool Grades section: every tool’s average grade over the rows where it was used (grade ≥ 1), highest first, plus Min (the worst grade it earned there) and σ (the spread across uses, shown only from three uses up). Tools never used are listed too, with a — average and zero uses. A Poor ratings (1–3) list follows with the de-duplicated reasons behind the low grades, taken from the matrix’s notes. Grades are windowed and scoped exactly like the usage figures above them: --days bounds the rows, --project restricts them to one project.

A Tool Quadrants grid then places every tool on quality against demand: rows are Avg > 3.5 and below, columns are uses ≥ the demand bar and below. workhorse and specialist are keepers, improve means the capability is needed but the implementation disappoints, and unproven means too few uses to judge — a candidate, not a verdict. Tools never used sit below the grid. The demand bar is the median use count of the tools actually used, floored at 3, and is recomputed per report, so a tool can move quadrants as the matrix grows.

Flag Description
--days=N Report window in days (default: 30)
--project=DIR Restrict the report to one project directory
--all, -a Aggregate every project (the default; accepted for clarity)
--harness=NAME Force a harness adapter (default: configured harness)
devbot stats                          # last 30 days, every project
devbot stats --days=7                 # last week
devbot stats --project=../other-repo  # one project only
devbot stats --harness=claudecode

Writing a stats adapter

The parent command (bin/stats.sh) is harness-agnostic: it detects the harness, runs src/harnesses/<harness>/stats.sh, validates the JSON it prints, and renders the Markdown report (src/_shared/render_stats.py). Each harness owns only the data gathering; all presentation lives in the parent.

A stats adapter is invoked as:

stats.sh --days <N> [--all | --project <dir>]

Without a scope flag (or with --all) the adapter aggregates every project; --project restricts it to one project directory. --all and --project are mutually exclusive.

and must print a single JSON object on stdout:

{
  "schema": 1,
  "harness": "opencode",
  "days": 30,
  "scope": "current",
  "scope_label": "/path/to/project",
  "generated_at": "2026-09-10T16:40:00Z",
  "cost_kind": "estimated",
  "tools": [{ "name": "bash", "count": 27710, "tokens": 196400000, "cost": 12.34 }],
  "mcp_servers": [
    {
      "server": "devbot-tools",
      "count": 1500,
      "tokens": 210000,
      "cost": 0.5,
      "tools": [
        {
          "name": "search-memories",
          "count": 1025,
          "tokens": 150000,
          "cost": 0.42
        }
      ]
    }
  ],
  "tool_arguments": {
    "bash": [{ "value": "git status", "count": 338 }],
    "skill": [{ "value": "devbot:software-development", "count": 42 }],
    "grep": [{ "value": "devbot_dir", "count": 20 }],
    "glob": [{ "value": "**/*.bats", "count": 15 }]
  }
}
Field Required Notes
schema yes Contract version; currently 1.
harness yes Harness name (shown in the report title).
days yes Window, echoed into the report.
scope yes all (every project, the default) or current (one project, via --project).
scope_label yes Human label (project path, or all projects).
generated_at yes ISO-8601 timestamp.
cost_kind yes estimated, exact, or null. Selects the cost column header — estimated renders Cost (est.), anything else renders Cost. The column itself appears whenever any tool or MCP server has a non-null cost.
cost_corrected no opencode-v2 only: how many recorded per-message costs the model catalogue overruled as impossible (that adapter’s own check). An adapter that cannot compare a cost against a published rate omits it.
tools[] yes Every tool, native and MCP. name and count are required; tokens and cost may be null.
mcp_servers[] yes MCP aggregation: server, count, tokens, cost, and tools[] holding short tool names.
tool_arguments no Optional argument aggregation for bash/pty_spawn/skill/grep/glob — a map of tool name to [{ "value", "count" }]. Tools absent from the map render no sub-table.

The parent validates the payload before rendering — a non-zero adapter exit, malformed JSON, missing required keys, or an unsupported schema fails the command.

The report contains a Tool Usage table, an MCP Server Usage table (shares are relative to MCP calls, not all tool calls), and a Tool Arguments section with one sub-table per aggregated tool.

The parent additionally reads the install-level grade matrix (.agents/logs/tools-grades.csv, written by devbot:grade-tools) and, after validation, injects an optional tool_grades block — adapters must never emit it. When present, the report gains a Tool Grades table (average, uses, worst grade, spread), a Tool Quadrants grid, and a Poor ratings (1–3) list; every tool in the block carries a bucket, the block reports the days window it was built with, and its demand_bar and quality_threshold are what the grid is drawn against. The parent passes its own --days to the helper, so the grades cover the same window as the usage figures — rows counts the rows in scope and in the window, while total_rows stays all-time as the denominator the window is shown against. Session ids are deliberately not counted: every subagent grades its own slice under its own session, so a session tally would measure agent count rather than how much evidence backs the table. A row the matrix left without a parseable datetime is placed by the dated rows around it: kept only when the nearest dated row before it and after it are both inside the window, dropped otherwise. The CSV path is overridable with DEV_BOT_STATS_GRADES_CSV (tests / out-of-tree installs); a missing or malformed CSV leaves the report unchanged.

To add an adapter for a new harness:

  1. Create src/harnesses/<name>/stats.sh — a thin wrapper that runs your helper with "$@" (mirror the existing adapters).
  2. Gather the data for the requested window (--days) and scope (every project by default, or the --project directory) and print the canonical JSON above, including tool_arguments when the harness exposes tool arguments.
  3. Attribute cost/tokens as accurately as the harness allows. When cost can only be estimated, set cost_kind to estimated.
  4. Keep presentation out of the adapter — the parent renders the Markdown.
  5. Add BATS tests under src/harnesses/<name>/tests/ using fixtures; never point tests at real user data.

devbot datasources <subcommand>

Subcommand Description
reload Re-render the datasource catalogue and verify the gateway serves it

reload re-evaluates the datasources against the network as it is now. The catalogue is otherwise evaluated once, at devbot up: a database behind a VPN that was down at boot is dropped from the gateway config while its harness manifest stays registered, so enabling it fails until a restart. reload re-renders, hands the config to a running gateway (toolbox reloads on its own poll), starts a gateway or sidecar a boot never started, and confirms every published — and every selected — source answers a tools/list request. It is explicit: nothing re-evaluates in the background. See Datasources.

devbot models <subcommand>

Manage LLM models via Ollama:

Subcommand Description
pull <model> Pull a model from the registry
list-local List locally cached models
list-remote Browse remote models
remove <model> Remove a locally cached model

devbot module <subcommand>

Manage external modules (see Module Reference for details):

Subcommand Description
install Clone/pull configured external modules
init [path] Wire modules into .opencode/ directories
add <url | path> Register a module (git URL or local path)
remove <name> Unregister a module
list List registered modules
sync Re-wire all modules (alias for init)

Contents

Type Name Purpose
Command audit Audit the dev-bot system setup in the current project — verify devbot reinit wired things correctly and the local agent can use every dev-bot capability, regardless of which harness (opencode or claudecode) is running. Produces a markdown report of what did not work and why.
Command audit-fix Grab an audit report (produced by devbot:audit slash command) and address the flagged issues.
Command full-audit-and-fix-loop Audit, fix and locally review in a worktree, then open a PR and work the Copilot loop.
Tool list-projects List sibling projects configured in the global devbot config, each with its name, full path, and whether the agent has access to it.
Tool project-for-path Resolve a path to the registered devbot project that owns it, and report that project’s effective configuration.
Tool project-memory Print the active memory a project loads for itself — its AGENTS.md/CLAUDE.md and /memory/active/**/*.md — labelled by file and scoped to that project.
Tool wait Wait a fixed duration, showing start and remaining time, then one wake-up line

Configuration

The CLI manages two config files — .devbot.global.jsonc (install-level) and .devbot.project.jsonc (per project) — both written by devbot install / devbot init and never overwritten once they exist.

See also

  • Configuration — the .devbot.global.jsonc / .devbot.project.jsonc files these commands manage
  • Module Reference — module lifecycle and the devbot module CLI
  • OpenCode — the harness devbot starts