feat: add multi-runtime support (coord run, prdy --codex) and next-task capsule

- coord/prdy subcommands now accept --claude/--codex runtime flags
- New `mosaic coord run` generates continuation context and launches
  selected runtime, replacing manual copy/paste workflow
- Next-task capsule (.mosaic/orchestrator/next-task.json) provides
  machine-readable execution context for deterministic session launches
- Codex strict orchestrator profile added to runtime/codex/RUNTIME.md
- Orchestrator protocol updated with between-session run flow
- New smoke-test.sh for orchestration behavior verification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jason Woltje
2026-02-23 18:27:09 -06:00
parent fbf74c2736
commit abead17e0e
12 changed files with 517 additions and 41 deletions

View File

@@ -41,6 +41,20 @@ _require_cmd() {
fi
}
prdy_runtime() {
local runtime="${MOSAIC_PRDY_RUNTIME:-claude}"
case "$runtime" in
claude|codex) echo "$runtime" ;;
*) echo "claude" ;;
esac
}
prdy_runtime_command() {
local runtime
runtime="$(prdy_runtime)"
echo "$runtime"
}
# ─── PRD detection ───────────────────────────────────────────────────────────
# Find the PRD file in a project directory.

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
#
# prdy-init.sh — Create a new PRD via guided Claude session
# prdy-init.sh — Create a new PRD via guided runtime session
#
# Usage:
# prdy-init.sh [--project <path>] [--name <feature>]
#
# Launches a dedicated Claude Code session in yolo mode with a specialized
# Launches a dedicated runtime session in yolo mode with a specialized
# system prompt that guides the user through PRD creation. The output is
# written to docs/PRD.md.
@@ -24,15 +24,15 @@ while [[ $# -gt 0 ]]; do
--name) NAME="$2"; shift 2 ;;
-h|--help)
cat <<'USAGE'
prdy-init.sh — Create a new PRD via guided Claude session
prdy-init.sh — Create a new PRD via guided runtime session
Usage: prdy-init.sh [--project <path>] [--name <feature>]
Options:
--project <path> Project directory (default: CWD)
--name <feature> Feature or project name (optional, Claude will ask if omitted)
--name <feature> Feature or project name (optional, runtime will ask if omitted)
Launches Claude Code in yolo mode with a PRD-focused system prompt.
Launches the selected runtime in yolo mode with a PRD-focused prompt.
The agent will ask clarifying questions, then write docs/PRD.md.
Examples:
@@ -51,7 +51,8 @@ PROJECT="${PROJECT/#\~/$HOME}"
# ─── Preflight checks ───────────────────────────────────────────────────────
_require_cmd "claude"
RUNTIME_CMD="$(prdy_runtime_command)"
_require_cmd "$RUNTIME_CMD"
# Check for existing PRD
EXISTING="$(find_prd "$PROJECT")"
@@ -77,11 +78,29 @@ else
KICKOFF="Create docs/PRD.md for this project. Read the project context first, then ask the user what they want to build. Ask clarifying questions before writing the PRD."
fi
# ─── Launch Claude ──────────────────────────────────────────────────────────
# ─── Launch runtime ──────────────────────────────────────────────────────────
info "Output target: $PROJECT/$PRD_CANONICAL"
info "Mode: PRD Creation (yolo)"
info "Mode: PRD Creation (yolo, runtime: $RUNTIME_CMD)"
echo ""
cd "$PROJECT"
exec claude --dangerously-skip-permissions --append-system-prompt "$SYSTEM_PROMPT" "$KICKOFF"
if [[ "$RUNTIME_CMD" == "claude" ]]; then
exec claude --dangerously-skip-permissions --append-system-prompt "$SYSTEM_PROMPT" "$KICKOFF"
fi
if [[ "$RUNTIME_CMD" == "codex" ]]; then
CODEX_PROMPT="$(cat <<EOF
Follow this PRD contract exactly.
$SYSTEM_PROMPT
Task:
$KICKOFF
EOF
)"
exec codex --dangerously-bypass-approvals-and-sandbox "$CODEX_PROMPT"
fi
fail "Unsupported runtime: $RUNTIME_CMD"
exit 1

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
#
# prdy-update.sh — Update an existing PRD via guided Claude session
# prdy-update.sh — Update an existing PRD via guided runtime session
#
# Usage:
# prdy-update.sh [--project <path>]
#
# Launches a dedicated Claude Code session in yolo mode with a specialized
# Launches a dedicated runtime session in yolo mode with a specialized
# system prompt that reads the existing PRD and guides targeted modifications.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -21,14 +21,14 @@ while [[ $# -gt 0 ]]; do
--project) PROJECT="$2"; shift 2 ;;
-h|--help)
cat <<'USAGE'
prdy-update.sh — Update an existing PRD via guided Claude session
prdy-update.sh — Update an existing PRD via guided runtime session
Usage: prdy-update.sh [--project <path>]
Options:
--project <path> Project directory (default: CWD)
Launches Claude Code in yolo mode with a PRD-update system prompt.
Launches the selected runtime in yolo mode with a PRD-update prompt.
The agent will read the existing docs/PRD.md, summarize its state,
and ask what changes are needed.
@@ -47,7 +47,8 @@ PROJECT="${PROJECT/#\~/$HOME}"
# ─── Preflight checks ───────────────────────────────────────────────────────
_require_cmd "claude"
RUNTIME_CMD="$(prdy_runtime_command)"
_require_cmd "$RUNTIME_CMD"
# Require existing PRD
EXISTING="$(find_prd "$PROJECT")"
@@ -65,11 +66,29 @@ SYSTEM_PROMPT="$(build_prdy_system_prompt "update")"
KICKOFF="Read the existing PRD at ${EXISTING}, summarize its current state, then ask what changes or additions are needed."
# ─── Launch Claude ──────────────────────────────────────────────────────────
# ─── Launch runtime ──────────────────────────────────────────────────────────
info "Updating: $EXISTING"
info "Mode: PRD Update (yolo)"
info "Mode: PRD Update (yolo, runtime: $RUNTIME_CMD)"
echo ""
cd "$PROJECT"
exec claude --dangerously-skip-permissions --append-system-prompt "$SYSTEM_PROMPT" "$KICKOFF"
if [[ "$RUNTIME_CMD" == "claude" ]]; then
exec claude --dangerously-skip-permissions --append-system-prompt "$SYSTEM_PROMPT" "$KICKOFF"
fi
if [[ "$RUNTIME_CMD" == "codex" ]]; then
CODEX_PROMPT="$(cat <<EOF
Follow this PRD contract exactly.
$SYSTEM_PROMPT
Task:
$KICKOFF
EOF
)"
exec codex --dangerously-bypass-approvals-and-sandbox "$CODEX_PROMPT"
fi
fail "Unsupported runtime: $RUNTIME_CMD"
exit 1