Skip to content
dtoolkit

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.

Persistent memory server. Manages brain initialization, server lifecycle, federation, and API keys.

CommandDescription
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 compactCompact 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 connectionsList 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.

terminal
dbrain init
dbrain init /custom/data/path
dbrain init --non-interactive
FlagDescription
[path]Data path (default: ~/.dbrain)
--non-interactiveSkip prompts, use environment variables (for Docker/CI)

Environment variables for non-interactive mode:

VariableDefaultPurpose
DBRAIN_DATA~/.dbrainData path
DBRAIN_PORT7878API port
DBRAIN_HOST0.0.0.0Bind address
DBRAIN_TOKENAuto-generatedAccess token
DBRAIN_AGENT_NAMEdBrainAI identity name
DBRAIN_OWNER_NAMEHumanOwner name
DBRAIN_BRAIN_TYPEpersonalpersonal or shared

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.

terminal
dbrain connect claude http://localhost:7878
dbrain connect gemini http://your-server:7878 --token sk-dbr_abc123
FlagDescription
<client>Target CLI: claude, codex, gemini, opencode
[url]Brain URL (prompted if omitted)
--token <token>Access token

Runs brain maintenance: deduplicates cold facts, recalculates memory tiers, and optionally extracts entities from unprocessed conversations.

terminal
dbrain compact
dbrain compact --process --dry-run
dbrain compact --dedup --threshold 0.9
FlagDescription
--path <path>Data path
--processExtract entities and facts from unprocessed conversations via LLM
--dedupDeduplicate cold facts only
--tiersRecalculate tiers only
--dry-runPreview changes without writing
--threshold <n>Similarity threshold, 0-1 (default: 0.85)
--limit <n>Max facts per batch (default: 1000)

Manage federation between personal and shared brains.

terminal
dbrain link http://team-brain:7878 --token sk-dbr_team123
dbrain unlink team-brain
dbrain connections
FlagDescription
--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.

terminal
dbrain keys create --user-id dev1 --user-name "Developer One"
dbrain keys list
dbrain keys revoke --key-id abc123
FlagDescription
<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)

Hooks for AI coding CLIs. Injects identity and project context at session start, saves transcripts before compaction.

CommandDescription
dcontext initInitialize dcontext for the current directory
dcontext install <target>Install hooks for a target CLI
dcontext uninstall <target>Remove hooks for a target CLI
dcontext statusShow configuration, context, and stats
dcontext configModify dcontext configuration interactively
dcontext explore [path]Preview the context that would be injected for a directory
dcontext syncSync 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.

terminal
dcontext init

The wizard will prompt to connect to an existing dbrain or start a local one, then optionally connect to dwork and dops servers.

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.

terminal
dcontext install claude
dcontext install gemini
dcontext install opencode
dcontext uninstall claude
FlagDescription
<target>Target CLI: claude, gemini, opencode

Preview the full context block that dcontext would inject for a given directory, without actually modifying any files. Useful for debugging context injection.

terminal
dcontext explore
dcontext explore /path/to/project

Displays current configuration including connected services (dbrain, dwork, dops), installed targets, entity mappings, and injection statistics.

terminal
dcontext status

AI-native, Markdown-driven project manager. Tasks live in BACKLOG.md, documentation in numbered files. SQLite FTS5 provides search.

CommandDescription
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).

terminal
dwork init
dwork init /custom/data/path
dwork init --non-interactive
FlagDescription
[path]Data path (default: ~/.dwork)
--non-interactiveSkip 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.

terminal
dwork sync my-project
dwork sync my-project --path /custom/data
FlagDescription
<project>Project slug
--path <path>Data path

Configures a client CLI to use a running dwork server via MCP.

terminal
dwork connect claude
dwork connect gemini http://team-server:7881 --token sk-dwk_abc123
FlagDescription
[client]Target CLI: claude, codex, gemini, opencode
[url]dwork URL (prompted if omitted)
--token <token>Access token

Manage API keys for the dwork server.

terminal
dwork keys create --user-id dev1 --user-name "Alice"
dwork keys list
dwork keys revoke --key-id abc123
FlagDescription
<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)

Universal CLI adapter for invoking AI models via local CLIs. Supports four providers with persistent memory, conversation history, and prompt templates.

CommandDescription
dproxy initInteractive setup wizard (required before first use)
dproxy ask [prompt...]Send a single-shot prompt to an AI model
dproxy chatStart an interactive conversation (REPL)
dproxy serveStart 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.

terminal
dproxy ask "Explain this error" -p claude
dproxy ask "Review this code" --file src/main.ts --stream
echo "data here" | dproxy ask "Summarize this"
dproxy ask "Continue from before" --continue
FlagDescription
-p, --provider <name>Provider: claude, codex, gemini, opencode
-m, --model <model>Model override
--streamStream 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-memorySkip memory injection
--memory <keys>Inject only specific memory keys (comma-separated)
--no-lifeSkip life/PARA context injection
--no-historyDo not save to history
--rawPrint raw JSON response
--token-footerAppend token usage footer
--max-session-tokens <n>Reset session if context exceeds this token count
-c, --continueContinue last conversation
-r, --resume <id>Resume a specific session

Interactive REPL for multi-turn conversations. Shares the same context injection pipeline as ask.

terminal
dproxy chat
dproxy chat -p gemini --continue
dproxy chat --resume abc123 -m claude-sonnet-4-20250514
FlagDescription
-p, --provider <name>Provider: claude, codex, gemini, opencode
-m, --model <model>Model override
-c, --continueContinue last conversation
-r, --resume <id>Resume a specific session
--max-turns <n>Max agent turns per message
--no-memorySkip memory injection
--no-lifeSkip 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.

terminal
dproxy serve
dproxy serve --port 8080 --host 0.0.0.0
FlagDescription
--port <port>Port to listen on (default from config)
--host <host>Host to bind to

Manage the append-only JSONL query history.

terminal
dproxy history list
dproxy history list --limit 50
dproxy history show abc12345
dproxy history search "react hooks"
dproxy history clear
SubcommandDescription
listList recent queries (--limit <n>, default 20)
show <id>Show full prompt, response, cost, and duration
search <query>Search history entries
clearDelete all history

CRUD for named memory snippets stored as Markdown files. Memory is automatically injected into prompts unless --no-memory is used.

terminal
dproxy memory set project-conventions "Always use TypeScript strict mode"
dproxy memory get project-conventions
dproxy memory list
dproxy memory search "typescript"
dproxy memory delete project-conventions
SubcommandDescription
set <key> <value...>Create or update a memory entry
get <key>Read a memory entry
listList all memory keys
search <query>Search memory contents
delete <key>Remove a memory entry

CRUD for YAML prompt templates with {{variable}} interpolation.

terminal
dproxy template list
dproxy template show code-review
dproxy template add code-review --file review.yaml
dproxy template run code-review --var file=src/main.ts
dproxy template delete code-review
SubcommandDescription
listList 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.

CommandDescription
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 ingestScan local CLI transcripts and push telemetry to the server
dops statsShow agent usage statistics
dops costsShow estimated costs by model

Creates the config file and SQLite database for storing telemetry data.

terminal
dops init
dops init /custom/data/path
dops init --non-interactive
FlagDescription
[path]Data path (default: ~/.dops)
--non-interactiveSkip prompts (for Docker/CI)

Scans local transcript directories for Claude Code, Codex, Gemini, and OpenCode sessions, then pushes the extracted telemetry to a running dops server.

terminal
dops ingest --url http://localhost:7883 --token sk-dops_abc123
dops ingest --url http://localhost:7883 --token sk-dops_abc123 --days 7 --source claude gemini
dops ingest --url http://localhost:7883 --token sk-dops_abc123 --dry-run
FlagDescription
--url <url>dops server URL (required)
--token <token>dops access token (required)
--days <n>Scan last N days (default: 30)
--dry-runScan and report without pushing data
--source <names...>Filter sources: claude, codex, gemini, opencode

Display aggregated usage statistics including tokens, tool calls, and errors.

terminal
dops stats --url http://localhost:7883 --token sk-dops_abc123
dops stats --url http://localhost:7883 --token sk-dops_abc123 --days 7 --source claude
FlagDescription
--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.

terminal
dops costs --url http://localhost:7883 --token sk-dops_abc123
dops costs --url http://localhost:7883 --token sk-dops_abc123 --days 7
FlagDescription
--url <url>dops server URL (required)
--token <token>dops access token (required)
--days <n>Last N days (default: 30)

A summary of all CLI entry points and the default ports for server products.

ProductInstallDefault port(s)
dbrainnpm install -g @dtoolkit/dbrain:7878 (API + MCP), :7879 (Dashboard)
dcontextnpm install -g @dtoolkit/dcontextN/A (hooks only)
dworknpm install -g @dtoolkit/dwork:7881 (API + MCP), :7882 (Dashboard)
dproxynpm install -g @dtoolkit/dproxy:7880 (HTTP API via serve)
dopsnpm install -g @dtoolkit/dops:7883 (API + MCP), :7884 (Dashboard)
terminal
# 1. Initialize and start the brain
dbrain init && dbrain start
# 2. Initialize and start the project manager
dwork init && dwork start
# 3. Initialize and start observability
dops init && dops start
# 4. Set up context hooks for your AI CLI
dcontext init
dcontext install claude
# 5. Initialize the proxy (optional, for multi-provider access)
dproxy init

For detailed product guides, see the individual product pages: dbrain, dcontext, dwork, dproxy, and dops.