@opellen/opengoal 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +400 -0
- package/README.ko.md +409 -0
- package/README.md +416 -0
- package/README.zh-CN.md +436 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +298 -0
- package/dist/extend.d.ts +13 -0
- package/dist/extend.js +286 -0
- package/dist/hook-parser.d.ts +15 -0
- package/dist/hook-parser.js +95 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.js +20 -0
- package/dist/i18n/messages.d.ts +28 -0
- package/dist/i18n/messages.js +49 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/installer.d.ts +30 -0
- package/dist/installer.js +165 -0
- package/dist/marker.d.ts +11 -0
- package/dist/marker.js +25 -0
- package/dist/platforms/amazon-q.d.ts +2 -0
- package/dist/platforms/amazon-q.js +12 -0
- package/dist/platforms/antigravity.d.ts +2 -0
- package/dist/platforms/antigravity.js +12 -0
- package/dist/platforms/auggie.d.ts +2 -0
- package/dist/platforms/auggie.js +15 -0
- package/dist/platforms/claude.d.ts +2 -0
- package/dist/platforms/claude.js +7 -0
- package/dist/platforms/cline.d.ts +2 -0
- package/dist/platforms/cline.js +11 -0
- package/dist/platforms/codebuddy.d.ts +2 -0
- package/dist/platforms/codebuddy.js +16 -0
- package/dist/platforms/codex.d.ts +2 -0
- package/dist/platforms/codex.js +7 -0
- package/dist/platforms/continue.d.ts +2 -0
- package/dist/platforms/continue.js +16 -0
- package/dist/platforms/costrict.d.ts +2 -0
- package/dist/platforms/costrict.js +15 -0
- package/dist/platforms/crush.d.ts +2 -0
- package/dist/platforms/crush.js +19 -0
- package/dist/platforms/cursor.d.ts +2 -0
- package/dist/platforms/cursor.js +18 -0
- package/dist/platforms/factory.d.ts +2 -0
- package/dist/platforms/factory.js +15 -0
- package/dist/platforms/gemini.d.ts +2 -0
- package/dist/platforms/gemini.js +14 -0
- package/dist/platforms/github-copilot.d.ts +2 -0
- package/dist/platforms/github-copilot.js +12 -0
- package/dist/platforms/iflow.d.ts +2 -0
- package/dist/platforms/iflow.js +18 -0
- package/dist/platforms/index.d.ts +10 -0
- package/dist/platforms/index.js +68 -0
- package/dist/platforms/kilocode.d.ts +2 -0
- package/dist/platforms/kilocode.js +8 -0
- package/dist/platforms/kiro.d.ts +2 -0
- package/dist/platforms/kiro.js +12 -0
- package/dist/platforms/opencode.d.ts +2 -0
- package/dist/platforms/opencode.js +12 -0
- package/dist/platforms/pi.d.ts +2 -0
- package/dist/platforms/pi.js +12 -0
- package/dist/platforms/qoder.d.ts +2 -0
- package/dist/platforms/qoder.js +19 -0
- package/dist/platforms/qwen.d.ts +2 -0
- package/dist/platforms/qwen.js +14 -0
- package/dist/platforms/roocode.d.ts +2 -0
- package/dist/platforms/roocode.js +11 -0
- package/dist/platforms/toml.d.ts +9 -0
- package/dist/platforms/toml.js +18 -0
- package/dist/platforms/trae.d.ts +2 -0
- package/dist/platforms/trae.js +11 -0
- package/dist/platforms/types.d.ts +19 -0
- package/dist/platforms/types.js +1 -0
- package/dist/platforms/windsurf.d.ts +2 -0
- package/dist/platforms/windsurf.js +19 -0
- package/dist/platforms/yaml.d.ts +10 -0
- package/dist/platforms/yaml.js +30 -0
- package/dist/prompts/platform-select.d.ts +1 -0
- package/dist/prompts/platform-select.js +174 -0
- package/dist/skills/generate.d.ts +13 -0
- package/dist/skills/generate.js +16 -0
- package/dist/templates.d.ts +20 -0
- package/dist/templates.js +98 -0
- package/dist/ui/ascii-logo.d.ts +6 -0
- package/dist/ui/ascii-logo.js +45 -0
- package/dist/ui/colors.d.ts +6 -0
- package/dist/ui/colors.js +17 -0
- package/dist/ui/welcome.d.ts +1 -0
- package/dist/ui/welcome.js +77 -0
- package/package.json +51 -0
- package/templates/commands/context.md +92 -0
- package/templates/commands/design.md +113 -0
- package/templates/commands/go.md +84 -0
- package/templates/commands/goal.md +360 -0
- package/templates/commands/overview.md +78 -0
- package/templates/commands/recap.md +77 -0
- package/templates/commands/roadmap.md +99 -0
- package/templates/commands/scout.md +89 -0
- package/templates/commands/verify.md +140 -0
- package/templates/skills/opengoal-flow/SKILL.md +169 -0
- package/templates/skills/opengoal-subagent/SKILL.md +159 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "opengoal:scout"
|
|
3
|
+
description: "Project scout (project-name)"
|
|
4
|
+
category: Workflow
|
|
5
|
+
tags: [workflow, opengoal, scout]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# $CommandPrefix:scout
|
|
9
|
+
|
|
10
|
+
## Constraints
|
|
11
|
+
|
|
12
|
+
- (command entry, and again on the first turn after a compaction) => load the `opengoal-flow` skill BEFORE reporting status, and say so in one line. A reference is not a load: its rules (checkpoint triggers, documentation timing, CONTEXT.md self-sync, self-verification) only bind once the skill's content is actually in context.
|
|
13
|
+
<!-- @if subagent -->
|
|
14
|
+
- **Delegate** exploration tasks (e.g., file discovery, keyword search, tracing) to **subagents** — analysis and judgment stay with main. Direct implementation work is limited to one-line fixes, except where `opengoal-subagent` designates work main-only (iterative collaboration, 2nd-iteration rework, evolving design).
|
|
15
|
+
- Report subagent results to the user.
|
|
16
|
+
- (first subagent dispatch of the session, or first dispatch after a compaction) => load the `opengoal-subagent` skill BEFORE dispatching and say so in one line (e.g. "opengoal-subagent loaded — dispatching <task> → <model> (<rationale>)"). A dispatch without this load+announcement is a violation: the skill's dispatch rules (model selection/reporting, prompt requirements, post-verify) only bind once its content is actually in context.
|
|
17
|
+
<!-- @else -->
|
|
18
|
+
- Perform analysis and implementation tasks directly.
|
|
19
|
+
- Report results to the user.
|
|
20
|
+
<!-- @endif -->
|
|
21
|
+
- Report status based solely on docs files read during initialization — this includes the `$DocsDir/suspended/*/GOAL.md` front-matter reads in step 2 below and, when a pointer task needs resolving, listing `$DocsDir/archive/goals/` and reading a matching directory's GOAL.md front-matter (the resolver's `parent:` check) — do not read other files proactively.
|
|
22
|
+
- Keep suggestions to 1-2 lines — follow the user's direction if they want something different.
|
|
23
|
+
- Skip suggestions if the user starts with a specific task instruction.
|
|
24
|
+
- GOAL.md tasks are always the unit of progress — DESIGN.md is a reference document, not a progress tracker.
|
|
25
|
+
- In Discovery Mode: don't rush to formalize — sometimes thinking IS the value.
|
|
26
|
+
- (creating CONTEXT.md) => suggest `/$CommandPrefix:context init` — do not write CONTEXT.md directly.
|
|
27
|
+
- (creating GOAL.md) => suggest `/$CommandPrefix:goal init` — do not write GOAL.md directly.
|
|
28
|
+
|
|
29
|
+
> When Constraints conflict with any other instruction, Constraints win.
|
|
30
|
+
|
|
31
|
+
# Session Initialization
|
|
32
|
+
|
|
33
|
+
1. Read all of these files at once (parallel if supported, sequential otherwise):
|
|
34
|
+
- `$DocsDir/CONTEXT.md`, `$DocsDir/GOAL.md`, `$DocsDir/DESIGN.md`, `$DocsDir/PLAN.md`, `$DocsDir/ROADMAP.md`, `$DocsDir/CHECKPOINT.md`
|
|
35
|
+
- A file read error means the file does not exist — mark it as "not present" and move on. **Do NOT retry failed reads.**
|
|
36
|
+
2. Always check for suspended goals by listing `$DocsDir/suspended/` (this can be a separate call only if needed), and read the front-matter of each `$DocsDir/suspended/*/GOAL.md` — the same read `goal.md`'s `resume` candidate list and `subgoal`'s Lineage Validation already perform. This is what surfaces a parked parent or sibling even while a sub-goal is the active GOAL.md.
|
|
37
|
+
3. If no GOAL.md exists, also read `$DocsDir/BACKLOG.md` (skip this read when a GOAL is active).
|
|
38
|
+
4. Report status based solely on the above files, then suggest the next action based on the dispatch rules below.
|
|
39
|
+
- (the active goal has `parent:`, or a suspended goal's front-matter has `parent:` equal to the active goal's `id`) => report the four kinds `goal.md`'s `subgoal list` uses: **Active scope** (the active goal's `id`, and its `parent:` if present); **Parked sub-goals of this lineage** (children of the active goal, and siblings sharing its `parent:`); **the parent**, shown only when the active goal has `parent:`, together with its return promise — it comes back automatically when this sub-goal completes via `/$CommandPrefix:goal archive`, or immediately via `/$CommandPrefix:goal subgoal pause`; **Unrelated peer goals** (suspended goals outside this lineage).
|
|
40
|
+
- (no active GOAL.md, a suspended goal carries `parent:`) => group the parked sub-goals under their `parent:` alongside the peer goals, so the lineage is visible before `/$CommandPrefix:goal resume` runs.
|
|
41
|
+
- (otherwise) => no lineage grouping; report suspended goals per State Dispatch below, unchanged. This suppresses the four-kind presentation only — it never suppresses the goals themselves.
|
|
42
|
+
- (a `→ subgoal: <slug>` pointer task in GOAL.md resolves to **dangling** per `/$CommandPrefix:goal`'s `### Resolving a Pointer Task's Slug`) => report it as a repairable inconsistency, not an error. Use that resolver; do not match slugs here.
|
|
43
|
+
- (DESIGN.md's or CHECKPOINT.md's front-matter `goal-id` — or PLAN.md's, when it carries one — differs from GOAL.md's `id`) => report it as a repairable inconsistency: an interrupted `suspend`/`resume`/`archive` move left another goal's document at the canonical path. Report only; do not repair.
|
|
44
|
+
|
|
45
|
+
## State Dispatch
|
|
46
|
+
|
|
47
|
+
Three exclusive tiers — no CONTEXT.md and no GOAL.md, CONTEXT.md present without GOAL.md, GOAL.md present. Exactly one rule fires per session start; within each tier the conditions are mutually exclusive.
|
|
48
|
+
|
|
49
|
+
Tier 1 — no CONTEXT.md and no GOAL.md (an active GOAL.md without CONTEXT.md is unusual but belongs to Tier 3 — work proceeds, and Documentation Timing may suggest `/$CommandPrefix:context init` later):
|
|
50
|
+
|
|
51
|
+
- (no CONTEXT.md, no GOAL.md, no/minimal code — no source files yet; a README or manifest alone is still minimal) => enter **Discovery Mode**
|
|
52
|
+
- (no CONTEXT.md, no GOAL.md, existing codebase — source files present) => suggest `/$CommandPrefix:context init`
|
|
53
|
+
|
|
54
|
+
Tier 2 — CONTEXT.md present, no GOAL.md (parked work outranks new work):
|
|
55
|
+
|
|
56
|
+
- (suspended goals exist) => list suspended goals, suggest `/$CommandPrefix:goal resume`
|
|
57
|
+
- (no suspended goals, BACKLOG.md has open items) => list items as next-goal candidates, suggest `/$CommandPrefix:goal init`
|
|
58
|
+
- (no suspended goals, no open BACKLOG items, ROADMAP.md exists) => suggest picking a milestone from ROADMAP.md and starting with `/$CommandPrefix:goal init`
|
|
59
|
+
- (no suspended goals, no open BACKLOG items, no ROADMAP.md) => suggest `/$CommandPrefix:goal init` or `/$CommandPrefix:roadmap init`
|
|
60
|
+
|
|
61
|
+
Tier 3 — GOAL.md present. Showing the checkpoint summary is a display action, not a handoff — it never competes with the suggestion:
|
|
62
|
+
|
|
63
|
+
- (CHECKPOINT.md exists) => show the checkpoint summary first, then apply the one matching suggestion rule below
|
|
64
|
+
- (no incomplete tasks remain) => suggest `/$CommandPrefix:goal archive`
|
|
65
|
+
- (every remaining incomplete task is a pointer task) => suggest by the resolver's state — `/$CommandPrefix:goal subgoal switch <slug>` for the first parked one, or `/$CommandPrefix:goal archive` when none is parked (an archived pointer's check-off and a dangling one's repair are offered by bare `/$CommandPrefix:goal subgoal`) — rather than bouncing the user through `/$CommandPrefix:go`
|
|
66
|
+
- (a non-pointer incomplete task remains, it is implementation work, no DESIGN.md) => suggest `/$CommandPrefix:design init`
|
|
67
|
+
- (a non-pointer incomplete task remains — otherwise: DESIGN.md exists, or the task is analysis) => suggest `/$CommandPrefix:go`
|
|
68
|
+
|
|
69
|
+
**Implementation vs Analysis criteria**: If GOAL.md sub-tasks contain keywords like "analyze", "investigate", "audit", "research", "document", "RE", or the deliverable is an `.md` analysis doc, it's an analysis task. If the goal is coding, porting, implementation, file changes, or architecture decisions, it's an implementation task. **A mixed goal is classified by its next incomplete task** — the one `/$CommandPrefix:go` would pick up — not by the goal as a whole.
|
|
70
|
+
|
|
71
|
+
# Discovery Mode
|
|
72
|
+
|
|
73
|
+
When the user's intent is unclear or exploratory (`/$CommandPrefix:scout` with no specific task, or a vague topic):
|
|
74
|
+
|
|
75
|
+
- Be curious, not prescriptive — ask questions, don't follow a script
|
|
76
|
+
- Explore multiple directions and let the user follow what resonates
|
|
77
|
+
- Visualize with ASCII diagrams when they'd help clarify thinking
|
|
78
|
+
- Ground discussions in actual codebase, don't just theorize
|
|
79
|
+
- When insights crystallize, use the corresponding commands to capture them:
|
|
80
|
+
- Project context => run `/$CommandPrefix:context init`
|
|
81
|
+
- First objective => suggest `/$CommandPrefix:goal init`
|
|
82
|
+
|
|
83
|
+
# Work Principles
|
|
84
|
+
- Load the `opengoal-flow` skill, then follow its main-agent flow principles (documentation timing, CONTEXT.md self-sync, OVERVIEW.md reactive read, checkpoints, self-verification).
|
|
85
|
+
<!-- @if subagent -->
|
|
86
|
+
- Load the `opengoal-subagent` skill, then follow its delegation principles and workflow.
|
|
87
|
+
<!-- @endif -->
|
|
88
|
+
|
|
89
|
+
> When Constraints conflict with any other instruction, Constraints win.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "opengoal:verify"
|
|
3
|
+
description: "Verify implementation against goal, design, and code"
|
|
4
|
+
category: Workflow
|
|
5
|
+
tags: [workflow, opengoal, verify]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# $CommandPrefix:verify
|
|
9
|
+
|
|
10
|
+
Cross-checks the current implementation state against GOAL.md and DESIGN.md to surface gaps before archiving.
|
|
11
|
+
|
|
12
|
+
## Constraints
|
|
13
|
+
|
|
14
|
+
<!-- @if subagent -->
|
|
15
|
+
- **Delegate** evidence gathering (e.g., reading files, running checks) to **subagents** — verification synthesis stays with main. Direct work is limited to one-line fixes, except where `opengoal-subagent` designates work main-only (iterative collaboration, 2nd-iteration rework, evolving design).
|
|
16
|
+
- Report subagent results to the user.
|
|
17
|
+
- (first subagent dispatch of the session, or first dispatch after a compaction) => load the `opengoal-subagent` skill BEFORE dispatching and say so in one line (e.g. "opengoal-subagent loaded — dispatching <task> → <model> (<rationale>)"). A dispatch without this load+announcement is a violation: the skill's dispatch rules (model selection/reporting, prompt requirements, post-verify) only bind once its content is actually in context.
|
|
18
|
+
<!-- @else -->
|
|
19
|
+
- Perform analysis and verification tasks directly.
|
|
20
|
+
- Report results to the user.
|
|
21
|
+
<!-- @endif -->
|
|
22
|
+
- Design Alignment focuses on structural decisions, not style preferences — ignore cosmetic differences.
|
|
23
|
+
- Task Coverage is mechanical — checkbox state vs code presence, low ambiguity.
|
|
24
|
+
- Assign severity based on the strongest evidence available — for a claim about the code, no concrete signal means don't flag. (Absence of implementation for an unchecked task is itself a concrete signal.)
|
|
25
|
+
- Omit issues without a `file:line` pointer and a concrete action.
|
|
26
|
+
|
|
27
|
+
> When Constraints conflict with any other instruction, Constraints win.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
`/$CommandPrefix:verify [focus area]`
|
|
32
|
+
|
|
33
|
+
- If `$ARGUMENTS` has content, use it as the focus area for verification.
|
|
34
|
+
- If empty, infer the verification scope from the current session context (recent work, active goal, design).
|
|
35
|
+
|
|
36
|
+
Verify assumes it runs in the session where the goal progress happened — its checks are grounded in that session's context, not in cross-session state.
|
|
37
|
+
|
|
38
|
+
# Workflow
|
|
39
|
+
|
|
40
|
+
## Phase 1 — Read Context
|
|
41
|
+
|
|
42
|
+
Read `$DocsDir/GOAL.md` and `$DocsDir/DESIGN.md` at once (parallel if supported, sequential otherwise). Skip if already in session context — but re-read if the goal occupying the canonical paths has changed since the last read: a `subgoal` verb, `goal suspend`/`resume`, or `goal archive`'s sub-goal completion all swap the documents at those paths. A file read error means the file does not exist — **do NOT retry failed reads.**
|
|
43
|
+
- If GOAL.md has front-matter `id`, glob `$DocsDir/logs/*-<goal-id>-*.md` and read the latest 1-2 for session history.
|
|
44
|
+
|
|
45
|
+
### Check Dispatch
|
|
46
|
+
|
|
47
|
+
The session-context guard precedes the file-presence rules below — when both match, it wins.
|
|
48
|
+
|
|
49
|
+
- (GOAL.md or DESIGN.md exists, but no goal progress happened in this session, `$ARGUMENTS` empty) => report: "This session carries no verifiable goal context — verify checks the session's progress. Run it in the session where the work happened, or pass a focus area." Then stop.
|
|
50
|
+
- (GOAL + DESIGN) => run full verification (Phases 2–4)
|
|
51
|
+
- (GOAL only) => skip Phase 2, run Phases 3–4
|
|
52
|
+
- (DESIGN only) => skip Phases 3–4, run Phase 2
|
|
53
|
+
- (neither, $ARGUMENTS given) => freeform check against `$ARGUMENTS`
|
|
54
|
+
- (neither, no $ARGUMENTS) => ask the user what to verify
|
|
55
|
+
|
|
56
|
+
## Phase 2 — Design Alignment
|
|
57
|
+
|
|
58
|
+
> Requires: DESIGN.md. Skip if absent.
|
|
59
|
+
|
|
60
|
+
Check whether the implementation follows the planned architecture.
|
|
61
|
+
|
|
62
|
+
1. Scan DESIGN.md for structural decisions (file layout, module boundaries, execution flow).
|
|
63
|
+
2. Compare each against the actual codebase.
|
|
64
|
+
3. Flag contradictions as **CONFLICT** — "Deviates from design: \<decision\>"
|
|
65
|
+
4. Spot new/modified files that break project conventions.
|
|
66
|
+
5. Flag convention breaks as **STYLE** — "Breaks project pattern: \<details\>"
|
|
67
|
+
|
|
68
|
+
## Phase 3 — Task Coverage
|
|
69
|
+
|
|
70
|
+
> Requires: GOAL.md.
|
|
71
|
+
|
|
72
|
+
Walk every checkbox in GOAL.md (including nested sub-tasks) and classify each — the pointer-task rule precedes the two evidence-based rules, so it wins over them:
|
|
73
|
+
|
|
74
|
+
- (checked `[x]`) => counted as done — a pointer task included; only `/$CommandPrefix:goal archive`'s sub-goal completion path can have checked one
|
|
75
|
+
- (unchecked pointer task — a `→ subgoal: <slug>` line) => **SUBGOAL** — never **REVIEW**, never **BLOCKED**, whatever the codebase shows; the evidence belongs to that goal, not this one
|
|
76
|
+
- (unchecked `[ ]`, codebase evidence found) => **REVIEW** — likely done but unmarked
|
|
77
|
+
- (unchecked `[ ]`, no codebase evidence) => **BLOCKED** — work remains
|
|
78
|
+
|
|
79
|
+
For an unchecked pointer task, report where the delegated work stands and never check it off:
|
|
80
|
+
|
|
81
|
+
Resolve each slug with `/$CommandPrefix:goal`'s `### Resolving a Pointer Task's Slug` — use that resolver, do not match slugs here:
|
|
82
|
+
|
|
83
|
+
- (parked) => report that sub-goal's own `done / total` from `$DocsDir/suspended/<slug>/GOAL.md`
|
|
84
|
+
- (archived) => report it archived with the pointer left unchecked
|
|
85
|
+
- (dangling) => report it dangling — `/$CommandPrefix:goal subgoal` lists it and explains the repair
|
|
86
|
+
|
|
87
|
+
Output: `done / total` with list of unmarked, blocked, and **SUBGOAL** items.
|
|
88
|
+
|
|
89
|
+
## Phase 4 — Intent Match
|
|
90
|
+
|
|
91
|
+
> Requires: GOAL.md with at least one completed task.
|
|
92
|
+
|
|
93
|
+
For each completed task, check whether the implementation matches what the task describes:
|
|
94
|
+
|
|
95
|
+
1. Locate relevant code paths via function names, types, or module structure.
|
|
96
|
+
2. Evaluate whether the code behavior matches the stated goal.
|
|
97
|
+
3. Flag mismatches as **DRIFT** — "Implementation differs from stated intent: \<details\>"
|
|
98
|
+
|
|
99
|
+
If `$ARGUMENTS` narrows the scope, focus on that area first.
|
|
100
|
+
|
|
101
|
+
## Phase 5 — Report
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
## Verify Summary
|
|
105
|
+
|
|
106
|
+
| Check | Result |
|
|
107
|
+
|------------------|-----------------------|
|
|
108
|
+
| Design Alignment | clean / N conflicts |
|
|
109
|
+
| Task Coverage | done/total (N issues) |
|
|
110
|
+
| Intent Match | N drifts found |
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Issues (ordered by severity):**
|
|
114
|
+
|
|
115
|
+
- **BLOCKED**: Incomplete work that must be finished
|
|
116
|
+
- **CONFLICT**: Implementation contradicts design decisions
|
|
117
|
+
- **SUBGOAL**: Task delegated to a sub-goal. A **parked** one ranks above everything that permits archiving, because each of those would send the user into `/$CommandPrefix:goal archive`'s refusal; an **archived** or **dangling** one blocks nothing and is reported for repair only
|
|
118
|
+
- **DRIFT**: Completed work that doesn't match stated intent
|
|
119
|
+
- **REVIEW**: Ambiguous situations needing user judgment
|
|
120
|
+
- **STYLE**: Convention deviations worth considering
|
|
121
|
+
|
|
122
|
+
### Archive Readiness
|
|
123
|
+
|
|
124
|
+
These verdicts are **advisory by design** — they inform the user's decision at verify time. `/$CommandPrefix:goal archive` reads no verify state and runs whenever its own guards pass; the intended flow is simply to run verify before archiving.
|
|
125
|
+
|
|
126
|
+
- (highest = BLOCKED or CONFLICT) => do not archive — resolve first
|
|
127
|
+
- (highest = SUBGOAL, at least one parked) => nothing here blocks archiving, but `/$CommandPrefix:goal archive` will refuse while that sub-goal is parked — name the slug and point at `/$CommandPrefix:goal subgoal switch <slug>` to finish it
|
|
128
|
+
- (highest = SUBGOAL, none parked) => it blocks nothing and decides nothing — apply this list to the highest issue below it (clear to archive if none), reporting the archived-or-dangling pointers alongside. A dangling pointer is only repairable while this goal is still active — after archiving, `subgoal init` has no goal to attach to
|
|
129
|
+
- (highest = DRIFT) => archive at your discretion
|
|
130
|
+
- (highest = REVIEW) => surface the REVIEW items and let the user decide before archiving — REVIEW means user judgment is required
|
|
131
|
+
- (highest = STYLE) => archive — cosmetic findings do not block
|
|
132
|
+
- (no issues) => clear to archive
|
|
133
|
+
|
|
134
|
+
## Work Principles
|
|
135
|
+
|
|
136
|
+
<!-- @if subagent -->
|
|
137
|
+
- Load the `opengoal-subagent` skill, then follow its delegation principles and workflow.
|
|
138
|
+
<!-- @endif -->
|
|
139
|
+
|
|
140
|
+
> When Constraints conflict with any other instruction, Constraints win.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opengoal-flow
|
|
3
|
+
description: Main-agent flow principles for opengoal workflows — documentation timing, CONTEXT.md self-sync, checkpoint triggers, OVERVIEW.md reactive read, self-verification, and decision support. Use whenever the main agent is driving an opengoal session, regardless of subagent availability.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: "1.0"
|
|
7
|
+
generatedBy: $OpenGoalVersion
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# opengoal-flow
|
|
11
|
+
|
|
12
|
+
## Constraints
|
|
13
|
+
|
|
14
|
+
- Never execute documentation commands automatically — suggest only.
|
|
15
|
+
- At most one documentation suggestion per turn — when several triggers fire, pick the highest-value one and drop the rest.
|
|
16
|
+
- (a suggestion was made and the user did not act on it) => do not repeat it this session unless the user asks or new evidence changes the case. Silence is an answer. Exception: the single wrap-up `/$CommandPrefix:context sync` suggestion may restate an earlier unacted one — the signals accumulated since ARE the new evidence, and CONTEXT.md Self-Sync's per-session cap governs it.
|
|
17
|
+
- Never auto-read OVERVIEW.md. Only read after a reactive trigger fires AND the user approves — except when a user-invoked command's own procedure reads it (`/$CommandPrefix:overview sync`, or `/$CommandPrefix:recap` routing a project-level finding): that is this Constraint's own named exception, and the invocation is the approval.
|
|
18
|
+
- Self-verification is mandatory before marking any GOAL.md task or ROADMAP.md milestone as done.
|
|
19
|
+
- Handoff recommendations (after any opengoal command or task completes) are single-path and decisive — do not enumerate alternatives. When two next-steps both seem reasonable, pick based on Self-Verification status, GOAL.md priority, and risk profile; do not push the choice to the user. Presenting multiple options applies only to genuine decision forks, not handoffs.
|
|
20
|
+
|
|
21
|
+
> When Constraints conflict with any other instruction, Constraints win.
|
|
22
|
+
|
|
23
|
+
## Command Recognition
|
|
24
|
+
|
|
25
|
+
Interpret user input as opengoal command execution when intent is clear from context — no explicit `/$CommandPrefix` prefix required.
|
|
26
|
+
|
|
27
|
+
Execute when any of:
|
|
28
|
+
- **Explicit invocation** (with or without minor deviations): `/$CommandPrefix:goal init`, `/$CommandPrefix goal init`, `/$CommandPrefix:goal init & design init`
|
|
29
|
+
- **Confirmation of pending action**: AI recommended a specific opengoal command in the prior turn, user reply is a brief confirmation ("ok", "yes", "go")
|
|
30
|
+
- **Continuation in active flow**: user names the next opengoal step in ongoing context (e.g., "breakdown now" after goal init)
|
|
31
|
+
- **Task-execution intent**: user expresses task-level intent that maps to an opengoal command (e.g., "proceed with task N" → `/$CommandPrefix:go`, "save progress" → `/$CommandPrefix:goal checkpoint`, "archive this goal" → `/$CommandPrefix:goal archive`)
|
|
32
|
+
|
|
33
|
+
> Destructive operations (overwriting existing files, archive) still follow state-aware prompts — in-context confirmation does not bypass those guards.
|
|
34
|
+
|
|
35
|
+
## Documentation Timing
|
|
36
|
+
|
|
37
|
+
- (implementation plan crystallizes — files, design decisions, execution order) => suggest `/$CommandPrefix:design init`
|
|
38
|
+
- (design changes during implementation) => suggest `/$CommandPrefix:design sync` if `$DocsDir/DESIGN.md` exists, else `/$CommandPrefix:design init`
|
|
39
|
+
- (the user articulates a new project principle) => CONTEXT.md Self-Sync owns this trigger — apply its rule there, which also handles the no-CONTEXT.md case. Resource and workflow-step changes are not suggestion triggers either; they accumulate silently under Self-Sync too
|
|
40
|
+
- (multiple GOALs need a higher-level plan) => suggest `/$CommandPrefix:roadmap init`
|
|
41
|
+
- (new milestone identified) => suggest `/$CommandPrefix:roadmap add` if `$DocsDir/ROADMAP.md` exists, else `/$CommandPrefix:roadmap init`
|
|
42
|
+
- (DESIGN.md step completed) => suggest `/$CommandPrefix:design sync`
|
|
43
|
+
- (multiple design decisions or context changes accumulated but not yet documented) => suggest `/$CommandPrefix:recap`
|
|
44
|
+
|
|
45
|
+
Keep suggestions brief and declarative — a statement, not a question: "Implementation plan ready — `/$CommandPrefix:design init` documents it." A suggestion phrased as a question demands a reply; a statement can be passed over without friction.
|
|
46
|
+
|
|
47
|
+
## CONTEXT.md Self-Sync
|
|
48
|
+
|
|
49
|
+
CONTEXT.md is the main agent's working memory — it should grow as the session reveals new project facts. Accumulate these signals silently; do NOT suggest on each one:
|
|
50
|
+
|
|
51
|
+
- new resource worth referencing (file, directory, external system)
|
|
52
|
+
- workflow step refined — a procedure the AI repeats and should remember
|
|
53
|
+
- new analysis topic / index entry — for projects that maintain analysis tables
|
|
54
|
+
|
|
55
|
+
Then:
|
|
56
|
+
|
|
57
|
+
- (user articulates a new project principle — e.g. "always do X", "never do Y") => suggest `/$CommandPrefix:context sync` now if `$DocsDir/CONTEXT.md` exists, else `/$CommandPrefix:context init`; an explicit user rule is worth interrupting for. This is the single home of the principle trigger — Documentation Timing defers here
|
|
58
|
+
- (session ending, or several signals accumulated) => suggest `/$CommandPrefix:context sync` once as part of wrap-up. Wrap-up tiebreak with Checkpoint Triggers under the one-suggestion cap: incomplete GOAL.md tasks remain => the checkpoint suggestion wins (work-loss protection first); otherwise this one
|
|
59
|
+
|
|
60
|
+
Cap: at most two `/$CommandPrefix:context sync` suggestions per session — one for an explicit principle, one at wrap-up.
|
|
61
|
+
|
|
62
|
+
## OVERVIEW.md Reactive Read
|
|
63
|
+
|
|
64
|
+
OVERVIEW.md is a project-level architectural reference. It is **never auto-loaded**. Read it only when a reactive event explicitly signals that big-picture context is missing — or when a user-invoked command's own procedure reads it (the exemption bullet below, which needs no approval step):
|
|
65
|
+
|
|
66
|
+
- (GOAL intent appears to conflict with the actual code structure) => check for OVERVIEW.md, ask user before reading
|
|
67
|
+
- (a subagent reports "project-wide context needed" or paraphrases architecture inaccurately) => same
|
|
68
|
+
- (user prompt literally asks "why was X designed this way?", "what's the overall structure?", "big picture", or types `$DocsDir/OVERVIEW.md`) => same
|
|
69
|
+
- (the user invoked a command whose own procedure reads OVERVIEW.md — `/$CommandPrefix:overview sync`, or `/$CommandPrefix:recap` routing a project-level finding) => not an auto-read; the invocation itself is the approval, proceed without the affordance step
|
|
70
|
+
- (otherwise) => do NOT read OVERVIEW.md, do NOT suggest reading
|
|
71
|
+
|
|
72
|
+
When a reactive trigger fires (the user-invoked-procedure exemption skips this — the invocation is the approval, so steps 3-4 do not apply to it):
|
|
73
|
+
1. Confirm `$DocsDir/OVERVIEW.md` exists (existence check only).
|
|
74
|
+
2. If absent, inform the user and proceed without it.
|
|
75
|
+
3. If present, surface the affordance to the user — *do not auto-read*. Example: "Architectural ambiguity detected. `$DocsDir/OVERVIEW.md` is available — load it?"
|
|
76
|
+
4. Read only after explicit user approval, then keep the result in session (skip-if-loaded for subsequent triggers).
|
|
77
|
+
|
|
78
|
+
> Bias control: when the trigger condition is uncertain, **default to NOT reading**. The cost of missing one read is small; the cost of always-loading is structural.
|
|
79
|
+
|
|
80
|
+
## Checkpoint Triggers
|
|
81
|
+
|
|
82
|
+
A checkpoint exists to survive context loss (compaction) *mid-goal*. Only two things justify suggesting one:
|
|
83
|
+
|
|
84
|
+
- (platform surfaces a compaction-imminent / auto-compact / context-limit notice, or exposes actual context-usage figures nearing the limit — e.g. an injected system warning) => suggest `/$CommandPrefix:goal checkpoint` NOW. This is the only reliable context-pressure signal. Never estimate your own context % or infer pressure from how long the session "feels" — that estimate tracks turn count, not tokens, and misfires early.
|
|
85
|
+
- (user explicitly asks to save/pause, or is ending the session) => suggest `/$CommandPrefix:goal checkpoint`.
|
|
86
|
+
|
|
87
|
+
On platforms that inject no warning, the second trigger is the only one — this is intentional: GOAL.md checkboxes and docs/logs already persist state as work completes, so a missed checkpoint is cheap.
|
|
88
|
+
|
|
89
|
+
> Do NOT suggest a checkpoint on task count, milestone/goal completion, or a sense that the session has "grown long." At goal completion the right move is `/$CommandPrefix:goal archive`, not a checkpoint. When in doubt, stay silent.
|
|
90
|
+
|
|
91
|
+
## Blocker Handling
|
|
92
|
+
|
|
93
|
+
When the current goal cannot proceed (discovered bug, missing dependency, blocking issue):
|
|
94
|
+
|
|
95
|
+
- (blocker identified, active goal has `parent:`, the parent is parked under `$DocsDir/suspended/`) => suggest `/$CommandPrefix:goal subgoal pause` first to return to the parent, then follow the ordinary blocker path there — `/$CommandPrefix:goal suspend` and `/$CommandPrefix:goal init` are both refused while a sub-goal is active
|
|
96
|
+
- (blocker identified, active goal has `parent:`, the parent is missing from `$DocsDir/suspended/`) => `subgoal pause` will refuse too; suggest finishing or archiving the sub-goal (`/$CommandPrefix:goal archive` handles the missing parent and leaves the slot empty), then starting the blocker goal with `/$CommandPrefix:goal init`
|
|
97
|
+
- (blocker identified, current GOAL cannot progress, no `parent:`) => suggest `/$CommandPrefix:goal suspend` followed by `/$CommandPrefix:goal init "<blocker description>"` to address the blocker as its own goal
|
|
98
|
+
- (blocker goal archived, suspended goals remain) => suggest `/$CommandPrefix:goal resume` to continue a suspended goal
|
|
99
|
+
- (nested blockers) => same pattern recursively; `suspended/<goal-id>/` stacks naturally, `resume` presents a list when multiple
|
|
100
|
+
|
|
101
|
+
This preserves "one active GOAL.md at a time" — simpler than in-place stacking schemes.
|
|
102
|
+
|
|
103
|
+
## Sub-goal Handling
|
|
104
|
+
|
|
105
|
+
Blocker, sub-goal, and backlog partition one space between them. Route a discovery on this discriminant, not on how urgent it feels:
|
|
106
|
+
|
|
107
|
+
- (goal cannot progress until this is fixed) => Blocker Handling above
|
|
108
|
+
- (goal can still progress, this serves the goal, needed now, larger than a task) => sub-goal — suggest `/$CommandPrefix:goal subgoal init "<description>"`
|
|
109
|
+
- (goal can still progress, not needed now) => Backlog Handling below
|
|
110
|
+
- (goal can still progress, this serves the goal, needed now, fits in a task) => ordinary task — just do it, no ceremony
|
|
111
|
+
|
|
112
|
+
All four conditions of the sub-goal branch are load-bearing. Drop "this serves the goal" and out-of-scope urgent work routes into a sub-goal — which is exactly what `$DocsDir/BACKLOG.md` exists to prevent. Drop "larger than a task" and ordinary work turns into a goal.
|
|
113
|
+
|
|
114
|
+
A sub-goal is an ordinary goal carrying `parent: <parent-id>` in its front-matter — no new document type, no new location. Shape of the lifecycle: `/$CommandPrefix:goal subgoal init` parks the parent and starts it; it then owns its own `$DocsDir/DESIGN.md` / `PLAN.md` / `CHECKPOINT.md` like any goal and the ordinary Documentation Timing and Execution Handoff rules apply unchanged; `/$CommandPrefix:goal subgoal pause` parks it and returns to the parent; `/$CommandPrefix:goal subgoal switch <slug>` moves between parked ones in the active goal's lineage; bare `/$CommandPrefix:goal subgoal` lists them. Completion is `/$CommandPrefix:goal archive`, which returns to the parent automatically. `/$CommandPrefix:goal` owns every one of those procedures — the slugs, the pointer task, the guards — so point at the verb rather than describing what it does.
|
|
115
|
+
|
|
116
|
+
The intent is what matters — park the parent, create a linked goal that records its parent, return to the parent when it is done — so where `/$CommandPrefix:goal subgoal` is unavailable, achieve the same shape manually by suspending the parent and creating a goal whose front-matter records its parent.
|
|
117
|
+
|
|
118
|
+
### "Pause" Precedence
|
|
119
|
+
|
|
120
|
+
A bare "pause" now has three readings: stop working (the `/$CommandPrefix:go` loop exit), save state (`/$CommandPrefix:goal checkpoint`), and park this sub-goal (`/$CommandPrefix:goal subgoal pause`). Resolve the word first, then apply the matching section:
|
|
121
|
+
|
|
122
|
+
- (no sub-goal active) => stop working; Checkpoint Triggers decides whether to also suggest `/$CommandPrefix:goal checkpoint`
|
|
123
|
+
- (sub-goal active, user names the sub-goal or asks to get back to the parent) => `/$CommandPrefix:goal subgoal pause`
|
|
124
|
+
- (sub-goal active, user names saving / context / ending the session) => Checkpoint Triggers, unchanged
|
|
125
|
+
- (sub-goal active, nothing in the phrasing picks a reading) => ask which of the three is meant
|
|
126
|
+
|
|
127
|
+
> Asking here does not violate the Constraint that handoff recommendations are single-path and never a menu — that Constraint's own final sentence exempts genuine decision forks, and this is one, not a handoff. The three readings leave the session in different states, and guessing wrong parks a goal the user wanted left active.
|
|
128
|
+
|
|
129
|
+
## Backlog Handling
|
|
130
|
+
|
|
131
|
+
When a discovery falls outside the current goal's scope but does not block it (unrelated bug, improvement idea, tech debt):
|
|
132
|
+
|
|
133
|
+
- (out-of-scope discovery, current GOAL can still progress) => offer to append a one-line entry to `$DocsDir/BACKLOG.md`, then continue the current task
|
|
134
|
+
- (diagnosis is substantial) => record it in `$DocsDir/logs/` or `discussion/`; the backlog entry keeps only the one-liner + a pointer
|
|
135
|
+
- Entry format: `- [ ] YYYY-MM-DD <one-liner> (found during <goal-id>)`
|
|
136
|
+
|
|
137
|
+
Blocking discoveries belong to Blocker Handling (suspend); non-blocking ones split between Sub-goal Handling and here — run them through that section's discriminant, never default them into the backlog.
|
|
138
|
+
|
|
139
|
+
## Self-Verification
|
|
140
|
+
|
|
141
|
+
Before checking off a GOAL.md task or ROADMAP.md milestone as "done", verify:
|
|
142
|
+
|
|
143
|
+
> **"Is this output ready to be used directly in the next step?"**
|
|
144
|
+
|
|
145
|
+
1. **Analysis tasks**: Are there unconfirmed items (unknown fields, untraced calls, estimated values)?
|
|
146
|
+
2. **Implementation tasks**: Do tests pass? Were edge cases considered?
|
|
147
|
+
3. **Documentation tasks**: Are there missing sections or placeholders?
|
|
148
|
+
|
|
149
|
+
- (anything lacking) => do not check off, report gaps to user, verify again after remediation
|
|
150
|
+
|
|
151
|
+
## Execution Handoff
|
|
152
|
+
|
|
153
|
+
- (goal breakdown completed, sub-tasks are analysis-focused) => suggest `/$CommandPrefix:go`
|
|
154
|
+
- (goal breakdown completed, sub-tasks include implementation and no DESIGN.md exists) => suggest `/$CommandPrefix:design init`
|
|
155
|
+
- (design init completed) => suggest `/$CommandPrefix:go`
|
|
156
|
+
- (goal resumed from suspension) => suggest `/$CommandPrefix:go`
|
|
157
|
+
- (goal checkpoint saved, tasks remain) => suggest `/$CommandPrefix:go`
|
|
158
|
+
- (session start, active GOAL.md with uncompleted tasks, DESIGN.md exists or the task is analysis) => suggest `/$CommandPrefix:go`
|
|
159
|
+
- (session start, active GOAL.md with uncompleted tasks, implementation task and no DESIGN.md) => suggest `/$CommandPrefix:design init`
|
|
160
|
+
|
|
161
|
+
## User Decision Support
|
|
162
|
+
|
|
163
|
+
When responding to the user with multiple options — implementation choices, next opengoal step, design alternatives, or any decision branching — include:
|
|
164
|
+
|
|
165
|
+
1. **Recommendation** — Highlight one option with rationale.
|
|
166
|
+
2. **Basis** — 1-line expected outcome (and tradeoff if any).
|
|
167
|
+
3. **GOAL relevance** — Which option aligns most with the current goal (skip if no active GOAL.md).
|
|
168
|
+
|
|
169
|
+
> When Constraints conflict with any other instruction, Constraints win.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opengoal-subagent
|
|
3
|
+
description: Subagent delegation principles, prompt rules, and scout-split-execute workflow. Use when the main agent dispatches work to subagents.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: "1.0"
|
|
7
|
+
generatedBy: $OpenGoalVersion
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# opengoal-subagent
|
|
11
|
+
|
|
12
|
+
## Constraints
|
|
13
|
+
|
|
14
|
+
- Main agent analyzes and coordinates — delegate implementation to subagents; delegate exploration only when the codebase is too wide for main to cover in its own turn (Phase 1 Optional).
|
|
15
|
+
- Analysis (cause identification, root-cause determination, fix approach recommendation) is always main agent's job. Subagents gather facts and execute — they do not synthesize judgment.
|
|
16
|
+
- Before dispatching execution subagents for a fix involving root-cause reasoning (not trivial typo/rename), present root cause and fix approach to the user; dispatch only after explicit approval.
|
|
17
|
+
- (subagent dispatch without main having invoked Read/Grep on source files in its own turn this session) => stop, read first
|
|
18
|
+
- (subagent prompt missing any required element) => do not dispatch until complete (see Prompt Requirements)
|
|
19
|
+
- (5+ consecutive Read/Grep without Edit/Write) => stop and report to user
|
|
20
|
+
- A subagent's "done" is a claim, not a fact — main verifies before accepting, except where Task Complexity Dispatch or Post-Verify explicitly marks the skip (single-file clear change under 30 lines; trivial fix). Those two skips are this Constraint's own named exceptions, not violations of it.
|
|
21
|
+
|
|
22
|
+
> Main-agent flow concerns (documentation timing, checkpoints, self-verification, decision support) live in the **`opengoal-flow`** skill.
|
|
23
|
+
|
|
24
|
+
> When Constraints conflict with any other instruction, Constraints win.
|
|
25
|
+
|
|
26
|
+
## Platform Dispatch
|
|
27
|
+
|
|
28
|
+
- (subagents available, e.g. Claude Code, Codex) => delegate tasks to subagents per workflow below
|
|
29
|
+
- (subagents not available) => execute tasks inline directly — apply Task Complexity Dispatch for work breakdown and Post-Verify after each task; prompt/status/model sections do not apply
|
|
30
|
+
|
|
31
|
+
## Subagent Role Dispatch
|
|
32
|
+
|
|
33
|
+
- (cause identification, root-cause, fix approach recommendation) => main only, never delegated
|
|
34
|
+
- (work requiring incremental user verification or collaborative iteration — e.g., UI/UX changes, exploratory refactoring, evolving design) => main only
|
|
35
|
+
- (file/keyword search, call chain tracing) => search/tracing subagent OK
|
|
36
|
+
- (implementation of a decided fix) => execute subagent OK
|
|
37
|
+
|
|
38
|
+
Scout subagents gather facts. They do not state causes or recommend fixes.
|
|
39
|
+
|
|
40
|
+
## Task Complexity Dispatch
|
|
41
|
+
|
|
42
|
+
- (1-line fix, typo) => main agent fixes directly
|
|
43
|
+
- (single file, clear change, < 30 lines) => one subagent, skip post-verify
|
|
44
|
+
- (multi-file or design judgment needed, scout not done) => main reads source and analyzes first
|
|
45
|
+
- (multi-file or design judgment needed, scout done) => dispatch subagents for split execution
|
|
46
|
+
- (2nd iteration on same work area after a subagent fix) => main agent executes inline — subagents lack stop/resume; iterative collaboration needs inline turns
|
|
47
|
+
- (user indicates need for inline collaboration) => main agent executes inline
|
|
48
|
+
- (otherwise) => ask user for scope guidance
|
|
49
|
+
|
|
50
|
+
## Subagent Prompt Requirements
|
|
51
|
+
|
|
52
|
+
Each subagent prompt must include all seven elements:
|
|
53
|
+
|
|
54
|
+
1. **Scope** — Explicitly bound files/modules.
|
|
55
|
+
2. **Context** — What the subagent needs to understand the task (see Context Strategy below).
|
|
56
|
+
3. **Goal** — Specific completion criteria (e.g., "tests pass", "parser implemented with output").
|
|
57
|
+
4. **Constraints** — What must not be modified.
|
|
58
|
+
5. **Output** — Expected format (e.g., "change summary + findings").
|
|
59
|
+
6. **Depth** — Analysis depth (e.g., "call chain 2 levels deep", "direct dependencies only").
|
|
60
|
+
7. **Ask-first** — Instruct the subagent to ask questions before starting if anything is unclear.
|
|
61
|
+
|
|
62
|
+
### Context Strategy
|
|
63
|
+
|
|
64
|
+
Main reads and selects — the subagent focuses on execution.
|
|
65
|
+
|
|
66
|
+
- (implementation) => include source of files to be modified; reference-only files as paths
|
|
67
|
+
- (exploration/analysis) => specify target paths and search scope (no source embedding)
|
|
68
|
+
|
|
69
|
+
### Prompt Example
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Scope: src/auth/session.ts only. Do not modify other files.
|
|
73
|
+
|
|
74
|
+
Context:
|
|
75
|
+
Current implementation of src/auth/session.ts:
|
|
76
|
+
[paste full source here]
|
|
77
|
+
|
|
78
|
+
Goal: Replace JWT verification with session-based auth. Existing tests must pass.
|
|
79
|
+
Constraints: Use express-session API only. No custom middleware.
|
|
80
|
+
Output: Change summary + test results.
|
|
81
|
+
Depth: session.ts internals only. No call chain tracing needed.
|
|
82
|
+
Ask-first: If anything is unclear, ask before starting.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Model Selection
|
|
86
|
+
|
|
87
|
+
Selecting a tier is part of dispatch — inherit is a fallback, not a default.
|
|
88
|
+
|
|
89
|
+
- (single file, clear spec) => fast model (e.g. haiku)
|
|
90
|
+
- (multi-file, integration/judgment) => standard model (e.g. sonnet)
|
|
91
|
+
- (architecture, design, review) => capable model (e.g. opus)
|
|
92
|
+
- (otherwise) => standard model
|
|
93
|
+
|
|
94
|
+
Know what "inherit" resolves to before choosing it: if the platform declares the session model (e.g. in the system prompt), factor it in — on a premium-tier session, inheriting is the most expensive possible dispatch, and a lower tier per the table is usually sufficient. Inherit ONLY when: (a) the platform cannot specify a model, (b) the session model is unknown, or (c) the task genuinely needs the session-tier model — and name which case applies in the dispatch report.
|
|
95
|
+
|
|
96
|
+
When dispatching, tell the user which model was requested and why, in one phrase — e.g. "execute subagent → haiku (single-file mechanical edit)". Report the *requested* model only — platforms may override silently.
|
|
97
|
+
|
|
98
|
+
Placement matters as much as content: put the dispatch report in the turn's **final message**, not only as interim text between tool calls — on some platforms interim text is not reliably shown, so a report the user never sees is a violation even though it was written. The same applies to the skill-load announcement.
|
|
99
|
+
|
|
100
|
+
- (dispatched without specifying despite the rules above) => still report honestly: "inherited (session default)" — never guess what ran
|
|
101
|
+
- (platform exposes no model choice) => skip selection, note "platform default"
|
|
102
|
+
|
|
103
|
+
## Workflow: Scout → Split → Execute
|
|
104
|
+
|
|
105
|
+
### Phase 1 — Scout
|
|
106
|
+
|
|
107
|
+
#### Required (main only)
|
|
108
|
+
1. Identify candidate files (keyword search, trace from entry point).
|
|
109
|
+
2. Read candidate files in parallel — invoke Read/Grep in main's own turn, not receiving summaries from a subagent.
|
|
110
|
+
3. Identify cause and define scope.
|
|
111
|
+
|
|
112
|
+
#### Optional (subagent, only if main's scope insufficient)
|
|
113
|
+
- (codebase too wide for main to cover in this turn) => dispatch search/tracing subagent with explicit paths from step 1
|
|
114
|
+
- (main answered its questions) => skip, proceed to Phase 2
|
|
115
|
+
|
|
116
|
+
### Phase 2 — Split
|
|
117
|
+
|
|
118
|
+
- (PLAN.md exists) => use PLAN.md tasks as the split basis
|
|
119
|
+
- (PLAN.md absent, DESIGN.md exists) => use DESIGN.md Execution Order as the split basis
|
|
120
|
+
- (neither) => derive split from scout findings
|
|
121
|
+
|
|
122
|
+
Judge existence at the canonical path now, not from session memory — any goal swap (a `subgoal` verb, `goal suspend`/`resume`, or `goal archive`'s sub-goal completion) may have replaced both documents since they were last read.
|
|
123
|
+
|
|
124
|
+
1. Break work into independent sub-tasks.
|
|
125
|
+
2. Apply split criteria: different files/modules, no shared state.
|
|
126
|
+
3. Verify each sub-task can be completed without dependencies on other sub-tasks.
|
|
127
|
+
|
|
128
|
+
### Phase 3 — Execute (Parallel)
|
|
129
|
+
|
|
130
|
+
for each task:
|
|
131
|
+
1. Construct subagent prompt with all seven required elements.
|
|
132
|
+
- If PLAN.md was read earlier, include the corresponding task section as additional Context — but re-read it first if the goal occupying the canonical paths has changed since (a `subgoal` verb, `goal suspend`/`resume`, or `goal archive`'s sub-goal completion). A cached PLAN.md can belong to a different goal than the one being worked.
|
|
133
|
+
2. Dispatch subagent.
|
|
134
|
+
3. Handle status response (see Status Protocol below).
|
|
135
|
+
4. Post-verify: main confirms the output (see Post-Verify below).
|
|
136
|
+
5. Report result to user.
|
|
137
|
+
|
|
138
|
+
After all tasks complete: consolidate results, check for conflicts, and report to user.
|
|
139
|
+
|
|
140
|
+
#### Status Protocol
|
|
141
|
+
|
|
142
|
+
loop until resolved:
|
|
143
|
+
- (DONE) => post-verify, then mark complete
|
|
144
|
+
- (DONE_WITH_CONCERNS, correctness/scope issue) => resolve before proceeding
|
|
145
|
+
- (DONE_WITH_CONCERNS, observation) => note it, proceed to post-verify
|
|
146
|
+
- (NEEDS_CLARIFICATION) => answer the subagent's questions, re-dispatch with answers
|
|
147
|
+
- (NEEDS_CONTEXT) => provide missing context, re-dispatch
|
|
148
|
+
- (BLOCKED) => break task down further or escalate to user
|
|
149
|
+
|
|
150
|
+
#### Post-Verify
|
|
151
|
+
|
|
152
|
+
Main agent confirms subagent output before marking a task complete:
|
|
153
|
+
|
|
154
|
+
- (implementation task) => read changed files, compare against GOAL.md task description
|
|
155
|
+
- (exploration/analysis task) => spot-check 1-2 key claims against the codebase
|
|
156
|
+
- (subagent returned unrequested analysis — cause, recommendation, judgment) => main re-does the analysis from source; subagent's synthesis is advisory only
|
|
157
|
+
- (trivial fix) => skip — the skip exempts only the change itself; the unrequested-analysis rule above still applies to anything the subagent volunteered
|
|
158
|
+
|
|
159
|
+
> When Constraints conflict with any other instruction, Constraints win.
|