@jaybeeuu/agent-cortex 1.37.1 → 1.38.1

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 (92) hide show
  1. package/.agents/skills/style-versioning/SKILL.md +9 -8
  2. package/.github/workflows/ci.yml +190 -8
  3. package/AGENTS.md +25 -6
  4. package/CHANGELOG.md +42 -0
  5. package/README.md +132 -33
  6. package/agents/README.md +47 -13
  7. package/agents/plan/agent.md +51 -0
  8. package/agents/plan/claude/frontmatter.json +6 -0
  9. package/agents/plan/copilot/frontmatter.json +6 -0
  10. package/agents/plan/pi/frontmatter.json +6 -0
  11. package/agents/plan.agent.md +3 -0
  12. package/agents/ralph/agent.md +262 -0
  13. package/agents/ralph/claude/frontmatter.json +6 -0
  14. package/agents/ralph/claude/polling.md +31 -0
  15. package/agents/ralph/copilot/frontmatter.json +6 -0
  16. package/agents/ralph/copilot/polling.md +62 -0
  17. package/agents/ralph/pi/frontmatter.json +6 -0
  18. package/agents/ralph/pi/polling.md +74 -0
  19. package/agents/ralph-plan/agent.md +114 -0
  20. package/agents/ralph-plan/claude/frontmatter.json +6 -0
  21. package/agents/ralph-plan/copilot/frontmatter.json +6 -0
  22. package/agents/ralph-plan/pi/frontmatter.json +6 -0
  23. package/agents/ralph-plan.agent.md +5 -2
  24. package/agents/ralph.agent.md +83 -57
  25. package/agents/strategy/agent.md +104 -0
  26. package/agents/strategy/claude/frontmatter.json +6 -0
  27. package/agents/strategy/copilot/frontmatter.json +6 -0
  28. package/agents/strategy/pi/frontmatter.json +6 -0
  29. package/agents/strategy.agent.md +3 -0
  30. package/bin/agent-cortex.mjs +68 -1
  31. package/bin/installers/claude.mjs +262 -0
  32. package/bin/installers/copilot.mjs +129 -0
  33. package/bin/installers/pi.mjs +197 -0
  34. package/claude/.claude-plugin/plugin.json +1 -1
  35. package/claude/agents/plan.md +3 -1
  36. package/claude/agents/ralph-plan.md +5 -3
  37. package/claude/agents/strategy.md +3 -1
  38. package/claude/hooks/scripts/notify.mjs +54 -0
  39. package/claude/hooks.json +15 -0
  40. package/docs/claude-hooks.md +115 -0
  41. package/docs/ideas/auto-model-selection.md +75 -0
  42. package/docs/ideas/improve-pi-system-prompt.md +34 -0
  43. package/docs/ideas/model-selector.md +40 -0
  44. package/docs/ideas/pi-task-memory.md +34 -0
  45. package/docs/ideas/qa-extension.md +43 -0
  46. package/docs/ideas/unified-ci-pipeline.md +28 -0
  47. package/docs/skills/skill-anatomy.md +9 -0
  48. package/extensions/agent-modes/README.md +54 -0
  49. package/extensions/agent-modes/discover.test.ts +241 -0
  50. package/extensions/agent-modes/discover.ts +458 -0
  51. package/extensions/agent-modes/index.ts +13 -224
  52. package/extensions/agent-modes/node_modules/.bin/pi +21 -0
  53. package/extensions/agent-modes/node_modules/.bin/tsc +21 -0
  54. package/extensions/agent-modes/node_modules/.bin/tsserver +21 -0
  55. package/extensions/agent-modes/node_modules/.bin/tsx +21 -0
  56. package/extensions/agent-modes/package.json +20 -0
  57. package/extensions/agent-modes/tsconfig.json +12 -0
  58. package/extensions/subagent/README.md +19 -0
  59. package/extensions/subagent/index.ts +131 -45
  60. package/extensions/subagent/node_modules/.bin/pi +21 -0
  61. package/extensions/subagent/node_modules/.bin/pi-ai +21 -0
  62. package/extensions/subagent/node_modules/.bin/tsc +21 -0
  63. package/extensions/subagent/node_modules/.bin/tsserver +21 -0
  64. package/extensions/subagent/node_modules/.bin/tsx +21 -0
  65. package/extensions/subagent/package.json +23 -0
  66. package/extensions/subagent/tsconfig.json +12 -0
  67. package/extensions/subagent/wait.test.ts +202 -0
  68. package/extensions/subagent/wait.ts +118 -0
  69. package/hooks/claude/hooks.json +38 -0
  70. package/hooks/claude/scripts/notify.mjs +54 -0
  71. package/lib/cli.mjs +62 -3
  72. package/package.json +6 -4
  73. package/plugin.json +1 -1
  74. package/scripts/build-copilot-agents.mjs +30 -0
  75. package/scripts/lib/compose-agent.mjs +241 -0
  76. package/skills/engineering/design-an-interface/SKILL.md +1 -1
  77. package/skills/engineering/improve-codebase-architecture/SKILL.md +1 -1
  78. package/skills/workflow/ralph/REFERENCE.md +2 -2
  79. package/skills/workflow/ralph/SKILL.md +6 -6
  80. package/skills/workflow/run-pipeline-stage/scripts/generate-progress.ts +4 -2
  81. package/skills/workflow/using-agent-skills/SKILL.md +122 -0
  82. package/test/cli.test.mjs +115 -2
  83. package/test/copilot-installer.test.mjs +298 -0
  84. package/test/installer.test.mjs +179 -0
  85. package/test/notify-hook.test.mjs +63 -0
  86. package/test/pi-installer.test.mjs +371 -0
  87. package/token-map.README.md +128 -0
  88. package/token-map.json +106 -0
  89. package/.github/workflows/ci.test.ts +0 -217
  90. package/.github/workflows/release.yml +0 -58
  91. package/scripts/build-claude-agents.mjs +0 -179
  92. package/scripts/publish-release.sh +0 -32
@@ -61,18 +61,19 @@ Fix status bead showing wrong priority after update
61
61
 
62
62
  ## After merge to main
63
63
 
64
- The `release.yml` workflow handles everything automatically:
64
+ The `release` job in `.github/workflows/ci.yml` handles everything automatically:
65
65
 
66
66
  1. **Detects new changesets** on main
67
- 2. **Creates or updates a "Version Packages" PR** with bumped versions and updated CHANGELOG
67
+ 2. **Creates a "Version Packages" PR** — the `version` step runs `pnpm version-packages`, which bumps `package.json`, syncs `plugin.json` (via `scripts/sync-plugin-version.sh`), updates `CHANGELOG.md`, and regenerates the committed generated output (`pnpm build:claude`, `pnpm build:copilot`) so the drift gates never fail on a version bump
68
68
  3. **When "Version Packages" is merged**:
69
- - Bumps `package.json` version
70
- - Syncs `plugin.json` version (via `scripts/sync-plugin-version.sh`)
71
- - Updates `CHANGELOG.md`
72
69
  - Creates a git tag
73
- - Publishes to npm via OIDC (no `NPM_TOKEN` needed)
70
+ - Publishes to npm — `pnpm publish-package` packs with `pnpm pack` and publishes with `npm publish --provenance --access public`. Authenticates via npm Trusted Publishing (OIDC): the release job's `id-token` permission lets npm exchange a GitHub OIDC token for a short-lived npm token at publish time, so no `NPM_TOKEN` secret or `.npmrc` auth config is required — only the one-time npm-side Trusted Publishing setup on npmjs.com (package → Access → Trusted Publishing → GitHub repo `jaybeeuu/agent-cortex` + workflow `.github/workflows/ci.yml`)
74
71
  - Creates a GitHub release automatically
75
72
 
73
+ `changesets/action` execs the `version`/`publish` inputs without a shell, so each
74
+ must be a single unquoted command token — keep release logic in pnpm scripts
75
+ (`version-packages`, `publish-package`), never inline shell strings.
76
+
76
77
  ### Version lockstep
77
78
 
78
79
  All version numbers stay in lockstep automatically:
@@ -96,6 +97,6 @@ All version numbers stay in lockstep automatically:
96
97
  | Before (manual) | After (changesets) |
97
98
  |---|---|
98
99
  | Agent bumps versions locally | Agent writes a changeset file |
99
- | Manual GitHub release creation | Automated via `release.yml` |
100
- | `publish.yml` triggered by release | `release.yml` triggered by push to main |
100
+ | Manual GitHub release creation | Automated by the `release` job in `ci.yml` |
101
+ | `publish.yml` triggered by release | `ci.yml` release job on push to main |
101
102
  | Version sync was manual | `sync-plugin-version.sh` runs automatically |
@@ -7,7 +7,40 @@ on:
7
7
  pull_request:
8
8
 
9
9
  jobs:
10
- changeset:
10
+ setup:
11
+ name: Setup
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Setup Node
18
+ uses: actions/setup-node@v6
19
+ with:
20
+ node-version: 24
21
+
22
+ - name: Setup pnpm
23
+ uses: pnpm/action-setup@v4
24
+ with:
25
+ version: 10
26
+ run_install: false
27
+
28
+ - name: Cache pnpm store
29
+ uses: actions/cache@v4
30
+ with:
31
+ path: ~/.pnpm-store
32
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
33
+ restore-keys: |
34
+ ${{ runner.os }}-pnpm-
35
+
36
+ - name: Install dependencies
37
+ run: pnpm install --frozen-lockfile
38
+
39
+ - name: Build
40
+ run: pnpm build
41
+
42
+
43
+ changeset-check:
11
44
  name: Changeset check
12
45
  if: github.event_name == 'pull_request'
13
46
  runs-on: ubuntu-latest
@@ -21,7 +54,7 @@ jobs:
21
54
  BASE_REF: ${{ github.event.pull_request.base.ref }}
22
55
  run: |
23
56
  # Paths that require a changeset when modified
24
- VERSIONED_PATHS='extensions/\|skills/\|agents/\|package.json\|plugin.json'
57
+ VERSIONED_PATHS='extensions/|skills/|agents/|package\.json|plugin\.json'
25
58
 
26
59
  changed=$(git diff --name-only "origin/${BASE_REF}...HEAD")
27
60
  echo "Changed files:"
@@ -46,29 +79,178 @@ jobs:
46
79
 
47
80
  echo "Changeset found: $changesets"
48
81
 
49
- checks:
82
+ lint:
83
+ name: Lint
84
+ needs: setup
50
85
  runs-on: ubuntu-latest
51
86
  steps:
52
87
  - name: Checkout
53
88
  uses: actions/checkout@v4
89
+
54
90
  - name: Setup Node
55
- uses: actions/setup-node@v4
91
+ uses: actions/setup-node@v6
56
92
  with:
57
- node-version: 20
93
+ node-version: 24
94
+
95
+ - name: Cache pnpm store
96
+ uses: actions/cache@v4
97
+ with:
98
+ path: ~/.pnpm-store
99
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
100
+ restore-keys: |
101
+ ${{ runner.os }}-pnpm-
102
+
58
103
  - name: Setup pnpm
59
104
  uses: pnpm/action-setup@v4
60
105
  with:
61
106
  version: 10
62
107
  run_install: false
108
+
63
109
  - name: Install dependencies
64
110
  run: pnpm install --frozen-lockfile
111
+
65
112
  - name: Lint
66
113
  run: pnpm lint
114
+
115
+ test:
116
+ name: Test
117
+ needs: setup
118
+ runs-on: ubuntu-latest
119
+ steps:
120
+ - name: Checkout
121
+ uses: actions/checkout@v4
122
+
123
+ - name: Setup Node
124
+ uses: actions/setup-node@v6
125
+ with:
126
+ node-version: 24
127
+
128
+ - name: Cache pnpm store
129
+ uses: actions/cache@v4
130
+ with:
131
+ path: ~/.pnpm-store
132
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
133
+ restore-keys: |
134
+ ${{ runner.os }}-pnpm-
135
+
136
+ - name: Setup pnpm
137
+ uses: pnpm/action-setup@v4
138
+ with:
139
+ version: 10
140
+ run_install: false
141
+
142
+ - name: Install dependencies
143
+ run: pnpm install --frozen-lockfile
144
+
67
145
  - name: Test
68
146
  run: pnpm test
69
- - name: Build
70
- run: pnpm build
147
+
148
+ claude-plugin-check:
149
+ name: Claude plugin check
150
+ needs: setup
151
+ runs-on: ubuntu-latest
152
+ steps:
153
+ - name: Checkout
154
+ uses: actions/checkout@v4
155
+
156
+ - name: Setup Node
157
+ uses: actions/setup-node@v6
158
+ with:
159
+ node-version: 24
160
+
161
+ - name: Cache pnpm store
162
+ uses: actions/cache@v4
163
+ with:
164
+ path: ~/.pnpm-store
165
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
166
+ restore-keys: |
167
+ ${{ runner.os }}-pnpm-
168
+
169
+ - name: Setup pnpm
170
+ uses: pnpm/action-setup@v4
171
+ with:
172
+ version: 10
173
+ run_install: false
174
+
175
+ - name: Install dependencies
176
+ run: pnpm install --frozen-lockfile
177
+
178
+ # `pnpm build:claude` is an alias of `agent-cortex install claude` (both run
179
+ # bin/installers/claude.mjs), so this drift check proves the committed subtree
180
+ # equals the installer's output — stale output or hand-edits to generated
181
+ # files fail the build. The subtree stays committed because the marketplace
182
+ # install flow reads it straight from the working tree (fresh clone installs
183
+ # as-is).
71
184
  - name: Check generated Claude plugin is up to date
72
185
  run: |
73
186
  pnpm build:claude
74
- git diff --exit-code claude/agents/ claude/skills/
187
+ git diff --exit-code claude/agents/ claude/skills/ claude/.claude-plugin/plugin.json claude/hooks.json claude/hooks/
188
+
189
+ - name: Check generated Copilot agent files are up to date
190
+ run: |
191
+ pnpm build:copilot
192
+ git diff --exit-code -- 'agents/*.agent.md'
193
+
194
+ release:
195
+ name: Release
196
+ needs: [lint, test, claude-plugin-check]
197
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
198
+ runs-on: ubuntu-latest
199
+ permissions:
200
+ contents: write
201
+ pull-requests: write
202
+ # npm Trusted Publishing (OIDC): npm exchanges this id-token for a
203
+ # short-lived npm token at publish time — no token config or secret.
204
+ id-token: write
205
+ concurrency: ${{ github.workflow }}-${{ github.ref }}
206
+ steps:
207
+ - name: Checkout
208
+ uses: actions/checkout@v4
209
+ with:
210
+ fetch-depth: 0
211
+
212
+ - name: Setup Node
213
+ uses: actions/setup-node@v6
214
+ with:
215
+ node-version: 24
216
+
217
+ - name: Cache pnpm store
218
+ uses: actions/cache@v4
219
+ with:
220
+ path: ~/.pnpm-store
221
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
222
+ restore-keys: |
223
+ ${{ runner.os }}-pnpm-
224
+
225
+ - name: Setup pnpm
226
+ uses: pnpm/action-setup@v4
227
+ with:
228
+ version: 10
229
+ run_install: false
230
+
231
+ - name: Install dependencies
232
+ run: pnpm install --frozen-lockfile
233
+
234
+ - name: Create Release Pull Request or Publish
235
+ id: changesets
236
+ uses: changesets/action@v1
237
+ with:
238
+ # changesets/action execs these inputs via @actions/exec with NO shell:
239
+ # the string is split by argStringToArray on whitespace (single quotes
240
+ # survive literally), so each must be a single unquoted command token
241
+ # that runs a pnpm script. version-packages bumps versions, syncs
242
+ # plugin.json, THEN regenerates the committed generated output
243
+ # (build:claude writes claude/.claude-plugin/plugin.json with the NEW
244
+ # version, build:copilot re-derives agents/*.agent.md) before the action
245
+ # commits, so the Version Packages PR always passes the drift gates.
246
+ version: pnpm version-packages
247
+ publish: pnpm publish-package
248
+ commit: "chore: version packages"
249
+ title: "chore: version packages"
250
+ env:
251
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
252
+ # Publish authenticates via npm Trusted Publishing (OIDC token
253
+ # exchange at publish time) — no NPM_TOKEN secret, no token config.
254
+ # Requires the one-time npm-side setup: npmjs.com → @jaybeeuu/
255
+ # agent-cortex → Access → Trusted Publishing, tied to GitHub repo
256
+ # jaybeeuu/agent-cortex + workflow .github/workflows/ci.yml.
package/AGENTS.md CHANGED
@@ -4,9 +4,10 @@ Instructions for agents working on this repository.
4
4
 
5
5
  ## What This Repo Is
6
6
 
7
- A personal Copilot CLI plugin containing custom agents and skills, plus PI extensions for
8
- enhancing the coding agent runtime. Changes here affect the behaviour of every agent, skill,
9
- and PI extension available in the author's coding sessions.
7
+ A personal Copilot CLI plugin containing custom agents and skills, shipped to Copilot, pi,
8
+ and Claude Code, plus PI extensions and Claude hooks for enhancing the coding agent
9
+ runtime. Changes here affect the behaviour of every agent, skill, and PI extension
10
+ available in the author's coding sessions.
10
11
 
11
12
  ## Structure
12
13
 
@@ -14,8 +15,12 @@ and PI extension available in the author's coding sessions.
14
15
  agent-cortex/
15
16
  ├── package.json # PI package manifest (pi: { extensions, skills })
16
17
  ├── plugin.json # GitHub Copilot plugin manifest — agents, skills, MCP servers
17
- ├── agents/ # Custom agents (*.agent.md)
18
- │ └── ralph.agent.md
18
+ ├── agents/ # Custom agents — canonical composable <name>/ dirs
19
+ │ ├── *.agent.md # generated from <name>/ by scripts/build-copilot-agents.mjs
20
+ │ ├── ralph/ # composable format — see agents/README.md
21
+ │ ├── plan/ # "
22
+ │ ├── ralph-plan/ # "
23
+ │ └── strategy/ # "
19
24
  ├── skills/ # Grouped by domain, discovered recursively
20
25
  │ ├── planning/ # Scope, spec, decompose
21
26
  │ ├── engineering/ # The coding loop
@@ -27,6 +32,8 @@ agent-cortex/
27
32
  │ └── skill-stats/
28
33
  │ ├── README.md # Installation & usage
29
34
  │ └── index.ts # Extension entrypoint
35
+ ├── hooks/ # Canonical Claude Code hooks (hooks.json + scripts — see docs/claude-hooks.md)
36
+ │ └── claude/ # generated into claude/hooks.json + claude/hooks/ by bin/installers/claude.mjs
30
37
  └── package.json # PI package manifest (pi: { extensions, skills })
31
38
  ```
32
39
 
@@ -52,7 +59,17 @@ Generated automatically by changesets. Do not edit `CHANGELOG.md` manually.
52
59
 
53
60
  ## Agent Conventions
54
61
 
55
- - Agent files are named `<name>.agent.md` and live in `agents/`.
62
+ - Agents live in composable `<name>/` directories under `agents/`: a shared `agent.md` body plus
63
+ per-harness subdirectories `pi/`, `copilot/`, `claude/` (frontmatter.json and optional section
64
+ files) per the spec in `agents/README.md`. `ralph`, `plan`, `ralph-plan`, and `strategy` all use
65
+ the composable layout. The flat `agents/*.agent.md` files are **generated output** — composed
66
+ from the canonical directories by the shared `bin/installers/copilot.mjs` code path behind both
67
+ `agent-cortex install copilot` and `scripts/build-copilot-agents.mjs` (thin wrapper), and
68
+ committed for Copilot CLI (plugin.json `agents: "agents/"` scans for `*.agent.md`); never edit
69
+ them by hand. The `claude/` subtree is generated by the install-time generator
70
+ `bin/installers/claude.mjs` (`pnpm build:claude` aliases `agent-cortex install claude`; `ralph`
71
+ is authored natively in `agents-native/` and copied verbatim; the other agents compose from their
72
+ `claude/` harness dirs).
56
73
  - Keep orchestration logic in the agent file; extract shared per-task workflow into a skill
57
74
  so it can be reused (e.g. ralph delegates per-task stage execution to `run-pipeline-stage`).
58
75
 
@@ -65,6 +82,8 @@ Generated automatically by changesets. Do not edit `CHANGELOG.md` manually.
65
82
  commands — they should not add token overhead.
66
83
  - Extensions that persist data should write to `~/.pi/agent-cortex/` (global, cross-project)
67
84
  and tag records with the project path for per-project slicing.
85
+ - PI extensions with Claude Code equivalents are ported to `hooks/claude/`; the port/reject
86
+ audit with rationale lives in `docs/claude-hooks.md`.
68
87
 
69
88
  ## User preferences
70
89
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.38.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5def727: Fix generate-progress parser for current bd list format
8
+ - 735f083: Fix Release CI npm publish (ENEEDAUTH): the release job now publishes via npm Trusted Publishing (OIDC) — no `NPM_TOKEN` secret or `.npmrc` auth config. The `release` job's `id-token: write` permission is the only workflow-side requirement; npm exchanges the GitHub OIDC token for a short-lived npm token at publish time.
9
+
10
+ **One-time npm-side setup required** (no GitHub secret): on npmjs.com, open the package `@jaybeeuu/agent-cortex` → Access → Trusted Publishing → Add new publisher → GitHub, select the `jaybeeuu/agent-cortex` repository and the `.github/workflows/ci.yml` workflow. Publishing then needs no token configuration.
11
+
12
+ ## 1.38.0
13
+
14
+ ### Minor Changes
15
+
16
+ - fbc6fa5: Add the Copilot CLI harness installer (`agent-cortex install copilot`), sharing the generator with `pnpm build:copilot`. It regenerates the flat `agents/*.agent.md` files the Copilot plugin loads (plugin.json `agents: "agents/"`), with the same `--dry-run` / `--output` contract as the claude and pi installers.
17
+ - 42d3a33: Add central token-map.json mapping tool names, paths, and agent naming across the copilot, claude, and pi harnesses, with the token substitution contract for the install-time generation system. Use {{TOOL:...}} / {{PATH:...}} tokens in canonical sources; installers substitute per-harness names from the map.
18
+ - 3a7e896: Add using-agent-skills meta-skill with 8 core operating behaviors and skill routing tree. Routes incoming work to the right skill, enforces scope discipline, and flags persistent failures to the user instead of working around them.
19
+ - 4f5b134: Add a `wait_for_agents` tool to the subagent extension: it blocks until at least one background sub-agent (spawned with `task`) completes and returns its result, with `read_agent` kept as a fallback. Ralph's PI completion detection now waits on `wait_for_agents` instead of a `sleep 120` poll loop.
20
+ - e1180d5: Update the agent-modes extension to discover agents from the composable directory format (`agents/<name>/` + per-harness `pi/frontmatter.json`). The PI system prompt is composed from `agent.md`, resolving `{{SECTION:...}}` includes from the agent's `pi/` directory and substituting `{{TOOL:...}}` / `{{PATH:...}}` tokens via token-map.json, so tool restrictions now translate to real PI tool names (e.g. `view` → `read`, `web_fetch` → `fetch_content`, null-mapped tools dropped). Flat `*.agent.md` files remain supported as a fallback for agents that have not been migrated to composable directories yet.
21
+ - 603679a: Make the composable agent directories (`agents/<name>/`) canonical: the hand-authored flat `agents/*.agent.md` sources are removed and the flat Copilot/pi agent files are now generated output, composed from the canonical dirs by `scripts/build-copilot-agents.mjs` (`pnpm build:copilot`). `claude/agents/*.md` is composed from the same dirs' `claude/` harness by `scripts/build-claude-agents.mjs` (ralph stays native via `agents-native/ralph.md`). Agent names, descriptions, and tool sets are unchanged; agent bodies now carry the composable (tokenized) content. CI verifies both generated outputs never drift.
22
+ - 60d498f: Port the pi extensions with Claude equivalents to the Claude Code plugin's hooks:
23
+ SessionStart now also injects the using-agent-skills / bd-tool / git-workflow skill
24
+ policy, and a Notification hook matched on documented notification types
25
+ (`agent_completed|agent_needs_input|permission_prompt`) raises desktop notifications
26
+ via the bundled `hooks/scripts/notify.mjs`. Hook support scripts are now bundled
27
+ into `claude/hooks/` by the shared installer, and the audit (auto-name, skill-stats,
28
+ subagent, agent-modes rejected with rationale) is recorded in `docs/claude-hooks.md`.
29
+ - 6863b0e: Add `agent-cortex install claude` — install-time generator for the Claude Code plugin
30
+ subtree, sharing one code path with `pnpm build:claude` so the outputs can never diverge.
31
+ `claude/.claude-plugin/plugin.json` (version now tracked from `package.json`) and
32
+ `claude/hooks.json` (from the new canonical `hooks/claude/` source) are generated rather
33
+ than hand-maintained, and the committed `claude/skills/` gains the previously-missing
34
+ `using-agent-skills` symlink. Root tests (`test/`) are now included in `pnpm test`.
35
+ - f2b441e: Add the pi harness installer (`agent-cortex install pi`): composes agents from the canonical composable directories plus `pi/` sections, substitutes `{{TOOL:...}}` / `{{PATH:...}}` tokens against token-map.json's pi column (null-mapped tools dropped with warnings, paths resolved against the plugin root), and writes `<output>/agents/<name>.agent.md` plus token-substituted skill copies to `<output>/skills` (default `~/.pi/agent`). Supports `--dry-run`, `--output <dir>`, and an optional `--plugin-root <dir>` override. The shared composer gains pi-friendly options (`dropNullTools`, `pluginRoot`, `resolveRelativePaths`, `warn`) with the copilot/claude build defaults unchanged, and the root test suite is now wired into `pnpm test`.
36
+
37
+ ### Patch Changes
38
+
39
+ - 99fcc9a: Complete the move to install-time Claude code generation: the standalone `scripts/build-claude-agents.mjs` build script is removed and `pnpm build:claude` is now a pure alias of `agent-cortex install claude` — both invoke the shared `bin/installers/claude.mjs` generator, so there is a single code path for the committed `claude/` plugin subtree and install-time vs regenerated output can never diverge. Generated agents carry installer provenance headers, and CI's drift check (regenerate + `git diff --exit-code`) validates the committed subtree byte-for-byte against installer output. `agents-native/` remains the canonical source for Claude-native agents (`ralph`), copied verbatim by the installer.
40
+ - 9b0c4fc: Fix the release pipeline so Version Packages PRs regenerate generated output. `changesets/action` execs the `version`/`publish` inputs without a shell, so quoted multi-command strings crash (`bash -c '...'` split on whitespace → unterminated quote, exit 2). The chain now lives in exec-safe single-command pnpm scripts: `pnpm version-packages` bumps versions, syncs `plugin.json`, then regenerates the committed Claude/Copilot agent output so the drift gates never fail on the bumped version; `pnpm publish-package` performs the pack + provenance publish.
41
+ - f1b8a25: Add composable agent directory structures for the plan, ralph-plan, and strategy agents (`agents/plan/`, `agents/ralph-plan/`, `agents/strategy/` with per-harness `pi/`, `copilot/`, and `claude/` frontmatter). The existing flat `*.agent.md` files are retained until the composer/installer migration lands, so no shipped behaviour changes yet.
42
+ - d83a7cf: Add composable agent directory structure for the ralph agent (`agents/ralph/` with per-harness `pi/`, `copilot/`, and `claude/` frontmatter and polling sections). The existing flat `agents/ralph.agent.md` is retained until the composer/installer migration lands, so no shipped behaviour changes yet.
43
+ - c4728c5: Migrate hardcoded tool names in skill files to `{{TOOL:name}}` tokens (task, read_agent, bash, view, rg, glob) so installers can substitute per-harness names.
44
+
3
45
  ## 1.37.1
4
46
 
5
47
  ### Patch Changes
package/README.md CHANGED
@@ -11,11 +11,12 @@ agent-cortex/
11
11
  ├── plugin.json # Copilot plugin manifest
12
12
  ├── .claude-plugin/
13
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
14
+ ├── agents/ # Canonical agents — composable <name>/ dirs (see agents/README.md)
15
+ │ ├── *.agent.md # ralph, ralph-plan, plan, strategy — GENERATED from <name>/ by scripts/build-copilot-agents.mjs
16
+ │ ├── ralph/ # composable form (shared agent.md + per-harness pi/, copilot/, claude/)
17
+ │ ├── plan/ # "
18
+ │ ├── ralph-plan/ # "
19
+ │ └── strategy/ # "
19
20
  ├── agents-native/ # Claude-only agents with no Copilot equivalent
20
21
  │ └── ralph.md # the lean Claude Ralph
21
22
  ├── skills/ # Skills (grouped by domain) — shared by all harnesses
@@ -26,39 +27,92 @@ agent-cortex/
26
27
  │ ├── style/ # style-code, style-tests, style-comms, style-documentation
27
28
  │ └── workflow/ # ralph, run-pipeline-stage, create-task, …
28
29
  ├── extensions/ # pi extensions (pi only)
30
+ │ ├── agent-modes/ # switchable agent modes (reads composable agents/)
29
31
  │ ├── skill-stats/
30
32
  │ └── notify/
31
33
  ├── pi/ # Global pi configuration (see below)
32
34
  │ └── settings.json
35
+ ├── token-map.json # canonical tool/path/agent names per harness (install-time token substitution)
36
+ ├── token-map.README.md # design decisions behind token-map.json
37
+ ├── bin/
38
+ │ ├── agent-cortex.mjs # CLI entrypoint
39
+ │ └── installers/
40
+ │ ├── copilot.mjs # shared generator: agent-cortex install copilot + scripts/build-copilot-agents.mjs
41
+ │ └── claude.mjs # install-time generator — agent-cortex install claude (pnpm build:claude aliases it)
33
42
  ├── scripts/
34
- │ └── build-claude-agents.mjs # builds the claude/ subtree from the sources above
43
+ │ └── build-copilot-agents.mjs # thin wrapper over bin/installers/copilot.mjs (regenerates agents/*.agent.md)
35
44
  └── claude/ # Self-contained Claude Code plugin (GENERATED — do not hand-edit)
36
45
  ├── .claude-plugin/
37
46
  │ └── 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)
47
+ ├── .mcp.json # MCP servers (context7, github) — hand-authored
48
+ ├── hooks.json # SessionStart + Notification hooks — generated from hooks/claude/
49
+ ├── hooks/ # hook scripts (e.g. scripts/notify.mjs) — generated from hooks/claude/
50
+ ├── agents/ # composed from agents/<name>/claude/ + copied from agents-native/
51
+ └── skills/ # symlinks to the grouped skills/ dirs (29 skills)
42
52
  ```
43
53
 
44
54
  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:
55
+ The composable `agents/<name>/` directories are the single source of truth; the flat
56
+ `agents/*.agent.md` files are **generated** by the shared copilot installer
57
+ (`agent-cortex install copilot`, or `scripts/build-copilot-agents.mjs` via
58
+ `pnpm build:copilot` — both run the same `bin/installers/copilot.mjs` code path, so
59
+ install-time and build-time output can never diverge) and committed so Copilot CLI
60
+ (plugin.json `agents: "agents/"`) and pi keep loading the agents — don't hand-edit them.
61
+ The `{{TOOL:...}}` / `{{PATH:...}}` tokens written in agent and skill files are resolved
62
+ per harness at install time from `token-map.json`, the single source of truth for
63
+ canonical tool/path/agent names (see `token-map.README.md` and the `contract` section).
64
+ The `claude/` subtree is **generated** by the install-time generator
65
+ (`bin/installers/claude.mjs`) — `pnpm build:claude` is a pure alias of
66
+ `agent-cortex install claude`, so there is no separate build-time code path, and the
67
+ committed subtree can never diverge from a real install. CI regenerates it and checks
68
+ it is never stale:
47
69
 
48
70
  - **Skills** stay single-source — `claude/skills/<name>` are symlinks into the grouped
49
71
  `skills/<group>/<name>` dirs (Claude discovers skills only one level deep, so the
50
72
  grouping is flattened via links, not copies).
51
73
  - **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.
74
+ are composed from the canonical `agents/<name>/` directories' `claude/` harness dirs
75
+ (frontmatter.json + section files), exactly like the Copilot flats are composed from their
76
+ `copilot/` dirs. Claude only loads agents from a plugin's default `agents/` dir, so the plugin
77
+ root is `claude/` — isolating it from the Copilot `.agent.md` files.
55
78
  - **Claude-native agents** that have no Copilot equivalent live in `agents-native/*.md` and are
56
79
  copied verbatim into `claude/agents/`. `ralph` is one: it is reimplemented for Claude around
57
80
  background workers + an independent review gate (the Copilot Ralph's `task`/`read_agent`
58
81
  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/`.
82
+ - **Manifests** are generated too: `claude/.claude-plugin/plugin.json` (its `version` tracks
83
+ `package.json`, so it never goes stale) and `claude/hooks.json` (copied from the canonical
84
+ `hooks/claude/hooks.json` source), plus any support files under `hooks/claude/` bundled into
85
+ `claude/hooks/` so hook commands can reach them via `$CLAUDE_PLUGIN_ROOT`. `claude/.mcp.json`
86
+ and `claude/scripts/` stay hand-authored. See `docs/claude-hooks.md` for the extension→hook
87
+ mapping and the rejections (auto-name, skill-stats, subagent, agent-modes).
88
+
89
+ Edit the sources (`agents/<name>/` composable dirs, `agents-native/*.md`, `skills/**`,
90
+ `hooks/claude/`, `package.json`), never anything under `claude/` or the generated
91
+ `agents/*.agent.md` files.
92
+
93
+ ## CI
94
+
95
+ The CI pipeline runs lint, test, and claude-plugin-check as three parallel jobs
96
+ (`lint`, `test`, `claude-plugin-check`), each gated on `needs: setup`. Each job
97
+ does its own checkout and `pnpm install` rather than sharing build artifacts from
98
+ the `setup` job — pnpm workspace symlinks don't survive artifact upload/download,
99
+ so artifact sharing would break the workspace resolution that the build depends on.
100
+
101
+ A separate `changeset-check` job runs only on pull requests and fails any PR that
102
+ touches a versioned path (`extensions/`, `skills/`, `agents/`, `package.json`, or
103
+ `plugin.json`) without a changeset in `.changeset/`. Add one with `pnpm changeset` —
104
+ the `style-versioning` skill documents the format.
105
+
106
+ On pushes to `main`, a `release` job (gated on `lint`, `test`, and
107
+ `claude-plugin-check`) runs changesets to open a `chore: version packages` PR when
108
+ changesets are pending, then publishes to npm once it lands. The version step runs
109
+ `pnpm version-packages` — bumping `package.json`, syncing `plugin.json`, and
110
+ regenerating the committed generated output so the drift gates stay green; the
111
+ publish step runs `pnpm publish-package` (pack + provenance publish). Publish
112
+ authenticates via npm Trusted Publishing (OIDC) — no npm token or GitHub
113
+ secret is needed, only the one-time npm-side setup on npmjs.com (package →
114
+ Access → Trusted Publishing for the `jaybeeuu/agent-cortex` repo). Releases
115
+ are sourced entirely from `main`.
62
116
 
63
117
  ## Installation
64
118
 
@@ -92,6 +146,29 @@ Desktop notifications are handled by the local `extensions/notify/` extension
92
146
  notification on multi-turn tasks, labelled with the tmux session:window.pane
93
147
  if available, or the project directory name otherwise.
94
148
 
149
+ ### Pi harness agents & skills (`agent-cortex install pi`)
150
+
151
+ The agents are already available to pi through the package (`pi.skills` + the
152
+ `agent-modes` extension compose them at runtime), but the raw package files carry
153
+ literal `{{TOOL:...}}` / `{{PATH:...}}` tokens. Run the pi installer to materialise
154
+ composed agents and token-substituted skills into pi's user scope:
155
+
156
+ ```sh
157
+ agent-cortex install pi
158
+ # → ~/.pi/agent/agents/<name>.agent.md (ralph, plan, ralph-plan, strategy)
159
+ # → ~/.pi/agent/skills/ (token-substituted skill tree)
160
+ ```
161
+
162
+ Flags:
163
+
164
+ | Flag | Meaning |
165
+ | --- | --- |
166
+ | `--dry-run` | Show what would be installed without writing anything |
167
+ | `--output <dir>` | Install into `<dir>/agents` and `<dir>/skills` (default `~/.pi/agent`) |
168
+ | `--plugin-root <dir>` | Override the plugin root used for `{{PATH:...}}` tokens (default: token-map.json's pi value — use it for checkout or symlinked installs) |
169
+
170
+ Re-run whenever you pull changes (`git pull` + reinstall, or after `pnpm build:copilot`).
171
+
95
172
  ### Copilot plugin (separate)
96
173
 
97
174
  ```sh
@@ -108,13 +185,22 @@ copilot plugin install ./agent-cortex
108
185
 
109
186
  The Claude plugin is the self-contained `claude/` subtree (manifest at
110
187
  `claude/.claude-plugin/plugin.json`), containing **4 agents** (`strategy`, `plan`,
111
- `ralph-plan`, `ralph`), **28 skills**, a `SessionStart` hook, and 2 MCP servers.
188
+ `ralph-plan`, `ralph`), **29 skills**, `SessionStart` + `Notification` hooks, and 2 MCP servers.
112
189
 
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):
190
+ `claude/` is committed (the marketplace install flow reads it straight from the working
191
+ tree, so a fresh clone installs as-is), and rebuilt via the install-time generator if you
192
+ change the sources:
115
193
 
116
194
  ```sh
117
- pnpm build:claude # or: node scripts/build-claude-agents.mjs
195
+ pnpm build:copilot # or: node scripts/build-copilot-agents.mjs (regenerates agents/*.agent.md)
196
+ pnpm build:claude # or: node bin/agent-cortex.mjs install claude (same generator)
197
+ # or the install-time entry (same generator, less typing):
198
+ node bin/agent-cortex.mjs install copilot # regenerates agents/*.agent.md in place
199
+ node bin/agent-cortex.mjs install copilot --dry-run # plan only, no writes
200
+ node bin/agent-cortex.mjs install copilot --output /tmp/x # preview the flat files elsewhere
201
+ node bin/agent-cortex.mjs install claude # regenerates ./claude in place
202
+ node bin/agent-cortex.mjs install claude --dry-run # plan only, no writes
203
+ node bin/agent-cortex.mjs install claude --output /tmp/x # write the subtree elsewhere
118
204
  ```
119
205
 
120
206
  #### Try it for one session
@@ -151,7 +237,7 @@ The marketplace source is your local checkout, so after pulling changes you must
151
237
 
152
238
  ```sh
153
239
  git pull
154
- pnpm build:claude # regenerate claude/ from the sources
240
+ pnpm build:claude # alias of agent-cortex install claude
155
241
  claude plugin marketplace update jaybeeuu
156
242
  claude plugin update agent-cortex # restart Claude Code to apply
157
243
  ```
@@ -186,15 +272,22 @@ It finds ready beads, spawns parallel background workers (implement → independ
186
272
  fix), opens a PR per feature, and pauses at each human merge gate. After you merge, re-invoke
187
273
  it and it resumes from `bd ready`.
188
274
 
189
- #### Style-skill enforcement
275
+ #### Hooks
190
276
 
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.
277
+ `SessionStart` injects a per-session policy nudging Claude to prefer the shipped skills over
278
+ ad-hoc choices: the "style policy" (invoke `style-code` / `style-tests` /
279
+ `style-documentation` / `style-comms` before the corresponding work — their descriptions also
280
+ auto-trigger proactively) and the "skill policy" (`using-agent-skills` for routing, `bd-tool`
281
+ for beads context, `git-workflow` for branch/PR discipline). A `Notification` hook matched on
282
+ `agent_completed|agent_needs_input|permission_prompt` raises a desktop notification when a
283
+ task finishes, waits on input, or needs approval. See `docs/claude-hooks.md` for the full
284
+ extension→hook audit.
194
285
 
195
286
  #### Not ported / follow-ups
196
287
 
197
- - The pi `extensions/` have no Claude runtime-extension equivalent (use hooks/MCP instead).
288
+ - Only `session-start` and `notify` had Claude equivalents (both ported to hooks); the other
289
+ pi `extensions/` (auto-name, skill-stats, subagent, agent-modes) have none — the audit and
290
+ rejection rationale live in `docs/claude-hooks.md`.
198
291
  - Ralph follow-ups: multi-feature epic branches, and a GitHub-trigger routine to auto-resume
199
292
  after a PR merge (instead of manual re-invocation).
200
293
  - The Copilot/pi Ralph (the 4-stage `run-pipeline-stage` pipeline) is unchanged; those two
@@ -202,8 +295,14 @@ corresponding work; the style skills' descriptions are also written to auto-trig
202
295
 
203
296
  #### Contributing to the Claude plugin
204
297
 
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.
298
+ Edit the **sources** — the composable `agents/<name>/` directories (shared `agent.md` +
299
+ per-harness frontmatter/sections, auto-composed by `scripts/build-copilot-agents.mjs` and
300
+ the install-time generator `bin/installers/claude.mjs`), `agents-native/*.md` (Claude-only
301
+ agents like `ralph` — the canonical bodies the installer copies verbatim), `skills/**`,
302
+ `hooks/claude/hooks.json` (hook config), and `package.json` (plugin
303
+ version) — then run `pnpm build:claude` (an alias of `agent-cortex install claude`). Never hand-edit
304
+ anything under `claude/` except the hand-authored `claude/.mcp.json` and `claude/scripts/`
305
+ files, or the generated `agents/*.agent.md` files, `claude/agents/`, `claude/skills/`,
306
+ `claude/.claude-plugin/plugin.json`, and `claude/hooks.json`. CI runs
307
+ `git diff --exit-code claude/agents/ claude/skills/ claude/.claude-plugin/plugin.json claude/hooks.json`
308
+ and `git diff --exit-code -- 'agents/*.agent.md'` so the generated outputs can never drift.