Skip to content

CLI Commands

All commands support --json for machine-readable output and --help for usage details.

Core Commands

Search for docs and skills in the registry using BM25 ranking.

sh
chub search [<query>] [--tags <tags>] [--lang <lang>] [--type <type>] [--limit <n>] [--json]
FlagDescriptionDefault
<query>Search query (supports multi-word). Omit to list all.
--tags <tags>Comma-separated tag filter (e.g. openai,chat)all
--lang <lang>Filter by language (e.g. python, js)all
--type <type>Filter by type: doc or skillall
--limit <n>Maximum number of results20
--jsonOutput results as JSONoff

Examples:

sh
chub search "stripe payments"
chub search "react hooks" --limit 5
chub search --tags openai,chat --lang python --json

chub get

Fetch a specific doc or skill by ID.

sh
chub get <id>... [--lang <lang>] [--version <ver>] [--pinned] [--match-env] [-o <file>] [--json]
FlagDescription
<id>Doc ID (e.g., openai/chat). Multiple IDs allowed.
--lang <lang>Language variant (e.g., python, js)
--version <ver>Specific version (e.g., 4.0)
--pinnedFetch all pinned docs at once
--match-envAuto-detect version from package.json, Cargo.toml, etc.
--fullFetch all files in the entry, not just the entry point
--file <file>Fetch a specific sub-file (comma-separated)
-o <path>Write output to a file or directory
--jsonJSON output

Examples:

sh
chub get openai/chat --lang python
chub get stripe/api --lang javascript --version 2024
chub get --pinned                            # fetch all pinned docs
chub get project/architecture                # project context doc
chub get openai/chat --match-env             # version matched from project deps

The fetched doc automatically includes:

  • Merged annotations from all three tiers (org → team → personal) appended at the end
  • A pin notice if the doc is pinned by the team

chub list

List all available docs in the registry.

sh
chub list [<query>] [--tags <tags>] [--lang <lang>] [--type <type>] [--limit <n>] [--json]
FlagDescriptionDefault
<query>Optional search query to filter results
--tags <tags>Comma-separated tag filterall
--lang <lang>Filter by languageall
--type <type>Filter by type: doc or skillall
--limit <n>Max results20
--jsonJSON outputoff

chub update

Refresh the cached registry and search index.

sh
chub update [--force] [--full]
FlagDescription
--forceRe-download even if cache is fresh
--fullDownload the full bundle for offline use

chub cache

Manage the local cache.

sh
chub cache status    # show cache state and size
chub cache clear     # clear all cached data

Team Commands

chub init

Initialize a .chub/ project directory for team sharing.

sh
chub init [--from-deps] [--monorepo]
FlagDescription
--from-depsScan dependency files and auto-pin matching docs
--monorepoCreate config with auto-profile rules for monorepo layout

Creates .chub/ with config.yaml, pins.yaml, annotations/, context/, and profiles/.

chub pin

Manage pinned doc versions.

sh
chub pin add <id> [--lang <lang>] [--version <ver>] [--reason <text>] [--source <name>]
chub pin remove <id>
chub pin list
chub pin get [--lang <lang>]
SubcommandDescription
add <id>Pin a doc to the project
remove <id>Remove a pinned doc
listList all active pins
getFetch all pinned docs at once

Options for pin add:

FlagDescription
--lang <lang>Pin to a specific language
--version <ver>Pin to a specific version
--reason <text>Human-readable reason (shown to agents)
--source <name>Source name for private registry

Examples:

sh
chub pin add openai/chat --lang python --version 4.0 --reason "Use v4 streaming API"
chub pin add stripe/api --lang javascript
chub pin remove openai/chat
chub pin list                                # list all active pins
chub pin get                                 # fetch all pinned docs at once

chub profile

Manage context profiles for role-scoped context.

sh
chub profile use <name>    # activate a profile ("none" to clear)
chub profile list          # list available profiles
chub profile current       # show the currently active profile

chub annotate

Read, write, clear, or list annotations for a doc entry.

sh
chub annotate [<id>] [<note>] [OPTIONS]

Modes:

InvocationEffect
chub annotate <id>Read all annotations (org + team + personal merged)
chub annotate <id> "<note>"Write personal annotation (overwrites previous)
chub annotate <id> "<note>" --teamAppend team annotation (add to history)
chub annotate <id> "<note>" --orgAppend to org annotation server (Tier 3)
chub annotate <id> --personalRead personal tier only
chub annotate <id> --teamRead team tier only
chub annotate <id> --orgRead org tier only
chub annotate <id> --clearRemove personal annotation
chub annotate <id> --clear --teamRemove team annotation file
chub annotate <id> --clear --orgRemove org annotation from server
chub annotate --listList all personal annotations
chub annotate --list --teamList all team annotations
chub annotate --list --orgList all org annotations

Options:

FlagDescriptionDefault
--kind <KIND>note, issue, fix, practicenote
--severity <LEVEL>high, medium, low (issue kind only)none
--personalTarget personal tier (~/.chub/annotations/, overwrite)default
--teamTarget team tier (.chub/annotations/, git-tracked, append)off
--orgTarget org server (requires annotation_server in config)off
--author <name>Author name for team/org annotations$USER
--clearRemove the annotation
--listList all annotations

Examples:

sh
# Write a team note (default kind)
chub annotate openai/chat "Use v4 streaming, not completions" --team

# Record a confirmed bug with severity
chub annotate openai/chat "tool_choice='none' silently ignores tools and returns null" \
  --kind issue --severity high --team

# Record the fix for the bug above
chub annotate openai/chat "Use tool_choice='auto' or remove tools from the array" \
  --kind fix --team

# Record a validated team pattern
chub annotate openai/chat "Always set max_tokens to avoid unbounded streaming cost" \
  --kind practice --team

# Org-level annotation (requires annotation_server in .chub/config.yaml)
chub annotate openai/chat "Always set max_tokens explicitly" \
  --kind practice --org

# Read all annotations for an entry (org + team + personal merged)
chub annotate openai/chat

# List all team annotations
chub annotate --list --team

Storage tiers

  • Personal (--personal, default): overwrite semantics — one note per entry, stored in ~/.chub/annotations/, local only.
  • Team (--team): append semantics — adds to history with author + date, stored in .chub/annotations/, git-tracked.
  • Org (--org): append semantics — sent to the org annotation server, requires annotation_server.url in .chub/config.yaml.

Reading without a tier flag shows all three tiers merged.

chub feedback

Submit feedback (thumbs up/down) about a doc.

sh
chub feedback <id> <rating> [<comment>] [OPTIONS]
FlagDescription
<rating>up or down
<comment>Optional explanation (positional)
--lang <lang>Language variant rated
--doc-version <ver>Version rated
--file <file>Specific file within the entry
--label <label>Structured label, repeatable (e.g. outdated, missing-example)
--agent <name>AI coding tool name
--model <model>LLM model name
--type <type>Explicit type: doc or skill
--statusShow feedback and telemetry status

chub detect

Scan dependency files and find matching docs.

sh
chub detect [--pin]
FlagDescription
--pinAuto-pin all detected matches

Supported dependency files: package.json, Cargo.toml, requirements.txt, pyproject.toml, Pipfile, go.mod, Gemfile, pom.xml, build.gradle(.kts).

chub check

Check pinned doc versions against installed library versions.

sh
chub check [--fix]
FlagDescription
--fixAuto-update outdated pins to match installed versions

chub context

Browse and query project context docs.

sh
chub context [<query>] [--list]
FlagDescription
<query>Task description to find relevant context for
--listList all project context docs

chub agent-config

Generate and sync agent configuration files from .chub/config.yaml.

sh
chub agent-config generate   # generate all target files (alias for sync)
chub agent-config sync       # generate all target files
chub agent-config diff       # show what would change without writing

Supported targets: CLAUDE.md, .cursorrules, .windsurfrules, AGENTS.md, .github/copilot-instructions.md, GEMINI.md, .clinerules, .roo/rules/chub-rules.md, .augment/rules/chub-rules.md, .kiro/steering/chub-rules.md.

chub snapshot

Manage point-in-time pin snapshots.

sh
chub snapshot create <name>          # save current pins
chub snapshot list                   # list all snapshots
chub snapshot restore <name>         # restore pin state
chub snapshot diff <name-a> <name-b> # compare two snapshots

chub bundle

Manage shareable doc collections.

sh
chub bundle create <name> --entries <ids> [--description <text>] [--author <name>] [--notes <text>]
chub bundle install <name>           # pin all entries in the bundle
chub bundle list                     # list available bundles
FlagDescription
--entries <ids>Comma-separated entry IDs (required for create)
--description <text>Bundle description
--author <name>Author name
--notes <text>Additional notes

chub stats

Show local usage analytics (opt-in).

sh
chub stats [--days <n>] [--json]
FlagDescriptionDefault
--days <n>Number of days to include30

Scanning Commands

chub scan

Scan for secrets in git history, directories, or stdin. Drop-in replacement for gitleaks and betterleaks.

sh
chub scan secrets git [<path>] [OPTIONS]     # scan git repository
chub scan secrets dir [<path>] [OPTIONS]     # scan directory or file
chub scan secrets stdin [OPTIONS]            # scan from stdin

Subcommands

SubcommandDescription
secrets git [path]Scan git repository history (default: current directory)
secrets dir [path]Scan a directory or file (aliases: file, directory)
secrets stdinScan from standard input

Global Options (apply to all subcommands)

FlagDescriptionDefault
-c, --config <path>Config file path (.gitleaks.toml / .betterleaks.toml / .chub-scan.toml)auto-detect
-b, --baseline-path <path>Baseline report to filter known findings
-f, --report-format <fmt>Output format: json, sarif, csvjson
-r, --report-path <path>Write report to file (use - for stdout)stdout
--redact [<pct>]Redact secrets in output (0-100%, default 100% if no value)off
--exit-code <n>Exit code when secrets are found1
--max-target-megabytes <n>Skip files larger than this10
--enable-rule <id>Only enable specific rule IDs (repeatable)all rules
-v, --verboseVerbose outputoff
--no-bannerSuppress banneroff
--no-colorSuppress colored outputoff

Git-specific Options

FlagDescription
--stagedScan only staged files (pre-commit mode)
--pre-commitAlias for --staged
--log-opts <opts>Custom git log options (e.g., "--all HEAD~10..HEAD")
--follow-symlinksFollow symbolic links

Stdin-specific Options

FlagDescriptionDefault
--label <name>Label for the input sourcestdin

Examples:

sh
# Scan git history
chub scan secrets git

# Pre-commit hook
chub scan secrets git --staged --exit-code 1

# Scan with SARIF output for CI
chub scan secrets git -f sarif -r results.sarif

# Scan directory with custom config
chub scan secrets dir ./src -c .gitleaks.toml

# Scan agent transcript from stdin
cat transcript.log | chub scan secrets stdin --label "claude-session"

# Redact secrets in output
chub scan secrets git --redact

# Only check for specific rule types
chub scan secrets git --enable-rule aws-access-token --enable-rule github-pat

# Filter known findings
chub scan secrets git --baseline-path known-findings.json

Config File Discovery

Chub searches for config files in this order:

  1. Explicit --config path
  2. Environment variables: CHUB_SCAN_CONFIG, BETTERLEAKS_CONFIG, GITLEAKS_CONFIG
  3. .chub-scan.toml in the target directory
  4. .betterleaks.toml in the target directory
  5. .gitleaks.toml in the target directory

Config format is compatible with gitleaks TOML. See Secret Scanning for full config documentation.

Tracking Commands

chub track

Track AI coding agent sessions — tokens, costs, models, tool usage. See AI Usage Tracking for full documentation.

sh
chub track enable [<agent>] [--force]   # install agent hooks
chub track disable                      # remove all hooks
chub track status                       # show active session
chub track log [--days <n>]             # session history
chub track show <session-id>            # session detail
chub track report [--days <n>]          # aggregate usage report
chub track export [--days <n>]          # JSON export
chub track clear                        # delete local transcripts
chub track dashboard [--port <n>]       # launch web dashboard
SubcommandDescription
enable [agent]Install hooks (auto-detects agent if omitted). Agents: claude-code, cursor, copilot, gemini-cli, codex
enable --forceOverwrite existing hooks
disableRemove all chub hooks
statusShow active session, detected agent/model
log --days <n>Session history (default 30 days)
show <id>Full details for a session
report --days <n>Aggregate cost, model, and tool report
export --days <n>JSON export for external dashboards
clearDelete local transcripts (.git/chub-sessions/)
dashboard --port <n>Web dashboard (default port 4243)

Examples:

sh
chub track enable                        # auto-detect and install hooks
chub track enable claude-code --force    # reinstall Claude Code hooks
chub track status --json                 # active session as JSON
chub track report --days 7              # last week's usage
chub track dashboard --port 8080        # custom port

chub telemetry

View and manage local usage telemetry data.

sh
chub telemetry status                    # show telemetry status
chub telemetry clear                     # clear local telemetry data
SubcommandDescription
statusShow telemetry collection status
clearClear local telemetry data

Telemetry is opt-in and anonymous. Disable via telemetry: false in ~/.chub/config.yaml or CHUB_TELEMETRY=0.

Server Commands

chub mcp

Start the MCP (Model Context Protocol) stdio server.

sh
chub mcp

chub serve

Serve a built content directory as an HTTP registry.

sh
chub serve <content-dir> [-p <port>] [-o <output-dir>]
FlagDescriptionDefault
-p, --port <n>HTTP port4242
--host <host>Host to bind to127.0.0.1
-o, --output <dir>Output directory for built contenttemp dir

Build Commands

chub build

Build a content directory into registry.json and search-index.json.

sh
chub build <content-dir> [-o <output>] [--base-url <url>] [--validate-only] [--no-incremental]
FlagDescriptionDefault
-o, --output <dir>Output directory<content-dir>/dist
--base-url <url>CDN base URL for doc pathsnone
--validate-onlyValidate content without buildingoff
--no-incrementalRebuild all files, skip change detectionoff

Examples:

sh
chub build ./content -o ./dist
chub build ./content --validate-only
chub build ./content --base-url https://cdn.example.com/v1

Global Flags

FlagDescription
--helpShow help for any command
--versionShow version
--jsonJSON output (most commands)