refactor: AGENTS.md is the single source of truth for all runtimes

- Create ~/.config/mosaic/AGENTS.md as the canonical universal agent config
- Runtime adapters (CLAUDE.md, opencode/AGENTS.md, codex/instructions.md) are
  now thin pointers that say "READ ~/.config/mosaic/AGENTS.md"
- mosaic claude: injects AGENTS.md via --append-system-prompt
- mosaic opencode/codex: copies AGENTS.md to runtime config path before launch
- mosaic-link-runtime-assets: pushes thin pointers for direct launch fallback

AGENTS.md is runtime-agnostic. All runtimes get the same standards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jason Woltje
2026-02-19 13:24:12 -06:00
parent 0b7b823911
commit 3f2ba89db2
8 changed files with 723 additions and 679 deletions

View File

@@ -2,34 +2,10 @@
## MANDATORY — Read Before Any Response
BEFORE responding to any user message, READ these files in order:
BEFORE responding to any user message, READ `~/.config/mosaic/AGENTS.md`.
1. `~/.config/mosaic/SOUL.md` (identity and behavioral contract)
2. `~/.config/mosaic/STANDARDS.md` (machine-wide standards)
3. Project-local `AGENTS.md` (project operations and workflows)
That file is the universal agent configuration. It contains the full load order,
development standards, skills, and workflows. Do NOT respond until you have loaded it.
Do NOT respond to the user until you have loaded all three.
This file is an OpenCode adapter layer. It does not replace project guidance.
## Orchestrator Capability Contract
- OpenCode sessions may not expose a native subagent/background task primitive in all deployments.
- When native subagent delegation is unavailable, use Mosaic's deterministic orchestrator rail:
- `~/.config/mosaic/bin/mosaic-orchestrator-matrix-cycle`
- Keep repo task tracking in `docs/tasks.md` as the canonical human-readable state.
- Keep machine transport/controller state in `.mosaic/orchestrator/`.
## Fallback Delegation Mode (No Native Subagents)
1. Bootstrap repo if needed:
- `~/.config/mosaic/bin/mosaic-bootstrap-repo /path/to/repo`
2. Configure `.mosaic/orchestrator/config.json`:
- set `"enabled": true`
- set `"worker.command_template"` to your OpenCode worker command
3. Queue work items in `.mosaic/orchestrator/tasks.json` (or via Matrix command ingestion).
4. Run deterministic ticks:
- `~/.config/mosaic/bin/mosaic-orchestrator-matrix-cycle`
- or drain to completion: `~/.config/mosaic/bin/mosaic-orchestrator-drain`
This preserves rails enforcement (`quality_gates`) even without runtime-native subagent features.
This file (`~/.config/opencode/AGENTS.md`) exists only as a fallback for direct `opencode` launches.
For full injection, use `mosaic opencode` instead.