Agent Rules#
These rules apply to every AI agent working in this repo.
Read First#
Before changing files, read:
README.mddocs/product/problem.mddocs/ops/build-loop-target.mddocs/ops/build-loop-tests.mddocs/ops/build-loop-test-areas.mddocs/ops/customer-readiness-tests.mddocs/ops/build-loop-done.mddocs/ops/build-order.mddocs/ops/overnight-agent-instructions.mddocs/engineering/repo-rules.mddocs/engineering/stack-decision.mddocs/engineering/architecture.mddocs/engineering/data-model.mddocs/engineering/performance-data-model.mddocs/engineering/mcp-contract.mddocs/engineering/mcp-overlap-contract.mddocs/engineering/session-context.mddocs/engineering/overlap-precision.mddocs/engineering/auth-plan.mddocs/engineering/security-checks.md
Before any frontend/UI work, also read:
DESIGN.md— design directives (brand, tokens, voice, density anchor)design-system/— vendored design system (tokens, assets, UI kit)
Hard Rules#
Frontend/UI changes must follow
DESIGN.mdand the design system indesign-system/: use the design tokens, reuse the primitives insrc/features/console/ui/, and never reintroduce the old light theme.No file may exceed 300 lines.
Put files in the right folder. Do not dump files in the repo root.
Keep documentation up to date with every meaningful change.
Do not add code, snippets, or files for deferred features.
Do not leave dead files, unused components, or fake placeholder systems.
Do not store core app state in Markdown.
Do not commit secrets, tokens, local databases, or generated junk.
Run security checks before claiming work is done.
If a trusted open-source project with at least 1,000 stars solves a problem, study it before building from scratch.
Only reuse open-source code when the license allows it, the dependency is maintained, and the security risk is acceptable.
MCP warnings and blocks must be returned to agents, not only shown in the UI.
Every MCP tool call must write a usage event.
Every work-state change must write a work event.
Overlap Protocol (judge before you start)#
When you take on work, you are the judge of whether it duplicates someone else's.
- Call
covibe_taskwithoperation: "check",title,description, a shortscope(what the work actually is), and the REQUIREDtask_type(feature|bug|refactor|chore|docs|test|spike). Keep the returnedcheck_id. Optionally declareaction(create|modify|remove|fix|audit) andcomponent(a layer tag likeserver/client) — they sharpen precision so work on a different layer or with an opposed action is not flagged as a duplicate. - If it returns
ok, start normally — anokcheck never blocks the start. Weak or divergent matches may still appear indata.matches(withwarning_id, score, and reason); they are recorded for the dashboard and are informational only — seedocs/engineering/overlap-precision.md. - If it returns
warningwithrequires_verdict: true, read each candidate indata.candidates(each carries its score and reason) and decide whether YOUR task is the SAME SCOPE as it. A candidate oftype: "intent"is another agent reserving that work right now — treat it like real work. Matches againstdone/cancelledwork only inform; they never escalate or block. - Call
covibe_taskwithoperation: "start", thecheck_id, and ascope_verdict:{ same_scope_candidate_ids: [...], reason: "..." }. List the ids of every candidate that is genuinely the same scope (empty if none); always give a reason. - If you listed any id, it is a real duplicate: tell the developer, get their
call, and pass
confirmation_reasonon the retry. Do not self-approve a true duplicate. - A match flagged
action_divergent: trueis opposed work on the same thing (create vs remove). It never blocks, but if your task would undo or reverse that owner's work, raise it with the developer before starting. - Before editing files, check
covibe_teamoperation: "state"→repo_snapshot_conflicts: a teammate (or your own other agent session) may have uncommitted or unpushed edits on the same files. Coordinate viacovibe_coordinationoperation: "ask_peer"or use a separate worktree. Claude Code sessions also receive these conflicts automatically as hook context at session start/stop.
The server records your verdict and gates the start on it. A start blocks ONLY
on the escalated (requires_verdict) path or on an agent-confirmed duplicate
missing its confirmation_reason — and the block message itself says what to
send next. Judge honestly — the verdict is audited.
Done Means#
Work is done only when:
- the app starts locally
- required tests pass
- security checks pass
- docs match the implementation
- the morning report explains what changed, what passed, what failed, and what a human should try first