A safe delivery system for Pocket Coach: agents can move faster, but prod stays protected. This is a planning artifact only; no repo, GitHub, Supabase, EAS, secrets, or production systems were changed.
Pocket_Coach.md, engineering lane, engineering audit, dev/test segregation plan, prior implementation plan.README.md, AGENTS.md, CLAUDE.md, DOCS/DECISIONS.md, DOCS/PRD-AI-COACH-BRIDGE.md.package.json, app.config.ts, eas.json, .env.example, lib/supabase.ts.supabase/functions/ai-chat, shared AI provider registry/system prompt, OAuth initiate flow, migrations, Supabase config.Jack, beta feedback, analytics, or bug signal becomes a GitHub Issue with scope, PRD links, acceptance criteria, env/data impact, and approval level.
Planning agent drafts a technical plan: in/out of scope, files touched, test plan, dev smoke, release, rollback, and open decisions.
Agents work on feature/*, fix/*, or claude/* branches. No direct push to main; no deploy from implementation agents.
PR template requires linked issue, risk flags, tests run, migration/function/env/EAS impact, AI-boundary statement, dev smoke plan, and rollback notes.
Typecheck, lint, Jest, secret scan, coaching-boundary scan, Supabase static checks, and advisory AI review summary.
After merge or manual dispatch, migrations/functions deploy only to dev Supabase using explicit project refs. Optional EAS preview build.
Generate RC evidence pack: commits, PRs, migration/function/env impact, QA report, dev smoke evidence, rollback plan, production command preview.
Manual workflow dispatch, GitHub Environment production, Jack required reviewer, explicit prod project refs, post-release monitoring.
| Workflow | Trigger | Purpose | Deploys? |
|---|---|---|---|
| PR Quality | Pull request | Install, typecheck, lint, Jest | No |
| Security Static Checks | Pull request | Gitleaks + sensitive file diff checks | No |
| Coaching Boundary | Pull request | Flag app-side coaching intelligence | No |
| Supabase Static Checks | PR paths: supabase/** | Migration naming, RLS evidence, function auth/env scan | No |
| AI Review Summary | Pull request | Advisory risk and review focus | No |
| Deploy Dev/Test | Manual / approved merge | Dev migrations/functions/EAS preview | Dev only |
| Create RC | Manual | Evidence pack and approval artifact | No |
| Deploy Production | Manual | Prod migrations/functions/EAS build | Yes, approved only |
name: PR Quality
on:
pull_request:
branches: [main]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run typecheck
- run: npm run lint
- run: npm test -- --runInBand
environment: development
env:
SUPABASE_PROJECT_REF: ${{ secrets.SUPABASE_DEV_PROJECT_REF }}
run: |
supabase db push --project-ref "$SUPABASE_PROJECT_REF"
supabase functions deploy --project-ref "$SUPABASE_PROJECT_REF"
--project-ref.app.config.ts already splits dev/prod identity.eas.json sets dev vs prod APP_ENV.| Role | Model recommendation | Permission |
|---|---|---|
| Spec / Product Intake | GPT-5.5 or Claude Sonnet | Draft issues/specs; approval before risky scope |
| Planning Architect | GPT-5.5 high reasoning | Read-only plan by default |
| Implementation Agent | Claude Sonnet / GPT-5.5 | Branch writes only; no deploy |
| Database / Edge Engineer | GPT-5.5 / Sonnet | Branch writes only; migration/function evidence required |
| QA Reviewer | Fast model + escalation | Read-only audit |
| Release Manager | Sonnet / GPT-5.5 | No prod without Jack approval |
The central guardrail: agents may help the app assemble context, stream AI responses, execute tool calls, and display AI-returned data. They must not add app-side readiness scoring, training analysis, nutrition interpretation, recommendations, or coaching logic.
PR template, issue templates, branch protection, environments, required reviewers.
Typecheck, lint, Jest, Node/package manager pinning, artifacts.
Gitleaks, sensitive diff, coaching-boundary scan, tuned from advisory to blocking.
Migration naming, RLS evidence, Edge Function auth/env checks.
Advisory PR summary with privacy-safe diff bundle.
Manual dev migrations/functions/EAS preview with explicit dev refs.
Evidence pack, QA report, rollback plan, production command preview.
Manual approved prod workflow; TestFlight submit later.
pocketcoachdev:// when touched.production.| Change type | Rollback |
|---|---|
| App-only | Rebuild previous known-good commit or ship hotfix with incremented build number. |
| Edge Function | Redeploy previous function version from known-good commit; monitor errors and sync logs. |
| Migration/schema | Prefer forward-only rollback migration; avoid destructive changes; require backup for risky ops. |
| Secret/env | Restore from approved secret store; verify values are not exposed in logs. |
| OAuth | Restore provider console settings from baseline; smoke both prod and dev app schemes. |
| EAS/TestFlight | Stop rollout/remove build if possible; hotfix from known-good commit. |
Start with governance and CI only. Do not include Supabase deploy, EAS build, or production workflow in the first PR.
.github/pull_request_template.md.github/ISSUE_TEMPLATE/*.yml.github/workflows/pr-quality.yml.github/workflows/security-static.yml.github/workflows/coaching-boundary.yml in advisory modeCONTRIBUTING.md with AI-agent and release rules