OpenCanon

Agent-ready. Human-readable. Runtime-enforced.

CLI

The opencanon binary is the primary product surface. It talks to the local service, starts project runtimes on demand, and exposes the same model to humans, hooks, MCP, and CI.

Context

context
sh
opencanon context --files src/services/company.service.ts
opencanon context --list-exceptions

Loads scoped Project Canon, Proof checks, Knowledge evidence, impact context, and optional Git history for files or topics.

Project Canon

canon
sh
opencanon canon list areas
opencanon canon list specs
opencanon changes list

Lists durable Areas and Specs plus active Changes that agents can follow.

Rules

rules
sh
opencanon rules --validator service-no-db-client
opencanon rules --convention service-db-boundary
opencanon rules --tree --validator service-no-db-client

Lists convention summaries, scopes, generated docs, runtime checks, and fixture coverage. --tree shows the file scope.

Graph Search

graph-search
sh
opencanon search loadCompany --kind symbol --symbol-kind function --scope "src/services/**"
opencanon symbols loadCompany --kind function --scope "src/services/**"
opencanon graph callers loadCompany
opencanon graph callees loadCompany
opencanon refactor rename-symbol loadCompany fetchCompany --file src/services/company.service.ts --format json

Searches the indexed TS/JS graph, filters symbols by kind and file scope, and inspects caller/callee edges before a change or refactor.

Validate

validate
sh
opencanon validate --changed
opencanon validate --project --profile
opencanon validate --check-fixtures
opencanon validate --changed --strict-warnings

Commit Gates

gate
sh
opencanon gate pending --format json
opencanon gate approve <gate-id> \
  --summary "User explicitly approved the blocked change." \
  --via agent

Validators can emit commit gates for intent-sensitive changes. Pending gates are written during changed-file validation. Agents should inspect the staged diff and gate evidence, ask the user for explicit Approve or Reject, and only then record the scoped approval before retrying the commit.

Feedback

feedback
sh
opencanon feedback --changed
opencanon feedback --changed --strict-warnings

Writes concise findings for an agent after edits.

Runtime

runtime
sh
opencanon service start
opencanon service status
opencanon project status
opencanon project index
opencanon project logs --tail 200
opencanon project stop

Runtime Updates

update
sh
opencanon update check --manifest ./opencanon-runtime-manifest.json
opencanon update apply --manifest ./opencanon-runtime-manifest.json --dry-run

Updates read a manifest, select the current engine target, and verify checksums before writing runtime assets. Writes fail while the service or current project runtime is running. After a real install, run opencanon doctor --fix in initialized projects to refresh managed agent guidance and setup artifacts.

Baselines

baseline
sh
opencanon baseline check
opencanon baseline update

Baselines record known findings so validators can distinguish existing debt from new drift.

Diagnostics

diagnostics
sh
opencanon doctor
opencanon benchmark --sizes 1000,10000,50000 --file-kb 8 --source-snapshot-only

Local State

state
sh
opencanon state status
opencanon state reset --confirm