@ai-content-space/loopx 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
 
@@ -18,14 +26,15 @@ clarify -> plan -> build -> review -> approve review->done -> archive
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`.
20
28
  - Supports npm global install and Codex plugin install through the same install/discovery core.
29
+ - Installs a managed Codex workflow hook that surfaces loopx workflow state and safe next-action hints inside Codex.
21
30
  - Stores runtime state and stage artifacts locally under `.loopx/` for auditability, recovery, and migration.
31
+ - Stores clarify intake snapshots under `.loopx/intake/` so `.loopx/specs/` stays reserved for long-lived domain specs.
22
32
  - Runs `plan` with a Planner -> Architect -> Critic consensus loop by default.
23
33
  - Writes OpenSpec-inspired change artifacts during `plan`: proposal, spec delta, design, vertical slices, tasks, and an artifact dependency graph.
24
34
  - Provides per-repo agent context under `.loopx/agents/` and `.loopx/context/domain.md`, consumed by build/review context manifests.
25
35
  - Runs `build` with execution records, verification evidence, architect validation, deslop cleanup, and regression re-verification.
26
36
  - Keeps `review` as an independent acceptance surface with code review plus an internal architecture-smell lane.
27
37
  - 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
38
 
30
39
  ## Installation
31
40
 
@@ -47,6 +56,12 @@ The script materializes loopx-owned skills under:
47
56
  ~/.agents/skills/
48
57
  ```
49
58
 
59
+ It also installs the loopx-managed Codex workflow hook at:
60
+
61
+ ```text
62
+ ~/.codex/hooks/codex-workflow-hook.mjs
63
+ ```
64
+
50
65
  and updates:
51
66
 
52
67
  ```text
@@ -108,7 +123,6 @@ Complete an approved review:
108
123
 
109
124
  ```bash
110
125
  loopx approve my-task --from review --to done
111
- loopx review my-task
112
126
  ```
113
127
 
114
128
  Archive accepted behavior into long-lived specs:
@@ -124,6 +138,12 @@ loopx status my-task
124
138
  loopx status my-task --json
125
139
  ```
126
140
 
141
+ Render derived HTML reading views:
142
+
143
+ ```bash
144
+ loopx render my-task
145
+ ```
146
+
127
147
  You can also create a planning workflow directly from an existing spec:
128
148
 
129
149
  ```bash
@@ -142,6 +162,7 @@ loopx build --from-review <review-report-path> [--no-deslop]
142
162
  loopx review <slug> [--reviewer <name>]
143
163
  loopx archive <slug>
144
164
  loopx autopilot <slug> [--reviewer <name>]
165
+ loopx render [slug|--all]
145
166
  loopx status [slug] [--json]
146
167
  loopx setup-context
147
168
  loopx doctor
@@ -151,7 +172,7 @@ loopx repair-install
151
172
 
152
173
  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
174
 
154
- `loopx status` remains a CLI/runtime diagnostic command rather than a Codex skill.
175
+ `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.
155
176
 
156
177
  ## Skills
157
178
 
@@ -183,6 +204,8 @@ Main artifacts:
183
204
  - `.loopx/workflows/<slug>/development-plan.md`
184
205
  - `.loopx/workflows/<slug>/test-plan.md`
185
206
 
207
+ `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.
208
+
186
209
  ### build
187
210
 
188
211
  `build` executes an approved plan and records changes, evidence, and limitations in the canonical artifact:
@@ -229,6 +252,8 @@ The architecture-smell lane is part of review; it does not add a new stage. It r
229
252
 
230
253
  Archive also writes an advisory ADR candidate under `.loopx/decisions/adr-candidates/<change-id>.md`. It is not promoted to `docs/adr/` automatically.
231
254
 
255
+ 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.
256
+
232
257
  ### autopilot
233
258
 
234
259
  `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 +292,10 @@ loopx writes runtime state under `.loopx/` in the current project:
267
292
  .loopx/
268
293
  README.md
269
294
  config.json
295
+ intake/
296
+ clarify-<slug>-<timestamp>.md
297
+ views/
298
+ index.html
270
299
  specs/
271
300
  <domain>/
272
301
  spec.md
@@ -300,6 +329,12 @@ loopx writes runtime state under `.loopx/` in the current project:
300
329
  test-plan.md
301
330
  execution-record.md
302
331
  review-report.md
332
+ view/
333
+ index.html
334
+ intake.html
335
+ plan.html
336
+ build.html
337
+ review.html
303
338
  plan-reviews/
304
339
  build-support/
305
340
  autopilot/
@@ -307,7 +342,35 @@ loopx writes runtime state under `.loopx/` in the current project:
307
342
  run.json
308
343
  ```
309
344
 
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.
345
+ `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.
346
+
347
+ `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.
348
+
349
+ ### Document Boundaries
350
+
351
+ Documents users normally need to watch:
352
+
353
+ - `README.md` / `README.zh-CN.md`: product usage, commands, and runtime layout.
354
+ - `.loopx/workflows/<slug>/spec.md`: the current requirement working copy.
355
+ - `.loopx/workflows/<slug>/plan.md`, `architecture.md`, `development-plan.md`, and `test-plan.md`: the current task's plan, architecture, execution, and verification contract.
356
+ - `.loopx/workflows/<slug>/execution-record.md` and `review-report.md`: execution evidence and review result.
357
+ - `.loopx/views/index.html` and `.loopx/workflows/<slug>/view/index.html`: reading entrypoints generated by `loopx render`.
358
+
359
+ Documents users may read and modify as workflow fact sources:
360
+
361
+ - `.loopx/workflows/<slug>/*.md`: editable working-copy artifacts for the active workflow; changes still need to pass the relevant stage gates.
362
+ - `.loopx/context/domain.md` and `.loopx/agents/*.md`: project context, domain vocabulary, and agent collaboration guidance.
363
+ - `.loopx/changes/active/<change-id>/*.md`: plan-generated change proposal, design, tasks, and spec delta; edits should be followed by plan/build/review validation.
364
+ - `.loopx/specs/<domain>/spec.md`: long-lived archived behavior specs; normally synced by `archive`, and manual edits should stay consistent with later change deltas.
365
+
366
+ Documents and data the tools depend on, or generate as derived evidence:
367
+
368
+ - `.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.
369
+ - `.loopx/workflows/<slug>/plan-reviews/`, `build-support/`, and `review-support/`: stage evidence and internal review outputs for diagnostics and review.
370
+ - `.loopx/intake/clarify-*.md`: immutable clarify snapshots for audit and traceability; do not treat them as long-lived specs.
371
+ - `.loopx/changes/active/<change-id>/slices.json` and `artifact-graph.json`: structured planning data consumed by build/review/archive.
372
+ - `.loopx/autopilot/<slug>/run.json` and `.loopx/build-active.json`: orchestration and stop-hook runtime state.
373
+ - `.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
374
 
312
375
  ## Diagnostics and Repair
313
376
 
@@ -329,6 +392,18 @@ Check skill discovery state only:
329
392
  node scripts/install-skills.mjs --check
330
393
  ```
331
394
 
395
+ ## Codex Workflow Hook
396
+
397
+ `install-skills.mjs` and the Codex plugin installer automatically install `scripts/codex-workflow-hook.mjs` to:
398
+
399
+ ```text
400
+ ~/.codex/hooks/codex-workflow-hook.mjs
401
+ ```
402
+
403
+ 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.
404
+
405
+ Set `LOOPX_HOOKS=0` to disable the workflow hook output.
406
+
332
407
  ## Codex Stop Hook
333
408
 
334
409
  loopx includes a Codex stop-hook helper that prevents an active build from stopping before review handoff readiness:
@@ -358,6 +433,7 @@ Install and discovery logic supports these environment variables:
358
433
  - `LOOPX_DISTRIBUTION_CHANNEL`: set the install channel, default `npm`.
359
434
  - `LOOPX_INSTALLATION_IDENTITY`: set the install identity, default `loopx`.
360
435
  - `LOOPX_SOURCE_URL`: set the install source.
436
+ - `LOOPX_HOOKS`: set to `0` to disable workflow hook output.
361
437
 
362
438
  ## Development
363
439
 
@@ -387,6 +463,8 @@ node src/cli.mjs status --json
387
463
  - `package.json`
388
464
  - `scripts/install-skills.mjs`
389
465
  - `scripts/codex-stop-hook.mjs`
466
+ - `scripts/codex-workflow-hook.mjs`
467
+ - `assets/logo.svg`
390
468
  - `src/`
391
469
  - `skills/`, including public loopx skills plus compatibility/internal skill sources shipped with the package
392
470
  - `templates/`
@@ -394,4 +472,4 @@ node src/cli.mjs status --json
394
472
 
395
473
  ## Version
396
474
 
397
- Current npm package version: `0.1.2`.
475
+ 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` 是端到端编排入口,会在内部复用这套公开阶段,而不是引入另一套流程真相。
@@ -18,13 +28,15 @@ clarify -> plan -> build -> review
18
28
 
19
29
  - 安装并公开 11 个 loopx Codex skills:工作流 skills `clarify`、`plan`、`build`、`review`、`archive`、`autopilot`,质量辅助 skills `debug`、`tdd`、`verify`,以及 Go 支持 skills `go-style`、`kratos`。
20
30
  - 支持 npm 全局安装和 Codex plugin 安装,两种安装方式共享同一套 install/discovery 逻辑。
31
+ - 自动安装 loopx 管理的 Codex workflow hook,在 Codex 中提示当前 workflow 状态和安全下一步。
21
32
  - 所有运行时状态和阶段产物都写入项目本地 `.loopx/`,便于审计、恢复和迁移。
33
+ - clarify 需求快照写入 `.loopx/intake/`,让 `.loopx/specs/` 只承载长期领域规格。
22
34
  - `plan` 默认采用 Planner -> Architect -> Critic 的共识规划循环。
23
35
  - `plan` 会写入借鉴 OpenSpec 的 change artifacts:proposal、spec delta、design、tasks 和 artifact dependency graph。
36
+ - 提供项目级 agent context:`.loopx/agents/` 和 `.loopx/context/domain.md`,供 build/review 的 context manifest 消费。
24
37
  - `build` 默认包含执行记录、验证证据、架构验收、deslop 清理和回归再验证。
25
- - `review` 作为独立验收面,输出中文评审结论和 go/no-go 判断。
26
- - 支持 `archive`,把已批准的 change delta 同步进长期 `.loopx/specs/` source of truth。
27
- - 支持从旧 `.codex-helper/` 运行时迁移到 `.loopx/`。
38
+ - `review` 作为独立验收面,包含代码审查和内部 architecture-smell lane,并输出中文评审结论和 go/no-go 判断。
39
+ - 支持 `archive`,把已批准的 change delta 同步进长期 `.loopx/specs/` source of truth,并生成 ADR candidate
28
40
 
29
41
  ## 安装
30
42
 
@@ -46,6 +58,12 @@ node scripts/install-skills.mjs
46
58
  ~/.agents/skills/
47
59
  ```
48
60
 
61
+ 同时也会把 loopx 管理的 Codex workflow hook 安装到:
62
+
63
+ ```text
64
+ ~/.codex/hooks/codex-workflow-hook.mjs
65
+ ```
66
+
49
67
  并更新:
50
68
 
51
69
  ```text
@@ -107,7 +125,6 @@ loopx review my-task
107
125
 
108
126
  ```bash
109
127
  loopx approve my-task --from review --to done
110
- loopx review my-task
111
128
  ```
112
129
 
113
130
  把已接受行为归档到长期 specs:
@@ -123,6 +140,12 @@ loopx status my-task
123
140
  loopx status my-task --json
124
141
  ```
125
142
 
143
+ 生成派生 HTML 阅读视图:
144
+
145
+ ```bash
146
+ loopx render my-task
147
+ ```
148
+
126
149
  也可以让 loopx 根据一个现成 spec 直接创建规划工作流:
127
150
 
128
151
  ```bash
@@ -141,6 +164,7 @@ loopx build --from-review <review-report-path> [--no-deslop]
141
164
  loopx review <slug> [--reviewer <name>]
142
165
  loopx archive <slug>
143
166
  loopx autopilot <slug> [--reviewer <name>]
167
+ loopx render [slug|--all]
144
168
  loopx status [slug] [--json]
145
169
  loopx setup-context
146
170
  loopx doctor
@@ -150,7 +174,7 @@ loopx repair-install
150
174
 
151
175
  CLI 主要用于运行时、调试、状态观察和维护。日常面向 Codex 的主入口是同名 skills,例如 `$clarify`、`$plan`、`$build`、`$review`、`$archive`、`$autopilot`、`$debug`、`$tdd`、`$verify`、`$go-style`、`$kratos`。
152
176
 
153
- `loopx status` 仍然是 CLI/runtime 诊断命令,不作为单独 Codex skill 暴露。
177
+ `loopx status` 仍然是 CLI/runtime 诊断命令,不作为单独 Codex skill 暴露。`loopx render` 会基于现有运行时产物生成给人阅读的 HTML 视图;不传 slug 时会渲染所有非 legacy workflow 和工作区首页。Markdown 和 JSON 仍然是机器可读、可编辑的事实源。
154
178
 
155
179
  ## Skill 说明
156
180
 
@@ -181,6 +205,8 @@ CLI 主要用于运行时、调试、状态观察和维护。日常面向 Codex
181
205
  - `.loopx/workflows/<slug>/development-plan.md`
182
206
  - `.loopx/workflows/<slug>/test-plan.md`
183
207
 
208
+ `spec-delta.md` 使用 requirement delta:`## ADDED Requirements`、`## MODIFIED Requirements`、`## REMOVED Requirements` 和 `## RENAMED Requirements`。ADDED / MODIFIED 必须是完整的 `### Requirement:` 块,包含 SHALL/MUST 约束和 `#### Scenario:` 场景,archive 才能把它们合并进长期 spec 当前状态。
209
+
184
210
  ### build
185
211
 
186
212
  `build` 执行已批准的计划,并把执行过程、验证证据和限制记录到 canonical artifact:
@@ -214,7 +240,7 @@ $build --from-review .loopx/workflows/<slug>/review-report.md
214
240
 
215
241
  ### review
216
242
 
217
- `review` 消费 build 输出的 `execution-record.md`,执行独立验收和代码评审,并生成:
243
+ `review` 消费 build 输出的 `execution-record.md`,执行独立验收、代码评审和轻量 architecture-smell lane,并生成:
218
244
 
219
245
  ```text
220
246
  .loopx/workflows/<slug>/review-report.md
@@ -224,6 +250,8 @@ $build --from-review .loopx/workflows/<slug>/review-report.md
224
250
 
225
251
  如果评审通过,仍然需要显式批准 `review -> done`。如果评审要求修实现问题,则运行 `$build --from-review .loopx/workflows/<slug>/review-report.md`。只有当 review 明确指出计划或需求本身错误时,才回到 `$plan <slug>` 或 `$clarify <slug>`。
226
252
 
253
+ architecture-smell lane 是 review 的一部分,不会增加新阶段。它会把发现记录到 `review-support/architecture-smell.json`,只有当模块边界、可测试性、领域词汇或计划架构假设存在实质性错误时才阻断。
254
+
227
255
  ### archive
228
256
 
229
257
  `archive` 消费已完成工作流,并把 `.loopx/changes/active/<change-id>/spec-delta.md` 合并进 `.loopx/specs/` 下的长期领域规格。归档后的 change 目录会移动到:
@@ -232,6 +260,10 @@ $build --from-review .loopx/workflows/<slug>/review-report.md
232
260
  .loopx/changes/archive/<change-id>/
233
261
  ```
234
262
 
263
+ Archive 还会在 `.loopx/decisions/adr-candidates/<change-id>.md` 写入建议性 ADR candidate,不会自动提升到 `docs/adr/`。
264
+
265
+ Archive 现在按语义应用 requirement delta,而不是追加每次 change 的历史块。ADDED 新增 requirement,MODIFIED 替换完整 requirement 块,REMOVED 删除 requirement,RENAMED 只修改 requirement 标题并保留正文。
266
+
235
267
  ### autopilot
236
268
 
237
269
  `autopilot` 是端到端编排入口,会在内部组织 expansion、planning、execution、qa、validation 等阶段,但 canonical artifact 仍然来自公开的 `clarify -> plan -> build -> review` 流程。
@@ -270,6 +302,10 @@ loopx 在当前项目下写入 `.loopx/`:
270
302
  .loopx/
271
303
  README.md
272
304
  config.json
305
+ intake/
306
+ clarify-<slug>-<timestamp>.md
307
+ views/
308
+ index.html
273
309
  specs/
274
310
  <domain>/
275
311
  spec.md
@@ -280,11 +316,19 @@ loopx 在当前项目下写入 `.loopx/`:
280
316
  spec-delta.md
281
317
  design.md
282
318
  tasks.md
319
+ slices.json
283
320
  artifact-graph.json
284
321
  archive/
285
322
  <change-id>/
323
+ decisions/
324
+ adr-candidates/
286
325
  plans/
326
+ agents/
327
+ issue-tracker.md
328
+ domain.md
329
+ triage-labels.md
287
330
  context/
331
+ domain.md
288
332
  workflows/
289
333
  <slug>/
290
334
  state.json
@@ -295,6 +339,12 @@ loopx 在当前项目下写入 `.loopx/`:
295
339
  test-plan.md
296
340
  execution-record.md
297
341
  review-report.md
342
+ view/
343
+ index.html
344
+ intake.html
345
+ plan.html
346
+ build.html
347
+ review.html
298
348
  plan-reviews/
299
349
  build-support/
300
350
  autopilot/
@@ -302,7 +352,35 @@ loopx 在当前项目下写入 `.loopx/`:
302
352
  run.json
303
353
  ```
304
354
 
305
- 旧的 `.codex-helper/` 可通过 `loopx migrate` 迁移。`.omx/` 仍保留为外部编排/规划元数据,不属于 loopx 运行时命名空间。
355
+ `intake` 保存一次需求的 clarify 快照;`workflows` 保存当前任务的运行时工作副本;`changes` 保存本次需求对长期行为的 change delta;`specs` 只保存 archive 后的长期领域行为契约。
356
+
357
+ `views/` 和 `workflows/<slug>/view/` 是 `loopx render` 生成的派生 HTML 阅读视图,只服务于人的浏览和评审,可以随时重新生成;agent 和工具仍应读取、修改 Markdown 与 JSON 产物。
358
+
359
+ ### 文档关注边界
360
+
361
+ 用户日常需要关注的文档:
362
+
363
+ - `README.md` / `README.zh-CN.md`:产品用法、命令和目录约定。
364
+ - `.loopx/workflows/<slug>/spec.md`:当前需求工作副本。
365
+ - `.loopx/workflows/<slug>/plan.md`、`architecture.md`、`development-plan.md`、`test-plan.md`:当前任务的计划、架构和验证约定。
366
+ - `.loopx/workflows/<slug>/execution-record.md`、`review-report.md`:执行证据和评审结论。
367
+ - `.loopx/views/index.html` 与 `.loopx/workflows/<slug>/view/index.html`:由 `loopx render` 生成的阅读入口。
368
+
369
+ 用户可以阅读和按流程修改的事实源文档:
370
+
371
+ - `.loopx/workflows/<slug>/*.md`:当前 workflow 的可编辑工作副本;修改后仍需通过对应阶段门禁。
372
+ - `.loopx/context/domain.md` 和 `.loopx/agents/*.md`:项目级背景、术语和 agent 协作约定。
373
+ - `.loopx/changes/active/<change-id>/*.md`:plan 生成的 change proposal、design、tasks 和 spec delta;修改后应重新过 plan/build/review。
374
+ - `.loopx/specs/<domain>/spec.md`:archive 后的长期行为规格;通常由 `archive` 同步,人工改动需要保持和后续 change delta 一致。
375
+
376
+ 工具运行依赖或派生的文档/数据:
377
+
378
+ - `.loopx/workflows/<slug>/state.json`、`build-context.jsonl`、`review-context.jsonl`:运行时状态和 context manifest,工具依赖,不建议手改。
379
+ - `.loopx/workflows/<slug>/plan-reviews/`、`build-support/`、`review-support/`:阶段证据和内部审查结果,供诊断和 review 使用。
380
+ - `.loopx/intake/clarify-*.md`:clarify 快照,用于审计和追溯;不要当作长期 specs 修改。
381
+ - `.loopx/changes/active/<change-id>/slices.json`、`artifact-graph.json`:计划结构化数据,build/review/archive 会消费。
382
+ - `.loopx/autopilot/<slug>/run.json`、`.loopx/build-active.json`:编排和 stop-hook 运行态。
383
+ - `.loopx/views/` 和 `.loopx/workflows/<slug>/view/`:HTML 派生视图,可删除后用 `loopx render` 重新生成,不应作为事实源编辑。
306
384
 
307
385
  ## 安装诊断与修复
308
386
 
@@ -324,6 +402,18 @@ loopx repair-install
324
402
  node scripts/install-skills.mjs --check
325
403
  ```
326
404
 
405
+ ## Codex Workflow Hook
406
+
407
+ `install-skills.mjs` 和 Codex plugin 安装脚本会自动把 `scripts/codex-workflow-hook.mjs` 安装到:
408
+
409
+ ```text
410
+ ~/.codex/hooks/codex-workflow-hook.mjs
411
+ ```
412
+
413
+ 该 hook 会读取最近的 `.loopx/workflows/<slug>/state.json`,为当前 workflow 输出建议性上下文:当前阶段、blockers、readiness、authorization、evidence 和安全下一步。它只提供提示;真正的运行时门禁仍以 loopx runtime 为准。
414
+
415
+ 设置 `LOOPX_HOOKS=0` 可以关闭 workflow hook 输出。
416
+
327
417
  ## Codex Stop Hook
328
418
 
329
419
  loopx 内置一个 Codex stop-hook 辅助脚本,用于防止活跃 build 在达到 review handoff 之前提前停止:
@@ -353,6 +443,7 @@ node scripts/codex-stop-hook.mjs
353
443
  - `LOOPX_DISTRIBUTION_CHANNEL`:设置安装渠道,默认 `npm`。
354
444
  - `LOOPX_INSTALLATION_IDENTITY`:设置安装身份,默认 `loopx`。
355
445
  - `LOOPX_SOURCE_URL`:设置安装来源。
446
+ - `LOOPX_HOOKS`:设置为 `0` 时关闭 workflow hook 输出。
356
447
 
357
448
  ## 开发
358
449
 
@@ -382,6 +473,8 @@ node src/cli.mjs status --json
382
473
  - `package.json`
383
474
  - `scripts/install-skills.mjs`
384
475
  - `scripts/codex-stop-hook.mjs`
476
+ - `scripts/codex-workflow-hook.mjs`
477
+ - `assets/logo.svg`
385
478
  - `src/`
386
479
  - `skills/`,包含公开 loopx skills 以及随包发布的兼容/内部 skill 源文件
387
480
  - `templates/`
@@ -389,4 +482,4 @@ node src/cli.mjs status --json
389
482
 
390
483
  ## 版本
391
484
 
392
- 当前 npm 包版本:`0.1.2`。
485
+ 当前 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>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-content-space/loopx",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "description": "Skill-first loopx workflow product for Codex",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,6 +24,7 @@
24
24
  "scripts/install-skills.mjs",
25
25
  "scripts/codex-stop-hook.mjs",
26
26
  "scripts/codex-workflow-hook.mjs",
27
+ "assets/logo.svg",
27
28
  "src/",
28
29
  "skills/",
29
30
  "templates/",
@@ -83,6 +83,19 @@ describe('loopx plugin shell', () => {
83
83
  assert.equal(ralplanSkill.includes('$plan --consensus'), false);
84
84
  });
85
85
 
86
+ it('locks clarify handoff to plan instead of direct implementation', async () => {
87
+ const clarifySkill = await readFile(join(ROOT_SKILLS_DIR, 'clarify', 'SKILL.md'), 'utf8');
88
+ const pluginClarifySkill = await readFile(join(PLUGIN_SKILLS_DIR, 'clarify', 'SKILL.md'), 'utf8');
89
+
90
+ assert.equal(pluginClarifySkill, clarifySkill);
91
+ assert.match(clarifySkill, /Recommended invocation: `\$plan <slug>`/);
92
+ assert.doesNotMatch(clarifySkill, /hand off to `build` only/i);
93
+ assert.doesNotMatch(clarifySkill, /direct execution/i);
94
+ assert.doesNotMatch(clarifySkill, /direct implementation/i);
95
+ assert.doesNotMatch(clarifySkill, /directly to implementation/i);
96
+ assert.doesNotMatch(clarifySkill, /Proceed directly to implementation/i);
97
+ });
98
+
86
99
  it('reuses the shared install core while materializing skills from the plugin shell', async () => {
87
100
  const home = await mkdtemp(join(tmpdir(), 'loopx-plugin-home-'));
88
101
  const env = loopxEnv(home);
@@ -10,6 +10,15 @@ argument-hint: "<workflow slug>"
10
10
 
11
11
  Use `archive` after a loopx workflow has reached `done`. It syncs the accepted change delta into long-lived `.loopx/specs/` files, archives the change staging directory, and writes an advisory ADR candidate.
12
12
 
13
+ The accepted delta is requirement-based, not a changelog block. Archive applies:
14
+
15
+ - `## ADDED Requirements`
16
+ - `## MODIFIED Requirements`
17
+ - `## REMOVED Requirements`
18
+ - `## RENAMED Requirements`
19
+
20
+ into the current long-lived `## Requirements` state for each target domain.
21
+
13
22
  ## Inputs
14
23
 
15
24
  - `<workflow slug>` for a completed loopx workflow
@@ -33,6 +42,7 @@ Then report in Chinese:
33
42
  ## Boundaries
34
43
 
35
44
  - Do not run archive before `review -> done` has been approved.
45
+ - Do not archive malformed requirement deltas. ADDED and MODIFIED entries must use `### Requirement:`, SHALL/MUST language, and at least one `#### Scenario:`.
36
46
  - Do not archive when `execution-record.md` declares non-empty `remaining_scope`, `completion_claim` other than `full`, or a mismatch between `planned_scope` and `implemented_scope`; route back to build/plan instead.
37
47
  - Do not edit implementation code.
38
48
  - Do not promote ADR candidates into `docs/adr/` automatically; report the candidate path for human follow-up.
@@ -23,7 +23,7 @@ Its job is not just to ask questions. Its job is to turn a vague or overloaded r
23
23
  - The request is broad, ambiguous, or mixes problem, solution, and implementation detail.
24
24
  - The user needs help defining scope, non-goals, acceptance criteria, or tradeoffs before planning.
25
25
  - A design direction exists only implicitly and would otherwise be invented during implementation.
26
- - The task will later be handed to `plan`, `build`, or `autopilot`, and you want a high-signal spec first.
26
+ - The task will later be handed to `plan`, and you want a high-signal spec first.
27
27
  </Use_When>
28
28
 
29
29
  <Do_Not_Use_When>
@@ -33,7 +33,7 @@ Its job is not just to ask questions. Its job is to turn a vague or overloaded r
33
33
  </Do_Not_Use_When>
34
34
 
35
35
  <Why_This_Exists>
36
- Most implementation drift happens before coding begins. Teams often think they need “more planning,” when the real problem is weaker intent clarity, hidden assumptions, fuzzy boundaries, or a design shape that was never made explicit. `clarify` exists to solve those upstream failures before `plan` or `build` magnifies them.
36
+ Most implementation drift happens before coding begins. Teams often think they need “more planning,” when the real problem is weaker intent clarity, hidden assumptions, fuzzy boundaries, or a design shape that was never made explicit. `clarify` exists to solve those upstream failures before `plan` turns the clarified intent into an execution contract.
37
37
  </Why_This_Exists>
38
38
 
39
39
  <Core_Principles>
@@ -268,7 +268,7 @@ Before marking a clarify spec handoff-ready, perform a self-review pass:
268
268
 
269
269
  Write the output to the loopx runtime namespace:
270
270
 
271
- - `.loopx/specs/clarify-<slug>-<timestamp>.md`
271
+ - `.loopx/intake/clarify-<slug>-<timestamp>.md`
272
272
 
273
273
  The clarify spec should include:
274
274
 
@@ -299,17 +299,17 @@ The clarify spec should include:
299
299
 
300
300
  After the clarify spec is ready:
301
301
 
302
- - hand off to `plan` by default
303
- - hand off to `build` only if the user explicitly wants direct execution and the task is already concrete enough
304
- - hand off to `autopilot` only when the scope is sufficiently tight for a bounded end-to-end run
302
+ - hand off to `plan`; do not start implementation, TDD, `build`, or `autopilot` from `clarify`
303
+ - if the user asks to execute immediately, explain that loopx requires the `plan` gate first and provide the plan invocation
304
+ - if a task is too small to justify planning, do not use `clarify`; handle that request outside the clarify workflow from the start
305
305
 
306
306
  Preferred explicit handoff contract:
307
307
 
308
308
  - Recommended invocation: `$plan <slug>`
309
- - Artifact-pinned invocation when needed: `$plan --direct .loopx/specs/clarify-<slug>-<timestamp>.md`
309
+ - Artifact-pinned invocation when needed: `$plan --direct .loopx/intake/clarify-<slug>-<timestamp>.md`
310
310
  - Consumer behavior: treat the clarify spec as the source of truth for intent, non-goals, decision boundaries, constraints, and design direction; do not reopen clarification by default
311
311
 
312
- `clarify` itself does not implement the feature.
312
+ `clarify` itself does not implement the feature. The handoff recommendation must name `plan` as the next workflow step.
313
313
 
314
314
  </Process>
315
315
 
@@ -328,6 +328,7 @@ Preferred explicit handoff contract:
328
328
 
329
329
  <Must_Not_Decide_Automatically>
330
330
  - approval to move from clarify into plan
331
+ - skipping `plan` after producing a clarify spec
331
332
  - implementation details that were never clarified or grounded
332
333
  - widening the task because a broader redesign sounds cleaner
333
334
  </Must_Not_Decide_Automatically>