Skip to content

Commit 8e29009

Browse files
committed
feat: bridge Codex v0.3.3–v0.4.1 (worklist routing, numbered closeout, delegation contract)
Bridges the Codex Game Studios v0.3.3 continuity-routing rework, v0.4.0 numbered closeout, and v0.4.1 role-agent delegation contract into the OpenCode-native port. - Introduce ## Session Worklist + ## Phase Guard routing cache in production/session-state/active.md; /resume-from-handoff compiles it, post-work closeouts read it, /studio-next deprecated to manual reference - Require numbered closeout (Next action: + 1. (Recommended)) on 21 completion skills + AGENTS wrap-up + session-continuity Pause Procedure - Add central Role-Agent Delegation Authorization to AGENTS.md, coordination-rules.md, director-gates.md; extend skill-test checks - Translate upstream validate_runtime.py CLOSEOUT enforcement into run_closeout in audit.sh - Bump VERSION 0.2.0 -> 0.3.0; CHANGELOG + README + test-evidence Bridged source: Cipher-85/Codex-Game-Studios v0.3.3, v0.4.0, v0.4.1 (2026-07-06).
1 parent 0b00237 commit 8e29009

31 files changed

Lines changed: 744 additions & 225 deletions

File tree

.opencode/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.0
1+
0.3.0

.opencode/audit.sh

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# all Run all validators (default)
99
# agents Validate agent files
1010
# skills Validate skill files
11+
# closeout Check closeout-routing contract on completion skills
1112
# runtime Check for stale references
1213
# config Validate opencode.json
1314
# hooks Test hook scripts
@@ -24,7 +25,7 @@ command="${1:-all}"
2425
while [ "$#" -gt 0 ]; do
2526
case "$1" in
2627
--root) root="$(cd "$2" && pwd -P)"; shift 2 ;;
27-
all|agents|skills|runtime|config|hooks|smoke|release) command="$1"; shift ;;
28+
all|agents|skills|runtime|config|hooks|smoke|release|closeout) command="$1"; shift ;;
2829
*) shift ;;
2930
esac
3031
done
@@ -97,6 +98,67 @@ sys.exit(0)
9798
printf ' %d skills checked\n' "$count"
9899
}
99100

101+
run_closeout() {
102+
printf '\n── Closeout Routing ────────────────────────────────────────\n'
103+
local -a skills=(
104+
architecture-decision architecture-review art-bible asset-spec brainstorm
105+
code-review consistency-check design-system dev-story gate-check help
106+
map-systems project-stage-detect quick-design smoke-check story-done
107+
story-readiness team-qa ux-design
108+
)
109+
local -a markers=(
110+
"Verdict: **COMPLETE**"
111+
"Verdict: COMPLETE"
112+
"**Verdict: COMPLETE**"
113+
"## Recommended Next Steps"
114+
)
115+
local -a required=(
116+
"Session Worklist"
117+
"production/session-state/active.md"
118+
"completed work"
119+
"owed verification"
120+
"numbered next-action prompt"
121+
"Next action:"
122+
"1. (Recommended)"
123+
"(Recommended)"
124+
)
125+
local -a forbidden=(
126+
"one recommended next action"
127+
"numbered choice set"
128+
)
129+
local checked=0
130+
for s in "${skills[@]}"; do
131+
local f="$root/.opencode/skills/$s/SKILL.md"
132+
[ -f "$f" ] || { fail "$s (no SKILL.md)"; continue; }
133+
checked=$((checked + 1))
134+
# Trigger only when the skill declares a closeout marker.
135+
local has_marker=0 m
136+
for m in "${markers[@]}"; do
137+
if rg -q -F "$m" "$f" 2>/dev/null; then has_marker=1; break; fi
138+
done
139+
if [ "$has_marker" -eq 0 ]; then
140+
pass "$s (no closeout marker; skipped)"
141+
continue
142+
fi
143+
local missing=() bad=()
144+
for m in "${required[@]}"; do
145+
if ! rg -q -F "$m" "$f" 2>/dev/null; then missing+=("$m"); fi
146+
done
147+
for m in "${forbidden[@]}"; do
148+
if rg -q -F "$m" "$f" 2>/dev/null; then bad+=("$m"); fi
149+
done
150+
if [ "${#missing[@]}" -eq 0 ] && [ "${#bad[@]}" -eq 0 ]; then
151+
pass "$s (closeout routing complete)"
152+
else
153+
local detail=""
154+
[ "${#missing[@]}" -gt 0 ] && detail+=" missing: ${missing[*]}"
155+
[ "${#bad[@]}" -gt 0 ] && detail+=" forbidden-present: ${bad[*]}"
156+
fail "$s (closeout contract)$detail"
157+
fi
158+
done
159+
printf ' %d closeout skills checked\n' "$checked"
160+
}
161+
100162
run_runtime() {
101163
printf '\n── Runtime References ──────────────────────────────────────\n'
102164
# Check for stale Claude references
@@ -241,19 +303,21 @@ case "$command" in
241303
all)
242304
run_agents
243305
run_skills
306+
run_closeout
244307
run_runtime
245308
run_config
246309
run_hooks
247310
run_smoke
248311
;;
249-
agents) run_agents ;;
250-
skills) run_skills ;;
251-
runtime) run_runtime ;;
252-
config) run_config ;;
253-
hooks) run_hooks ;;
254-
smoke) run_smoke ;;
255-
release) run_release ;;
256-
*) printf 'Unknown command: %s\nAvailable: all, agents, skills, runtime, config, hooks, smoke, release\n' "$command" >&2; exit 2 ;;
312+
agents) run_agents ;;
313+
skills) run_skills ;;
314+
closeout) run_closeout ;;
315+
runtime) run_runtime ;;
316+
config) run_config ;;
317+
hooks) run_hooks ;;
318+
smoke) run_smoke ;;
319+
release) run_release ;;
320+
*) printf 'Unknown command: %s\nAvailable: all, agents, skills, closeout, runtime, config, hooks, smoke, release\n' "$command" >&2; exit 2 ;;
257321
esac
258322

259323
printf '\n── Result: %d error(s) ──\n' "$errors"

.opencode/docs/coordination-rules.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,31 @@ Spawned via `Task` within a single OpenCode session. Used by all `team-*` skills
4040
and orchestration skills. Subagents share the session's permission context, run
4141
sequentially or in parallel within the session, and return results to the parent.
4242

43+
Explicit invocation of an OpenCode Game Studios skill authorizes only the
44+
subagent spawns declared by that skill's workflow for that run. This
45+
authorization is limited to delegation; normal approval rules still govern file
46+
writes, commits, pushes, branch changes, design decisions, game-feel or balance
47+
decisions, and any agent not named by the workflow.
48+
4349
**When to spawn in parallel**: If two subagents' inputs are independent (neither
4450
needs the other's output to begin), spawn both Task calls simultaneously rather
4551
than waiting. Example: `/review-all-gdds` Phase 1 (consistency) and Phase 2
4652
(design theory) are independent — spawn both at the same time.
4753

54+
**Review-mode check**: Before spawning any director or lead gate, resolve the
55+
active review mode using `.opencode/docs/director-gates.md`. `solo` skips all
56+
director gates, `lean` runs only PHASE-GATE director gates, and `full` runs
57+
declared gates normally.
58+
59+
**Runtime fallback**: OpenCode's `Task` tool does not require per-spawn consent
60+
for agents already named by an invoked skill's workflow. If a surface still
61+
requires literal user consent before the first subagent spawn, ask one
62+
confirmation before spawning: "This skill declares [agents/gates]. May I spawn
63+
those role agents for this run?" If the user declines or delegation is
64+
unavailable, do not invent, summarize, or simulate specialist/director verdicts.
65+
Report the missing delegation as skipped or blocked, then continue only where
66+
the workflow allows a partial result.
67+
4868
### Agent Teams (experimental — opt-in)
4969
Multiple independent OpenCode *sessions* running simultaneously, coordinated
5070
via a shared task list. Each session has its own context window and token budget.
@@ -70,4 +90,5 @@ When an orchestration skill spawns multiple independent agents:
7090
1. Issue all independent Task calls before waiting for any result
7191
2. Collect all results before proceeding to dependent phases
7292
3. If any agent is BLOCKED, surface it immediately — do not silently skip
73-
4. Always produce a partial report if some agents complete and others block
93+
4. Never replace a blocked or skipped agent with an internal simulated verdict
94+
5. Always produce a partial report if some agents complete and others block

.opencode/docs/director-gates.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ the verdict using the **Verdict handling** rules below.
2828
Review intensity controls whether director gates run. It can be set globally
2929
(persists across sessions) or overridden per skill run.
3030

31+
Explicit invocation of a skill that references this document authorizes the
32+
director and lead subagent spawns declared by that skill, after review-mode
33+
filtering, for that run only. This authorization does not grant file-write,
34+
commit, push, branch-change, design-decision, game-feel, balance, or undeclared
35+
agent permission.
36+
3137
**Global config**: `production/review-mode.txt` — one word: `full`, `lean`, or `solo`.
3238
Set once during `/start`. Edit the file directly to change it at any time.
3339

@@ -47,6 +53,12 @@ Examples:
4753
| `lean` | PHASE-GATEs only (`/gate-check`) — per-skill gates skipped | **Default** — solo devs and small teams; directors review at milestones only |
4854
| `solo` | No director gates anywhere | Game jams, prototypes, maximum speed |
4955

56+
`--review full` means every gate declared by the invoked skill runs normally.
57+
For `/gate-check`, both `full` and `lean` run all declared PHASE-GATE directors:
58+
CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, and AD-PHASE-GATE. `solo` skips
59+
those directors and leaves the gate verdict based on artifact and quality checks
60+
only.
61+
5062
**Check pattern — apply before every gate spawn:**
5163

5264
```
@@ -62,6 +74,10 @@ Apply the resolved mode:
6274
- full → spawn as normal
6375
```
6476

77+
If the runtime still requires literal delegation consent before the first spawn,
78+
ask once for the agents/gates that survived review-mode filtering. If consent is
79+
denied, mark those gates skipped or blocked; do not simulate their verdicts.
80+
6581
---
6682

6783
## Invocation Pattern (copy into any skill)
@@ -76,6 +92,10 @@ Apply the resolved mode:
7692
- `lean`**skip unless this is a PHASE-GATE** (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE). Note: `[GATE-ID] skipped — Lean mode`
7793
- `full` → spawn as normal
7894

95+
After applying review mode, spawn only the gates declared by the invoked skill.
96+
Do not add adjacent reviewers, and do not replace skipped or unavailable gates
97+
with internal simulated verdicts.
98+
7999
```
80100
# Apply mode check, then:
81101
Spawn `[agent-name]` via Task:
@@ -765,6 +785,10 @@ introduced, or when a tech art decision affects visual style
765785
When a workflow requires multiple directors at the same checkpoint (most common
766786
at `/gate-check`), spawn all agents simultaneously:
767787

788+
`/gate-check` is the canonical PHASE-GATE workflow. In `lean` and `full` mode,
789+
all four PHASE-GATE directors below run unless the runtime blocks delegation. In
790+
`solo` mode, they are skipped.
791+
768792
```
769793
Spawn in parallel (issue all Task calls before waiting for any result):
770794
1. creative-director → gate CD-PHASE-GATE

.opencode/docs/session-continuity.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ history. Prefer small, current, file-backed state over broad transcripts.
55

66
## File Roles
77

8-
- `production/session-state/active.md`: live working checkpoint. Use for current
9-
task, progress checklist, decisions, files touched, open questions, and owed
10-
verification.
8+
- `production/session-state/active.md`: live working checkpoint and current
9+
session routing cache. Use for current task, progress checklist, decisions,
10+
files touched, open questions, owed verification, `## Session Worklist`, and
11+
`## Phase Guard`.
1112
- `production/session-handoff.md`: canonical resume narrative when a session has
1213
enough state that another session should continue from it.
1314
- `production/session-archive.md`: historical record only. Do not read by default
@@ -25,9 +26,17 @@ Before pausing a meaningful work unit:
2526

2627
1. Record what changed and what remains.
2728
2. Record verification that passed, failed, was blocked, or was not run.
28-
3. Preserve exact next commands only when they are known to be useful.
29-
4. Keep local-only notes out of tracked docs unless they are project state.
30-
5. Suggest `/handoff [short-label]` when installed and the next session would
29+
3. Read or refresh `## Session Worklist` in
30+
`production/session-state/active.md` and recommend the top valid lane.
31+
The final response must include completed work, verification or owed
32+
verification, and a numbered next-action prompt with exactly one
33+
`(Recommended)` option. Use this numeric fallback even when there is only one
34+
clear next lane:
35+
`Next action:` then `1. (Recommended) [action label] - [brief reason /
36+
command]`. The user can reply with `1`.
37+
4. Preserve exact next commands only when they are known to be useful.
38+
5. Keep local-only notes out of tracked docs unless they are project state.
39+
6. Suggest `/handoff [short-label]` when installed and the next session would
3140
otherwise need to reconstruct context.
3241

3342
## Resume Procedure
@@ -39,7 +48,8 @@ On resume:
3948
3. Read only the bounded files named by the handoff unless a deep audit is
4049
needed.
4150
4. Verify drift-prone claims cheaply before acting on them.
42-
5. Continue from the saved artifact unless there is a real inconsistency.
51+
5. Continue from the saved `## Session Worklist` unless there is a real
52+
inconsistency.
4353

4454
## Context Thresholds
4555

.opencode/skills/architecture-decision/SKILL.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,21 @@ If there are no remaining priority ADRs and no undesigned GDD systems, offer onl
455455
> assessment. Running it here would invalidate the review.
456456
457457
Update any stories that were `Status: Blocked` pending this ADR to `Status: Ready`.
458+
459+
460+
## Closeout Contract
461+
462+
Every final response from this skill must include completed work, verification
463+
run or owed verification, and next-lane routing. Read or refresh the
464+
`## Session Worklist` in `production/session-state/active.md` when present. End
465+
with a numbered next-action prompt using numeric format only, even when there is
466+
only one valid lane:
467+
468+
```md
469+
Next action:
470+
1. (Recommended) [action label] - [brief reason / command]
471+
```
472+
473+
If multiple lanes are viable, add more numbered options and keep exactly one
474+
`(Recommended)` option. The user can reply with `1`. Do not end with only a
475+
static command list.

.opencode/skills/architecture-review/SKILL.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,3 +664,21 @@ If any spawned agent returns BLOCKED, errors, or fails to complete:
664664
with grouped options — not a separate plain-text question per file.
665665
6. **Non-blocking** — the verdict is advisory; the user decides whether to continue
666666
despite CONCERNS or even FAIL findings
667+
668+
669+
## Closeout Contract
670+
671+
Every final response from this skill must include completed work, verification
672+
run or owed verification, and next-lane routing. Read or refresh the
673+
`## Session Worklist` in `production/session-state/active.md` when present. End
674+
with a numbered next-action prompt using numeric format only, even when there is
675+
only one valid lane:
676+
677+
```md
678+
Next action:
679+
1. (Recommended) [action label] - [brief reason / command]
680+
```
681+
682+
If multiple lanes are viable, add more numbered options and keep exactly one
683+
`(Recommended)` option. The user can reply with `1`. Do not end with only a
684+
static command list.

.opencode/skills/art-bible/SKILL.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,21 @@ After the art bible is approved:
248248
- Run `/design-system [first-system]` to start authoring per-system GDDs
249249
- Run `/consistency-check` once GDDs exist to validate them against the art bible's visual rules
250250
- Run `/create-architecture` to produce the master architecture document
251+
252+
253+
## Closeout Contract
254+
255+
Every final response from this skill must include completed work, verification
256+
run or owed verification, and next-lane routing. Read or refresh the
257+
`## Session Worklist` in `production/session-state/active.md` when present. End
258+
with a numbered next-action prompt using numeric format only, even when there is
259+
only one valid lane:
260+
261+
```md
262+
Next action:
263+
1. (Recommended) [action label] - [brief reason / command]
264+
```
265+
266+
If multiple lanes are viable, add more numbered options and keep exactly one
267+
`(Recommended)` option. The user can reply with `1`. Do not end with only a
268+
static command list.

.opencode/skills/asset-spec/SKILL.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,21 @@ Every phase follows: **Identify → Confirm → Generate → Review → Approve
351351

352352
- Run `/asset-spec [next-context]` to continue speccing remaining systems, levels, or characters
353353
- Run `/asset-audit` to validate delivered assets against the written specs and identify gaps or mismatches
354+
355+
356+
## Closeout Contract
357+
358+
Every final response from this skill must include completed work, verification
359+
run or owed verification, and next-lane routing. Read or refresh the
360+
`## Session Worklist` in `production/session-state/active.md` when present. End
361+
with a numbered next-action prompt using numeric format only, even when there is
362+
only one valid lane:
363+
364+
```md
365+
Next action:
366+
1. (Recommended) [action label] - [brief reason / command]
367+
```
368+
369+
If multiple lanes are viable, add more numbered options and keep exactly one
370+
`(Recommended)` option. The user can reply with `1`. Do not end with only a
371+
static command list.

.opencode/skills/brainstorm/SKILL.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,21 @@ After the game concept is written, follow the pre-production pipeline in order:
358358
5. `/create-architecture` — produce the master architecture blueprint
359359
6. `/architecture-review` — bootstrap TR registry and Requirements Traceability Matrix
360360
7. `/gate-check pre-production` — validate readiness before committing to production
361+
362+
363+
## Closeout Contract
364+
365+
Every final response from this skill must include completed work, verification
366+
run or owed verification, and next-lane routing. Read or refresh the
367+
`## Session Worklist` in `production/session-state/active.md` when present. End
368+
with a numbered next-action prompt using numeric format only, even when there is
369+
only one valid lane:
370+
371+
```md
372+
Next action:
373+
1. (Recommended) [action label] - [brief reason / command]
374+
```
375+
376+
If multiple lanes are viable, add more numbered options and keep exactly one
377+
`(Recommended)` option. The user can reply with `1`. Do not end with only a
378+
static command list.

0 commit comments

Comments
 (0)