@pazmo/ai-workflow-kit 5.2.0 → 5.3.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.
@@ -6,7 +6,7 @@
6
6
  "plugins": [
7
7
  {
8
8
  "name": "ai-workflow-kit",
9
- "version": "5.2.0",
9
+ "version": "5.3.0",
10
10
  "source": ".",
11
11
  "description": "Concise requirements-to-delivery workflow with human approval and understanding gates.",
12
12
  "category": "development",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-workflow-kit",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Concise requirements-to-delivery workflow with human approval and understanding gates.",
5
5
  "author": {
6
6
  "name": "JongKun Kim"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-workflow-kit",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Concise requirements-to-delivery workflow with human approval and understanding gates.",
5
5
  "skills": "./skills/"
6
6
  }
package/README.ko.md CHANGED
@@ -8,11 +8,16 @@ AI Workflow Kit은 Codex와 Claude Code에 작업 절차를 추가합니다. 무
8
8
 
9
9
  그래프 실행기가 작업 목록과 실행 순서를 관리합니다.
10
10
 
11
- ## 5.2.0 업데이트
11
+ ## 5.3.0 업데이트
12
+
13
+ - **업데이트할 때 버전을 알려 줍니다.** `init`은 실행 중인 CLI 버전과 바꾼 버전을 `Updated AI Workflow Kit 5.2.0 → 5.3.0.`처럼 출력합니다. `doctor`는 `Kit version: CLI …, installed …` 줄을 출력합니다. 캐시된 옛 CLI가 돌면 그냥 "이미 최신"이라고 하지 않고 자기 버전 번호를 보여 줍니다. CLI가 설치된 버전보다 오래되면 더 새 버전의 파일을 검사할 수 없으므로 `doctor`가 실패합니다.
14
+ - **버전이 섞인 설치를 알려 줍니다.** 관리 파일이 설치된 버전과 다르면, 포매터만 바꾼 경우라도 `doctor`가 경고하고, 그 경로를 지운 뒤 `init`을 다시 실행하라고 안내합니다.
15
+ - **5.2.0에서 올리면** 기존 실행이 그대로 이어집니다. 그래프 런타임 파일과 역할 노드가 바뀌지 않았습니다. **5.0.x에서 올리면** 5.1.0을 npm에 배포하지 않았기 때문에 아래 5.1.0 변경도 함께 들어옵니다. 업데이트 전에 시작한 역할 실행은 `Role assignment or graph changed`로 멈춥니다. 새 역할 실행을 시작하세요.
16
+
17
+ 5.2.0에서 추가된 것:
12
18
 
13
19
  - **요구 정리 단계에서 대안을 직접 보여 줍니다.** 요청한 변경이 아직 크게 다르게 동작할 수 있으면, intake가 선택지 2~3개를 장단점과 추천 기본값과 함께 보여 줍니다. CE `ce-brainstorm`은 만들 기능 없이 목표만 있는 열린 요청이거나, 무엇을 만들지 모르겠다고 하거나, 직접 고를 때만 씁니다. 쓸 때는 에이전트가 먼저 알리고, 결과는 kit의 Story와 G1로 돌아옵니다.
14
20
  - **결제 렌즈가 되돌릴 기준을 묻습니다.** 가격이나 청구 규칙을 바꾸는 Story는 무엇이 되돌림(rollback)의 기준인지, 이미 발행된 청구는 어떻게 되는지 묻습니다.
15
- - **5.0.x에서 올리나요?** 5.1.0은 npm에 배포하지 않았기 때문에 5.2.0에는 아래 5.1.0 변경도 들어 있습니다. 업데이트 전에 시작한 역할 실행은 `Role assignment or graph changed`로 멈춥니다. 새 역할 실행을 시작하세요.
16
21
 
17
22
  5.1.0에서 추가된 것:
18
23
 
@@ -30,7 +35,16 @@ AI Workflow Kit은 Codex와 Claude Code에 작업 절차를 추가합니다. 무
30
35
  - **리뷰는 기본 3명으로 조정합니다.** 작은 변경은 0~2명, 명확한 전문 위험이 있으면 4~5명으로 조정합니다. 메인이 단순화와 결과 통합을 맡고, 내부 위임도 같은 예산에 포함합니다. 실제 인원 제한은 호스트가 적용합니다.
31
36
  - **검증 실행의 예외를 수정했습니다.** 분리된 자식이 출력 파이프를 유지해도 정해진 정리 시간 뒤 불완전한 수집을 실패로 기록합니다. `toString`, `hasOwnProperty` 같은 유효한 검사 ID도 실행 순서와 관계없이 사용할 수 있습니다.
32
37
 
33
- 기존 프로젝트는 `npx @pazmo/ai-workflow-kit@latest init`과 `npx @pazmo/ai-workflow-kit@latest doctor`로 업데이트한 뒤 새 Codex 작업 또는 Claude Code 세션을 여세요. 사용자가 수정한 관리 파일은 보존하고 알려주므로, 새 지침을 수동 반영해야 하는지 확인하세요.
38
+ 기존 프로젝트를 업데이트할 때는 `@latest` 대신 정확한 버전을 지정하고, 설치 전에 npx가 실제로 실행하는 CLI 버전을 확인하세요. 프로젝트의 `.npmrc`가 접속할 수 없는 사설 레지스트리를 가리키면, npx가 캐시된 옛 버전을 알리지 않고 실행할 수 있습니다. 정확한 버전을 지정하면 다른 버전의 캐시로 대신 실행되지 않습니다.
39
+
40
+ ```sh
41
+ VERSION=$(npm view @pazmo/ai-workflow-kit version --registry=https://registry.npmjs.org/)
42
+ npx @pazmo/ai-workflow-kit@$VERSION --version
43
+ npx @pazmo/ai-workflow-kit@$VERSION init
44
+ npx @pazmo/ai-workflow-kit@$VERSION doctor
45
+ ```
46
+
47
+ `--version`이 `$VERSION`과 다른 값을 출력하면 멈추세요. `.npmrc`가 사설 레지스트리를 가리키는 프로젝트에서는 패키지 이름 앞에 `--registry=https://registry.npmjs.org/`를 넣으세요. 예: `npx --registry=https://registry.npmjs.org/ @pazmo/ai-workflow-kit@$VERSION init`. 패키지 이름 뒤에 두면 npm이 아니라 kit에 전달됩니다. `init`은 `Updated AI Workflow Kit 5.2.0 → 5.3.0.`처럼 두 버전을 출력하고, `doctor`는 `Kit version: CLI …, installed …` 줄을 출력합니다. 그다음 새 Codex 작업 또는 Claude Code 세션을 여세요. 사용자가 수정한 관리 파일은 보존하고 알려주므로, 새 지침을 수동 반영해야 하는지 확인하세요.
34
48
 
35
49
  **4.x에서 업데이트할 때:** 5.x는 실제 실행 기록을 요구하는 v3 형식을 사용합니다. [검증 가이드](skills/workflow/references/verification.md)에 따라 `.ai-workflow/verification.json`과 Story에 연결된 G1/G3 기록을 준비하세요. 기존 v1/v2는 조회 전용(`upgrade-required`)입니다. 기존 worker를 중지하고 증거·시도 기록을 보존한 뒤 v3에서 리뷰·검증해야 합니다. `graph delivery`는 최종 스냅샷에 연결된 실제 G4도 확인합니다. [전체 변경 이력](CHANGELOG.md)을 참고하세요.
36
50
 
@@ -191,9 +205,9 @@ AGENTS.md / CLAUDE.md 표시된 구간에 작업 지침 추가
191
205
  templates/ai-workflow/ Story와 Task 서식
192
206
  ```
193
207
 
194
- `init`은 기존 설치도 업데이트합니다. 사용자가 고친 관리 파일은 보존하고 알려줍니다. `remove`는 kit이 관리하는 파일과 지침 구간을 제거합니다. 사용자 변경, 실행 기록, 증거는 남깁니다.
208
+ `init`은 기존 설치도 업데이트하고, 실행한 버전과 교체한 버전을 출력합니다. 사용자가 고친 관리 파일은 보존하고 알려줍니다. 보존된 파일은 옛 내용 그대로이므로 설치에 여러 버전이 섞입니다. 포매터가 바꾼 것도 수정으로 봅니다. 새 버전을 받으려면 그 파일을 지우고 `init`을 다시 실행하세요. `remove`는 kit이 관리하는 파일과 지침 구간을 제거합니다. 사용자 변경, 실행 기록, 증거는 남깁니다.
195
209
 
196
- 설치 후 `doctor`를 실행하세요. 누락된 파일과 검사기·그래프를 숨기는 Git 무시 규칙을 찾습니다. 프로젝트를 공유하기 전에 안내대로 수정하세요.
210
+ 설치 후 `doctor`를 실행하세요. CLI 버전과 설치된 버전을 출력하고, 누락된 파일, 그 버전과 내용이 다른 관리 파일, 검사기·그래프를 숨기는 Git 무시 규칙을 찾습니다. CLI가 설치된 kit보다 오래된 버전이면 실패합니다. 프로젝트를 공유하기 전에 안내대로 수정하세요.
197
211
 
198
212
  ## 명령어
199
213
 
package/README.md CHANGED
@@ -8,11 +8,16 @@ AI Workflow Kit adds a work process to Codex and Claude Code. It defines what to
8
8
 
9
9
  A graph runner tracks the task list and the rules for which task runs next.
10
10
 
11
- ## What's new in 5.2.0
11
+ ## What's new in 5.3.0
12
+
13
+ - **Upgrades name the versions involved.** `init` prints the running CLI version and the version it replaced, such as `Updated AI Workflow Kit 5.2.0 → 5.3.0.`, and `doctor` prints `Kit version: CLI …, installed …`. An older cached CLI now shows its version number instead of a bare "already up to date". `doctor` fails when the CLI is older than the install, because it cannot check a newer release's files.
14
+ - **Mixed-version installs are flagged.** When a managed file differs from the installed release, even if only a formatter changed it, `doctor` warns and says to delete the path and re-run `init`.
15
+ - **Upgrading from 5.2.0** keeps existing runs: no graph runtime file or role node changed. **From 5.0.x**, 5.1.0 was not published to npm, so the 5.1.0 changes below apply too. A role run started before the upgrade stops with `Role assignment or graph changed`. Start a new role run.
16
+
17
+ 5.2.0 added:
12
18
 
13
19
  - **Intake explores alternatives itself.** When a requested change can still behave in materially different ways, intake shows two or three options with trade-offs and a recommended default. CE `ce-brainstorm` runs only for an open idea (a goal with no concrete change yet), when you say you do not know what to build, or when you select it. The agent tells you when it uses it, and the results come back to the kit's Story and G1.
14
20
  - **The payment lens asks about rollback.** A Story that changes a price or charge rule now asks what triggers a rollback and what happens to charges already issued.
15
- - **Upgrading from 5.0.x?** 5.1.0 was not published to npm, so 5.2.0 also includes the 5.1.0 changes below. A role run started before the upgrade stops with `Role assignment or graph changed`. Start a new role run.
16
21
 
17
22
  5.1.0 added:
18
23
 
@@ -30,7 +35,16 @@ A graph runner tracks the task list and the rules for which task runs next.
30
35
  - **Keep review work bounded.** Default to three workers, reduce to 0–2 for small changes, and expand to 4–5 for named risks. Main simplifies and aggregates; nested workers share the same budget. The host enforces actual dispatch limits.
31
36
  - **Fix verification edge cases.** Incomplete output collection fails after bounded cleanup when an escaped child keeps pipes open. Valid check IDs such as `toString` and `hasOwnProperty` work regardless of execution order.
32
37
 
33
- To update an existing project, run `npx @pazmo/ai-workflow-kit@latest init`, then `npx @pazmo/ai-workflow-kit@latest doctor`. Open a new Codex task or Claude Code session. User-edited managed files are preserved and reported; inspect them for changes that need applying manually.
38
+ To update an existing project, pin the exact release instead of `@latest`, and check which CLI npx runs before you install. npx can quietly run an older cached copy, for example when the project's `.npmrc` points at a private registry that is unreachable. An exact version cannot be met by a different cached copy.
39
+
40
+ ```sh
41
+ VERSION=$(npm view @pazmo/ai-workflow-kit version --registry=https://registry.npmjs.org/)
42
+ npx @pazmo/ai-workflow-kit@$VERSION --version
43
+ npx @pazmo/ai-workflow-kit@$VERSION init
44
+ npx @pazmo/ai-workflow-kit@$VERSION doctor
45
+ ```
46
+
47
+ Stop if `--version` prints anything other than `$VERSION`. In a project whose `.npmrc` points at a private registry, put `--registry=https://registry.npmjs.org/` before the package name, for example `npx --registry=https://registry.npmjs.org/ @pazmo/ai-workflow-kit@$VERSION init`. After the package name it goes to the kit, not to npm. `init` names both versions, such as `Updated AI Workflow Kit 5.2.0 → 5.3.0.`, and `doctor` prints `Kit version: CLI …, installed …`. Then open a new Codex task or Claude Code session. User-edited managed files are preserved and reported; inspect them for changes that need applying manually.
34
48
 
35
49
  **Upgrading from 4.x:** 5.x uses persisted run format v3 and runner-issued receipts. Configure `.ai-workflow/verification.json` and Story-bound G1/G3 records using the [verification guide](skills/workflow/references/verification.md). Legacy v1/v2 runs are read-only (`upgrade-required`): stop old workers, preserve evidence/attempt history, and rerun review/checks in v3. `graph delivery` also requires a real G4 bound to the final snapshot. See [all changes](CHANGELOG.md).
36
50
 
@@ -192,9 +206,9 @@ AGENTS.md / CLAUDE.md Workflow instructions inside a marked block
192
206
  templates/ai-workflow/ Story and Task templates
193
207
  ```
194
208
 
195
- `init` also updates an existing installation. It preserves user-edited managed files and reports them. `remove` removes owned files and instruction blocks. It keeps user changes, run files, and evidence.
209
+ `init` also updates an existing installation and names the version it ran and the version it replaced. It preserves user-edited managed files and reports them. A preserved file keeps its old content, so the install then mixes versions. Formatter passes count as edits. To take the new copy, delete the file and run `init` again. `remove` removes owned files and instruction blocks. It keeps user changes, run files, and evidence.
196
210
 
197
- Run `doctor` after installation. It finds missing files and Git ignore rules that hide the checker or graph runtime. Follow its suggested fixes before sharing the project.
211
+ Run `doctor` after installation. It prints the CLI and installed versions, finds missing files, warns about managed files that differ from that version, and finds Git ignore rules that hide the checker or graph runtime. It fails when the CLI is older than the installed kit. Follow its suggested fixes before sharing the project.
198
212
 
199
213
  ## Commands
200
214
 
@@ -3,14 +3,17 @@ import { access, readFile, readdir } from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { checkArtifact, checkGate } from '../assets/check.mjs';
6
- import { installWorkflow, removeWorkflow } from '../src/install.mjs';
6
+ import { installWorkflow, managedDrift, removeWorkflow } from '../src/install.mjs';
7
7
  import { checkerVisibility, fileVisibilities, ignoredCheckerAdvice } from '../src/git-visibility.mjs';
8
8
  import { END_MARKER, START_MARKER } from '../src/managed-block.mjs';
9
9
  import { HOSTS } from '../src/paths.mjs';
10
10
  import { publishStory } from '../src/jira.mjs';
11
11
  import { runGraphCommand } from '../src/graph/cli.mjs';
12
+ import { compareVersions, readPackageVersion } from '../src/version.mjs';
12
13
 
13
14
  const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
15
+ const PACKAGE_NAME = '@pazmo/ai-workflow-kit';
16
+ const PUBLIC_REGISTRY = 'https://registry.npmjs.org/';
14
17
 
15
18
  async function graphFiles() {
16
19
  return ['.ai-workflow/bin/graph.mjs', ...(await readdir(path.join(packageRoot, 'src/graph')))
@@ -73,6 +76,38 @@ async function exists(file) {
73
76
  try { await access(file); return true; } catch { return false; }
74
77
  }
75
78
 
79
+ // A stale CLI (for example a cached npx copy behind an unreachable private registry)
80
+ // must not vouch for a newer install: that direction fails, the other only warns.
81
+ function versionCheck(cli, installed) {
82
+ const line = `Kit version: CLI ${cli}, installed ${installed ?? 'unknown'}`;
83
+ const order = compareVersions(cli, installed);
84
+ if (order === 0) return { status: 'PASS', line, advice: [], ok: true, sameVersion: true };
85
+ if (order === null) {
86
+ return { status: 'WARN', line, advice: ['The installed version is not recorded. Run init with this CLI to record it.'], ok: true };
87
+ }
88
+ if (order > 0) {
89
+ return {
90
+ status: 'WARN', line, ok: true,
91
+ advice: [
92
+ `The project has an older release. Run init with this CLI to update it, or check it with ${PACKAGE_NAME}@${installed}.`,
93
+ 'File contents are compared only when the versions match.',
94
+ ],
95
+ };
96
+ }
97
+ return {
98
+ status: 'FAIL', line, ok: false,
99
+ advice: [
100
+ 'This CLI is older than the installed kit: it cannot check that release, and its init would downgrade it.',
101
+ `npx may have run a cached copy (for example when a private registry in .npmrc is unreachable). Run: npx --registry=${PUBLIC_REGISTRY} ${PACKAGE_NAME}@${installed} doctor`,
102
+ ],
103
+ };
104
+ }
105
+
106
+ function listSome(items, limit = 3) {
107
+ const shown = items.slice(0, limit).join(', ');
108
+ return items.length > limit ? `${shown}, +${items.length - limit} more` : shown;
109
+ }
110
+
76
111
  async function doctor(root) {
77
112
  const configFile = path.join(root, '.ai-workflow/config.json');
78
113
  if (!await exists(configFile)) {
@@ -88,6 +123,11 @@ async function doctor(root) {
88
123
  return false;
89
124
  }
90
125
 
126
+ const cliVersion = await readPackageVersion(packageRoot);
127
+ const version = versionCheck(cliVersion, config.packageVersion);
128
+ console.log(`${version.status} ${version.line}`);
129
+ for (const line of version.advice) console.log(` ${line}`);
130
+
91
131
  const hosts = Array.isArray(config.hosts) ? config.hosts : [];
92
132
  if (hosts.length === 0 || hosts.some((host) => !HOSTS[host])) {
93
133
  console.log('MISS configured hosts');
@@ -110,7 +150,7 @@ async function doctor(root) {
110
150
  if (name.endsWith('.mjs')) checks.push([`Graph runtime ${name}`, `.ai-workflow/graph/${name}`]);
111
151
  }
112
152
 
113
- let ok = true;
153
+ let ok = version.ok;
114
154
  for (const [label, relative, routing] of checks) {
115
155
  const file = path.join(root, relative);
116
156
  let present = await exists(file);
@@ -122,6 +162,16 @@ async function doctor(root) {
122
162
  ok &&= present;
123
163
  }
124
164
 
165
+ if (version.sameVersion) {
166
+ const drift = await managedDrift({ root, packageRoot, hosts });
167
+ for (const { relative, files } of drift) {
168
+ console.log(`WARN Mixed version: ${relative} differs from ${cliVersion}${files.length ? ` (${listSome(files)})` : ''}`);
169
+ }
170
+ if (drift.length) {
171
+ console.log(` Kept from an older release or edited locally (a formatter pass counts). To take ${cliVersion}, delete each listed path and re-run init; copy any edits you want to keep first.`);
172
+ }
173
+ }
174
+
125
175
  const visibility = await checkerVisibility(root);
126
176
  if (visibility.status === 'ignored') {
127
177
  console.log(`MISS Checker reaches git: ${visibility.source}`);
@@ -172,9 +222,18 @@ async function main(argv) {
172
222
 
173
223
  if (command === 'init') {
174
224
  const result = await installWorkflow({ root, packageRoot, hosts });
175
- console.log(result.changed ? 'Installed/updated AI Workflow Kit.' : 'AI Workflow Kit is already up to date.');
225
+ const { version, previousVersion } = result;
226
+ if (!result.changed) console.log(`AI Workflow Kit ${version} is already up to date (installed ${previousVersion ?? version}).`);
227
+ else if (!previousVersion) console.log(`Installed AI Workflow Kit ${version}.`);
228
+ else console.log(`Updated AI Workflow Kit ${previousVersion} → ${version}.`);
229
+ if (compareVersions(version, previousVersion) < 0) {
230
+ console.log(`WARNING This CLI (${version}) is older than the kit it replaced (${previousVersion}), so the project was downgraded. If npx ran a cached copy, re-run: npx --registry=${PUBLIC_REGISTRY} ${PACKAGE_NAME}@${previousVersion} init`);
231
+ }
176
232
  console.log(`Hosts: ${result.hosts.join(', ')}`);
177
- if (result.preserved.length) console.log(`Preserved modified files: ${result.preserved.join(', ')}`);
233
+ if (result.preserved.length) {
234
+ console.log(`Preserved modified files: ${result.preserved.join(', ')}`);
235
+ console.log(`WARNING Mixed-version install: the files above were kept as they were and do not match ${version}. To take ${version}, delete each one and re-run init; copy any local edits you want to keep first.`);
236
+ }
178
237
  const visibility = await checkerVisibility(root);
179
238
  if (visibility.status === 'ignored') {
180
239
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pazmo/ai-workflow-kit",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/syjkim0125/ai-workflow-kit.git"
@@ -102,11 +102,31 @@ Input: Office launches two kit runs against the same repository, or cancels a wo
102
102
  Expected: Office isolates/serializes writers across runs and stops workers before reset. Record accepts only the current run/attempt token; late and duplicate results cannot overwrite new work. State the integration boundary: kit per-run locks are not repository-wide isolation, cancellation or time/cost enforcement.
103
103
  Failure: Claim the local graph alone guarantees safe independent Office workers or that rejecting a late result undoes its filesystem effects.
104
104
 
105
+ ## Named change with diverging behaviors
106
+ Input: A PM asks to let customers pause a subscription. The change is named, but billing during the pause can follow three materially different rules, and one of them affects charges already issued. Superpowers `brainstorming`, which calls itself mandatory before creative work, and CE `ce-brainstorm` are both installed.
107
+ Expected: Intake explores in the kit: one question with two or three options, what each does, its trade-off and a recommended default. Load neither brainstorming skill for a named change. Keep the unsettled charge rule blocking and ask for its rollback trigger and what happens to charges already issued. The Story proposal and the user's G1 remain the only requirements source and approval.
108
+ Failure: Start Superpowers `brainstorming` and its plan-and-execute chain, call `ce-brainstorm` for a named change, ask about each option separately, or label the unsettled charge rule `ASSUMED` or a non-blocking note.
109
+
110
+ ## Open idea before any concrete change
111
+ Input: One request states only a goal: renewals keep failing, figure out what to build. Another user says they do not know what to build. A third request names a concrete change. A fourth project has the same open goal without CE installed.
112
+ Expected: Decide from the request before loading a skill. For the open goal and the unsure user, announce in one line that `ce-brainstorm` will explore and that the user can switch to direct scoping, then pass the caller-owned exploration instruction; decisions, alternatives considered and open questions return to intake. The named change stays in intake. Without CE, intake explores directly and reports the fallback.
113
+ Failure: Let `ce-brainstorm` write or commit a separate spec, invoke a planning or implementation skill, or show its next-step menu, which can offer `lfg` with a PR and a push. Load it silently or for a named change, or install CE.
114
+
115
+ ## Caller-owned planning
116
+ Input: The team lead receives a Story with G1 recorded. Superpowers `writing-plans` ends with an Execution Handoff offering subagent-driven or inline execution, and its plan header names an execution sub-skill. CE `ce-plan` is also installed.
117
+ Expected: Invoke `superpowers:writing-plans` with the caller-owned plan instruction from skill-integration.md. Return the plan path, self-review result and unresolved decisions as blockers. Skip the Execution Handoff and name this workflow's graph as the executor in the plan header. Reuse an existing plan; a small reversible task may use the kit's minimal plan. Use `ce-plan` only when the user or host selects CE planning.
118
+ Failure: Start `executing-plans` or `subagent-driven-development`, leave an execution sub-skill as the plan's executor, default to `ce-plan`, or treat the plan's self-review as G3.
119
+
105
120
  ## Focused implementation returns to its caller
106
121
  Input: Developer receives only Task A of a project plan; CE and Superpowers are both installed. G1 already covers this work.
107
122
  Expected: Read skill-integration.md and the applicable Superpowers focused skill. Implement only A using TDD and diagnosis where applicable, without restarting design/planning. Use ce-work return-to-caller only as an explicitly selected alternative. Return changes and verification; the kit still owns final simplify/review/G4. Do not re-plan settled requirements or execute Tasks B/C.
108
123
  Failure: Invoke bare ce-work with the full project plan, enter shipping/babysitting, or start Superpowers design approvals and another implementer/reviewer hierarchy.
109
124
 
125
+ ## Superpowers review inside the allocation
126
+ Input: A normal review round has an allocation of three workers. Superpowers `requesting-code-review` dispatches one reviewer per filled template; CE `ce-code-review` is also installed and would add persona, validator and report workers.
127
+ Expected: Fill one template per bounded assignment (correctness and security, tests and runtime evidence, maintainability and performance), give each only its diff, requirements and evidence, and count each as one worker. Main aggregates and returns fixes to the Developer. Use `ce-code-review mode:agent` only when the user or host selects it and its fan-out fits the allocation; otherwise review directly within the allocation.
128
+ Failure: Default to `ce-code-review`, launch it beyond the allocation and hope, call one whole-diff template three reviews, let a reviewer re-delegate, or apply fixes from a read-only review.
129
+
110
130
  ## Completed review still needs fixes
111
131
  Input: ce-code-review mode:agent returns status complete, verdict Ready with fixes, and an unresolved material finding; actionable_findings is empty because the finding needs verification.
112
132
  Expected: Read findings, coverage and testing gaps; do not pass the review node. Return the concrete issue to the Developer or unresolved decision to the host, then review/reverify the affected new revision.
package/src/install.mjs CHANGED
@@ -13,6 +13,7 @@ import { fileURLToPath } from 'node:url';
13
13
  import { HOSTS, normalizeHosts, projectPath } from './paths.mjs';
14
14
  import { managedBlockFor, removeManagedBlock, upsertManagedBlock } from './managed-block.mjs';
15
15
  import { installTransaction } from './install-transaction.mjs';
16
+ import { readPackageVersion } from './version.mjs';
16
17
 
17
18
  const modulePackageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
18
19
  const CONFIG_PATH = '.ai-workflow/config.json';
@@ -50,9 +51,9 @@ async function fileHash(file) {
50
51
  return sha256(await readFile(file));
51
52
  }
52
53
 
53
- async function treeHash(directory) {
54
- if (!await exists(directory)) return null;
55
- const entries = [];
54
+ // Relative path -> content hash, in the walk order treeHash has always used.
55
+ async function treeFiles(directory) {
56
+ const files = new Map();
56
57
 
57
58
  async function walk(current, prefix = '') {
58
59
  const children = await readdir(current, { withFileTypes: true });
@@ -61,11 +62,18 @@ async function treeHash(directory) {
61
62
  const relative = path.posix.join(prefix, child.name);
62
63
  const full = path.join(current, child.name);
63
64
  if (child.isDirectory()) await walk(full, relative);
64
- else entries.push(`${relative}:${await fileHash(full)}`);
65
+ else files.set(relative, await fileHash(full));
65
66
  }
66
67
  }
67
68
 
68
69
  await walk(directory);
70
+ return files;
71
+ }
72
+
73
+ // Recorded in .ai-workflow/config.json: the entry format must stay byte-identical.
74
+ async function treeHash(directory) {
75
+ if (!await exists(directory)) return null;
76
+ const entries = [...await treeFiles(directory)].map(([relative, hash]) => `${relative}:${hash}`);
69
77
  return sha256(entries.join('\n'));
70
78
  }
71
79
 
@@ -77,14 +85,6 @@ async function writeIfChanged(file, content) {
77
85
  return true;
78
86
  }
79
87
 
80
- async function packageVersion(packageRoot) {
81
- try {
82
- return JSON.parse(await readFile(path.join(packageRoot, 'package.json'), 'utf8')).version;
83
- } catch {
84
- return '3.0.0';
85
- }
86
- }
87
-
88
88
  async function readConfig(root) {
89
89
  try {
90
90
  return JSON.parse(await readFile(projectPath(root, CONFIG_PATH), 'utf8'));
@@ -259,16 +259,24 @@ async function installPrepared({
259
259
  if (checkerResult.changed) installed.push(CHECKER_PATH);
260
260
  if (checkerResult.preserved) preserved.push(CHECKER_PATH);
261
261
 
262
+ const version = await readPackageVersion(packageRoot);
262
263
  const config = `${JSON.stringify({
263
264
  schemaVersion: 2,
264
- packageVersion: await packageVersion(packageRoot),
265
+ packageVersion: version,
265
266
  hosts: selectedHosts,
266
267
  managedFiles,
267
268
  managedTrees,
268
269
  }, null, 2)}\n`;
269
270
  changed = await writeIfChanged(projectPath(root, CONFIG_PATH), config) || changed;
270
271
 
271
- return { changed, installed, preserved, hosts: selectedHosts };
272
+ return {
273
+ changed,
274
+ installed,
275
+ preserved,
276
+ hosts: selectedHosts,
277
+ previousVersion: previous?.packageVersion ?? null,
278
+ version,
279
+ };
272
280
  }
273
281
 
274
282
  export async function installWorkflow(options = {}) {
@@ -276,6 +284,37 @@ export async function installWorkflow(options = {}) {
276
284
  return installTransaction(root, (stage) => installPrepared({ ...options, root: stage }));
277
285
  }
278
286
 
287
+ // Managed paths whose bytes differ from this package's source: files an install
288
+ // preserved (local edits, formatter passes, older copies) next to newer ones.
289
+ // Trees list the differing files inside them; deleting the tree is the fix.
290
+ export async function managedDrift({ root = process.cwd(), packageRoot = modulePackageRoot, hosts = [] } = {}) {
291
+ root = path.resolve(root);
292
+ packageRoot = path.resolve(packageRoot);
293
+ const drift = [];
294
+ const trees = [
295
+ ...normalizeHosts(hosts).map((host) => ['skills/workflow', HOSTS[host].skillDir]),
296
+ ['src/graph', GRAPH_PATH],
297
+ ];
298
+ for (const [sourceRelative, relative] of trees) {
299
+ const target = projectPath(root, relative);
300
+ if (!await exists(target)) continue;
301
+ const expected = await treeFiles(path.join(packageRoot, sourceRelative));
302
+ const actual = await treeFiles(target);
303
+ const files = [...new Set([...expected.keys(), ...actual.keys()])]
304
+ .filter((file) => expected.get(file) !== actual.get(file))
305
+ .sort();
306
+ if (files.length) drift.push({ relative, files });
307
+ }
308
+ for (const [sourceRelative, relative] of [...TEMPLATE_PATHS, ['assets/check.mjs', CHECKER_PATH]]) {
309
+ const target = projectPath(root, relative);
310
+ if (!await exists(target)) continue;
311
+ if (await fileHash(target) !== await fileHash(path.join(packageRoot, sourceRelative))) {
312
+ drift.push({ relative, files: [] });
313
+ }
314
+ }
315
+ return drift;
316
+ }
317
+
279
318
  async function removeEmptyParents(file, stopAt) {
280
319
  let current = path.dirname(file);
281
320
  while (current.startsWith(stopAt) && current !== stopAt) {
@@ -0,0 +1,28 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+
4
+ export async function readPackageVersion(packageRoot) {
5
+ try {
6
+ return JSON.parse(await readFile(path.join(packageRoot, 'package.json'), 'utf8')).version;
7
+ } catch {
8
+ return '3.0.0';
9
+ }
10
+ }
11
+
12
+ const SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
13
+
14
+ // Negative when left < right, positive when left > right, 0 when equal, null when
15
+ // either side is not a version (a hand-edited or missing packageVersion).
16
+ export function compareVersions(left, right) {
17
+ const a = SEMVER.exec(String(left ?? ''));
18
+ const b = SEMVER.exec(String(right ?? ''));
19
+ if (!a || !b) return null;
20
+ for (let index = 1; index <= 3; index += 1) {
21
+ const difference = Number(a[index]) - Number(b[index]);
22
+ if (difference) return Math.sign(difference);
23
+ }
24
+ if (a[4] === b[4]) return 0;
25
+ if (!a[4]) return 1;
26
+ if (!b[4]) return -1;
27
+ return a[4] < b[4] ? -1 : 1;
28
+ }