scope
Skill2 starsChanged 9 months agoMITView on GitHub
Interactive planning + orchestration. Approval-gated workflow covering saga→epic→task hierarchy via progressive scoping.
- Deletes or force-pushes
- Commits and pushes
25 other projects use a version of this.
Adopted by
Most recently taken up by
- thekinv21/NotificationServicetheir own version, first seen Oct 3, 2026
- klmiing1229-a11y/scopetheir own version, first seen Oct 2, 2026
- thekinv21/RBAC_Authenticationtheir own version, first seen Oct 1, 2026
- eliphazbouye/skillstheir own version, first seen Sep 30, 2026
- Nagacash/naga-codex-skillstheir own version, first seen Sep 25, 2026
- shammlo/zoth-skillstheir own version, first seen Sep 24, 2026
Used with
Projects with it also use develop, document and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
bamechoSkilldevelop
开发实施阶段详细规则;进入开发实施时读取;包含执行流程、代码规范、一致性审计、方案包迁移
Also in 6 projects that use this
nicolasestremSkilldocument
Create focused documentation for specific components or features
Also in 5 projects that use this
MicrosoftSkillsync
Sync the current session branch with its upstream branch, or publish the current session branch to a remote. Use when the user asks to sync a branch, pull latest changes, rebase onto upstream, push current branch, publish branch, or set upstream.
Also in 6 projects that use this
kt057Skillcheck
lint, typecheck, test を一括実行して結果をサマリーする
Also in 5 projects that use this
jdonohooSkillarchitect
Architect Vern - Systems design, scalable architecture, production-grade thinking. The blueprints before the build.
Also in 8 projects that use this
AnthropicSkilldebug
Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.
Also in 9 projects that use this
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 25
- jsmastery-pro/skills★ 1.4ksame name
- suboss87/FDEOps★ 950same name
- AlexZio00/sovereign-skills★ 138same name
- crisandrews/ClawCode★ 63same name
- Dan-Cleary/fdestack★ 46same name
- ConnorGriffin/skills★ 22same name
- chrisallenlane/claude-swe-workflows★ 18same name
- jsmastery-pro/pilot★ 8same name
- WhorideChicken/first-playable★ 3same name
- envisioning/skills★ 2same name
15 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- affirmationSkill
- auditSkill
- councilSkill
- doSkill
- gitSkill
- infoSkill
- kill-playgroundSkill
- memorySkill
- mergeSkill
- opsSkill
- qSkill
- refineSkill
- runSkill
- sim-sourceSkill
- stateSkill
- thinkSkill
- ui-brainSkill
- worktree-managerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
79 rules. 0 are common, 35 are distinctive, and 44 are very specific to this project.
0
Common
Most of the 24 edited versions we read keep these.
35
Distinctive
This author's own choices. Worth a look.
44
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Every gate = Review Card. User must approve before proceeding.
- Very specific: line 61
Always full deliberation (4-7 personas).
- Very specific: line 74
Call mcp__state__session_resume(skill: "scope", repo: {cwd}) — checks for ANY active scope session.
- Very specific: line 75
If found → use the session's scope field (the initiative slug) to go straight to the right roadmap.
- Distinctive: line 76
If not found → fall through to normal roadmap scan / SCOPE.md detection.
- Distinctive: line 157
When presenting multiple items at same level (e.g., 8 tasks):
- Very specific: line 168
After 3 → suggest: (o) open in IDE for manual edit
- Distinctive: line 169
Never re-plan already-approved items
- Very specific: line 182
Loading: When an abstract action is needed (e.g., "create tracking ticket"), check config.yml.
- Very specific: line 195
First-run detection: If .ai-plans/config.yml doesn't exist, auto-detect available CLIs (gh, linear, jira), ask user which to activate, …
- Very specific: line 236
Create epic branch: git checkout main && git pull && git checkout -b epic/{slug}
- Distinctive: line 237
Commit roadmap to main
- Very specific: line 238
If integration configured: create tracking ticket, create draft PR linking to roadmap, add to project board in Planning status.
- Distinctive: line 239
Ensure relay is running (see Relay section)
- Very specific: line 269
Create stage branch: git checkout -b {prefix}/{slug}/{stage-slug}
- Very specific: line 271
Write task instruction files to .ai-queue/:
- Very specific: line 283
Update roadmap: stage status → in-progress, phase → execute
- Very specific: line 287
Dependency markers: Add <!-- depends-on: NNN --> upfront when task ordering matters.
- Distinctive: line 295
Verify workers are running: Check relay for connected workers.
- Distinctive: line 300
Do NOT proceed to implement the tasks yourself.
- Very specific: line 341
Completion: All tasks archived in _completed/ → proceed to VERIFY.
- Distinctive: line 427
Cleanup: Update roadmap status. Commit.
- Distinctive: line 487
Create epic branch, run the full SCOPE → BREAKDOWN → EXECUTE → VERIFY → ADVANCE → SHIP cycle.
- Distinctive: line 557
Read roadmap to determine current stage, total task count, and stage issue number.
- Very specific: line 562
If workers disconnect (no progress for 2+ cycles), re-send work-queued via relay
- Very specific: line 564
All tasks moved to _completed/ → proceed to Phase B
- Very specific: line 575
After clean completes, resume as if /scope watch was called fresh:
- Very specific: line 577
If phase is still execute and tasks remain → return to Phase A (monitor again)
- Very specific: line 578
If all tasks complete → transition to VERIFY — run build/lint/test, check acceptance criteria
- Very specific: line 592
Use the /loop skill pattern internally — but /scope watch is a single invocation, not recurring.
- Distinctive: line 596
No user interaction during Phase A/B: Only Phase C (VERIFY gate) requires approval.
- Distinctive: line 597
Re-send relay events: if workers appear stalled (no new completions for 2+ minutes).
- Distinctive: line 598
9-minute ceiling is soft: If 6/7 tasks done at 9 min, extend 3 min automatically.
- Very specific: line 599
Phase B is mandatory: Never skip /scope clean after workers finish, even if all tasks completed quickly.
- Distinctive: line 600
Phase C re-evaluates: After clean, re-read roadmap state — don't assume tasks are still complete.
- Distinctive: line 618
Update all local tracking branches to match their remote counterparts, then sync epic branches with main:
- Very specific: line 638
Update roadmap current_epic/current_stage/phase frontmatter to reflect actual state.
- Distinctive: line 639
Commit roadmap changes if any.
- Very specific: line 644
If roadmap has Issue: #N — verify issue exists, has correct label (epic/stage), is open/closed appropriately (done → closed, in-progress → …
- Distinctive: line 645
If roadmap has NO issue reference — create missing issue, link to parent, add label, set board status, write issue # back to roadmap
- Distinctive: line 646
Verify epic issue body lists all stages in checklist format
- Distinctive: line 647
Verify saga issue body lists all epics in checklist format
- Very specific: line 653
Create the epic PR targeting main from epic/{slug}
- Distinctive: line 657
Write PR number back to roadmap metadata
- Distinctive: line 658
If epic PR exists: Verify PR body has all stages in checklist format
- Distinctive: line 691
No user interaction. Fix everything, report at end.
- Very specific: line 692
Read config.yml for integration.
- Very specific: line 693
Read integrations/github.md for concrete commands.
- Distinctive: line 717
Apply changes: Write updated roadmap. Preserve all execution metadata: PR numbers, issue IDs, iteration counts, checkmarks.
- Distinctive: line 736
Do NOT delete branches, roadmaps, or completed work.
- Distinctive: line 739
If integration: close ticket with "Aborted.
- Very specific: line 759
Ensure .gitignore contains these entries (append if missing, don't duplicate):
- Very specific: line 772
If SCOPE.md doesn't exist at repo root, create it empty.
- Very specific: line 776
If .ai-plans/config.yml doesn't exist:
- Very specific: line 783
If gh is available and authenticated (gh auth status):
- Very specific: line 785
Ask user for project_number (or skip if no project board)
- Very specific: line 786
If project_number provided: resolve project_node_id, status_field_id, status_options via:
- Very specific: line 790
Ensure labels exist: gh label create epic --repo OWNER/REPO 2>/dev/null || true (repeat for saga, stage)
- Very specific: line 792
If no CLI detected: write config.yml with integrations: []
- Very specific: line 794
If .ai-plans/config.yml exists: validate it (same as config validation on every run).
- Distinctive: line 798
Start the relay if not running (standard relay startup sequence).
- Distinctive: line 820
Never destructive — never overwrites existing config, roadmaps, or queue files.
- Distinctive: line 821
Only asks one question: project board number (if GitHub detected and no config exists).
- Very specific: line 822
If config exists but is incomplete (e.g., missing status_options), auto-resolve the missing fields without asking.
- Distinctive: line 833
If one → resume: read YAML frontmatter → determine current phase → re-enter flow at correct gate
- Very specific: line 834
If multiple → AskUserQuestion which to resume
- Very specific: line 835
If SCOPE.md has content → read contents into $GOAL, immediately empty SCOPE.md, then AskUserQuestion: resume active initiative or start new …
- Very specific: line 836
No active roadmap: Check SCOPE.md at repo root
- Distinctive: line 839
Ensure relay is running
- Very specific: line 886
Auto-store on Review Card rejection: When user responds n + feedback containing a directive (negation, "don't", "always", "never", …
- Very specific: line 888
Attribution: When a recalled memory influences a decision, annotate the bullet in the Review Card with [mem:short-name].
- Distinctive: line 907
Never execute without approval: Every gate requires a review card.
- Distinctive: line 910
Brevity in cards: No paragraphs. Bullets only.
- Very specific: line 912
Progressive disclosure: Default = compressed. Detail on demand via ?
- Distinctive: line 918
Relay required: No fallback polling — relay must be running for worker coordination.
- Very specific: line 919
Integration side-effects are mandatory: When config.yml lists an integration, every ADVANCE and SHIP phase MUST execute all side-effects …
- Very specific: line 920
Labels are mandatory: Every saga issue gets saga label.
- Very specific: line 921
Checklist links are mandatory: When checking off a stage in an epic PR/issue body, or an epic in a saga issue body, ALWAYS include the PR …
- Distinctive: line 923
Verify after every side-effect: After updating a PR body, issue body, or board status, re-read the target to confirm the change took effect.
“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Scope
Interactive, approval-gated planning and orchestration. Every unit of work is reviewed before creation and before merge.
/scope {goal} — start new initiative
/scope — resume active initiative; if none, read SCOPE.md (non-empty) from repo root
/scope setup — scaffold repo for scope + q workflows (run once per repo)
/scope status — show hierarchy dashboard
/scope update — modify an active roadmap
/scope watch — monitor workers, verify tracking, then auto-resume
/scope clean — audit + fix all PM tracking (roadmap, issues, PRs, board)
/scope abort — abort (preserves all work)Flow
SCOPE → BREAKDOWN → EXECUTE → VERIFY → ADVANCE
↑ ↑ ↑ ↑ ↑
gate gate (q runs) gate gateEvery gate = Review Card. User must approve before proceeding.
Scope Detection
Determine hierarchy depth from the goal:
| Scope | Detection | Flow |
| Small | Single task, clear files | Skip to EXECUTE |
| Medium | Multi-stage, one epic | BREAKDOWN into tasks |
| Large | Multi-epic initiative | SCOPE into epics first |
Always announce: "Detected {scope} scope. {plan}."
User can override: "Actually, just one epic."
Council Integration (Mandatory)
/council is the quality firewall. Invoke via the Skill tool at these points:
- SCOPE phase:
/council {goal} --subroutine— full deliberation on initiative design - BREAKDOWN phase:
/council "Plan stage: {title}" --subroutine— per-stage approach
Always full deliberation (4-7 personas). --subroutine returns the plan directly without user interaction — /scope handles all user gates via Review Cards.
State
Session persistence (state MCP)
In addition to the roadmap file, /scope registers with the state MCP server for cross-conversation session tracking.
Scope key: skill: "scope", repo: {cwd}, scope: {slug} (the initiative slug — allows parallel initiatives).
On startup (before roadmap scan):
- Call
mcp__state__session_resume(skill: "scope", repo: {cwd})— checks for ANY active scope session. - If found → use the session's
scopefield (the initiative slug) to go straight to the right roadmap. Skip the.ai-plans/scan + user disambiguation. - If not found → fall through to normal roadmap scan / SCOPE.md detection.
On SCOPE approval: mcp__state__session_start(skill: "scope", repo: {cwd}, scope: {slug})
At each phase transition (BREAKDOWN, EXECUTE, VERIFY, ADVANCE, SHIP): mcp__state__session_checkpoint(session_id, phase: {phase}, state_json: {slug, current_epic, current_stage}, git_ref: {HEAD SHA if commit was made})
On SHIP (all epics done): mcp__state__session_complete(session_id)
On abort: mcp__state__session_abandon(session_id)
The roadmap file remains the source of truth for initiative structure. The session DB is a fast-path index for "what's active?" and "where was I?"
Roadmap file
Single roadmap file per initiative: .ai-plans/{slug}/roadmap.md
---
slug: {slug}
status: scoping | planning | in-progress | verifying | done | aborted
scope: small | medium | large
created: YYYY-MM-DD
current_epic: 1
current_stage: 1
phase: scope | breakdown | execute | verify | advance
---
# {Title}
## Overview
{Goals, scope, key decisions — from council}
## Metadata
- **Epic branch:** epic/{slug}
- **PR:** #{N}
- **Created:** YYYY-MM-DD
- **Integrations:** {from config.yml or "none"}
- **Risk summary:** {from council}
## Epic 1: {title}
**Status:** pending | in-progress | done
### Stage 1.1: {title}
**Status:** pending | in-progress | done
**Branch:** feat/{slug}/{stage-slug}
**Acceptance criteria:**
- [ ] {criterion}
**Tasks:**
- [ ] {task description} → {files}Committed to git — survives /clear. Everything else is derived.
For small scope (single task): roadmap has no epics/stages — just a task section. For medium scope (single epic): roadmap has stages but no epic grouping.
The Review Card
Universal format at every gate, every level. Use AskUserQuestion to present.
[LEVEL] Title
─────────────────────────────
Summary: • bullet 1 • bullet 2 • bullet 3
Scope: files/areas affected
SoW: what the AI will do if approved (one line, active voice)
Risk: one line
(y) approve (n) reject + feedback (?) expand (o) open in IDERules
- ≤7 lines default view. Scannable in <5 seconds.
?expands: acceptance criteria, alternatives considered, full detail?3drills into item 3[LEVEL]prefix:[SAGA],[EPIC],[STAGE],[TASK]- Auto-expand for
highrisk items
Batch Review
When presenting multiple items at same level (e.g., 8 tasks):
- Show numbered list (one line each)
- Options:
(a)approve all,(1-8)drill into one,(w)walkthrough sequentially - Batch summary highlights outliers (highest risk, largest scope)
Rejection Flow
User responds n + feedback:
- Refine ONLY the rejected item
- Re-present its card
- Max 3 iterations per item
- After 3 → suggest:
(o)open in IDE for manual edit - Never re-plan already-approved items
Integrations
Core scope is PM-agnostic. Integrations are optional plugins that map abstract actions to concrete CLI commands.
Config: .ai-plans/config.yml
integrations: [github] # or: [] or omit entirelyLoading: When an abstract action is needed (e.g., "create tracking ticket"), check config.yml. If an integration is listed, read ~/.claude/skills/scope/integrations/{name}.md for the concrete commands. If no integration configured → skip the action silently.
Abstract actions (referenced throughout phases):
create-ticket— create a tracking issue/ticketcreate-pr— create a draft PR (git fallback:gh pr create --draft)link-ticket— link a sub-ticket to a parentclose-ticket— close a ticket with commentmove-status— update ticket status on a boardupdate-epic-pr— check off completed stage in epic PR bodyupdate-epic-issue— check off completed stage in epic issue bodyupdate-saga-issue— check off completed epic in saga issue bodymove-to-done— move issue to Done on project board
First-run detection: If .ai-plans/config.yml doesn't exist, auto-detect available CLIs (gh, linear, jira), ask user which to activate, write config. Subsequent runs read config directly.
Config validation (every run): When config.yml lists an integration (e.g., github), verify the config block is complete. For GitHub: owner, repo, project_number, project_node_id, status_field_id, status_options must all be present. If missing → resolve field IDs via gh project field-list and write them. Never proceed with a half-configured integration — it causes silent side-effect failures in ADVANCE and SHIP.
Phase 1: SCOPE
- Invoke
/council {goal} --subroutinevia theSkilltool — full deliberation - Parse council output — extract plan steps, key decisions, risks
- Detect scope (small/medium/large) from council's plan structure
- Present Review Card:
For large scope (multi-epic):
[SAGA] {Title}
─────────────────────────────
Summary: • {what} • {why} • {approach}
Scope: {packages/areas affected}
SoW: Break into {N} epics, execute sequentially
Risk: {from council risk summary}
(y) approve (n) reject + feedback (?) expandFor medium scope (single epic):
[EPIC] {Title}
─────────────────────────────
Summary: • {what} • {why}
Scope: {areas affected}
SoW: Break into {N} stages
Risk: {one line}
(y) approve (n) reject + feedback (?) expandFor small scope: present a [TASK] card and skip directly to EXECUTE.
- On approval:
- Create
.ai-plans/{slug}/roadmap.md - Create epic branch:
git checkout main && git pull && git checkout -b epic/{slug} - Commit roadmap to main
- If integration configured: create tracking ticket, create draft PR linking to roadmap, add to project board in Planning status. Otherwise:
gh pr create --draft - Ensure relay is running (see Relay section)
- Proceed to BREAKDOWN for first stage (or EXECUTE for small scope)
- Create
Phase 2: BREAKDOWN (per stage)
- Invoke
/council "Plan stage: {title}" --subroutine— deliberation on approach - Research the codebase — read relevant files, understand current state
- Segment into file-disjoint tasks — each task touches different files (parallel-safe)
- Present batch Review Card:
Stage {N}: {title} — {count} tasks
─────────────────────────────
1. {task title} — {files}
2. {task title} — {files}
3. {task title} — {files}
4. Integration task — {wiring}
(a) approve all (1-4) drill into one (w) walkthrough- On approval:
- Sync local epic branch before branching:
git fetch origin epic/{slug} git checkout epic/{slug} git reset --hard origin/epic/{slug} - Create stage branch:
git checkout -b {prefix}/{slug}/{stage-slug} - Integration: create stage sub-ticket —
create-ticketfor the stage, linking to parent epic issue. Add to project board in Todo status. - Write task instruction files to
.ai-queue/:<!-- auto-queue --> <!-- target-branch: {prefix}/{slug}/{stage-slug} --> <!-- no-merge --> <!-- depends-on: NNN --> # Task: {title} {Implementation instructions with file paths and acceptance criteria}<!-- no-merge -->is mandatory./scopeowns all merges — workers must never self-merge. - Integration: move stage ticket to In Progress on board
- Send
work-queuedevent via relay - Update roadmap: stage status →
in-progress, phase →execute
- Sync local epic branch before branching:
Branch prefix: feat/, fix/, chore/, or docs/ based on stage nature.
Dependency markers: Add <!-- depends-on: NNN --> upfront when task ordering matters. Workers respect these — a task with unmet dependencies stays pending.
Phase 3: EXECUTE
The orchestrator does NOT implement. Workers (/q) claim and execute tasks in worktrees. The orchestrator owns all merges — workers never self-merge (enforced by <!-- no-merge --> directive).
- Verify workers are running. Check relay for connected workers. If none:
Do NOT proceed to implement the tasks yourself. Wait.⚠ No workers connected. Start /q in 1-3 separate terminals to begin execution. Waiting for workers... Monitor + Merge loop. Listen for relay events:
task-ready,task-completed,worker-disconnected.On
task-readyevent: A worker has committed and is waiting for merge. The orchestrator merges sequentially:a. Scan
.ai-queue/for active task files (XXX-active.md). Read<!-- worktree: ... -->and<!-- branch: ... -->headers to identify the ready branch.b. Merge the worker's branch to the target branch:
TARGET={target-branch from task file} WORKER_BRANCH=q-{NNN} cd {repo-root} git checkout $TARGET git fetch origin $TARGET 2>/dev/null || true git rebase origin/$TARGET 2>/dev/null || true # Rebase worker branch onto latest target git checkout $WORKER_BRANCH git rebase $TARGET git checkout $TARGET # Merge with merge commit git merge --no-ff $WORKER_BRANCH -m "merge: $WORKER_BRANCH {task-title}" git push origin $TARGETc. Send
merge-done:{NNN}event via relay (unblocks the worker to clean up):node -e " const s = require('net').connect(process.argv[1]); s.write(JSON.stringify({type:'event',event:process.argv[2]})+'\n'); setTimeout(() => s.destroy(), 500); " "$RELAY_SOCK" "merge-done:{NNN}"d. On merge conflict: skip this task, log the conflict, continue with other
task-readyevents. Report conflicts at VERIFY.- Print progress:
[{completed}/{total}] Stage {N}: {title} - Completion: All tasks archived in
_completed/→ proceed to VERIFY.
Phase 4: VERIFY
- Checkout the stage branch. Pull latest.
- Run verification:
npm run build,npm run lint,npm test(or project equivalents) - Check acceptance criteria from roadmap — check off each that passes
- Present Review Card:
[VERIFY] Stage {N}: {title}
─────────────────────────────
Summary: • {N}/{M} criteria pass • {build/lint/test status}
Scope: {files changed in this stage}
SoW: Merge stage to epic branch (or iterate on failures)
Risk: {assessment}
(y) approve + advance (n) reject + feedback (?) expand- All pass + approved → ADVANCE
- Failures → ITERATE: analyze failures, write fix tasks to
.ai-queue/, sendwork-queued, return to EXECUTE - Iteration limit: 5 per stage, 20 total across all stages. Exceeding → present card explaining failures, ask user.
Phase 5: ADVANCE
Protocol: Read
references/branch-protocol.mdbefore creating any PR. Stage PRs MUST targetepic/{slug}, nevermain.
- Validate PR target — assert base branch is
epic/{slug}, sync local:BASE="epic/${SLUG}" git fetch origin "$BASE" || { echo "ERROR: epic branch $BASE not found"; exit 1; } git checkout "$BASE" git reset --hard "origin/$BASE" - Create stage PR to epic branch:
gh pr create --base epic/{slug} --head {prefix}/{slug}/{stage-slug} \ --title "Stage {N}: {title}" --body "Closes stage {N} of {slug}" - Merge stage PR:
gh pr merge --merge --delete-branch - Update roadmap: Mark stage done (criteria already checked from VERIFY).
- Integration side-effects (mandatory when configured):
update-epic-pr— check off- [x] Stage {N}: {title} (#{stage_pr})in epic PR bodyclose-ticket— close the stage sub-issue with "Completed."move-to-done— move stage sub-issue to Done on project board
- More stages? → BREAKDOWN for next stage. All stages done? → SHIP.
SHIP (epic complete)
- Rebase epic branch on main:
git checkout epic/{slug} && git fetch origin main && git rebase origin/main git push --force-with-lease origin epic/{slug} - Present final Review Card:
[SHIP] {Epic title} ───────────────────────────── Summary: • {stages completed} • {key outcomes} Scope: {total files changed} SoW: Merge epic/{slug} to main Risk: {one line} (y) merge (n) hold (?) expand with full diff - On approval: Mark PR ready for review. Wait for CI. If green → merge.
- Integration side-effects (mandatory when configured):
update-saga-issue— check off- [x] Epic {N}: {title} (#{epic_pr})in saga issue bodyupdate-epic-pr— verify all stages checked off in epic PR body (should already be done in ADVANCE)move-to-done— move epic PR to Done on project board (epics go from Planning → Done, never In Progress)
- Cleanup: Update roadmap status. Commit.
- Multi-epic: proceed to next epic's BREAKDOWN instead of sending
epic-done. - All epics done: send
epic-donevia relay. Move saga issue + saga PR to Done on board. Print summary.
Multi-Epic Mode
For broad goals that decompose into multiple epics.
Planning (multi-epic)
Council is invoked once for the full initiative. The reconciled plan identifies natural epic boundaries. Scope converts these into the multi-epic roadmap format.
For each epic, council may be re-invoked for detailed stage planning:
- Simple epic (1-2 stages) → derive stages directly from council plan
- Complex epic (3+ stages) →
/council "Detail stages for epic: {title}" --subroutine
Roadmap format (multi-epic)
---
slug: {slug}
status: in-progress
scope: large
created: YYYY-MM-DD
current_epic: 1
current_stage: 1
phase: breakdown
---
# {Title}
## Overview
{Goals, scope, key decisions from council plan}
## Metadata
- **Created:** YYYY-MM-DD
- **Integrations:** github
## Epic 1: {title}
**Objective:** {what this delivers}
**Dependencies:** none
**Epic slug:** {epic-slug}
**Epic branch:** epic/{epic-slug}
**Status:** pending | in-progress | complete | skipped
### Stage 1.1: {title}
**Branch prefix:** feat
**Acceptance criteria:**
- [ ] {criterion}
**Status:** pending
## Epic 2: {title}
**Dependencies:** Epic 1
...Execution
- Sequentially execute epics in dependency order. For each epic:
- Create epic branch, run the full SCOPE → BREAKDOWN → EXECUTE → VERIFY → ADVANCE → SHIP cycle.
- Between epics:
/clearcontext. Compare output against Overview (drift check).
- Worker lifecycle: Between epics send
work-queued(keeps workers alive). Only sendepic-doneafter the last epic completes. - Drift check: Minor drift → log and continue. Significant drift → pause, present card to user.
Relay Integration
Fixed socket path: ~/.claude/relay.sock. One relay per machine, started on first use.
Start relay (if not running):
RELAY_SOCK="$HOME/.claude/relay.sock"
RELAY_PID="$HOME/.claude/relay.pid"
if ! ([ -f "$RELAY_PID" ] && kill -0 "$(cat "$RELAY_PID")" 2>/dev/null && [ -S "$RELAY_SOCK" ]); then
nohup node ~/.claude/skills/relay/server.js > ~/.claude/relay.log 2>&1 &
# Wait up to 2s for relay.sock to appear
fiSend event:
node -e "
const s = require('net').connect(process.argv[1]);
s.write(JSON.stringify({type:'event',event:process.argv[2]})+'\n');
setTimeout(() => s.destroy(), 500);
" "$RELAY_SOCK" "{event-name}"**Events sent by /scope **
work-queued— after writing task files to.ai-queue/(wakes workers)epic-done— after all epics complete (workers exit)
/scope status
{Title} ({scope})
Status: {phase} — {status}
Epics:
1. {title} — done ✓
2. {title} — in-progress
Stage 2.1: {title} — done ✓
Stage 2.2: {title} — in-progress [3/5 tasks]
Stage 2.3: {title} — pending
3. {title} — pendingFor single-epic: omit epic grouping, show stages directly. For small scope: show task status.
Reads from .ai-plans/ — scan for all roadmaps, display active ones.
/scope watch
Autonomous monitor → verify → resume cycle. Use during EXECUTE phase when workers are processing tasks.
Behavior
Three sequential phases, fully autonomous (no user interaction until next gate):
Phase A: Monitor (up to 9 minutes)
- Read roadmap to determine current stage, total task count, and stage issue number.
- Poll
.ai-queue/and.ai-queue/_completed/every 60 seconds:- Count remaining vs completed tasks
- Print progress:
[{completed}/{total}] Stage {N}: {title} — {elapsed} - Listen for
task-readyevents and merge worker branches sequentially (same merge protocol as EXECUTE phase — rebase onto target, merge --no-ff, push, sendmerge-done:{NNN}) - If workers disconnect (no progress for 2+ cycles), re-send
work-queuedvia relay
- Exit conditions:
- All tasks moved to
_completed/→ proceed to Phase B - 9 minutes elapsed with tasks remaining → print status, ask user whether to extend or intervene
- All tasks moved to
Phase B: Clean
Once all tasks complete, run /scope clean (the full 5-pass audit) before doing anything else. Workers often leave tracking gaps — stale board statuses, missing PR checkoffs, roadmap drift. Clean fixes all of it.
This is not a lightweight check. It is the real /scope clean — Pass 0 through Pass 4, autonomous, no user interaction.
Phase C: Resume Flow
After clean completes, resume as if /scope watch was called fresh:
- Re-read roadmap frontmatter (clean may have updated it)
- If phase is still
executeand tasks remain → return to Phase A (monitor again) - If all tasks complete → transition to VERIFY — run build/lint/test, check acceptance criteria
- Present the
[VERIFY]Review Card for user approval - On approval → ADVANCE → next stage BREAKDOWN (or SHIP if final stage)
This is the standard /scope resume flow from Phase 4 onward — watch simply automates the wait.
Polling implementation
# Count remaining tasks (non-hidden files in .ai-queue/, excluding _completed/)
REMAINING=$(find .ai-queue -maxdepth 1 -name '*.md' | wc -l | tr -d ' ')
COMPLETED=$(find .ai-queue/_completed -maxdepth 1 -name '*.md' 2>/dev/null | wc -l | tr -d ' ')Use the /loop skill pattern internally — but /scope watch is a single invocation, not recurring. The polling loop runs within the single command execution.
Rules
- No user interaction during Phase A/B. Only Phase C (VERIFY gate) requires approval.
- Re-send relay events if workers appear stalled (no new completions for 2+ minutes).
- 9-minute ceiling is soft. If 6/7 tasks done at 9 min, extend 3 min automatically. Only prompt if <50% done at 9 min.
- Phase B is mandatory. Never skip
/scope cleanafter workers finish, even if all tasks completed quickly. Workers leave messes. - Phase C re-evaluates. After clean, re-read roadmap state — don't assume tasks are still complete. If clean revealed issues, loop back to Phase A.
/scope clean
Full-initiative audit + repair. Derives truth from shipped code (merged PRs, branch state), then reconciles roadmap + GH artifacts to match.
Source of truth hierarchy:
- Merged code — PRs merged, branches merged = work is done
- Roadmap — updated to reflect merged code
- GH issues/PRs — updated to reflect roadmap
- Board — updated to reflect issue/PR state
Five Audit Passes (all autonomous, no user interaction)
Pass 0: Sync Local Branches
Update all local tracking branches to match their remote counterparts, then sync epic branches with main:
git fetch origin
# For each epic branch referenced in roadmap:
git checkout epic/{slug} && git reset --hard origin/epic/{slug}
# Merge main into epic branch to keep it current:
git merge main --no-edit
git push origin epic/{slug}
# For the current stage branch (if exists):
git checkout {prefix}/{slug}/{stage-slug} && git reset --hard origin/{prefix}/{slug}/{stage-slug}
# Return to original branch
git checkout {original-branch}This prevents stale local branches from causing incorrect audit results or bad rebases. Merging main into epic branches ensures stage PRs won't have stale bases.
Pass 1: Code → Roadmap
Scan merged PRs and branch state to determine what's actually shipped:
- For each stage: check if its branch was merged to epic branch (or PR merged). If merged but roadmap says
pending/in-progress→ markdone, check off acceptance criteria. - For each epic: if all stages done but epic says
in-progress→ check if epic branch merged to main. If so → markdone. - Update roadmap
current_epic/current_stage/phasefrontmatter to reflect actual state. - Commit roadmap changes if any.
Pass 2: Roadmap → GitHub Issues
For each epic/stage in the roadmap:
- If roadmap has
Issue: #N— verify issue exists, has correct label (epic/stage), is open/closed appropriately (done → closed, in-progress → open) - If roadmap has NO issue reference — create missing issue, link to parent, add label, set board status, write issue # back to roadmap
- Verify epic issue body lists all stages in checklist format
- Verify saga issue body lists all epics in checklist format
Pass 3: Roadmap → GitHub PRs
For each epic in the roadmap:
- If NO epic PR exists (check
gh pr list --head epic/{slug}):- Create the epic PR targeting
mainfromepic/{slug} - Title: the epic title from the roadmap (or parent issue)
- Body: summary from roadmap/issue + stages checklist (
- [ ] Stage N: titlefor each stage) +Closes #{epic_issue}if issue exists - Label the PR with
epic - Write PR number back to roadmap metadata
- Create the epic PR targeting
- If epic PR exists: Verify PR body has all stages in checklist format
- Done stages checked off with PR link:
- [x] Stage N: title (#PR) - In-progress/pending stages unchecked:
- [ ] Stage N: title - Fix mismatches (missing checkoffs, missing PR links, missing stage entries)
Pass 4: Board Status
For each tracked issue:
- Epic/saga issues: Planning (active) or Done (complete). Never Todo/InProgress/InReview.
- Stage issues:
pending→ Todo,in-progress→ In Progress, has PR → In Review,done→ Done - Fix status mismatches
Output
/scope clean — {title}
──────────────────────────────────
Fixed:
• Roadmap: marked Stage 6.1 done (PR #209 merged)
• Created missing issue for Stage 6.2 (#211)
• Checked off Stage 6.1 in epic PR #209 body
• Moved #208 from In Progress → Done
• Added 'stage' label to #211
Clean:
• Epic issue #206 ✓
• Roadmap frontmatter ✓
{or "All clean — nothing to fix."}Rules
- No user interaction. Fix everything, report at end.
- Read
config.ymlfor integration. No integration → "No integration configured, nothing to audit." - Read
integrations/github.mdfor concrete commands. - Idempotent — safe to run repeatedly.
- CAN update roadmap (statuses, issue/PR references, frontmatter). Shipped code is ground truth.
- Commits roadmap changes if modified.
/scope update
Interactively modify an active roadmap.
- List active roadmaps. Scan
.ai-plans/for roadmaps wherestatusis notdoneoraborted. If none → "No active roadmaps." Otherwise AskUserQuestion with numbered list. - Read selected roadmap. Parse type (saga vs single-epic), full structure, per-stage/epic statuses.
- Prompt for changes. AskUserQuestion: "What changes do you want to make to this roadmap?"
- Generate diff summary. Compact before/after:
+additions (new stages/epics/criteria)~modifications (title, criteria, or scope changes)-removals (deleted pending stages/epics/criteria)
- Confirm loop. AskUserQuestion: "Apply these changes?" Max 3 loops → stop and print diff for manual editing.
- Apply changes. Write updated roadmap. Preserve all execution metadata: PR numbers, issue IDs, iteration counts, checkmarks.
- Side-effects:
- Adjust
current_stage/current_epicin frontmatter if structure shifted - New epics: create branch, create tracking ticket if integration configured
- Title changes:
gh issue editif GitHub integration active - Removed pending items: close associated tickets with "Removed from roadmap."
- Adjust
- Commit. Roadmap to main.
Constraints
- Cannot update
doneorabortedroadmaps. - Cannot remove or reorder
in-progressordonestages/epics — onlypendingitems. - Editing titles/criteria on
in-progressstages is allowed (scope refinement).
/scope abort
- Do NOT delete branches, roadmaps, or completed work.
- Set roadmap
statustoaborted. mcp__state__session_abandon(session_id)— mark session abandoned.- If integration: close ticket with "Aborted. Work preserved."
- Send
epic-donevia relay (workers exit). - Print where to find preserved work.
/scope setup
One-time repo scaffolding for /scope + /q workflows. Safe to re-run — idempotent.
Steps (all autonomous, no user interaction until summary)
1. Create directories
mkdir -p .ai-plans .ai-queue/_completed2. Gitignore entries
Ensure .gitignore contains these entries (append if missing, don't duplicate):
# AI orchestration
.ai-queue/
.worktrees/
SCOPE.md.ai-plans/ is NOT gitignored — roadmaps are committed.
3. Create SCOPE.md
If SCOPE.md doesn't exist at repo root, create it empty. (It's the scratch pad for new initiatives — gitignored, never committed.)
4. Configure integration
If .ai-plans/config.yml doesn't exist:
- Auto-detect available CLIs:
command -v gh &>/dev/null && echo "github" command -v linear &>/dev/null && echo "linear" - If
ghis available and authenticated (gh auth status):- Detect
ownerandrepofrom git remote:gh repo view --json owner,name - Ask user for
project_number(or skip if no project board) - If project_number provided: resolve
project_node_id,status_field_id,status_optionsvia:gh project field-list $PROJECT_NUMBER --owner $OWNER --format json - Ensure labels exist:
gh label create epic --repo OWNER/REPO 2>/dev/null || true(repeat forsaga,stage) - Write complete
config.yml
- Detect
- If no CLI detected: write
config.ymlwithintegrations: []
If .ai-plans/config.yml exists: validate it (same as config validation on every run). Fix incomplete fields.
5. Verify relay
Start the relay if not running (standard relay startup sequence). Verify socket is responsive.
6. Print summary
/scope setup — complete
─────────────────────────────
✓ .ai-plans/ created (or exists)
✓ .ai-queue/ created (or exists)
✓ .gitignore updated (or already correct)
✓ SCOPE.md created (or exists)
✓ config.yml github (owner/repo, project #N)
✓ Labels epic, saga, stage verified
✓ Relay running (pid XXXX)
Ready. Run `/scope {goal}` to start an initiative,
or `/q` in a separate terminal to start a worker.Rules
- Idempotent — safe to run multiple times.
- Never destructive — never overwrites existing config, roadmaps, or queue files.
- Only asks one question: project board number (if GitHub detected and no config exists). Everything else is auto-resolved.
- If config exists but is incomplete (e.g., missing
status_options), auto-resolve the missing fields without asking.
/scope (resume / SCOPE.md)
SCOPE.md at repo root is the user's scratch pad for defining new initiatives. Empty SCOPE.md = no pending scope (equivalent to the file not existing). Never delete SCOPE.md — only empty it.
- Scan
.ai-plans/for roadmaps withstatusnotdoneoraborted - Sync local branches:
git fetch origin, then for each epic/stage branch in the active roadmap, update local to match remote (git checkout {branch} && git reset --hard origin/{branch}). Return to original branch. - Active roadmap(s) found:
- If one → resume: read YAML frontmatter → determine current phase → re-enter flow at correct gate
- If multiple →
AskUserQuestionwhich to resume - If
SCOPE.mdhas content → read contents into$GOAL, immediately emptySCOPE.md, thenAskUserQuestion: resume active initiative or start new one?
- No active roadmap: Check
SCOPE.mdat repo root- Has content → read full contents into
$GOAL, then immediately overwriteSCOPE.mdwith an empty file (Write tool, empty string). Proceed with$GOALinto Phase 1 (SCOPE). - Empty or missing → "No active initiative. Run
/scope {goal}or write your goal inSCOPE.md."
- Has content → read full contents into
- Ensure relay is running
SCOPE.md lifecycle
Clear on read: the moment /scope reads SCOPE.md content, it empties the file immediately (before any council invocation or user interaction). The content is in the conversation context — the file is free for the next initiative. Same pattern as /do with DO.md.
Branch Strategy
main
└── epic/{slug}
├── feat/{slug}/{stage-1-slug}
├── fix/{slug}/{stage-2-slug}
└── chore/{slug}/{stage-3-slug}Epic branches merge to main. Stage branches merge to epic. Worker branches (q-NNN) merge to stage.
Error Handling
| Error | Action |
| Stage iteration limit (5) | Present card explaining failures, ask user |
| Total iteration limit (20) | Present card explaining failures, ask user |
| Merge conflict | Attempt rebase. If unresolvable → present card |
| CI failure | Present verification card with failures |
| Dependency deadlock (multi-epic) | Present card, ask user |
Memory Integration
Recall at phase entries. Store on outcomes. Reinforce on use. Read ~/.claude/skills/memory/MEMORY_OPS.md for tool call templates.
| Phase | Action |
| SCOPE entry | recall-prior-art with goal keywords + recall-constraints with "scope orchestrator" |
| BREAKDOWN entry | recall-checklist with "breakdown github tracking tickets" |
| EXECUTE entry | recall-constraints with "scope never implement execute monitor workers". Reinforce any recalled feedback memories. |
| VERIFY | recall-prior-art with test/lint patterns for this project |
| ADVANCE | recall-checklist with "advance integration side-effects PR board". Reinforce recalled checklist memories. |
| SHIP | recall-checklist with "ship merge saga close". store-outcome summarizing the initiative. |
Auto-store on Review Card rejection: When user responds n + feedback containing a directive (negation, "don't", "always", "never", corrective language), auto-store as store-feedback.
Attribution: When a recalled memory influences a decision, annotate the bullet in the Review Card with [mem:short-name]. Cap at 3 per section. In ? expanded view, show full memory content.
!! ROLE BOUNDARY !!
Scope is orchestration-only. A /scope orchestrator:
- NEVER implements code directly — no writing/modifying source files, components, tests, or application code
- NEVER skips the queue — ALL implementation work MUST go through
.ai-queue/for/qworkers - Only writes: roadmap files,
.ai-queue/task files,config.yml, and git/GitHub operations - EXECUTE phase = monitoring only — block on relay events, print progress, wait for workers
- If no workers are running: tell the user to start
/qworkers in separate terminals. Do NOT do the work yourself.
This boundary exists because the orchestrator and workers operate in separate contexts. The orchestrator manages the lifecycle; workers do the implementation. Violating this boundary means work happens without proper isolation, worktree safety, or parallel execution.
Rules
- Never execute without approval. Every gate requires a review card.
- Council before code. SCOPE and BREAKDOWN always invoke
/council --subroutine. - Never implement code. Scope writes task files. Workers implement. No exceptions.
- Brevity in cards. No paragraphs. Bullets only. Active voice.
- Consistent hierarchy. Summary > Scope > SoW > Risk > Action. Always this order.
- Progressive disclosure. Default = compressed. Detail on demand via
?. - Iterate, don't restart. Rejection refines the item, not the whole plan.
- Level tags always.
[SAGA]/[EPIC]/[STAGE]/[TASK]prefix. - One roadmap file.
.ai-plans/{slug}/roadmap.md— single source of truth. - File-disjoint tasks. Parallel-safe by construction.
- Commit state to git. Roadmap survives
/clear. - Relay required. No fallback polling — relay must be running for worker coordination.
- Integration side-effects are mandatory. When
config.ymllists an integration, every ADVANCE and SHIP phase MUST execute all side-effects (update PR body, update issue body, move board status). Never skip silently. - Labels are mandatory. Every saga issue gets
sagalabel. Every epic issue getsepiclabel. Every stage issue getsstagelabel. Verify after creation. - Checklist links are mandatory. When checking off a stage in an epic PR/issue body, or an epic in a saga issue body, ALWAYS include the PR number:
- [x] Stage N: title (#PR_NUMBER). Never check off without linking. - Board status transitions are mandatory. Sagas/epics: Planning on creation → Done on merge (no other statuses ever). Stages: Todo → In Progress → In Review → Done. Never skip transitions.
- Verify after every side-effect. After updating a PR body, issue body, or board status, re-read the target to confirm the change took effect. If it didn't, fix it immediately.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

