v2.x

Tools Reference

Complete reference for all 16 C3 MCP tools โ€” parameters, actions, examples, and usage notes.

c3_read
read-only plan-mode safe
Targeted symbol or line-range reads

Read specific symbols (functions, classes, methods) or exact line ranges from a file. Always use after c3_compress to get the line map. Never read entire files.

ParameterTypeDefaultDescription
file_path string required Relative path to the file
symbols array null Symbol names to read: ["ClassName.method_name"] or ["function_name"]
lines string null Line range: "100-150" or "100"

Examples

# Read specific symbols
c3_read(file_path='services/session_manager.py', symbols=['SessionManager.save', 'SessionManager.restore'])

# Read by line range (from compress map)
c3_read(file_path='cli/c3.py', lines='660-720')

# Read a standalone function
c3_read(file_path='services/memory.py', symbols=['recall_facts'])
c3_compress
read-only plan-mode safe
Structural file map โ€” 40โ€“70% token savings

Returns a compact structural summary of one or more files. Use before c3_read to understand file structure and get the line numbers needed for targeted reads. Supports batch (comma-separated paths).

ParameterTypeDefaultDescription
file_path string required Single path or comma-separated list of paths
mode string "smart" map symbol line-map ยท dense_map map + docstrings ยท smart adaptive ยท diff recent changes ยท bug_scan suspicious patterns ยท ast knowledge-graph via codebase-memory-mcp

Examples

# Map a single file
c3_compress(file_path='cli/mcp_server.py', mode='map')

# Map multiple files in one call
c3_compress(file_path='services/memory.py,services/agents.py', mode='map')

# See recent changes
c3_compress(file_path='cli/c3.py', mode='diff')

# Quick bug scan
c3_compress(file_path='services/embedding_index.py', mode='bug_scan')

# Knowledge-graph overview (requires codebase-memory-mcp installed)
c3_compress(file_path='.', mode='ast')
๐Ÿ’ก
The map output includes line numbers for every symbol. Use those line numbers directly in c3_read(lines=โ€ฆ) to read specific sections.

The ast mode uses codebase-memory-mcp (optional install) for a project-wide knowledge graph โ€” languages, entry points, hotspots, HTTP routes, and module clusters.
c3_filter
read-only plan-mode safe
Extract signal from terminal output and log files

Filters noisy terminal output, log files, or JSONL data to return only relevant lines. Use whenever command output exceeds ~10 lines. Supports inline text or file path input.

ParameterTypeDefaultDescription
text string "" Raw terminal output to filter (inline)
file_path string "" Path to a log or data file to filter
pattern string "" Regex pattern to filter by (e.g. "error|warning")

Examples

# Filter inline terminal output
c3_filter(text="<pytest output with 200+ lines>")

# Filter a log file for errors
c3_filter(file_path=".c3/sessions/session_042.json", pattern="error|fail")

# Filter build output
c3_filter(text="<webpack build output>", pattern="warning|error")
c3_edit
writes files logs to ledger
Atomic read-patch-write-log in one step

The only way to edit files in C3. Validates the old_string match, applies the patch, writes the file, and logs the change to the edit ledger. Supports single edits and batched edits to the same file. Can be called in parallel for different files.

ParameterTypeDefaultDescription
file_path string required Relative path to the file to edit
old_string string "" Exact text to find and replace (must be unique in the file)
new_string string "" Replacement text
summary string "" Human-readable description of the change (logged to ledger)
edits array null List of {old_string, new_string} objects for batch edits to the same file

Single edit

c3_edit(
  file_path='services/auth.py',
  old_string='return token.expiry > now',
  new_string='return token.expiry > now + CLOCK_SKEW',
  summary='Add clock skew buffer to token expiry'
)

Batch edits to same file

c3_edit(
  file_path='core/config.py',
  edits=[
    {"old_string": "DEBUG = True",      "new_string": "DEBUG = False"},
    {"old_string": "LOG_LEVEL = 'DEBUG'", "new_string": "LOG_LEVEL = 'WARNING'"}
  ],
  summary='Production config hardening'
)
โš ๏ธ
old_string must be unique in the file. If it appears multiple times, c3_edit will fail. Expand the context in old_string to make it unique.
๐Ÿ’ก
Unicode lookalikes are matched automatically. If old_string uses straight quotes but the file has curly quotes (or vice versa), or the two differ only by ASCII vs. unicode dashes (-/โ€“/โ€”) or non-breaking spaces, c3_edit retries with a normalized match and splices your new_string in at the matched offsets โ€” unrelated lookalikes elsewhere are left intact. The response is tagged [unicode-normalized] when the fallback was used.
c3_validate
read-only plan-mode safe
Syntax-check files using native parsers

Runs the appropriate native syntax checker for each file type. Supports comma-separated batch validation. Always call after c3_edit and before reporting done. If pyright (Python) or tsc (TypeScript) is on PATH, also runs a deep type check and reports type errors as advisory warnings alongside the PASS result.

ParameterTypeDefaultDescription
file_path string required Single path or comma-separated list of paths

Examples

# Single file
c3_validate(file_path='services/memory.py')

# Batch (runs in parallel)
c3_validate(file_path='cli/c3.py,cli/mcp_server.py,services/agents.py')

Supported file types

Python (.py) JS (.js .mjs) TypeScript (.ts .tsx) HTML (.html) CSS (.css) JSON (.json) TOML (.toml) YAML (.yml .yaml) Bash (.sh)
c3_impact
read-only plan-mode safe
Blast-radius analysis โ€” know what breaks before you change it

Finds every file that references a symbol (function, class, variable) before you rename or remove it. Uses git grep for speed with a pure-Python fallback. Groups results by file, scores risk (SAFE / LOW / MEDIUM / HIGH), and in unstaged mode overlays which affected files have uncommitted changes.

ParameterTypeDefaultDescription
target string required Symbol name, function, or class to analyse
file_path string "" Source file to exclude from results (the definition site)
mode string "symbol" symbol cross-project reference scan ยท unstaged overlay uncommitted-change files

Examples

# Check blast radius before renaming a function
c3_impact(target='handle_memory', file_path='cli/tools/memory.py')

# Which affected files also have uncommitted changes?
c3_impact(target='MemoryStore', mode='unstaged')

# Safe to remove? (check before deleting)
c3_impact(target='_legacy_compress')

Risk levels

SAFE โ€” 0 files LOW โ€” 1-2 files MEDIUM โ€” 3-6 files HIGH โ€” 7+ files
๐Ÿ’ก
Run c3_impact before c3_edit whenever you're renaming, removing, or changing the signature of a shared symbol. A HIGH risk result means you need to update all call sites in the same edit pass.
c3_shell
execution ledger-aware
Structured shell execution โ€” exit codes, auto-filter, git-ledger hooks

Run a shell command through C3 with structured returns (exit_code, stdout, stderr, duration_ms), hard timeout + taskkill /F /T on Windows, auto-filter of long stdout, and automatic edit-ledger entries for git-mutating commands. Use for tests, git, builds, and one-shot scripts. Native Bash remains the fallback for interactive / TTY commands (gh pr create with editor, ollama run).

ParameterTypeDefaultDescription
cmd string required Shell command to execute (runs via subprocess.Popen(shell=True))
cwd string "" Working directory. Defaults to the project root
timeout int 60 Seconds before the process is killed with taskkill /F /T (Win) or SIGKILL. Capped at 600
filter_output bool True Auto-route stdout through c3_filter when it exceeds 30 lines
log bool True Write shell_exec to the activity log and auto-log git-mutating commands to the edit ledger

Examples

# Run tests โ€” exit_code propagates, long output is filtered
c3_shell(cmd='pytest tests/test_c3_shell.py -v')

# Git mutation โ€” affected files auto-recorded in the edit ledger
c3_shell(cmd='git commit -m "wire c3_shell"')

# Build with a longer timeout
c3_shell(cmd='npm run build', timeout=300)

Safety classification

BLOCKED โ€” rm -rf of /, a top-level system dir, $HOME/~; fork bombs; whole-drive wipes WARN โ€” --force, --no-verify, reset --hard, DROP/TRUNCATE OK โ€” everything else

The blocklist is a best-effort guard against the most catastrophic commands โ€” not a sandbox. c3_shell runs arbitrary commands by design; for an intentionally dangerous command, use native Bash with explicit approval.

๐Ÿ’ก
Prefer c3_shell over native Bash for anything noisy, git-mutating, or long-running. You get structured returns, consistent Windows timeout behaviour, free output filtering, and ledger coupling. Fall back to native Bash only for interactive / TTY commands.
c3_session
session
Snapshot, restore, log, compact โ€” session lifecycle

Manages the session lifecycle. Use log to record decisions, snapshot before /clear, restore to recover after /clear, and compact for a one-step restart. Session data persists in .c3/sessions/.

ParameterTypeDefaultDescription
action string required See action table below
data string "" Content for log/plan actions
reasoning string "" Optional rationale for log entries

Actions

ActionRead-only?Description
startโ€”Start a new session (auto-called on server start)
logโœ“Record a decision or note to the session
planโœ“Record a plan or approach
snapshotโœ“Save full session state (call before /clear)
restoreโ€”Restore last session snapshot (call after /clear)
compactโ€”One-step snapshot + summary + restore prompt
convo_logโœ“Search session conversation history

Examples

# Log a decision
c3_session(action='log', data='Chose Redis over memcached โ€” TTL support needed', reasoning='Session persistence required')

# Before /clear
c3_session(action='snapshot')

# After /clear
c3_session(action='restore')

# One-step restart
c3_session(action='compact')
c3_memory
memory
Persistent cross-session facts โ€” add, recall, query, manage

Persistent key-fact store that survives /clear and session restarts. Use recall at session start to recover context. Facts are stored with salience scores and auto-decayed over time. Supports semantic recall, explicit query, and manual management.

ParameterTypeDefaultDescription
action string required See action table below
fact string "" Fact text for add and update
query string "" Search query for recall and query
category string "general" Fact category: general, architecture, convention, feedback
fact_id string "" Fact ID for update and delete
top_k int 3 Max facts to return

Actions

ActionRead-only?Description
recallโœ“Semantic recall of top-k relevant facts for a query
queryโœ“Exact/keyword search over facts
listโœ“List all facts (optionally by category)
addโ€”Add a new persistent fact
updateโ€”Update an existing fact by ID
deleteโ€”Delete a fact by ID
reviewโœ“Review facts for staleness / deduplication
consolidateโ€”Merge duplicate/redundant facts
scoreโœ“Show salience scores for all facts
trendsโœ“Show memory usage trends over time
graphโœ“Show fact relationships graph
groundโ€”Ground facts against current codebase (verify still accurate)
exportโœ“Export all facts as JSON
lifespanโœ“Show fact age and decay information

Examples

# Session start โ€” recall relevant facts
c3_memory(action='recall', query='authentication token system', top_k=5)

# Add a new fact
c3_memory(action='add', fact='[architecture] JWT tokens use RS256 โ€” public key in /etc/c3/jwt.pub', category='architecture')

# Save a convention
c3_memory(action='add', fact='[convention] All new API handlers must call audit_log() before returning', category='convention')

# Verify facts are still accurate
c3_memory(action='ground')

# List all architecture facts
c3_memory(action='list', category='architecture')
๐Ÿ’ก
What to save in c3_memory vs Claude's auto-memory: C3 memory is the project's persistent knowledge store โ€” architecture decisions, conventions, gotchas. Claude's ~/.claude auto-memory is for user preferences and cross-project behavior. Never conflate them.
c3_status
read-only plan-mode safe
Budget, health, notifications, session overview

Project and session status dashboard. Check token budget, server health, pending notifications, and active session summary.

ParameterTypeDefaultDescription
view string "budget" budget token budget ยท health server health ยท notifications pending alerts ยท sessions session list
detailed bool false Include extended metrics

Examples

c3_status(view='budget')           # Token budget remaining
c3_status(view='health')           # MCP server + services health
c3_status(view='notifications')    # Pending alerts (budget warnings, etc.)
c3_status(view='sessions')         # Recent sessions list
c3_delegate
AI
Offload tasks to Ollama, Codex, Gemini, or Claude CLI

Delegates tasks to local or remote AI backends to save Claude tokens on routine work (summarization, routing, simple Q&A). Supports automatic backend selection based on task type.

ParameterTypeDefaultDescription
task string required The task or question to delegate
task_type string "ask" ask general Q&A ยท summarize summarization ยท auto let C3 route optimally
context string "" Additional context to include with the task
backend string "auto" ollama ยท codex ยท gemini ยท claude ยท auto

Examples

# Delegate summarization to local Ollama
c3_delegate(task='Summarize what this function does', context='<function code>', backend='ollama', task_type='summarize')

# Auto-route based on task type
c3_delegate(task='What is the purpose of this config key?', context='<config snippet>', backend='auto')
โ„น๏ธ
Requires Ollama running locally for ollama backend. Codex and Gemini backends require their respective CLIs. The claude backend uses the Claude Code CLI in non-interactive print mode (claude -p) โ€” no extra config needed if Claude Code is installed. Use task_type='available' to check which of the 4 backends are reachable.
c3_agent
AI
Multi-step compound workflows

Executes compound multi-step workflows using multiple C3 tools in sequence. Useful for common patterns like reviewing changes, preparing context, or running a preflight check.

ParameterTypeDefaultDescription
workflow string required Workflow name โ€” see workflow table below
scope string "" File paths or focus area for the workflow
context string "" Additional context to pass into the workflow

Available workflows

WorkflowWhat it does
available List all available workflows with descriptions
review_changes Compress recently changed files + summarize what changed
prepare_context Search + compress files relevant to a scope/topic
investigate Multi-step investigation: search โ†’ compress โ†’ summarize โ†’ recommend
preflight Pre-task check: recall memory + status + recent changes
validate_compress Batch validate + compress a set of files

Examples

# Run a preflight before starting work
c3_agent(workflow='preflight', context='starting auth refactor')

# Prepare context for a specific area
c3_agent(workflow='prepare_context', scope='services/memory.py,services/agents.py')

# Review what changed recently
c3_agent(workflow='review_changes')

# Deep investigation
c3_agent(workflow='investigate', context='why does session restore fail after compact?')
c3_edits
ledger
Edit ledger โ€” history, versions, audit trail

Access the edit ledger โ€” a persistent append-only log of all file changes made through c3_edit. Provides history, version diffing, stats, and tagging. The ledger is also enriched in the background by the EditLedgerEnricherAgent. Since v2.35.0, each entry is stamped with the git branch and HEAD it was made on, and history can be filtered by branch.

ParameterTypeDefaultDescription
action string required See action table below
file string "" Filter by file path
change_type string "modified" Change type for log action
branch string "" Filter history to edits stamped with this git branch v2.35.0

Actions

ActionDescription
logManually log an edit to the ledger (normally done automatically by c3_edit)
historyShow edit history (optionally filtered by file and/or branch)
versionsShow version history for a specific file
statsAggregate stats: most-edited files, change frequency
tagTag an edit entry with a label

Examples

# Show recent edit history
c3_edits(action='history')

# Version history for a specific file
c3_edits(action='versions', file='services/memory.py')

# Ledger stats
c3_edits(action='stats')

# Edits made on a specific branch
c3_edits(action='history', branch='feature/x')
c3_bitbucket
scm v2.30.0
Bitbucket Data Center / Server โ€” see and act on PRs, branches, builds, repo admin

Connect to a self-hosted enterprise Bitbucket server and operate on it. Tokens live in the OS keyring (Windows Credential Manager / macOS Keychain / Linux Secret Service); only a non-secret index of accounts and the active-account pointer is written to .c3/config.json. Project key + repo slug fall back to the configured defaults.

Setup: c3 bitbucket login --url <URL> (interactive PAT prompt), then c3 bitbucket set-default --project PROJ --repo my-repo. See the Bitbucket integration guide for the full action reference, Hub UI tour, audit-trail integration, and troubleshooting.

Actions

ActionGroupDescription
statusReadActive account, accounts list, defaults, server-version probe
whoamiReadCurrent authenticated user (PAT owner)
list_projects, list_repos, get_repoReadProject / repository discovery
list_prs, get_pr, get_pr_diff, get_pr_activitiesReadPR browsing + diff + activity feed
create_pr, comment_pr, approve_pr, unapprove_pr, decline_pr, merge_prWritePR write actions. merge_pr and decline_pr auto-fetch the PR's current version
list_branches, create_branch, delete_branchBranchBranch listing and admin (uses the branch-utils API)
list_commits, list_activity, build_statusReadRecent commits, activity, build/CI status (defaults to default-branch HEAD)
repo_settings, update_repo_settings, list_webhooks, create_webhook, delete_webhook, list_permissionsAdminRepository administration

Examples

# Connection probe + active account info
c3_bitbucket(action='status')

# List open PRs in the default repo
c3_bitbucket(action='list_prs', state='OPEN')

# Open a PR
c3_bitbucket(action='create_pr',
             title='Add Bitbucket integration',
             from_branch='feat/bitbucket',
             to_branch='main',
             reviewers='alice,bob')

# Approve and merge โ€” version is fetched automatically
c3_bitbucket(action='approve_pr', pr_id=42)
c3_bitbucket(action='merge_pr', pr_id=42)

Audit trail: mutating actions (merge_pr, create_branch, delete_branch, webhook writes, etc.) are appended to the C3 edit ledger so the local audit log covers platform-side state changes too.

c3_project
multi-project v2.31.0
Run C3 against OTHER c3-installed projects โ€” discover, read, and (guarded) write

Reach outside the current workspace. C3 keeps a global registry of installed projects (~/.c3/projects.json); c3_project lists/scans them and proxies the core C3 operations against any one โ€” building and caching a full runtime per target project on demand. Name the target by registered name or absolute path (a .c3 directory is required).

Write safety: read ops run freely; mutating ops (edit, shell, and memory add/update/delete) are refused unless you pass allow_write=true, and every foreign mutation is recorded on the target project's activity log and edit ledger.

Actions

ActionGroupDescription
listDiscoverRegistered projects (fast; registry only)
scanDiscoverRegistry + bounded filesystem scan for unregistered .c3 projects nearby
info, register, unregisterDiscoverProject details / add to / remove from the registry
search, read, compress, status, memory, impact, edits, validate, filterReadProxy the matching c3_* tool against the target project
edit, shell, memory(add/update/delete)WriteMutate the target project โ€” require allow_write=true

Examples

# Which projects have C3 installed?
c3_project(action='list')
c3_project(action='scan')              # also finds unregistered .c3 dirs nearby

# Search / read inside another project
c3_project(action='search', project='SafeMirror', query='token bucket')
c3_project(action='read', project='SafeMirror', file_path='core/limiter.py', symbols='RateLimiter')

# Memory recall from another project's fact store
c3_project(action='memory', project='Sentinel', mem_action='recall', query='auth flow')

# Guarded write โ€” the edit lands in the target project's ledger
c3_project(action='edit', project='Sentinel',
           file_path='README.md',
           old_string='v1', new_string='v2',
           allow_write=true)

Sub-action params: search_action (code/files/semantic/โ€ฆ), mem_action (recall/index/fetch/add/โ€ฆ), and edits_action (history/versions/stats) pick the operation for those verbs; scan_roots (comma-separated) overrides where scan looks.