Before editing

  1. Read the current architecture and product records relevant to the change.
  2. Distinguish implemented, mounted, worker-registered, and automatically orchestrated behavior.
  3. Check for existing worktree changes and preserve unrelated edits.
  4. Add a failing test for the requested behavior.

Non-negotiable rules

  • Every AI output references evidence_ids.
  • Every tenant-owned query filters by team_id.
  • Database access goes through repositories; services own transactions.
  • Wire and persistence enums come from app.db.models.enums.
  • Agent roles are versioned data, not hardcoded runtime or UI names.
  • OpenRouter is the sole model runtime for AI features.

Public-contract changes

REST is canonical. When a response changes, update the shared service DTO, REST tests, MCP schema and tool tests, CLI/client consumers, console adapter, and documentation together. Keep cursor pagination opaque and preserve tenant-safe 404 behavior.

New source adapters

A source type needs a registered acquisition function, canonicalizer, differ, evidence builder, verification policy, bounds, service tests, worker dispatch, monitor capability metadata, and startup drift checks. Configuration must never choose an arbitrary import path.

Stage-gated work

Mount higher-stage routes, MCP tools, and frontend views only at their declared stage. Add explicit tests proving that lower stages neither list nor dispatch the capability.

Verification

Run the narrowest failing test first, then the relevant suite, type checks, lint, and build. For documentation changes, run: