Commit Graph

54 Commits

Author SHA1 Message Date
Jason Woltje
fbf74c2736 fix: strip .git suffix in repo detection (POSIX ERE non-greedy bug)
POSIX ERE doesn't support non-greedy +? quantifier, so the pattern
([^/]+?)(\.git)?$ matched .git as part of the repo name instead of
stripping it. Split into two sed passes: strip .git first, then
extract owner/repo.

Fixes wp_detect_repo() and init-project.sh CICD_REPO_NAME.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 13:08:47 -06:00
Jason Woltje
364d6c2278 fix: use Woodpecker v3 numeric repo IDs in API calls
Woodpecker v3 requires numeric repo IDs in API endpoints, not
owner/repo path segments. The old paths hit the SPA frontend
catch-all and return HTML, which downstream tools misinterpret
as auth failure (401).

- Add tools/woodpecker/_lib.sh with wp_resolve_repo_id() helper
  that calls /api/repos/lookup/{owner}/{repo} to get numeric ID
- Update all 3 pipeline scripts to resolve repo ID before API calls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:54:03 -06:00
Jason Woltje
93efbcdafe fix: align codex mission resume and uppercase guide refs 2026-02-23 12:29:37 -06:00
Jason Woltje
def9c2fd7a feat: add Woodpecker multi-instance credential support
Add named instance support matching the existing cloudflare pattern:
- credentials.sh: woodpecker-<name> loads .woodpecker.<name>.{url,token}
- credentials.sh: bare woodpecker resolves via .woodpecker.default or
  WOODPECKER_INSTANCE env, with legacy flat-key fallback
- All 3 pipeline tools accept -a <instance> flag to select instance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:40:51 -06:00
Jason Woltje
87501ea952 fix: rename guide files to match AGENTS.md references (case-sensitive)
e2e-delivery.md → E2E-DELIVERY.md
orchestrator.md → ORCHESTRATOR.md
ci-cd-pipelines.md → CI-CD-PIPELINES.md

Agents on case-sensitive filesystems couldn't find these guides because
AGENTS.md referenced uppercase names but the files were lowercase.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:30:33 -06:00
Jason Woltje
7a5f28c8b5 feat: write session lock from all launcher paths
All launch paths (claude, codex, opencode, yolo variants) now write a
session.lock before exec'ing, so `mosaic coord status` can detect
running agent sessions. Stale locks from dead sessions are cleaned up
automatically on next launch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:14:57 -06:00
Jason Woltje
405bc4c797 fix: show mission context when no active session in coord status
Previously `mosaic coord status` only said "No active session" with no
indication of whether a mission existed. Now shows mission name, status,
milestones/tasks progress, and actionable next steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:08:16 -06:00
Jason Woltje
c9bf578396 feat: add mosaic prdy command for PRD creation and validation
Adds `mosaic prdy {init|update|validate}` subcommand:
- init: launches yolo Claude session with PRD-focused system prompt
- update: launches session to modify existing docs/PRD.md
- validate: bash-only completeness checker (15 checks against PRD guide)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:04:35 -06:00
c1f4830bf5 feat: add subagent model selection guidance for cost optimization
Global AGENTS.md: task-type-to-model-tier mapping table with decision
rule — haiku for search/status, sonnet for standard coding/review,
opus only for complex architecture and security.

Claude RUNTIME.md: Task tool model parameter syntax with examples
and quick reference table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 07:37:44 -06:00
e5c4bf25b3 feat: add Cloudflare DNS tool suite with multi-instance support
- zone-list, record-list, record-create, record-update, record-delete
- Named instance support (-a flag) with configurable default
- Zone name-to-ID auto-resolution in shared _lib.sh
- Updated credentials loader with cloudflare/cloudflare-<name> services
- TOOLS.md and INFRASTRUCTURE.md guide documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:31:52 -06:00
a9623e9219 fix: add hard gates for manual docker build bypass and intake skipping
Post-mortem from website agent session that manually built/pushed Docker
images instead of using existing Woodpecker CI pipelines. Root cause:
agent skipped E2E intake because the task "felt simple."

AGENTS.md hard gates 10-12:
- Manual docker build/push FORBIDDEN when CI pipelines exist
- MUST check for pipeline config before any build/deploy action
- Load order and intake are NOT conditional on task complexity

E2E-DELIVERY.md:
- Complexity trap warning on intake section
- Mandatory deployment surface check (step 3) with pipeline discovery
- Expanded forbidden anti-patterns with Build/Deploy section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 18:18:36 -06:00
5d666bdca9 fix: move mission context to top of system prompt + auto-inject initial prompt
Mission context was buried at the end of a 21K char system prompt and the
agent ignored it. Two fixes:
1. Mission block now emits FIRST in build_runtime_prompt() so it's the most
   prominent instruction the agent sees
2. When an active mission exists and no user prompt is given, auto-inject
   an initial user message triggering the agent to read mission state files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 17:52:44 -06:00
221afe94d9 feat: inject active mission context into agent system prompt
The session-start hook approach didn't work — Claude Code's TUI
overwrites stdout before the agent sees it, and the hook only fires
when the agent calls it as a tool.

Instead, inject mission context directly into the composed system
prompt via build_runtime_prompt(). When mission.json is active in
CWD, the agent gets mission name, ID, milestone progress, and
mandatory first-action instructions in its initial context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 17:44:36 -06:00
612796d8e0 fix: prevent task count line break in session-start template
grep -c returns empty on no match, causing arithmetic to break
across lines. Use ${var:-0} fallback pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 17:42:41 -06:00
5ba531e2d0 feat: r0 coordinator tooling for orchestrator protocol
Implements the manual coordinator workflow for multi-session agent
orchestration. Agents stop after one milestone (confirmed limitation);
these tools let the human coordinator check status, generate continuation
prompts, and chain sessions together.

New:
- tools/orchestrator/ — 5 scripts + shared library (_lib.sh)
  - mission-init.sh: initialize mission with milestones and state files
  - mission-status.sh: dashboard showing milestones, tasks, sessions
  - session-status.sh: check if agent is running/stale/dead
  - continue-prompt.sh: generate paste-ready continuation prompt
  - session-resume.sh: crash recovery with dirty state detection
- guides/ORCHESTRATOR-PROTOCOL.md: agent-facing mission lifecycle guide
- templates/docs/: mission manifest, scratchpad, continuation templates
- templates/repo/.mosaic/orchestrator/mission.json: state file template

Modified:
- bin/mosaic: add 'coord' subcommand + resume advisory on launch
- AGENTS.md: conditional loading for protocol guide + rule 37
- bin/mosaic-doctor: checks for new coordinator files
- session hooks: mission detection on start, cleanup on end

Usage: mosaic coord init|mission|status|continue|resume

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 17:22:50 -06:00
a8e580e1a3 feat: rename rails/ to tools/ and add service tool suites (#4)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-02-22 17:52:23 +00:00
248db8935c fix: enforce durable memory in mosaic memory dir, not runtime-native silos
MEMORY.md was conditionally loaded so agents defaulted to their native
memory locations (e.g. ~/.claude/projects/*/memory/). This caused durable
learnings to be siloed per-runtime instead of shared across agents.

- Move MEMORY.md to mandatory load order in AGENTS.md (position 7)
- Add Memory Override section to all three runtime configs (Claude, Codex,
  OpenCode) explicitly forbidding native memory silos for durable data
- Add memory/ directory with .gitkeep to bootstrap source
- Add mkdir -p for memory/ in install.sh post-sync step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 15:02:20 -06:00
1c45894711 fix: redirect stdin from /dev/tty for curl|sh installs (#3)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-02-21 19:03:07 +00:00
a9ce355c85 fix: enforce headless browser automation + update README for wizard (#2)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-02-21 18:56:24 +00:00
6a84f7e210 feat: TypeScript installation wizard with @clack/prompts TUI (#1)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-02-21 18:25:51 +00:00
Jason Woltje
e3ec3e32e5 chore: sync local Mosaic changes 2026-02-21 09:55:34 -06:00
1e4eefeca3 Update scripts to keep SOUL.md idempotent. Add release upgrade framework. 2026-02-20 07:36:54 -06:00
eac247c5cb Add Claude memory section to instruct agents to save to the shared memory instead of the Claude-specific memory. 2026-02-19 20:01:18 -06:00
Jason Woltje
f577ccd61d docs: rewrite README with one-liner install, mosaic CLI, and upgrade docs
- Mac/Linux curl one-liner and Windows PowerShell one-liner at the top
- First-run flow (mosaic init → mosaic claude)
- Architecture diagram showing AGENTS.md as single source of truth
- Injection mechanism table for all runtimes (launcher vs direct)
- All mosaic CLI commands documented
- mosaic upgrade workflow documented
- Removed outdated sections superseded by the mosaic launcher

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:38:23 -06:00
Jason Woltje
56b644e6d3 feat: add mosaic upgrade command to clean stale per-project files
Detects and cleans up files that are now centralized:
- SOUL.md: removed (now global at ~/.config/mosaic/SOUL.md)
- CLAUDE.md: replaced with thin pointer to global AGENTS.md
- AGENTS.md: stale load-order sections stripped, project content preserved

Supports --dry-run, --all (scan ~/src/*), and per-project paths.
Creates .mosaic-bak backups before any modification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:33:10 -06:00
Jason Woltje
3f2ba89db2 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>
2026-02-19 13:24:12 -06:00
Jason Woltje
0b7b823911 fix: remove --append-system-prompt-file from launcher
SOUL.md injection happens via ~/.claude/CLAUDE.md directive (pushed by
mosaic-link-runtime-assets), not CLI flags. The launcher now just does
pre-flight checks and launches the runtime directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:15:17 -06:00
Jason Woltje
b886b3d3c2 feat: colored installer output with status indicators and next steps
- Green ✓ for success, yellow ⚠ for warnings, red ✗ for errors
- Bold section headings (Installing, Post-install, PATH, Summary)
- Summary block with numbered next steps (source shell profile, mosaic init)
- Suppressed noisy sub-script output — only status lines shown
- Colors auto-disabled when not running in a terminal (piped output)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:05:10 -06:00
Jason Woltje
1f2bb6ef77 fix: installer auto-adds mosaic bin to PATH with clear status output
- install.sh: detects shell profile (zsh/bash/profile), adds PATH entry if missing
- install.ps1: adds to User PATH via SetEnvironmentVariable if missing
- Both are idempotent — show "already in PATH ✓" on re-run
- mosaic/mosaic.ps1: accept "help" and "version" as bare subcommands

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:03:07 -06:00
Jason Woltje
7c2eba4e15 feat: centralized SOUL.md, mosaic-init generator, and unified launcher
- Add SOUL.md.template with {{PLACEHOLDERS}} for interactive generation
- Add mosaic-init (bash + PS1) for interactive SOUL.md creation with flag overrides
- Add mosaic launcher (bash + PS1) — unified CLI for claude/opencode/codex with SOUL.md injection
- Add codex runtime adapter (runtime/codex/instructions.md)
- Update runtime adapters (claude, opencode) with SOUL.md read directive
- Update mosaic-link-runtime-assets to push codex adapter to ~/.codex/
- Update installers to prompt for mosaic init when SOUL.md is missing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:38:22 -06:00
Jason Woltje
7316870c81 feat: add Windows PowerShell support and remote install one-liners
- remote-install.sh: POSIX one-liner (curl | sh), downloads archive to tmpdir
- remote-install.ps1: Windows one-liner (irm | iex), fully native PowerShell
- install.ps1: Native Windows installer calling all .ps1 post-install scripts
- bin/mosaic-link-runtime-assets.ps1: Syncs runtime config files
- bin/mosaic-sync-skills.ps1: Clones skills, links via directory junctions
- bin/mosaic-migrate-local-skills.ps1: Migrates local skills to junctions
- bin/mosaic-doctor.ps1: Health audit for Windows environments

Directory junctions used instead of symlinks (no elevation required).
All junction operations fall back to file copy on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 11:49:36 -06:00
Jason Woltje
449e47bedc add central multi-repo project orchestration command 2026-02-17 14:50:02 -06:00
Jason Woltje
0ff39bcee4 add drain-mode orchestration and docs/tasks sync for codex-opencode 2026-02-17 14:41:47 -06:00
Jason Woltje
c7f363b2d2 migrate mosaic home to xdg config path 2026-02-17 14:12:02 -06:00
Jason Woltje
e16ff8af70 add opencode runtime adapter and matrix fallback orchestration guidance 2026-02-17 14:05:39 -06:00
Jason Woltje
014654972c add single-command orchestrator matrix cycle 2026-02-17 13:56:59 -06:00
Jason Woltje
d7d5415bce add matrix publish/consume transport for orchestrator rail 2026-02-17 13:35:25 -06:00
Jason Woltje
4c7c314aac ignore python bytecode in orchestrator controller 2026-02-17 13:32:01 -06:00
Jason Woltje
a2062a8d49 remove accidental pycache artifact from orchestrator rail 2026-02-17 13:31:53 -06:00
Jason Woltje
caaa0e6a46 add matrix orchestrator rail and repo scaffolding 2026-02-17 13:31:29 -06:00
Jason Woltje
e1c1ce2856 integrate generalized quality-rails into mosaic bootstrap 2026-02-17 13:16:01 -06:00
Jason Woltje
5ac015b177 audit and remediate mosaic framework path inconsistencies 2026-02-17 13:08:55 -06:00
Jason Woltje
4d6a78a277 skip session-start pull on dirty working trees 2026-02-17 12:43:07 -06:00
Jason Woltje
a146aa0709 drop claude symlink trees for migrated assets 2026-02-17 12:20:33 -06:00
Jason Woltje
947d4e808d add runtime empty-directory cleanup command 2026-02-17 12:12:58 -06:00
Jason Woltje
db2ec9524f generalize runtime ownership with doctor and local skill migration 2026-02-17 12:10:06 -06:00
Jason Woltje
967c9c462b add safe prune command for migrated runtime backups 2026-02-17 12:00:39 -06:00
Jason Woltje
adef51d852 add cicd rail and link generate-docker-steps via mosaic 2026-02-17 11:59:11 -06:00
Jason Woltje
33bbf60bad generalize presets into mosaic profiles with runtime overlays 2026-02-17 11:46:12 -06:00
Jason Woltje
4eac2c76e6 centralize guides and rails under mosaic with runtime compatibility links 2026-02-17 11:39:52 -06:00