@jaybeeuu/agent-cortex 1.20.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 (154) hide show
  1. package/.beads/README.md +81 -0
  2. package/.beads/config.yaml +1 -0
  3. package/.beads/issues.jsonl +236 -0
  4. package/.beads/metadata.json +7 -0
  5. package/.claude-plugin/marketplace.json +16 -0
  6. package/.github/workflows/ci.test.ts +217 -0
  7. package/.github/workflows/ci.yml +35 -0
  8. package/.github/workflows/publish.yml +36 -0
  9. package/.junie/guidelines.md +87 -0
  10. package/.junie/mcp/mcp.json +10 -0
  11. package/AGENTS.md +102 -0
  12. package/CHANGELOG.md +705 -0
  13. package/README.md +209 -0
  14. package/agents/README.md +235 -0
  15. package/agents/plan.agent.md +56 -0
  16. package/agents/ralph-plan.agent.md +119 -0
  17. package/agents/ralph.agent.md +305 -0
  18. package/agents/strategy.agent.md +109 -0
  19. package/agents-native/ralph.md +193 -0
  20. package/bin/agent-cortex.mjs +27 -0
  21. package/claude/.claude-plugin/plugin.json +11 -0
  22. package/claude/.mcp.json +18 -0
  23. package/claude/agents/plan.md +56 -0
  24. package/claude/agents/ralph-plan.md +119 -0
  25. package/claude/agents/ralph.md +193 -0
  26. package/claude/agents/strategy.md +109 -0
  27. package/claude/hooks.json +23 -0
  28. package/claude/scripts/statusline-command.sh +124 -0
  29. package/docs/ideas/auto-model-selection.md +75 -0
  30. package/docs/ideas/improve-pi-system-prompt.md +34 -0
  31. package/docs/ideas/model-selector.md +40 -0
  32. package/docs/ideas/pi-task-memory.md +34 -0
  33. package/docs/ideas/qa-extension.md +43 -0
  34. package/docs/inspirations.md +33 -0
  35. package/docs/research/gas-city-research.md +256 -0
  36. package/docs/research/skill-design-research.md +286 -0
  37. package/docs/research/skill-improvements-analysis.md +117 -0
  38. package/docs/research/skill-patterns-research.md +24 -0
  39. package/docs/skills/skill-anatomy.md +149 -0
  40. package/docs/user-preferences.md +17 -0
  41. package/extensions/agent-modes/index.ts +507 -0
  42. package/extensions/auto-name.ts +107 -0
  43. package/extensions/context-loader.md +35 -0
  44. package/extensions/context-loader.ts +65 -0
  45. package/extensions/lib/tiny-model.ts +212 -0
  46. package/extensions/notify/index.ts +293 -0
  47. package/extensions/session-start.ts +44 -0
  48. package/extensions/skill-stats/README.md +74 -0
  49. package/extensions/skill-stats/context-loader.test.ts +107 -0
  50. package/extensions/skill-stats/discover.ts +119 -0
  51. package/extensions/skill-stats/format.ts +13 -0
  52. package/extensions/skill-stats/index.test.ts +452 -0
  53. package/extensions/skill-stats/index.ts +222 -0
  54. package/extensions/skill-stats/package.json +19 -0
  55. package/extensions/skill-stats/pnpm-lock.yaml +329 -0
  56. package/extensions/skill-stats/record.ts +48 -0
  57. package/extensions/skill-stats/store.ts +104 -0
  58. package/extensions/skill-stats/tsconfig.json +12 -0
  59. package/extensions/subagent/README.md +175 -0
  60. package/extensions/subagent/agents/planner.md +37 -0
  61. package/extensions/subagent/agents/reviewer.md +35 -0
  62. package/extensions/subagent/agents/scout.md +50 -0
  63. package/extensions/subagent/agents/worker.md +24 -0
  64. package/extensions/subagent/agents.ts +126 -0
  65. package/extensions/subagent/index.ts +1138 -0
  66. package/extensions/subagent/prompts/implement-and-review.md +10 -0
  67. package/extensions/subagent/prompts/implement.md +10 -0
  68. package/extensions/subagent/prompts/scout-and-plan.md +9 -0
  69. package/hooks.json +10 -0
  70. package/lib/cli.mjs +37 -0
  71. package/package.json +39 -0
  72. package/pi/keybindings.json +3 -0
  73. package/pi/settings.json +29 -0
  74. package/plugin.json +35 -0
  75. package/pnpm-workspace.yaml +7 -0
  76. package/scripts/build-claude-agents.mjs +179 -0
  77. package/scripts/install-instructions.sh +82 -0
  78. package/skills/engineering/design-an-interface/SKILL.md +94 -0
  79. package/skills/engineering/grill-with-docs/SKILL.md +88 -0
  80. package/skills/engineering/improve-codebase-architecture/REFERENCE.md +78 -0
  81. package/skills/engineering/improve-codebase-architecture/SKILL.md +81 -0
  82. package/skills/engineering/tdd/SKILL.md +150 -0
  83. package/skills/engineering/tdd/deep-modules.md +33 -0
  84. package/skills/engineering/tdd/interface-design.md +31 -0
  85. package/skills/engineering/tdd/mocking.md +59 -0
  86. package/skills/engineering/tdd/refactoring.md +10 -0
  87. package/skills/engineering/tdd/tests.md +61 -0
  88. package/skills/engineering/technical-direction/SKILL.md +86 -0
  89. package/skills/planning/classify-bead/SKILL.md +67 -0
  90. package/skills/planning/create-task/SKILL.md +96 -0
  91. package/skills/planning/create-task/pipeline.json +33 -0
  92. package/skills/planning/create-task/scripts/create-chores.ts +112 -0
  93. package/skills/planning/create-task/scripts/package.json +14 -0
  94. package/skills/planning/create-task/scripts/pnpm-lock.yaml +342 -0
  95. package/skills/planning/create-task/scripts/tsconfig.json +12 -0
  96. package/skills/planning/create-task/templates/code.md +40 -0
  97. package/skills/planning/create-task/templates/document.md +40 -0
  98. package/skills/planning/create-task/templates/fix.md +27 -0
  99. package/skills/planning/create-task/templates/review.md +36 -0
  100. package/skills/planning/create-task/templates/verify.md +43 -0
  101. package/skills/planning/prd-to-tasks/SKILL.md +227 -0
  102. package/skills/planning/record-idea/SKILL.md +62 -0
  103. package/skills/planning/record-idea/scripts/new-idea.sh +89 -0
  104. package/skills/planning/request-refactor-plan/SKILL.md +73 -0
  105. package/skills/planning/write-a-prd/SKILL.md +74 -0
  106. package/skills/planning/write-a-ticket/SKILL.md +97 -0
  107. package/skills/productivity/bd-tool/SKILL.md +90 -0
  108. package/skills/productivity/grill-me/SKILL.md +10 -0
  109. package/skills/productivity/handoff/SKILL.md +15 -0
  110. package/skills/productivity/init-beads/SKILL.md +93 -0
  111. package/skills/productivity/teach/GLOSSARY-FORMAT.md +35 -0
  112. package/skills/productivity/teach/LEARNING-RECORD-FORMAT.md +46 -0
  113. package/skills/productivity/teach/MISSION-FORMAT.md +31 -0
  114. package/skills/productivity/teach/RESOURCES-FORMAT.md +32 -0
  115. package/skills/productivity/teach/SKILL.md +109 -0
  116. package/skills/productivity/validate-agent-dir/scripts/package.json +15 -0
  117. package/skills/productivity/validate-agent-dir/scripts/pnpm-lock.yaml +329 -0
  118. package/skills/productivity/validate-agent-dir/scripts/pnpm-workspace.yaml +2 -0
  119. package/skills/productivity/validate-agent-dir/scripts/tsconfig.json +19 -0
  120. package/skills/productivity/validate-agent-dir/scripts/validate-agent-dir.test.ts +317 -0
  121. package/skills/productivity/validate-agent-dir/scripts/validate-agent-dir.ts +127 -0
  122. package/skills/productivity/write-a-skill/SKILL.md +74 -0
  123. package/skills/review/maintain-agent-docs/REFERENCE.md +246 -0
  124. package/skills/review/maintain-agent-docs/SKILL.md +83 -0
  125. package/skills/review/refactor-skill/EXAMPLES.md +20 -0
  126. package/skills/review/refactor-skill/SKILL.md +148 -0
  127. package/skills/review/review-security/SKILL.md +107 -0
  128. package/skills/review/review-security/scripts/install-gitleaks.sh +43 -0
  129. package/skills/style/style-code/REFERENCE.md +38 -0
  130. package/skills/style/style-code/SKILL.md +113 -0
  131. package/skills/style/style-comms/SKILL.md +93 -0
  132. package/skills/style/style-documentation/SKILL.md +112 -0
  133. package/skills/style/style-tests/SKILL.md +97 -0
  134. package/skills/workflow/git-workflow/SKILL.md +85 -0
  135. package/skills/workflow/hitl-collab/SKILL.md +29 -0
  136. package/skills/workflow/plan/SKILL.md +272 -0
  137. package/skills/workflow/ralph/REFERENCE.md +202 -0
  138. package/skills/workflow/ralph/SKILL.md +105 -0
  139. package/skills/workflow/run-pipeline-stage/SKILL.md +151 -0
  140. package/skills/workflow/run-pipeline-stage/playbooks/code.md +17 -0
  141. package/skills/workflow/run-pipeline-stage/playbooks/document.md +18 -0
  142. package/skills/workflow/run-pipeline-stage/playbooks/fix.md +17 -0
  143. package/skills/workflow/run-pipeline-stage/playbooks/review.md +19 -0
  144. package/skills/workflow/run-pipeline-stage/playbooks/verify.md +14 -0
  145. package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +20 -0
  146. package/skills/workflow/run-pipeline-stage/scripts/generate-progress.test.ts +783 -0
  147. package/skills/workflow/run-pipeline-stage/scripts/generate-progress.ts +586 -0
  148. package/skills/workflow/run-pipeline-stage/scripts/package.json +15 -0
  149. package/skills/workflow/run-pipeline-stage/scripts/pnpm-lock.yaml +342 -0
  150. package/skills/workflow/run-pipeline-stage/scripts/pnpm-workspace.yaml +2 -0
  151. package/skills/workflow/run-pipeline-stage/scripts/tsconfig.json +12 -0
  152. package/skills/workflow/using-agent-skills/SKILL.md +109 -0
  153. package/skills/workflow/using-agent-skills/scripts/validate-skill-structure.test.ts +73 -0
  154. package/test/cli.test.mjs +149 -0
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: style-documentation
3
+ description: Defines what to document, what to skip, and how to structure documentation for TypeScript projects. Use BEFORE writing or updating any documentation (READMEs, doc comments, guides), when reviewing existing docs for drift, or when setting up "documentation conventions".
4
+ ---
5
+
6
+ # Documentation Style
7
+
8
+ ## When to use
9
+
10
+ - Deciding whether to write or update documentation.
11
+ - Reviewing existing documentation for drift or completeness.
12
+ - Asked for a "docs review", "what should I document", or "documentation conventions".
13
+
14
+ ## When NOT to use
15
+
16
+ - General writing tone, structure, and concision — use `style-comms` instead. This skill layers on top of it.
17
+ - Writing API reference docs that describe how a function works — that belongs in code comments, not a doc.
18
+
19
+ ## Philosophy / rationale
20
+
21
+ - **The code is the documentation.** Written docs exist to capture what the code cannot communicate on its own. A reader who can read the code should not need the docs to understand *how* something works — only a brief orientation, *why* it works that way, what decisions shaped it, and how the pieces fit together at a high level.
22
+ - **Sparse docs maintained well beat comprehensive docs that drift.** Every word that falls out of sync with reality actively misleads. Fewer words, kept accurate, is a winning strategy.
23
+ - **Docs need grooming like code.** Each doc is a commitment to maintain. Prune outdated content, update what changed, delete what no longer serves. A doc that does not earn its keep should be removed.
24
+ - **Gift future engineers a starting point.** Write docs that point to the code and explain the journey that led to it, not that restate it.
25
+
26
+ ## Workflow
27
+
28
+ 1. **Find what already exists.** Search the project and wider knowledge base for relevant documentation — ADRs, READMEs, inline docs, `docs/` directories, and any team Confluence pages. A surprising number of documentation changes are updates to documents you forgot existed.
29
+
30
+ 2. **Decide what action is needed.** Evaluate the subject against these criteria:
31
+ - **Nothing changed, nothing missing** — leave it. Doing nothing is often the correct outcome.
32
+ - **Something changed** — update the existing document. Add a sentence noting what changed and why.
33
+ - **Existing doc is stale or misleading** — prune the outdated parts or delete it outright. Stale docs actively mislead; a deleted doc leaves a clean gap that someone will fill correctly.
34
+ - **No documentation exists and a criterion below is met** — create something new.
35
+
36
+ Only create new documentation when at least one of these is true:
37
+ - A decision was made — why this approach over a reasonable alternative.
38
+ - Macro behaviour changed — what the system now does that it didn't before, at a level above the code.
39
+ - A constraint exists that isn't visible in the code — a trade-off, an upstream dependency, a known limitation.
40
+ - No orientation exists for this area — add a brief overview covering intent, purpose, and how it fits into the wider system.
41
+
42
+ 3. **Choose the smallest viable change.** The order of preference is:
43
+ - Update an existing document.
44
+ - Add a single well-placed sentence.
45
+ - Add a paragraph.
46
+ - Add a new section.
47
+ - Create a new file (last resort — only when no suitable home exists).
48
+
49
+ 4. **Write for the reader who knows the code.** Provide a brief orientation, explain the decisions, show how the pieces fit. Do not restate implementation detail — the code already does that.
50
+
51
+ 5. **Keep it concise.** Use plain prose. Reserve bullet points for genuinely enumerable items. Do not use headings for documents shorter than three sections.
52
+
53
+ 6. **Check tone and structure.** Invoke `style-comms` for guidance on tone, concision, and document structure. This skill governs *what* and *whether* to document; style-comms governs the *how*.
54
+
55
+ 7. **Scan for secrets.** Run `review-security` before committing to catch any credentials, tokens, or real values that leaked into examples or sample configs.
56
+
57
+ ## Red Flags
58
+
59
+ - **Documenting implementation detail.** If a reader can learn it in under a minute by reading the code, it doesn't belong in a doc.
60
+ - **Writing speculatively.** Decisions that haven't been made yet are aspirations, not documentation. They capture a wish, not reality.
61
+ - **Creating a new file unnecessarily.** A sentence in an existing document is cheaper to find, read, and maintain than a new file that fragments knowledge.
62
+ - **Documenting for the sake of it.** Docs, like code, carry a maintenance cost. Every doc must earn its place — and once written, it must be groomed, pruned, and kept accurate. A doc that drifts from reality is worse than no doc at all.
63
+
64
+ ## Common Rationalizations
65
+
66
+ | Rationalization | Rebuttal |
67
+ |---|---|
68
+ | "I'll add docs later" | If the context is fresh now, it's fresh. Later you will have forgotten the nuance. Write it now or don't. |
69
+ | "More docs is always better" | Every word that drifts from reality actively misleads. Sparse accurate docs beat comprehensive drift. |
70
+ | "This is obvious from the code" | Then do not write it. The code is the documentation — let it do the work. |
71
+ | "This doc is harmless even if it drifts" | Drift is not harmless — it erodes trust. Every stale sentence makes the reader wonder what else is wrong. Prune or update instead. |
72
+
73
+ ## Cross-skill references
74
+
75
+ | When you need… | Use this skill |
76
+ |---|---|
77
+ | Tone, structure, and concision for writing | `style-comms` |
78
+ | Code-level conventions and inline comments | `style-code` |
79
+ | Secrets and credential scanning before committing | `review-security` |
80
+
81
+ ## Examples
82
+
83
+ ### Decision documented vs aspirational
84
+
85
+ | Instead of… | Write… |
86
+ |---|---|
87
+ | "We may want to migrate to Kafka in the future." | "We chose RabbitMQ over Kafka because our throughput fits the simpler model and operational overhead was critical. See ADR-004 for the full tradeoff." |
88
+
89
+ ### Brief orientation vs implementation restatement
90
+
91
+ | Instead of… | Write… |
92
+ |---|---|
93
+ | Three paragraphs on how `calculateFees` iterates over transactions and applies each rate tier | "Fees are computed per-transaction using tiered rates defined in `src/fees/rates.ts`. See the module docs for the exact logic." |
94
+
95
+ ### Maintenance first
96
+
97
+ | Instead of… | Write… |
98
+ |---|---|
99
+ | Writing a new `docs/deployment-kubernetes.md` repeating steps already in `README.md` | Searching first, then adding a sentence to the existing "Deployment" section linking to the K8s manifests |
100
+ | Leaving a stale ADR that references a replaced approach | Pruning the outdated decision record or marking it superseded with a link to the replacement |
101
+ | Adding a new doc for a concept already partially covered in three places | Consolidating into one well-maintained location, deleting the others |
102
+
103
+ ## Verification checklist
104
+
105
+ - [ ] Searched for existing documentation on the subject before writing
106
+ - [ ] Stale or misleading content was pruned or updated, not left to rot
107
+ - [ ] Documentation passes the "code can't communicate this on its own" test
108
+ - [ ] No implementation detail restated from the code
109
+ - [ ] No speculative or aspirational content about undecided features
110
+ - [ ] Uses the smallest viable change (existing doc → sentence → paragraph → section → new file)
111
+ - [ ] Tone and structure checked against `style-comms`
112
+ - [ ] Staged changes scanned with `review-security` for leaked secrets
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: style-tests
3
+ description: Defines this project's test-writing conventions — assertion strategy, mock discipline, and what to test. Use BEFORE writing or editing any test and when reviewing tests — consult it whenever you add or change test files rather than choosing an approach ad hoc. Also for a "test review", "mock strategy", or deciding "what to test".
4
+ ---
5
+
6
+ # Test Style
7
+
8
+ ## When to use
9
+
10
+ - Writing new tests, reviewing existing tests, or debugging a failing test suite.
11
+ - Deciding between unit, integration, or e2e for a given behaviour.
12
+ - Asked for a "test review", "what should I test", or "is this test well-written".
13
+
14
+ ## When NOT to use
15
+
16
+ - The red-green-refactor development loop — use `tdd` instead.
17
+ - Code-level style and conventions — use `style-code`.
18
+
19
+ ## Philosophy / rationale
20
+
21
+ - **Test behaviour, not implementation.** A passing test should survive a refactor that does not change observable behaviour. If a test fails after a refactor that preserved behaviour, the test was wrong.
22
+ - **Prefer sociable tests over mockery.** Favour integration tests over unit tests. Reserve unit tests for complex functional logic that benefits from tight isolation. Use e2e smoke tests to prove the system hangs together. This is the testing trophy, not the testing pyramid.
23
+ - **Every test has a cost.** Time to write, run, and maintain. Only write a test when its value exceeds its weight. Each behaviour should be covered at least once — ideally only once.
24
+
25
+ ## Workflow
26
+
27
+ 1. **Determine the test level.** Can you test this behaviour through the module's public API or interface? Prefer integration-level tests. Reserve unit tests for complex functional logic that genuinely benefits from tight isolation. Use a small number of e2e smoke tests to prove the system hangs together.
28
+
29
+ 2. **Decide what to mock.** Mock as little as possible. A useful mental model: mock what is **above** the module under test in the dependency tree, not below it. At the integration level, mock only genuine external systems. At e2e, mock almost nothing.
30
+
31
+ 3. **Write the test structure.** Use a `describe` block per module or function; use `it` per behaviour. Name tests descriptively — the name should communicate what the system does, not how. The relationship between setup, action, and assertion should be self-evident.
32
+
33
+ 4. **Set up data.** Inline what matters — any value that is asserted on or establishes the test condition must appear inline in the test body. Use factory/builder helpers for complex objects with sensible defaults, but any value that changes the test condition must be an explicit override, never buried in a default. Avoid `before`/`after` hooks for shared state; they are acceptable only for expensive, non-observable infrastructure setup (e.g. starting a server or database).
34
+
35
+ 5. **Write targeted assertions.** Prefer `toMatchObject` over asserting every property. Multiple assertions are fine when they all verify the same behaviour. Avoid asserting call counts when asserting call arguments already covers the behaviour.
36
+
37
+ 6. **Review against the checklist below.** Read the test as if you are seeing the codebase for the first time.
38
+
39
+ ## Red Flags
40
+
41
+ - **Mocking implementation details.** Hooking into internal module structure ties tests to code shape, not behaviour. Mock the module's public interface instead.
42
+ - **Duplicating type or lint coverage.** Types and linting already provide those guarantees. Repeating them with assertions adds maintenance cost for zero value.
43
+ - **Skipping flaky tests.** A flaky test is a broken test. Fix it or delete it. Skipping normalises unreliability across the suite.
44
+ - **Sharing state via hooks.** Tests must be fully independent. `before`/`after` hooks that set up shared mutable state create order-dependent failures.
45
+ - **`any` or unsafe casts in test code.** Test code is production code. Be strict with types — no `any`, no unsafe casts, no cutting corners.
46
+ - **Skipping a failing test.** A failing test means behaviour broke. Investigate and fix it — do not paper over it.
47
+
48
+ ## Common Rationalizations
49
+
50
+ | Rationalization | Rebuttal |
51
+ |---|---|
52
+ | "It passed locally" | CI is the only truth. If a test is flaky, it is broken — fix or delete. |
53
+ | "I'll mock this to keep the test simple" | Over-mocking hides integration bugs. Mock the boundary, not the internals. |
54
+ | "I'll fix the flake later" | No you will not. Fix it now or delete it. |
55
+ | "This test is too small for that pattern" | Small tests benefit from structure too. Consistency beats shortcuts. |
56
+ | "I'll skip this failing test and come back" | A skipped test is a blind spot. The failure is telling you something — listen to it. |
57
+
58
+ ## Cross-skill references
59
+
60
+ | When you need… | Use this skill |
61
+ |---|---|
62
+ | Red-green-refactor development loop | `tdd` |
63
+ | Code-level style and conventions | `style-code` |
64
+ | Secrets and credential scanning | `review-security` |
65
+
66
+ ## Examples
67
+
68
+ ### Mock boundaries
69
+
70
+ | Instead of… | Write… |
71
+ |---|---|
72
+ | Mocking the internal database driver to verify a query was called | Testing through the repository interface with a test double at that boundary |
73
+ | Mocking `fetch` in a unit test for an API client | Testing the client with a real HTTP stub that returns controlled responses |
74
+
75
+ ### Targeted assertions
76
+
77
+ | Instead of… | Write… |
78
+ |---|---|
79
+ | `expect(result).toEqual(fullExpectedObject)` with every field asserted | `expect(result).toMatchObject({ status: "success", id: expect.any(String) })` |
80
+ | `expect(mockSave).toHaveBeenCalledTimes(1)` and then `expect(mockSave).toHaveBeenCalledWith(data)` | Just the call-args assertion — count is redundant |
81
+
82
+ ### Factory overrides
83
+
84
+ | Instead of… | Write… |
85
+ |---|---|
86
+ | `const user = createUser();` where the test needs `isAdmin: true` but the default happens to set it | `const user = createUser({ isAdmin: true });` — explicit override visible in the test body |
87
+
88
+ ## Verification checklist
89
+
90
+ - [ ] Test verifies behaviour, not implementation structure
91
+ - [ ] No mocking of internal module details — only public interfaces
92
+ - [ ] No `before`/`after` hooks for shared test state (infrastructure setup only)
93
+ - [ ] Assertions are targeted — no over-asserting or redundant checks
94
+ - [ ] No skipped or commented-out tests
95
+ - [ ] No flaky tests — all deterministic
96
+ - [ ] No `any` or unsafe casts in test code
97
+ - [ ] No duplication of type or linting coverage
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: git-workflow
3
+ description: "Enforces git discipline: feature branches over direct pushes, git worktrees for isolation, and GitHub PRs for all changes. Use when making any change to a codebase — this is the default workflow."
4
+ ---
5
+
6
+ # Git Workflow
7
+
8
+ Follow this workflow when asked to make changes unattended (AFK-mode). When
9
+ collaborating with a human on the same branch, work in their workspace —
10
+ do not create a separate worktree that splits attention.
11
+
12
+ If unsure whether you're working solo or collaboratively, ask.
13
+
14
+ ## Rules
15
+
16
+ ### 1. Feature branches — always
17
+
18
+ Never commit directly to `main` or `master`. Every change gets a feature branch.
19
+
20
+ ```
21
+ ❌ git commit -m "fix" # on main — never
22
+ ✅ git checkout -b feat/my-thing
23
+ ```
24
+
25
+ Branch naming:
26
+ - `feat/<description>` — new features
27
+ - `fix/<description>` — bug fixes
28
+ - `refactor/<description>` — refactoring
29
+ - `chore/<description>` — tooling, config, CI, docs
30
+
31
+ ### 2. Git worktrees — for unattended solo work
32
+
33
+ Use `git worktree add` to create an isolated working directory instead of
34
+ stashing or switching branches in-place. Worktrees let you work on multiple
35
+ branches simultaneously without interference.
36
+
37
+ ```bash
38
+ git worktree add ../my-repo-feat-branch feat/my-branch
39
+ ```
40
+
41
+ Worktrees are cheaper than clones (shared object store) and safer than
42
+ stashing — **but only when you're working solo**. If the human is also
43
+ working on the same thing, use a shared branch and workspace instead.
44
+
45
+ **When collaborating**: ask the human what workspace/branch they're on. Do
46
+ not spin up a separate worktree — work in the same checkout so you both see
47
+ the same state.
48
+
49
+ ### 3. Pull requests for review
50
+
51
+ Every feature branch ends in a GitHub PR. Open the PR early (draft if unfinished) so the diff is visible.
52
+
53
+ ```bash
54
+ gh pr create --title "..." --body "..."
55
+ gh pr create --draft # early
56
+ ```
57
+
58
+ ### 4. Sync before branching
59
+
60
+ Before creating a feature branch, sync with upstream:
61
+
62
+ ```bash
63
+ git checkout main
64
+ git pull
65
+ ```
66
+
67
+ This avoids avoidable merge conflicts.
68
+
69
+ ### 5. Worktree lifecycle
70
+
71
+ After the PR is merged or closed, clean up the worktree:
72
+
73
+ ```bash
74
+ cd /path/to/main/repo
75
+ git worktree remove ../my-repo-feat-branch
76
+ git branch -d feat/my-branch
77
+ ```
78
+
79
+ ## When NOT to use
80
+
81
+ - **Collaborating with a human** on the same code — use their workspace,
82
+ not a separate worktree.
83
+ - Single-character typo fixes that are already on a branch.
84
+ - Emergency hotfixes to production that bypass normal process (rare, explicit).
85
+ - **If unsure** whether you're working solo or alongside a human: ask.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: hitl-collab
3
+ description: Coordinates HITL collaboration by producing a handoff document and optionally updating the HITL bead with a summary and doc link. Use when a task requires human review/approval, manual steps, or PR handoff collaboration.
4
+ ---
5
+
6
+ # HITL Collab
7
+
8
+ ## Quick start
9
+
10
+ 1. Run `bd show <bead-id>` (bead ID is required).
11
+ 2. Create `.agent-cortex/working-docs/hitl/<bead-id>/handoff.md`.
12
+ 3. If the bead lacks **PR/branch links + manual steps + acceptance criteria**, add a short note with those details and the handoff doc path via `bd update <bead-id> --notes "<text>"`.
13
+
14
+ ## Handoff doc template
15
+
16
+ - **Summary**
17
+ - **Why HITL**
18
+ - **PR/branch links**
19
+ - **Acceptance criteria**
20
+ - **Manual steps**
21
+ - **Verification checklist**
22
+ - **References** (optional)
23
+
24
+ ## Workflow
25
+
26
+ 1. Gather context from the bead description and any referenced PRs/branches.
27
+ 2. Write the handoff doc using the template above. Use the `style-comms` skill for tone.
28
+ 3. Use `.agent-cortex/working-docs/hitl/<bead-id>/` as the home for any additional notes, scripts, screenshots, or logs needed for collaboration.
29
+ 4. Only update the bead if it is missing **PR/branch links**, **manual steps**, or **acceptance criteria**. Include the handoff doc path in the note.
@@ -0,0 +1,272 @@
1
+ ---
2
+ name: plan
3
+ description: Guide a feature from first discussion through PRD and task breakdown to classified beads ready for execution, then produce a handoff bead for ralph. Use when starting a new feature, scoping work to hand off to ralph, investigating a codebase change and structuring the work, or saying "plan this" or "get this ready for ralph".
4
+ argument-hint: Feature description, PRD draft, or goal you want to plan.
5
+ ---
6
+
7
+ # Plan
8
+
9
+ Orchestrate the full ideate → specify → decompose → classify → handoff workflow. Produces a complete bead tree (epics + classified tasks with pipeline stages) and a top-level bead ID to pass to a separate agent running the `ralph` skill.
10
+
11
+ Covers everything needed to prepare work for autonomous execution: understand the problem, write a PRD, break it into vertical-slice tasks, classify each one, and expand AFK tasks into pipeline-stage chore beads. Stops before execution — the user reviews the plan, then hands off a bead ID to ralph.
12
+
13
+ ## When to use
14
+
15
+ - "Plan this feature for me"
16
+ - "Get this ready for ralph"
17
+ - "I need to investigate a codebase change, scope the work, and set up the beads"
18
+ - User wants the full flow: investigation → PRD → task breakdown → classified beads → handoff
19
+ - User has an existing PRD and wants to skip to the breakdown and bead creation (step in at Phase 2)
20
+
21
+ ## When NOT to use
22
+
23
+ - User already has a PRD and just needs it broken into tasks — use `prd-to-tasks` directly.
24
+ - Single well-understood task that just needs a bead — use `create-task`.
25
+ - Raw idea not ready for implementation planning — use `record-idea`.
26
+ - Detailed refactor plan with commit-level steps — use `request-refactor-plan`.
27
+ - Beads already exist and just need execution — use `ralph` directly.
28
+
29
+ ## Workflow
30
+
31
+ ### Phase 1 — Understand and specify
32
+
33
+ Establish what needs to be built through investigation and collaborative design.
34
+
35
+ 1. Ask the user to describe the problem, goal, or feature in their own words. Listen for what currently exists, what is missing, and what success looks like.
36
+
37
+ 2. Explore the codebase to verify the user's assertions and understand the current state of the relevant areas. Investigate:
38
+ - Existing architecture and data models
39
+ - Similar features already implemented
40
+ - Integration points (APIs, databases, third-party services)
41
+ - Test patterns and coverage conventions
42
+
43
+ 3. Interview the user relentlessly about every aspect of the plan until reaching shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. Cover:
44
+ - Scope boundaries — what is in and what is explicitly out
45
+ - Key data models and their relationships
46
+ - Module boundaries and interfaces
47
+ - Technical constraints and trade-offs
48
+ - How each change will be verified
49
+
50
+ 4. Sketch the major modules that will be built or modified. Look for opportunities to extract deep modules — ones that encapsulate significant behaviour behind a simple, testable interface.
51
+
52
+ 5. Draft a PRD using the template from `write-a-prd`. Include:
53
+ - Problem statement and solution summary
54
+ - Numbered user stories covering all aspects
55
+ - Implementation decisions (modules, interfaces, technical clarifications)
56
+ - Out-of-scope items
57
+
58
+ 6. Present the PRD to the user for review. Iterate until they approve it.
59
+
60
+ 7. Create an epic bead from the approved PRD:
61
+ ```bash
62
+ bd create "<Feature Title> — PRD" --type epic \
63
+ --description "<rendered PRD as markdown>" --priority p2
64
+ bd tag <epic-id> workflow:plan
65
+ ```
66
+
67
+ #### Phase 1 gate
68
+
69
+ - [ ] Codebase explored and assertions verified
70
+ - [ ] Design decisions resolved through interview
71
+ - [ ] Modules sketched and reviewed with the user
72
+ - [ ] PRD drafted and approved by the user
73
+ - [ ] Epic bead created from approved PRD
74
+
75
+ ### Phase 2 — Break into tasks
76
+
77
+ Take the approved PRD and produce a set of epics and tasks using tracer-bullet vertical slices.
78
+
79
+ 8. Review the user stories and implementation decisions from the PRD. Identify natural phase boundaries — each phase should be a thin end-to-end slice through all layers (schema, API, logic, UI, tests) that is demoable on its own.
80
+
81
+ 9. For each phase, define:
82
+ - **Title**: short descriptive name
83
+ - **User stories covered**: which PRD stories this phase addresses
84
+ - **What to build**: end-to-end behaviour description
85
+ - **Acceptance criteria**: verifiable outcomes
86
+
87
+ 10. If the work is small enough for a single epic (one phase, a few tasks), skip epics and proceed directly to Phase 3. A single epic with a few tasks dispatches through ralph more efficiently than creating unnecessary epic hierarchy. If the work has multiple distinct phases, create epics:
88
+ ```bash
89
+ bd create "<Phase Title>" --type epic \
90
+ --description "<epic body with scope, criteria, dependencies>" --priority <same as parent>
91
+ bd tag <epic-id> workflow:plan
92
+ bd dep add <epic-id> <parent-epic-id> --type parent-child
93
+ ```
94
+
95
+ 11. Present the proposed phase/task breakdown to the user. Ask:
96
+ - Does the granularity feel right?
97
+ - Should any phases be merged or split?
98
+ - Are the dependency relationships correct — can any run in parallel?
99
+
100
+ 12. Iterate until the user approves the breakdown. Every phase and task must represent a thin vertical slice.
101
+
102
+ #### Phase 2 gate
103
+
104
+ - [ ] Phases identified as vertical slices (not horizontal layers)
105
+ - [ ] Each phase has documented acceptance criteria
106
+ - [ ] Breakdown approved by the user
107
+
108
+ ### Phase 3 — Create and classify beads
109
+
110
+ For each task (within each epic), create a bead, classify it, and expand AFK tasks into pipeline-stage chore beads.
111
+
112
+ 13. For each task in dependency order (blockers first), create the task bead via `create-task`:
113
+ ```bash
114
+ # create-task handles: bead creation → classify → AFK: expand into pipeline stages → HITL: stop
115
+ ```
116
+ Pass the parent epic ID (if epics are used) so tasks are nested under their epic.
117
+
118
+ 14. After all tasks in an epic are created, tag the parent epic with the aggregate classification:
119
+ - If **any** task is HITL: `bd tag <epic-id> implementation-type:hitl`
120
+ - If **all** tasks are AFK: `bd tag <epic-id> implementation-type:afk`
121
+
122
+ 15. Present the full bead tree to the user:
123
+ ```
124
+ Epic: "Phase 1 Title" (#epic-abc)
125
+ ├── Task 1: "..." (#task-123) — AFK
126
+ ├── Task 2: "..." (#task-456) — HITL (visual review)
127
+ └── Task 3: "..." (#task-789) — AFK
128
+ Epic: "Phase 2 Title" (#epic-def)
129
+ ├── ...
130
+ ```
131
+
132
+ #### Phase 3 gate
133
+
134
+ - [ ] All tasks created via `create-task`
135
+ - [ ] All tasks classified (AFK or HITL)
136
+ - [ ] AFK tasks expanded into pipeline-stage chore beads plus PR gate
137
+ - [ ] Parent epics tagged with aggregate `implementation-type`
138
+ - [ ] Full bead tree presented to the user
139
+
140
+ ### Phase 4 — Prepare handoff to ralph
141
+
142
+ Deliver a handoff bead and instructions for running ralph.
143
+
144
+ 16. Determine the entry point:
145
+ - **Single epic**: the epic ID is the handoff bead.
146
+ - **Multiple independent epics**: create a parent meta-epic that groups them:
147
+ ```bash
148
+ bd create "<Feature Title> — Implementation" --type epic \
149
+ --description "Meta-epic grouping all phases for execution. See child epics for detail." \
150
+ --priority <same>
151
+ bd dep add <epic-1> <meta-epic> --type parent-child
152
+ bd dep add <epic-2> <meta-epic> --type parent-child
153
+ ```
154
+ The meta-epic ID is the handoff bead.
155
+ - **Sequentially dependent epics**: the first unblocked epic is the handoff bead — ralph will discover the rest via `bd ready` as dependencies clear.
156
+
157
+ 17. Tag the handoff bead for ralph's discovery:
158
+ ```bash
159
+ bd tag <handoff-id> workflow:ralph
160
+ ```
161
+
162
+ 18. Push the bead state:
163
+ ```bash
164
+ bd dolt push
165
+ ```
166
+
167
+ 19. Present the handoff summary:
168
+ ```
169
+ ✅ Plan complete. Ready for ralph.
170
+
171
+ Handoff bead: #<handoff-id>
172
+
173
+ To execute, tell an agent:
174
+
175
+ Use the ralph skill. Start from bead #<handoff-id>.
176
+
177
+ Full bead tree:
178
+
179
+ | Bead ID | Title | Type | Classification |
180
+ |---------|-------|------|---------------|
181
+ | #epic | Phase 1 | epic | AFK |
182
+ | #task | Task 1 | task | AFK (4 chore beads + PR gate) |
183
+ | #task | Task 2 | task | HITL |
184
+ | ... | ... | ... | ... |
185
+ ```
186
+
187
+ #### Phase 4 gate
188
+
189
+ - [ ] Handoff bead identified and tagged `workflow:ralph`
190
+ - [ ] Bead state pushed with `bd dolt push`
191
+ - [ ] Handoff summary presented with the exact instruction to give an agent
192
+
193
+ ## Phase-gate checklist
194
+
195
+ - [ ] Phase 1: PRD drafted and approved, epic bead created
196
+ - [ ] Phase 2: Task breakdown approved, epics created (if needed)
197
+ - [ ] Phase 3: All tasks created, classified, expanded, tree presented
198
+ - [ ] Phase 4: Handoff bead prepared, state pushed, summary delivered
199
+
200
+ ## Red Flags
201
+
202
+ - **Skipping the codebase investigation.** Surface-level understanding produces PRDs that miss integration constraints, existing patterns, or prior art. Always explore before designing.
203
+ - **Skipping the user interview.** The agent has incomplete context. The interview resolves ambiguities that would otherwise surface mid-execution as rework.
204
+ - **Creating horizontal slices.** "All the DB work first, then all the API work" is not tracer bullets. Every task must deliver end-to-end value.
205
+ - **Moving past Phase 2 without user approval.** The task breakdown shapes the entire execution. Do not create beads until the breakdown is approved.
206
+
207
+ ## Common Rationalizations
208
+
209
+ | Rationalization | Rebuttal |
210
+ |---|---|
211
+ | "I know what needs to be built, I don't need a PRD" | A written PRD is the shared contract between the user, the planner, and the executor. It catches unstated assumptions. |
212
+ | "I'll refine the tasks as I go" | The plan phase is the right time to refine. Mid-execution task changes cause rework in the bead dependency graph and confuse ralph's stage tracking. |
213
+ | "This is a small change, I can just hand it straight to ralph" | For genuinely small changes — a single well-understood task — use `create-task` directly and skip this skill. This skill is for work that needs scoping. |
214
+ | "I already know the phases, skip the quiz" | The quiz is where edge cases surface. Present the proposed breakdown for quick confirmation rather than skipping. |
215
+
216
+ ## Philosophy / rationale
217
+
218
+ - **Tracer-bullet vertical slices** mean each completed task is independently demoable and verifiable. This avoids the "everything works but nothing is finished" trap.
219
+ - **The bead graph is the plan.** By storing scope, dependencies, and classification in beads, there is no separate document to drift. The handoff is just a bead ID.
220
+ - **Planning and execution are separate concerns.** The plan skill works with the user to get the right scope and structure. Ralph then executes autonomously within that structure. Separating them means the user reviews once, not piecemeal.
221
+ - **AFK by default.** Classify tasks as AFK unless a human is genuinely required. Agent capability grows over time — tasks that feel HITL today may be AFK tomorrow.
222
+
223
+ ## Cross-skill references
224
+
225
+ - `write-a-prd` — PRD template and interview workflow for Phase 1 (this skill incorporates the approach inline rather than delegating, to maintain a single coherent conversation).
226
+ - `prd-to-tasks` — For the task breakdown step in Phase 2. If the PRD is already written and only decomposition is needed, use that skill directly.
227
+ - `create-task` — Invoked in Phase 3 for each task. Handles bead creation, classification via `classify-bead`, and pipeline expansion for AFK tasks.
228
+ - `classify-bead` — Invoked internally by `create-task`; not invoked directly by this skill.
229
+ - `ralph` — The downstream skill that consumes the handoff bead. Run a separate agent with "Use the ralph skill. Start from bead #<handoff-id>."
230
+ - `record-idea` — Use this instead if the idea is not ready for implementation planning.
231
+ - `style-comms` — Invoke during Phase 1 if the user stories or implementation decisions need clearer writing.
232
+ - `style-documentation` — Invoke during Phase 1 to align PRD documentation conventions with project standards.
233
+
234
+ ## Examples
235
+
236
+ **Input:** "Plan this for me — I want to add a webhook notification system so external services can subscribe to order events."
237
+
238
+ **Output after Phase 4:**
239
+ ```
240
+ ✅ Plan complete. Ready for ralph.
241
+
242
+ Handoff bead: #epic-abc123
243
+
244
+ To execute, tell an agent:
245
+
246
+ Use the ralph skill. Start from bead #epic-abc123.
247
+
248
+ Full bead tree:
249
+
250
+ | Bead ID | Title | Type | Classification |
251
+ |---------|-------|------|---------------|
252
+ | #epic-abc123 | Webhook Notification System — PRD | epic | AFK |
253
+ | #task-456 | Create webhook subscription schema + API | task | AFK (4 chore beads + PR gate) |
254
+ | #task-789 | Implement event dispatch and retry logic | task | AFK (4 chore beads + PR gate) |
255
+ | #task-012 | Build subscriber management UI | task | HITL (visual review) |
256
+ ```
257
+
258
+ ## Verification checklist
259
+
260
+ - [ ] Codebase was explored before drafting the PRD
261
+ - [ ] User interview completed — each design branch resolved before moving to the next
262
+ - [ ] PRD written with user stories and implementation decisions
263
+ - [ ] PRD approved by the user before bead creation
264
+ - [ ] Epic bead created from the approved PRD body
265
+ - [ ] Task breakdown uses vertical slices (each task covers all layers — schema, API, logic, UI if applicable, tests)
266
+ - [ ] Task breakdown approved by the user before moving to Phase 3
267
+ - [ ] All tasks created via `create-task` (which handles classification, pipeline expansion, and PR gate creation)
268
+ - [ ] Parent epics tagged with aggregate `implementation-type` (AFK if all children AFK, HITL if any child is HITL)
269
+ - [ ] Full bead tree presented to the user before handoff
270
+ - [ ] Handoff bead tagged `workflow:ralph`
271
+ - [ ] Bead state pushed with `bd dolt push`
272
+ - [ ] Handoff summary includes the exact instruction to give an agent