@jaybeeuu/agent-cortex 1.38.1 → 1.40.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.
Files changed (88) hide show
  1. package/.agents/skills/style-versioning/SKILL.md +1 -1
  2. package/.github/workflows/ci.yml +47 -14
  3. package/AGENTS.md +19 -3
  4. package/CHANGELOG.md +42 -0
  5. package/README.md +118 -63
  6. package/agents/README.md +13 -10
  7. package/agents/ralph-plan/agent.md +1 -1
  8. package/agents/ralph-plan.agent.md +1 -1
  9. package/bin/agent-cortex.mjs +29 -8
  10. package/bin/installers/claude.mjs +569 -105
  11. package/bin/installers/copilot.mjs +22 -12
  12. package/bin/installers/pi.mjs +37 -34
  13. package/docs/claude-hooks.md +3 -3
  14. package/docs/ideas/extension-manifests.md +75 -0
  15. package/docs/ideas/record-ideas-as-beads.md +115 -0
  16. package/docs/ideas/subagent-visibility.md +72 -0
  17. package/docs/ideas/task-session-context.md +89 -0
  18. package/docs/research/skill-design-research.md +4 -4
  19. package/docs/research/skill-improvements-analysis.md +1 -1
  20. package/docs/skills/skill-anatomy.md +38 -2
  21. package/docs/technical-direction/migration-execution-labels.md +132 -0
  22. package/extensions/agent-modes/README.md +3 -2
  23. package/extensions/agent-modes/discover.test.ts +30 -7
  24. package/extensions/agent-modes/discover.ts +1 -1
  25. package/extensions/skill-stats/index.test.ts +3 -2
  26. package/lib/cli.mjs +24 -6
  27. package/package.json +4 -4
  28. package/plugin.json +1 -1
  29. package/pnpm-workspace.yaml +1 -1
  30. package/scripts/build-copilot-agents.mjs +1 -1
  31. package/scripts/check-no-sync.mjs +49 -0
  32. package/scripts/lib/compose-agent.mjs +32 -14
  33. package/skills/engineering/design-an-interface/SKILL.md +78 -58
  34. package/skills/engineering/grill-with-docs/REFERENCE.md +78 -0
  35. package/skills/engineering/grill-with-docs/SKILL.md +66 -63
  36. package/skills/engineering/improve-codebase-architecture/SKILL.md +66 -48
  37. package/skills/engineering/technical-direction/FORMAT.md +38 -0
  38. package/skills/engineering/technical-direction/SKILL.md +70 -77
  39. package/skills/planning/classify-bead/SKILL.md +59 -35
  40. package/skills/planning/create-task/REFERENCE.md +40 -0
  41. package/skills/planning/create-task/SKILL.md +70 -66
  42. package/skills/planning/create-task/scripts/create-chores.ts +6 -1
  43. package/skills/planning/create-task/scripts/node_modules/.bin/tsc +21 -0
  44. package/skills/planning/create-task/scripts/node_modules/.bin/tsserver +21 -0
  45. package/skills/planning/create-task/scripts/node_modules/.bin/tsx +21 -0
  46. package/skills/planning/prd-to-tasks/REFERENCE.md +66 -0
  47. package/skills/planning/prd-to-tasks/SKILL.md +86 -170
  48. package/skills/planning/record-idea/FORMAT.md +44 -0
  49. package/skills/planning/record-idea/SKILL.md +70 -53
  50. package/skills/planning/request-refactor-plan/FORMAT.md +45 -0
  51. package/skills/planning/request-refactor-plan/SKILL.md +57 -46
  52. package/skills/planning/write-a-prd/FORMAT.md +54 -0
  53. package/skills/planning/write-a-prd/SKILL.md +49 -48
  54. package/skills/planning/write-a-ticket/SKILL.md +68 -53
  55. package/skills/productivity/handoff/SKILL.md +12 -0
  56. package/skills/productivity/init-beads/SKILL.md +48 -40
  57. package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsc +21 -0
  58. package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsserver +21 -0
  59. package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsx +21 -0
  60. package/skills/productivity/write-a-skill/SKILL.md +2 -1
  61. package/skills/review/maintain-agent-docs/SKILL.md +71 -51
  62. package/skills/workflow/hitl-collab/SKILL.md +86 -17
  63. package/skills/workflow/ralph/REFERENCE.md +22 -17
  64. package/skills/workflow/ralph/SKILL.md +88 -74
  65. package/skills/workflow/run-pipeline-stage/REFERENCE.md +22 -0
  66. package/skills/workflow/run-pipeline-stage/SKILL.md +91 -93
  67. package/skills/workflow/run-pipeline-stage/scripts/generate-progress.test.ts +6 -107
  68. package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsc +21 -0
  69. package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsserver +21 -0
  70. package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsx +21 -0
  71. package/test/claude-installer.test.mjs +308 -0
  72. package/test/cli.test.mjs +40 -30
  73. package/test/copilot-installer.test.mjs +92 -82
  74. package/test/helpers/fake-claude.mjs +152 -0
  75. package/test/installer.test.mjs +309 -57
  76. package/test/pi-installer.test.mjs +115 -99
  77. package/token-map.README.md +21 -10
  78. package/token-map.json +7 -6
  79. package/.claude-plugin/marketplace.json +0 -16
  80. package/claude/.claude-plugin/plugin.json +0 -11
  81. package/claude/agents/plan.md +0 -58
  82. package/claude/agents/ralph-plan.md +0 -121
  83. package/claude/agents/ralph.md +0 -193
  84. package/claude/agents/strategy.md +0 -111
  85. package/claude/hooks/scripts/notify.mjs +0 -54
  86. package/claude/hooks.json +0 -38
  87. /package/{claude → claude-extras}/.mcp.json +0 -0
  88. /package/{claude → claude-extras}/scripts/statusline-command.sh +0 -0
@@ -1,86 +1,79 @@
1
1
  ---
2
2
  name: technical-direction
3
- description: Drive collaborative technical design by challenging assumptions, mapping constraints, comparing alternatives, and producing a justified recommendation. Use when user wants to decide technical direction after PRD, evaluate architecture/technology choices, or asks to design a solution with tradeoff analysis.
3
+ description: Challenge assumptions, map constraints, compare options, and justify the choice. Use when deciding technical direction, choosing architecture or technology, or designing a solution with tradeoffs.
4
4
  ---
5
5
 
6
6
  # Technical Direction
7
7
 
8
- Act like a pragmatic, challenging staff engineer: constructive, direct, evidence-driven.
8
+ Act as a pragmatic, challenging staff engineer: constructive, direct, and evidence-driven. The deliverable is a justified recommendation, not consensus.
9
+
10
+ ## When to use
11
+
12
+ - "Decide technical direction" for a change with real architectural weight.
13
+ - Evaluating architecture or technology choices that carry tradeoffs.
14
+ - A PRD or brief is approved and the solution shape is still open.
15
+ - "Design a solution" where alternatives need mapping and comparison before picking one.
16
+
17
+ ## When NOT to use
18
+
19
+ - Stress-testing an existing plan or sharpening domain language — use `grill-with-docs`.
20
+ - Scoping a feature into PRD and tasks — use `plan` before direction makes sense.
21
+ - Exploring a codebase for refactoring opportunities — use `improve-codebase-architecture`.
22
+ - Reversible decisions with no meaningful tradeoffs — a memo costs more than it saves.
9
23
 
10
24
  ## Workflow
11
25
 
12
- 1. **Anchor on problem context**
13
- - Start from PRD or user brief
14
- - Confirm technical goals, non-goals, and decision horizon
15
-
16
- 2. **Discover constraints from codebase first**
17
- - Investigate architecture, existing interfaces, deployment/runtime constraints, data model boundaries, and team conventions
18
- - Note unknowns and risks
19
-
20
- 3. **Challenge loop (one question at a time)**
21
- - Ask focused, high-leverage questions
22
- - Challenge vague claims and hidden assumptions
23
- - Require explicit justification for each major decision
24
- - Keep drilling until constraints and tradeoffs are concrete
25
-
26
- 4. **Generate options**
27
- - Always include Option A (extend current approach), Option B (moderate architectural shift), and Option C (stronger alternative using new tech/pattern)
28
- - For each option: feasibility, complexity, migration cost, operational impact, testability, performance, and failure modes
29
-
30
- 5. **Use web research when needed**
31
- - Do this autonomously when codebase evidence is insufficient or a high-impact decision needs external comparison
32
- - Prefer authoritative sources (official docs, maintainers, widely adopted production guidance)
33
- - Bring findings back as tradeoffs, and retain source links as references
34
-
35
- 6. **Converge on a recommendation**
36
- - Select the best-fit option for current constraints
37
- - Explicitly explain why alternatives were not chosen
38
- - List decision triggers that would justify revisiting later
39
-
40
- 7. **Write decision memo**
41
- - Ensure `docs/technical-direction/` exists
42
- - Save to `docs/technical-direction/<feature-slug>.md` using this template:
43
-
44
- ```md
45
- # Technical Direction: <Feature Name>
46
- ## Problem and target outcome
47
- - What we are solving
48
- - Why this matters now
49
- ## Current-state constraints
50
- - Architecture and integration constraints
51
- - Team/runtime/operational constraints
52
- - Unknowns and assumptions
53
- ## Options considered
54
- ### Option A: <name>
55
- - Approach
56
- - Pros
57
- - Cons
58
- - Risks
59
- ### Option B: <name>
60
- ...
61
- ### Option C: <name>
62
- ...
63
- ## Recommendation
64
- - Chosen approach
65
- - Why this is best under current constraints
66
- - Why alternatives were not selected
67
- ## Tradeoffs accepted
68
- - Explicit compromises and consequences
69
- ## Validation plan
70
- - Fastest experiments/spikes to de-risk decision
71
- - Success/failure signals
72
- ## Revisit triggers
73
- - Conditions that should force re-evaluation
74
- ## References
75
- - Web sources used for decisions (title + URL)
76
- - Code evidence links (repo path + line range, and permalink URL when available)
77
- ```
78
-
79
- ## Rules
80
-
81
- - Ask questions one at a time.
82
- - If the answer exists in the codebase, investigate before asking.
83
- - Be challenging but collaborative; do not optimize for agreement.
84
- - Avoid premature implementation details until direction is selected.
85
- - Every recommendation must include explicit constraints and tradeoffs.
86
- - When web or code sources materially inform decisions, include them in `## References`.
26
+ 1. **Anchor on problem context.** Start from the PRD or user brief. Confirm goals, non-goals, and the decision horizon (how long this choice must hold).
27
+ 2. **Discover constraints from the codebase first.** Investigate architecture, existing interfaces, deployment and runtime constraints, data-model boundaries, and team conventions using {{TOOL:rg}}, {{TOOL:view}}, and {{TOOL:glob}}. Record unknowns and risks explicitly.
28
+ 3. **Run the challenge loop, one question at a time.** Ask focused, high-leverage questions. Challenge vague claims and hidden assumptions; require explicit justification for each major decision. Keep drilling until constraints and tradeoffs are concrete. If an answer exists in the codebase, find it before asking.
29
+ 4. **Generate options.** Always include Option A (extend the current approach), Option B (moderate architectural shift), and Option C (a stronger alternative using new tech or patterns). Evaluate each on feasibility, complexity, migration cost, operational impact, testability, performance, and failure modes.
30
+ 5. **Use web research when the codebase is insufficient.** Do this autonomously for high-impact decisions needing external comparison. Prefer authoritative sources (official docs, maintainers, widely adopted production guidance) via {{TOOL:web_fetch}}; bring findings back as tradeoffs with source links.
31
+ 6. **Converge on a recommendation.** Select the best-fit option under current constraints. Explain explicitly why each alternative was not chosen. List decision triggers that would justify revisiting.
32
+ 7. **Write the decision memo.** Ensure `docs/technical-direction/` exists and save `docs/technical-direction/<feature-slug>.md` using the template in [FORMAT.md](FORMAT.md).
33
+
34
+ ## Red Flags
35
+
36
+ - Red flag: proposing options before constraints are mapped — alternatives become uncomparable.
37
+ - Red flag: asking a question the codebase can answer without looking first.
38
+ - Red flag: optimising for agreement instead of surfacing hard tradeoffs.
39
+ - Red flag: recommending direction without stated tradeoffs, revisit triggers, or validation signals.
40
+ - Red flag: sliding into premature implementation details before direction is selected.
41
+
42
+ ## Common Rationalizations
43
+
44
+ | Rationalization | Rebuttal |
45
+ |---|---|
46
+ | "We already know the answer" | Stated answers often rest on unstated assumptions. Test the recommendation against the constraints before accepting it. |
47
+ | "The tradeoffs are obvious" | Obvious today is forgotten in a month. The memo exists so reversible choices stay reversible and irreversible ones are signposted. |
48
+ | "Web research is overkill" | For high-impact choices with insufficient codebase evidence, external comparison is the cheapest way to kill a plausible-but-wrong option. |
49
+ | "One option is clearly right" | A single option is a statement, not a decision. Alternatives and their failure modes are what justify the choice. |
50
+
51
+ ## Philosophy / rationale
52
+
53
+ - **Constraints first, options second.** Options only compare against the constraints that bound them, so map the codebase and decision horizon before generating alternatives.
54
+ - **Challenge is the deliverable.** The value of a direction session is the assumptions it surfaces and kills. Optimising for agreement produces a recommendation nobody tested.
55
+ - **Every recommendation carries its tradeoffs.** A choice without documented tradeoffs, revisit triggers, and validation signals cannot be revisited intelligently later.
56
+
57
+ ## Cross-skill references
58
+
59
+ - `write-a-prd` produces the input brief when no PRD exists yet.
60
+ - `grill-with-docs` sharpens contested terminology and stress-tests the memo against domain docs.
61
+ - `design-an-interface` structures the option-generation step when the decision is about interface shape.
62
+ - `style-documentation` governs the memo's what/whether criteria before writing.
63
+
64
+ ## Examples
65
+
66
+ Input: "Decide on the write-path storage for the events service."
67
+ Output: a decision memo at `docs/technical-direction/events-write-path.md` covering constraints, three options scored against them, a justified recommendation, tradeoffs accepted, a validation plan, revisit triggers, and references. See [FORMAT.md](FORMAT.md) for the full template.
68
+
69
+ ## Verification checklist
70
+
71
+ - [ ] Goals, non-goals, and decision horizon confirmed before options were generated
72
+ - [ ] Codebase constraints explored before asking questions; unknowns and risks recorded
73
+ - [ ] Questions asked one at a time; nothing answerable from the codebase asked of the user
74
+ - [ ] At least three options considered, including an extend-current approach and a stronger alternative
75
+ - [ ] Each option scored on feasibility, complexity, migration cost, operational impact, testability, performance, and failure modes
76
+ - [ ] Recommendation states why alternatives were not chosen and lists revisit triggers
77
+ - [ ] Decision memo saved to `docs/technical-direction/<feature-slug>.md` using the FORMAT.md template
78
+ - [ ] Tradeoffs accepted, validation plan, and references (web and code, with links) included
79
+ - [ ] No premature implementation detail in the memo — direction only
@@ -5,63 +5,87 @@ description: Classify a bead as AFK or HITL and apply the implementation-type la
5
5
 
6
6
  # Classify Bead
7
7
 
8
- Determine whether a bead requires human action (HITL) or can be completed autonomously by an agent (AFK), then persist the result as a label.
8
+ Determine whether a bead requires human action (HITL) or can be completed autonomously by an agent (AFK), then persist the result as an `implementation-type` label.
9
9
 
10
10
  ## When to use
11
11
 
12
- - When picking up a bead that is missing the `implementation-type` label.
13
- - Immediately after creating a new bead, before claiming or scheduling it.
14
- - Any time you are unsure of a bead's classification.
12
+ - A bead is missing its `implementation-type` label and you are about to pick it up.
13
+ - A skill has just created a new bead and needs it classified before claiming or scheduling.
14
+ - You are unsure of a bead's classification and want to resolve it deterministically.
15
+
16
+ ## When NOT to use
17
+
18
+ - The bead already carries an `implementation-type` label — check `bd label list <id>` before invoking, and never re-classify a labelled bead.
19
+ - You are creating a new task — `create-task` classifies internally; do not spawn this skill separately.
20
+ - The work item is not a bead (e.g. a Jira ticket or plain code task) — use `write-a-ticket` or start the work directly.
15
21
 
16
22
  ## Invocation
17
23
 
18
- **Always run this skill as a subagent** (background `general-purpose` agent, `model: haiku`) to avoid loading bead content into the calling agent's context. Classification is a rubric lookup, not code generation, so the smaller/cheaper model is sufficient. Pass the bead ID and the `bd prime` output. The subagent runs the procedure below and reports back the classification and the `bd tag` command it applied.
24
+ Run this skill as a background subagent via {{TOOL:task}} so bead content never loads into the calling agent's context. Classification is a rubric lookup, not code generation — a small, cheap model is sufficient. Pass the bead ID and the `bd prime` output; the subagent runs the workflow below and reports back the classification plus the `bd tag` command it applied.
25
+
26
+ Only run inline when no task-spawning capability exists in the current environment.
27
+
28
+ **Callers should check `bd label list <id>` themselves first.** If `implementation-type` is already present, skip spawning this skill entirely — spawning a subagent purely to re-read a label that already exists wastes a full agent call.
29
+
30
+ ## Workflow
31
+
32
+ 1. **Check for an existing label.**
19
33
 
20
- Only run inline (without a subagent) if no task-spawning capability is available in the current environment.
34
+ ```bash
35
+ bd label list <id>
36
+ ```
21
37
 
22
- **Callers should check `bd label list <id>` themselves first.** If `implementation-type` is already present, skip spawning this skill entirely — spawning a subagent purely to re-read a label that's already there wastes a full agent call.
38
+ - `implementation-type:afk` present → classification is **AFK**. Stop here.
39
+ - `implementation-type:hitl` present → classification is **HITL**. Stop here.
23
40
 
24
- ## Procedure
41
+ 2. **Check the `## Type` field (back-compat).**
25
42
 
26
- ### 1. Check for an existing label
43
+ ```bash
44
+ bd show <id>
45
+ ```
27
46
 
28
- ```bash
29
- bd label list <id>
30
- ```
47
+ Locate the `## Type` section in the bead body. `HITL` or `AFK` (case-insensitive) determines the classification; continue to step 4. This field predates the label system, so treat it as authoritative when present.
31
48
 
32
- - If `implementation-type:afk` is present → classification is **AFK**. Stop here.
33
- - If `implementation-type:hitl` is present → classification is **HITL**. Stop here.
49
+ 3. **Classify from first principles** — only when neither the label nor the `## Type` field is present. Read the full bead body and apply the rubric:
34
50
 
35
- ### 2. Check the `## Type` field (back-compat)
51
+ **HITL** — the bead requires a human if at least one of the following is true:
52
+ - The outcome cannot be verified by an agent (e.g. visual review, stakeholder sign-off, UX judgement call).
53
+ - A manual action only a human can perform is required (e.g. credential setup, secrets management, external service configuration, infrastructure provisioning outside the codebase).
54
+ - A decision must be made that the agent cannot make unilaterally (e.g. architectural choice between equally valid options, regulatory or legal sign-off).
36
55
 
37
- ```bash
38
- bd show <id>
39
- ```
56
+ **AFK** — the agent can implement, verify, and complete the task autonomously, and all acceptance criteria are machine-checkable.
40
57
 
41
- Locate the `## Type` section in the bead body.
58
+ 4. **Apply the label.**
42
59
 
43
- - If the value is `HITL` (case-insensitive) → classification is **HITL**. Proceed to step 4.
44
- - If the value is `AFK` (case-insensitive) → classification is **AFK**. Proceed to step 4.
60
+ ```bash
61
+ bd tag <id> implementation-type:afk # or implementation-type:hitl
62
+ ```
45
63
 
46
- ### 3. Classify from first principles
64
+ 5. **Return the classification.** Report `AFK` or `HITL` so the calling skill or agent can act on it.
47
65
 
48
- If neither the label nor the `## Type` field is present, read the full bead body and apply this rubric:
66
+ ## Red Flags
49
67
 
50
- **HITL** — the bead requires a human if at least one of the following is true:
51
- - The outcome cannot be verified by an agent (e.g. visual review, stakeholder sign-off, UX judgement call).
52
- - The work requires a manual action only a human can perform (e.g. credential setup, secrets management, external service configuration, infrastructure provisioning outside the codebase).
53
- - A decision must be made that the agent cannot make unilaterally (e.g. architectural choice between equally valid options, regulatory or legal sign-off).
68
+ - Classifying a bead without the caller-side `bd label list` check — you either overwrite a recorded decision or waste an agent spawn re-reading a label that already exists.
69
+ - Defaulting to HITL for a complex task whose acceptance criteria are machine-checkable — complexity alone is not a criterion.
70
+ - Choosing a class without reading the bead body when neither the label nor `## Type` is present.
54
71
 
55
- **AFK** — the agent can implement, verify, and complete the task autonomously, and all acceptance criteria are machine-checkable.
72
+ ## Common Rationalizations
56
73
 
57
- Prefer AFK. Do not classify as HITL just because the task is complex — only when the agent genuinely cannot complete or verify it without human involvement.
74
+ | Rationalization | Rebuttal |
75
+ |---|---|
76
+ | "This task is complex, so it must be HITL" | Complexity is not a criterion. HITL applies only when a human is genuinely required to complete or verify. |
77
+ | "I'll mark it HITL to be safe" | HITL consumes scarce human attention. Prefer AFK — ralph's review gates still catch agent mistakes. |
78
+ | "The label is probably already there, I'll skip the check" | One `bd label list` command settles it. Skipping it either overwrites a decision or spawns an agent to re-read a label. |
58
79
 
59
- ### 4. Apply the label
80
+ ## Philosophy / rationale
60
81
 
61
- ```bash
62
- bd tag <id> implementation-type:afk # or implementation-type:hitl
63
- ```
82
+ - Classification gates automation against human attention: AFK beads feed ralph's autonomous pipeline, HITL beads are routed to a person. We prefer AFK because human time is the scarce resource, and later review gates still catch agent mistakes — escalate only when completion or verification genuinely requires a human.
83
+ - The rubric is deterministic, so this skill is a lookup rather than deep reasoning — which is why a cheap subagent suffices and the step 1 early exit exists.
64
84
 
65
- ### 5. Return the classification
85
+ ## Verification checklist
66
86
 
67
- Report back `AFK` or `HITL` so the calling skill or agent can act on it.
87
+ - [ ] `bd label list <id>` was checked before any other step.
88
+ - [ ] Classification followed the precedence order: existing label → `## Type` → first-principles rubric.
89
+ - [ ] The full bead body was read before classifying from first principles (step 3).
90
+ - [ ] `bd tag <id> implementation-type:<afk|hitl>` was applied.
91
+ - [ ] The calling skill or agent received the classification in the report.
@@ -0,0 +1,40 @@
1
+ # Create Task — Reference
2
+
3
+ Detail behind `skills/planning/create-task/SKILL.md`. The script (`scripts/create-chores.ts`) is the source of truth for this contract; this document mirrors it for verification.
4
+
5
+ ## Script invocation
6
+
7
+ ```
8
+ tsx create-chores.ts --parent <bead-id> [--priority <0-4>]
9
+ ```
10
+
11
+ - Reads `<skill>/pipeline.json`; creates each stage chore via `bd create` and wires dependencies via `bd dep add`.
12
+ - Prints a JSON object mapping each stage ID to its chore bead ID, plus `featurePrReview` for the PR gate.
13
+
14
+ ## Stage chore beads
15
+
16
+ One per stage in `pipeline.json` (currently `code`, `verify`, `review`, `document`):
17
+
18
+ - **Type**: `chore`
19
+ - **Title**: `[<parent-id>] <stage title>` (e.g. `[abc-123] Code`)
20
+ - **Labels**: `stage:<id>` (e.g. `stage:code`, `stage:verify`)
21
+ - **Dependencies**: `parent-child` to the parent bead; `blocks` between stages per each stage's `dependsOn` (the script requires `dependsOn` targets to appear earlier in `pipeline.json`).
22
+
23
+ ## PR gate bead (`featurePrReview`)
24
+
25
+ - **Type**: `task`
26
+ - **Title**: `[<parent-id>] PR Review and Merge`
27
+ - **Labels**: `implementation-type:hitl`, `lifecycle:feature-pr`
28
+ - **Dependencies**: `parent-child` to the parent bead; `blocks` on the final document stage chore (`document`, falling back to the last stage in `pipeline.json`).
29
+ - **Purpose**: human review of the agent PR (agent branch → feature branch) before the feature closes.
30
+
31
+ ## Current pipeline stages
32
+
33
+ | id | title | dependsOn |
34
+ |---|---|---|
35
+ | code | Code | — |
36
+ | verify | Verify | code |
37
+ | review | Review | verify |
38
+ | document | Document | review |
39
+
40
+ `maxFixRounds: 4` — the maximum fix-retry rounds allowed for a stage's verify loop before the PR gate. Adjust stages only in `pipeline.json`; the script and templates follow it.
@@ -1,96 +1,100 @@
1
1
  ---
2
2
  name: create-task
3
- description: Create a bead, classify it, and if AFK expand it into pipeline stage child beads plus a HITL PR gate task. Use when creating a new task that should be tracked and moved through implementation and human review gates.
3
+ description: Create a task bead, classify it as AFK or HITL, and if AFK expand it into pipeline stage chores plus a HITL PR gate. Use when starting tracked work with implementation and review gates — "create a task for this", "track this end-to-end", or "get this into the ralph pipeline".
4
4
  ---
5
5
 
6
6
  # Create Task
7
7
 
8
- Create a bead, classify it via `classify-bead`, and — if AFK — expand it into child chore beads for each pipeline stage plus a child HITL PR gate task bead.
8
+ Turn a piece of work into a tracked bead, classify it for autonomous (AFK) or human-in-the-loop (HITL) execution, and — when AFK — expand it into the standard pipeline: one chore bead per stage plus a HITL PR gate task so a human always reviews the finished branch. Parameters: `title` (required), `description` (required), `priority` (0–3, default 2), `parent` (epic bead ID, optional — sets a `parent-child` dependency).
9
9
 
10
- ## Inputs
10
+ ## When to use
11
11
 
12
- | Parameter | Required | Description |
13
- |-------------|----------|--------------------------------------|
14
- | title | yes | Task title |
15
- | description | yes | Task description |
16
- | priority | no | 0–3 (default 2) |
17
- | parent | no | Parent bead ID for `parent-child` dep |
12
+ - Starting new tracked work that must move through implementation, verification, and review gates — user phrases like "create a task for this", "track this work end-to-end", or "get this into the ralph pipeline".
13
+ - A caller (`prd-to-tasks`, `ralph-plan`) needs one task bead with the full child-chore structure.
18
14
 
19
- ## Procedure
15
+ ## When NOT to use
20
16
 
21
- ### 1. Create the bead
17
+ - Work that is only a raw idea, not ready to build — use `record-idea`.
18
+ - A feature that needs specification first — use `write-a-prd`, or `prd-to-tasks` to break an approved PRD into epics and tasks (`prd-to-tasks` calls this skill per task itself).
19
+ - A ticket for an external issue tracker aimed at human engineers — use `write-a-ticket`.
20
+ - A refactor that needs an incremental migration plan — use `request-refactor-plan`.
22
21
 
23
- ```bash
24
- bd create "<title>" --description "<description>" --priority <priority>
25
- ```
22
+ ## Workflow
26
23
 
27
- If a `parent` was provided, add a `parent-child` dependency:
24
+ 1. **Create the parent bead.**
28
25
 
29
- ```bash
30
- bd dep add <new-id> <parent> --type parent-child
31
- ```
26
+ ```bash
27
+ bd create "<title>" --description "<description>" --priority <priority>
28
+ ```
32
29
 
33
- Record the new bead ID.
30
+ If a `parent` epic was provided, record the dependency:
34
31
 
35
- ### 2. Classify the bead
32
+ ```bash
33
+ bd dep add <new-id> <parent> --type parent-child
34
+ ```
36
35
 
37
- Invoke the `classify-bead` skill on the new bead (as a subagent per that skill's invocation instructions). It returns `AFK` or `HITL`.
36
+ 2. **Check for an existing classification label.** Run `bd label list <id>`. If `implementation-type` is already present, skip step 3 — re-classifying a labelled bead wastes a subagent call.
38
37
 
39
- ### 3. Branch on classification
38
+ 3. **Classify the bead.** Delegate to the `classify-bead` skill as a subagent via {{TOOL:task}} — do not classify inline. It returns `AFK` or `HITL` and applies the `implementation-type` label.
40
39
 
41
- **If HITL**: stop. Report the bead ID and classification to the caller. No further action.
40
+ 4. **Branch on classification.**
41
+ - **HITL** — stop here. Report the bead ID and classification to the caller. Do not create pipeline chores: a human drives the work, so the chore tree does not apply.
42
+ - **AFK** — continue to step 5.
42
43
 
43
- **If AFK**: continue to step 4.
44
+ 5. **Expand into pipeline stage chores.** Run the `create-chores` script, which reads this skill's `pipeline.json` and deterministically creates all stage chores plus the PR gate bead in one shot:
44
45
 
45
- ### 4. Expand into pipeline stage chores
46
+ ```bash
47
+ # Run from the TARGET project's directory — bd resolves its beads DB from cwd;
48
+ # the skill's own location or `pnpm --prefix <scripts>` would target the wrong tree.
49
+ <skill-scripts>/node_modules/.bin/tsx \
50
+ <skill-scripts>/create-chores.ts \
51
+ --parent <parent-id> [--priority <priority>]
52
+ ```
46
53
 
47
- Run the `create-chores` script, which reads `pipeline.json` and deterministically creates all
48
- stage chores in one shot. They are plain (non-ephemeral) chores — `bd ready` must surface
49
- them without `--include-ephemeral` for ralph to discover them:
54
+ `<skill-scripts>` is the absolute path to this skill's own `scripts/` directory, resolved from wherever this skill was loaded — it varies by harness and install location, so never hardcode one harness's path.
50
55
 
51
- ```bash
52
- # Run from the TARGET project's directory (cwd must be inside the target's
53
- # .beads tree) — bd resolves its beads DB from cwd, not from the skill's
54
- # location. Do NOT use `pnpm --prefix <scripts> exec`, which changes cwd to
55
- # the scripts dir and makes bd pick the skill repo's own .beads instead of
56
- # the target project's.
57
- <skill-scripts>/node_modules/.bin/tsx \
58
- <skill-scripts>/create-chores.ts \
59
- --parent <parent-id> \
60
- --priority <priority>
61
- ```
56
+ 6. **Report.** Return the parent bead ID, the classification (`AFK`), and the created child bead IDs from the script output (including `featurePrReview`).
57
+
58
+ ## Red Flags
59
+
60
+ - **Running the script from the wrong directory.** Chores land in whatever `.beads` tree `bd` resolves from cwd — the target project's root is the only safe cwd.
61
+ - **Classifying inline.** The `classify-bead` rubric is a subagent's job (with a label short-circuit); inlining yours means re-reading bead content and drifting from the rubric.
62
+ - **Expanding an HITL bead.** If classification is HITL, stop — creating a chore tree for human-driven work is wrong.
63
+ - **Hardcoding `<skill-scripts>`.** The install path differs per harness (plugin cache, installed-plugins, dev checkout); resolve it at runtime.
64
+
65
+ ## Common Rationalizations
62
66
 
63
- Where `<skill-scripts>` is the absolute path to this skill's own `scripts/` directory —
64
- resolve it from wherever this skill was actually loaded from (it varies by harness and
65
- install location; e.g. a Claude Code plugin cache dir vs. a Copilot
66
- `~/.copilot/installed-plugins/...` install vs. a local dev checkout). Do not hardcode
67
- one harness's path.
67
+ | Rationalization | Rebuttal |
68
+ |---|---|
69
+ | "I know this task is AFK — I'll skip the classify-bead call" | Classification is a rubric check against the full bead body; assumptions masked by familiarity cause mislabelled work to hit the wrong queue. |
70
+ | "I'll create the chores by hand instead of running the script" | The script is the single source of truth for titles, labels, dep chains, and the PR gate. Hand-created chores drift silently. |
71
+ | "The pipeline is overkill for this small task" | If the work is worth tracking at all, the stage chore tree is what lets ralph execute and gate it. Not ready for that? Use `record-idea`. |
68
72
 
69
- The script outputs a JSON object mapping stage IDs to chore bead IDs, plus a HITL PR gate task bead ID, e.g.:
73
+ ## Philosophy / rationale
74
+
75
+ - **The script owns the expansion contract.** Pipeline stages, titles, labels, dependency chains, and the PR gate are deterministic — a one-shot script keeps every chore identical to the contract and reproducible across runs.
76
+ - **The PR gate is a hard human checkpoint.** Every AFK task ends with a `featurePrReview` task that blocks the final document stage, so automated work never merges without a human reviewing the branch.
77
+
78
+ ## Cross-skill references
79
+
80
+ - `classify-bead` — classify the new bead via subagent (step 3).
81
+
82
+ ## Examples
83
+
84
+ Input: title `Add export API to invoices`, description `…`, priority `2`, parent `epic-456`. Output: the parent bead ID plus the script's JSON mapping stage IDs → chore bead IDs, with `featurePrReview` as the HITL PR gate:
70
85
 
71
86
  ```json
72
- {
73
- "code": "abc123",
74
- "verify": "def456",
75
- "review": "ghi789",
76
- "document": "jkl012",
77
- "featurePrReview": "bd-mno345"
78
- }
87
+ {"code": "abc123", "verify": "def456", "review": "ghi789", "document": "jkl012", "featurePrReview": "bd-mno345"}
79
88
  ```
80
89
 
81
- Each stage chore is created with:
82
- - **type**: `chore`
83
- - **Title pattern**: `[<parent-id>] <stage title>` (e.g. `[abc-123] Code`)
84
- - **Labels**: `stage:<id>` (e.g. `stage:code`, `stage:verify`)
85
- - **Dependencies**: `parent-child` to parent bead; `blocks` between stages per `dependsOn`
86
-
87
- The PR gate bead is created with:
88
- - **type**: `task`
89
- - **Title**: `[<parent-id>] PR Review and Merge`
90
- - **Labels**: `implementation-type:hitl`, `lifecycle:feature-pr`
91
- - **Dependencies**: `parent-child` to parent bead; `blocks` on the final document stage chore
92
- - **Purpose**: human review of the agent PR (agent-branch → feature branch)
90
+ The full bead-property contract (titles, labels, dependencies per chore and for the PR gate) is in `REFERENCE.md`.
93
91
 
94
- ### 5. Report
92
+ ## Verification checklist
95
93
 
96
- Return the parent bead ID, classification (`AFK`), and the list of created child bead IDs (including `featurePrReview`).
94
+ - [ ] Parent bead exists with the correct title, description, and priority.
95
+ - [ ] `parent-child` dependency added when a parent epic was supplied.
96
+ - [ ] `implementation-type` label present on the parent bead (`bd label list <id>`).
97
+ - [ ] HITL path: no pipeline chores created, caller told the classification. AFK path: script ran from the target project's cwd and its JSON contains every stage ID plus `featurePrReview`.
98
+ - [ ] Chore titles/labels/dependencies match the contract (`[<parent-id>] <stage title>`, `stage:<id>`, `parent-child` to parent, `blocks` per `dependsOn`), verified against `REFERENCE.md`.
99
+ - [ ] PR gate task exists with `implementation-type:hitl` + `lifecycle:feature-pr` labels and blocks the final document stage chore.
100
+ - [ ] Report returned the parent bead ID, classification, and all child bead IDs.
@@ -39,8 +39,13 @@ function parseArgs(args: string[]): { parentId: string; priority: string } {
39
39
 
40
40
  // ─── Exec ─────────────────────────────────────────────────────────────────────
41
41
 
42
+ // BD_PATH env override lets machines where bd is not on PATH pin a location.
43
+ // Defaults to `bd`, resolved via PATH.
44
+ const BD_PATH = process.env.BD_PATH || 'bd';
45
+
42
46
  function run(args: string[]): string {
43
- return execSync(args.join(' '), { encoding: 'utf-8' }).trim();
47
+ const cmd = args[0] === 'bd' ? [BD_PATH, ...args.slice(1)] : args;
48
+ return execSync(cmd.join(' '), { encoding: 'utf-8' }).trim();
44
49
  }
45
50
 
46
51
  // ─── Main ─────────────────────────────────────────────────────────────────────
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsc" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsserver" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
19
+ else
20
+ exec node "$basedir/../tsx/dist/cli.mjs" "$@"
21
+ fi