@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.
- package/.beads/README.md +81 -0
- package/.beads/config.yaml +1 -0
- package/.beads/issues.jsonl +236 -0
- package/.beads/metadata.json +7 -0
- package/.claude-plugin/marketplace.json +16 -0
- package/.github/workflows/ci.test.ts +217 -0
- package/.github/workflows/ci.yml +35 -0
- package/.github/workflows/publish.yml +36 -0
- package/.junie/guidelines.md +87 -0
- package/.junie/mcp/mcp.json +10 -0
- package/AGENTS.md +102 -0
- package/CHANGELOG.md +705 -0
- package/README.md +209 -0
- package/agents/README.md +235 -0
- package/agents/plan.agent.md +56 -0
- package/agents/ralph-plan.agent.md +119 -0
- package/agents/ralph.agent.md +305 -0
- package/agents/strategy.agent.md +109 -0
- package/agents-native/ralph.md +193 -0
- package/bin/agent-cortex.mjs +27 -0
- package/claude/.claude-plugin/plugin.json +11 -0
- package/claude/.mcp.json +18 -0
- package/claude/agents/plan.md +56 -0
- package/claude/agents/ralph-plan.md +119 -0
- package/claude/agents/ralph.md +193 -0
- package/claude/agents/strategy.md +109 -0
- package/claude/hooks.json +23 -0
- package/claude/scripts/statusline-command.sh +124 -0
- package/docs/ideas/auto-model-selection.md +75 -0
- package/docs/ideas/improve-pi-system-prompt.md +34 -0
- package/docs/ideas/model-selector.md +40 -0
- package/docs/ideas/pi-task-memory.md +34 -0
- package/docs/ideas/qa-extension.md +43 -0
- package/docs/inspirations.md +33 -0
- package/docs/research/gas-city-research.md +256 -0
- package/docs/research/skill-design-research.md +286 -0
- package/docs/research/skill-improvements-analysis.md +117 -0
- package/docs/research/skill-patterns-research.md +24 -0
- package/docs/skills/skill-anatomy.md +149 -0
- package/docs/user-preferences.md +17 -0
- package/extensions/agent-modes/index.ts +507 -0
- package/extensions/auto-name.ts +107 -0
- package/extensions/context-loader.md +35 -0
- package/extensions/context-loader.ts +65 -0
- package/extensions/lib/tiny-model.ts +212 -0
- package/extensions/notify/index.ts +293 -0
- package/extensions/session-start.ts +44 -0
- package/extensions/skill-stats/README.md +74 -0
- package/extensions/skill-stats/context-loader.test.ts +107 -0
- package/extensions/skill-stats/discover.ts +119 -0
- package/extensions/skill-stats/format.ts +13 -0
- package/extensions/skill-stats/index.test.ts +452 -0
- package/extensions/skill-stats/index.ts +222 -0
- package/extensions/skill-stats/package.json +19 -0
- package/extensions/skill-stats/pnpm-lock.yaml +329 -0
- package/extensions/skill-stats/record.ts +48 -0
- package/extensions/skill-stats/store.ts +104 -0
- package/extensions/skill-stats/tsconfig.json +12 -0
- package/extensions/subagent/README.md +175 -0
- package/extensions/subagent/agents/planner.md +37 -0
- package/extensions/subagent/agents/reviewer.md +35 -0
- package/extensions/subagent/agents/scout.md +50 -0
- package/extensions/subagent/agents/worker.md +24 -0
- package/extensions/subagent/agents.ts +126 -0
- package/extensions/subagent/index.ts +1138 -0
- package/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/extensions/subagent/prompts/implement.md +10 -0
- package/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/hooks.json +10 -0
- package/lib/cli.mjs +37 -0
- package/package.json +39 -0
- package/pi/keybindings.json +3 -0
- package/pi/settings.json +29 -0
- package/plugin.json +35 -0
- package/pnpm-workspace.yaml +7 -0
- package/scripts/build-claude-agents.mjs +179 -0
- package/scripts/install-instructions.sh +82 -0
- package/skills/engineering/design-an-interface/SKILL.md +94 -0
- package/skills/engineering/grill-with-docs/SKILL.md +88 -0
- package/skills/engineering/improve-codebase-architecture/REFERENCE.md +78 -0
- package/skills/engineering/improve-codebase-architecture/SKILL.md +81 -0
- package/skills/engineering/tdd/SKILL.md +150 -0
- package/skills/engineering/tdd/deep-modules.md +33 -0
- package/skills/engineering/tdd/interface-design.md +31 -0
- package/skills/engineering/tdd/mocking.md +59 -0
- package/skills/engineering/tdd/refactoring.md +10 -0
- package/skills/engineering/tdd/tests.md +61 -0
- package/skills/engineering/technical-direction/SKILL.md +86 -0
- package/skills/planning/classify-bead/SKILL.md +67 -0
- package/skills/planning/create-task/SKILL.md +96 -0
- package/skills/planning/create-task/pipeline.json +33 -0
- package/skills/planning/create-task/scripts/create-chores.ts +112 -0
- package/skills/planning/create-task/scripts/package.json +14 -0
- package/skills/planning/create-task/scripts/pnpm-lock.yaml +342 -0
- package/skills/planning/create-task/scripts/tsconfig.json +12 -0
- package/skills/planning/create-task/templates/code.md +40 -0
- package/skills/planning/create-task/templates/document.md +40 -0
- package/skills/planning/create-task/templates/fix.md +27 -0
- package/skills/planning/create-task/templates/review.md +36 -0
- package/skills/planning/create-task/templates/verify.md +43 -0
- package/skills/planning/prd-to-tasks/SKILL.md +227 -0
- package/skills/planning/record-idea/SKILL.md +62 -0
- package/skills/planning/record-idea/scripts/new-idea.sh +89 -0
- package/skills/planning/request-refactor-plan/SKILL.md +73 -0
- package/skills/planning/write-a-prd/SKILL.md +74 -0
- package/skills/planning/write-a-ticket/SKILL.md +97 -0
- package/skills/productivity/bd-tool/SKILL.md +90 -0
- package/skills/productivity/grill-me/SKILL.md +10 -0
- package/skills/productivity/handoff/SKILL.md +15 -0
- package/skills/productivity/init-beads/SKILL.md +93 -0
- package/skills/productivity/teach/GLOSSARY-FORMAT.md +35 -0
- package/skills/productivity/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/skills/productivity/teach/MISSION-FORMAT.md +31 -0
- package/skills/productivity/teach/RESOURCES-FORMAT.md +32 -0
- package/skills/productivity/teach/SKILL.md +109 -0
- package/skills/productivity/validate-agent-dir/scripts/package.json +15 -0
- package/skills/productivity/validate-agent-dir/scripts/pnpm-lock.yaml +329 -0
- package/skills/productivity/validate-agent-dir/scripts/pnpm-workspace.yaml +2 -0
- package/skills/productivity/validate-agent-dir/scripts/tsconfig.json +19 -0
- package/skills/productivity/validate-agent-dir/scripts/validate-agent-dir.test.ts +317 -0
- package/skills/productivity/validate-agent-dir/scripts/validate-agent-dir.ts +127 -0
- package/skills/productivity/write-a-skill/SKILL.md +74 -0
- package/skills/review/maintain-agent-docs/REFERENCE.md +246 -0
- package/skills/review/maintain-agent-docs/SKILL.md +83 -0
- package/skills/review/refactor-skill/EXAMPLES.md +20 -0
- package/skills/review/refactor-skill/SKILL.md +148 -0
- package/skills/review/review-security/SKILL.md +107 -0
- package/skills/review/review-security/scripts/install-gitleaks.sh +43 -0
- package/skills/style/style-code/REFERENCE.md +38 -0
- package/skills/style/style-code/SKILL.md +113 -0
- package/skills/style/style-comms/SKILL.md +93 -0
- package/skills/style/style-documentation/SKILL.md +112 -0
- package/skills/style/style-tests/SKILL.md +97 -0
- package/skills/workflow/git-workflow/SKILL.md +85 -0
- package/skills/workflow/hitl-collab/SKILL.md +29 -0
- package/skills/workflow/plan/SKILL.md +272 -0
- package/skills/workflow/ralph/REFERENCE.md +202 -0
- package/skills/workflow/ralph/SKILL.md +105 -0
- package/skills/workflow/run-pipeline-stage/SKILL.md +151 -0
- package/skills/workflow/run-pipeline-stage/playbooks/code.md +17 -0
- package/skills/workflow/run-pipeline-stage/playbooks/document.md +18 -0
- package/skills/workflow/run-pipeline-stage/playbooks/fix.md +17 -0
- package/skills/workflow/run-pipeline-stage/playbooks/review.md +19 -0
- package/skills/workflow/run-pipeline-stage/playbooks/verify.md +14 -0
- package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +20 -0
- package/skills/workflow/run-pipeline-stage/scripts/generate-progress.test.ts +783 -0
- package/skills/workflow/run-pipeline-stage/scripts/generate-progress.ts +586 -0
- package/skills/workflow/run-pipeline-stage/scripts/package.json +15 -0
- package/skills/workflow/run-pipeline-stage/scripts/pnpm-lock.yaml +342 -0
- package/skills/workflow/run-pipeline-stage/scripts/pnpm-workspace.yaml +2 -0
- package/skills/workflow/run-pipeline-stage/scripts/tsconfig.json +12 -0
- package/skills/workflow/using-agent-skills/SKILL.md +109 -0
- package/skills/workflow/using-agent-skills/scripts/validate-skill-structure.test.ts +73 -0
- package/test/cli.test.mjs +149 -0
package/README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# agent-cortex
|
|
2
|
+
|
|
3
|
+
A personal collection of custom agents and skills, shipped to three harnesses from one
|
|
4
|
+
source: the [GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/plugins-creating),
|
|
5
|
+
pi, and [Claude Code](https://code.claude.com/docs) (as a plugin).
|
|
6
|
+
|
|
7
|
+
## Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
agent-cortex/
|
|
11
|
+
├── plugin.json # Copilot plugin manifest
|
|
12
|
+
├── .claude-plugin/
|
|
13
|
+
│ └── marketplace.json # Claude marketplace (exposes ./claude as the "jaybeeuu" market)
|
|
14
|
+
├── agents/ # Canonical agents (Copilot/pi format: *.agent.md)
|
|
15
|
+
│ ├── ralph.agent.md
|
|
16
|
+
│ ├── ralph-plan.agent.md
|
|
17
|
+
│ ├── plan.agent.md
|
|
18
|
+
│ └── strategy.agent.md
|
|
19
|
+
├── agents-native/ # Claude-only agents with no Copilot equivalent
|
|
20
|
+
│ └── ralph.md # the lean Claude Ralph
|
|
21
|
+
├── skills/ # Skills (grouped by domain) — shared by all harnesses
|
|
22
|
+
│ ├── engineering/ # tdd, improve-codebase-architecture, …
|
|
23
|
+
│ ├── planning/ # write-a-prd, prd-to-tasks, design-an-interface, …
|
|
24
|
+
│ ├── productivity/ # bd-tool, write-a-skill, grill-me, …
|
|
25
|
+
│ ├── review/ # review-security, refactor-skill, maintain-agent-docs
|
|
26
|
+
│ ├── style/ # style-code, style-tests, style-comms, style-documentation
|
|
27
|
+
│ └── workflow/ # ralph, run-pipeline-stage, create-task, …
|
|
28
|
+
├── extensions/ # pi extensions (pi only)
|
|
29
|
+
│ ├── skill-stats/
|
|
30
|
+
│ └── notify/
|
|
31
|
+
├── pi/ # Global pi configuration (see below)
|
|
32
|
+
│ └── settings.json
|
|
33
|
+
├── scripts/
|
|
34
|
+
│ └── build-claude-agents.mjs # builds the claude/ subtree from the sources above
|
|
35
|
+
└── claude/ # Self-contained Claude Code plugin (GENERATED — do not hand-edit)
|
|
36
|
+
├── .claude-plugin/
|
|
37
|
+
│ └── plugin.json
|
|
38
|
+
├── .mcp.json # MCP servers (context7, github)
|
|
39
|
+
├── hooks.json # SessionStart hooks (beads context + style policy)
|
|
40
|
+
├── agents/ # generated from agents/*.agent.md + copied from agents-native/
|
|
41
|
+
└── skills/ # symlinks to the grouped skills/ dirs (28 skills)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The same `agents/` and `skills/` power three harnesses (Copilot, pi, Claude Code).
|
|
45
|
+
The `claude/` subtree is **generated** by `scripts/build-claude-agents.mjs`
|
|
46
|
+
(`pnpm build:claude`) and committed; CI checks it is never stale:
|
|
47
|
+
|
|
48
|
+
- **Skills** stay single-source — `claude/skills/<name>` are symlinks into the grouped
|
|
49
|
+
`skills/<group>/<name>` dirs (Claude discovers skills only one level deep, so the
|
|
50
|
+
grouping is flattened via links, not copies).
|
|
51
|
+
- **Agents** can't be shared files (the frontmatter formats differ), so `claude/agents/*.md`
|
|
52
|
+
are converted from the canonical `agents/*.agent.md`. Claude only loads agents from a
|
|
53
|
+
plugin's default `agents/` dir, so the plugin root is `claude/` — isolating it from the
|
|
54
|
+
Copilot `.agent.md` files.
|
|
55
|
+
- **Claude-native agents** that have no Copilot equivalent live in `agents-native/*.md` and are
|
|
56
|
+
copied verbatim into `claude/agents/`. `ralph` is one: it is reimplemented for Claude around
|
|
57
|
+
background workers + an independent review gate (the Copilot Ralph's `task`/`read_agent`
|
|
58
|
+
poll loop has no Claude equivalent), so it can't be mechanically converted.
|
|
59
|
+
|
|
60
|
+
Edit the sources (`agents/*.agent.md`, `agents-native/*.md`, `skills/**`), never anything
|
|
61
|
+
under `claude/`.
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
### Symlink as global pi config
|
|
66
|
+
|
|
67
|
+
This repo's `pi/settings.json` is symlinked to `~/.pi/agent/settings.json`,
|
|
68
|
+
making it the canonical store for personal pi agent configuration:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
~/.pi/agent/settings.json -> /path/to/agent-cortex/pi/settings.json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
All `pi install` / `pi remove` commands write to this file, and changes are
|
|
75
|
+
committed to git. On a fresh machine:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
git clone https://github.com/jaybeeuu/agent-cortex
|
|
79
|
+
ln -sf "$PWD/agent-cortex/pi/settings.json" ~/.pi/agent/settings.json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Pi package dependencies
|
|
83
|
+
|
|
84
|
+
These packages are declared in `pi/settings.json` and auto-installed by pi:
|
|
85
|
+
|
|
86
|
+
| Package | Version | Purpose |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| [`pi-web-access`](https://www.npmjs.com/package/pi-web-access) | 0.10.7 | Web search, URL fetching, GitHub repo access, PDF/YouTube/video analysis |
|
|
89
|
+
|
|
90
|
+
Desktop notifications are handled by the local `extensions/notify/` extension
|
|
91
|
+
(replaces the former `pi-notify` dependency). It sends an OSC desktop
|
|
92
|
+
notification on multi-turn tasks, labelled with the tmux session:window.pane
|
|
93
|
+
if available, or the project directory name otherwise.
|
|
94
|
+
|
|
95
|
+
### Copilot plugin (separate)
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
copilot plugin install jaybeeuu/agent-cortex
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or install a local checkout:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
copilot plugin install ./agent-cortex
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Claude Code plugin (separate)
|
|
108
|
+
|
|
109
|
+
The Claude plugin is the self-contained `claude/` subtree (manifest at
|
|
110
|
+
`claude/.claude-plugin/plugin.json`), containing **4 agents** (`strategy`, `plan`,
|
|
111
|
+
`ralph-plan`, `ralph`), **28 skills**, a `SessionStart` hook, and 2 MCP servers.
|
|
112
|
+
|
|
113
|
+
`claude/` is committed, so a fresh clone is installable as-is. If you change the sources,
|
|
114
|
+
rebuild it (the generator is a zero-dependency Node script):
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
pnpm build:claude # or: node scripts/build-claude-agents.mjs
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Try it for one session
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
claude --plugin-dir /path/to/agent-cortex/claude
|
|
124
|
+
# verify what loaded:
|
|
125
|
+
claude --plugin-dir /path/to/agent-cortex/claude plugin details agent-cortex
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`SKILL.md` edits are picked up live in that session; agent, hook, and MCP changes need
|
|
129
|
+
`/reload-plugins`.
|
|
130
|
+
|
|
131
|
+
#### Install persistently (recommended)
|
|
132
|
+
|
|
133
|
+
The repo ships a marketplace manifest (`.claude-plugin/marketplace.json`) that exposes the
|
|
134
|
+
`claude/` subtree. Register it by **absolute path** (a bare `.` is rejected — use an absolute
|
|
135
|
+
path or a `./`-prefixed one), then install:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
claude plugin marketplace add /path/to/agent-cortex
|
|
139
|
+
claude plugin install agent-cortex@jaybeeuu # every session (user scope)
|
|
140
|
+
# or, for this project only:
|
|
141
|
+
claude plugin install agent-cortex@jaybeeuu --scope local
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
After installing, the agents and skills are available in every session with no `--plugin-dir`
|
|
145
|
+
flag, and Ralph is just `claude --agent agent-cortex:ralph`.
|
|
146
|
+
|
|
147
|
+
#### Update
|
|
148
|
+
|
|
149
|
+
The marketplace source is your local checkout, so after pulling changes you must rebuild the
|
|
150
|
+
`claude/` subtree and refresh the plugin:
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
git pull
|
|
154
|
+
pnpm build:claude # regenerate claude/ from the sources
|
|
155
|
+
claude plugin marketplace update jaybeeuu
|
|
156
|
+
claude plugin update agent-cortex # restart Claude Code to apply
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Uninstall
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
claude plugin uninstall agent-cortex
|
|
163
|
+
claude plugin marketplace remove jaybeeuu
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Using the agents
|
|
167
|
+
|
|
168
|
+
| Agent | How to invoke | Purpose |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `strategy` | delegate: "use the **strategy** agent…" | Vision brief / PRD / technical-direction docs |
|
|
171
|
+
| `ralph-plan` | delegate: "use the **ralph-plan** agent…" | Explore, grill, and file beads for a change |
|
|
172
|
+
| `plan` | delegate: "use the **plan** agent…" | End-to-end planning (PRD → classified beads) |
|
|
173
|
+
| `ralph` | **run as the main agent**: `claude --agent agent-cortex:ralph` | Parallel backlog orchestrator (below) |
|
|
174
|
+
|
|
175
|
+
Skills auto-trigger from their descriptions, or invoke one explicitly as
|
|
176
|
+
`/agent-cortex:<skill>` (e.g. `/agent-cortex:tdd`).
|
|
177
|
+
|
|
178
|
+
The lean **Ralph** runs as the interactive main agent (not delegated — it must stay alive to
|
|
179
|
+
receive its workers' completions):
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
claude --agent agent-cortex:ralph # (add --plugin-dir .../claude if not installed)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
It finds ready beads, spawns parallel background workers (implement → independent review →
|
|
186
|
+
fix), opens a PR per feature, and pauses at each human merge gate. After you merge, re-invoke
|
|
187
|
+
it and it resumes from `bd ready`.
|
|
188
|
+
|
|
189
|
+
#### Style-skill enforcement
|
|
190
|
+
|
|
191
|
+
The plugin's `SessionStart` hook injects a "style policy" each session, nudging Claude to
|
|
192
|
+
invoke `style-code` / `style-tests` / `style-documentation` / `style-comms` before the
|
|
193
|
+
corresponding work; the style skills' descriptions are also written to auto-trigger proactively.
|
|
194
|
+
|
|
195
|
+
#### Not ported / follow-ups
|
|
196
|
+
|
|
197
|
+
- The pi `extensions/` have no Claude runtime-extension equivalent (use hooks/MCP instead).
|
|
198
|
+
- Ralph follow-ups: multi-feature epic branches, and a GitHub-trigger routine to auto-resume
|
|
199
|
+
after a PR merge (instead of manual re-invocation).
|
|
200
|
+
- The Copilot/pi Ralph (the 4-stage `run-pipeline-stage` pipeline) is unchanged; those two
|
|
201
|
+
ralph-coupled skills (`ralph`, `run-pipeline-stage`) are intentionally not shipped to Claude.
|
|
202
|
+
|
|
203
|
+
#### Contributing to the Claude plugin
|
|
204
|
+
|
|
205
|
+
Edit the **sources** — `agents/*.agent.md` (Copilot format, auto-converted),
|
|
206
|
+
`agents-native/*.md` (Claude-only agents like `ralph`), and `skills/**` — then run
|
|
207
|
+
`pnpm build:claude`. Never hand-edit anything under `claude/` (except the hand-authored
|
|
208
|
+
`claude/hooks.json`, `claude/.mcp.json`, and `claude/.claude-plugin/plugin.json`). CI runs
|
|
209
|
+
`git diff --exit-code claude/agents/ claude/skills/` so the generated tree can never drift.
|
package/agents/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Agent Directory Format
|
|
2
|
+
|
|
3
|
+
This document defines the canonical format for composable agent directories in agent-cortex.
|
|
4
|
+
|
|
5
|
+
## Motivation
|
|
6
|
+
|
|
7
|
+
The current format uses a single `*.agent.md` file per agent, combining harness-agnostic logic with harness-specific configuration. This creates duplication when the same agent needs to run on multiple harnesses (PI, Copilot, Claude) with different tool names and polling mechanisms.
|
|
8
|
+
|
|
9
|
+
The new format separates concerns:
|
|
10
|
+
|
|
11
|
+
- **Shared body**: Harness-agnostic instructions (workflow, branching model, constraints)
|
|
12
|
+
- **Harness-specific frontmatter**: Tool names, model preferences, metadata per harness
|
|
13
|
+
- **Section files**: Harness-specific instructions (e.g., polling loops) included via tokens
|
|
14
|
+
|
|
15
|
+
## Directory Structure
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
agents/
|
|
19
|
+
├── <agent-name>/
|
|
20
|
+
│ ├── agent.md # Shared body (harness-agnostic)
|
|
21
|
+
│ ├── pi/
|
|
22
|
+
│ │ ├── frontmatter.json # PI-specific metadata
|
|
23
|
+
│ │ └── <section>.md # Optional: PI-specific sections
|
|
24
|
+
│ ├── copilot/
|
|
25
|
+
│ │ ├── frontmatter.json # Copilot-specific metadata
|
|
26
|
+
│ │ └── <section>.md # Optional: Copilot-specific sections
|
|
27
|
+
│ └── claude/
|
|
28
|
+
│ ├── frontmatter.json # Claude-specific metadata
|
|
29
|
+
│ └── <section>.md # Optional: Claude-specific sections
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Example: ralph agent
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
agents/ralph/
|
|
36
|
+
├── agent.md # Shared body (branching model, dispatch logic, constraints)
|
|
37
|
+
├── pi/
|
|
38
|
+
│ ├── frontmatter.json # PI tools: ["bash", "task", "read_agent"]
|
|
39
|
+
│ └── polling.md # PI polling loop using read_agent
|
|
40
|
+
├── copilot/
|
|
41
|
+
│ ├── frontmatter.json # Copilot tools (same as PI for now)
|
|
42
|
+
│ └── polling.md # Copilot polling (same as PI)
|
|
43
|
+
└── claude/
|
|
44
|
+
├── frontmatter.json # Claude tools: ["bash", "task"]
|
|
45
|
+
└── polling.md # Claude event-driven (no polling)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Example: plan agent (no per-harness sections)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
agents/plan/
|
|
52
|
+
├── agent.md # Shared body (planning workflow)
|
|
53
|
+
├── pi/
|
|
54
|
+
│ └── frontmatter.json # PI tools
|
|
55
|
+
├── copilot/
|
|
56
|
+
│ └── frontmatter.json # Copilot tools
|
|
57
|
+
└── claude/
|
|
58
|
+
└── frontmatter.json # Claude tools
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## File Specifications
|
|
62
|
+
|
|
63
|
+
### agent.md
|
|
64
|
+
|
|
65
|
+
The shared body contains everything harness-agnostic:
|
|
66
|
+
|
|
67
|
+
- Workflow instructions
|
|
68
|
+
- Branching model
|
|
69
|
+
- Stage pipeline rules
|
|
70
|
+
- Bead lifecycle management
|
|
71
|
+
- Constraints and guardrails
|
|
72
|
+
- Any shared logic
|
|
73
|
+
|
|
74
|
+
**No YAML frontmatter.** The file is pure markdown.
|
|
75
|
+
|
|
76
|
+
### frontmatter.json
|
|
77
|
+
|
|
78
|
+
JSON schema for harness-specific metadata:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"name": "agent-cortex:ralph",
|
|
83
|
+
"description": "Parallel task orchestration agent",
|
|
84
|
+
"tools": ["bash", "task", "read_agent"],
|
|
85
|
+
"model": "claude-sonnet-4-5", // optional
|
|
86
|
+
"argumentHint": "Run all pending beads" // optional
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Required Fields
|
|
91
|
+
|
|
92
|
+
| Field | Type | Description |
|
|
93
|
+
|-------|------|-------------|
|
|
94
|
+
| `name` | `string` | Agent identifier (e.g., `agent-cortex:ralph`) |
|
|
95
|
+
| `description` | `string` | What the agent does (used in agent selection) |
|
|
96
|
+
| `tools` | `string[]` | Tool names the agent can use (non-empty) |
|
|
97
|
+
|
|
98
|
+
#### Optional Fields
|
|
99
|
+
|
|
100
|
+
| Field | Type | Description |
|
|
101
|
+
|-------|------|-------------|
|
|
102
|
+
| `model` | `string` | Preferred model for this harness |
|
|
103
|
+
| `argumentHint` | `string` | Usage hint shown to users |
|
|
104
|
+
|
|
105
|
+
#### Constraints
|
|
106
|
+
|
|
107
|
+
- No unknown fields allowed (strict schema)
|
|
108
|
+
- `name` and `description` must be non-empty strings
|
|
109
|
+
- `tools` must be a non-empty array of strings
|
|
110
|
+
|
|
111
|
+
### Section Files
|
|
112
|
+
|
|
113
|
+
Optional markdown files in harness subdirectories that contain harness-specific instructions. Included via `{{SECTION:name}}` tokens in agent.md.
|
|
114
|
+
|
|
115
|
+
Examples:
|
|
116
|
+
- `polling.md` — Polling loop logic (differs between PI and Claude)
|
|
117
|
+
- `authentication.md` — Harness-specific auth setup
|
|
118
|
+
- `output-format.md` — Harness-specific output formatting
|
|
119
|
+
|
|
120
|
+
## Token Format
|
|
121
|
+
|
|
122
|
+
Tokens in agent.md reference tools, paths, and sections:
|
|
123
|
+
|
|
124
|
+
| Token | Syntax | Description |
|
|
125
|
+
|-------|--------|-------------|
|
|
126
|
+
| Tool reference | `{{TOOL:name}}` | Reference a tool by name (for documentation/highlighting) |
|
|
127
|
+
| Path reference | `{{PATH:path}}` | Reference a file path (e.g., skills, extensions) |
|
|
128
|
+
| Section include | `{{SECTION:name}}` | Include content from a section file in the harness directory |
|
|
129
|
+
|
|
130
|
+
### Examples
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
Use {{TOOL:task}} to spawn subagents.
|
|
134
|
+
|
|
135
|
+
Read {{PATH:skills/workflow/plan/SKILL.md}} for the full workflow.
|
|
136
|
+
|
|
137
|
+
{{SECTION:polling}}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
When composing the final agent file for a specific harness:
|
|
141
|
+
|
|
142
|
+
1. Start with agent.md content
|
|
143
|
+
2. Replace `{{SECTION:name}}` with content from `<harness>/<name>.md`
|
|
144
|
+
3. `{{TOOL:name}}` and `{{PATH:name}}` remain as-is (documentation tokens)
|
|
145
|
+
|
|
146
|
+
## Composition Rules
|
|
147
|
+
|
|
148
|
+
### For Harnesses with Sections
|
|
149
|
+
|
|
150
|
+
When a harness directory contains section files:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
agent.md + pi/frontmatter.json + pi/polling.md → composed agent
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The composer:
|
|
157
|
+
1. Reads agent.md as the base
|
|
158
|
+
2. For each `{{SECTION:name}}` token, reads `<harness>/<name>.md` and replaces the token
|
|
159
|
+
3. Prepends YAML frontmatter from `<harness>/frontmatter.json`
|
|
160
|
+
4. Outputs the composed agent file
|
|
161
|
+
|
|
162
|
+
### For Harnesses Without Sections
|
|
163
|
+
|
|
164
|
+
When a harness directory only has frontmatter.json:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
agent.md + pi/frontmatter.json → composed agent
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The composer:
|
|
171
|
+
1. Reads agent.md as the base
|
|
172
|
+
2. No section replacements needed
|
|
173
|
+
3. Prepends YAML frontmatter from `<harness>/frontmatter.json`
|
|
174
|
+
4. Outputs the composed agent file
|
|
175
|
+
|
|
176
|
+
### Agents with No Per-Harness Differences
|
|
177
|
+
|
|
178
|
+
Agents like `plan`, `ralph-plan`, and `strategy` that have identical behavior across harnesses still need per-harness directories for their frontmatter.json (since tool names differ between harnesses).
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
agents/plan/
|
|
182
|
+
├── agent.md # Shared body (same for all harnesses)
|
|
183
|
+
├── pi/frontmatter.json # PI tools
|
|
184
|
+
├── copilot/frontmatter.json # Copilot tools
|
|
185
|
+
└── claude/frontmatter.json # Claude tools
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Migration Path
|
|
189
|
+
|
|
190
|
+
1. Define the format (this document)
|
|
191
|
+
2. Migrate ralph agent first (proves the pattern)
|
|
192
|
+
3. Migrate plan, ralph-plan, strategy agents
|
|
193
|
+
4. Update the installer/composer to handle the new format
|
|
194
|
+
5. Remove old `*.agent.md` files
|
|
195
|
+
|
|
196
|
+
## Validation
|
|
197
|
+
|
|
198
|
+
Use the `validate-agent-dir` script to validate agent directories:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
node --test --import tsx/esm skills/productivity/validate-agent-dir/scripts/validate-agent-dir.test.ts
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The validator checks:
|
|
205
|
+
- agent.md exists
|
|
206
|
+
- At least one harness subdirectory with valid frontmatter.json
|
|
207
|
+
- Frontmatter conforms to the schema (required fields, no unknown fields)
|
|
208
|
+
|
|
209
|
+
## Design Decisions
|
|
210
|
+
|
|
211
|
+
### Why JSON for frontmatter instead of YAML?
|
|
212
|
+
|
|
213
|
+
- JSON has strict syntax (no comments, no ambiguity)
|
|
214
|
+
- Easier to validate with JSON Schema
|
|
215
|
+
- Consistent with existing tooling (package.json, plugin.json)
|
|
216
|
+
- No need for YAML parser dependency
|
|
217
|
+
|
|
218
|
+
### Why separate section files instead of inline sections?
|
|
219
|
+
|
|
220
|
+
- Keeps agent.md focused on shared logic
|
|
221
|
+
- Allows harness-specific sections to evolve independently
|
|
222
|
+
- Makes it clear what's shared vs what's harness-specific
|
|
223
|
+
- Enables conditional inclusion (only include sections relevant to the harness)
|
|
224
|
+
|
|
225
|
+
### Why require at least one harness directory?
|
|
226
|
+
|
|
227
|
+
- Ensures every agent has explicit harness configuration
|
|
228
|
+
- Prevents "default harness" ambiguity
|
|
229
|
+
- Makes the agent's capabilities explicit per harness
|
|
230
|
+
|
|
231
|
+
### Why strict schema (no unknown fields)?
|
|
232
|
+
|
|
233
|
+
- Catches typos and configuration errors early
|
|
234
|
+
- Makes the format self-documenting
|
|
235
|
+
- Prevents accidental field additions that break tooling
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Guide a feature from first discussion through PRD and task breakdown to classified beads ready for ralph execution. Full end-to-end planning workflow using the plan skill. Use when starting a new feature, scoping work to hand off to ralph, or saying 'plan this'."
|
|
3
|
+
name: "agent-cortex:plan"
|
|
4
|
+
tools: ["bash", "view", "edit", "create", "grep", "glob", "ask_user", "task", "read_agent", "skill"]
|
|
5
|
+
argument-hint: "Plan <feature or change description>"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a planning agent. Your job is to guide a feature from first discussion through PRD and task breakdown to classified beads ready for ralph execution.
|
|
9
|
+
|
|
10
|
+
You follow the **plan** skill workflow. The skill is defined in `skills/workflow/plan/SKILL.md`. Read it now to load the full instructions.
|
|
11
|
+
|
|
12
|
+
## Workflow summary
|
|
13
|
+
|
|
14
|
+
### Phase 1 — Understand and specify
|
|
15
|
+
1. Ask the user to describe the problem, goal, or feature.
|
|
16
|
+
2. Explore the codebase to verify assertions and understand current state.
|
|
17
|
+
3. Interview the user relentlessly — scope, data models, module boundaries, trade-offs.
|
|
18
|
+
4. Sketch major modules.
|
|
19
|
+
5. Draft a PRD using the `write-a-prd` template.
|
|
20
|
+
6. Present the PRD for user approval.
|
|
21
|
+
7. Create an epic bead from the approved PRD.
|
|
22
|
+
|
|
23
|
+
### Phase 2 — Break into tasks
|
|
24
|
+
8. Review PRD stories and identify vertical-slice phases.
|
|
25
|
+
9. Define each phase (title, stories, what to build, acceptance criteria).
|
|
26
|
+
10. Create epics for multi-phase work.
|
|
27
|
+
11. Present the breakdown for user approval.
|
|
28
|
+
|
|
29
|
+
### Phase 3 — Create and classify beads
|
|
30
|
+
13. Create task beads via `create-task` for each task.
|
|
31
|
+
14. Tag parent epics with aggregate classification.
|
|
32
|
+
15. Present the full bead tree.
|
|
33
|
+
|
|
34
|
+
### Phase 4 — Prepare handoff to ralph
|
|
35
|
+
16. Determine the handoff bead (epic or meta-epic).
|
|
36
|
+
17. Tag it `workflow:ralph`.
|
|
37
|
+
18. Push bead state with `bd dolt push`.
|
|
38
|
+
19. Present the handoff summary.
|
|
39
|
+
|
|
40
|
+
## Permitted writes
|
|
41
|
+
|
|
42
|
+
| Location | Purpose |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `.agent-cortex/working-docs/` | Research notes, decisions, exploration findings — gitignored |
|
|
45
|
+
| Bead fields (`description`, `design`) | Plans and specifications |
|
|
46
|
+
| `docs/prd/<topic>.md` | PRD documents |
|
|
47
|
+
|
|
48
|
+
Do **not** modify source code or tracked documentation outside these locations.
|
|
49
|
+
|
|
50
|
+
## Constraints
|
|
51
|
+
|
|
52
|
+
- Never modify source code.
|
|
53
|
+
- Always get user approval before moving between phases.
|
|
54
|
+
- Each phase has a gate — do not skip it.
|
|
55
|
+
- Work in `.agent-cortex/working-docs/` for scratchpad notes.
|
|
56
|
+
- Use `bd` commands for all bead operations.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Plans changes by exploring codebases and creating beads to track the work. Use when you want to scope a feature, bug fix, or refactor — the agent reads, reasons, grills the user, writes a high-level plan into the top-level bead, then files child beads ready for ralph."
|
|
3
|
+
name: "agent-cortex:ralph-plan"
|
|
4
|
+
tools: ["bash", "view", "edit", "create", "grep", "glob", "ask_user"]
|
|
5
|
+
argument-hint: "Plan <feature or change description>"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a planning agent. Your job is to understand a task, explore the codebase, grill the user until the design is clear, write a concise implementation plan, and file beads for ralph to implement. You **must not** modify any source code or tracked documentation — your writes are limited to `.agent-cortex/working-docs/` and bead fields.
|
|
9
|
+
|
|
10
|
+
## Permitted writes
|
|
11
|
+
|
|
12
|
+
| Location | Purpose |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `.agent-cortex/working-docs/` | Research notes, decision records, exploration findings — gitignored, never committed |
|
|
15
|
+
| Bead `description` / `design` fields | High-level plan (≤100 lines) written via MCP tools |
|
|
16
|
+
|
|
17
|
+
Do **not** write anywhere else. No source files, no READMEs, no tracked docs, no commits.
|
|
18
|
+
|
|
19
|
+
## .agent-cortex/working-docs conventions
|
|
20
|
+
|
|
21
|
+
- Create `.agent-cortex/working-docs/` if it doesn't exist.
|
|
22
|
+
- One file per concern: `exploration-<area>.md`, `decisions.md`, `open-questions.md`, etc.
|
|
23
|
+
- Sub-agents write their findings here; they do not update beads.
|
|
24
|
+
- Keep files focused — a few hundred lines max each.
|
|
25
|
+
- The directory is gitignored; treat it as a scratchpad, not a deliverable.
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
### 1. Load context
|
|
30
|
+
Invoke the **beads** skill (set workspace root, run `bd prime`). Hold the output in memory.
|
|
31
|
+
|
|
32
|
+
If the input looks like a PRD (product requirements document), invoke the **prd-to-tasks** skill first — it handles exploration, user quizzing, and creates epics and task beads directly. Then continue from step 7 (Agree with the user).
|
|
33
|
+
|
|
34
|
+
### 2. Understand the request
|
|
35
|
+
If the request is ambiguous or incomplete, use `ask_user` to resolve blockers before exploring. One question at a time.
|
|
36
|
+
|
|
37
|
+
If the domain language is unclear or inconsistent, invoke the **grill-with-docs** skill to extract canonical terms. It updates `CONTEXT.md` inline and surfaces ambiguities.
|
|
38
|
+
|
|
39
|
+
### 3. Explore the codebase
|
|
40
|
+
Dispatch parallel **explore** sub-agents — one per independent research area. Tell each sub-agent to write its findings to a named file in `.agent-cortex/working-docs/` and **not** to modify any beads or source files. Provide each sub-agent with the full `bd prime` output.
|
|
41
|
+
|
|
42
|
+
- If the task involves a bug or regression, investigate the root cause directly before exploring broader context: trace the code path, check recent changes with `git log`, attempt to reproduce, and classify the failure (regression / missing edge case / design flaw). Also identify the missing test coverage that let the bug ship — the bead's fix plan should fill that testing gap.
|
|
43
|
+
- If the task involves architectural change, invoke **improve-codebase-architecture** to surface structural concerns.
|
|
44
|
+
- If the task requires designing a new module API or interface, invoke **design-an-interface** to generate and compare options. Write the output to `.agent-cortex/working-docs/interface-design.md`.
|
|
45
|
+
|
|
46
|
+
### 4. Grill the user
|
|
47
|
+
After reviewing exploration findings, invoke the **grill-me** skill to surface and resolve outstanding design questions. Keep grilling until there are no open questions that would block implementation. Record answers in `.agent-cortex/working-docs/decisions.md`.
|
|
48
|
+
|
|
49
|
+
### 5. Write the plan
|
|
50
|
+
Update the top-level bead's `design` field with a high-level implementation plan. Invoke the **style-comms** skill first so the plan matches the project's communication style.
|
|
51
|
+
|
|
52
|
+
- **≤100 lines**. Link to `.agent-cortex/working-docs/` files for any detail that would push it over.
|
|
53
|
+
- Structure: Goal → Key decisions → Ordered workstreams → Risks / out-of-scope
|
|
54
|
+
- No line-by-line code guidance — just what, not how.
|
|
55
|
+
|
|
56
|
+
### 6. Decompose into tasks
|
|
57
|
+
For large workstreams (multiple distinct areas) invoke the **prd-to-tasks** skill. For a single self-contained task invoke **create-task**. Pass the full `bd prime` output and any relevant design context from the `design` field to each skill.
|
|
58
|
+
|
|
59
|
+
For each new feature bead and each new task bead, create a HITL planning gate before handoff. The feature/task bead depends on this gate and stays blocked until the user explicitly confirms planning is sufficient **for that specific feature/task**.
|
|
60
|
+
|
|
61
|
+
Every planning gate description must be cold-start-ready so another person can pick it up without prior chat context. Include all of: (1) what is being built and why, (2) decisions already made, (3) open questions/risks, and (4) references (bead IDs, files, or docs) used during planning.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
gate_id=$(bd create "Plan: <feature title>" --type task --description "<planning context, decisions, open questions, and references>")
|
|
65
|
+
bd tag <planning-gate-id> implementation-type:hitl
|
|
66
|
+
bd dep add <feature-or-task-id> <planning-gate-id> # feature/task depends on planning gate (gate blocks implementation)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Do not close planning gates in bulk. Only close a gate after the user explicitly confirms that exact feature/task is ready to implement; leave all unconfirmed gates open and blocking.
|
|
70
|
+
|
|
71
|
+
After creating each bead, invoke **classify-bead** to ensure it has an `implementation-type` label before handing off.
|
|
72
|
+
|
|
73
|
+
Tag every bead created in this step with `workflow:ralph`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
bd tag <id> workflow:ralph
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Tag every bead with a priority using the unified scale:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
bd tag <id> priority:<p0|p1|p2|p3|p4|p5>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| Priority | When | Examples |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| P0 | Drop everything | Crash, data loss, security breach |
|
|
88
|
+
| P1 | Fix before next feature | Major bug, no workaround |
|
|
89
|
+
| P2 | Fix soon, still before features | Minor bug, workaround exists |
|
|
90
|
+
| P3 | Core feature, blocks others | Feature that unlocks downstream work |
|
|
91
|
+
| P4 | Feature, important | Valuable but doesn't block others |
|
|
92
|
+
| P5 | Nice-to-have | Polish, cosmetic, improvement |
|
|
93
|
+
|
|
94
|
+
Bugs naturally outrank features on this scale (P0-P2 are always bugs). Calibrate each
|
|
95
|
+
bead against the full backlog — a P3 feature that blocks others may need a higher
|
|
96
|
+
explicit priority than a standalone P4 feature.
|
|
97
|
+
|
|
98
|
+
### 7. Agree with the user
|
|
99
|
+
Present the bead list (IDs, titles, one-line rationale each) plus planning gate status for each item using `✅` (confirmed/closed) or `⏳` (awaiting confirmation/open). Ask the user to confirm or request changes before finishing.
|
|
100
|
+
|
|
101
|
+
If any planning gates remain open, include an explicit warning that those features/tasks are still blocked and cannot be handed off to ralph yet. Iterate until approved.
|
|
102
|
+
|
|
103
|
+
### 8. Hand off to ralph
|
|
104
|
+
Once approved, report: "Plan complete — `bd ready` will show the first tasks for ralph."
|
|
105
|
+
|
|
106
|
+
## Exploration sub-agent instructions
|
|
107
|
+
|
|
108
|
+
Every explore sub-agent prompt must include:
|
|
109
|
+
1. The full `bd prime` output as context.
|
|
110
|
+
2. The specific area to investigate.
|
|
111
|
+
3. The path to write findings to (e.g. `.agent-cortex/working-docs/exploration-auth.md`).
|
|
112
|
+
4. The instruction: **"Write your findings to the file above. Do not modify any beads, source files, or tracked documentation."**
|
|
113
|
+
|
|
114
|
+
## Guardrails
|
|
115
|
+
|
|
116
|
+
- Never assume — verify by reading actual code before creating a bead.
|
|
117
|
+
- Never write outside `.agent-cortex/working-docs/` or bead fields.
|
|
118
|
+
- Never make commits, open PRs, or run shell commands that modify the repo.
|
|
119
|
+
- Use `bash` only for read-only commands (`git log`, `find`, `cat`, etc.).
|