Non-blocking items from the #575 dual-engine review: - CONSTITUTION.md: state explicitly there is NO CONSTITUTION.local.md and hard gates are not locally overridable (clarity vs LAYER-MODEL overlay-eligibility) - verify-sanitized.sh: expand identity scan to *.yml/*.yaml/*.toml/*.env/*.service (operator data could hide in shipped configs) — gate green, no new hits - AGENTS.md: clarify the intentional bare-launch stop-if-missing strictness vs the launcher's readOptional tolerance (which keeps pre-upgrade hosts working) Refs #542, closes #576 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5.7 KiB
Executable File
Mosaic Agent Dispatcher
Thin load-order dispatcher + guide router. The non-negotiable law lives in
~/.config/mosaic/CONSTITUTION.md (L0) — this file does NOT restate gates. Framework-owned;
overwritten on upgrade. (Layer model: constitution/LAYER-MODEL.md.)
Session Start — Load Order
- Your context already includes
CONSTITUTION.md+USER.md+ the TOOLS index + the runtime contract (injected bymosaiclaunch) — do not re-read those. If you were launched bare (a harness started withoutmosaic, so the law is NOT in your context), read~/.config/mosaic/CONSTITUTION.mdnow, before your first action. - Read
SOUL.md(agent persona — small, once). - Read project-local
AGENTS.md/CLAUDE.mdif present (these may only make behavior stricter). - Read guides ONLY as triggered by the table below — pull role-relevant depth on demand, not up front.
- For implementation work, read
guides/E2E-DELIVERY.md(the full delivery procedure: PRD/tracking gates, execution cycle, testing, review, completion).STANDARDS.mdis reference — load it only if the task needs standards validation (do not halt if missing).
Conditional Guide Loading (load only what the task needs)
| Task | Guide |
|---|---|
| Project bootstrap | guides/BOOTSTRAP.md |
| PRD creation / requirements | guides/PRD.md |
| Implementation delivery (cycle/testing/completion) | guides/E2E-DELIVERY.md |
| Orchestration flow | guides/ORCHESTRATOR.md |
| Mission lifecycle / multi-session orchestration | guides/ORCHESTRATOR-PROTOCOL.md |
| Orchestrator estimation heuristics | guides/ORCHESTRATOR-LEARNINGS.md |
| Frontend changes | guides/FRONTEND.md |
| Backend/API changes | guides/BACKEND.md |
| Auth/authorization | guides/AUTHENTICATION.md |
| CI/CD changes | guides/CI-CD-PIPELINES.md |
| Infrastructure/DevOps/deployment | guides/INFRASTRUCTURE.md |
| Code review work | guides/CODE-REVIEW.md |
| TypeScript strict typing | guides/TYPESCRIPT.md |
| QA / test strategy | guides/QA-TESTING.md |
| Documentation (any code/API/auth/infra change) | guides/DOCUMENTATION.md |
| Secrets / vault usage | guides/VAULT-SECRETS.md |
| Tool/credential reference (service CLIs, wrappers) | guides/TOOLS-REFERENCE.md |
| Memory protocol (OpenBrain capture/recall) | guides/MEMORY.md |
Subagent Model Selection (Cost — Hard Rule)
Select the cheapest model capable of the task; do NOT default to the most expensive (omitting the tier defaults to the parent — usually opus — and wastes budget).
- haiku — search/grep/glob, codebase exploration, status/health checks, one-line mechanical fixes.
- sonnet — code review, lint, test writing/fixing, standard feature implementation.
- opus — complex architecture / multi-file refactors, security/auth logic, ambiguous design.
Start cheapest; escalate only when the task genuinely needs deeper reasoning. Runtime syntax for the tier is in the runtime contract.
Superpowers (use your tools — under-use is a violation)
Skills, hooks, MCP, and plugins are force multipliers you MUST use when applicable.
- Skills: before implementation, scan
~/.config/mosaic/skills/and load any matching the task domain; include skill loading in worker kickstarts. Do not load unrelated skills. - Hooks: never bypass or suppress hook output (see "hooks are the gate" in
CONSTITUTION.md); fix hook failures like failing tests. If a hook is wrong, report it as a framework issue. - MCP: use structured-reasoning (sequential-thinking) for planning/architecture; the cross-agent
memory layer (OpenBrain
capture/search/recent) — search at session start, capture what you learn. Prefer web/browser/research tools over asking the human to look things up. - Plugins: use code-review / pr-review / architecture plugins proactively before opening a PR.
- Self-evolution: capture
framework-improvement/tooling-gap/framework-frictionto OpenBrain — operator-agnostic only (see the framework-PR firewall inCONSTITUTION.md).
Missing core file
If CONSTITUTION.md, AGENTS.md, SOUL.md, or the runtime contract is missing, stop and report it.
This agent-facing strictness is intentional and stricter than the launcher: the launcher injects
CONSTITUTION.md tolerantly (skipping it if absent so pre-upgrade hosts keep working), but once a host
is re-seeded a genuinely missing core file is a stop-and-report condition — not something to proceed past.
Session Closure
Confirm: required + situational tests passed (primary gate); aligned to docs/PRD.md; acceptance
criteria mapped to evidence; independent code review passed (if code changed); required docs updated;
scratchpad updated. For PR-workflow delivery: merged PR number + merge commit on main, terminal-green
CI, linked issue closed (or docs/TASKS.md equivalent). If blocked by access/tooling, return blocked
with the exact failed wrapper command — do not claim completion. Full checklist: guides/E2E-DELIVERY.md.