@ai-content-space/loopx 0.1.2 → 0.1.3

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 (67) hide show
  1. package/README.md +343 -56
  2. package/README.zh-CN.md +392 -0
  3. package/package.json +4 -1
  4. package/plugins/loopx/.codex-plugin/plugin.json +1 -1
  5. package/plugins/loopx/scripts/plugin-install.test.mjs +1 -0
  6. package/plugins/loopx/skills/archive/SKILL.md +39 -0
  7. package/plugins/loopx/skills/build/SKILL.md +111 -9
  8. package/plugins/loopx/skills/clarify/SKILL.md +121 -1
  9. package/plugins/loopx/skills/debug/SKILL.md +296 -0
  10. package/plugins/loopx/skills/debug/condition-based-waiting.md +115 -0
  11. package/plugins/loopx/skills/debug/defense-in-depth.md +122 -0
  12. package/plugins/loopx/skills/debug/find-polluter.sh +63 -0
  13. package/plugins/loopx/skills/debug/root-cause-tracing.md +169 -0
  14. package/plugins/loopx/skills/go-style/SKILL.md +71 -0
  15. package/plugins/loopx/skills/kratos/SKILL.md +74 -0
  16. package/plugins/loopx/skills/kratos/references/advanced-features.md +314 -0
  17. package/plugins/loopx/skills/kratos/references/architecture.md +488 -0
  18. package/plugins/loopx/skills/kratos/references/configuration.md +399 -0
  19. package/plugins/loopx/skills/kratos/references/http-customization.md +512 -0
  20. package/plugins/loopx/skills/kratos/references/middleware-logging.md +400 -0
  21. package/plugins/loopx/skills/kratos/references/proto-api-design.md +432 -0
  22. package/plugins/loopx/skills/kratos/references/security-auth.md +411 -0
  23. package/plugins/loopx/skills/kratos/references/troubleshooting.md +385 -0
  24. package/plugins/loopx/skills/plan/SKILL.md +22 -2
  25. package/plugins/loopx/skills/review/SKILL.md +98 -1
  26. package/plugins/loopx/skills/tdd/SKILL.md +371 -0
  27. package/plugins/loopx/skills/tdd/testing-anti-patterns.md +299 -0
  28. package/plugins/loopx/skills/verify/SKILL.md +139 -0
  29. package/scripts/codex-stop-hook.mjs +71 -0
  30. package/scripts/codex-workflow-hook.mjs +153 -0
  31. package/skills/archive/SKILL.md +39 -0
  32. package/skills/build/SKILL.md +111 -9
  33. package/skills/clarify/SKILL.md +121 -1
  34. package/skills/debug/SKILL.md +296 -0
  35. package/skills/debug/condition-based-waiting.md +115 -0
  36. package/skills/debug/defense-in-depth.md +122 -0
  37. package/skills/debug/find-polluter.sh +63 -0
  38. package/skills/debug/root-cause-tracing.md +169 -0
  39. package/skills/go-style/SKILL.md +71 -0
  40. package/skills/kratos/SKILL.md +74 -0
  41. package/skills/kratos/references/advanced-features.md +314 -0
  42. package/skills/kratos/references/architecture.md +488 -0
  43. package/skills/kratos/references/configuration.md +399 -0
  44. package/skills/kratos/references/http-customization.md +512 -0
  45. package/skills/kratos/references/middleware-logging.md +400 -0
  46. package/skills/kratos/references/proto-api-design.md +432 -0
  47. package/skills/kratos/references/security-auth.md +411 -0
  48. package/skills/kratos/references/troubleshooting.md +385 -0
  49. package/skills/plan/SKILL.md +18 -2
  50. package/skills/review/SKILL.md +98 -1
  51. package/skills/tdd/SKILL.md +371 -0
  52. package/skills/tdd/testing-anti-patterns.md +299 -0
  53. package/skills/verify/SKILL.md +139 -0
  54. package/src/build-runtime.mjs +303 -26
  55. package/src/build-stop-gate.mjs +94 -0
  56. package/src/cli.mjs +47 -5
  57. package/src/codex-exec-runtime.mjs +105 -5
  58. package/src/context-manifest.mjs +172 -0
  59. package/src/install-discovery.mjs +352 -5
  60. package/src/next-skill.mjs +57 -5
  61. package/src/plan-runtime.mjs +79 -122
  62. package/src/review-runtime.mjs +378 -0
  63. package/src/runtime-maintenance.mjs +428 -14
  64. package/src/template-governance.mjs +223 -0
  65. package/src/workflow.mjs +1941 -117
  66. package/src/workspace-context.mjs +166 -0
  67. package/src/workspace-memory.mjs +69 -0
package/README.md CHANGED
@@ -1,104 +1,373 @@
1
1
  # loopx
2
2
 
3
- `loopx` is a skill-first workflow product for Codex. It supports two first-class distribution shells:
3
+ [中文文档](./README.zh-CN.md)
4
4
 
5
- - npm/global install
6
- - Codex plugin install
5
+ `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.
7
6
 
8
- Both shells converge on one shared loopx core and one visible loopx skill set.
7
+ Current public flow:
9
8
 
10
- ## Release Contract
9
+ ```text
10
+ clarify -> plan -> build -> review -> approve review->done -> archive
11
+ ```
12
+
13
+ `done` is a runtime completion state reached by `loopx approve <slug> --from review --to done`, not a separate Codex skill.
11
14
 
12
- The active loopx release flow is:
15
+ `autopilot` is the end-to-end orchestration entrypoint. Internally it reuses the public flow instead of creating a second source of workflow truth.
13
16
 
14
- `clarify -> plan -> build -> review`
17
+ ## Features
15
18
 
16
- Bundled skill surfaces:
19
+ - 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
+ - Supports npm global install and Codex plugin install through the same install/discovery core.
21
+ - Stores runtime state and stage artifacts locally under `.loopx/` for auditability, recovery, and migration.
22
+ - Runs `plan` with a Planner -> Architect -> Critic consensus loop by default.
23
+ - Writes OpenSpec-inspired change artifacts during `plan`: proposal, spec delta, design, vertical slices, tasks, and an artifact dependency graph.
24
+ - Provides per-repo agent context under `.loopx/agents/` and `.loopx/context/domain.md`, consumed by build/review context manifests.
25
+ - Runs `build` with execution records, verification evidence, architect validation, deslop cleanup, and regression re-verification.
26
+ - Keeps `review` as an independent acceptance surface with code review plus an internal architecture-smell lane.
27
+ - 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/`.
17
29
 
18
- - `clarify`
19
- - `plan`
20
- - `build`
21
- - `review`
22
- - `autopilot`
30
+ ## Installation
23
31
 
24
- There is no public `team` surface in this release.
32
+ ### npm Global Install
25
33
 
26
- ## Product Positioning
34
+ ```bash
35
+ npm install -g @ai-content-space/loopx
36
+ ```
27
37
 
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/`
38
+ Installation automatically runs:
32
39
 
33
- ## Runtime Namespace
40
+ ```bash
41
+ node scripts/install-skills.mjs
42
+ ```
34
43
 
35
- loopx user-facing runtime state is stored under:
44
+ The script materializes loopx-owned skills under:
36
45
 
37
46
  ```text
38
- .loopx/
47
+ ~/.agents/skills/
39
48
  ```
40
49
 
41
- Key subtrees:
50
+ and updates:
42
51
 
43
- - `.loopx/specs/`
44
- - `.loopx/plans/`
45
- - `.loopx/workflows/<slug>/`
46
- - `.loopx/autopilot/<slug>/`
52
+ ```text
53
+ ~/.agents/.skill-lock.json
54
+ ```
55
+
56
+ ### Codex Plugin Install
57
+
58
+ The plugin shell lives at:
59
+
60
+ ```text
61
+ plugins/loopx/
62
+ ```
63
+
64
+ Plugin install script:
65
+
66
+ ```bash
67
+ node plugins/loopx/scripts/plugin-install.mjs
68
+ ```
47
69
 
48
- The `.omx/` tree remains orchestration/planning metadata and is not part of the loopx runtime rename.
70
+ npm and plugin installs converge on the same `installationIdentity=loopx`, so Codex should expose one loopx skill set rather than duplicates.
49
71
 
50
- ## CLI Surface
72
+ ## Quick Start
51
73
 
52
- Primary runtime/debug commands:
74
+ Initialize a workflow:
75
+
76
+ ```bash
77
+ loopx init --slug my-task
78
+ ```
79
+
80
+ Run clarification:
81
+
82
+ ```bash
83
+ loopx clarify my-task
84
+ ```
85
+
86
+ Approve and run planning:
87
+
88
+ ```bash
89
+ loopx approve my-task --from clarify --to plan
90
+ loopx plan my-task
91
+ ```
92
+
93
+ Approve and run execution:
94
+
95
+ ```bash
96
+ loopx approve my-task --from plan --to build
97
+ loopx build my-task
98
+ ```
99
+
100
+ Approve and run review:
101
+
102
+ ```bash
103
+ loopx approve my-task --from build --to review
104
+ loopx review my-task
105
+ ```
106
+
107
+ Complete an approved review:
108
+
109
+ ```bash
110
+ loopx approve my-task --from review --to done
111
+ loopx review my-task
112
+ ```
113
+
114
+ Archive accepted behavior into long-lived specs:
115
+
116
+ ```text
117
+ $archive my-task
118
+ ```
119
+
120
+ Check status:
121
+
122
+ ```bash
123
+ loopx status my-task
124
+ loopx status my-task --json
125
+ ```
126
+
127
+ You can also create a planning workflow directly from an existing spec:
128
+
129
+ ```bash
130
+ loopx plan --direct ./path/to/spec.md
131
+ ```
132
+
133
+ ## CLI Commands
53
134
 
54
135
  ```bash
55
136
  loopx init [--slug <slug>]
56
- loopx clarify <slug>
137
+ loopx clarify <slug> [--standard|--deep]
57
138
  loopx approve <slug> --from <stage> --to <stage>
58
- loopx plan <slug>
59
- loopx build <slug>
139
+ loopx plan [slug] [--direct <spec-path>] [--interactive] [--deliberate]
140
+ loopx build <slug> [--no-deslop]
141
+ loopx build --from-review <review-report-path> [--no-deslop]
60
142
  loopx review <slug> [--reviewer <name>]
143
+ loopx archive <slug>
61
144
  loopx autopilot <slug> [--reviewer <name>]
62
145
  loopx status [slug] [--json]
146
+ loopx setup-context
63
147
  loopx doctor
64
148
  loopx migrate
65
149
  loopx repair-install
66
150
  ```
67
151
 
68
- The CLI is supporting runtime/debug tooling. The intended user-facing product surface is the bundled loopx skills.
152
+ 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`.
69
153
 
70
- ## Install and Discovery
154
+ `loopx status` remains a CLI/runtime diagnostic command rather than a Codex skill.
71
155
 
72
- loopx supports two install paths that both reuse the same shared install/discovery core:
156
+ ## Skills
73
157
 
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`
158
+ ### clarify
79
159
 
80
- Bootstrap behavior:
160
+ `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.
81
161
 
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`
162
+ Profiles:
87
163
 
88
- Discovery is valid only when both are true:
164
+ - `--standard`: target ambiguity score `<= 0.20`, up to `15` rounds.
165
+ - `--deep`: target ambiguity score `<= 0.10`, up to `25` rounds.
89
166
 
90
- - the installed loopx skill directory exists
91
- - the matching loopx-owned registry row exists
167
+ ### plan
92
168
 
93
- If both npm and plugin installs are present, Codex should still expose one loopx skill set rather than duplicates.
169
+ `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.
94
170
 
95
- ## Legacy Migration
171
+ Main artifacts:
96
172
 
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`
173
+ - `.loopx/plans/prd-<slug>.md`
174
+ - `.loopx/plans/test-spec-<slug>.md`
175
+ - `.loopx/changes/active/<change-id>/proposal.md`
176
+ - `.loopx/changes/active/<change-id>/spec-delta.md`
177
+ - `.loopx/changes/active/<change-id>/design.md`
178
+ - `.loopx/changes/active/<change-id>/tasks.md`
179
+ - `.loopx/changes/active/<change-id>/slices.json`
180
+ - `.loopx/changes/active/<change-id>/artifact-graph.json`
181
+ - `.loopx/workflows/<slug>/plan.md`
182
+ - `.loopx/workflows/<slug>/architecture.md`
183
+ - `.loopx/workflows/<slug>/development-plan.md`
184
+ - `.loopx/workflows/<slug>/test-plan.md`
100
185
 
101
- ## Verification
186
+ ### build
187
+
188
+ `build` executes an approved plan and records changes, evidence, and limitations in the canonical artifact:
189
+
190
+ ```text
191
+ .loopx/workflows/<slug>/execution-record.md
192
+ ```
193
+
194
+ Deslop cleanup is enabled by default. To skip it explicitly:
195
+
196
+ ```bash
197
+ loopx build <slug> --no-deslop
198
+ ```
199
+
200
+ When review requests implementation changes, the normal Codex-facing handoff uses the review artifact as the direct rework contract:
201
+
202
+ ```text
203
+ $build --from-review .loopx/workflows/<slug>/review-report.md
204
+ ```
205
+
206
+ The approved PRD, test spec, previous execution record, and workflow-local plan package remain supporting context.
207
+
208
+ ### review
209
+
210
+ `review` consumes the build `execution-record.md`, runs independent acceptance, code review, and a lightweight architecture-smell lane, and generates:
211
+
212
+ ```text
213
+ .loopx/workflows/<slug>/review-report.md
214
+ ```
215
+
216
+ The user-facing review result is expected to be written in Chinese.
217
+
218
+ 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.
219
+
220
+ 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.
221
+
222
+ ### archive
223
+
224
+ `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:
225
+
226
+ ```text
227
+ .loopx/changes/archive/<change-id>/
228
+ ```
229
+
230
+ Archive also writes an advisory ADR candidate under `.loopx/decisions/adr-candidates/<change-id>.md`. It is not promoted to `docs/adr/` automatically.
231
+
232
+ ### autopilot
233
+
234
+ `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.
235
+
236
+ The orchestration ledger is written to:
237
+
238
+ ```text
239
+ .loopx/autopilot/<slug>/run.json
240
+ ```
241
+
242
+ ### debug
243
+
244
+ `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.
245
+
246
+ ### tdd
247
+
248
+ `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.
249
+
250
+ ### verify
251
+
252
+ `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.
253
+
254
+ ### go-style
255
+
256
+ `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.
257
+
258
+ ### kratos
259
+
260
+ `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.
261
+
262
+ ## Runtime Layout
263
+
264
+ loopx writes runtime state under `.loopx/` in the current project:
265
+
266
+ ```text
267
+ .loopx/
268
+ README.md
269
+ config.json
270
+ specs/
271
+ <domain>/
272
+ spec.md
273
+ changes/
274
+ active/
275
+ <change-id>/
276
+ proposal.md
277
+ spec-delta.md
278
+ design.md
279
+ tasks.md
280
+ slices.json
281
+ artifact-graph.json
282
+ archive/
283
+ <change-id>/
284
+ decisions/
285
+ adr-candidates/
286
+ plans/
287
+ agents/
288
+ issue-tracker.md
289
+ domain.md
290
+ triage-labels.md
291
+ context/
292
+ domain.md
293
+ workflows/
294
+ <slug>/
295
+ state.json
296
+ spec.md
297
+ plan.md
298
+ architecture.md
299
+ development-plan.md
300
+ test-plan.md
301
+ execution-record.md
302
+ review-report.md
303
+ plan-reviews/
304
+ build-support/
305
+ autopilot/
306
+ <slug>/
307
+ run.json
308
+ ```
309
+
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.
311
+
312
+ ## Diagnostics and Repair
313
+
314
+ Inspect runtime and skill installation state:
315
+
316
+ ```bash
317
+ loopx doctor
318
+ ```
319
+
320
+ Repair loopx-owned skill installation:
321
+
322
+ ```bash
323
+ loopx repair-install
324
+ ```
325
+
326
+ Check skill discovery state only:
327
+
328
+ ```bash
329
+ node scripts/install-skills.mjs --check
330
+ ```
331
+
332
+ ## Codex Stop Hook
333
+
334
+ loopx includes a Codex stop-hook helper that prevents an active build from stopping before review handoff readiness:
335
+
336
+ ```bash
337
+ node scripts/codex-stop-hook.mjs
338
+ ```
339
+
340
+ During `loopx build`, runtime state is written to:
341
+
342
+ ```text
343
+ .loopx/build-active.json
344
+ ```
345
+
346
+ 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.
347
+
348
+ ## Environment Variables
349
+
350
+ Install and discovery logic supports these environment variables:
351
+
352
+ - `LOOPX_HOME`: override the default home directory.
353
+ - `LOOPX_AGENTS_ROOT`: override the `.agents` root.
354
+ - `LOOPX_SKILLS_ROOT`: override the installed skills directory.
355
+ - `LOOPX_SKILL_LOCK_PATH`: override the skill lock path.
356
+ - `LOOPX_PROJECT_ROOT`: override the loopx project root.
357
+ - `LOOPX_SKILL_SOURCE_ROOT`: override the skill source directory.
358
+ - `LOOPX_DISTRIBUTION_CHANNEL`: set the install channel, default `npm`.
359
+ - `LOOPX_INSTALLATION_IDENTITY`: set the install identity, default `loopx`.
360
+ - `LOOPX_SOURCE_URL`: set the install source.
361
+
362
+ ## Development
363
+
364
+ Run tests:
365
+
366
+ ```bash
367
+ npm test
368
+ ```
369
+
370
+ Useful verification commands:
102
371
 
103
372
  ```bash
104
373
  node --test test/*.test.mjs
@@ -108,3 +377,21 @@ node src/cli.mjs --help
108
377
  node src/cli.mjs doctor
109
378
  node src/cli.mjs status --json
110
379
  ```
380
+
381
+ ## Published Files
382
+
383
+ `package.json` publishes:
384
+
385
+ - `README.md`
386
+ - `README.zh-CN.md`
387
+ - `package.json`
388
+ - `scripts/install-skills.mjs`
389
+ - `scripts/codex-stop-hook.mjs`
390
+ - `src/`
391
+ - `skills/`, including public loopx skills plus compatibility/internal skill sources shipped with the package
392
+ - `templates/`
393
+ - `plugins/loopx/`
394
+
395
+ ## Version
396
+
397
+ Current npm package version: `0.1.2`.