CLI Commands
All dtoolkit CLIs follow the same conventions: commander for argument parsing, picocolors for output, and @clack/prompts for interactive wizards. Install any CLI globally with npm install -g @dtoolkit/<package> or run directly via npx.
dbrain
Section titled “dbrain”Persistent memory server. Manages brain initialization, server lifecycle, federation, and API keys.
Commands
Section titled “Commands”| Command | Description |
|---|---|
dbrain init [path] | Initialize a new brain (database, config, identity) |
dbrain start [path] | Start the API server (REST + MCP on :7878) and dashboard (:7879) |
dbrain connect <client> [url] | Connect a client CLI to a running brain |
dbrain status [path] | Check brain health and status |
dbrain compact | Compact the brain (deduplicate facts, recalculate tiers) |
dbrain configure [path] | Reconfigure the brain interactively |
dbrain link <url> | Link to a shared brain (federation) |
dbrain unlink <name> | Remove a connection to a shared brain |
dbrain connections | List connected brains with health status |
dbrain keys <action> | Manage API keys for shared brains (create, list, revoke) |
Interactive wizard that creates a new brain. Sets up the SQLite database, config file, identity documents, and initial entities.
dbrain initdbrain init /custom/data/pathdbrain init --non-interactive| Flag | Description |
|---|---|
[path] | Data path (default: ~/.dbrain) |
--non-interactive | Skip prompts, use environment variables (for Docker/CI) |
Environment variables for non-interactive mode:
| Variable | Default | Purpose |
|---|---|---|
DBRAIN_DATA | ~/.dbrain | Data path |
DBRAIN_PORT | 7878 | API port |
DBRAIN_HOST | 0.0.0.0 | Bind address |
DBRAIN_TOKEN | Auto-generated | Access token |
DBRAIN_AGENT_NAME | dBrain | AI identity name |
DBRAIN_OWNER_NAME | Human | Owner name |
DBRAIN_BRAIN_TYPE | personal | personal or shared |
connect
Section titled “connect”Configures a client CLI to connect to a running brain. Fetches connection details from the brain’s /connect endpoint and writes the client’s native config files.
dbrain connect claude http://localhost:7878dbrain connect gemini http://your-server:7878 --token sk-dbr_abc123| Flag | Description |
|---|---|
<client> | Target CLI: claude, codex, gemini, opencode |
[url] | Brain URL (prompted if omitted) |
--token <token> | Access token |
compact
Section titled “compact”Runs brain maintenance: deduplicates cold facts, recalculates memory tiers, and optionally extracts entities from unprocessed conversations.
dbrain compactdbrain compact --process --dry-rundbrain compact --dedup --threshold 0.9| Flag | Description |
|---|---|
--path <path> | Data path |
--process | Extract entities and facts from unprocessed conversations via LLM |
--dedup | Deduplicate cold facts only |
--tiers | Recalculate tiers only |
--dry-run | Preview changes without writing |
--threshold <n> | Similarity threshold, 0-1 (default: 0.85) |
--limit <n> | Max facts per batch (default: 1000) |
link / unlink / connections
Section titled “link / unlink / connections”Manage federation between personal and shared brains.
dbrain link http://team-brain:7878 --token sk-dbr_team123dbrain unlink team-braindbrain connections| Flag | Description |
|---|---|
--token <token> | Access token for the shared brain |
--name <name> | Connection name (defaults to remote brain name) |
--path <path> | Local brain data path |
Manage per-user API keys for shared brains.
dbrain keys create --user-id dev1 --user-name "Developer One"dbrain keys listdbrain keys revoke --key-id abc123| Flag | Description |
|---|---|
<action> | create, list, or revoke |
--url <url> | Brain URL (or DBRAIN_URL env) |
--token <token> | Admin token (or DBRAIN_TOKEN env) |
--user-id <id> | User ID (for create) |
--user-name <name> | Display name (for create) |
--permissions <perms> | read, write, or read+write (default: read+write) |
--key-id <id> | Key ID (for revoke) |
dcontext
Section titled “dcontext”Hooks for AI coding CLIs. Injects identity and project context at session start, saves transcripts before compaction.
Commands
Section titled “Commands”| Command | Description |
|---|---|
dcontext init | Initialize dcontext for the current directory |
dcontext install <target> | Install hooks for a target CLI |
dcontext uninstall <target> | Remove hooks for a target CLI |
dcontext status | Show configuration, context, and stats |
dcontext config | Modify dcontext configuration interactively |
dcontext explore [path] | Preview the context that would be injected for a directory |
dcontext sync | Sync project code graph |
dcontext hook <event> | Handle hook events (internal, called by CLI hooks) |
Interactive wizard that connects dcontext to dbrain (and optionally dwork and dops), maps the current directory to an entity, and saves configuration.
dcontext initThe wizard will prompt to connect to an existing dbrain or start a local one, then optionally connect to dwork and dops servers.
install / uninstall
Section titled “install / uninstall”Register or remove dcontext hooks in a target CLI’s configuration. After installation, the target CLI will automatically receive identity and project context at session start.
dcontext install claudedcontext install geminidcontext install opencodedcontext uninstall claude| Flag | Description |
|---|---|
<target> | Target CLI: claude, gemini, opencode |
explore
Section titled “explore”Preview the full context block that dcontext would inject for a given directory, without actually modifying any files. Useful for debugging context injection.
dcontext exploredcontext explore /path/to/projectstatus
Section titled “status”Displays current configuration including connected services (dbrain, dwork, dops), installed targets, entity mappings, and injection statistics.
dcontext statusAI-native, Markdown-driven project manager. Tasks live in BACKLOG.md, documentation in numbered files. SQLite FTS5 provides search.
Commands
Section titled “Commands”| Command | Description |
|---|---|
dwork init [path] | Initialize dwork (config, database, optional first project) |
dwork start [path] | Start the server (REST + MCP on :7881, dashboard on :7882) |
dwork status [path] | Check dwork health and status |
dwork sync <project> | Sync project docs from source code via dproxy |
dwork connect [client] [url] | Connect a client CLI to a running dwork server |
dwork configure [path] | Reconfigure dwork interactively |
dwork keys <action> | Manage API keys (create, list, revoke) |
Interactive wizard that creates the config file, SQLite database, and optionally scaffolds a first project with the four mandatory Markdown files (README.md, TECH.md, ROADMAP.md, BACKLOG.md).
dwork initdwork init /custom/data/pathdwork init --non-interactive| Flag | Description |
|---|---|
[path] | Data path (default: ~/.dwork) |
--non-interactive | Skip prompts (for Docker/CI) |
Syncs project documentation from the source code directory by analyzing it via dproxy. Requires dproxy to be configured in config.json.
dwork sync my-projectdwork sync my-project --path /custom/data| Flag | Description |
|---|---|
<project> | Project slug |
--path <path> | Data path |
connect
Section titled “connect”Configures a client CLI to use a running dwork server via MCP.
dwork connect claudedwork connect gemini http://team-server:7881 --token sk-dwk_abc123| Flag | Description |
|---|---|
[client] | Target CLI: claude, codex, gemini, opencode |
[url] | dwork URL (prompted if omitted) |
--token <token> | Access token |
Manage API keys for the dwork server.
dwork keys create --user-id dev1 --user-name "Alice"dwork keys listdwork keys revoke --key-id abc123| Flag | Description |
|---|---|
<action> | create, list, or revoke |
--url <url> | dwork URL (or DWORK_URL env) |
--token <token> | Admin token (or DWORK_TOKEN env) |
--user-id <id> | User ID (for create) |
--user-name <name> | Display name (for create) |
--permissions <perms> | read, write, or read+write (default: read+write) |
--key-id <id> | Key ID (for revoke) |
dproxy
Section titled “dproxy”Universal CLI adapter for invoking AI models via local CLIs. Supports four providers with persistent memory, conversation history, and prompt templates.
Commands
Section titled “Commands”| Command | Description |
|---|---|
dproxy init | Interactive setup wizard (required before first use) |
dproxy ask [prompt...] | Send a single-shot prompt to an AI model |
dproxy chat | Start an interactive conversation (REPL) |
dproxy serve | Start the dproxy HTTP API server |
dproxy history <subcommand> | Manage query history (list, show, search, clear) |
dproxy memory <subcommand> | Manage persistent memory snippets (set, get, list, search, delete) |
dproxy template <subcommand> | Manage YAML prompt templates (list, show, add, run, delete) |
dproxy config [set|get] | View or modify configuration |
Send a prompt and receive a response. Supports file attachments, streaming, session continuation, and context injection.
dproxy ask "Explain this error" -p claudedproxy ask "Review this code" --file src/main.ts --streamecho "data here" | dproxy ask "Summarize this"dproxy ask "Continue from before" --continue| Flag | Description |
|---|---|
-p, --provider <name> | Provider: claude, codex, gemini, opencode |
-m, --model <model> | Model override |
--stream | Stream response text as it arrives |
--system-prompt <text> | System prompt override |
-f, --file <paths...> | Attach one or more files to the prompt |
-o, --output-format <fmt> | Output format: text, json, stream-json |
--max-turns <n> | Max agent turns |
--max-budget-usd <n> | Max budget in USD |
--no-memory | Skip memory injection |
--memory <keys> | Inject only specific memory keys (comma-separated) |
--no-life | Skip life/PARA context injection |
--no-history | Do not save to history |
--raw | Print raw JSON response |
--token-footer | Append token usage footer |
--max-session-tokens <n> | Reset session if context exceeds this token count |
-c, --continue | Continue last conversation |
-r, --resume <id> | Resume a specific session |
Interactive REPL for multi-turn conversations. Shares the same context injection pipeline as ask.
dproxy chatdproxy chat -p gemini --continuedproxy chat --resume abc123 -m claude-sonnet-4-20250514| Flag | Description |
|---|---|
-p, --provider <name> | Provider: claude, codex, gemini, opencode |
-m, --model <model> | Model override |
-c, --continue | Continue last conversation |
-r, --resume <id> | Resume a specific session |
--max-turns <n> | Max agent turns per message |
--no-memory | Skip memory injection |
--no-life | Skip life/PARA context injection |
Start a Fastify HTTP API server that provides full CLI parity via REST endpoints with Bearer token auth and SSE streaming.
dproxy servedproxy serve --port 8080 --host 0.0.0.0| Flag | Description |
|---|---|
--port <port> | Port to listen on (default from config) |
--host <host> | Host to bind to |
history
Section titled “history”Manage the append-only JSONL query history.
dproxy history listdproxy history list --limit 50dproxy history show abc12345dproxy history search "react hooks"dproxy history clear| Subcommand | Description |
|---|---|
list | List recent queries (--limit <n>, default 20) |
show <id> | Show full prompt, response, cost, and duration |
search <query> | Search history entries |
clear | Delete all history |
memory
Section titled “memory”CRUD for named memory snippets stored as Markdown files. Memory is automatically injected into prompts unless --no-memory is used.
dproxy memory set project-conventions "Always use TypeScript strict mode"dproxy memory get project-conventionsdproxy memory listdproxy memory search "typescript"dproxy memory delete project-conventions| Subcommand | Description |
|---|---|
set <key> <value...> | Create or update a memory entry |
get <key> | Read a memory entry |
list | List all memory keys |
search <query> | Search memory contents |
delete <key> | Remove a memory entry |
template
Section titled “template”CRUD for YAML prompt templates with {{variable}} interpolation.
dproxy template listdproxy template show code-reviewdproxy template add code-review --file review.yamldproxy template run code-review --var file=src/main.tsdproxy template delete code-review| Subcommand | Description |
|---|---|
list | List all templates |
show <name> | Show template details |
add <name> | Create a template (from file or stdin) |
run <name> | Execute a template with variable substitution |
delete <name> | Remove a template |
Agent observability. Ingests telemetry from AI CLI transcripts and provides usage statistics, cost breakdowns, and error tracking.
Commands
Section titled “Commands”| Command | Description |
|---|---|
dops init [path] | Initialize dops (config and database) |
dops start [path] | Start the server (REST + MCP on :7883, dashboard on :7884) |
dops status [path] | Check dops health and status |
dops ingest | Scan local CLI transcripts and push telemetry to the server |
dops stats | Show agent usage statistics |
dops costs | Show estimated costs by model |
Creates the config file and SQLite database for storing telemetry data.
dops initdops init /custom/data/pathdops init --non-interactive| Flag | Description |
|---|---|
[path] | Data path (default: ~/.dops) |
--non-interactive | Skip prompts (for Docker/CI) |
ingest
Section titled “ingest”Scans local transcript directories for Claude Code, Codex, Gemini, and OpenCode sessions, then pushes the extracted telemetry to a running dops server.
dops ingest --url http://localhost:7883 --token sk-dops_abc123dops ingest --url http://localhost:7883 --token sk-dops_abc123 --days 7 --source claude geminidops ingest --url http://localhost:7883 --token sk-dops_abc123 --dry-run| Flag | Description |
|---|---|
--url <url> | dops server URL (required) |
--token <token> | dops access token (required) |
--days <n> | Scan last N days (default: 30) |
--dry-run | Scan and report without pushing data |
--source <names...> | Filter sources: claude, codex, gemini, opencode |
Display aggregated usage statistics including tokens, tool calls, and errors.
dops stats --url http://localhost:7883 --token sk-dops_abc123dops stats --url http://localhost:7883 --token sk-dops_abc123 --days 7 --source claude| Flag | Description |
|---|---|
--url <url> | dops server URL (required) |
--token <token> | dops access token (required) |
--days <n> | Last N days (default: 30) |
--source <name> | Filter by source: claude, codex, gemini, opencode |
Show estimated costs broken down by model, calculated from token usage and published pricing.
dops costs --url http://localhost:7883 --token sk-dops_abc123dops costs --url http://localhost:7883 --token sk-dops_abc123 --days 7| Flag | Description |
|---|---|
--url <url> | dops server URL (required) |
--token <token> | dops access token (required) |
--days <n> | Last N days (default: 30) |
Quick reference
Section titled “Quick reference”A summary of all CLI entry points and the default ports for server products.
| Product | Install | Default port(s) |
|---|---|---|
| dbrain | npm install -g @dtoolkit/dbrain | :7878 (API + MCP), :7879 (Dashboard) |
| dcontext | npm install -g @dtoolkit/dcontext | N/A (hooks only) |
| dwork | npm install -g @dtoolkit/dwork | :7881 (API + MCP), :7882 (Dashboard) |
| dproxy | npm install -g @dtoolkit/dproxy | :7880 (HTTP API via serve) |
| dops | npm install -g @dtoolkit/dops | :7883 (API + MCP), :7884 (Dashboard) |
Typical setup flow
Section titled “Typical setup flow”# 1. Initialize and start the braindbrain init && dbrain start
# 2. Initialize and start the project managerdwork init && dwork start
# 3. Initialize and start observabilitydops init && dops start
# 4. Set up context hooks for your AI CLIdcontext initdcontext install claude
# 5. Initialize the proxy (optional, for multi-provider access)dproxy initFor detailed product guides, see the individual product pages: dbrain, dcontext, dwork, dproxy, and dops.