# Mosaic Agent Framework `~/.mosaic` is the universal userspace standards layer (master) for all agent runtimes. ## Install Master Layer From the standalone source repo: ```bash git clone https://git.mosaicstack.dev/mosaic/bootstrap.git ~/src/mosaic-bootstrap bash ~/src/mosaic-bootstrap/install.sh ``` ## What It Provides - Shared standards document: `~/.mosaic/STANDARDS.md` - Shared operational guides: `~/.mosaic/guides/` - Shared quality rails/scripts: `~/.mosaic/rails/` - Shared runtime-neutral presets/profiles: `~/.mosaic/profiles/` - Runtime adapter docs: `~/.mosaic/adapters/` - Runtime overlays: `~/.mosaic/runtime/` - Shared wrapper commands: `~/.mosaic/bin/` - Canonical skills directory: `~/.mosaic/skills` - Local cross-runtime skills: `~/.mosaic/skills-local` ## Universal Skills The installer syncs skills from: - `https://git.mosaicstack.dev/mosaic/agent-skills` into: - `~/.mosaic/skills` Then links each skill into runtime directories: - `~/.claude/skills` - `~/.codex/skills` - `~/.config/opencode/skills` Local skills under `~/.mosaic/skills-local` are also linked into runtimes. Manual commands: ```bash ~/.mosaic/bin/mosaic-sync-skills ~/.mosaic/bin/mosaic-sync-skills --link-only ``` ## Runtime Compatibility Sync Installer syncs Claude runtime overlays as regular files (not symlinks): - `~/.claude/{CLAUDE.md,settings.json,hooks-config.json,context7-integration.md}` <- `~/.mosaic/runtime/claude/...` Legacy symlink trees under `~/.claude` for migrated guides/scripts/templates/presets are pruned during sync. Run manually: ```bash ~/.mosaic/bin/mosaic-link-runtime-assets ~/.mosaic/bin/mosaic-migrate-local-skills --apply ``` Prune migrated legacy backups from runtime folders (dry-run by default): ```bash ~/.mosaic/bin/mosaic-prune-legacy-runtime --runtime claude ~/.mosaic/bin/mosaic-prune-legacy-runtime --runtime claude --apply ``` Clean empty legacy runtime directories: ```bash ~/.mosaic/bin/mosaic-clean-runtime --runtime claude ~/.mosaic/bin/mosaic-clean-runtime --runtime claude --apply ~/.mosaic/bin/mosaic-clean-runtime --runtime claude --all-empty --apply ``` Audit runtime drift: ```bash ~/.mosaic/bin/mosaic-doctor ~/.mosaic/bin/mosaic-doctor --fail-on-warn ``` Opt-out during install: ```bash MOSAIC_SKIP_SKILLS_SYNC=1 bash ~/src/mosaic-bootstrap/install.sh ``` ## Usage Inside any compatible repository: ```bash ~/.mosaic/bin/mosaic-session-start ~/.mosaic/bin/mosaic-critical ~/.mosaic/bin/mosaic-session-end ``` Wrapper commands call local repo scripts under `scripts/agent/`. ## Quality Rails (Generalized) Mosaic includes vendored quality-rails templates and scripts at: - `~/.mosaic/rails/quality/` Apply to a repo: ```bash ~/.mosaic/bin/mosaic-quality-apply --template typescript-node --target /path/to/repo ``` Verify enforcement: ```bash ~/.mosaic/bin/mosaic-quality-verify --target /path/to/repo ``` Templates currently supported: - `typescript-node` - `typescript-nextjs` - `monorepo` ## Matrix Orchestrator Rail Mosaic includes a runtime-agnostic orchestrator rail at: - `~/.mosaic/rails/orchestrator-matrix/` Run from a bootstrapped repo: ```bash ~/.mosaic/bin/mosaic-orchestrator-run --once ~/.mosaic/bin/mosaic-orchestrator-run --poll-sec 10 ``` The controller reads/writes repo-local state in `.mosaic/orchestrator/` and emits structured events to `.mosaic/orchestrator/events.ndjson` for Matrix bridge consumption. ## Bootstrap Any Repo (Slave Linkage) Attach any repository/workspace to the master layer: ```bash ~/.mosaic/bin/mosaic-bootstrap-repo /path/to/repo ``` Attach and apply quality rails in one step: ```bash ~/.mosaic/bin/mosaic-bootstrap-repo --quality-template typescript-node /path/to/repo ``` This creates/updates: - `.mosaic/` (repo-specific hook/config surface) - `scripts/agent/` (portable lifecycle scripts) - `AGENTS.md` (if missing) ## Upgrade Existing Slave Repos Preview upgrades (dry-run): ```bash ~/.mosaic/bin/mosaic-upgrade-slaves ``` Apply upgrades: ```bash ~/.mosaic/bin/mosaic-upgrade-slaves --apply ```