This page is synced from/AI_GUIDE.mdat the repository root. Edit the source file — this published copy is regenerated bynpm run docs:sync-canonical. See the governance index for related documents.
AI_GUIDE.md - AI Contribution Guide for Encore OS
Version: 2.12.0 Last Updated: 2026-05-13Document hierarchy:constitution.md->AI_GUIDE.md->AGENTS.md->.cursor/rules/*constitution.mdis the source of truth for guardrails. This guide defines implementation workflow and decision support.AGENTS.mdis the always-loaded quick reference.
Purpose
Use this file for process decisions that are not obvious from code:- Spec and planning decisions
- Integration contract requirements
- Implementation log workflow
- Spec review and delivery checklists
AGENTS.md or constitutional rules that already live in constitution.md.
When To Read This File
Read this guide when you are:- creating/updating specs
- validating implementation readiness
- updating integration contracts
- completing implementation logs
- deciding whether to create plan docs
AGENTS.md plus scoped rule files under .cursor/rules/.
Decision Trees
Use these decision trees before writing implementation tasks or generating plan artifacts.Workflow Entry Points
1) Should I create a spec?
Two spec locations? See docs/development/SPEC_PATHWAYS.md — product features go inBefore creating a new spec:specs/{core}/; tooling/process designs go indocs/superpowers/specs/.
npm run spec -- precedent --core {core} --topic "{feature}"- Check
specs/{core}/archive/ - Check
specs/SPEC_STATUS_REGISTRY.md - Decide whether to enhance an existing spec instead of creating a new one
2) Should this become a setting, picklist, or feature flag?
Apply the full decision tree from.cursor/rules/tenant-configurability.md:
- Same for every tenant forever and not regulatory? → OK to hardcode (system constant).
- Different orgs need different values? (thresholds, intervals, defaults, limits) →
{core}_module_settingsper constitution §5.2.3. - Value varies by state Medicaid program? (deadlines, timed-code thresholds, assessment counts) → PF-96 jurisdiction profiles, not org settings.
- User/admin-maintained list of options? (status reasons, categories, types, dropdown choices) → PF-15 picklists, not string literals or
CHECKconstraints. - Boolean product experiment or slow rollout? → PF-45 feature flags.
- Org-specific schema extensions on entities? →
custom_fieldsJSONB + PF-16 definitions.
SPEC_TEMPLATE.md and the Enums and Source Types section — evaluate every new enum/status field against the picklist-vs-enum decision table in §5.2.4. Run audit-tenant-configurability --core {core} for existing code.
3) PLAN_TEMPLATE vs plan-in-spec
Use canonical matrices inspecs/_templates/SPEC_GUIDE.md:
- Full spec vs lite:
#factor-score-full-spec-vs-lite - Separate plan doc:
#decision-matrix-for-plan-document
4) Ask vs proceed
Ask when security/PHI handling, cross-core boundaries, breaking changes, or migration rollback paths are ambiguous.Integration Documentation Requirements
All cross-core interactions require contract documentation.- Platform layers:
docs/architecture/integrations/PLATFORM_INTEGRATION_LAYERS.md - Event contracts:
docs/architecture/integrations/EVENT_CONTRACTS.md - API contracts:
docs/architecture/integrations/API_CONTRACTS.md - Integration matrix:
docs/architecture/integrations/CROSS_CORE_INTEGRATIONS.md
Spec Review Checklist
- RLS enabled and UPDATE policies include both
USINGandWITH CHECK - SECURITY DEFINER helpers used where required
- No recursive RLS policy patterns
- PHI/PII handling and access controls documented
- Dependencies, contracts, and fallback paths documented
- Tenant configurability reviewed: Settings Considerations table completed; hard-coded values justified; enums evaluated for PF-15 picklist eligibility; jurisdiction-scoped values routed to PF-96 (constitution §5.2.3–§5.2.4)
Implementation Log Protocol
After shipping meaningful work, updatespecs/{core}/IMPLEMENTATION_LOG.md with status, completion date, changed surfaces, test evidence, and deferred work.
Scope Notes
- Canonical “What AI Must NEVER Do” list lives in
AGENTS.md. - Quick pattern rules live in
AGENTS.mdand.cursor/rules/quick-reference.mdc. - Constitutional policy and regulatory guardrails remain in
constitution.md.