@ai-content-space/loopx 0.1.2 → 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.
Files changed (69) hide show
  1. package/README.md +422 -57
  2. package/README.zh-CN.md +485 -0
  3. package/assets/logo.svg +89 -0
  4. package/package.json +5 -1
  5. package/plugins/loopx/.codex-plugin/plugin.json +1 -1
  6. package/plugins/loopx/scripts/plugin-install.test.mjs +14 -0
  7. package/plugins/loopx/skills/archive/SKILL.md +49 -0
  8. package/plugins/loopx/skills/build/SKILL.md +111 -9
  9. package/plugins/loopx/skills/clarify/SKILL.md +129 -8
  10. package/plugins/loopx/skills/debug/SKILL.md +296 -0
  11. package/plugins/loopx/skills/debug/condition-based-waiting.md +115 -0
  12. package/plugins/loopx/skills/debug/defense-in-depth.md +122 -0
  13. package/plugins/loopx/skills/debug/find-polluter.sh +63 -0
  14. package/plugins/loopx/skills/debug/root-cause-tracing.md +169 -0
  15. package/plugins/loopx/skills/go-style/SKILL.md +71 -0
  16. package/plugins/loopx/skills/kratos/SKILL.md +74 -0
  17. package/plugins/loopx/skills/kratos/references/advanced-features.md +314 -0
  18. package/plugins/loopx/skills/kratos/references/architecture.md +488 -0
  19. package/plugins/loopx/skills/kratos/references/configuration.md +399 -0
  20. package/plugins/loopx/skills/kratos/references/http-customization.md +512 -0
  21. package/plugins/loopx/skills/kratos/references/middleware-logging.md +400 -0
  22. package/plugins/loopx/skills/kratos/references/proto-api-design.md +432 -0
  23. package/plugins/loopx/skills/kratos/references/security-auth.md +411 -0
  24. package/plugins/loopx/skills/kratos/references/troubleshooting.md +385 -0
  25. package/plugins/loopx/skills/plan/SKILL.md +24 -3
  26. package/plugins/loopx/skills/review/SKILL.md +98 -1
  27. package/plugins/loopx/skills/tdd/SKILL.md +371 -0
  28. package/plugins/loopx/skills/tdd/testing-anti-patterns.md +299 -0
  29. package/plugins/loopx/skills/verify/SKILL.md +139 -0
  30. package/scripts/codex-stop-hook.mjs +71 -0
  31. package/scripts/codex-workflow-hook.mjs +248 -0
  32. package/skills/archive/SKILL.md +49 -0
  33. package/skills/build/SKILL.md +111 -9
  34. package/skills/clarify/SKILL.md +129 -8
  35. package/skills/debug/SKILL.md +296 -0
  36. package/skills/debug/condition-based-waiting.md +115 -0
  37. package/skills/debug/defense-in-depth.md +122 -0
  38. package/skills/debug/find-polluter.sh +63 -0
  39. package/skills/debug/root-cause-tracing.md +169 -0
  40. package/skills/go-style/SKILL.md +71 -0
  41. package/skills/kratos/SKILL.md +74 -0
  42. package/skills/kratos/references/advanced-features.md +314 -0
  43. package/skills/kratos/references/architecture.md +488 -0
  44. package/skills/kratos/references/configuration.md +399 -0
  45. package/skills/kratos/references/http-customization.md +512 -0
  46. package/skills/kratos/references/middleware-logging.md +400 -0
  47. package/skills/kratos/references/proto-api-design.md +432 -0
  48. package/skills/kratos/references/security-auth.md +411 -0
  49. package/skills/kratos/references/troubleshooting.md +385 -0
  50. package/skills/plan/SKILL.md +20 -3
  51. package/skills/review/SKILL.md +98 -1
  52. package/skills/tdd/SKILL.md +371 -0
  53. package/skills/tdd/testing-anti-patterns.md +299 -0
  54. package/skills/verify/SKILL.md +139 -0
  55. package/src/build-runtime.mjs +311 -26
  56. package/src/build-stop-gate.mjs +94 -0
  57. package/src/cli.mjs +57 -5
  58. package/src/codex-exec-runtime.mjs +105 -5
  59. package/src/context-manifest.mjs +172 -0
  60. package/src/html-views.mjs +316 -0
  61. package/src/install-discovery.mjs +352 -5
  62. package/src/next-skill.mjs +57 -5
  63. package/src/plan-runtime.mjs +102 -122
  64. package/src/review-runtime.mjs +558 -0
  65. package/src/runtime-maintenance.mjs +429 -14
  66. package/src/template-governance.mjs +223 -0
  67. package/src/workflow.mjs +2341 -120
  68. package/src/workspace-context.mjs +166 -0
  69. package/src/workspace-memory.mjs +69 -0
package/README.md CHANGED
@@ -1,104 +1,449 @@
1
- # loopx
1
+ <p align="center">
2
+ <img src="./assets/logo.svg" alt="loopx fox logo" width="128" height="128">
3
+ </p>
2
4
 
3
- `loopx` is a skill-first workflow product for Codex. It supports two first-class distribution shells:
5
+ <h1 align="center">loopx</h1>
4
6
 
5
- - npm/global install
6
- - Codex plugin install
7
+ <p align="center">
8
+ Skill-first workflow runtime for Codex.
9
+ </p>
7
10
 
8
- Both shells converge on one shared loopx core and one visible loopx skill set.
11
+ [中文文档](./README.zh-CN.md)
9
12
 
10
- ## Release Contract
13
+ `loopx` is a skill-first workflow toolkit for Codex. It organizes clarification, consensus planning, persistent execution, and independent review into a local, auditable workflow exposed through both a CLI and Codex Skills.
11
14
 
12
- The active loopx release flow is:
15
+ Current public flow:
13
16
 
14
- `clarify -> plan -> build -> review`
17
+ ```text
18
+ clarify -> plan -> build -> review -> approve review->done -> archive
19
+ ```
20
+
21
+ `done` is a runtime completion state reached by `loopx approve <slug> --from review --to done`, not a separate Codex skill.
15
22
 
16
- Bundled skill surfaces:
23
+ `autopilot` is the end-to-end orchestration entrypoint. Internally it reuses the public flow instead of creating a second source of workflow truth.
17
24
 
18
- - `clarify`
19
- - `plan`
20
- - `build`
21
- - `review`
22
- - `autopilot`
25
+ ## Features
23
26
 
24
- There is no public `team` surface in this release.
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
+ - 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.
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.
32
+ - Runs `plan` with a Planner -> Architect -> Critic consensus loop by default.
33
+ - Writes OpenSpec-inspired change artifacts during `plan`: proposal, spec delta, design, vertical slices, tasks, and an artifact dependency graph.
34
+ - Provides per-repo agent context under `.loopx/agents/` and `.loopx/context/domain.md`, consumed by build/review context manifests.
35
+ - Runs `build` with execution records, verification evidence, architect validation, deslop cleanup, and regression re-verification.
36
+ - Keeps `review` as an independent acceptance surface with code review plus an internal architecture-smell lane.
37
+ - Supports `archive` to sync approved change deltas into long-lived `.loopx/specs/` source-of-truth files and emit ADR candidates.
25
38
 
26
- ## Product Positioning
39
+ ## Installation
27
40
 
28
- - skill-first for normal use
29
- - retained CLI/runtime/debug substrate for maintenance and inspection
30
- - explicit local artifacts and state under `.loopx/`
31
- - bounded migration from legacy `.codex-helper/`
41
+ ### npm Global Install
32
42
 
33
- ## Runtime Namespace
43
+ ```bash
44
+ npm install -g @ai-content-space/loopx
45
+ ```
34
46
 
35
- loopx user-facing runtime state is stored under:
47
+ Installation automatically runs:
48
+
49
+ ```bash
50
+ node scripts/install-skills.mjs
51
+ ```
52
+
53
+ The script materializes loopx-owned skills under:
36
54
 
37
55
  ```text
38
- .loopx/
56
+ ~/.agents/skills/
57
+ ```
58
+
59
+ It also installs the loopx-managed Codex workflow hook at:
60
+
61
+ ```text
62
+ ~/.codex/hooks/codex-workflow-hook.mjs
63
+ ```
64
+
65
+ and updates:
66
+
67
+ ```text
68
+ ~/.agents/.skill-lock.json
69
+ ```
70
+
71
+ ### Codex Plugin Install
72
+
73
+ The plugin shell lives at:
74
+
75
+ ```text
76
+ plugins/loopx/
77
+ ```
78
+
79
+ Plugin install script:
80
+
81
+ ```bash
82
+ node plugins/loopx/scripts/plugin-install.mjs
83
+ ```
84
+
85
+ npm and plugin installs converge on the same `installationIdentity=loopx`, so Codex should expose one loopx skill set rather than duplicates.
86
+
87
+ ## Quick Start
88
+
89
+ Initialize a workflow:
90
+
91
+ ```bash
92
+ loopx init --slug my-task
93
+ ```
94
+
95
+ Run clarification:
96
+
97
+ ```bash
98
+ loopx clarify my-task
99
+ ```
100
+
101
+ Approve and run planning:
102
+
103
+ ```bash
104
+ loopx approve my-task --from clarify --to plan
105
+ loopx plan my-task
106
+ ```
107
+
108
+ Approve and run execution:
109
+
110
+ ```bash
111
+ loopx approve my-task --from plan --to build
112
+ loopx build my-task
113
+ ```
114
+
115
+ Approve and run review:
116
+
117
+ ```bash
118
+ loopx approve my-task --from build --to review
119
+ loopx review my-task
120
+ ```
121
+
122
+ Complete an approved review:
123
+
124
+ ```bash
125
+ loopx approve my-task --from review --to done
126
+ ```
127
+
128
+ Archive accepted behavior into long-lived specs:
129
+
130
+ ```text
131
+ $archive my-task
39
132
  ```
40
133
 
41
- Key subtrees:
134
+ Check status:
42
135
 
43
- - `.loopx/specs/`
44
- - `.loopx/plans/`
45
- - `.loopx/workflows/<slug>/`
46
- - `.loopx/autopilot/<slug>/`
136
+ ```bash
137
+ loopx status my-task
138
+ loopx status my-task --json
139
+ ```
47
140
 
48
- The `.omx/` tree remains orchestration/planning metadata and is not part of the loopx runtime rename.
141
+ Render derived HTML reading views:
49
142
 
50
- ## CLI Surface
143
+ ```bash
144
+ loopx render my-task
145
+ ```
146
+
147
+ You can also create a planning workflow directly from an existing spec:
148
+
149
+ ```bash
150
+ loopx plan --direct ./path/to/spec.md
151
+ ```
51
152
 
52
- Primary runtime/debug commands:
153
+ ## CLI Commands
53
154
 
54
155
  ```bash
55
156
  loopx init [--slug <slug>]
56
- loopx clarify <slug>
157
+ loopx clarify <slug> [--standard|--deep]
57
158
  loopx approve <slug> --from <stage> --to <stage>
58
- loopx plan <slug>
59
- loopx build <slug>
159
+ loopx plan [slug] [--direct <spec-path>] [--interactive] [--deliberate]
160
+ loopx build <slug> [--no-deslop]
161
+ loopx build --from-review <review-report-path> [--no-deslop]
60
162
  loopx review <slug> [--reviewer <name>]
163
+ loopx archive <slug>
61
164
  loopx autopilot <slug> [--reviewer <name>]
165
+ loopx render [slug|--all]
62
166
  loopx status [slug] [--json]
167
+ loopx setup-context
63
168
  loopx doctor
64
169
  loopx migrate
65
170
  loopx repair-install
66
171
  ```
67
172
 
68
- The CLI is supporting runtime/debug tooling. The intended user-facing product surface is the bundled loopx skills.
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`.
174
+
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.
176
+
177
+ ## Skills
178
+
179
+ ### clarify
180
+
181
+ `clarify` turns an ambiguous request into an execution-ready spec. It tracks ambiguity score, non-goals, decision boundaries, and pressure-pass completion. It only recommends handoff to `plan` after the runtime gates are satisfied.
182
+
183
+ Profiles:
184
+
185
+ - `--standard`: target ambiguity score `<= 0.20`, up to `15` rounds.
186
+ - `--deep`: target ambiguity score `<= 0.10`, up to `25` rounds.
187
+
188
+ ### plan
189
+
190
+ `plan` turns an approved clarify spec, or a directly supplied spec, into a reviewed plan package. By default it runs the Planner, Architect, and Critic review loop until approval or the iteration cap is reached.
191
+
192
+ Main artifacts:
193
+
194
+ - `.loopx/plans/prd-<slug>.md`
195
+ - `.loopx/plans/test-spec-<slug>.md`
196
+ - `.loopx/changes/active/<change-id>/proposal.md`
197
+ - `.loopx/changes/active/<change-id>/spec-delta.md`
198
+ - `.loopx/changes/active/<change-id>/design.md`
199
+ - `.loopx/changes/active/<change-id>/tasks.md`
200
+ - `.loopx/changes/active/<change-id>/slices.json`
201
+ - `.loopx/changes/active/<change-id>/artifact-graph.json`
202
+ - `.loopx/workflows/<slug>/plan.md`
203
+ - `.loopx/workflows/<slug>/architecture.md`
204
+ - `.loopx/workflows/<slug>/development-plan.md`
205
+ - `.loopx/workflows/<slug>/test-plan.md`
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
+
209
+ ### build
210
+
211
+ `build` executes an approved plan and records changes, evidence, and limitations in the canonical artifact:
212
+
213
+ ```text
214
+ .loopx/workflows/<slug>/execution-record.md
215
+ ```
216
+
217
+ Deslop cleanup is enabled by default. To skip it explicitly:
218
+
219
+ ```bash
220
+ loopx build <slug> --no-deslop
221
+ ```
222
+
223
+ When review requests implementation changes, the normal Codex-facing handoff uses the review artifact as the direct rework contract:
224
+
225
+ ```text
226
+ $build --from-review .loopx/workflows/<slug>/review-report.md
227
+ ```
228
+
229
+ The approved PRD, test spec, previous execution record, and workflow-local plan package remain supporting context.
230
+
231
+ ### review
232
+
233
+ `review` consumes the build `execution-record.md`, runs independent acceptance, code review, and a lightweight architecture-smell lane, and generates:
234
+
235
+ ```text
236
+ .loopx/workflows/<slug>/review-report.md
237
+ ```
238
+
239
+ The user-facing review result is expected to be written in Chinese.
240
+
241
+ If review approves the run, the workflow still requires an explicit `review -> done` approval. If review requests implementation changes, run `$build --from-review .loopx/workflows/<slug>/review-report.md`. Plan and clarify rollbacks still use `$plan <slug>` or `$clarify <slug>` when the review finding says the plan or requirements are wrong.
242
+
243
+ The architecture-smell lane is part of review; it does not add a new stage. It records findings under `review-support/architecture-smell.json` and only blocks when module seams, testability, domain vocabulary, or plan architecture assumptions are materially wrong.
244
+
245
+ ### archive
246
+
247
+ `archive` consumes a completed workflow and syncs the approved `.loopx/changes/active/<change-id>/spec-delta.md` into long-lived domain specs under `.loopx/specs/`. The change folder is moved to:
248
+
249
+ ```text
250
+ .loopx/changes/archive/<change-id>/
251
+ ```
252
+
253
+ Archive also writes an advisory ADR candidate under `.loopx/decisions/adr-candidates/<change-id>.md`. It is not promoted to `docs/adr/` automatically.
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
+
257
+ ### autopilot
258
+
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.
260
+
261
+ The orchestration ledger is written to:
262
+
263
+ ```text
264
+ .loopx/autopilot/<slug>/run.json
265
+ ```
266
+
267
+ ### debug
268
+
269
+ `debug` is a quality support skill for bugs, failures, regressions, and unexpected behavior. It requires root-cause investigation before proposing fixes, then moves through pattern analysis, hypothesis testing, and implementation.
270
+
271
+ ### tdd
272
+
273
+ `tdd` is a quality support skill for feature work and bug fixes. It requires writing a failing test first, confirming the failure is meaningful, then implementing the smallest change needed to pass.
274
+
275
+ ### verify
276
+
277
+ `verify` is a quality support skill for final claims. It requires fresh verification evidence before saying work is complete, fixed, passing, ready to commit, or ready for review.
278
+
279
+ ### go-style
280
+
281
+ `go-style` is a Go language support skill. It guides `.go` edits toward idiomatic structure, local project conventions, clear error handling, small interfaces, table-driven tests, and `gofmt`/Go verification.
282
+
283
+ ### kratos
284
+
285
+ `kratos` is a Go-Kratos framework support skill. It applies when a project uses Kratos signals such as `buf.yaml`, proto APIs, `internal/service`, `internal/biz`, `internal/data`, or `github.com/go-kratos/kratos/v2`, and includes focused references for proto design, layered architecture, config, middleware, auth, HTTP customization, and troubleshooting.
286
+
287
+ ## Runtime Layout
288
+
289
+ loopx writes runtime state under `.loopx/` in the current project:
290
+
291
+ ```text
292
+ .loopx/
293
+ README.md
294
+ config.json
295
+ intake/
296
+ clarify-<slug>-<timestamp>.md
297
+ views/
298
+ index.html
299
+ specs/
300
+ <domain>/
301
+ spec.md
302
+ changes/
303
+ active/
304
+ <change-id>/
305
+ proposal.md
306
+ spec-delta.md
307
+ design.md
308
+ tasks.md
309
+ slices.json
310
+ artifact-graph.json
311
+ archive/
312
+ <change-id>/
313
+ decisions/
314
+ adr-candidates/
315
+ plans/
316
+ agents/
317
+ issue-tracker.md
318
+ domain.md
319
+ triage-labels.md
320
+ context/
321
+ domain.md
322
+ workflows/
323
+ <slug>/
324
+ state.json
325
+ spec.md
326
+ plan.md
327
+ architecture.md
328
+ development-plan.md
329
+ test-plan.md
330
+ execution-record.md
331
+ review-report.md
332
+ view/
333
+ index.html
334
+ intake.html
335
+ plan.html
336
+ build.html
337
+ review.html
338
+ plan-reviews/
339
+ build-support/
340
+ autopilot/
341
+ <slug>/
342
+ run.json
343
+ ```
344
+
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.
374
+
375
+ ## Diagnostics and Repair
376
+
377
+ Inspect runtime and skill installation state:
378
+
379
+ ```bash
380
+ loopx doctor
381
+ ```
382
+
383
+ Repair loopx-owned skill installation:
384
+
385
+ ```bash
386
+ loopx repair-install
387
+ ```
388
+
389
+ Check skill discovery state only:
69
390
 
70
- ## Install and Discovery
391
+ ```bash
392
+ node scripts/install-skills.mjs --check
393
+ ```
71
394
 
72
- loopx supports two install paths that both reuse the same shared install/discovery core:
395
+ ## Codex Workflow Hook
73
396
 
74
- - npm/global install:
75
- - `npm install -g @ai-content-space/loopx`
76
- - followed by `postinstall -> node scripts/install-skills.mjs`
77
- - plugin install:
78
- - `plugins/loopx/scripts/plugin-install.mjs`
397
+ `install-skills.mjs` and the Codex plugin installer automatically install `scripts/codex-workflow-hook.mjs` to:
79
398
 
80
- Bootstrap behavior:
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.
81
404
 
82
- - materializes loopx-owned skills under `~/.agents/skills/`
83
- - updates loopx-owned `local` rows in `~/.agents/.skill-lock.json`
84
- - keeps install idempotent
85
- - supports repair through `loopx repair-install`
86
- - converges npm and plugin installs onto one `installationIdentity=loopx`
405
+ Set `LOOPX_HOOKS=0` to disable the workflow hook output.
87
406
 
88
- Discovery is valid only when both are true:
407
+ ## Codex Stop Hook
408
+
409
+ loopx includes a Codex stop-hook helper that prevents an active build from stopping before review handoff readiness:
410
+
411
+ ```bash
412
+ node scripts/codex-stop-hook.mjs
413
+ ```
414
+
415
+ During `loopx build`, runtime state is written to:
416
+
417
+ ```text
418
+ .loopx/build-active.json
419
+ ```
89
420
 
90
- - the installed loopx skill directory exists
91
- - the matching loopx-owned registry row exists
421
+ If that state says build is still `starting`, `executing`, `verifying`, or `fixing`, the hook returns `allow: false` and a continuation message. Once build is `review-ready`, blocked by a real blocker, failed, cancelled, or inactive, the hook allows the stop.
92
422
 
93
- If both npm and plugin installs are present, Codex should still expose one loopx skill set rather than duplicates.
423
+ ## Environment Variables
94
424
 
95
- ## Legacy Migration
425
+ Install and discovery logic supports these environment variables:
96
426
 
97
- - legacy `.codex-helper/` runtime state is migrated through `loopx migrate`
98
- - mixed `.loopx/` and `.codex-helper/` roots are treated as a repairable error
99
- - public docs, package, CLI, and skill names use `loopx`
427
+ - `LOOPX_HOME`: override the default home directory.
428
+ - `LOOPX_AGENTS_ROOT`: override the `.agents` root.
429
+ - `LOOPX_SKILLS_ROOT`: override the installed skills directory.
430
+ - `LOOPX_SKILL_LOCK_PATH`: override the skill lock path.
431
+ - `LOOPX_PROJECT_ROOT`: override the loopx project root.
432
+ - `LOOPX_SKILL_SOURCE_ROOT`: override the skill source directory.
433
+ - `LOOPX_DISTRIBUTION_CHANNEL`: set the install channel, default `npm`.
434
+ - `LOOPX_INSTALLATION_IDENTITY`: set the install identity, default `loopx`.
435
+ - `LOOPX_SOURCE_URL`: set the install source.
436
+ - `LOOPX_HOOKS`: set to `0` to disable workflow hook output.
100
437
 
101
- ## Verification
438
+ ## Development
439
+
440
+ Run tests:
441
+
442
+ ```bash
443
+ npm test
444
+ ```
445
+
446
+ Useful verification commands:
102
447
 
103
448
  ```bash
104
449
  node --test test/*.test.mjs
@@ -108,3 +453,23 @@ node src/cli.mjs --help
108
453
  node src/cli.mjs doctor
109
454
  node src/cli.mjs status --json
110
455
  ```
456
+
457
+ ## Published Files
458
+
459
+ `package.json` publishes:
460
+
461
+ - `README.md`
462
+ - `README.zh-CN.md`
463
+ - `package.json`
464
+ - `scripts/install-skills.mjs`
465
+ - `scripts/codex-stop-hook.mjs`
466
+ - `scripts/codex-workflow-hook.mjs`
467
+ - `assets/logo.svg`
468
+ - `src/`
469
+ - `skills/`, including public loopx skills plus compatibility/internal skill sources shipped with the package
470
+ - `templates/`
471
+ - `plugins/loopx/`
472
+
473
+ ## Version
474
+
475
+ Current npm package version: `0.1.4`.