# Rule Loading Strategy

Open Orchestra treats detailed delivery rules as neutral source material that can
be rendered or referenced by each runtime. Cursor `.mdc` files are supported
runtime outputs, but they are not the universal source of truth.

## Source Model

- Root files such as `AGENTS.md`, `CLAUDE.md`, and `ORCHESTRA.md` stay compact.
- `src/rule-catalog.ts` owns rule metadata: id, title, canonical path, roles,
  capabilities, triggers, and risk areas.
- Detailed rule content lives under `rules/` using the format that best fits the
  rule. Cursor-specific `.mdc` files remain valid rendered or legacy targets.
- Runtime context manifests and quality contracts resolve rules by id instead of
  hardcoding Cursor paths.

## Runtime Behavior

For a task or phase, Orchestra selects rules from:

- active role and required roles;
- capabilities needed by the work;
- task title, goal, scope, paths, risks, and acceptance criteria;
- phase-specific evidence and handoff requirements.

The selected rules are injected as context references or excerpts for the active
runtime. A runtime may render the same rule source differently: Codex receives
compact markdown references, Claude can load markdown files, Cursor can receive
`.mdc`, and VS Code-style integrations can consume structured JSON.

## Semantic Code Rule

Implementation roles should load `semantic-code` when writing or reviewing code,
automation, scripts, tests, or architecture-sensitive refactors. The rule
requires code to be readable by intent through domain naming, narrow types,
focused helpers, and clear boundaries. Comments should explain why, trade-offs,
or non-obvious constraints, not restate the code.
