From c7f363b2d20075c45106ade6c5705a94bfb511b7 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Tue, 17 Feb 2026 14:12:02 -0600 Subject: [PATCH] migrate mosaic home to xdg config path --- AUDIT-2026-02-17-framework-consistency.md | 16 +-- README.md | 82 ++++++------ STANDARDS.md | 22 ++-- adapters/claude.md | 6 +- adapters/codex.md | 2 +- adapters/generic.md | 2 +- bin/mosaic-bootstrap-repo | 14 +-- bin/mosaic-doctor | 2 +- bin/mosaic-link-runtime-assets | 2 +- bin/mosaic-migrate-local-skills | 4 +- bin/mosaic-orchestrator-matrix-consume | 2 +- bin/mosaic-orchestrator-matrix-cycle | 2 +- bin/mosaic-orchestrator-matrix-publish | 2 +- bin/mosaic-orchestrator-run | 2 +- bin/mosaic-prune-legacy-runtime | 4 +- bin/mosaic-quality-apply | 2 +- bin/mosaic-quality-verify | 2 +- bin/mosaic-sync-skills | 10 +- bin/mosaic-upgrade-slaves | 4 +- guides/authentication.md | 2 +- guides/backend.md | 6 +- guides/bootstrap.md | 42 +++---- guides/code-review.md | 2 +- guides/frontend.md | 4 +- guides/infrastructure.md | 2 +- guides/orchestrator.md | 20 +-- guides/qa-testing.md | 2 +- install.sh | 4 +- profiles/README.md | 6 +- rails/bootstrap/agent-lint.sh | 6 +- rails/bootstrap/agent-upgrade.sh | 6 +- rails/bootstrap/init-project.sh | 8 +- rails/bootstrap/init-repo-labels.sh | 2 +- rails/codex/README.md | 30 ++--- rails/orchestrator-matrix/README.md | 10 +- rails/qa/qa-hook-handler.sh | 2 +- rails/qa/qa-hook-stdin.sh | 6 +- rails/qa/qa-hook-wrapper.sh | 2 +- rails/qa/qa-queue-monitor.sh | 2 +- rails/qa/remediation-hook-handler.sh | 2 +- rails/quality/README.md | 6 +- rails/quality/scripts/install.sh | 2 +- runtime/claude/CLAUDE.md | 118 +++++++++--------- runtime/claude/settings.json | 2 +- runtime/opencode/AGENTS.md | 8 +- skills-local/mosaic-standards/SKILL.md | 4 +- skills-local/setup-cicd/SKILL.md | 6 +- templates/agent/AGENTS.md.template | 4 +- templates/agent/CLAUDE.md.template | 22 ++-- templates/agent/SPEC.md | 6 +- templates/agent/fragments/code-review.md | 6 +- .../agent/fragments/conditional-loading.md | 22 ++-- .../agent/projects/django/AGENTS.md.template | 4 +- .../agent/projects/django/CLAUDE.md.template | 14 +-- .../projects/nestjs-nextjs/AGENTS.md.template | 4 +- .../projects/nestjs-nextjs/CLAUDE.md.template | 20 +-- .../python-fastapi/CLAUDE.md.template | 24 ++-- .../python-library/CLAUDE.md.template | 18 +-- .../projects/typescript/AGENTS.md.template | 2 +- .../projects/typescript/CLAUDE.md.template | 20 +-- 60 files changed, 330 insertions(+), 330 deletions(-) diff --git a/AUDIT-2026-02-17-framework-consistency.md b/AUDIT-2026-02-17-framework-consistency.md index c5c27c1..cb99368 100644 --- a/AUDIT-2026-02-17-framework-consistency.md +++ b/AUDIT-2026-02-17-framework-consistency.md @@ -4,7 +4,7 @@ Date: 2026-02-17 Scope: - `~/src/mosaic-bootstrap` - `~/src/agent-skills` -- Installed runtime check: `~/.mosaic` +- Installed runtime check: `~/.config/mosaic` ## Findings @@ -31,7 +31,7 @@ Updated: - `rails/qa/qa-queue-monitor.sh` Change: -- Standardized handler paths to `~/.mosaic/rails/qa/...`. +- Standardized handler paths to `~/.config/mosaic/rails/qa/...`. ### MF-002 + MF-003 (conditional loading/context detection) Updated: @@ -42,7 +42,7 @@ Updated: Change: - Detection now recognizes both legacy and Mosaic patterns: - `agent-guides` (legacy compatibility) - - `~/.mosaic/guides` + - `~/.config/mosaic/guides` - `Conditional Loading` - `Conditional Context` @@ -58,8 +58,8 @@ Updated: - `skills/pr-reviewer/SKILL.md` Change: -- Replaced all `~/.claude/scripts/git/...` with `~/.mosaic/rails/git/...`. -- Replaced `~/.claude/skills/...` with `~/.mosaic/skills/...`. +- Replaced all `~/.claude/scripts/git/...` with `~/.config/mosaic/rails/git/...`. +- Replaced `~/.claude/skills/...` with `~/.config/mosaic/skills/...`. ### MF-006 (worktree skill docs hierarchy) Updated: @@ -84,7 +84,7 @@ Updated: - `skills/systematic-debugging/CREATION-LOG.md` Change: -- Standardized references to `~/.mosaic/skills`. +- Standardized references to `~/.config/mosaic/skills`. - Removed stale Claude-only wording. ## Residual Legacy References (Intentional) @@ -109,7 +109,7 @@ These are required to support existing Claude runtime integration while keeping Executed checks: - `rg -n "~/.claude|\\.claude/|agent-guides" ~/src/agent-skills -S` - Result: no matches after remediation. -- `rg -n "~/.mosaic/rails/(qa-hook|remediation-hook|qa-queue-monitor)" ~/src/mosaic-bootstrap -S` +- `rg -n "~/.config/mosaic/rails/(qa-hook|remediation-hook|qa-queue-monitor)" ~/src/mosaic-bootstrap -S` - Result: no invalid old-style QA rail paths remain. - Installed runtime validation: - - `~/.mosaic` contains `rails/git`, `rails/portainer`, `rails/cicd`, `skills`, and `bin` tooling. + - `~/.config/mosaic` contains `rails/git`, `rails/portainer`, `rails/cicd`, `skills`, and `bin` tooling. diff --git a/README.md b/README.md index a55c0cd..3e54f6b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mosaic Agent Framework -`~/.mosaic` is the universal userspace standards layer (master) for all agent runtimes. +`~/.config/mosaic` is the universal userspace standards layer (master) for all agent runtimes. ## Install Master Layer @@ -13,15 +13,15 @@ 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` +- Shared standards document: `~/.config/mosaic/STANDARDS.md` +- Shared operational guides: `~/.config/mosaic/guides/` +- Shared quality rails/scripts: `~/.config/mosaic/rails/` +- Shared runtime-neutral presets/profiles: `~/.config/mosaic/profiles/` +- Runtime adapter docs: `~/.config/mosaic/adapters/` +- Runtime overlays: `~/.config/mosaic/runtime/` +- Shared wrapper commands: `~/.config/mosaic/bin/` +- Canonical skills directory: `~/.config/mosaic/skills` +- Local cross-runtime skills: `~/.config/mosaic/skills-local` ## Universal Skills @@ -31,7 +31,7 @@ The installer syncs skills from: into: -- `~/.mosaic/skills` +- `~/.config/mosaic/skills` Then links each skill into runtime directories: @@ -39,51 +39,51 @@ Then links each skill into runtime directories: - `~/.codex/skills` - `~/.config/opencode/skills` -Local skills under `~/.mosaic/skills-local` are also linked into runtimes. +Local skills under `~/.config/mosaic/skills-local` are also linked into runtimes. Manual commands: ```bash -~/.mosaic/bin/mosaic-sync-skills -~/.mosaic/bin/mosaic-sync-skills --link-only +~/.config/mosaic/bin/mosaic-sync-skills +~/.config/mosaic/bin/mosaic-sync-skills --link-only ``` ## Runtime Compatibility Sync Installer syncs runtime overlays as regular files (not symlinks): -- `~/.claude/{CLAUDE.md,settings.json,hooks-config.json,context7-integration.md}` <- `~/.mosaic/runtime/claude/...` -- `~/.config/opencode/AGENTS.md` <- `~/.mosaic/runtime/opencode/AGENTS.md` +- `~/.claude/{CLAUDE.md,settings.json,hooks-config.json,context7-integration.md}` <- `~/.config/mosaic/runtime/claude/...` +- `~/.config/opencode/AGENTS.md` <- `~/.config/mosaic/runtime/opencode/AGENTS.md` 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 +~/.config/mosaic/bin/mosaic-link-runtime-assets +~/.config/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 +~/.config/mosaic/bin/mosaic-prune-legacy-runtime --runtime claude +~/.config/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 +~/.config/mosaic/bin/mosaic-clean-runtime --runtime claude +~/.config/mosaic/bin/mosaic-clean-runtime --runtime claude --apply +~/.config/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 +~/.config/mosaic/bin/mosaic-doctor +~/.config/mosaic/bin/mosaic-doctor --fail-on-warn ``` Opt-out during install: @@ -97,9 +97,9 @@ MOSAIC_SKIP_SKILLS_SYNC=1 bash ~/src/mosaic-bootstrap/install.sh Inside any compatible repository: ```bash -~/.mosaic/bin/mosaic-session-start -~/.mosaic/bin/mosaic-critical -~/.mosaic/bin/mosaic-session-end +~/.config/mosaic/bin/mosaic-session-start +~/.config/mosaic/bin/mosaic-critical +~/.config/mosaic/bin/mosaic-session-end ``` Wrapper commands call local repo scripts under `scripts/agent/`. @@ -108,18 +108,18 @@ Wrapper commands call local repo scripts under `scripts/agent/`. Mosaic includes vendored quality-rails templates and scripts at: -- `~/.mosaic/rails/quality/` +- `~/.config/mosaic/rails/quality/` Apply to a repo: ```bash -~/.mosaic/bin/mosaic-quality-apply --template typescript-node --target /path/to/repo +~/.config/mosaic/bin/mosaic-quality-apply --template typescript-node --target /path/to/repo ``` Verify enforcement: ```bash -~/.mosaic/bin/mosaic-quality-verify --target /path/to/repo +~/.config/mosaic/bin/mosaic-quality-verify --target /path/to/repo ``` Templates currently supported: @@ -132,16 +132,16 @@ Templates currently supported: Mosaic includes a runtime-agnostic orchestrator rail at: -- `~/.mosaic/rails/orchestrator-matrix/` +- `~/.config/mosaic/rails/orchestrator-matrix/` Run from a bootstrapped repo: ```bash -~/.mosaic/bin/mosaic-orchestrator-matrix-cycle -~/.mosaic/bin/mosaic-orchestrator-run --once -~/.mosaic/bin/mosaic-orchestrator-run --poll-sec 10 -~/.mosaic/bin/mosaic-orchestrator-matrix-publish -~/.mosaic/bin/mosaic-orchestrator-matrix-consume +~/.config/mosaic/bin/mosaic-orchestrator-matrix-cycle +~/.config/mosaic/bin/mosaic-orchestrator-run --once +~/.config/mosaic/bin/mosaic-orchestrator-run --poll-sec 10 +~/.config/mosaic/bin/mosaic-orchestrator-matrix-publish +~/.config/mosaic/bin/mosaic-orchestrator-matrix-consume ``` The controller reads/writes repo-local state in `.mosaic/orchestrator/` and emits @@ -152,13 +152,13 @@ structured events to `.mosaic/orchestrator/events.ndjson` for Matrix bridge cons Attach any repository/workspace to the master layer: ```bash -~/.mosaic/bin/mosaic-bootstrap-repo /path/to/repo +~/.config/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 +~/.config/mosaic/bin/mosaic-bootstrap-repo --quality-template typescript-node /path/to/repo ``` This creates/updates: @@ -172,11 +172,11 @@ This creates/updates: Preview upgrades (dry-run): ```bash -~/.mosaic/bin/mosaic-upgrade-slaves +~/.config/mosaic/bin/mosaic-upgrade-slaves ``` Apply upgrades: ```bash -~/.mosaic/bin/mosaic-upgrade-slaves --apply +~/.config/mosaic/bin/mosaic-upgrade-slaves --apply ``` diff --git a/STANDARDS.md b/STANDARDS.md index d0dfd79..9d8a585 100644 --- a/STANDARDS.md +++ b/STANDARDS.md @@ -3,7 +3,7 @@ This file is the canonical standards contract for agent sessions on this machine. Master/slave model: -- Master: `~/.mosaic` (this framework) +- Master: `~/.config/mosaic` (this framework) - Slave: each repo bootstrapped via `mosaic-bootstrap-repo` ## Execution Model @@ -12,16 +12,16 @@ Master/slave model: 2. Load project-local `AGENTS.md` next. 3. Respect repository-specific tooling and workflows. 4. Use lifecycle scripts when available (`scripts/agent/*.sh`). -5. Use shared rails/guides from `~/.mosaic` as canonical references. +5. Use shared rails/guides from `~/.config/mosaic` as canonical references. ## Non-Negotiables - Data files are authoritative; generated views are derived artifacts. - Pull before edits when collaborating in shared repos. - Run validation checks before claiming completion. -- Apply quality rails from `~/.mosaic/rails/` when relevant (review, QA, git workflow). -- For project-level mechanical enforcement templates, use `~/.mosaic/rails/quality/` via `~/.mosaic/bin/mosaic-quality-apply`. -- For runtime-agnostic delegation/orchestration, use `~/.mosaic/rails/orchestrator-matrix/` with repo-local `.mosaic/orchestrator/` state. +- Apply quality rails from `~/.config/mosaic/rails/` when relevant (review, QA, git workflow). +- For project-level mechanical enforcement templates, use `~/.config/mosaic/rails/quality/` via `~/.config/mosaic/bin/mosaic-quality-apply`. +- For runtime-agnostic delegation/orchestration, use `~/.config/mosaic/rails/orchestrator-matrix/` with repo-local `.mosaic/orchestrator/` state. - Avoid hardcoded secrets and token leakage in remotes/commits. - Do not perform destructive git/file actions without explicit instruction. @@ -44,15 +44,15 @@ If a repo does not expose these scripts, run equivalent local workflow commands All runtime adapters should inject: -- `~/.mosaic/STANDARDS.md` +- `~/.config/mosaic/STANDARDS.md` - project `AGENTS.md` before task execution. Runtime-compatible guides and rails are hosted at: -- `~/.mosaic/guides/` -- `~/.mosaic/rails/` -- `~/.mosaic/profiles/` (runtime-neutral domain/workflow/stack presets) -- `~/.mosaic/runtime/` (runtime-specific overlays) -- `~/.mosaic/skills-local/` (local private skills shared across runtimes) +- `~/.config/mosaic/guides/` +- `~/.config/mosaic/rails/` +- `~/.config/mosaic/profiles/` (runtime-neutral domain/workflow/stack presets) +- `~/.config/mosaic/runtime/` (runtime-specific overlays) +- `~/.config/mosaic/skills-local/` (local private skills shared across runtimes) diff --git a/adapters/claude.md b/adapters/claude.md index 4c73539..ae8d94a 100644 --- a/adapters/claude.md +++ b/adapters/claude.md @@ -4,14 +4,14 @@ Use this adapter when running Claude CLI sessions. ## Required Context -1. `~/.mosaic/STANDARDS.md` +1. `~/.config/mosaic/STANDARDS.md` 2. `/AGENTS.md` ## Command Wrapper -Use wrapper commands from `~/.mosaic/bin/` for lifecycle rituals. +Use wrapper commands from `~/.config/mosaic/bin/` for lifecycle rituals. ## Migration Note Project-local `.claude/commands/*.md` should call `scripts/agent/*.sh` so behavior stays runtime-neutral. -Guides and rails should resolve to `~/.mosaic/guides` and `~/.mosaic/rails` (linked into `~/.claude` for compatibility). +Guides and rails should resolve to `~/.config/mosaic/guides` and `~/.config/mosaic/rails` (linked into `~/.claude` for compatibility). diff --git a/adapters/codex.md b/adapters/codex.md index dada518..0609a3b 100644 --- a/adapters/codex.md +++ b/adapters/codex.md @@ -4,7 +4,7 @@ Use this adapter when running Codex CLI sessions. ## Required Context -1. `~/.mosaic/STANDARDS.md` +1. `~/.config/mosaic/STANDARDS.md` 2. `/AGENTS.md` ## Runtime Behavior diff --git a/adapters/generic.md b/adapters/generic.md index e47a9d7..548946a 100644 --- a/adapters/generic.md +++ b/adapters/generic.md @@ -4,7 +4,7 @@ For runtimes without a first-class adapter yet. ## Required Context -1. Load `~/.mosaic/STANDARDS.md` +1. Load `~/.config/mosaic/STANDARDS.md` 2. Load project `AGENTS.md` ## Minimal Contract diff --git a/bin/mosaic-bootstrap-repo b/bin/mosaic-bootstrap-repo index 429ffd1..90dae9e 100755 --- a/bin/mosaic-bootstrap-repo +++ b/bin/mosaic-bootstrap-repo @@ -27,12 +27,12 @@ if [[ ! -d "$TARGET_DIR" ]]; then exit 1 fi -MOSAIC_HOME="${MOSAIC_HOME:-$HOME/.mosaic}" +MOSAIC_HOME="${MOSAIC_HOME:-$HOME/.config/mosaic}" TEMPLATE_ROOT="$MOSAIC_HOME/templates/repo" if [[ ! -d "$TEMPLATE_ROOT" ]]; then echo "[mosaic] Missing templates at $TEMPLATE_ROOT" >&2 - echo "[mosaic] Install or refresh framework: ~/.mosaic/install.sh" >&2 + echo "[mosaic] Install or refresh framework: ~/.config/mosaic/install.sh" >&2 exit 1 fi @@ -74,7 +74,7 @@ if [[ ! -f "$TARGET_DIR/AGENTS.md" ]]; then ## Standards Load Order -1. `~/.mosaic/STANDARDS.md` +1. `~/.config/mosaic/STANDARDS.md` 2. `AGENTS.md` (this file) 3. `.mosaic/repo-hooks.sh` @@ -88,8 +88,8 @@ bash scripts/agent/session-end.sh ## Shared Rails -- Quality and orchestration guides: `~/.mosaic/guides/` -- Shared automation rails: `~/.mosaic/rails/` +- Quality and orchestration guides: `~/.config/mosaic/guides/` +- Shared automation rails: `~/.config/mosaic/rails/` ## Repo-Specific Notes @@ -103,8 +103,8 @@ fi echo "[mosaic] Repo bootstrap complete: $TARGET_DIR" echo "[mosaic] Next: edit $TARGET_DIR/.mosaic/repo-hooks.sh with project workflows" -echo "[mosaic] Optional: apply quality rails via ~/.mosaic/bin/mosaic-quality-apply --template