@ai-content-space/loopx 0.2.3 → 0.2.7

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 (56) hide show
  1. package/README.md +106 -10
  2. package/README.zh-CN.md +106 -10
  3. package/docs/loopx/design/finish/345/255/246/344/271/240/345/256/241/350/256/241/351/234/200/346/261/202/350/256/276/350/256/241/346/226/207/346/241/243.md +707 -0
  4. package/docs/loopx/memory/2026-06-09-stale-archive-hook-guidance.md +15 -0
  5. package/docs/loopx/memory/README.md +25 -0
  6. package/docs/loopx/plans/2026-06-08-finish-audit-change-window.md +933 -0
  7. package/docs/loopx/plans/2026-06-08-finish-learning-audit.md +410 -0
  8. package/docs/loopx/plans/2026-06-09-cli-onboarding-install-surface.md +1277 -0
  9. package/docs/loopx/specs/installation.md +33 -0
  10. package/package.json +18 -2
  11. package/plugins/loopx/.codex-plugin/plugin.json +1 -1
  12. package/plugins/loopx/skills/clarify/SKILL.md +1 -1
  13. package/plugins/loopx/skills/debug/SKILL.md +1 -1
  14. package/plugins/loopx/skills/doc-readability/SKILL.md +222 -0
  15. package/plugins/loopx/skills/doc-readability/references/prd.md +269 -0
  16. package/plugins/loopx/skills/exec/SKILL.md +11 -1
  17. package/plugins/loopx/skills/final-review/SKILL.md +1 -1
  18. package/plugins/loopx/skills/finish/SKILL.md +39 -7
  19. package/plugins/loopx/skills/fix-review/SKILL.md +1 -1
  20. package/plugins/loopx/skills/go-style/SKILL.md +1 -1
  21. package/plugins/loopx/skills/kratos/SKILL.md +1 -1
  22. package/plugins/loopx/skills/plan/SKILL.md +1 -1
  23. package/plugins/loopx/skills/refactor-plan/SKILL.md +1 -1
  24. package/plugins/loopx/skills/review/SKILL.md +1 -1
  25. package/plugins/loopx/skills/spec/SKILL.md +1 -1
  26. package/plugins/loopx/skills/subagent-exec/SKILL.md +13 -1
  27. package/plugins/loopx/skills/tdd/SKILL.md +1 -1
  28. package/plugins/loopx/skills/verify/SKILL.md +1 -1
  29. package/scripts/claude-workflow-hook.mjs +50 -1
  30. package/scripts/codex-workflow-hook.mjs +33 -12
  31. package/scripts/install-skills.mjs +58 -3
  32. package/scripts/verify-skills.mjs +83 -7
  33. package/skills/RESOLVER.md +3 -1
  34. package/skills/clarify/SKILL.md +1 -1
  35. package/skills/debug/SKILL.md +1 -1
  36. package/skills/doc-readability/SKILL.md +222 -0
  37. package/skills/doc-readability/references/prd.md +269 -0
  38. package/skills/exec/SKILL.md +11 -1
  39. package/skills/final-review/SKILL.md +1 -1
  40. package/skills/finish/SKILL.md +39 -7
  41. package/skills/fix-review/SKILL.md +1 -1
  42. package/skills/go-style/SKILL.md +1 -1
  43. package/skills/kratos/SKILL.md +1 -1
  44. package/skills/plan/SKILL.md +1 -1
  45. package/skills/refactor-plan/SKILL.md +1 -1
  46. package/skills/review/SKILL.md +1 -1
  47. package/skills/spec/SKILL.md +1 -1
  48. package/skills/subagent-exec/SKILL.md +13 -1
  49. package/skills/tdd/SKILL.md +1 -1
  50. package/skills/verify/SKILL.md +1 -1
  51. package/src/cli.mjs +473 -86
  52. package/src/finish-runtime.mjs +1184 -0
  53. package/src/install-discovery.mjs +38 -0
  54. package/src/next-skill.mjs +8 -10
  55. package/src/workflow.mjs +19 -26
  56. package/skills/deepsearch/SKILL.md +0 -38
package/README.md CHANGED
@@ -18,6 +18,32 @@ Recommended v1 flow:
18
18
  clarify -> spec? -> plan -> (subagent-exec | exec) -> final-review -> fix-review? -> finish
19
19
  ```
20
20
 
21
+ ## Quick start
22
+
23
+ ```bash
24
+ loopx install-skills --target all --yes
25
+ loopx init --slug my-feature
26
+ loopx clarify my-feature
27
+ loopx status my-feature
28
+ ```
29
+
30
+ For the shortest next-step prompt after a workflow exists, run:
31
+
32
+ ```bash
33
+ loopx next my-feature
34
+ ```
35
+
36
+ Human output is the default for first-use commands such as `loopx init`, `loopx clarify`, `loopx status`, `loopx doctor`, and `loopx install-skills`. Use `--json` when an agent or script needs the complete runtime payload:
37
+
38
+ ```bash
39
+ loopx init --slug my-feature --json
40
+ loopx clarify my-feature --json
41
+ loopx doctor --json
42
+ loopx install-skills --target all --json
43
+ ```
44
+
45
+ The JSON flag also works on the default init path: `loopx init --json`.
46
+
21
47
  `spec` is conditional. Use it when API, data, state, permission, migration, compatibility, product behavior, or architecture decisions must be fixed before planning. Skip it when the remaining work is local implementation choice.
22
48
 
23
49
  ## Skills
@@ -55,12 +81,23 @@ For the v1 skill-suite workflow, human-maintained artifacts live under `docs/loo
55
81
  - `docs/loopx/plans/`
56
82
  - `docs/loopx/reviews/`
57
83
  - `docs/loopx/refactors/`
84
+ - `docs/loopx/memory/`
58
85
  - `docs/loopx/specs/`
59
86
 
87
+ `docs/loopx/memory/` stores git-tracked shared memory for lightweight project knowledge that should follow a user across machines but is not stable enough to become a spec.
88
+
60
89
  `finish` may generate spec candidates in `docs/loopx/specs/` when completed work produces stable team rules. These candidates are repo-tracked and must remain visible in the git diff.
61
90
 
91
+ `finish` also writes a local audit ledger under `.loopx/finish/<audit-id>/`. `none` means the work was audited, but it did not produce a durable learning candidate. Choice recording lives in that local finish audit directory, while repo-tracked spec candidates stay in `docs/loopx/specs/`.
92
+
93
+ Finish runtime commands are advanced agent/runtime plumbing, not the normal user path. `finish-start` records the starting commit for plan execution, and `finish-audit` uses that baseline to include committed `baseline..HEAD` evidence, changed files, and uncommitted status in `.loopx/finish/<audit-id>/finish-state.json` as `audit.change_window`, so finish learning/spec extraction still has input after the worktree is clean. It also writes draft `audit.extraction_candidates` for memory/spec review; agents must accept or reject those drafts before recording a done finish choice.
94
+
62
95
  `finish` is the terminal completion step for one implementation decision. Rerun it only after keep-as-is, PR iteration, interruption before executing a choice, or new changes after review feedback. Do not rerun it after merge or discard.
63
96
 
97
+ ### Archive compatibility
98
+
99
+ archive is not part of the public v1 finish flow. Older runtime state may still contain archive fields or a hidden `loopx archive <slug>` compatibility command, but normal users should complete work through `finish`.
100
+
64
101
  Generated support state, hook diagnostics, installer metadata, HTML views, manifests, and runtime JSON remain under `.loopx/`.
65
102
 
66
103
  Local agent memory lives under `.loopx/memory/`:
@@ -72,6 +109,8 @@ Local agent memory lives under `.loopx/memory/`:
72
109
 
73
110
  `MEMORY.md` is a bounded curated project memory summary. `index.jsonl` is a curated active index for agent file-search, not an append-only log.
74
111
 
112
+ Shared agent memory lives under `docs/loopx/memory/`. It is repo-tracked for multi-machine continuity and should stay concise, evidence-backed, and below spec-level stability.
113
+
75
114
  ## Installation
76
115
 
77
116
  Install globally:
@@ -87,6 +126,44 @@ Postinstall installs user-level skills and hooks for Codex and Claude:
87
126
  - Codex hook: `~/.codex/hooks/codex-workflow-hook.mjs`
88
127
  - Claude hook: `~/.claude/hooks/loopx-workflow-hook.mjs`
89
128
 
129
+ To inspect without writing files:
130
+
131
+ ```bash
132
+ loopx install-skills --target all --dry-run
133
+ ```
134
+
135
+ Use the explicit target form for dry-run checks so the command stays non-interactive.
136
+
137
+ Successful install output lists the targets and installed skill roots. `loopx install-skills --json` includes the full inspection payload for scripts and support cases.
138
+
139
+ To opt out during npm postinstall:
140
+
141
+ ```bash
142
+ LOOPX_SKIP_POSTINSTALL=1 npm install -g @ai-content-space/loopx
143
+ LOOPX_POSTINSTALL=0 npm install -g @ai-content-space/loopx
144
+ ```
145
+
146
+ To disable loopx hooks for one process:
147
+
148
+ ```bash
149
+ LOOPX_HOOKS=0 codex
150
+ ```
151
+
152
+ Repair an interrupted or conflicted install with:
153
+
154
+ ```bash
155
+ loopx repair-install
156
+ loopx doctor
157
+ ```
158
+
159
+ Undo installed files when you want to remove loopx-managed user-level artifacts:
160
+
161
+ ```bash
162
+ rm -rf ~/.agents/skills/{clarify,spec,plan,subagent-exec,exec,review,final-review,fix-review,finish,refactor-plan,tdd,debug,verify,go-style,kratos}
163
+ rm -rf ~/.claude/skills/{clarify,spec,plan,subagent-exec,exec,review,final-review,fix-review,finish,refactor-plan,tdd,debug,verify,go-style,kratos}
164
+ rm -f ~/.codex/hooks/codex-workflow-hook.mjs ~/.claude/hooks/loopx-workflow-hook.mjs
165
+ ```
166
+
90
167
  Run the installer manually or choose targets interactively:
91
168
 
92
169
  ```bash
@@ -121,23 +198,42 @@ The CLI supports installation, diagnostics, rendering, and runtime maintenance:
121
198
 
122
199
  ```bash
123
200
  loopx --version
124
- loopx install-skills [--target <codex|claude|all>] [--project] [--mode <copy|symlink>] [--dir <path>] [--yes]
125
- loopx init [--slug <slug>] [--enable-agent-delegation] [--auto-agent-delegation] [--agent-delegation-threshold <local|critic-only|parallel-review>]
126
- loopx clarify <slug> [--standard|--deep]
127
- loopx approve <slug> --from <stage> --to <stage>
128
- loopx plan [slug] [--interactive] [--deliberate]
129
- loopx build <slug> [--no-deslop]
130
- loopx build --from-review <review-report-path> [--no-deslop]
131
- loopx review <slug> [--reviewer <name>]
132
- loopx autopilot <slug> [--reviewer <name>]
201
+ loopx install-skills [--target <codex|claude|all>] [--project] [--mode <copy|symlink>] [--dir <path>] [--yes] [--dry-run] [--json]
202
+ loopx init [--slug <slug>] [--enable-agent-delegation] [--auto-agent-delegation] [--agent-delegation-threshold <local|critic-only|parallel-review>] [--json]
203
+ loopx clarify <slug> [--standard|--deep] [--json]
133
204
  loopx render [slug|--all]
134
205
  loopx status [slug] [--json]
206
+ loopx next <slug> [--json]
135
207
  loopx setup-context
136
- loopx doctor
208
+ loopx doctor [--json]
137
209
  loopx migrate
138
210
  loopx repair-install
139
211
  ```
140
212
 
213
+ Advanced runtime commands:
214
+
215
+ ```bash
216
+ loopx help advanced
217
+ ```
218
+
219
+ These commands are kept for skills, hooks, and compatibility paths. Normal users should follow `loopx status`, `loopx next`, and the suggested skill commands.
220
+
221
+ ## Golden path
222
+
223
+ This is the smallest complete first-run loop:
224
+
225
+ ```bash
226
+ loopx install-skills --target all --dry-run
227
+ loopx install-skills --target all --yes
228
+ loopx doctor
229
+ loopx init --slug my-feature
230
+ loopx clarify my-feature
231
+ loopx status my-feature
232
+ loopx next my-feature
233
+ ```
234
+
235
+ After `clarify`, hand control to the suggested skill command, usually `$plan <slug>`. Continue following `loopx status <slug>` or `loopx next <slug>` until `final-review` and `$finish` complete the work.
236
+
141
237
  ## Governance
142
238
 
143
239
  The bundled skill resolver lives at:
package/README.zh-CN.md CHANGED
@@ -18,6 +18,32 @@
18
18
  clarify -> spec? -> plan -> (subagent-exec | exec) -> final-review -> fix-review? -> finish
19
19
  ```
20
20
 
21
+ ## 快速开始
22
+
23
+ ```bash
24
+ loopx install-skills --target all --yes
25
+ loopx init --slug my-feature
26
+ loopx clarify my-feature
27
+ loopx status my-feature
28
+ ```
29
+
30
+ 工作流存在后,如果只想看下一步命令:
31
+
32
+ ```bash
33
+ loopx next my-feature
34
+ ```
35
+
36
+ 默认输出面向人类,例如 `loopx init`、`loopx clarify`、`loopx status`、`loopx doctor` 和 `loopx install-skills`。当 agent 或脚本需要完整 runtime payload 时使用 `--json`:
37
+
38
+ ```bash
39
+ loopx init --slug my-feature --json
40
+ loopx clarify my-feature --json
41
+ loopx doctor --json
42
+ loopx install-skills --target all --json
43
+ ```
44
+
45
+ 默认 init 路径也可以使用 JSON 输出:`loopx init --json`。
46
+
21
47
  `spec` 是条件设计门。涉及 API、数据、状态、权限、迁移、兼容、产品行为或架构决策时使用;只剩局部实现选择时可以跳过,直接进入 `plan`。
22
48
 
23
49
  ## Skills
@@ -55,12 +81,23 @@ v1 skill-suite 工作流的人工维护长期产物放在 `docs/loopx/`:
55
81
  - `docs/loopx/plans/`
56
82
  - `docs/loopx/reviews/`
57
83
  - `docs/loopx/refactors/`
84
+ - `docs/loopx/memory/`
58
85
  - `docs/loopx/specs/`
59
86
 
87
+ `docs/loopx/memory/` 用于保存纳入 git 的 shared memory,适合需要跟随用户跨机器同步、但还没有稳定到 spec 级别的轻量项目知识。
88
+
60
89
  当完成的工作产生稳定团队规则时,`finish` 可以在 `docs/loopx/specs/` 生成 spec candidates。这些候选是 repo-tracked,必须保留在 git diff 中供审阅。
61
90
 
91
+ `finish` 还会在 `.loopx/finish/<audit-id>/` 下写入本地 audit ledger。`none` 表示已经完成审计,但没有产生可持久化的 learning candidate。choice recording 也放在这个本地 finish audit 目录里,而 repo-tracked 的 spec candidates 仍然保留在 `docs/loopx/specs/`。
92
+
93
+ Finish runtime 命令是给 agent、hooks 和兼容路径使用的高级 plumbing,不是普通用户主路径。`finish-start` 会记录计划执行开始时的提交,`finish-audit` 使用这个基线把已提交的 `baseline..HEAD` 证据、变更文件和未提交状态写入 `.loopx/finish/<audit-id>/finish-state.json` 的 `audit.change_window`,因此即使执行过程中已经 commit、当前工作区是 clean,finish 的记忆/spec 提取仍有稳定输入。它还会写入用于记忆/spec 审核的草稿 `audit.extraction_candidates`;agent 必须接受或拒绝这些草稿后,才能把 finish choice 记录为 done。
94
+
62
95
  `finish` 是一次 implementation decision 的终端完成步骤。只有在上次选择保留、PR 迭代、执行选择前中断,或 review feedback 后出现新变更时才重新执行;merge 或 discard 后不要重复执行。
63
96
 
97
+ ### Archive 兼容性
98
+
99
+ archive 不属于公开 v1 finish 流程。旧 runtime state 仍可能包含 archive 字段,也可能通过隐藏的 `loopx archive <slug>` 兼容命令处理历史状态,但普通用户应通过 `finish` 完成工作。
100
+
64
101
  生成的支撑状态、hook 诊断、安装元数据、HTML views、manifests 和 runtime JSON 仍放在 `.loopx/` 下。
65
102
 
66
103
  本地 agent memory 放在 `.loopx/memory/`:
@@ -72,6 +109,8 @@ v1 skill-suite 工作流的人工维护长期产物放在 `docs/loopx/`:
72
109
 
73
110
  `MEMORY.md` 是有上限的 curated project memory summary。`index.jsonl` 是用于 agent 文件检索的 curated active index,不是 append-only log。
74
111
 
112
+ shared agent memory 放在 `docs/loopx/memory/`。它会纳入 repo,用于多机器连续性;内容应简短、有证据,并且还没有稳定到 spec 级别。
113
+
75
114
  ## 安装
76
115
 
77
116
  全局安装:
@@ -87,6 +126,44 @@ postinstall 默认安装 Codex 和 Claude 用户级 skills 与 hooks:
87
126
  - Codex hook:`~/.codex/hooks/codex-workflow-hook.mjs`
88
127
  - Claude hook:`~/.claude/hooks/loopx-workflow-hook.mjs`
89
128
 
129
+ 只检查、不写文件:
130
+
131
+ ```bash
132
+ loopx install-skills --target all --dry-run
133
+ ```
134
+
135
+ dry-run 检查使用显式 target,避免命令进入交互选择。
136
+
137
+ 安装成功后的输出会列出 targets 和安装到的 skill roots。`loopx install-skills --json` 会输出完整 inspection payload,供脚本和排查使用。
138
+
139
+ npm postinstall 阶段跳过自动安装:
140
+
141
+ ```bash
142
+ LOOPX_SKIP_POSTINSTALL=1 npm install -g @ai-content-space/loopx
143
+ LOOPX_POSTINSTALL=0 npm install -g @ai-content-space/loopx
144
+ ```
145
+
146
+ 只在当前进程禁用 loopx hooks:
147
+
148
+ ```bash
149
+ LOOPX_HOOKS=0 codex
150
+ ```
151
+
152
+ 修复中断或冲突的安装:
153
+
154
+ ```bash
155
+ loopx repair-install
156
+ loopx doctor
157
+ ```
158
+
159
+ 撤销已安装文件,移除 loopx 管理的用户级 artifacts:
160
+
161
+ ```bash
162
+ rm -rf ~/.agents/skills/{clarify,spec,plan,subagent-exec,exec,review,final-review,fix-review,finish,refactor-plan,tdd,debug,verify,go-style,kratos}
163
+ rm -rf ~/.claude/skills/{clarify,spec,plan,subagent-exec,exec,review,final-review,fix-review,finish,refactor-plan,tdd,debug,verify,go-style,kratos}
164
+ rm -f ~/.codex/hooks/codex-workflow-hook.mjs ~/.claude/hooks/loopx-workflow-hook.mjs
165
+ ```
166
+
90
167
  也可以手动运行安装器或交互式选择目标:
91
168
 
92
169
  ```bash
@@ -121,23 +198,42 @@ CLI 用于安装、诊断、渲染和 runtime 维护:
121
198
 
122
199
  ```bash
123
200
  loopx --version
124
- loopx install-skills [--target <codex|claude|all>] [--project] [--mode <copy|symlink>] [--dir <path>] [--yes]
125
- loopx init [--slug <slug>] [--enable-agent-delegation] [--auto-agent-delegation] [--agent-delegation-threshold <local|critic-only|parallel-review>]
126
- loopx clarify <slug> [--standard|--deep]
127
- loopx approve <slug> --from <stage> --to <stage>
128
- loopx plan [slug] [--interactive] [--deliberate]
129
- loopx build <slug> [--no-deslop]
130
- loopx build --from-review <review-report-path> [--no-deslop]
131
- loopx review <slug> [--reviewer <name>]
132
- loopx autopilot <slug> [--reviewer <name>]
201
+ loopx install-skills [--target <codex|claude|all>] [--project] [--mode <copy|symlink>] [--dir <path>] [--yes] [--dry-run] [--json]
202
+ loopx init [--slug <slug>] [--enable-agent-delegation] [--auto-agent-delegation] [--agent-delegation-threshold <local|critic-only|parallel-review>] [--json]
203
+ loopx clarify <slug> [--standard|--deep] [--json]
133
204
  loopx render [slug|--all]
134
205
  loopx status [slug] [--json]
206
+ loopx next <slug> [--json]
135
207
  loopx setup-context
136
- loopx doctor
208
+ loopx doctor [--json]
137
209
  loopx migrate
138
210
  loopx repair-install
139
211
  ```
140
212
 
213
+ 高级 runtime 命令:
214
+
215
+ ```bash
216
+ loopx help advanced
217
+ ```
218
+
219
+ 这些命令保留给 skills、hooks 和兼容路径。普通用户应跟随 `loopx status`、`loopx next` 和提示的 skill 命令。
220
+
221
+ ## 黄金路径
222
+
223
+ 最小完整首次使用路径:
224
+
225
+ ```bash
226
+ loopx install-skills --target all --dry-run
227
+ loopx install-skills --target all --yes
228
+ loopx doctor
229
+ loopx init --slug my-feature
230
+ loopx clarify my-feature
231
+ loopx status my-feature
232
+ loopx next my-feature
233
+ ```
234
+
235
+ `clarify` 之后,把控制权交给提示的 skill 命令,通常是 `$plan <slug>`。后续继续跟随 `loopx status <slug>` 或 `loopx next <slug>`,直到 `final-review` 和 `$finish` 完成收尾。
236
+
141
237
  ## 治理
142
238
 
143
239
  bundled skill resolver 位于: