Rules
Markdown files that define hard constraints Cora applies to every interaction, without exception.
Rules are the invariants of your codebase things that are always true regardless of what the prompt says. Unlike skills, which provide context Cora uses when relevant, rules constrain behavior unconditionally. Cora follows a rule even if a prompt implicitly suggests otherwise.

Storage locations
Global rules apply to every project:
Project rules apply to the current workspace only:
Project rules take precedence over global rules when a file with the same name exists in both locations.
What goes in rules
Rules are best suited to constraints where a violation would cause a bug, a security issue, or a consistency problem that would need to be fixed before merging. Good candidates:
Security invariants: "every database query on tenant-owned data must include an orgId filter"
Forbidden patterns: things done wrong in the past that must not recur
Required structures: things every module of a given type must have
Import constraints: what can import from what, what must not be imported in certain contexts
Naming conventions that apply everywhere without exception
Creating rules
Create a .md file in the rules directory. Write rules as direct, unambiguous statements not explanations, but declarations of what Cora must or must not do.
Example: rules/security.md
Example: rules/naming.md
Rules vs. skills
Rules are unconditional. Skills are contextual. If you find yourself writing a skill that says "always do X" it belongs in a rules file instead. A practical test: if Cora violated this during a code generation pass, would you need to fix it before merging? If yes, it's a rule.
Editing rules directly
All rule files in a given scope are loaded together on every task. There's no per-file scoping every rule applies everywhere within its scope.
Last updated