Local repo rules
Executable repo conventions for agents.
OpenCanon loads the rules for a repo, runs validators, and returns findings agents can act on.
Runs locally. Open source. No analytics.
import { db } from "../db/client"; ← service imports db client
export class CompanyService {
constructor(private readonly billing: BillingClient) {}
async deactivate(companyId: string) {
const row = await db ← "companies" appears in multiple services
.from("companies")
.where({ id: companyId })
.update({ status: "inactive" });
return row;
}
}
- error service-no-db-client src/services/company.service.ts:1
Services must not import the database client directly. Route persistence through a repository in src/repositories/.
- warn repeated-domain-literals src/services/company.service.ts:7
The literal "companies" is duplicated across services. Extract into the shared domain table registry.
Workflow
Rules beside the code they govern.
Keep docs, decisions, validators, and findings in one local loop.
Runtime
One daemon, same result everywhere.
The daemon watches changes, caches facts, and serves the CLI, hooks, and UI.
Runtime Loop
One daemon. Three clients.
Changes become facts. Validators turn facts into findings. The CLI, hooks, and UI read the same local API. A local process that watches the repo, caches facts, runs validators, and serves the CLI, hooks, and UI.
- 1 Watch changed files.
- 2 Extract and cache facts.
- 3 Run validators.
- 4 Send findings to CLI, hooks, and UI.
Feedback
Findings agents can act on.
Each finding includes the rule, location, reason, and fix metadata.
-
contextloads rules for a path. -
validateruns the validators in scope. -
feedbackreturns agent-ready findings.
opencanon context --files src/services/company.service.ts
opencanon validate --changed
opencanon feedback --changed
Install
Install the skill.
Clone OpenCanon into your agent host's skills directory. The skill includes the CLI, daemon, UI assets, validators, and engine.
npx skills add nick-vi/opencanon --skill opencanon -a codex -y
bun .agents/skills/opencanon/scripts/opencanon.ts setup --yes --hooks codex
bun run opencanon daemon start
bun run opencanon daemon status
bun run opencanon daemon open