How to add a new module or adjust existing ones.
- Create
modules/<name>.mdfollowing the standard shape:
# Module: <name>
Active when `scope.<key> == "<value>"`.
## Deps
## Env vars
## Files
## Cross-integrations
## Docs- Add the question to
AGENT.mdin the right phase. - Add the key to the
scope.jsonshape inAGENT.md. - If the module needs its own tests, create
tests/<name>.yamlwith anapplies_when:that checks thescopekey. - Add an entry to
CHANGELOG.mdunder[Unreleased].
- Install commands use
pnpm. - Never use
process.envdirectly in examples — always go throughsrc/lib/env.ts. - The env vars listed must also appear in the generated project's
src/lib/env.ts. - Code examples must compile on the stack described in
SPEC.md. - Keep modules ≤ ~100 lines. If a module is bigger, it's probably two.
If your module depends on another (e.g. usage-tracking needs
auth + db), document it in:
- The module's "Cross-integrations" section
- The "Cross-validations" section in
AGENT.md
Tests in tests/*.yaml are contracts. Prefer:
- File-exists checks (cheap, fast)
- HTTP checks against the dev server (realistic)
- Grep checks on code when a pattern is mandatory (e.g.
constructEventin the Stripe webhook)
Avoid tests that require real credentials unless marked
requires_env: true.