Splits the 155-line thin-core AGENTS.md into: - defaults/CONSTITUTION.md (L0): gates + integrity + escalation + block-vs-done + mode + two-axis precedence + hooks-are-the-gate + framework-PR firewall + structured-reasoning capability + tier-aware self-load. Capability-verb authored. - defaults/AGENTS.md gutted to an ~80-line load-order dispatcher + guide table (kills the false "already in context, do not re-read" line). - constitution/LAYER-MODEL.md: source-only governance spec (layers + precedence). Non-regression wiring (fresh-install functional; upgrade-safety is P4): - launch.ts injects CONSTITUTION.md before AGENTS.md (tolerant of un-reseeded installs) - install.sh + file-adapter.ts seed CONSTITUTION.md (+ test fixture updated) Runtime adapters: capability-verb the sequential-thinking binding; claude/codex/ opencode restate the REQUIRED hard-stop, pi binds to native thinking (gate=false) — restores the force the adversarial review flagged as weakened. Gate hardening (dual-engine review): identity denylist now covers examples/ (closes the Codex open-source gap), self-test-first, *.json in scope, ci.yml typecheck depends on sanitization (fail-fast), L0 line-count ceiling (<=120). Adversarial gate-preservation review: every original rule traced to L0, the dispatcher, or a routed guide — nothing lost. Refs #542, closes #574 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
81 lines
5.4 KiB
Markdown
Executable File
81 lines
5.4 KiB
Markdown
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
|
|
|
|
1. Your context already includes `CONSTITUTION.md` + `USER.md` + the TOOLS index + the runtime
|
|
contract (injected by `mosaic` launch) — do not re-read those. **If you were launched bare**
|
|
(a harness started without `mosaic`, so the law is NOT in your context), read
|
|
`~/.config/mosaic/CONSTITUTION.md` now, before your first action.
|
|
2. Read `SOUL.md` (agent persona — small, once).
|
|
3. Read project-local `AGENTS.md` / `CLAUDE.md` if present (these may only make behavior stricter).
|
|
4. Read guides ONLY as triggered by the table below — pull role-relevant depth on demand, not up front.
|
|
5. For implementation work, read `guides/E2E-DELIVERY.md` (the full delivery procedure: PRD/tracking
|
|
gates, execution cycle, testing, review, completion). `STANDARDS.md` is 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-friction` to
|
|
OpenBrain — operator-agnostic only (see the framework-PR firewall in `CONSTITUTION.md`).
|
|
|
|
## Missing core file
|
|
|
|
If `CONSTITUTION.md`, `AGENTS.md`, `SOUL.md`, or the runtime contract is missing, stop and report it.
|
|
|
|
## 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`.
|