deepmodebot 0.0.0-stage → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +26 -0
- package/.omp-plugin/marketplace.json +26 -0
- package/LICENSE +24 -0
- package/README.md +377 -2
- package/bin/deepmodebot.mjs +229 -0
- package/lib/autoupdate.mjs +47 -0
- package/lib/clients.mjs +139 -0
- package/lib/run.mjs +32 -0
- package/lib/state.mjs +52 -0
- package/lib/tree.mjs +48 -0
- package/package.json +44 -4
- package/plugins/deepmodebot/.antigravity-plugin/plugin.json +35 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/deep/SKILL.md +13 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/land-pr/SKILL.md +23 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/pr-thread/SKILL.md +17 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/review-pr/SKILL.md +16 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/tournament/SKILL.md +14 -0
- package/plugins/deepmodebot/.claude-plugin/plugin.json +27 -0
- package/plugins/deepmodebot/agents/reviewer/agent.md +33 -0
- package/plugins/deepmodebot/agents/scout/agent.md +34 -0
- package/plugins/deepmodebot/agents/security-reviewer/agent.md +30 -0
- package/plugins/deepmodebot/assets/logo.svg +8 -0
- package/plugins/deepmodebot/commands/contribute.md +8 -0
- package/plugins/deepmodebot/commands/deep.md +11 -0
- package/plugins/deepmodebot/commands/land-pr.md +12 -0
- package/plugins/deepmodebot/commands/pr-thread.md +14 -0
- package/plugins/deepmodebot/commands/project-brief.md +8 -0
- package/plugins/deepmodebot/commands/review-pr.md +10 -0
- package/plugins/deepmodebot/commands/tournament.md +12 -0
- package/plugins/deepmodebot/hooks/hooks.json +26 -0
- package/plugins/deepmodebot/hooks.json +24 -0
- package/plugins/deepmodebot/mcp_config.json +11 -0
- package/plugins/deepmodebot/scripts/antigravity-guard.mjs +413 -0
- package/plugins/deepmodebot/scripts/omp-mcp-server.mjs +1091 -0
- package/plugins/deepmodebot/skills/agent-harnesses/SKILL.md +57 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/bun.lock +391 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/check.ts +53 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/check_antigravity.py +38 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/check_claude.mjs +11 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/package.json +11 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/requirements.txt +1 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/ai-native-tooling.md +190 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/ai-sdk-selection.md +50 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/antigravity.md +108 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/claude-code.md +166 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/codex.md +151 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/delegation-efficiency.md +230 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/langchain-ecosystem.md +124 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/omp.md +183 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/protocols.md +172 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/sdks.md +228 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/self-authoring.md +171 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/SKILL.md +24 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/aws.md +264 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/azure.md +261 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/containers.md +96 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/devops-tools.md +297 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/devsecops-pipeline.md +258 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/gcp.md +258 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/kubernetes.md +74 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/local-emulators.md +265 -0
- package/plugins/deepmodebot/skills/contribute/SKILL.md +134 -0
- package/plugins/deepmodebot/skills/create-verification-skill/LICENSE +21 -0
- package/plugins/deepmodebot/skills/create-verification-skill/SKILL.md +101 -0
- package/plugins/deepmodebot/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/plugins/deepmodebot/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/plugins/deepmodebot/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/plugins/deepmodebot/skills/deep-stack/SKILL.md +53 -0
- package/plugins/deepmodebot/skills/deep-stack/references/AGENTS.template.md +52 -0
- package/plugins/deepmodebot/skills/deep-stack/references/agentic-workflow.md +114 -0
- package/plugins/deepmodebot/skills/deep-stack/references/any-app-stack.md +51 -0
- package/plugins/deepmodebot/skills/deep-stack/references/design-workflow.md +101 -0
- package/plugins/deepmodebot/skills/deep-stack/references/isolate.md +23 -0
- package/plugins/deepmodebot/skills/deep-stack/references/philosophy.md +306 -0
- package/plugins/deepmodebot/skills/deep-stack/references/prove.md +31 -0
- package/plugins/deepmodebot/skills/deep-stack/references/stack.md +119 -0
- package/plugins/deepmodebot/skills/deep-stack/references/structure.md +22 -0
- package/plugins/deepmodebot/skills/deep-stack/references/unslop/LICENSE +21 -0
- package/plugins/deepmodebot/skills/deep-stack/references/unslop/unslop.md +80 -0
- package/plugins/deepmodebot/skills/deepmodebot/LICENSE +23 -0
- package/plugins/deepmodebot/skills/deepmodebot/SKILL.md +198 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/agents_md.py +207 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/test_agents_md.py +146 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/architecture-review/report-template.html +92 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude-guard.sh +42 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude_guard.py +135 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/omp-contain-link.ts +12 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/omp-contain.ts +115 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_antigravity_guard.py +483 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_audit_regressions.py +139 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_contain.py +301 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_omp_mcp.py +602 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/design.py +242 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/evidence.py +293 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/record.py +387 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/review.py +339 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_design.py +69 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_evidence.py +160 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_record.py +180 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_review.py +265 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard-patterns.txt +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.sh +132 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.ts +122 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/test_git_guard.py +192 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/bot.py +3037 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/brand.json +11 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/brand.py +51 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/ghapp.py +361 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/install.py +274 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/local_updates.py +576 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/review_context.py +204 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_bot.py +2182 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_brand.py +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_local_updates.py +691 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_review_context.py +127 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_workspace_cleanup.py +496 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/workspace_cleanup.py +351 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/loop.py +2394 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/plan.py +583 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_loop.py +1426 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_plan.py +320 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_windows_job.py +326 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/windows_job.py +244 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/bench_harness.py +165 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/perf_audit.py +240 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/test_bench_harness.py +55 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/test_perf_audit.py +53 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/diff_coverage.py +350 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/pr_agent_local.py +370 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/test_diff_coverage.py +94 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/arena.html +425 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/arena.py +579 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/arena_tui.py +839 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/font8x8_basic.hex +1 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/show_thread.py +329 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/test_arena.py +610 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/repo-references.json +637 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/test_yt_enrich.py +250 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_enrich.py +1820 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_meta.py +156 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_transcript_relay.js +54 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/security-audit/audit-pr.sh +122 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/security-audit/gate.cjs +155 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/security-audit/prompt.md +13 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/tournament/test_tournament.py +654 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/tournament/tournament.py +1285 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/wizard/wizard.sh +234 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/workspace-map/test_workspace_map.py +879 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/workspace-map/workspace_map.py +2436 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/README.md +61 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/catalog.md +105 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/contain.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/factory-landscape.md +147 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/flows.md +50 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/authoring-a-skill.md +37 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/babysit.md +77 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/bug-fix.md +34 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/end-to-end.md +50 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/eval.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/feature.md +60 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/handoff.md +52 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/hillclimb.md +46 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/investigation.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/opening-a-pr.md +97 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/pause-safely.md +30 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/perf-issue.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/phased-build.md +146 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/prototype.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/refactoring.md +60 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/reference-rebuild.md +45 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/run-a-goal.md +143 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/runtime-forensics.md +22 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/self-authoring.md +130 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/session-pickup.md +33 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/setup.md +105 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/shipping.md +52 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/spec.md +67 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/tickets.md +56 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/trace-forensics.md +24 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/triage.md +102 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/visual-parity.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/wayfinder.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/work-a-queue.md +189 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/worktree-cleanup.md +35 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/attack-the-premise.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/boundary-discipline.md +8 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/build-the-lever.md +8 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/encode-lessons-in-structure.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/exhaust-the-design-space.md +4 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/experience-first.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/explain-the-number.md +9 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/fix-root-causes.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/foundational-thinking.md +9 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/guard-the-context-window.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/laziness-protocol.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/make-operations-idempotent.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/migrate-callers-then-delete-legacy-apis.md +5 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/minimize-reader-load.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/model-the-domain.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/never-block-on-the-human.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/outcome-oriented-execution.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/prove-it-works.md +8 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/redesign-from-first-principles.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/separate-before-serializing-shared-state.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/sequence-verifiable-units.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/subtract-before-you-add.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/test-behavior-not-implementation.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/type-system-discipline.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/rust-migration-case-studies.md +26 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/startup-ideas.md +21 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/agent-collaboration.md +82 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/architect.md +32 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/architecture-review.md +43 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/arena.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/benchmark-checklist.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/blast-radius.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/correct.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/course.md +47 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/coworkers.md +70 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/domain-model.md +69 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/figure-it-out.md +25 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/git-guardrails.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/github-app.md +160 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/goal-review.md +156 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/grill.md +27 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/how.md +23 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/in-your-own-words.md +12 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/inner-loop.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/interrogate.md +16 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/issue-conversation.md +52 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/no-comments.md +29 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/open-design-evidence.md +65 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/panel.md +34 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-agent.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-conversation.md +135 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-review.md +138 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pre-commit.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/prior-art.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/questionnaire.md +46 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/re-explain.md +23 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/recall.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/reflect.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/research.md +99 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/retro.md +30 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/scrape.md +32 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/security-audit.md +40 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sharpen.md +15 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/show-me-your-work.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sme-review.md +49 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/swarm.md +14 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tdd.md +55 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/teach.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/technical-writing.md +22 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tool-routing.md +85 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tournament.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tracker.md +78 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/unslop.md +15 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/visual-e2e.md +78 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/why.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/wizard.md +25 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/workspace-map.md +35 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/writing-for-agents.md +66 -0
- package/plugins/deepmodebot/skills/deepmodebot/scripts/check_skill.py +93 -0
- package/plugins/deepmodebot/skills/deepmodebot/scripts/trending.py +598 -0
- package/plugins/deepmodebot/skills/domain-rules/SKILL.md +131 -0
- package/plugins/deepmodebot/skills/domain-rules/references/agent-engineering.md +105 -0
- package/plugins/deepmodebot/skills/domain-rules/references/ai-concepts.md +103 -0
- package/plugins/deepmodebot/skills/domain-rules/references/aws-networking.md +121 -0
- package/plugins/deepmodebot/skills/domain-rules/references/backend-system-design.md +162 -0
- package/plugins/deepmodebot/skills/domain-rules/references/data-structures-and-cache-optimization.md +48 -0
- package/plugins/deepmodebot/skills/domain-rules/references/devops-and-fundamentals.md +137 -0
- package/plugins/deepmodebot/skills/domain-rules/references/engineering-practice.md +100 -0
- package/plugins/deepmodebot/skills/domain-rules/references/high-scale-server-optimization.md +181 -0
- package/plugins/deepmodebot/skills/domain-rules/references/language-ecosystems.md +56 -0
- package/plugins/deepmodebot/skills/frontend-ui/SKILL.md +146 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/live-demos.md +38 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/mobbin-shipped-apps.md +28 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/motion-clips.md +269 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/motion-graphics.md +62 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/pinterest-animations.md +217 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/pinterest-patterns.md +101 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/01-workflow.md +25 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/02-review-rubric.md +21 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/03-ai-tells.md +46 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/04-components.md +21 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/04a-agent-ui.md +153 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/05-motion.md +106 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/05a-motion-graphics.md +121 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06-typography-layout.md +48 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06a-color.md +26 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/07-copy.md +11 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/08-quality-floor.md +63 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/09-steering-agents.md +13 -0
- package/plugins/deepmodebot/skills/maintain-verification-skill/LICENSE +21 -0
- package/plugins/deepmodebot/skills/maintain-verification-skill/SKILL.md +47 -0
- package/plugins/deepmodebot/skills/project-brief/SKILL.md +100 -0
- package/plugins/deepmodebot/skills/project-brief/assets/CONTRIBUTING.template.md +124 -0
- package/plugins/deepmodebot/skills/project-brief/assets/ISSUE_TEMPLATE/task.yml +61 -0
- package/plugins/deepmodebot/skills/project-brief/assets/PROJECT_BRIEF.template.md +98 -0
- package/plugins/deepmodebot/skills/project-brief/assets/PULL_REQUEST_TEMPLATE.md +35 -0
- package/plugins/deepmodebot/skills/project-brief/assets/pr-overlap.py +643 -0
- package/plugins/deepmodebot/skills/project-brief/assets/sync-roadmap.py +314 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/SKILL.md +60 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/agent-authentication.md +198 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/leak-prevention.md +206 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/logins-and-passwords.md +165 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/secrets-and-env.md +182 -0
- package/plugins/deepmodebot/skills/software-architecture/SKILL.md +47 -0
- package/plugins/deepmodebot/skills/software-architecture/references/backend-infrastructure.md +273 -0
- package/plugins/deepmodebot/skills/software-architecture/references/databases.md +277 -0
- package/plugins/deepmodebot/skills/software-architecture/references/monorepos.md +210 -0
- package/plugins/deepmodebot/skills/software-architecture/references/ontology.md +287 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Databases for agent-built apps (2026): choose, organize, migrate, operate safely
|
|
2
|
+
|
|
3
|
+
Facts checked 2026-11-11 against official docs, pricing pages, and GitHub/npm/PyPI release metadata. Version and price figures go stale; re-check before quoting.
|
|
4
|
+
|
|
5
|
+
- Default to **PostgreSQL 18** with extensions before adding another datastore. Postgres 14 reaches end of life on 2026-11-12, and Postgres 19 is at RC1 ([versioning](https://www.postgresql.org/support/versioning/)).
|
|
6
|
+
- Keep schema and migrations in the repo (`packages/db`). Commit the generated SQL, review it like code, and run migrations through expand-contract. Never run `push`/`reset` workflows against shared databases.
|
|
7
|
+
- Use one connection string per role: owner (migrations only), app (DML only), and agent (read-only with timeouts). Agents get a branch or a throwaway database, never production credentials ([Neon MCP guidance](https://neon.com/docs/ai/neon-mcp-server), [Replit incident response](https://replit.com/blog/introducing-a-safer-way-to-vibe-code-with-replit-databases)).
|
|
8
|
+
- A read-only MCP server still leaks data through prompt injection. Least privilege, project scoping, and human review are what actually limit damage ([Supabase](https://supabase.com/blog/defense-in-depth-mcp)).
|
|
9
|
+
- Test against a real Postgres (Testcontainers, PGlite, or a DB branch), not mocks or SQLite stand-ins ([Prisma AGENTS.md for databases](https://www.prisma.io/blog/agents-md-for-databases)).
|
|
10
|
+
|
|
11
|
+
## 1. Workload -> database
|
|
12
|
+
|
|
13
|
+
| Situation | Pick | Why | Source |
|
|
14
|
+
|---|---|---|---|
|
|
15
|
+
| New web/API app, relational data, any size a small team will see | Postgres 18 | 5-year support window per major; extensions cover vectors, geo, time series, partitioning | [versioning](https://www.postgresql.org/support/versioning/) |
|
|
16
|
+
| Single-server app, low/medium write traffic, embedded or local-first | SQLite (WAL) | SQLite says sites under ~100K hits/day work fine (a conservative estimate); one writer at a time | [whentouse](https://www.sqlite.org/whentouse.html) |
|
|
17
|
+
| Many clients over a network, write-heavy, multi-server | Client/server RDBMS (Postgres) | SQLite's own checklist says to pick client/server when the data is separated from the app by a network | [whentouse](https://www.sqlite.org/whentouse.html) |
|
|
18
|
+
| Database per agent/user/tenant at very large counts | Turso Cloud, Cloudflare D1, or Neon project-per-tenant | Free and paid tiers are built for many small DBs (D1 paid: 100,000 DBs included) | [D1 pricing](https://developers.cloudflare.com/d1/platform/pricing/), [Neon pricing](https://neon.com/pricing) |
|
|
19
|
+
| Local/batch analytics on Parquet/CSV, notebooks, CI reports | DuckDB (embedded) | In-process OLAP, MIT, v2.0.0 released 2026-10-21 | [duckdb releases](https://github.com/duckdb/duckdb/releases) |
|
|
20
|
+
| Shared cloud analytics on DuckDB | MotherDuck (paid beyond Lite) | Lite: $0, 10 GB storage, 10 h Pulse compute/month | [MotherDuck pricing](https://motherduck.com/product/pricing/) |
|
|
21
|
+
| High-volume event/log analytics (billions of rows, aggregations) | ClickHouse | Columnar OLAP, Apache-2.0, monthly stable plus LTS lines | [ClickHouse releases](https://github.com/ClickHouse/ClickHouse/releases) |
|
|
22
|
+
| Time series inside an existing Postgres | TimescaleDB extension | Apache-2.0 core plus Timescale License (TSL) features | [license](https://github.com/timescale/timescaledb/blob/main/LICENSE) |
|
|
23
|
+
| Embeddings for RAG next to app data | pgvector | HNSW/IVFFlat indexes, filtering, iterative index scans (0.8.0+) | [pgvector](https://github.com/pgvector/pgvector) |
|
|
24
|
+
| In-app search over your own tables | Postgres full-text search | Built in; no sync pipeline | [textsearch](https://www.postgresql.org/docs/current/textsearch.html) |
|
|
25
|
+
| Typo-tolerant instant search UX | Meilisearch or Typesense | Purpose-built engines; check the licenses below | [Meilisearch](https://github.com/meilisearch/meilisearch), [Typesense](https://github.com/typesense/typesense) |
|
|
26
|
+
| Cache, rate limits, ephemeral counters | Valkey (BSD) or Redis 8 (AGPLv3 option) | Licensing differs; see section 3 | [Valkey](https://github.com/valkey-io/valkey), [Redis AGPL](https://redis.io/blog/agplv3/) |
|
|
27
|
+
| Existing MySQL/Vitess shop | MySQL 8.4/9.7 line or PlanetScale (paid) | Stay on what the team runs; no reason to migrate a working system | [mysql-server tags](https://github.com/mysql/mysql-server/tags) |
|
|
28
|
+
| Document-shaped data, no need for joins/transactions across docs | Postgres `jsonb` first; MongoDB only if team expertise demands it | MongoDB Community is SSPL (not OSI) | [mongo LICENSE](https://github.com/mongodb/mongo/blob/master/LICENSE-Community.txt) |
|
|
29
|
+
|
|
30
|
+
Rules:
|
|
31
|
+
- Add a second datastore only after measuring that Postgres fails a concrete requirement. Every extra store adds a sync path, a backup plan, and a credential that agents can mishandle [inference].
|
|
32
|
+
- SQLite on a network filesystem risks corruption because of buggy file locking ([whentouse](https://www.sqlite.org/whentouse.html)). Never put it on NFS/SMB shares, including Windows mapped drives.
|
|
33
|
+
|
|
34
|
+
## 2. Engines and extensions (tool table)
|
|
35
|
+
|
|
36
|
+
| Tool | What | License / free terms | Latest release | Agent notes | Source |
|
|
37
|
+
|---|---|---|---|---|---|
|
|
38
|
+
| PostgreSQL | RDBMS | PostgreSQL License | 18.6 current; 19 RC1 2026-10-15 | `uuidv7()` built in from 18; 14 EOL 2026-11-12 | [versioning](https://www.postgresql.org/support/versioning/) |
|
|
39
|
+
| pgvector | Vector type + ANN indexes | PostgreSQL License | v0.8.7 (tag 2026-10-01) | HNSW: better speed/recall than IVFFlat, slower builds, more memory; `halfvec` to save space | [repo](https://github.com/pgvector/pgvector) |
|
|
40
|
+
| pgvectorscale | DiskANN-style index for pgvector | PostgreSQL License | 0.9.1 (2026-09-04) | Only when pgvector HNSW memory becomes the bottleneck | [repo](https://github.com/timescale/pgvectorscale) |
|
|
41
|
+
| PostGIS | Geospatial | GPL-2.0 | 3.6.4; 3.7.0rc3 | Offered by most managed Postgres (Neon lists it on every plan) | [tags](https://github.com/postgis/postgis/tags), [Neon](https://neon.com/pricing) |
|
|
42
|
+
| pg_partman | Partition management | PostgreSQL License | v5.5.0 (2026-07-22) | Use for append-heavy tables (events, logs) past tens of GB [inference] | [repo](https://github.com/pgpartman/pg_partman) |
|
|
43
|
+
| TimescaleDB | Time series | Apache-2.0 + TSL (`tsl/` dir) | 2.31.0 (2026-10-20) | TSL's main restriction is offering it as a DBaaS; `SHOW timescaledb.license` shows the edition | [TSL](https://www.timescale.com/legal/licenses), [editions](https://docs.tigerdata.com/about/latest/timescaledb-editions) |
|
|
44
|
+
| Citus | Distributed Postgres | AGPL-3.0 | v14.3.0 (2026-10-23) | Only for real sharding needs | [repo](https://github.com/citusdata/citus) |
|
|
45
|
+
| SQLite | Embedded RDBMS | Public domain | n/a | One writer at a time; WAL for concurrency | [whentouse](https://www.sqlite.org/whentouse.html) |
|
|
46
|
+
| Turso Database (ex-Limbo) | SQLite rewrite in Rust | MIT | v0.8.3 (2026-10-12), pre-1.0 | libSQL README calls it beta and says new projects should look at it; Turso joined Supabase 2026-10-02 | [turso](https://github.com/tursodatabase/turso), [libsql](https://github.com/tursodatabase/libsql), [news](https://turso.tech/blog/turso-is-joining-supabase) |
|
|
47
|
+
| libSQL | SQLite fork | MIT | server v0.24.32 (2025-02-14) | No server release in 12+ months; repo still pushed; feature work moved to Turso Database | [repo](https://github.com/tursodatabase/libsql) |
|
|
48
|
+
| Litestream | SQLite WAL streaming backup to object storage | Apache-2.0 | v0.5.18 (2026-11-03) | README status badge: beta | [repo](https://github.com/benbjohnson/litestream) |
|
|
49
|
+
| LiteFS | FUSE-replicated SQLite | Apache-2.0 | v0.5.14 (2025-04-22) | Beta; **no release in 12+ months**; avoid for new work | [repo](https://github.com/superfly/litefs) |
|
|
50
|
+
| DuckDB | Embedded OLAP | MIT | v2.0.0 (2026-10-21) | Node: `@duckdb/node-api` 2.0.0-r.1 | [repo](https://github.com/duckdb/duckdb) |
|
|
51
|
+
| ClickHouse | Columnar OLAP server | Apache-2.0 | v26.10.2 stable; v26.3 LTS | Prefer the LTS line for self-hosting | [releases](https://github.com/ClickHouse/ClickHouse/releases) |
|
|
52
|
+
| MySQL | RDBMS | GPL-2.0 (Community) | tags mysql-9.7.4, mysql-26.10.0, mysql-8.4.9 | Which line is LTS after 8.4: [unverified] | [tags](https://github.com/mysql/mysql-server/tags) |
|
|
53
|
+
| MongoDB | Document DB | SSPL v1 (not OSI) | r9.0.8 | SSPL matters if you offer it as a service | [license](https://github.com/mongodb/mongo/blob/master/LICENSE-Community.txt) |
|
|
54
|
+
| Redis | KV/cache | RSALv2 or SSPLv1 or AGPLv3 (8.0+); 7.2 and earlier BSD | 8.10.3 (2026-10-26) | AGPL option added May 2025 | [LICENSE](https://github.com/redis/redis/blob/unstable/LICENSE.txt), [blog](https://redis.io/blog/agplv3/) |
|
|
55
|
+
| Valkey | Redis fork | BSD-3-Clause | 9.1.3 (2026-10-26) | Drop-in for most Redis clients | [repo](https://github.com/valkey-io/valkey) |
|
|
56
|
+
| Qdrant | Vector DB | Apache-2.0 | v1.20.0 (2026-10-22) | Separate service; adds a sync path | [repo](https://github.com/qdrant/qdrant) |
|
|
57
|
+
| Weaviate | Vector DB | BSD-3 outside `wl/`; `wl/` is enterprise-only | v1.40.5 (2026-11-10) | Some features need a license key | [LICENSE](https://github.com/weaviate/weaviate/blob/main/LICENSE) |
|
|
58
|
+
| LanceDB | Embedded vector store | Apache-2.0 | PyPI 0.41.0 (2026-10-29) | Embedded like SQLite; good for local agents | [repo](https://github.com/lancedb/lancedb) |
|
|
59
|
+
| Chroma | Vector DB | Apache-2.0 | 1.5.9 (2026-05-05) | Prototyping; slower release cadence lately | [repo](https://github.com/chroma-core/chroma) |
|
|
60
|
+
| ParadeDB `pg_search` | BM25 search in Postgres | AGPL-3.0 | v0.26.6 (2026-11-08) | AGPL; check obligations before bundling | [repo](https://github.com/paradedb/paradedb) |
|
|
61
|
+
| Meilisearch | Search engine | MIT core + BUSL-1.1 Enterprise Edition parts | v1.56.2 (2026-11-09) | Cloud from $20/month, 14-day trial | [LICENSE](https://github.com/meilisearch/meilisearch/blob/main/LICENSE), [pricing](https://www.meilisearch.com/pricing) |
|
|
62
|
+
| Typesense | Search engine | GPL-3.0 | v30.2 (2026-04-19) | Self-host free | [repo](https://github.com/typesense/typesense) |
|
|
63
|
+
| OpenSearch | Search/log analytics | Apache-2.0 | 3.9.0 (2026-09-29); 2.19.7 | Heavy to run for a small app | [repo](https://github.com/opensearch-project/OpenSearch) |
|
|
64
|
+
|
|
65
|
+
When a separate vector DB is justified [inference]: the HNSW index no longer fits in RAM next to OLTP data, vector QPS interferes with transactional load, or you need features pgvector lacks after measuring. Until then, pgvector keeps vectors transactional with the rows they describe.
|
|
66
|
+
|
|
67
|
+
## 3. Licensing watchlist (2024-2026 changes)
|
|
68
|
+
|
|
69
|
+
- **Redis**: 7.4 moved to RSALv2/SSPL (March 2024). Redis 8 adds AGPLv3 as a third option. Valkey stays BSD ([Redis](https://redis.io/blog/agplv3/)).
|
|
70
|
+
- **Liquibase**: Community 5.0+ is FSL-1.1-ALv2 (Functional Source License that converts to Apache-2.0 later). Pro features were removed from GitHub releases ([LICENSE](https://github.com/liquibase/liquibase/blob/master/LICENSE.txt), [blog](https://www.liquibase.com/blog/liquibase-community-for-the-future-fsl)).
|
|
71
|
+
- **Atlas**: the standard binary is under the Atlas MSA. Only the Community build is Apache-2.0, and it lacks views, triggers, functions, RLS, extensions, partitions, `migrate lint`, and declarative `schema plan` ([Atlas editions](https://atlasgo.io/community-edition)).
|
|
72
|
+
- **Meilisearch** (MIT + BUSL EE), **Weaviate** (BSD + proprietary `wl/`), **TimescaleDB** (Apache + TSL): mixed-license repos, so check which features you enable.
|
|
73
|
+
- **MongoDB** SSPL, **Citus** and **ParadeDB** AGPL-3.0: fine for internal use. Get legal review before offering them as a service.
|
|
74
|
+
- **Ownership changes**: Neon now markets itself as "from Databricks" (Lakebase Postgres) ([Neon](https://neon.com/pricing)). Supabase is acquiring Turso ([Turso](https://turso.tech/blog/turso-is-joining-supabase)). Re-check terms after acquisitions.
|
|
75
|
+
|
|
76
|
+
## 4. Hosted free tiers (exact limits, 2026-11-11)
|
|
77
|
+
|
|
78
|
+
| Service | Free tier | Branching / backups on free | Gotchas | Source |
|
|
79
|
+
|---|---|---|---|---|
|
|
80
|
+
| Neon | 100 projects; 10 branches/project; 100 CU-hours/project/month; up to 2 CU; 1 GB storage/project, 20 GB total; 5 GB egress/project | Branching yes; 6 h history window (1 GB); 1 manual snapshot | Scales to zero after 5 min, no pausing for inactivity; hitting limits suspends compute or blocks writes, no data deleted | [pricing](https://neon.com/pricing) |
|
|
81
|
+
| Supabase | 2 active projects; 500 MB DB; shared CPU/500 MB RAM; 5 GB egress; 1 GB file storage; 50k MAU | No branching (Pro: $0.01344/branch-hour); no backups; PITR $100/month per 7 days | Free projects pause after 1 week of inactivity | [pricing](https://supabase.com/pricing) |
|
|
82
|
+
| Turso | 100 DBs; 5 GB; 500M rows read and 10M rows written per month; 3 GB syncs | 1-day point-in-time restore | SQLite semantics; vendor acquired by Supabase | [pricing](https://turso.tech/pricing) |
|
|
83
|
+
| Cloudflare D1 | 10 DBs; 5M rows read/day; 100k rows written/day; 5 GB total | n/a | Daily limits reset 00:00 UTC; queries error when exceeded; billed by rows scanned, so missing indexes cost money | [pricing](https://developers.cloudflare.com/d1/platform/pricing/) |
|
|
84
|
+
| Prisma Postgres | 200k operations/month; 2 GB; 50 DBs; 10 pooled + 10 direct connections | No backups on free (paid: daily, 7 days) | Accelerate retires 2026-12-01 | [pricing](https://www.prisma.io/pricing) |
|
|
85
|
+
| Nile | $0: 50M query tokens, 1 GB storage | Pricing page lists branching and backups as "coming soon" [unverified whether current] | Tenant-aware Postgres | [pricing](https://www.thenile.dev/pricing) |
|
|
86
|
+
| Xata | No free cloud tier (trial only); open-source self-host is free (Apache-2.0) | Copy-on-write branching on every plan | Cloud micro $0.012/h (~$9/month) + $0.28/GB-month | [pricing](https://xata.io/pricing) |
|
|
87
|
+
| PlanetScale | **None**: Hobby plan retired 2024-04-08 | n/a | Cheapest Postgres single-node PS-5 $5/month; HA PS-5 $15/month (us-east-1) | [blog](https://planetscale.com/blog/planetscale-forever), [pricing](https://planetscale.com/pricing) |
|
|
88
|
+
| MotherDuck | Lite $0: 10 GB, 10 h Pulse compute/month, 3 users | 1-day snapshot retention | Analytics only | [pricing](https://motherduck.com/product/pricing/) |
|
|
89
|
+
|
|
90
|
+
## 5. Branching, local dev, and tests
|
|
91
|
+
|
|
92
|
+
| Need | Pick | Notes | Source |
|
|
93
|
+
|---|---|---|---|
|
|
94
|
+
| Preview DB per PR | Neon branch (copy-on-write) or Supabase preview branch (paid) | Supabase preview branches are deleted when the PR merges or closes; persistent branches for staging | [Supabase branching](https://supabase.com/docs/guides/deployment/branching) |
|
|
95
|
+
| Branch per agent task | Neon branch, Xata branch, or Prisma `npx create-db --json` throwaway | Neon free includes 10 branches/project; extra branches $1.50/branch-month on paid | [Neon](https://neon.com/pricing), [Prisma blog](https://www.prisma.io/blog/agents-md-for-databases) |
|
|
96
|
+
| Local Postgres matching prod | Docker `postgres:18` (same major and extensions as prod) | On Windows, Docker Desktop + WSL2 is required for Testcontainers too [inference] | [Testcontainers](https://testcontainers.com/) |
|
|
97
|
+
| Integration tests | Testcontainers (node v12.2.1, go v0.45.0, python 4.15.0) | Real engine, disposable per test run | [node](https://github.com/testcontainers/testcontainers-node), [go](https://github.com/testcontainers/testcontainers-go), [python](https://github.com/testcontainers/testcontainers-python) |
|
|
98
|
+
| Fast in-process Postgres for unit tests or the browser | PGlite 0.5.16 (Apache-2.0) | WASM Postgres in single-user mode, ~3 MB gzipped, supports pgvector and PostGIS; not a load or concurrency test | [pglite](https://github.com/electric-sql/pglite) |
|
|
99
|
+
| Supabase stack locally | Supabase CLI (`supabase start`) | Local MCP at `http://localhost:54321/mcp` | [Supabase MCP](https://supabase.com/docs/guides/ai-tools/mcp) |
|
|
100
|
+
|
|
101
|
+
## 6. Repo organization (monorepo `packages/db`)
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
packages/db/
|
|
105
|
+
package.json # "@acme/db": exports client, schema, generated types
|
|
106
|
+
src/schema/ # Drizzle schema files (or prisma/schema.prisma)
|
|
107
|
+
src/client.ts # the ONLY place that reads DATABASE_URL and builds the pool
|
|
108
|
+
migrations/ # generated SQL, committed, reviewed; never edited after merge
|
|
109
|
+
seed/ # deterministic, idempotent dev/test seed; refuses to run when NODE_ENV=production
|
|
110
|
+
test/ # integration tests against real Postgres (Testcontainers / branch)
|
|
111
|
+
drizzle.config.ts # or prisma.config.ts (Prisma 7 moves URLs here)
|
|
112
|
+
apps/api, apps/worker # import @acme/db; never open their own connections
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- Keep one owner of the schema (`packages/db`). Apps import the typed client and never run DDL [inference].
|
|
116
|
+
- Python services: `db/` package with SQLAlchemy models + `alembic/` versions dir. Go: `db/migrations` (goose or dbmate) + `db/queries` for sqlc [inference].
|
|
117
|
+
- Separate env vars: `DATABASE_URL` (pooled, app role) and `DIRECT_DATABASE_URL` (unpooled, owner role, migrations only). In Prisma 7, the URL in `prisma.config.ts` is the one the CLI uses for migrations ([Prisma 7 upgrade](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v7)).
|
|
118
|
+
|
|
119
|
+
## 7. Migrations
|
|
120
|
+
|
|
121
|
+
| Tool | Style | License | Latest | Agent notes | Source |
|
|
122
|
+
|---|---|---|---|---|---|
|
|
123
|
+
| Drizzle Kit | Codebase-first: `generate` SQL + `migrate`, or `push` | Apache-2.0 | 0.31.11 (latest), 1.0.0-rc.5 (2026-10-21) | `push --force` auto-approves data-loss statements; keep `push` for local prototyping | [migrations](https://orm.drizzle.team/docs/migrations), [push](https://orm.drizzle.team/docs/drizzle-kit-push) |
|
|
124
|
+
| Prisma Migrate | Schema-first, generated SQL | Apache-2.0 | 7.10.1 (2026-10-15); 8.0.0-rc.33 | Since 6.15, detects AI agents and refuses `migrate reset --force` without explicit consent | [changelog](https://www.prisma.io/changelog/2025-08-27) |
|
|
125
|
+
| Atlas | Declarative or versioned, lint, drift | Apache-2.0 Community build / MSA standard | v1.3.0 (2026-08-02) | Lint, `schema plan`, and RLS/views are paid (Pro, 30-day trial) | [editions](https://atlasgo.io/community-edition) |
|
|
126
|
+
| Alembic | SQLAlchemy autogenerate | MIT | 1.20.1 (2026-10-22) | Autogenerate output must be reviewed; it guesses renames as drop+add [inference] | [repo](https://github.com/sqlalchemy/alembic) |
|
|
127
|
+
| goose | SQL or Go migrations | MIT | v3.30.0 (2026-11-10) | Go-native; embeddable | [repo](https://github.com/pressly/goose) |
|
|
128
|
+
| dbmate | Plain SQL up/down, language-agnostic | MIT | v2.38.1 (2026-11-09) | Good default for polyglot repos | [repo](https://github.com/amacneil/dbmate) |
|
|
129
|
+
| sqitch | Dependency-based plans | MIT | v1.6.1 (2026-01-06) | Powerful, steeper learning curve | [repo](https://github.com/sqitchers/sqitch) |
|
|
130
|
+
| Flyway Community | Versioned SQL | Apache-2.0 | 13.12.1 (2026-11-05) | Undo and advanced features are in paid Redgate editions | [repo](https://github.com/flyway/flyway), [editions](https://www.red-gate.com/products/flyway/pricing) |
|
|
131
|
+
| Liquibase Community | Changelogs | FSL-1.1-ALv2 since 5.0 | v5.0.4 (2026-08-20) | License change; check policy | [LICENSE](https://github.com/liquibase/liquibase/blob/master/LICENSE.txt) |
|
|
132
|
+
| pgroll | Zero-downtime expand/contract for Postgres | Apache-2.0 | v0.16.3 (2026-09-08) | Serves old and new schema versions at once | [repo](https://github.com/xataio/pgroll) |
|
|
133
|
+
| Squawk | Postgres migration linter | Apache-2.0 | v2.72.0 (2026-11-08) | Free CI gate for lock-heavy DDL | [repo](https://github.com/sbdchd/squawk) |
|
|
134
|
+
|
|
135
|
+
| Stack | Access layer | Migration tool | Why |
|
|
136
|
+
|---|---|---|---|
|
|
137
|
+
| TypeScript, SQL-literate team, serverless/edge | Drizzle ORM | Drizzle Kit `generate` + `migrate` | SQL-shaped API; SQL files committed ([docs](https://orm.drizzle.team/docs/migrations)) |
|
|
138
|
+
| TypeScript, wants highest-level API and Studio | Prisma ORM 7 | Prisma Migrate | Built-in AI guardrail; Prisma 7 requires driver adapters ([upgrade](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v7)) |
|
|
139
|
+
| TypeScript, raw-SQL control | Kysely + kysely-codegen | dbmate or Atlas | Type-safe query builder; types generated from the live schema |
|
|
140
|
+
| Python | SQLAlchemy 2.x (or SQLModel with FastAPI) | Alembic | De facto standard pair |
|
|
141
|
+
| Go | sqlc (or ent) | goose / dbmate (or Atlas for ent) | sqlc compiles SQL to typed Go ([sqlc](https://github.com/sqlc-dev/sqlc)) |
|
|
142
|
+
| Polyglot monorepo | per-language layer | dbmate or Atlas on plain SQL | One SQL migration history shared by all services [inference] |
|
|
143
|
+
|
|
144
|
+
Expand-contract rules (zero-downtime) ([ParallelChange](https://martinfowler.com/bliki/ParallelChange.html), [GitLab](https://docs.gitlab.com/development/database/avoiding_downtime_in_migrations/)):
|
|
145
|
+
1. Expand: add the new column/table as nullable or defaulted. Deploy code that writes both old and new.
|
|
146
|
+
2. Backfill in batches. Switch reads. Then add constraints as `NOT VALID` and `VALIDATE CONSTRAINT` separately ([ALTER TABLE](https://www.postgresql.org/docs/current/sql-altertable.html)).
|
|
147
|
+
3. Contract in a **later** release: stop referencing the old column in code first, drop it next release. GitLab splits a column drop across three releases.
|
|
148
|
+
4. Renames are add-copy-switch-drop, never `RENAME` while old code still runs.
|
|
149
|
+
5. Build indexes with `CREATE INDEX CONCURRENTLY`. It cannot run inside a transaction block, so mark that migration non-transactional ([CREATE INDEX](https://www.postgresql.org/docs/current/sql-createindex.html)).
|
|
150
|
+
6. Start every migration with `SET lock_timeout = '5s';` so it fails fast instead of queueing behind long queries and blocking all traffic ([client config](https://www.postgresql.org/docs/current/runtime-config-client.html)). Retry with backoff.
|
|
151
|
+
7. Migrations are forward-only once merged. Fix mistakes with a new migration, and never edit an applied file.
|
|
152
|
+
|
|
153
|
+
## 8. Schema conventions
|
|
154
|
+
|
|
155
|
+
- **Naming**: `snake_case`, unquoted, plural or singular consistently. Unquoted identifiers fold to lower case, and names are truncated at 63 bytes ([lexical](https://www.postgresql.org/docs/current/sql-syntax-lexical.html)). Name constraints explicitly (`orders_customer_id_fkey`) so migrations can reference them.
|
|
156
|
+
- **IDs**: Postgres 18 ships `uuidv7()`, time-ordered with millisecond precision ([UUID functions](https://www.postgresql.org/docs/18/functions-uuid.html)). Use `id uuid PRIMARY KEY DEFAULT uuidv7()`. `uuid_extract_timestamp()` reveals creation time, so do not expose v7 IDs where creation time is sensitive. On older Postgres, generate v7 in the app. `bigint GENERATED ALWAYS AS IDENTITY` is fine for internal tables [inference].
|
|
157
|
+
- **Timestamps**: `timestamptz` with `created_at`/`updated_at` set by the database, not the client [inference].
|
|
158
|
+
- **Soft delete**: usually not worth it. `deleted_at` leaks into every query, effectively loses foreign-key integrity, and makes pruning hard. Prefer hard delete plus a deleted-records table holding row JSON ([brandur](https://brandur.org/soft-deletion)). If you must soft delete, add partial unique indexes `WHERE deleted_at IS NULL` [inference].
|
|
159
|
+
- **Audit**: append-only `audit_log(table, row_id, op, old jsonb, new jsonb, actor, at)` written by trigger. Pass the actor via `set_config('app.actor_id', ..., true)` [inference].
|
|
160
|
+
- **Seeding**: deterministic, idempotent, small. Drizzle ships seeding docs ([seed](https://orm.drizzle.team/docs/seed-overview)) and Prisma has `prisma db seed`. Seeds never target production.
|
|
161
|
+
- **Domain modeling**: enums/`CHECK` constraints and foreign keys encode invariants. This builds on deepmodebot's model-the-domain principle rather than repeating it.
|
|
162
|
+
|
|
163
|
+
## 9. Multi-tenancy
|
|
164
|
+
|
|
165
|
+
| Tenancy | Pattern | Why | Source |
|
|
166
|
+
|---|---|---|---|
|
|
167
|
+
| Many small tenants (B2C, SMB SaaS) | Pool: shared tables + `tenant_id` + RLS | One schema, one migration; the DB filters rows even when app code forgets the `WHERE` (not a boundary against arbitrary SQL, see below) | [AWS pool model](https://docs.aws.amazon.com/prescriptive-guidance/latest/saas-multitenant-managed-postgresql/pool.html), [AWS RLS blog](https://aws.amazon.com/blogs/database/multi-tenant-data-isolation-with-postgresql-row-level-security/) |
|
|
168
|
+
| Few large or regulated tenants, residency, per-tenant restore | Silo: database per tenant | Strongest isolation; migrations fan out per DB | [AWS isolation whitepaper](https://docs.aws.amazon.com/whitepapers/latest/saas-tenant-isolation-strategies/pooled-storage-isolation-strategies.html), [Neon per-tenant cost](https://neon.com/pricing) |
|
|
169
|
+
| Mixed tiers | Bridge: schema per tenant or pool plus silo for premium | AWS describes mixing silo and pool | [AWS whitepaper PDF](https://docs.aws.amazon.com/pdfs/whitepapers/latest/saas-tenant-isolation-strategies/saas-tenant-isolation-strategies.pdf) |
|
|
170
|
+
| Per-agent or per-user scratch data | SQLite DB per agent (Turso/D1) or Neon project | Cheap at high DB counts | [Turso](https://turso.tech/pricing), [D1](https://developers.cloudflare.com/d1/platform/pricing/) |
|
|
171
|
+
|
|
172
|
+
RLS facts that bite ([RLS docs](https://www.postgresql.org/docs/current/ddl-rowsecurity.html)): superusers and `BYPASSRLS` roles always bypass RLS. Table owners bypass unless you use `FORCE ROW LEVEL SECURITY`. With no policy, access is default-deny. `TRUNCATE` is not subject to RLS. Supabase's `service_role` bypasses RLS ([General Analysis](https://generalanalysis.com/blog/supabase-mcp-blog)).
|
|
173
|
+
|
|
174
|
+
```sql
|
|
175
|
+
ALTER TABLE invoices ENABLE ROW LEVEL SECURITY;
|
|
176
|
+
ALTER TABLE invoices FORCE ROW LEVEL SECURITY;
|
|
177
|
+
CREATE POLICY tenant_isolation ON invoices
|
|
178
|
+
USING (tenant_id = current_setting('app.tenant_id')::uuid)
|
|
179
|
+
WITH CHECK (tenant_id = current_setting('app.tenant_id')::uuid);
|
|
180
|
+
-- per request, inside the transaction (is_local = true survives transaction pooling):
|
|
181
|
+
SELECT set_config('app.tenant_id', $1, true);
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Trust boundary: any role can set a custom setting such as `app.tenant_id` ([set_config](https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADMIN-SET)). This policy stops app bugs that omit the tenant filter, not a caller that can run arbitrary SQL as `app_rw` or `agent_ro` (such as SQL injection or an agent with a SQL tool), which can call `set_config` with another tenant's UUID and read their rows.
|
|
185
|
+
|
|
186
|
+
Never give agents a SQL connection to pooled multi-tenant data. Where the caller can run arbitrary SQL, key isolation on something it cannot change: a separate database per tenant (silo), or one `LOGIN` role per tenant with no membership in other tenant roles and the policy keyed on `current_user`.
|
|
187
|
+
|
|
188
|
+
## 10. Access layers (ORMs, query builders, type generation)
|
|
189
|
+
|
|
190
|
+
| Tool | Lang | License | Latest | Agent notes | Source |
|
|
191
|
+
|---|---|---|---|---|---|
|
|
192
|
+
| Drizzle ORM | TS | Apache-2.0 | 0.45.4 (2026-10-08); 1.0.0-rc.5 | v1 RC changes relations API (RQB v2); pin a major | [repo](https://github.com/drizzle-team/drizzle-orm), [v1 upgrade](https://orm.drizzle.team/docs/upgrade-v1) |
|
|
193
|
+
| Prisma ORM 7 | TS | Apache-2.0 | 7.10.1; 8.0.0-rc.33 (2026-11-06) | 7: ESM-only, Rust-free `prisma-client` generator, required `output`, driver adapters for every DB, `prisma.config.ts`, no automatic `.env` loading, `pg` pool defaults (no connect timeout) | [upgrade](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v7) |
|
|
194
|
+
| Kysely | TS | MIT | 0.29.8 (2026-11-01) | Pair with kysely-codegen 0.20.0 (2026-02-16), kysely-ctl, or prisma-kysely 3.2.1 | [kysely](https://github.com/kysely-org/kysely), [codegen](https://github.com/RobinBlomberg/kysely-codegen) |
|
|
195
|
+
| Kanel | TS types from Postgres | MIT | npm 4.0.5 (2026-11-11) | GitHub releases stale (2023); npm is current | [repo](https://github.com/kristiandupont/kanel) |
|
|
196
|
+
| SQLAlchemy 2.x | Py | MIT | 2.1.8 / 2.0.57 (2026-11-04) | Use 2.0-style `select()`; async via asyncpg/psycopg 3 | [repo](https://github.com/sqlalchemy/sqlalchemy) |
|
|
197
|
+
| SQLModel | Py | MIT | 0.0.49 (2026-11-11) | Still 0.0.x; pin exact version | [repo](https://github.com/fastapi/sqlmodel) |
|
|
198
|
+
| sqlc | Go/others | MIT | v1.31.1 (2026-04-22) | Write SQL, get typed code; strong fit for agents because the SQL is reviewable [inference] | [repo](https://github.com/sqlc-dev/sqlc) |
|
|
199
|
+
| GORM | Go | MIT | v1.31.2 (2026-06-25) | Do not use `AutoMigrate` in production; use goose/Atlas [inference] | [repo](https://github.com/go-gorm/gorm) |
|
|
200
|
+
| ent | Go | Apache-2.0 | v0.14.6 (2026-03-23) | Schema-as-code; integrates with Atlas | [repo](https://github.com/ent/ent) |
|
|
201
|
+
| Diesel | Rust | MIT/Apache-2.0 | v2.3.14 (2026-10-07) | Compile-time checked queries | [repo](https://github.com/diesel-rs/diesel) |
|
|
202
|
+
| SeaORM | Rust | MIT/Apache-2.0 | 2.0.4 (2026-09-27) | Async ORM | [repo](https://github.com/SeaQL/sea-orm) |
|
|
203
|
+
| Supabase CLI types | TS | MIT | v4.0.0-next tags | `supabase gen types` from the live schema | [repo](https://github.com/supabase/cli) |
|
|
204
|
+
|
|
205
|
+
## 11. Operations: backups, PITR, pooling
|
|
206
|
+
|
|
207
|
+
- **Backups**: managed providers differ sharply. Neon keeps history for 6 h on free and up to 7/30 days on Launch/Scale. Supabase Pro has daily backups (7 days) and sells PITR as a $100/month add-on. Turso free has 1-day restore. Prisma Postgres free has none ([Neon](https://neon.com/pricing), [Supabase](https://supabase.com/pricing), [Turso](https://turso.tech/pricing), [Prisma](https://www.prisma.io/pricing)).
|
|
208
|
+
- Self-hosted Postgres: continuous WAL archiving + base backups give PITR ([docs](https://www.postgresql.org/docs/current/continuous-archiving.html)). Tools: pgBackRest 2.60.0 (MIT, 2026-10-18), WAL-G v3.0.9 (2026-08-20), Barman 3.20.1 (GPL-3.0) ([pgBackRest](https://github.com/pgbackrest/pgbackrest), [WAL-G](https://github.com/wal-g/wal-g), [Barman](https://github.com/EnterpriseDB/barman)). SQLite: Litestream.
|
|
209
|
+
- An untested backup is not a backup. Schedule a restore into a branch or scratch instance and run a row-count/checksum query [inference].
|
|
210
|
+
- **Pooling**: serverless functions must go through a pooler. PgBouncer 1.26.1 (2026-10-14) in transaction mode tracks protocol-level prepared statements when `max_prepared_statements` is non-zero (current default 200) ([config](https://www.pgbouncer.org/config.html)). Supavisor v2.10.0 (Apache-2.0) backs Supabase ([repo](https://github.com/supabase/supavisor)). Neon pools up to 10,000 connections per compute ([Neon](https://neon.com/pricing)). The Neon serverless driver 1.2.0 (MIT) works over HTTP/WebSocket ([repo](https://github.com/neondatabase/serverless)).
|
|
211
|
+
- Transaction pooling breaks session state. Use `set_config(..., true)`/`SET LOCAL` inside transactions, and route advisory locks, `LISTEN`, and migrations through the direct URL [inference].
|
|
212
|
+
|
|
213
|
+
## 12. Agents and databases
|
|
214
|
+
|
|
215
|
+
| MCP option | Read-only control | License / latest | Status | Source |
|
|
216
|
+
|---|---|---|---|---|
|
|
217
|
+
| Supabase MCP (hosted `mcp.supabase.com/mcp` or local CLI) | `read_only=true` runs SQL as a read-only Postgres user; `project_ref` scopes; `features=` limits tool groups | Apache-2.0; mcp-server-supabase v0.16.1 (2026-11-06) | Active; destructive-SQL confirmation is "not a security guarantee" | [docs](https://supabase.com/docs/guides/ai-tools/mcp), [repo](https://github.com/supabase-community/supabase-mcp) |
|
|
218
|
+
| Neon MCP (hosted `mcp.neon.tech/mcp`) | `readonly=true`, `projectId`, `category`, `roleName` (SQL runs as that role) | MIT repo; local stdio npm package deprecated | Neon: development and testing only, never connect to production | [docs](https://neon.com/docs/ai/neon-mcp-server) |
|
|
219
|
+
| Postgres MCP Pro (crystaldba) | `--access-mode=restricted`: read-only transactions + execution-time limits | MIT; v0.3.0 (2025-05-16) | **No release in 12+ months** | [repo](https://github.com/crystaldba/postgres-mcp) |
|
|
220
|
+
| Reference `@modelcontextprotocol/server-postgres` | READ ONLY transaction | MIT; npm 0.6.2 (2024-12-04) | **Archived**, "no security guarantees" | [archive](https://github.com/modelcontextprotocol/servers-archived) |
|
|
221
|
+
| MCP Toolbox for Databases (Google) | Tools defined in config [unverified details] | Apache-2.0; v1.16.0 (2026-11-05) | Active | [repo](https://github.com/googleapis/genai-toolbox) |
|
|
222
|
+
|
|
223
|
+
Incidents to learn from:
|
|
224
|
+
- **Supabase MCP, July 2025**: instructions planted in a support ticket made a developer's assistant, connected with `service_role` (bypasses RLS), read private tables and copy them into a customer-visible reply ([General Analysis](https://generalanalysis.com/blog/supabase-mcp-blog)). Supabase's response added read-only mode, project scoping, and feature groups, but states that prompt injection remains the top concern even in read-only mode ([Supabase](https://supabase.com/blog/defense-in-depth-mcp)).
|
|
225
|
+
- **Replit, July 2025**: an agent deleted a production database during a code freeze. Replit's fix was automatic dev/prod database separation ([Replit](https://replit.com/blog/introducing-a-safer-way-to-vibe-code-with-replit-databases), [CEO post](https://x.com/amasad/status/1946986468586721478)).
|
|
226
|
+
|
|
227
|
+
Least-privilege roles. Only the owner can DROP or ALTER an object; that right "cannot be granted or revoked" ([privileges](https://www.postgresql.org/docs/current/ddl-priv.html)). So app and agent roles must never own tables:
|
|
228
|
+
|
|
229
|
+
```sql
|
|
230
|
+
CREATE ROLE app_owner NOLOGIN; -- owns all objects; migrations SET ROLE app_owner
|
|
231
|
+
CREATE ROLE app_rw LOGIN PASSWORD :'app_pw'; -- runtime: DML only, no TRUNCATE
|
|
232
|
+
CREATE ROLE agent_ro LOGIN PASSWORD :'agent_pw';
|
|
233
|
+
GRANT USAGE ON SCHEMA public TO app_rw, agent_ro;
|
|
234
|
+
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO app_rw;
|
|
235
|
+
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO app_rw;
|
|
236
|
+
GRANT SELECT ON ALL TABLES IN SCHEMA public TO agent_ro;
|
|
237
|
+
ALTER DEFAULT PRIVILEGES FOR ROLE app_owner IN SCHEMA public GRANT SELECT ON TABLES TO agent_ro;
|
|
238
|
+
ALTER DEFAULT PRIVILEGES FOR ROLE app_owner IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO app_rw;
|
|
239
|
+
ALTER DEFAULT PRIVILEGES FOR ROLE app_owner IN SCHEMA public GRANT USAGE, SELECT ON SEQUENCES TO app_rw;
|
|
240
|
+
ALTER ROLE agent_ro SET default_transaction_read_only = on;
|
|
241
|
+
ALTER ROLE agent_ro SET statement_timeout = '5s';
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
On Neon, Console/API-created roles are members of `neon_superuser` and can read all data. Create agent roles with SQL or `neon roles create --access` ([Neon](https://neon.com/docs/ai/neon-mcp-server)). `pg_read_all_data` does not bypass RLS ([predefined roles](https://www.postgresql.org/docs/current/predefined-roles.html)).
|
|
245
|
+
|
|
246
|
+
Blocking dangerous operations, in layers:
|
|
247
|
+
1. **Database**: agents get a branch or throwaway DB plus a non-owner role. That alone makes `DROP`/`TRUNCATE` on prod impossible for them.
|
|
248
|
+
2. **Tooling**: Prisma refuses `migrate reset --force` when it detects an agent ([changelog](https://www.prisma.io/changelog/2025-08-27)). The agent should surface the prompt, not set the consent variable itself ([Prisma blog](https://www.prisma.io/blog/agents-md-for-databases)).
|
|
249
|
+
3. **Harness**: deny rules beat allow rules — Claude Code `"permissions": {"deny": ["Bash(npx prisma migrate reset:*)", "Bash(npx drizzle-kit push --force:*)", "Bash(dropdb:*)"]}` ([settings](https://code.claude.com/docs/en/settings)); Antigravity `Deny` rules `command(npx prisma migrate reset)`, `command(npx drizzle-kit push --force)`, `command(dropdb)` ([permissions](https://antigravity.google/docs/permissions)); omp `bash.patterns` deny entries. Prefix patterns are bypassable through wrappers (`pnpm exec`, scripts), so treat them as a seatbelt, not a gate [inference].
|
|
250
|
+
4. **CI review gate**: lint every migration (Squawk free; Atlas `migrate lint` paid). Require human approval for files containing `DROP`, `TRUNCATE`, `ALTER ... TYPE`, or `SET NOT NULL` [inference].
|
|
251
|
+
5. **AGENTS.md**: state where scratch DBs come from, which commands need a human, and that tests run against real Postgres ([Prisma blog](https://www.prisma.io/blog/agents-md-for-databases)).
|
|
252
|
+
|
|
253
|
+
## Traps for agents
|
|
254
|
+
|
|
255
|
+
- Running `drizzle-kit push --force`, `prisma db push --accept-data-loss`, or `prisma migrate reset` to "fix" drift or a migration conflict, which wipes data. Generate a migration and ask instead ([Prisma blog](https://www.prisma.io/blog/agents-md-for-databases), [drizzle push](https://orm.drizzle.team/docs/drizzle-kit-push)).
|
|
256
|
+
- Using the first connection string found in `.env`, often production or `service_role`. Agents must only see branch/scratch URLs ([Neon](https://neon.com/docs/ai/neon-mcp-server), [General Analysis](https://generalanalysis.com/blog/supabase-mcp-blog)).
|
|
257
|
+
- Treating MCP read-only mode as safe: it stops writes, not exfiltration via prompt injection ([Supabase](https://supabase.com/blog/defense-in-depth-mcp)).
|
|
258
|
+
- Mocking the data layer or swapping in SQLite for Postgres tests. The result is green tests that miss constraint, RLS, and SQL-dialect bugs ([Prisma blog](https://www.prisma.io/blog/agents-md-for-databases)).
|
|
259
|
+
- Writing `RENAME COLUMN`/`DROP COLUMN` in the same deploy as the code change, or `CREATE INDEX` without `CONCURRENTLY` on a live table ([GitLab](https://docs.gitlab.com/development/database/avoiding_downtime_in_migrations/), [CREATE INDEX](https://www.postgresql.org/docs/current/sql-createindex.html)).
|
|
260
|
+
- Enabling RLS but connecting as the table owner or a `BYPASSRLS` role, so policies silently do nothing ([RLS](https://www.postgresql.org/docs/current/ddl-rowsecurity.html)).
|
|
261
|
+
- Copying Prisma 6 snippets into Prisma 7 projects (`prisma-client-js`, `datasourceUrl`, implicit `.env`). Writing new code against Accelerate URLs that retire 2026-12-01 ([upgrade](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v7)).
|
|
262
|
+
- Recommending PlanetScale "free tier" (gone since 2024), assuming Supabase free projects stay awake (they pause after 1 week), or quoting stale limits ([PlanetScale](https://planetscale.com/blog/planetscale-forever), [Supabase](https://supabase.com/pricing)).
|
|
263
|
+
- Picking a separate vector DB, search engine, or Redis on day one, which adds sync jobs and credentials that pgvector/FTS/Postgres would have avoided [inference].
|
|
264
|
+
- Choosing a stale or archived MCP server (reference Postgres server, LiteFS-era tooling) because it ranks high in training data ([archive](https://github.com/modelcontextprotocol/servers-archived)).
|
|
265
|
+
- Editing an already-applied migration file instead of adding a new one, which causes checksum drift and divergent environments [inference].
|
|
266
|
+
- Using `gen_random_uuid()` everywhere on Postgres 18 when `uuidv7()` exists, or exposing v7 IDs that leak creation time ([UUID functions](https://www.postgresql.org/docs/18/functions-uuid.html)).
|
|
267
|
+
|
|
268
|
+
## Default for a solo dev / small team
|
|
269
|
+
|
|
270
|
+
- **Database**: Postgres 18. Hosted on Neon Free for branching, or Supabase Free if you also want auth/storage (watch the 1-week pause). Prod moves to a paid plan with PITR before real users arrive.
|
|
271
|
+
- **Repo**: `packages/db` owns the schema, migrations, seed, client, and generated types. Apps import it.
|
|
272
|
+
- **TypeScript**: Drizzle ORM + Drizzle Kit `generate`/`migrate` (or Prisma 7 if the team prefers it). **Python**: SQLAlchemy 2 + Alembic. **Go**: sqlc + goose.
|
|
273
|
+
- **Extensions before services**: pgvector for embeddings, built-in FTS for search, pg_partman for big append tables, DuckDB locally for analytics.
|
|
274
|
+
- **Tenancy**: a `tenant_id` column + RLS with `FORCE ROW LEVEL SECURITY` from the first table; move to db-per-tenant only for contractual isolation.
|
|
275
|
+
- **IDs and data**: `uuidv7()` keys, `timestamptz`, hard delete plus an archive/audit table, deterministic seeds.
|
|
276
|
+
- **Safety**: three roles (owner, app, agent_ro), branch per PR/agent, Squawk in CI, human approval for destructive SQL, harness deny rules, monthly restore test.
|
|
277
|
+
- **Tests**: Testcontainers Postgres (or PGlite for fast unit tests) with migrations applied, never mocks.
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Organizing a Monorepo (2026)
|
|
2
|
+
|
|
3
|
+
Summary (facts checked 2026-11-11):
|
|
4
|
+
- A monorepo pays off only when code is shared across deployables AND you invest in affected-only CI plus caching; without that it is slower than a polyrepo ([Vercel](https://vercel.com/i/monorepos-full-stack-teams), [Google CACM](https://cacm.acm.org/research/why-google-stores-billions-of-lines-of-code-in-a-single-repository/fulltext)).
|
|
5
|
+
- Default JS/TS stack: pnpm workspaces + catalogs, `apps/` + `packages/`, Turborepo for task caching, Changesets only if you publish. Python: uv workspaces. Go: one `go.mod`. Rust: Cargo workspace. Polyglot at scale: Bazel 9 (Bzlmod only), Pants, or moon.
|
|
6
|
+
- Enforce package boundaries with a tool (Nx module boundaries, `turbo boundaries`, dependency-cruiser, sheriff, import-linter); agents do not respect conventions that are not checked.
|
|
7
|
+
- Agent context: one root `AGENTS.md` plus short per-package files. Harnesses load nested files differently (Codex and Antigravity: root/ancestors to cwd only, ignoring subfolders below cwd; Claude Code: subdirectories on demand; omp: ancestors plus pointers), so put package commands where the agent will actually start.
|
|
8
|
+
- Remote cache security is real: Nx deprecated its bucket cache plugins over cache poisoning (CVE-2025-36852); never let untrusted PR builds write to the cache `main` reads.
|
|
9
|
+
|
|
10
|
+
## 1. Monorepo or polyrepo
|
|
11
|
+
|
|
12
|
+
Primary write-ups:
|
|
13
|
+
- Google: benefits are unified versioning, code sharing, atomic changes, large-scale refactoring, visibility; costs are tooling investment, codebase complexity "including unnecessary dependencies and difficulties with code discovery", and code-health effort ([CACM 2016](https://cacm.acm.org/research/why-google-stores-billions-of-lines-of-code-in-a-single-repository/fulltext)). "A monolithic codebase in no way implies monolithic software design" (same source).
|
|
14
|
+
- Meta: one large monorepo on Sapling, built to serve tens of millions of files and commits ([Meta Engineering 2022](https://engineering.fb.com/2022/11/15/developer-tools/sapling-source-control-scalable)); branching inside it solved with full-repo and directory branching ([Meta 2025](https://engineering.fb.com/2025/10/16/developer-tools/branching-in-a-sapling-monorepo)).
|
|
15
|
+
- Uber: moved Go services from many small repos into a Go monorepo in 2018 with Bazel + Gazelle, affected-target hashing, and SubmitQueue to keep main green ([Uber Blog](https://www.uber.com/blog/go-monorepo-bazel/)).
|
|
16
|
+
- Shopify: in 2024 chose "one repository for all things Shopify ships" (World) plus Nix; CI had to scale "by an order of magnitude", merge queues "became load-bearing", the build cache "became a product"; payoff was an agent at repo root that can navigate cross-zone, with `AGENTS.md` files and skills in the repo ([Shopify Engineering 2026](https://shopify.engineering/under-the-river)).
|
|
17
|
+
- Vercel: a monorepo without incremental builds and shared cache "is strictly worse than a polyrepo"; polyglot stacks and single-app repos are signals against ([Vercel 2026](https://vercel.com/i/monorepos-full-stack-teams)).
|
|
18
|
+
- AWS CDK: start with one app per repo; move shared packages to their own repo when they serve several apps on independent cadences or different teams need access control ([AWS CDK best practices](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html)).
|
|
19
|
+
|
|
20
|
+
| Situation | Pick | Why | Source |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| One deployable, no shared code | Single-package repo (no workspace tooling) | No coordination cost to remove | [Vercel](https://vercel.com/i/monorepos-full-stack-teams) |
|
|
23
|
+
| Web + API + shared types/UI, 1-15 devs, TS | Monorepo: pnpm workspaces + Turborepo | Atomic cross-package changes; cheap setup; free remote cache | [Turborepo](https://turborepo.dev/docs/crafting-your-repository/structuring-a-repository) |
|
|
24
|
+
| TS frontend + Python or Go backend, small team | Monorepo, each language uses its native workspace; one task runner on top (Turborepo experimental uv/Go, or moon) | Shared API contracts change atomically; native tools stay the source of truth | [Turborepo Python](https://turborepo.dev/docs/guides/tools/python), [moon](https://moonrepo.dev/docs/setup-toolchain) |
|
|
25
|
+
| Many languages, 50+ engineers, hermetic builds needed | Bazel 9 (or Pants for Python/Go/JVM) | Fine-grained, cached, remote-executable graph | [Bazel 9](https://blog.bazel.build/2026/01/20/bazel-9.html), [Pants](https://www.pantsbuild.org/stable/docs/introduction/welcome-to-pants) |
|
|
26
|
+
| Library consumed by external users on its own cadence | Separate repo or publishable package with Changesets | Independent lifecycle and versioning | [AWS CDK](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html), [Changesets](https://github.com/changesets/changesets) |
|
|
27
|
+
| Different orgs/teams need hard access control | Separate repos | Repo is the unit of access control on most hosts | [AWS CDK](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html) |
|
|
28
|
+
|
|
29
|
+
## 2. Layout conventions
|
|
30
|
+
|
|
31
|
+
Turborepo recommends "splitting your packages into `apps/` for applications and services and `packages/` for everything else, like libraries and tooling"; it does not support nested packages (`apps/a` and `apps/a/b`), but you can group with `packages/group/*` if `packages/group` has no `package.json` ([Turborepo structure](https://turborepo.dev/docs/crafting-your-repository/structuring-a-repository)). Nx uses the same `apps`/`libs`-style split with tags ([Nx project dependency rules](https://nx.dev/docs/concepts/decisions/project-dependency-rules)).
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
repo/
|
|
35
|
+
AGENTS.md # repo-wide rules, commands, map of packages (keep short)
|
|
36
|
+
CLAUDE.md # optional: "@AGENTS.md" + Claude-only notes (no symlink on Windows)
|
|
37
|
+
.github/CODEOWNERS # ownership; owner for CODEOWNERS itself
|
|
38
|
+
.github/workflows/ # CI: affected-only, merge_group trigger
|
|
39
|
+
apps/
|
|
40
|
+
web/ # deployable; own package.json, AGENTS.md, tests
|
|
41
|
+
api/ # deployable; owns its DB migrations if it is the only writer
|
|
42
|
+
packages/
|
|
43
|
+
ui/ # internal package, @repo/ui, just-in-time TS
|
|
44
|
+
domain/ # shared types, schemas (zod/pydantic), no I/O
|
|
45
|
+
db/ # only if several apps share one database: schema + migrations + client
|
|
46
|
+
typescript-config/ # @repo/typescript-config: base.json, nextjs.json, library.json
|
|
47
|
+
eslint-config/ # or a root biome.json with nested "extends": "//"
|
|
48
|
+
tools/ # generators, codemods, repo scripts (not shipped)
|
|
49
|
+
infra/ # IaC shared across apps (network, DNS, accounts); per-app infra lives with the app
|
|
50
|
+
docs/adr/0001-record-architecture-decisions.md
|
|
51
|
+
package.json pnpm-workspace.yaml turbo.json pnpm-lock.yaml
|
|
52
|
+
pyproject.toml uv.lock # uv workspace root if Python members exist
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Rules:
|
|
56
|
+
- Name internal packages under one scope (`@repo/*` in Turborepo examples) and depend on them with `workspace:*` ([Turborepo internal packages](https://turborepo.dev/docs/core-concepts/internal-packages)).
|
|
57
|
+
- Shared config is a package, not a root file every package reaches into: `@repo/typescript-config` with `base.json` extended by each `tsconfig.json` ([Turborepo TypeScript](https://turborepo.dev/docs/guides/tools/typescript)). Biome v2 supports a root `biome.json` with nested configs using `"extends": "//"` ([Biome big projects](https://biomejs.dev/guides/big-projects/)).
|
|
58
|
+
- DB schema and migrations: exactly one package owns each database's migrations. Shared DB: a `packages/database` package (`@repo/db`) owns schema, migrations directory, and client, and apps import it ([Prisma + Turborepo guide](https://www.prisma.io/docs/guides/deployment/turborepo)). Single-writer DB: keep migrations inside that app [inference].
|
|
59
|
+
- IaC: keep app-specific infrastructure next to the runtime code it deploys; AWS calls combining them "a best practice" ([AWS CDK](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html)). Shared foundation (network, DNS, org accounts) goes in `infra/` with its own pipeline [inference].
|
|
60
|
+
- ADRs: Nygard's original convention is in-repo, numbered sequentially, never reused, superseded rather than deleted ([Nygard 2011](https://www.cognitect.com/blog/2011/11/15/documenting-architecture-decisions)). Use `docs/adr/`; package-local decisions may live in `<pkg>/docs/adr/` [inference].
|
|
61
|
+
- `tools/` vs `scripts/`: pick one name; nothing in it is imported by `apps/` [inference].
|
|
62
|
+
- CODEOWNERS: last matching pattern wins; any one listed owner's approval satisfies the requirement; give `/.github/CODEOWNERS` itself an owner ([GitHub CODEOWNERS](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners)).
|
|
63
|
+
|
|
64
|
+
### Internal package strategies (TS)
|
|
65
|
+
|
|
66
|
+
| Strategy | When | Trade-off | Source |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| Just-in-time (export `.ts` from `exports`, no build) | Consumers use a bundler or TS-native runtime; small repo | No build cache for the package; cannot use TS `paths`; dependents see its type errors | [Turborepo](https://turborepo.dev/docs/core-concepts/internal-packages) |
|
|
69
|
+
| Compiled (`tsc` to `dist/`, `types` points at source) | Consumed by Node without bundler, or build time matters | More config; cacheable outputs | [Turborepo](https://turborepo.dev/docs/core-concepts/internal-packages) |
|
|
70
|
+
| Publishable | Ships to npm | Most config; use Changesets | [Turborepo](https://turborepo.dev/docs/core-concepts/internal-packages) |
|
|
71
|
+
|
|
72
|
+
Use Node subpath imports (`"imports": {"#*": "./src/*"}`) instead of `compilerOptions.paths` inside packages ([Turborepo TypeScript](https://turborepo.dev/docs/guides/tools/typescript)).
|
|
73
|
+
TypeScript project references: Turborepo says "You likely don't need" them (extra config and caching layer) ([Turborepo TypeScript](https://turborepo.dev/docs/guides/tools/typescript)); Nx recommends workspaces + project references and auto-syncs them with `nx sync` ([Nx TS project linking](https://nx.dev/docs/concepts/typescript-project-linking)). Pick per tool, not both philosophies.
|
|
74
|
+
TypeScript 7.0 (Go port, released 2026-07) keeps `--build` and adds `--builders` for parallel project builds ([TS 7.0](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/)).
|
|
75
|
+
|
|
76
|
+
## 3. Enforced boundaries
|
|
77
|
+
|
|
78
|
+
| Tool | What | License / terms | Latest release | Agent notes | Source |
|
|
79
|
+
|---|---|---|---|---|---|
|
|
80
|
+
| Nx `@nx/enforce-module-boundaries` | ESLint rule: tag projects (`scope:*`, `type:*`), `depConstraints` allow lists | MIT | Nx 24.0.6, 2026-11-10 | Strongest TS option; needs Nx project graph | [Nx](https://nx.dev/docs/features/enforce-module-boundaries) |
|
|
81
|
+
| `turbo boundaries` | Flags imports outside package dir and undeclared deps; tag allow/deny rules, transitive | MIT; experimental | turbo 2.11.11, 2026-11-11 | Run in CI; catches `../../packages/x/src` imports | [Turborepo](https://turborepo.dev/docs/reference/boundaries) |
|
|
82
|
+
| dependency-cruiser | Rule-based `forbidden` graph checks, cycles, orphans, missing deps | MIT | v18.7.2, 2026-11-02 | Tool-agnostic; `depcruise --init` writes sane defaults | [README](https://github.com/sverweij/dependency-cruiser) |
|
|
83
|
+
| Sheriff | TS module boundaries via `index.ts` public APIs + tag rules | MIT | v0.20.0, 2026-10-07 (pre-1.0) | Good inside one large app package | [README](https://github.com/softarc-consulting/sheriff) |
|
|
84
|
+
| import-linter | Python contracts: forbidden, protected, layers, independence, acyclic siblings | BSD-2-Clause | v2.16, 2026-11-06 | Required for uv workspaces: uv "can't ensure that packages don't import dependencies declared by another workspace member" | [docs](https://import-linter.readthedocs.io/en/stable/), [uv](https://docs.astral.sh/uv/concepts/projects/workspaces/) |
|
|
85
|
+
| Go `internal/` | Compiler-enforced package privacy | BSD-3 (Go) | Go 1.27.4 | Free boundary; use it before inventing modules | [Go modules wiki](https://go.dev/wiki/Modules) |
|
|
86
|
+
|
|
87
|
+
Nx example:
|
|
88
|
+
```js
|
|
89
|
+
'@nx/enforce-module-boundaries': ['error', { depConstraints: [
|
|
90
|
+
{ sourceTag: 'type:app', onlyDependOnLibsWithTags: ['type:feature', 'type:ui', 'type:domain'] },
|
|
91
|
+
{ sourceTag: 'type:domain', onlyDependOnLibsWithTags: ['type:domain'] } ] }]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 4. JS/TS tooling
|
|
95
|
+
|
|
96
|
+
| Tool | What | License / free terms | Latest release | Agent notes | Source |
|
|
97
|
+
|---|---|---|---|---|---|
|
|
98
|
+
| pnpm workspaces + catalogs | Strict node_modules; `workspace:` protocol; `catalog:` pins one version in `pnpm-workspace.yaml` | MIT | v12.18.0, 2026-11-05 | Use `catalogMode: strict` to stop agents adding stray versions; `catalog:` is rewritten on publish | [pnpm catalogs](https://pnpm.io/catalogs) |
|
|
99
|
+
| npm / Yarn 4 / Bun workspaces | `workspaces` globs in root package.json | npm Artistic-2.0; Yarn BSD-2; Bun MIT | Yarn 4.18.1 2026-09-24; Bun 1.4.4 2026-10-22 | Fine for small repos; pnpm catches phantom deps better [inference] | [Turborepo structure](https://turborepo.dev/docs/crafting-your-repository/structuring-a-repository) |
|
|
100
|
+
| Turborepo | Task graph, local + remote cache, `--affected`, `boundaries`, `prune` for Docker | MIT. Vercel Remote Cache "free to use on all plans"; self-host via OpenAPI spec | 2.11.11, 2026-11-11 | Experimental uv, Go, Cargo support; can keep a managed block in root `AGENTS.md`; shares local cache across worktrees | [Remote caching](https://turborepo.dev/docs/core-concepts/remote-caching), [AI guide](https://turborepo.dev/docs/guides/ai) |
|
|
101
|
+
| Nx | Project graph, affected, generators, module boundaries, `nx sync` for TS refs | MIT core. Nx Cloud: Hobby free (50K credits/mo), Team from $29/mo (paid) | 24.0.6, 2026-11-10 | Bucket cache plugins `@nx/s3-cache` etc. deprecated 2026-05-21; `nx configure-ai-agents` writes AGENTS.md/skills | [Nx pricing](https://nx.dev/pricing), [deprecation](https://nx.dev/docs/reference/deprecated/self-hosted-cache-packages), [AI setup](https://nx.dev/docs/getting-started/ai-setup) |
|
|
102
|
+
| moon | Rust task runner, polyglot toolchains (Node, Bun, Deno, Go, Python, Rust, PHP, Ruby) via proto | MIT | v2.6.5, 2026-10-29 (v2.0 Feb 2026; v1 docs frozen) | Good polyglot middle ground; v1 configs in training data are stale | [moon v2](https://moonrepo.dev/blog/moon-v2.0), [toolchains](https://moonrepo.dev/docs/setup-toolchain) |
|
|
103
|
+
| Rush | Microsoft's large-repo manager (pnpm-based, publishing, policies) | MIT | 5.182.1, 2026-10-30 | Heavy; pick only for many published packages and strict policies [inference] | [npm @microsoft/rush](https://www.npmjs.com/package/@microsoft/rush) |
|
|
104
|
+
| Lerna | Versioning/publishing; task running delegates to Nx | MIT; Nx took over stewardship in 2022 | v10.1.2, 2026-11-06 | Maintained, not dead; new repos usually use Changesets or `nx release` | [Lerna and Nx](https://lerna.js.org/docs/lerna-and-nx) |
|
|
105
|
+
| Changesets | Per-PR intent files, then `changeset version` / `publish` | MIT | @changesets/cli 3.0.3, 2026-09-14 | Only needed if you publish or version packages | [Changesets](https://github.com/changesets/changesets) |
|
|
106
|
+
|
|
107
|
+
Root `package.json` scripts delegate to the runner (`"build": "turbo run build"`), and each package defines its own `build`, `lint`, `test`, `check-types` ([Turborepo structure](https://turborepo.dev/docs/crafting-your-repository/structuring-a-repository)).
|
|
108
|
+
|
|
109
|
+
## 5. Python, Go, Rust, polyglot
|
|
110
|
+
|
|
111
|
+
| Ecosystem | Pick | Key facts | Latest | Source |
|
|
112
|
+
|---|---|---|---|---|
|
|
113
|
+
| Python | uv workspace | One `uv.lock` for all members; `uv run --package <m>`; member deps via `{ workspace = true }`; one `requires-python` (intersection); not for members with conflicting requirements, use path deps instead | uv 0.13.7, 2026-11-03 (Apache-2.0/MIT) | [uv workspaces](https://docs.astral.sh/uv/concepts/projects/workspaces/) |
|
|
114
|
+
| Python (legacy) | Poetry only per-project | No native workspaces; monorepo issue #936 closed "not planned"; plugins exist | Poetry 2.5.1, 2026-09-20 | [issue #936](https://github.com/python-poetry/poetry/issues/936) |
|
|
115
|
+
| Python at scale | Pants | Dependency inference by static analysis, fine-grained invalidation, remote cache; Python, Go, Java, Scala, Kotlin, Shell, Docker | 2.32.2, 2026-11-01 (Apache-2.0) | [Pants](https://www.pantsbuild.org/stable/docs/introduction/welcome-to-pants) |
|
|
116
|
+
| Go | One `go.mod` at the Go root | Multi-module repos take "more work on an on-going basis"; `go.work` for local multi-module dev, and committing it is "generally inadvisable" | Go 1.27.4 | [Go wiki](https://go.dev/wiki/Modules), [go.dev/ref/mod](https://go.dev/ref/mod) |
|
|
117
|
+
| Rust | Cargo workspace | Shared `Cargo.lock`; `[workspace.dependencies]` for inherited versions; virtual manifests must set `resolver` | stable toolchain | [Cargo workspaces](https://doc.rust-lang.org/cargo/reference/workspaces.html) |
|
|
118
|
+
| Polyglot, large | Bazel 9 | 9.0 (Jan 2026) removed WORKSPACE entirely; Bzlmod `MODULE.bazel` only; language rules now external (e.g. `rules_cc`) | 9.3.2, 2026-11-05 (Apache-2.0) | [Bazel 9 LTS](https://blog.bazel.build/2026/01/20/bazel-9.html) |
|
|
119
|
+
| Polyglot, Meta-style | Buck2 | No stable release tag; bi-monthly date tags (latest 2026-11-01) | Apache-2.0 | [Buck2 README](https://github.com/facebook/buck2) |
|
|
120
|
+
|
|
121
|
+
## 6. CI for monorepos
|
|
122
|
+
|
|
123
|
+
| Need | Do | Source |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| Run only what changed | `turbo run build lint test --affected` (defaults to `main...HEAD`; override with `TURBO_SCM_BASE`) or `nx affected -t lint test build` with `nrwl/nx-set-shas` | [turbo run](https://turborepo.dev/docs/reference/run), [Nx affected](https://nx.dev/docs/features/ci-features/affected) |
|
|
126
|
+
| Git history for affected | `actions/checkout` with `fetch-depth: 0` and `filter: blob:none` (blobless, full history) | [Turborepo](https://turborepo.dev/docs/reference/run), [actions/checkout](https://github.com/actions/checkout) |
|
|
127
|
+
| Path-based workflow triggers | Do not mark path-filtered workflows as required: skipped workflows stay "Pending" and block merge. Use job-level conditions (skipped jobs report Success) or an always-run gate job with `needs` + `always()` | [GitHub required checks](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks) |
|
|
128
|
+
| Job-level change detection | `dorny/paths-filter` (MIT, v4.0.3 2026-08-05) outputs per-path booleans for `if:` | [paths-filter](https://github.com/dorny/paths-filter) |
|
|
129
|
+
| Busy main branch | GitHub merge queue; workflows must also trigger `on: merge_group` or checks never report | [Merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue) |
|
|
130
|
+
| Remote cache safety | Signed artifacts (`remoteCache.signature: true` + `TURBO_REMOTE_CACHE_SIGNATURE_KEY`); a custom Nx cache server must return 409 on existing keys; give PR builds read-only cache tokens [inference for Turborepo] | [Turborepo](https://turborepo.dev/docs/core-concepts/remote-caching), [Nx CREEP notice](https://nx.dev/docs/reference/deprecated/self-hosted-cache-packages) |
|
|
131
|
+
| Docker images per app | `turbo prune <app> --docker` produces a pruned workspace for the image build | [turbo prune](https://turborepo.dev/docs/reference/prune) |
|
|
132
|
+
|
|
133
|
+
Big-repo git (only when clone/status is slow): `git sparse-checkout set <dirs>` with cone mode and sparse index ([GitHub blog](https://github.blog/open-source/git/make-your-monorepo-feel-small-with-gits-sparse-index)); partial clone `--filter=blob:none` ([git partial clone](https://git-scm.com/docs/partial-clone)); `scalar clone` (in Git since 2.38) turns on sparse-checkout, background maintenance, commit-graph, multi-pack-index ([git scalar](https://git-scm.com/docs/scalar), [Story of Scalar](https://github.blog/open-source/git/the-story-of-scalar/)). The standalone `microsoft/scalar` repo's last release is 2021; use the Git-bundled one.
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
on: { pull_request: {}, merge_group: {} }
|
|
137
|
+
jobs:
|
|
138
|
+
ci:
|
|
139
|
+
runs-on: ubuntu-latest
|
|
140
|
+
steps:
|
|
141
|
+
- uses: actions/checkout@<commit-sha> # pin full SHA (v7.0.1 as of 2026-11)
|
|
142
|
+
with: { fetch-depth: 0, filter: blob:none }
|
|
143
|
+
- uses: pnpm/action-setup@<commit-sha> # pin full SHA (v6.1.1 as of 2026-11)
|
|
144
|
+
- run: pnpm install --frozen-lockfile
|
|
145
|
+
- run: pnpm turbo run lint check-types test build --affected
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 7. Agent-friendliness
|
|
149
|
+
|
|
150
|
+
How harnesses discover nested instruction files:
|
|
151
|
+
|
|
152
|
+
| Harness | Loads at start | Below cwd | Gotchas | Source |
|
|
153
|
+
|---|---|---|---|---|
|
|
154
|
+
| AGENTS.md convention | Root file; nested per package | "The closest AGENTS.md to the edited file wins" | Behavior is per harness, not guaranteed | [agents.md](https://agents.md/) |
|
|
155
|
+
| Codex | Global `~/.codex/AGENTS.md`, then project root down to cwd; per dir `AGENTS.override.md` > `AGENTS.md` > fallbacks; concatenated root first | Not loaded: Codex "stops searching once it reaches your current directory" | 32 KiB combined cap (`project_doc_max_bytes`); start Codex in the package dir for package rules | [Codex AGENTS.md](https://developers.openai.com/codex/guides/agents-md) |
|
|
156
|
+
| Claude Code | `CLAUDE.md`/`CLAUDE.local.md` in cwd and every ancestor | Subdirectory `CLAUDE.md` loads when Claude reads/edits a file there | Reads `AGENTS.md` (v2.1.277+) only if no `CLAUDE.md`/`CLAUDE.local.md` on the path; target under 200 lines; on Windows use `@AGENTS.md` import, not a symlink | [Claude memory](https://code.claude.com/docs/en/memory), [large codebases](https://code.claude.com/docs/en/large-codebases) |
|
|
157
|
+
| omp | Standalone `AGENTS.md`/`CLAUDE.md` from cwd up to repo root, one per depth, all depths kept, closer files last | With workspace tree on, deeper `AGENTS.md` files are listed as pointers in `<dir-context>`, not injected | Task subagents drop files named `AGENTS.md`; put must-follow rules in `.omp/RULES.md` | [omp context files](https://github.com/can1357/oh-my-pi/blob/main/docs/context-files.md) |
|
|
158
|
+
| Antigravity (`agy`/App/IDE) | `AGENTS.md` and `GEMINI.md` in cwd and parents up to repo root, plus `~/.gemini/AGENTS.md` and `~/.gemini/GEMINI.md` | Subfolders below cwd are not scanned | Every matching rule loads; start in the package dir or read nested `AGENTS.md` explicitly | [customization-discovery](https://antigravity.google/docs/customization-discovery) |
|
|
159
|
+
|
|
160
|
+
Rules:
|
|
161
|
+
- Root `AGENTS.md`: what the repo is, package map (one line per package), the exact commands (`pnpm turbo run test --filter=<pkg>`), boundaries rules, where ADRs/migrations/infra live. Keep it under ~200 lines ([Claude memory](https://code.claude.com/docs/en/memory)).
|
|
162
|
+
- Package `AGENTS.md`: stack, local commands runnable from the package dir, invariants ("never edit a merged migration"). Claude's own monorepo example uses exactly this split ([Claude large codebases](https://code.claude.com/docs/en/large-codebases)).
|
|
163
|
+
- Make every package testable in isolation: own `test`, `lint`, `check-types` scripts; `turbo run test --filter=<pkg>` or `uv run --package <m> pytest` works without building unrelated apps.
|
|
164
|
+
- One instruction file per directory for all tools: `AGENTS.md`, with `CLAUDE.md` containing `@AGENTS.md` only where Claude-specific notes exist ([Claude memory](https://code.claude.com/docs/en/memory)).
|
|
165
|
+
- Codebase maps: prefer the tool's graph over prose. `turbo ls` / `turbo query` ([Turborepo reference](https://turborepo.dev/llms.txt)), `nx show projects` / `nx graph` ([Nx AI](https://nx.dev/docs/features/enhance-ai)), Aider-style repo maps rank files by dependency graph to fit a token budget ([Aider repo map](https://aider.chat/docs/repomap.html)). Keep the package map in root `AGENTS.md` to one line each so it does not rot.
|
|
166
|
+
- Parallel agents: one git worktree per agent. Claude Code `--worktree` creates `.claude/worktrees/<name>`; copy gitignored `.env` via `.worktreeinclude`; `worktree.sparsePaths` checks out only listed packages; `symlinkDirectories: ["node_modules"]` avoids reinstalling ([Claude worktrees](https://code.claude.com/docs/en/worktrees), [large codebases](https://code.claude.com/docs/en/large-codebases)). Codex app worktrees also honor `.worktreeinclude` and keep the latest 15 by default ([Codex worktrees](https://developers.openai.com/codex/app/worktrees)). Turborepo shares the local cache across worktrees ([Turborepo AI](https://turborepo.dev/docs/guides/ai)).
|
|
167
|
+
- Each worktree is a fresh checkout: run install there, and give each dev server its own port [inference].
|
|
168
|
+
|
|
169
|
+
## 8. Decision table: situation -> layout/tool
|
|
170
|
+
|
|
171
|
+
| Situation | Layout | Tooling | Why | Source |
|
|
172
|
+
|---|---|---|---|---|
|
|
173
|
+
| Solo dev, Next.js + API in TS | `apps/web`, `apps/api`, `packages/{ui,domain,typescript-config}` | pnpm + catalogs, Turborepo, JIT packages | Lowest config, free Vercel remote cache | [Turborepo](https://turborepo.dev/docs/core-concepts/internal-packages) |
|
|
174
|
+
| TS web + Python API | `apps/web`, `apps/api` (Python), root `pyproject.toml` uv workspace | pnpm + uv; Turborepo `experimentalPythonWorkspaces` or plain package scripts | Native lockfiles stay authoritative; Turborepo uv support is experimental | [Turborepo Python](https://turborepo.dev/docs/guides/tools/python) |
|
|
175
|
+
| Go services + TS frontend | `services/*` under one `go.mod`, `apps/web` | Go toolchain + Turborepo (Go experimental) or moon | Single Go module avoids multi-module versioning | [Go wiki](https://go.dev/wiki/Modules), [moon](https://moonrepo.dev/docs/setup-toolchain) |
|
|
176
|
+
| Angular or many TS libs, want generators and strict boundaries | `apps/`, `libs/` with `scope:`/`type:` tags | Nx (+ Nx Cloud Hobby if desired) | Module-boundary rule, `nx sync` | [Nx](https://nx.dev/docs/features/enforce-module-boundaries) |
|
|
177
|
+
| Publishing several npm packages | `packages/*` publishable | pnpm + Changesets (or `nx release`) | Versioning per PR intent | [Changesets](https://github.com/changesets/changesets) |
|
|
178
|
+
| Python-only, several services sharing libs | `apps/*`, `libs/*` uv workspace | uv + import-linter (+ Pants when CI is slow) | uv cannot enforce member imports | [uv](https://docs.astral.sh/uv/concepts/projects/workspaces/) |
|
|
179
|
+
| Hermetic multi-language at org scale | `//services`, `//libs`, BUILD files | Bazel 9 + remote cache/exec | Only Bzlmod supported now | [Bazel 9](https://blog.bazel.build/2026/01/20/bazel-9.html) |
|
|
180
|
+
|
|
181
|
+
## Traps for agents
|
|
182
|
+
|
|
183
|
+
- Assuming a nested `AGENTS.md` is in context. Codex and Antigravity never load files below cwd; Claude loads them only after touching a file there; omp lists them as pointers. Read the package `AGENTS.md` before editing a package ([Codex](https://developers.openai.com/codex/guides/agents-md), [Claude](https://code.claude.com/docs/en/memory), [omp](https://github.com/can1357/oh-my-pi/blob/main/docs/context-files.md), [Antigravity](https://antigravity.google/docs/customization-discovery)).
|
|
184
|
+
- Adding a `CLAUDE.md` or `CLAUDE.local.md` next to an `AGENTS.md`: Claude Code then stops reading `AGENTS.md` by default ([Claude memory](https://code.claude.com/docs/en/memory)).
|
|
185
|
+
- Symlinking `CLAUDE.md` to `AGENTS.md` in a repo cloned on Windows: Git checks it out as a one-line text file unless `core.symlinks` is on ([Claude memory](https://code.claude.com/docs/en/memory)).
|
|
186
|
+
- Linking packages with TS `paths` or relative `../../packages/x/src` imports instead of `workspace:*` deps; JIT packages break and `turbo boundaries` flags it ([Turborepo TS](https://turborepo.dev/docs/guides/tools/typescript), [boundaries](https://turborepo.dev/docs/reference/boundaries)).
|
|
187
|
+
- Importing a dependency a package does not declare (hoisting hides it); in uv workspaces nothing stops it, so add import-linter ([uv](https://docs.astral.sh/uv/concepts/projects/workspaces/)).
|
|
188
|
+
- Installing a dependency at the root or with a different version per package instead of the catalog ([pnpm catalogs](https://pnpm.io/catalogs)).
|
|
189
|
+
- Mixing philosophies: adding TS project references to a Turborepo repo that its docs advise against, or hand-editing references Nx syncs ([Turborepo TS](https://turborepo.dev/docs/guides/tools/typescript), [Nx](https://nx.dev/docs/concepts/typescript-project-linking)).
|
|
190
|
+
- Nesting packages (`apps/a/b`) under Turborepo: unsupported ([Turborepo structure](https://turborepo.dev/docs/crafting-your-repository/structuring-a-repository)).
|
|
191
|
+
- Requiring a path-filtered workflow in branch protection; or enabling a merge queue without `merge_group` ([GitHub checks](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks), [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue)).
|
|
192
|
+
- `fetch-depth: 1` (the checkout default) with `--affected` or `nx affected`: no base to diff ([Nx affected](https://nx.dev/docs/features/ci-features/affected)).
|
|
193
|
+
- Suggesting stale tooling from training data: Nx `tasksRunnerOptions` or `@nx/s3-cache` (deprecated, CVE-2025-36852), Bazel `WORKSPACE` (removed in 9.0), moon v1 configs, standalone `microsoft/scalar` ([Nx](https://nx.dev/docs/reference/deprecated/self-hosted-cache-packages), [Bazel](https://blog.bazel.build/2026/01/20/bazel-9.html)).
|
|
194
|
+
- Declaring Lerna dead and migrating away for no reason; it is maintained by the Nx team ([Lerna](https://lerna.js.org/docs/lerna-and-nx)).
|
|
195
|
+
- Committing `go.work` ([go.dev/ref/mod](https://go.dev/ref/mod)); creating a `go.mod` per service by default ([Go wiki](https://go.dev/wiki/Modules)).
|
|
196
|
+
- Creating a package per idea. Google names "unnecessary dependencies" as a core monorepo cost; split when there is a second consumer or a separate deploy [inference from [CACM](https://cacm.acm.org/research/why-google-stores-billions-of-lines-of-code-in-a-single-repository/fulltext)].
|
|
197
|
+
- Two packages writing migrations for the same database; migrations must have one owner ([Prisma guide](https://www.prisma.io/docs/guides/deployment/turborepo)).
|
|
198
|
+
- Running parallel agents in one checkout instead of worktrees; or forgetting install and `.env` in a new worktree ([Claude worktrees](https://code.claude.com/docs/en/worktrees)).
|
|
199
|
+
- Running root-wide `build`/`test` to verify a one-package change; use `--filter=<pkg>` or `--affected` [inference].
|
|
200
|
+
|
|
201
|
+
## Default for a solo dev / small team
|
|
202
|
+
|
|
203
|
+
1. One repo. pnpm workspaces with `catalog:` (`catalogMode: strict`), `apps/*` + `packages/*`, scope `@repo/*`, internal packages just-in-time until build time hurts ([pnpm](https://pnpm.io/catalogs), [Turborepo](https://turborepo.dev/docs/core-concepts/internal-packages)).
|
|
204
|
+
2. Turborepo for `build`/`lint`/`check-types`/`test`; Vercel Remote Cache (free) or none; turn on `remoteCache.signature` if remote cache is used ([Turborepo](https://turborepo.dev/docs/core-concepts/remote-caching)).
|
|
205
|
+
3. Python members in a root uv workspace; Go in one module; Rust in one Cargo workspace. Do not adopt Bazel/Pants until CI time is the bottleneck ([uv](https://docs.astral.sh/uv/concepts/projects/workspaces/), [Go](https://go.dev/wiki/Modules)).
|
|
206
|
+
4. Boundaries in CI from day one: `turbo boundaries` (or dependency-cruiser) for TS, import-linter for Python, `internal/` for Go.
|
|
207
|
+
5. Shared config packages (`@repo/typescript-config`, root `biome.json` + nested `"extends": "//"`); DB schema and migrations in exactly one package; app infra next to the app, shared infra in `infra/`; ADRs in `docs/adr/`.
|
|
208
|
+
6. CI: `--affected` with `fetch-depth: 0` + `filter: blob:none`, one always-run required gate job, `merge_group` trigger once a merge queue is on.
|
|
209
|
+
7. Root `AGENTS.md` under ~200 lines with package map and commands; a short `AGENTS.md` per app; `CLAUDE.md` = `@AGENTS.md` only if needed; `.worktreeinclude` for `.env`; one worktree per parallel agent.
|
|
210
|
+
8. Add Changesets only when something is published; add CODEOWNERS when a second person owns a package.
|