Authoring Rules and Metrics
Detection rules and metrics are the primary extensibility surface of AI Engineer Coach. Every rule and metric is a self-contained markdown file with YAML frontmatter and a small DSL — no code changes required to ship a new one.
This guide covers contributing a built-in rule or metric to this repository. For the in-extension authoring flow (live-test, threshold sliders, AI-assisted drafting), see the Rule Editor guide.
Where rules and metrics live
| Layer | Location | Trust | Use when |
|---|---|---|---|
| Built-in | src/core/rules/, src/core/metrics/ | Trusted | Contributing a rule for everyone via this repo |
| Personal | ~/.ai-engineer-coach/rules/, ~/.ai-engineer-coach/metrics/ | Prompted on first load | Private rules shared across all your workspaces |
| Project | <workspace>/.ai-engineer-coach/rules/, <workspace>/.ai-engineer-coach/metrics/ | Prompted on first load | Workspace-specific rules checked into a repo |
Personal and project rules follow the same file format as built-in rules but are loaded at runtime through the trust gate in src/core/rule-trust.ts.
For the full DSL reference — field schema, function catalog, and metric primitives — open the DSL Reference modal inside the extension (Rule Editor → DSL Reference) or the Rule Playground.