AI Agent Rules
Canonical cross-agent execution contract for implementing features with docs + kit + examples.
What It Does
This page defines how coding agents should implement features in Creatorem using a single canonical rules contract and generated agent-specific adapters.
When To Use
- You want consistent behavior across Codex, Claude, Cursor, Windsurf, and other agents.
- You want feature work to be capability-driven instead of guess-driven.
- You want reusable implementation decisions (
kit/*) with real integration patterns (examples/*).
Prerequisites
- Access to the repository root.
- Access to docs capability endpoints (
/mcp-index.json,/llms.mdx/*) when using MCP retrieval.
Agents should use capability-first retrieval, then implement against kit/* as source of truth, and use examples/* for composition patterns.
How To Use
Use canonical contract as source of truth.
Canonical contract path:
docs/agent-rules/creatorem-agent-rules.contract.v1.jsonConsume an adapter for your coding agent.
| Agent | Adapter file |
|---|---|
| Codex | AGENTS.md |
| Claude | CLAUDE.md |
| Cursor | .cursor/rules/creatorem-agent-rules.mdc |
| Windsurf | .windsurfrules |
| Other agents | docs/agent-rules/adapters/generic-agent-rules.md |
Use MCP discovery before coding.
- Read capability metadata from
/mcp-index.json. - Resolve the target docs page(s).
- Pull LLM-ready content from
/llms.mdx/*only for selected pages.
Map docs capabilities to implementation layers.
| Capability family | Main implementation truth | Integration references |
|---|---|---|
| Filters architecture | kit/utils/src/filters/* + kit/*/src/**/filters/* | apps/dashboard/hooks/use-filters.ts, apps/dashboard/lib/init-*-filters.ts, apps/mobile/hooks/use-filters.ts |
| Settings | kit/settings/* | examples/pco-dashboard/*settings*, examples/pco-mobile/*settings* |
| Translations/i18n | kit/i18n/*, cross-env filters | examples/pco-dashboard/config/i18n.config.ts, examples/pco-dashboard/lib/init-cross-env-filters.ts |
| Database workflow | root package.json db scripts + supabase/* | docs/database, docs/scripts, .creatorem schemas in examples |
Maintain and validate adapters from canonical contract.
pnpm --filter creatorem docs:agents:generate
pnpm --filter creatorem docs:agents:checkSource Precedence
If sources disagree, resolve in this order:
kit/*code and exports- docs contract pages (
MCP Context,Agent Recipe) examples/*integration implementations
Filter-First Modularity
Use filter composition as the default integration strategy before app-local implementation:
- Define and verify filter signatures in
FilterList. - Register filter callbacks in package filter modules.
- Initialize filters in app entrypoints (
use-filters.ts,init-server-filters.ts,init-cross-env-filters.ts). - Consume filters through
useApplyFilter/applyServerFilter/applyCrossEnv*.
When a feature already exposes filter integration points, do not hardcode equivalent behavior directly in app routes/components.
See Filter API for the full architecture and end-to-end wiring pattern.
MCP Context
capability: agent_rules_contract entrypoints: - docs/agent-rules/creatorem-agent-rules.contract.v1.json - AGENTS.md - CLAUDE.md - .cursor/rules/creatorem-agent-rules.mdc - .windsurfrules - docs/agent-rules/adapters/generic-agent-rules.md - apps/creatorem/scripts/generate-agent-rules.mts - apps/creatorem/scripts/check-agent-rules.mts - apps/creatorem/app/mcp-index.json/route.ts - apps/creatorem/app/llms.mdx/[...slug]/route.ts inputs: - coding_task - capability_selection outputs: - deterministic_agent_execution_rules - synchronized_agent_adapter_files constraints: - canonical contract is the only editable source for adapter content - capability IDs referenced by rules must exist in mcp-index - path references in contract must resolve in repository side_effects: - adapter files are regenerated from canonical contract
Agent Recipe
- Select capability IDs from
/mcp-index.json. - Read target docs pages and extract implementation entrypoints.
- Implement in
kit/*first when behavior is reusable. - Wire app-level integration using existing example patterns.
- Run validation commands and report exact execution status.
Troubleshooting
- If adapters are outdated, run
pnpm --filter creatorem docs:agents:generate. - If contract checks fail on capability IDs, regenerate docs index and verify capability names.
- If path references fail, update contract refs to real paths before regeneration.
Related
Supabase + SQL workflow used by the kit.
Production deployment flow for Supabase-backed web apps.
How is this guide?
Last updated on 3/27/2026