Skip to content

Commit 32da724

Browse files
NagyViktNagyVikt
andauthored
Make plan handoffs copyable and claimable (#539)
Plan-backed work was blocked because role packets existed only as tasks and the existing submodule-aware plan was not registered in Colony. The scaffold now emits per-role prompt.md files in runtime, template, and frontend copies, and the existing plan is backfilled plus published as Colony subtasks. Constraint: Existing submodule-aware plan is already the SSOT; avoid regenerating role proposals/specs into the slim plan. Rejected: Re-run init-plan-workspace against existing plan | would create broad default role artifacts outside the requested prompt backfill. Confidence: high Scope-risk: narrow Directive: Keep runtime/template/frontend scaffold copies aligned when role artifact shape changes. Tested: bash -n scripts/openspec/init-plan-workspace.sh Tested: bash -n templates/scripts/openspec/init-plan-workspace.sh Tested: bash -n frontend/scripts/openspec/init-plan-workspace.sh Tested: node --test --test-name-pattern "OpenSpec plan workspace scaffold creates expected role/task structure" test/branch.test.js Tested: node --test --test-name-pattern=critical.*sync test/metadata.test.js Tested: openspec validate --specs Tested: openspec validate agent-claude-submodule-aware-gx-2026-05-07-18-46 --strict Related: Colony plan agent-claude-submodule-aware-gx-2026-05-07-18-46 task ids 47-52 Not-tested: full npm test Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
1 parent e521a0e commit 32da724

22 files changed

Lines changed: 692 additions & 1 deletion

File tree

frontend/scripts/openspec/init-plan-workspace.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ if [[ ! -f "$PLAN_DIR/README.md" ]]; then
6363
echo
6464
echo "Each role folder contains OpenSpec-style artifacts:"
6565
echo "- \`.openspec.yaml\`"
66+
echo "- \`prompt.md\` (copy/paste role prompt)"
6667
echo "- \`proposal.md\`"
6768
echo "- \`tasks.md\` (Spec / Tests / Implementation / Checkpoints checklists)"
6869
echo "- \`specs/<role>/spec.md\`"
@@ -86,6 +87,7 @@ Drive this plan from draft to execution-ready status with strict checkpoint disc
8687
- \`openspec/plan/${PLAN_SLUG}/summary.md\`
8788
- \`openspec/plan/${PLAN_SLUG}/checkpoints.md\`
8889
- \`openspec/plan/${PLAN_SLUG}/planner/plan.md\`
90+
- role \`prompt.md\` files for copy/paste helper startup
8991
- role \`tasks.md\` files for planner/architect/critic/executor/writer/verifier
9092
9193
## Coordinator responsibilities
@@ -258,6 +260,7 @@ Role workspace for \`${role}\`.
258260
259261
Default artifacts:
260262
- \`.openspec.yaml\`
263+
- \`prompt.md\`
261264
- \`proposal.md\`
262265
- \`tasks.md\`
263266
- \`specs/<role>/spec.md\`
@@ -278,12 +281,52 @@ plan: ${PLAN_SLUG}
278281
role: ${role}
279282
status: draft
280283
artifacts:
284+
prompt: prompt.md
281285
proposal: proposal.md
282286
tasks: tasks.md
283287
spec: specs/${ROLE_SPEC_SLUG}/spec.md
284288
ROLEYAMLEOF
285289
fi
286290

291+
if [[ ! -f "$ROLE_DIR/prompt.md" ]]; then
292+
cat > "$ROLE_DIR/prompt.md" <<ROLEPROMPTEOF
293+
# ${role} Prompt
294+
295+
You are the \`${role}\` role for OpenSpec plan \`${PLAN_SLUG}\`.
296+
297+
## Objective
298+
299+
Complete only this role's assigned checklist and leave compact evidence for the coordinator.
300+
301+
## Source of truth
302+
303+
- \`openspec/plan/${PLAN_SLUG}/summary.md\`
304+
- \`openspec/plan/${PLAN_SLUG}/checkpoints.md\`
305+
- \`openspec/plan/${PLAN_SLUG}/open-questions.md\`
306+
- \`openspec/plan/${PLAN_SLUG}/${role}/tasks.md\`
307+
- \`openspec/plan/${PLAN_SLUG}/${role}/proposal.md\`
308+
309+
## Before edits
310+
311+
1. Confirm branch/worktree with \`git status --short --branch\`.
312+
2. Claim every touched file before editing:
313+
- Prefer Colony \`task_claim_file\` when an active task exists.
314+
- Otherwise run \`gx locks claim --branch <agent-branch> <file...>\`.
315+
3. Stay inside assigned files/modules; coordinate before touching shared paths.
316+
317+
## Working rules
318+
319+
- Update \`${role}/tasks.md\` as each item completes.
320+
- Record durable unresolved questions in \`open-questions.md\`.
321+
- Keep handoffs short: files changed, behavior touched, verification, risks.
322+
- Do not revert another agent's edits.
323+
324+
## Cleanup
325+
326+
Only the owner/finalizer lane runs \`gx branch finish --branch <agent-branch> --base dev --via-pr --wait-for-merge --cleanup\`. If blocked, append \`BLOCKED:\` with branch, task, blocker, next, evidence.
327+
ROLEPROMPTEOF
328+
fi
329+
287330
if [[ ! -f "$ROLE_DIR/proposal.md" ]]; then
288331
cat > "$ROLE_DIR/proposal.md" <<ROLEPROPOSALEOF
289332
# Proposal: ${role} (${PLAN_SLUG})
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
base_root_hash: missing-spec-root
3+
slug: agent-claude-submodule-aware-gx-2026-05-07-18-46
4+
---
5+
6+
# CHANGE · agent-claude-submodule-aware-gx-2026-05-07-18-46
7+
8+
## §P proposal
9+
# Submodule-aware gx role plan
10+
11+
## Problem
12+
13+
The existing OpenSpec plan workspace for submodule-aware gx has role tasks and prompt packets in-repo, but Colony had no published claimable plan, so helper agents could not claim planner, architect, executor, critic, writer, and verifier lanes from the coordination surface.
14+
15+
## Acceptance criteria
16+
17+
- Colony exposes claimable role subtasks for the existing submodule-aware gx plan.
18+
- Each role subtask points to its plan prompt.md and tasks.md packet plus owned implementation files where applicable.
19+
- Downstream agents claim files before edits and record verification or blockers in the role task handoff fields.
20+
21+
## Sub-tasks
22+
23+
### Sub-task 0: Planner: freeze submodule-aware gx plan
24+
25+
Use planner/prompt.md and planner/tasks.md to finish spec/open-question planning for the existing submodule-aware gx plan. Keep durable questions in the plan workspace and hand off execution boundaries.
26+
27+
File scope: openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/planner/tasks.md, openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/planner/prompt.md
28+
29+
### Sub-task 1: Architect: review lifecycle boundaries
30+
31+
Use architect/prompt.md and architect/tasks.md to validate submodule lifecycle boundaries, manifests, token preflight, and failure modes before implementation.
32+
33+
File scope: openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/architect/tasks.md, openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/architect/prompt.md
34+
35+
### Sub-task 2: Executor: implement submodule-aware gx (depends on: 0, 1)
36+
37+
Use executor/prompt.md and executor/tasks.md to add tests first, then implement submodule detection, lock tuple keying, start/finish wiring, and gx subcommands inside the approved scope.
38+
39+
File scope: openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/executor/tasks.md, openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/executor/prompt.md, scripts/agent-submodules.py, scripts/agent-branch-start.sh, scripts/agent-branch-finish.sh, scripts/agent-file-locks.py, scripts/codex-agent.sh, bin/gx, test/agent-submodules-detect.test.js, test/agent-submodules-locks.test.py, test/agent-submodules-finish.test.js, test/agent-submodules-preflight.test.js
40+
41+
### Sub-task 3: Quality review: stress-test executor diff (depends on: 2)
42+
43+
Use critic/prompt.md and critic/tasks.md to review executor output for unclaimed edits, stranded submodule writes, atomic gitlink bump correctness, and missing negative scenarios.
44+
45+
File scope: openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/critic/tasks.md, openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/critic/prompt.md
46+
47+
### Sub-task 4: Writer: sync operator docs/context (depends on: 2, 3)
48+
49+
Use writer/prompt.md and writer/tasks.md to update only approved user-facing workflow docs/context after implementation behavior is final.
50+
51+
File scope: openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/writer/tasks.md, openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/writer/prompt.md, AGENTS.md, README.md, openspec/specs/gitguardex-submodules/context.md
52+
53+
### Sub-task 5: Verifier: prove submodule-aware lifecycle (depends on: 3, 4)
54+
55+
Use verifier/prompt.md and verifier/tasks.md to run OpenSpec, focused node/python tests, and the approved walkthrough proof or record exact blockers.
56+
57+
File scope: openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/verifier/tasks.md, openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/verifier/prompt.md
58+
59+
60+
## §S delta
61+
op|target|row
62+
-|-|-
63+
64+
## §T tasks
65+
id|status|task|cites
66+
-|-|-|-
67+
68+
## §B bugs
69+
id|status|task|cites
70+
-|-|-|-

openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Use this command to update checkpoints:
88
/opsx:checkpoint agent-claude-submodule-aware-gx-2026-05-07-18-46 <role> <checkpoint-id> <state> <note...>
99
```
1010

11-
Roles (each has its own `tasks.md`):
11+
Roles (each has its own `tasks.md` and copyable `prompt.md`):
1212

1313
- `planner/` — owns spec + open-questions
1414
- `architect/` — owns manifest schema + failure catalog
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# architect Prompt
2+
3+
You are the `architect` role for OpenSpec plan `agent-claude-submodule-aware-gx-2026-05-07-18-46`.
4+
5+
## Objective
6+
7+
Complete only this role's assigned checklist and leave compact evidence for the coordinator.
8+
9+
## Source of truth
10+
11+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/summary.md`
12+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/checkpoints.md`
13+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/open-questions.md`
14+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/architect/tasks.md`
15+
16+
## Before edits
17+
18+
1. Confirm branch/worktree with `git status --short --branch`.
19+
2. Claim every touched file before editing:
20+
- Prefer Colony `task_claim_file` when an active task exists.
21+
- Otherwise run `gx locks claim --branch <agent-branch> <file...>`.
22+
3. Stay inside assigned files/modules; coordinate before touching shared paths.
23+
24+
## Working rules
25+
26+
- Update `architect/tasks.md` as each item completes.
27+
- Record durable unresolved questions in `open-questions.md`.
28+
- Keep handoffs short: files changed, behavior touched, verification, risks.
29+
- Do not revert another agent's edits.
30+
31+
## Cleanup
32+
33+
Only the owner/finalizer lane runs `gx branch finish --branch <agent-branch> --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# critic Prompt
2+
3+
You are the `critic` role for OpenSpec plan `agent-claude-submodule-aware-gx-2026-05-07-18-46`.
4+
5+
## Objective
6+
7+
Complete only this role's assigned checklist and leave compact evidence for the coordinator.
8+
9+
## Source of truth
10+
11+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/summary.md`
12+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/checkpoints.md`
13+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/open-questions.md`
14+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/critic/tasks.md`
15+
16+
## Before edits
17+
18+
1. Confirm branch/worktree with `git status --short --branch`.
19+
2. Claim every touched file before editing:
20+
- Prefer Colony `task_claim_file` when an active task exists.
21+
- Otherwise run `gx locks claim --branch <agent-branch> <file...>`.
22+
3. Stay inside assigned files/modules; coordinate before touching shared paths.
23+
24+
## Working rules
25+
26+
- Update `critic/tasks.md` as each item completes.
27+
- Record durable unresolved questions in `open-questions.md`.
28+
- Keep handoffs short: files changed, behavior touched, verification, risks.
29+
- Do not revert another agent's edits.
30+
31+
## Cleanup
32+
33+
Only the owner/finalizer lane runs `gx branch finish --branch <agent-branch> --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# executor Prompt
2+
3+
You are the `executor` role for OpenSpec plan `agent-claude-submodule-aware-gx-2026-05-07-18-46`.
4+
5+
## Objective
6+
7+
Complete only this role's assigned checklist and leave compact evidence for the coordinator.
8+
9+
## Source of truth
10+
11+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/summary.md`
12+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/checkpoints.md`
13+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/open-questions.md`
14+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/executor/tasks.md`
15+
16+
## Before edits
17+
18+
1. Confirm branch/worktree with `git status --short --branch`.
19+
2. Claim every touched file before editing:
20+
- Prefer Colony `task_claim_file` when an active task exists.
21+
- Otherwise run `gx locks claim --branch <agent-branch> <file...>`.
22+
3. Stay inside assigned files/modules; coordinate before touching shared paths.
23+
24+
## Working rules
25+
26+
- Update `executor/tasks.md` as each item completes.
27+
- Record durable unresolved questions in `open-questions.md`.
28+
- Keep handoffs short: files changed, behavior touched, verification, risks.
29+
- Do not revert another agent's edits.
30+
31+
## Cleanup
32+
33+
Only the owner/finalizer lane runs `gx branch finish --branch <agent-branch> --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# planner Prompt
2+
3+
You are the `planner` role for OpenSpec plan `agent-claude-submodule-aware-gx-2026-05-07-18-46`.
4+
5+
## Objective
6+
7+
Complete only this role's assigned checklist and leave compact evidence for the coordinator.
8+
9+
## Source of truth
10+
11+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/summary.md`
12+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/checkpoints.md`
13+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/open-questions.md`
14+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/planner/tasks.md`
15+
16+
## Before edits
17+
18+
1. Confirm branch/worktree with `git status --short --branch`.
19+
2. Claim every touched file before editing:
20+
- Prefer Colony `task_claim_file` when an active task exists.
21+
- Otherwise run `gx locks claim --branch <agent-branch> <file...>`.
22+
3. Stay inside assigned files/modules; coordinate before touching shared paths.
23+
24+
## Working rules
25+
26+
- Update `planner/tasks.md` as each item completes.
27+
- Record durable unresolved questions in `open-questions.md`.
28+
- Keep handoffs short: files changed, behavior touched, verification, risks.
29+
- Do not revert another agent's edits.
30+
31+
## Cleanup
32+
33+
Only the owner/finalizer lane runs `gx branch finish --branch <agent-branch> --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# verifier Prompt
2+
3+
You are the `verifier` role for OpenSpec plan `agent-claude-submodule-aware-gx-2026-05-07-18-46`.
4+
5+
## Objective
6+
7+
Complete only this role's assigned checklist and leave compact evidence for the coordinator.
8+
9+
## Source of truth
10+
11+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/summary.md`
12+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/checkpoints.md`
13+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/open-questions.md`
14+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/verifier/tasks.md`
15+
16+
## Before edits
17+
18+
1. Confirm branch/worktree with `git status --short --branch`.
19+
2. Claim every touched file before editing:
20+
- Prefer Colony `task_claim_file` when an active task exists.
21+
- Otherwise run `gx locks claim --branch <agent-branch> <file...>`.
22+
3. Stay inside assigned files/modules; coordinate before touching shared paths.
23+
24+
## Working rules
25+
26+
- Update `verifier/tasks.md` as each item completes.
27+
- Record durable unresolved questions in `open-questions.md`.
28+
- Keep handoffs short: files changed, behavior touched, verification, risks.
29+
- Do not revert another agent's edits.
30+
31+
## Cleanup
32+
33+
Only the owner/finalizer lane runs `gx branch finish --branch <agent-branch> --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# writer Prompt
2+
3+
You are the `writer` role for OpenSpec plan `agent-claude-submodule-aware-gx-2026-05-07-18-46`.
4+
5+
## Objective
6+
7+
Complete only this role's assigned checklist and leave compact evidence for the coordinator.
8+
9+
## Source of truth
10+
11+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/summary.md`
12+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/checkpoints.md`
13+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/open-questions.md`
14+
- `openspec/plan/agent-claude-submodule-aware-gx-2026-05-07-18-46/writer/tasks.md`
15+
16+
## Before edits
17+
18+
1. Confirm branch/worktree with `git status --short --branch`.
19+
2. Claim every touched file before editing:
20+
- Prefer Colony `task_claim_file` when an active task exists.
21+
- Otherwise run `gx locks claim --branch <agent-branch> <file...>`.
22+
3. Stay inside assigned files/modules; coordinate before touching shared paths.
23+
24+
## Working rules
25+
26+
- Update `writer/tasks.md` as each item completes.
27+
- Record durable unresolved questions in `open-questions.md`.
28+
- Keep handoffs short: files changed, behavior touched, verification, risks.
29+
- Do not revert another agent's edits.
30+
31+
## Cleanup
32+
33+
Only the owner/finalizer lane runs `gx branch finish --branch <agent-branch> --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Architect
2+
3+
Plan: `agent-claude-submodule-aware-gx-2026-05-07-18-46`
4+
5+
## Responsibility
6+
7+
Check boundaries, data flow, interfaces, and rollback shape.
8+
9+
## Checkpoints
10+
11+
- [ ] Read `plan.md`, `tasks.md`, and `checkpoints.md`.
12+
- [ ] Record decisions or blockers in the plan workspace before handoff.
13+
- [ ] Keep task-thread status aligned with local files.

0 commit comments

Comments
 (0)