@ai-content-space/loopx 0.1.3 → 0.1.5

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 (40) hide show
  1. package/README.md +123 -6
  2. package/README.zh-CN.md +143 -10
  3. package/assets/logo.svg +89 -0
  4. package/package.json +4 -2
  5. package/plugins/loopx/.codex-plugin/plugin.json +1 -1
  6. package/plugins/loopx/scripts/plugin-install.test.mjs +13 -0
  7. package/plugins/loopx/skills/archive/SKILL.md +14 -1
  8. package/plugins/loopx/skills/autopilot/SKILL.md +4 -1
  9. package/plugins/loopx/skills/build/SKILL.md +7 -1
  10. package/plugins/loopx/skills/clarify/SKILL.md +13 -9
  11. package/plugins/loopx/skills/debug/SKILL.md +4 -1
  12. package/plugins/loopx/skills/go-style/SKILL.md +4 -1
  13. package/plugins/loopx/skills/kratos/SKILL.md +4 -1
  14. package/plugins/loopx/skills/plan/SKILL.md +8 -4
  15. package/plugins/loopx/skills/review/SKILL.md +7 -1
  16. package/plugins/loopx/skills/tdd/SKILL.md +4 -1
  17. package/plugins/loopx/skills/verify/SKILL.md +4 -1
  18. package/scripts/codex-workflow-hook.mjs +101 -6
  19. package/scripts/verify-skills.mjs +166 -0
  20. package/skills/RESOLVER.md +45 -0
  21. package/skills/archive/SKILL.md +14 -1
  22. package/skills/autopilot/SKILL.md +4 -1
  23. package/skills/build/SKILL.md +7 -1
  24. package/skills/clarify/SKILL.md +13 -9
  25. package/skills/debug/SKILL.md +4 -1
  26. package/skills/go-style/SKILL.md +4 -1
  27. package/skills/kratos/SKILL.md +4 -1
  28. package/skills/plan/SKILL.md +8 -4
  29. package/skills/review/SKILL.md +7 -1
  30. package/skills/tdd/SKILL.md +4 -1
  31. package/skills/verify/SKILL.md +4 -1
  32. package/src/build-runtime.mjs +8 -0
  33. package/src/cli.mjs +10 -0
  34. package/src/context-manifest.mjs +3 -1
  35. package/src/html-views.mjs +316 -0
  36. package/src/plan-runtime.mjs +23 -0
  37. package/src/project-discovery.mjs +163 -0
  38. package/src/review-runtime.mjs +203 -23
  39. package/src/runtime-maintenance.mjs +1 -0
  40. package/src/workflow.mjs +499 -94
package/README.md CHANGED
@@ -1,4 +1,12 @@
1
- # loopx
1
+ <p align="center">
2
+ <img src="./assets/logo.svg" alt="loopx fox logo" width="128" height="128">
3
+ </p>
4
+
5
+ <h1 align="center">loopx</h1>
6
+
7
+ <p align="center">
8
+ Skill-first workflow runtime for Codex.
9
+ </p>
2
10
 
3
11
  [中文文档](./README.zh-CN.md)
4
12
 
@@ -17,15 +25,18 @@ clarify -> plan -> build -> review -> approve review->done -> archive
17
25
  ## Features
18
26
 
19
27
  - Installs and exposes eleven bundled loopx Codex skills: workflow skills `clarify`, `plan`, `build`, `review`, `archive`, and `autopilot`; quality support skills `debug`, `tdd`, and `verify`; and Go support skills `go-style` and `kratos`.
28
+ - Keeps bundled skill routing explicit in `skills/RESOLVER.md`, with deterministic governance checks for frontmatter, plugin mirrors, resolver coverage, local references, package inclusion, and version alignment.
20
29
  - Supports npm global install and Codex plugin install through the same install/discovery core.
30
+ - Installs a managed Codex workflow hook that surfaces loopx workflow state and safe next-action hints inside Codex.
21
31
  - Stores runtime state and stage artifacts locally under `.loopx/` for auditability, recovery, and migration.
32
+ - Stores clarify intake snapshots under `.loopx/intake/` so `.loopx/specs/` stays reserved for long-lived domain specs.
33
+ - Records existing project AI rule files, existing spec sources, and detected verification commands in `.loopx/config.json` during init so loopx can preserve local sources of truth while still running the full workflow.
22
34
  - Runs `plan` with a Planner -> Architect -> Critic consensus loop by default.
23
35
  - Writes OpenSpec-inspired change artifacts during `plan`: proposal, spec delta, design, vertical slices, tasks, and an artifact dependency graph.
24
36
  - Provides per-repo agent context under `.loopx/agents/` and `.loopx/context/domain.md`, consumed by build/review context manifests.
25
37
  - Runs `build` with execution records, verification evidence, architect validation, deslop cleanup, and regression re-verification.
26
38
  - Keeps `review` as an independent acceptance surface with code review plus an internal architecture-smell lane.
27
39
  - Supports `archive` to sync approved change deltas into long-lived `.loopx/specs/` source-of-truth files and emit ADR candidates.
28
- - Supports migration from the legacy `.codex-helper/` runtime namespace to `.loopx/`.
29
40
 
30
41
  ## Installation
31
42
 
@@ -47,6 +58,12 @@ The script materializes loopx-owned skills under:
47
58
  ~/.agents/skills/
48
59
  ```
49
60
 
61
+ It also installs the loopx-managed Codex workflow hook at:
62
+
63
+ ```text
64
+ ~/.codex/hooks/codex-workflow-hook.mjs
65
+ ```
66
+
50
67
  and updates:
51
68
 
52
69
  ```text
@@ -108,7 +125,6 @@ Complete an approved review:
108
125
 
109
126
  ```bash
110
127
  loopx approve my-task --from review --to done
111
- loopx review my-task
112
128
  ```
113
129
 
114
130
  Archive accepted behavior into long-lived specs:
@@ -124,6 +140,12 @@ loopx status my-task
124
140
  loopx status my-task --json
125
141
  ```
126
142
 
143
+ Render derived HTML reading views:
144
+
145
+ ```bash
146
+ loopx render my-task
147
+ ```
148
+
127
149
  You can also create a planning workflow directly from an existing spec:
128
150
 
129
151
  ```bash
@@ -142,6 +164,7 @@ loopx build --from-review <review-report-path> [--no-deslop]
142
164
  loopx review <slug> [--reviewer <name>]
143
165
  loopx archive <slug>
144
166
  loopx autopilot <slug> [--reviewer <name>]
167
+ loopx render [slug|--all]
145
168
  loopx status [slug] [--json]
146
169
  loopx setup-context
147
170
  loopx doctor
@@ -151,7 +174,25 @@ loopx repair-install
151
174
 
152
175
  The CLI is primarily for runtime, debugging, status inspection, and maintenance. The normal Codex-facing product surface is the bundled skill set, for example `$clarify`, `$plan`, `$build`, `$review`, `$archive`, `$autopilot`, `$debug`, `$tdd`, `$verify`, `$go-style`, and `$kratos`.
153
176
 
154
- `loopx status` remains a CLI/runtime diagnostic command rather than a Codex skill.
177
+ `loopx status` remains a CLI/runtime diagnostic command rather than a Codex skill. `loopx render` generates human-readable HTML views from existing runtime artifacts; without a slug it renders every non-legacy workflow plus the workspace index. Markdown and JSON remain the canonical machine-readable and editable sources.
178
+
179
+ ## Skill Routing and Governance
180
+
181
+ The bundled skill resolver lives at:
182
+
183
+ ```text
184
+ skills/RESOLVER.md
185
+ ```
186
+
187
+ It is the human-readable routing map for the eleven bundled skills. Keep it aligned with each `skills/<name>/SKILL.md` and mirrored `plugins/loopx/skills/<name>/SKILL.md`.
188
+
189
+ Skill governance is enforced by:
190
+
191
+ ```bash
192
+ node scripts/verify-skills.mjs
193
+ ```
194
+
195
+ The verifier checks that bundled skill frontmatter is triggerable and bounded, `metadata.version` matches `package.json`, plugin skill mirrors match the canonical skills, `skills/RESOLVER.md` covers every bundled skill without stale bundled-skill references, local skill references exist, the plugin manifest version matches the package version, and the verifier itself is included in the npm package.
155
196
 
156
197
  ## Skills
157
198
 
@@ -183,6 +224,8 @@ Main artifacts:
183
224
  - `.loopx/workflows/<slug>/development-plan.md`
184
225
  - `.loopx/workflows/<slug>/test-plan.md`
185
226
 
227
+ `spec-delta.md` uses requirement deltas: `## ADDED Requirements`, `## MODIFIED Requirements`, `## REMOVED Requirements`, and `## RENAMED Requirements`. ADDED and MODIFIED entries are full `### Requirement:` blocks with SHALL/MUST language and `#### Scenario:` examples, so archive can merge them into the current long-lived spec state.
228
+
186
229
  ### build
187
230
 
188
231
  `build` executes an approved plan and records changes, evidence, and limitations in the canonical artifact:
@@ -229,6 +272,8 @@ The architecture-smell lane is part of review; it does not add a new stage. It r
229
272
 
230
273
  Archive also writes an advisory ADR candidate under `.loopx/decisions/adr-candidates/<change-id>.md`. It is not promoted to `docs/adr/` automatically.
231
274
 
275
+ Archive applies requirement deltas semantically instead of appending per-change history blocks. ADDED creates requirements, MODIFIED replaces a full existing requirement block, REMOVED deletes a requirement, and RENAMED changes the requirement title while preserving its body.
276
+
232
277
  ### autopilot
233
278
 
234
279
  `autopilot` is the end-to-end orchestration entrypoint. It may run internal phases such as expansion, planning, execution, QA, and validation, but canonical artifacts still come from the public `clarify -> plan -> build -> review` flow.
@@ -267,6 +312,10 @@ loopx writes runtime state under `.loopx/` in the current project:
267
312
  .loopx/
268
313
  README.md
269
314
  config.json
315
+ intake/
316
+ clarify-<slug>-<timestamp>.md
317
+ views/
318
+ index.html
270
319
  specs/
271
320
  <domain>/
272
321
  spec.md
@@ -300,14 +349,52 @@ loopx writes runtime state under `.loopx/` in the current project:
300
349
  test-plan.md
301
350
  execution-record.md
302
351
  review-report.md
352
+ view/
353
+ index.html
354
+ intake.html
355
+ plan.html
356
+ build.html
357
+ review.html
303
358
  plan-reviews/
304
359
  build-support/
360
+ review-support/
305
361
  autopilot/
306
362
  <slug>/
307
363
  run.json
308
364
  ```
309
365
 
310
- Legacy `.codex-helper/` state can be migrated with `loopx migrate`. The `.omx/` tree remains external orchestration/planning metadata and is not part of the loopx runtime namespace.
366
+ `config.json` records the loopx product contract plus init-time project discovery: existing AI rules such as `AGENTS.md` / `CLAUDE.md` / Cursor / Copilot files, existing spec sources such as `docs/changes` or ADR/RFC folders, and detected install/test/lint/typecheck/build/E2E commands. This does not create a lighter loopx mode; it keeps project facts available to `plan`, `build`, and `review` while preserving loopx's full closed workflow.
367
+
368
+ `intake` contains immutable clarify snapshots for a specific request. `workflows` contains the active runtime working set. `changes` contains the proposed change delta for the current request. `specs` contains accepted long-lived behavior after archive.
369
+
370
+ `views/` and `workflows/<slug>/view/` are derived HTML reading views generated by `loopx render`. They are for human review only and are safe to regenerate; agents and tooling should continue to read and update the Markdown and JSON artifacts.
371
+
372
+ ### Document Boundaries
373
+
374
+ Documents users normally need to watch:
375
+
376
+ - `README.md` / `README.zh-CN.md`: product usage, commands, and runtime layout.
377
+ - `.loopx/workflows/<slug>/spec.md`: the current requirement working copy.
378
+ - `.loopx/workflows/<slug>/plan.md`, `architecture.md`, `development-plan.md`, and `test-plan.md`: the current task's plan, architecture, execution, and verification contract.
379
+ - `.loopx/workflows/<slug>/execution-record.md` and `review-report.md`: execution evidence and review result.
380
+ - `.loopx/views/index.html` and `.loopx/workflows/<slug>/view/index.html`: reading entrypoints generated by `loopx render`.
381
+
382
+ Documents users may read and modify as workflow fact sources:
383
+
384
+ - `.loopx/workflows/<slug>/*.md`: editable working-copy artifacts for the active workflow; changes still need to pass the relevant stage gates.
385
+ - `.loopx/config.json`: workspace configuration, project-rule/spec-source discovery, and default verification commands; update it if the repository's canonical commands or project-rule files change.
386
+ - `.loopx/context/domain.md` and `.loopx/agents/*.md`: project context, domain vocabulary, and agent collaboration guidance.
387
+ - `.loopx/changes/active/<change-id>/*.md`: plan-generated change proposal, design, tasks, and spec delta; edits should be followed by plan/build/review validation.
388
+ - `.loopx/specs/<domain>/spec.md`: long-lived archived behavior specs; normally synced by `archive`, and manual edits should stay consistent with later change deltas.
389
+
390
+ Documents and data the tools depend on, or generate as derived evidence:
391
+
392
+ - `.loopx/workflows/<slug>/state.json`, `build-context.jsonl`, and `review-context.jsonl`: runtime state and context manifests; tools depend on these and manual edits are discouraged.
393
+ - `.loopx/workflows/<slug>/plan-reviews/`, `build-support/`, and `review-support/`: stage evidence and internal review outputs for diagnostics and review.
394
+ - `.loopx/intake/clarify-*.md`: immutable clarify snapshots for audit and traceability; do not treat them as long-lived specs.
395
+ - `.loopx/changes/active/<change-id>/slices.json` and `artifact-graph.json`: structured planning data consumed by build/review/archive.
396
+ - `.loopx/autopilot/<slug>/run.json` and `.loopx/build-active.json`: orchestration and stop-hook runtime state.
397
+ - `.loopx/views/` and `.loopx/workflows/<slug>/view/`: derived HTML views; they can be deleted and regenerated with `loopx render`, and should not be edited as fact sources.
311
398
 
312
399
  ## Diagnostics and Repair
313
400
 
@@ -329,6 +416,24 @@ Check skill discovery state only:
329
416
  node scripts/install-skills.mjs --check
330
417
  ```
331
418
 
419
+ Verify bundled skill governance:
420
+
421
+ ```bash
422
+ node scripts/verify-skills.mjs
423
+ ```
424
+
425
+ ## Codex Workflow Hook
426
+
427
+ `install-skills.mjs` and the Codex plugin installer automatically install `scripts/codex-workflow-hook.mjs` to:
428
+
429
+ ```text
430
+ ~/.codex/hooks/codex-workflow-hook.mjs
431
+ ```
432
+
433
+ The hook reads the nearest `.loopx/workflows/<slug>/state.json` and emits advisory context for the active workflow: current stage, blockers, readiness, authorization, evidence, and the next safe loopx action. It is advisory only; runtime gates remain authoritative.
434
+
435
+ Set `LOOPX_HOOKS=0` to disable the workflow hook output.
436
+
332
437
  ## Codex Stop Hook
333
438
 
334
439
  loopx includes a Codex stop-hook helper that prevents an active build from stopping before review handoff readiness:
@@ -358,6 +463,7 @@ Install and discovery logic supports these environment variables:
358
463
  - `LOOPX_DISTRIBUTION_CHANNEL`: set the install channel, default `npm`.
359
464
  - `LOOPX_INSTALLATION_IDENTITY`: set the install identity, default `loopx`.
360
465
  - `LOOPX_SOURCE_URL`: set the install source.
466
+ - `LOOPX_HOOKS`: set to `0` to disable workflow hook output.
361
467
 
362
468
  ## Development
363
469
 
@@ -367,9 +473,17 @@ Run tests:
367
473
  npm test
368
474
  ```
369
475
 
476
+ `npm test` runs bundled skill governance first, then the Node test suites:
477
+
478
+ ```bash
479
+ node scripts/verify-skills.mjs
480
+ node --test test/*.test.mjs
481
+ ```
482
+
370
483
  Useful verification commands:
371
484
 
372
485
  ```bash
486
+ node scripts/verify-skills.mjs
373
487
  node --test test/*.test.mjs
374
488
  node scripts/install-skills.mjs --check
375
489
  node --test plugins/loopx/scripts/plugin-install.test.mjs
@@ -386,7 +500,10 @@ node src/cli.mjs status --json
386
500
  - `README.zh-CN.md`
387
501
  - `package.json`
388
502
  - `scripts/install-skills.mjs`
503
+ - `scripts/verify-skills.mjs`
389
504
  - `scripts/codex-stop-hook.mjs`
505
+ - `scripts/codex-workflow-hook.mjs`
506
+ - `assets/logo.svg`
390
507
  - `src/`
391
508
  - `skills/`, including public loopx skills plus compatibility/internal skill sources shipped with the package
392
509
  - `templates/`
@@ -394,4 +511,4 @@ node src/cli.mjs status --json
394
511
 
395
512
  ## Version
396
513
 
397
- Current npm package version: `0.1.2`.
514
+ Current npm package version: `0.1.4`.
package/README.zh-CN.md CHANGED
@@ -1,4 +1,12 @@
1
- # loopx
1
+ <p align="center">
2
+ <img src="./assets/logo.svg" alt="loopx fox logo" width="128" height="128">
3
+ </p>
4
+
5
+ <h1 align="center">loopx</h1>
6
+
7
+ <p align="center">
8
+ 面向 Codex 的 skill-first 工作流运行时。
9
+ </p>
2
10
 
3
11
  [English](./README.md)
4
12
 
@@ -7,9 +15,11 @@
7
15
  当前公开流程:
8
16
 
9
17
  ```text
10
- clarify -> plan -> build -> review
18
+ clarify -> plan -> build -> review -> approve review->done -> archive
11
19
  ```
12
20
 
21
+ `done` 是通过 `loopx approve <slug> --from review --to done` 进入的运行时完成状态,不是单独的 Codex skill。
22
+
13
23
  评审通过并进入 `done` 后,可以执行 archive,把本次被接受的 change delta 合并到长期 specs。
14
24
 
15
25
  其中 `autopilot` 是端到端编排入口,会在内部复用这套公开阶段,而不是引入另一套流程真相。
@@ -17,14 +27,18 @@ clarify -> plan -> build -> review
17
27
  ## 特性
18
28
 
19
29
  - 安装并公开 11 个 loopx Codex skills:工作流 skills `clarify`、`plan`、`build`、`review`、`archive`、`autopilot`,质量辅助 skills `debug`、`tdd`、`verify`,以及 Go 支持 skills `go-style`、`kratos`。
30
+ - 通过 `skills/RESOLVER.md` 明确 bundled skill 路由,并用确定性治理脚本检查 frontmatter、plugin 镜像、resolver 覆盖、本地引用、发布包包含项和版本一致性。
20
31
  - 支持 npm 全局安装和 Codex plugin 安装,两种安装方式共享同一套 install/discovery 逻辑。
32
+ - 自动安装 loopx 管理的 Codex workflow hook,在 Codex 中提示当前 workflow 状态和安全下一步。
21
33
  - 所有运行时状态和阶段产物都写入项目本地 `.loopx/`,便于审计、恢复和迁移。
34
+ - clarify 需求快照写入 `.loopx/intake/`,让 `.loopx/specs/` 只承载长期领域规格。
35
+ - init 时会把已有项目 AI 规则、既有 spec 来源和自动发现的验证命令记录到 `.loopx/config.json`,让 loopx 保留项目原有事实源,同时继续执行完整闭环。
22
36
  - `plan` 默认采用 Planner -> Architect -> Critic 的共识规划循环。
23
37
  - `plan` 会写入借鉴 OpenSpec 的 change artifacts:proposal、spec delta、design、tasks 和 artifact dependency graph。
38
+ - 提供项目级 agent context:`.loopx/agents/` 和 `.loopx/context/domain.md`,供 build/review 的 context manifest 消费。
24
39
  - `build` 默认包含执行记录、验证证据、架构验收、deslop 清理和回归再验证。
25
- - `review` 作为独立验收面,输出中文评审结论和 go/no-go 判断。
26
- - 支持 `archive`,把已批准的 change delta 同步进长期 `.loopx/specs/` source of truth。
27
- - 支持从旧 `.codex-helper/` 运行时迁移到 `.loopx/`。
40
+ - `review` 作为独立验收面,包含代码审查和内部 architecture-smell lane,并输出中文评审结论和 go/no-go 判断。
41
+ - 支持 `archive`,把已批准的 change delta 同步进长期 `.loopx/specs/` source of truth,并生成 ADR candidate
28
42
 
29
43
  ## 安装
30
44
 
@@ -46,6 +60,12 @@ node scripts/install-skills.mjs
46
60
  ~/.agents/skills/
47
61
  ```
48
62
 
63
+ 同时也会把 loopx 管理的 Codex workflow hook 安装到:
64
+
65
+ ```text
66
+ ~/.codex/hooks/codex-workflow-hook.mjs
67
+ ```
68
+
49
69
  并更新:
50
70
 
51
71
  ```text
@@ -107,7 +127,6 @@ loopx review my-task
107
127
 
108
128
  ```bash
109
129
  loopx approve my-task --from review --to done
110
- loopx review my-task
111
130
  ```
112
131
 
113
132
  把已接受行为归档到长期 specs:
@@ -123,6 +142,12 @@ loopx status my-task
123
142
  loopx status my-task --json
124
143
  ```
125
144
 
145
+ 生成派生 HTML 阅读视图:
146
+
147
+ ```bash
148
+ loopx render my-task
149
+ ```
150
+
126
151
  也可以让 loopx 根据一个现成 spec 直接创建规划工作流:
127
152
 
128
153
  ```bash
@@ -141,6 +166,7 @@ loopx build --from-review <review-report-path> [--no-deslop]
141
166
  loopx review <slug> [--reviewer <name>]
142
167
  loopx archive <slug>
143
168
  loopx autopilot <slug> [--reviewer <name>]
169
+ loopx render [slug|--all]
144
170
  loopx status [slug] [--json]
145
171
  loopx setup-context
146
172
  loopx doctor
@@ -150,7 +176,25 @@ loopx repair-install
150
176
 
151
177
  CLI 主要用于运行时、调试、状态观察和维护。日常面向 Codex 的主入口是同名 skills,例如 `$clarify`、`$plan`、`$build`、`$review`、`$archive`、`$autopilot`、`$debug`、`$tdd`、`$verify`、`$go-style`、`$kratos`。
152
178
 
153
- `loopx status` 仍然是 CLI/runtime 诊断命令,不作为单独 Codex skill 暴露。
179
+ `loopx status` 仍然是 CLI/runtime 诊断命令,不作为单独 Codex skill 暴露。`loopx render` 会基于现有运行时产物生成给人阅读的 HTML 视图;不传 slug 时会渲染所有非 legacy workflow 和工作区首页。Markdown 和 JSON 仍然是机器可读、可编辑的事实源。
180
+
181
+ ## Skill 路由与治理
182
+
183
+ bundled skill resolver 位于:
184
+
185
+ ```text
186
+ skills/RESOLVER.md
187
+ ```
188
+
189
+ 它是 11 个 bundled skills 的可读路由表。修改任一 `skills/<name>/SKILL.md` 或镜像的 `plugins/loopx/skills/<name>/SKILL.md` 时,都要保持 resolver 同步。
190
+
191
+ skill 治理由下面的确定性脚本执行:
192
+
193
+ ```bash
194
+ node scripts/verify-skills.mjs
195
+ ```
196
+
197
+ 该脚本会检查 bundled skill frontmatter 是否可触发且有排除边界、`metadata.version` 是否匹配 `package.json`、plugin skill 镜像是否与 canonical skills 一致、`skills/RESOLVER.md` 是否覆盖所有 bundled skills 且没有陈旧 bundled-skill 引用、本地 skill 引用是否存在、plugin manifest 版本是否匹配 package 版本,以及 verifier 本身是否进入 npm 发布包。
154
198
 
155
199
  ## Skill 说明
156
200
 
@@ -175,12 +219,15 @@ CLI 主要用于运行时、调试、状态观察和维护。日常面向 Codex
175
219
  - `.loopx/changes/active/<change-id>/spec-delta.md`
176
220
  - `.loopx/changes/active/<change-id>/design.md`
177
221
  - `.loopx/changes/active/<change-id>/tasks.md`
222
+ - `.loopx/changes/active/<change-id>/slices.json`
178
223
  - `.loopx/changes/active/<change-id>/artifact-graph.json`
179
224
  - `.loopx/workflows/<slug>/plan.md`
180
225
  - `.loopx/workflows/<slug>/architecture.md`
181
226
  - `.loopx/workflows/<slug>/development-plan.md`
182
227
  - `.loopx/workflows/<slug>/test-plan.md`
183
228
 
229
+ `spec-delta.md` 使用 requirement delta:`## ADDED Requirements`、`## MODIFIED Requirements`、`## REMOVED Requirements` 和 `## RENAMED Requirements`。ADDED / MODIFIED 必须是完整的 `### Requirement:` 块,包含 SHALL/MUST 约束和 `#### Scenario:` 场景,archive 才能把它们合并进长期 spec 当前状态。
230
+
184
231
  ### build
185
232
 
186
233
  `build` 执行已批准的计划,并把执行过程、验证证据和限制记录到 canonical artifact:
@@ -214,7 +261,7 @@ $build --from-review .loopx/workflows/<slug>/review-report.md
214
261
 
215
262
  ### review
216
263
 
217
- `review` 消费 build 输出的 `execution-record.md`,执行独立验收和代码评审,并生成:
264
+ `review` 消费 build 输出的 `execution-record.md`,执行独立验收、代码评审和轻量 architecture-smell lane,并生成:
218
265
 
219
266
  ```text
220
267
  .loopx/workflows/<slug>/review-report.md
@@ -224,6 +271,8 @@ $build --from-review .loopx/workflows/<slug>/review-report.md
224
271
 
225
272
  如果评审通过,仍然需要显式批准 `review -> done`。如果评审要求修实现问题,则运行 `$build --from-review .loopx/workflows/<slug>/review-report.md`。只有当 review 明确指出计划或需求本身错误时,才回到 `$plan <slug>` 或 `$clarify <slug>`。
226
273
 
274
+ architecture-smell lane 是 review 的一部分,不会增加新阶段。它会把发现记录到 `review-support/architecture-smell.json`,只有当模块边界、可测试性、领域词汇或计划架构假设存在实质性错误时才阻断。
275
+
227
276
  ### archive
228
277
 
229
278
  `archive` 消费已完成工作流,并把 `.loopx/changes/active/<change-id>/spec-delta.md` 合并进 `.loopx/specs/` 下的长期领域规格。归档后的 change 目录会移动到:
@@ -232,6 +281,10 @@ $build --from-review .loopx/workflows/<slug>/review-report.md
232
281
  .loopx/changes/archive/<change-id>/
233
282
  ```
234
283
 
284
+ Archive 还会在 `.loopx/decisions/adr-candidates/<change-id>.md` 写入建议性 ADR candidate,不会自动提升到 `docs/adr/`。
285
+
286
+ Archive 现在按语义应用 requirement delta,而不是追加每次 change 的历史块。ADDED 新增 requirement,MODIFIED 替换完整 requirement 块,REMOVED 删除 requirement,RENAMED 只修改 requirement 标题并保留正文。
287
+
235
288
  ### autopilot
236
289
 
237
290
  `autopilot` 是端到端编排入口,会在内部组织 expansion、planning、execution、qa、validation 等阶段,但 canonical artifact 仍然来自公开的 `clarify -> plan -> build -> review` 流程。
@@ -270,6 +323,10 @@ loopx 在当前项目下写入 `.loopx/`:
270
323
  .loopx/
271
324
  README.md
272
325
  config.json
326
+ intake/
327
+ clarify-<slug>-<timestamp>.md
328
+ views/
329
+ index.html
273
330
  specs/
274
331
  <domain>/
275
332
  spec.md
@@ -280,11 +337,19 @@ loopx 在当前项目下写入 `.loopx/`:
280
337
  spec-delta.md
281
338
  design.md
282
339
  tasks.md
340
+ slices.json
283
341
  artifact-graph.json
284
342
  archive/
285
343
  <change-id>/
344
+ decisions/
345
+ adr-candidates/
286
346
  plans/
347
+ agents/
348
+ issue-tracker.md
349
+ domain.md
350
+ triage-labels.md
287
351
  context/
352
+ domain.md
288
353
  workflows/
289
354
  <slug>/
290
355
  state.json
@@ -295,14 +360,52 @@ loopx 在当前项目下写入 `.loopx/`:
295
360
  test-plan.md
296
361
  execution-record.md
297
362
  review-report.md
363
+ view/
364
+ index.html
365
+ intake.html
366
+ plan.html
367
+ build.html
368
+ review.html
298
369
  plan-reviews/
299
370
  build-support/
371
+ review-support/
300
372
  autopilot/
301
373
  <slug>/
302
374
  run.json
303
375
  ```
304
376
 
305
- 旧的 `.codex-helper/` 可通过 `loopx migrate` 迁移。`.omx/` 仍保留为外部编排/规划元数据,不属于 loopx 运行时命名空间。
377
+ `config.json` 记录 loopx 产品契约和 init 时的项目发现结果:已有 AI 规则文件,例如 `AGENTS.md`、`CLAUDE.md`、Cursor / Copilot 规则;已有 spec 来源,例如 `docs/changes`、ADR/RFC 目录;以及自动发现的 install/test/lint/typecheck/build/E2E 命令。这不会引入轻量版 loopx;它只是让 `plan`、`build`、`review` 能看到项目事实,同时保持完整闭环。
378
+
379
+ `intake` 保存一次需求的 clarify 快照;`workflows` 保存当前任务的运行时工作副本;`changes` 保存本次需求对长期行为的 change delta;`specs` 只保存 archive 后的长期领域行为契约。
380
+
381
+ `views/` 和 `workflows/<slug>/view/` 是 `loopx render` 生成的派生 HTML 阅读视图,只服务于人的浏览和评审,可以随时重新生成;agent 和工具仍应读取、修改 Markdown 与 JSON 产物。
382
+
383
+ ### 文档关注边界
384
+
385
+ 用户日常需要关注的文档:
386
+
387
+ - `README.md` / `README.zh-CN.md`:产品用法、命令和目录约定。
388
+ - `.loopx/workflows/<slug>/spec.md`:当前需求工作副本。
389
+ - `.loopx/workflows/<slug>/plan.md`、`architecture.md`、`development-plan.md`、`test-plan.md`:当前任务的计划、架构和验证约定。
390
+ - `.loopx/workflows/<slug>/execution-record.md`、`review-report.md`:执行证据和评审结论。
391
+ - `.loopx/views/index.html` 与 `.loopx/workflows/<slug>/view/index.html`:由 `loopx render` 生成的阅读入口。
392
+
393
+ 用户可以阅读和按流程修改的事实源文档:
394
+
395
+ - `.loopx/workflows/<slug>/*.md`:当前 workflow 的可编辑工作副本;修改后仍需通过对应阶段门禁。
396
+ - `.loopx/config.json`:workspace 配置、项目规则/spec 来源发现结果和默认验证命令;当仓库的 canonical 命令或规则文件变化时可以更新。
397
+ - `.loopx/context/domain.md` 和 `.loopx/agents/*.md`:项目级背景、术语和 agent 协作约定。
398
+ - `.loopx/changes/active/<change-id>/*.md`:plan 生成的 change proposal、design、tasks 和 spec delta;修改后应重新过 plan/build/review。
399
+ - `.loopx/specs/<domain>/spec.md`:archive 后的长期行为规格;通常由 `archive` 同步,人工改动需要保持和后续 change delta 一致。
400
+
401
+ 工具运行依赖或派生的文档/数据:
402
+
403
+ - `.loopx/workflows/<slug>/state.json`、`build-context.jsonl`、`review-context.jsonl`:运行时状态和 context manifest,工具依赖,不建议手改。
404
+ - `.loopx/workflows/<slug>/plan-reviews/`、`build-support/`、`review-support/`:阶段证据和内部审查结果,供诊断和 review 使用。
405
+ - `.loopx/intake/clarify-*.md`:clarify 快照,用于审计和追溯;不要当作长期 specs 修改。
406
+ - `.loopx/changes/active/<change-id>/slices.json`、`artifact-graph.json`:计划结构化数据,build/review/archive 会消费。
407
+ - `.loopx/autopilot/<slug>/run.json`、`.loopx/build-active.json`:编排和 stop-hook 运行态。
408
+ - `.loopx/views/` 和 `.loopx/workflows/<slug>/view/`:HTML 派生视图,可删除后用 `loopx render` 重新生成,不应作为事实源编辑。
306
409
 
307
410
  ## 安装诊断与修复
308
411
 
@@ -324,6 +427,24 @@ loopx repair-install
324
427
  node scripts/install-skills.mjs --check
325
428
  ```
326
429
 
430
+ 检查 bundled skill 治理状态:
431
+
432
+ ```bash
433
+ node scripts/verify-skills.mjs
434
+ ```
435
+
436
+ ## Codex Workflow Hook
437
+
438
+ `install-skills.mjs` 和 Codex plugin 安装脚本会自动把 `scripts/codex-workflow-hook.mjs` 安装到:
439
+
440
+ ```text
441
+ ~/.codex/hooks/codex-workflow-hook.mjs
442
+ ```
443
+
444
+ 该 hook 会读取最近的 `.loopx/workflows/<slug>/state.json`,为当前 workflow 输出建议性上下文:当前阶段、blockers、readiness、authorization、evidence 和安全下一步。它只提供提示;真正的运行时门禁仍以 loopx runtime 为准。
445
+
446
+ 设置 `LOOPX_HOOKS=0` 可以关闭 workflow hook 输出。
447
+
327
448
  ## Codex Stop Hook
328
449
 
329
450
  loopx 内置一个 Codex stop-hook 辅助脚本,用于防止活跃 build 在达到 review handoff 之前提前停止:
@@ -353,6 +474,7 @@ node scripts/codex-stop-hook.mjs
353
474
  - `LOOPX_DISTRIBUTION_CHANNEL`:设置安装渠道,默认 `npm`。
354
475
  - `LOOPX_INSTALLATION_IDENTITY`:设置安装身份,默认 `loopx`。
355
476
  - `LOOPX_SOURCE_URL`:设置安装来源。
477
+ - `LOOPX_HOOKS`:设置为 `0` 时关闭 workflow hook 输出。
356
478
 
357
479
  ## 开发
358
480
 
@@ -362,9 +484,17 @@ node scripts/codex-stop-hook.mjs
362
484
  npm test
363
485
  ```
364
486
 
487
+ `npm test` 会先运行 bundled skill 治理检查,再运行 Node 测试套件:
488
+
489
+ ```bash
490
+ node scripts/verify-skills.mjs
491
+ node --test test/*.test.mjs
492
+ ```
493
+
365
494
  也可以直接执行项目内的验证命令:
366
495
 
367
496
  ```bash
497
+ node scripts/verify-skills.mjs
368
498
  node --test test/*.test.mjs
369
499
  node scripts/install-skills.mjs --check
370
500
  node --test plugins/loopx/scripts/plugin-install.test.mjs
@@ -381,7 +511,10 @@ node src/cli.mjs status --json
381
511
  - `README.zh-CN.md`
382
512
  - `package.json`
383
513
  - `scripts/install-skills.mjs`
514
+ - `scripts/verify-skills.mjs`
384
515
  - `scripts/codex-stop-hook.mjs`
516
+ - `scripts/codex-workflow-hook.mjs`
517
+ - `assets/logo.svg`
385
518
  - `src/`
386
519
  - `skills/`,包含公开 loopx skills 以及随包发布的兼容/内部 skill 源文件
387
520
  - `templates/`
@@ -389,4 +522,4 @@ node src/cli.mjs status --json
389
522
 
390
523
  ## 版本
391
524
 
392
- 当前 npm 包版本:`0.1.2`。
525
+ 当前 npm 包版本:`0.1.4`。
@@ -0,0 +1,89 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" role="img" aria-labelledby="title desc">
2
+ <title id="title">loopx fox logo</title>
3
+ <desc id="desc">A cute black and white fox mascot in left-facing profile with a curled tail.</desc>
4
+ <g transform="translate(0.000000,256.000000) scale(0.025000,-0.025000)"
5
+ fill="#000000" stroke="none">
6
+ <path d="M5828 9086 c-59 -21 -132 -81 -223 -184 -395 -444 -774 -1140 -908
7
+ -1667 -18 -71 -37 -131 -42 -133 -6 -1 -57 9 -115 22 -103 25 -262 46 -337 46
8
+ l-38 0 76 -74 77 -73 -109 -7 c-119 -7 -305 -36 -384 -60 -27 -8 -50 -14 -52
9
+ -12 -5 5 136 62 212 85 39 12 98 25 133 28 34 3 65 9 67 14 3 4 -28 36 -69 72
10
+ l-74 65 45 6 c117 16 292 5 493 -30 l35 -6 12 54 c7 29 27 97 44 150 l32 97
11
+ -58 73 c-262 326 -572 612 -891 822 -279 182 -403 179 -451 -12 -21 -81 -28
12
+ -399 -14 -563 27 -304 117 -651 222 -861 16 -32 29 -61 29 -65 0 -4 -18 -21
13
+ -40 -36 -22 -16 -40 -31 -40 -35 0 -4 48 -6 107 -5 105 3 107 2 83 -15 -230
14
+ -161 -385 -319 -497 -507 -119 -200 -152 -337 -163 -670 -6 -224 -9 -245 -34
15
+ -320 -54 -161 -155 -291 -319 -413 -168 -125 -284 -186 -394 -207 -92 -18
16
+ -179 -59 -208 -98 -33 -46 -27 -137 14 -214 61 -115 199 -252 270 -270 14 -3
17
+ 46 -25 71 -47 56 -52 126 -100 187 -130 27 -12 68 -42 93 -65 56 -53 197 -122
18
+ 310 -153 74 -20 108 -23 260 -22 158 0 195 4 380 38 326 59 478 59 564 -2 109
19
+ -76 104 -238 -11 -381 -54 -67 -92 -102 -248 -227 -77 -61 -158 -131 -181
20
+ -155 -50 -55 -128 -169 -120 -176 3 -3 33 0 67 6 34 7 100 16 148 19 l87 7
21
+ -69 -79 c-88 -103 -142 -196 -186 -321 -33 -94 -35 -108 -35 -230 -1 -165 23
22
+ -267 99 -420 138 -279 371 -495 708 -655 244 -116 483 -177 722 -186 116 -4
23
+ 137 -2 121 8 -10 7 -57 39 -105 70 -47 31 -102 70 -121 86 l-35 30 160 -6
24
+ c605 -19 1215 178 1665 538 89 72 227 206 219 214 -2 3 -33 -1 -69 -9 -194
25
+ -40 -295 -50 -530 -49 -195 0 -255 4 -350 22 -398 73 -641 226 -704 441 -56
26
+ 190 20 400 217 608 68 71 246 223 262 223 4 0 5 -19 2 -43 -7 -50 3 -187 13
27
+ -187 4 0 44 62 90 138 100 164 159 246 282 387 168 193 181 209 224 276 87
28
+ 133 132 269 141 424 5 93 -2 160 -33 295 -4 20 0 16 21 -15 45 -69 83 -149
29
+ 111 -236 32 -99 35 -96 65 79 24 141 25 341 3 467 -45 261 -171 492 -384 705
30
+ -63 64 -136 131 -162 150 -27 18 -46 35 -44 38 7 7 154 -75 223 -124 153 -109
31
+ 270 -248 354 -418 68 -141 100 -273 108 -451 l6 -140 105 -6 c112 -7 162 -17
32
+ 250 -47 263 -91 456 -295 506 -532 23 -107 14 -345 -15 -454 -82 -297 -270
33
+ -573 -551 -808 -336 -282 -844 -513 -1274 -580 -42 -6 -76 -15 -76 -19 0 -19
34
+ 211 -74 362 -94 932 -123 1887 474 2182 1365 68 206 80 288 80 545 0 212 -2
35
+ 240 -26 356 -99 459 -337 832 -722 1131 -49 38 -170 123 -270 190 -255 172
36
+ -308 211 -271 203 55 -12 129 -36 208 -67 43 -17 80 -28 84 -25 9 10 -63 153
37
+ -118 232 -67 98 -185 209 -288 272 -45 28 -78 53 -74 56 17 11 141 29 238 35
38
+ l100 7 -50 37 c-86 64 -204 130 -340 190 -71 32 -135 58 -141 58 -6 0 -24 -28
39
+ -40 -62 -35 -77 -128 -217 -184 -278 l-40 -45 34 60 c80 141 141 319 183 530
40
+ 25 127 25 501 0 670 -69 465 -238 944 -470 1330 -187 313 -349 454 -469 411z
41
+ m91 -422 c80 -67 234 -356 310 -579 86 -256 129 -488 138 -751 14 -420 -80
42
+ -781 -283 -1087 -64 -96 -66 -100 -56 -136 31 -102 111 -189 316 -343 194
43
+ -146 191 -143 141 -122 -104 43 -606 309 -644 341 -16 12 16 7 92 -17 48 -15
44
+ 87 -24 87 -19 0 11 -119 160 -174 217 -61 65 -169 151 -275 221 -51 33 -90 61
45
+ -87 61 12 0 151 -39 195 -55 24 -8 46 -14 48 -12 2 2 -29 34 -68 72 -130 122
46
+ -334 240 -521 302 -100 32 -98 29 -98 169 0 392 184 908 486 1364 132 200 306
47
+ 400 347 400 9 0 29 -12 46 -26z m-2425 -576 c108 -185 314 -628 291 -628 -2 0
48
+ -32 18 -66 40 -34 22 -64 38 -66 36 -8 -7 62 -149 120 -244 31 -51 57 -95 57
49
+ -97 0 -1 -33 8 -72 20 -40 13 -75 22 -77 19 -6 -6 62 -107 103 -152 21 -23 37
50
+ -44 35 -45 -2 -2 -24 -12 -48 -22 -24 -11 -80 -43 -124 -72 -44 -29 -81 -52
51
+ -81 -50 -58 154 -111 370 -142 577 -34 238 -27 710 11 710 3 0 29 -42 59 -92z
52
+ m528 -2172 c132 -40 244 -122 317 -231 56 -84 92 -176 71 -183 -55 -19 -175
53
+ -90 -222 -131 l-56 -51 -7 39 c-11 64 -61 158 -110 205 -59 58 -122 87 -199
54
+ 93 -133 11 -234 -55 -300 -196 -44 -94 -70 -221 -61 -301 7 -66 32 -157 49
55
+ -185 13 -19 11 -20 -71 -20 l-84 0 6 110 c30 540 154 794 420 862 59 15 178 9
56
+ 247 -11z m-134 -377 c36 -18 74 -46 93 -70 68 -86 90 -219 48 -289 -32 -52
57
+ -88 -118 -120 -140 l-27 -20 25 72 c22 63 25 85 21 173 -3 73 -10 112 -25 146
58
+ -26 57 -88 128 -128 145 l-30 13 41 1 c26 0 63 -11 102 -31z m-224 -78 c49
59
+ -54 15 -163 -53 -169 -49 -5 -71 20 -71 79 0 86 77 142 124 90z m1291 -361
60
+ c50 -6 126 -17 170 -26 86 -17 272 -77 287 -92 6 -6 -23 -10 -74 -11 -119 -2
61
+ -338 -42 -338 -61 0 -4 33 -10 74 -13 207 -18 461 -103 611 -207 78 -54 169
62
+ -146 221 -222 44 -67 113 -215 114 -246 0 -7 -29 3 -77 27 -99 49 -193 78
63
+ -313 96 -99 15 -212 20 -223 9 -4 -4 19 -22 51 -41 69 -41 171 -140 214 -206
64
+ 31 -49 78 -165 78 -193 0 -10 -26 8 -66 44 -75 69 -196 134 -294 157 -116 27
65
+ -118 24 -36 -57 46 -46 86 -97 107 -138 33 -63 34 -68 34 -185 0 -112 -2 -125
66
+ -31 -190 -79 -182 -200 -307 -558 -575 -142 -106 -304 -237 -359 -289 -209
67
+ -201 -328 -391 -399 -636 -19 -67 -23 -103 -23 -225 1 -136 3 -151 32 -239
68
+ l32 -94 -41 39 c-86 84 -159 206 -199 334 -19 62 -24 96 -23 195 0 74 6 144
69
+ 16 183 8 35 12 62 7 60 -5 -2 -29 -30 -54 -63 -46 -62 -95 -168 -95 -207 0
70
+ -16 -3 -19 -11 -11 -21 21 -14 229 10 322 49 187 179 378 356 522 36 29 63 54
71
+ 61 56 -2 2 -86 -6 -186 -17 -100 -12 -184 -20 -186 -17 -8 8 69 71 231 188
72
+ 174 127 300 248 352 339 36 63 63 148 63 197 0 32 4 36 65 64 36 16 86 32 111
73
+ 36 24 3 46 9 49 13 8 12 -138 78 -220 99 -119 31 -205 41 -350 41 -146 0 -233
74
+ -11 -550 -72 -198 -38 -234 -42 -365 -42 -159 1 -254 20 -347 68 l-48 25 86 1
75
+ c285 1 546 111 724 302 105 114 128 178 61 178 -31 0 -41 -10 -71 -69 -77
76
+ -154 -278 -283 -510 -326 -67 -13 -123 -16 -220 -12 -145 5 -230 26 -325 80
77
+ -55 31 -150 112 -150 128 0 4 13 28 30 52 39 58 86 179 95 242 4 34 2 65 -8
78
+ 92 l-14 42 46 10 c94 21 158 23 335 11 313 -21 423 8 776 205 113 63 252 135
79
+ 309 160 319 139 660 198 956 165z m-2567 -537 l57 -28 -87 -6 c-51 -4 -104
80
+ -15 -131 -27 l-45 -20 -26 27 c-24 25 -25 29 -11 41 55 46 162 51 243 13z"/>
81
+ <path d="M5937 8202 c-48 -198 -131 -379 -247 -532 -22 -30 -36 -56 -31 -58
82
+ 16 -5 144 65 189 104 22 19 42 34 45 34 2 0 -2 -35 -10 -77 -32 -169 -114
83
+ -321 -248 -462 -44 -46 -71 -81 -62 -81 28 0 152 42 210 72 67 34 66 37 22
84
+ -75 -39 -98 -86 -167 -181 -265 l-92 -95 65 6 c37 4 99 21 149 40 l85 35 -6
85
+ -32 c-6 -25 -44 -109 -113 -249 -7 -14 65 20 113 53 147 101 249 270 306 507
86
+ 16 69 22 132 26 293 6 236 -6 349 -62 565 -29 115 -112 335 -125 335 -3 0 -18
87
+ -53 -33 -118z"/>
88
+ </g>
89
+ </svg>