@ai-content-space/loopx 0.2.4 → 0.2.8

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 (58) hide show
  1. package/README.md +108 -12
  2. package/README.zh-CN.md +109 -13
  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/design/loopx-skill-suite-v1-design.md +4 -4
  5. package/docs/loopx/memory/2026-06-09-stale-archive-hook-guidance.md +15 -0
  6. package/docs/loopx/memory/README.md +25 -0
  7. package/docs/loopx/plans/2026-06-08-finish-audit-change-window.md +933 -0
  8. package/docs/loopx/plans/2026-06-08-finish-learning-audit.md +410 -0
  9. package/docs/loopx/plans/2026-06-09-cli-onboarding-install-surface.md +1277 -0
  10. package/docs/loopx/plans/loopx-skill-suite-v1-implementation.md +1 -1
  11. package/docs/loopx/specs/installation.md +33 -0
  12. package/package.json +18 -2
  13. package/plugins/loopx/.codex-plugin/plugin.json +1 -1
  14. package/plugins/loopx/skills/clarify/SKILL.md +3 -3
  15. package/plugins/loopx/skills/debug/SKILL.md +1 -1
  16. package/plugins/loopx/skills/doc-readability/SKILL.md +1 -1
  17. package/plugins/loopx/skills/exec/SKILL.md +12 -2
  18. package/plugins/loopx/skills/final-review/SKILL.md +1 -1
  19. package/plugins/loopx/skills/finish/SKILL.md +39 -7
  20. package/plugins/loopx/skills/fix-review/SKILL.md +1 -1
  21. package/plugins/loopx/skills/go-style/SKILL.md +1 -1
  22. package/plugins/loopx/skills/kratos/SKILL.md +1 -1
  23. package/plugins/loopx/skills/{plan → plan-to-exec}/SKILL.md +5 -5
  24. package/plugins/loopx/skills/refactor-plan/SKILL.md +1 -1
  25. package/plugins/loopx/skills/review/SKILL.md +1 -1
  26. package/plugins/loopx/skills/spec/DESIGN_SPEC_TEMPLATE.md +2 -2
  27. package/plugins/loopx/skills/spec/SKILL.md +4 -4
  28. package/plugins/loopx/skills/subagent-exec/SKILL.md +14 -2
  29. package/plugins/loopx/skills/tdd/SKILL.md +1 -1
  30. package/plugins/loopx/skills/verify/SKILL.md +1 -1
  31. package/scripts/claude-workflow-hook.mjs +52 -3
  32. package/scripts/codex-workflow-hook.mjs +36 -15
  33. package/scripts/install-skills.mjs +58 -3
  34. package/scripts/verify-skills.mjs +83 -7
  35. package/skills/RESOLVER.md +4 -4
  36. package/skills/clarify/SKILL.md +3 -3
  37. package/skills/debug/SKILL.md +1 -1
  38. package/skills/doc-readability/SKILL.md +1 -1
  39. package/skills/exec/SKILL.md +12 -2
  40. package/skills/final-review/SKILL.md +1 -1
  41. package/skills/finish/SKILL.md +39 -7
  42. package/skills/fix-review/SKILL.md +1 -1
  43. package/skills/go-style/SKILL.md +1 -1
  44. package/skills/kratos/SKILL.md +1 -1
  45. package/skills/{plan → plan-to-exec}/SKILL.md +5 -5
  46. package/skills/refactor-plan/SKILL.md +1 -1
  47. package/skills/review/SKILL.md +1 -1
  48. package/skills/spec/DESIGN_SPEC_TEMPLATE.md +2 -2
  49. package/skills/spec/SKILL.md +4 -4
  50. package/skills/subagent-exec/SKILL.md +14 -2
  51. package/skills/tdd/SKILL.md +1 -1
  52. package/skills/verify/SKILL.md +1 -1
  53. package/src/cli.mjs +473 -86
  54. package/src/finish-runtime.mjs +1184 -0
  55. package/src/install-discovery.mjs +38 -1
  56. package/src/next-skill.mjs +10 -12
  57. package/src/workflow.mjs +21 -28
  58. package/skills/deepsearch/SKILL.md +0 -38
@@ -2,17 +2,72 @@
2
2
 
3
3
  import { installSkillsForTargets, verifyInstallTargets } from '../src/install-discovery.mjs';
4
4
 
5
+ function shouldSkipPostinstall(env = process.env) {
6
+ return env.LOOPX_SKIP_POSTINSTALL === '1' || env.LOOPX_POSTINSTALL === '0';
7
+ }
8
+
9
+ function skipPostinstallEnv(env = process.env) {
10
+ if (env.LOOPX_SKIP_POSTINSTALL === '1') {
11
+ return 'LOOPX_SKIP_POSTINSTALL';
12
+ }
13
+ if (env.LOOPX_POSTINSTALL === '0') {
14
+ return 'LOOPX_POSTINSTALL';
15
+ }
16
+ return null;
17
+ }
18
+
19
+ function targetNames(result) {
20
+ return Array.isArray(result.targets) && result.targets.length > 0 ? result.targets : Object.keys(result.results || {});
21
+ }
22
+
23
+ function count(result, key) {
24
+ return Object.values(result.results || {})
25
+ .reduce((sum, target) => sum + (Array.isArray(target?.[key]) ? target[key].length : 0), 0);
26
+ }
27
+
28
+ function printSummary(result, { checkOnly = false } = {}) {
29
+ console.log(`loopx ${checkOnly ? 'install check' : 'postinstall'}: ${result.ok === false ? 'attention needed' : 'ok'}`);
30
+ console.log(`targets: ${targetNames(result).join(', ')}`);
31
+ if (!checkOnly) {
32
+ console.log(`installed skills: ${count(result, 'installed')}`);
33
+ }
34
+ console.log(`conflicts: ${count(result, 'conflicts')}`);
35
+ console.log(`skipped user-modified: ${count(result, 'skipped')}`);
36
+ console.log('repair: loopx repair-install');
37
+ console.log('opt out: LOOPX_SKIP_POSTINSTALL=1');
38
+ console.log('disable hooks for one process: LOOPX_HOOKS=0');
39
+ console.log('details: node scripts/install-skills.mjs --json');
40
+ }
41
+
5
42
  async function main() {
43
+ const json = process.argv.includes('--json');
44
+ if (shouldSkipPostinstall()) {
45
+ if (json) {
46
+ console.log(JSON.stringify({
47
+ ok: true,
48
+ skipped: true,
49
+ reason: 'postinstall_disabled',
50
+ env: skipPostinstallEnv(),
51
+ }, null, 2));
52
+ } else {
53
+ console.log('loopx postinstall skipped: LOOPX_SKIP_POSTINSTALL=1 or LOOPX_POSTINSTALL=0');
54
+ }
55
+ return;
56
+ }
57
+
6
58
  const checkOnly = process.argv.includes('--check');
7
59
  const result = checkOnly ? await verifyInstallTargets(process.env) : await installSkillsForTargets(process.env);
8
60
  const ok = checkOnly ? result.ok : result.ok !== false;
9
61
  const payload = checkOnly ? result : { ok, targets: result.targets, results: result.results };
62
+ if (json) {
63
+ const stream = ok ? process.stdout : process.stderr;
64
+ stream.write(`${JSON.stringify(payload, null, 2)}\n`);
65
+ } else {
66
+ printSummary(payload, { checkOnly });
67
+ }
10
68
  if (!ok) {
11
- console.error(JSON.stringify(payload, null, 2));
12
69
  process.exitCode = 1;
13
- return;
14
70
  }
15
- console.log(JSON.stringify(payload, null, 2));
16
71
  }
17
72
 
18
73
  await main();
@@ -103,6 +103,16 @@ function assertContains(text, value, label) {
103
103
  assert.match(text, new RegExp(value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')), `${label} missing ${value}`);
104
104
  }
105
105
 
106
+ function publicArchiveCommandLines(text) {
107
+ return text
108
+ .split('\n')
109
+ .filter((line) => /^\s*(?:(?:[-*+]|\d+[.)])\s+)?`?loopx archive(?:\s|`|$)/.test(line));
110
+ }
111
+
112
+ function assertNoPublicArchiveCommandExposure(text, label) {
113
+ assert.deepEqual(publicArchiveCommandLines(text), [], `${label} should not expose archive runtime command`);
114
+ }
115
+
106
116
  async function assertPublicDocsAligned() {
107
117
  const readme = await readFile(join(repoRoot, 'README.md'), 'utf8');
108
118
  const readmeZh = await readFile(join(repoRoot, 'README.zh-CN.md'), 'utf8');
@@ -110,13 +120,10 @@ async function assertPublicDocsAligned() {
110
120
  'loopx install-skills',
111
121
  'loopx init',
112
122
  'loopx clarify',
113
- 'loopx approve',
114
- 'loopx plan',
115
- 'loopx build',
116
- 'loopx review',
117
- 'loopx autopilot',
118
123
  'loopx render',
119
124
  'loopx status',
125
+ 'loopx next',
126
+ 'loopx help advanced',
120
127
  'loopx setup-context',
121
128
  'loopx doctor',
122
129
  'loopx migrate',
@@ -127,8 +134,67 @@ async function assertPublicDocsAligned() {
127
134
  assertContains(readme, command, 'README.md');
128
135
  assertContains(readmeZh, command, 'README.zh-CN.md');
129
136
  }
130
- assert.doesNotMatch(readme, /loopx archive/, 'README.md should not expose archive runtime command');
131
- assert.doesNotMatch(readmeZh, /loopx archive/, 'README.zh-CN.md should not expose archive runtime command');
137
+ assert.deepEqual(
138
+ publicArchiveCommandLines([
139
+ 'loopx archive <slug>',
140
+ '- loopx archive <slug>',
141
+ '- `loopx archive <slug>`',
142
+ '1. loopx archive <slug>',
143
+ '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.',
144
+ ].join('\n')),
145
+ [
146
+ 'loopx archive <slug>',
147
+ '- loopx archive <slug>',
148
+ '- `loopx archive <slug>`',
149
+ '1. loopx archive <slug>',
150
+ ],
151
+ 'archive command exposure guard should catch public command lines without rejecting prose compatibility notes',
152
+ );
153
+ assertNoPublicArchiveCommandExposure(readme, 'README.md');
154
+ assertNoPublicArchiveCommandExposure(readmeZh, 'README.zh-CN.md');
155
+ assertContains(readme, 'local audit ledger', 'README.md');
156
+ assertContains(readme, '.loopx/finish/<audit-id>/', 'README.md');
157
+ assert.match(readme, /`none` means|none means/i, 'README.md missing none means');
158
+ assertContains(readme, 'docs/loopx/specs/', 'README.md');
159
+ assertContains(readme, 'Advanced runtime commands', 'README.md');
160
+ assertContains(readme, 'loopx help advanced', 'README.md');
161
+ assertContains(readme, 'Undo installed files', 'README.md');
162
+ assertContains(readme, 'Golden path', 'README.md');
163
+
164
+ assertContains(readmeZh, '本地 audit ledger', 'README.zh-CN.md');
165
+ assertContains(readmeZh, '.loopx/finish/<audit-id>/', 'README.zh-CN.md');
166
+ assertContains(readmeZh, '`none` 表示', 'README.zh-CN.md');
167
+ assertContains(readmeZh, 'docs/loopx/specs/', 'README.zh-CN.md');
168
+ assertContains(readmeZh, '高级 runtime 命令', 'README.zh-CN.md');
169
+ assertContains(readmeZh, 'loopx help advanced', 'README.zh-CN.md');
170
+ assertContains(readmeZh, '撤销已安装文件', 'README.zh-CN.md');
171
+ assertContains(readmeZh, '黄金路径', 'README.zh-CN.md');
172
+ for (const required of [
173
+ 'Quick start',
174
+ 'Human output is the default',
175
+ 'loopx install-skills --target all --dry-run',
176
+ 'LOOPX_SKIP_POSTINSTALL=1',
177
+ 'LOOPX_POSTINSTALL=0',
178
+ 'LOOPX_HOOKS=0',
179
+ 'Archive compatibility',
180
+ ]) {
181
+ assertContains(readme, required, 'README.md');
182
+ }
183
+ for (const required of [
184
+ '快速开始',
185
+ '默认输出面向人类',
186
+ 'loopx install-skills --target all --dry-run',
187
+ 'LOOPX_SKIP_POSTINSTALL=1',
188
+ 'LOOPX_POSTINSTALL=0',
189
+ 'LOOPX_HOOKS=0',
190
+ 'Archive 兼容性',
191
+ ]) {
192
+ assertContains(readmeZh, required, 'README.zh-CN.md');
193
+ }
194
+ assert.doesNotMatch(readme, /`loopx install-skills --dry-run`/, 'README.md should use explicit dry-run target');
195
+ assert.doesNotMatch(readmeZh, /`loopx install-skills --dry-run`/, 'README.zh-CN.md should use explicit dry-run target');
196
+ assert.doesNotMatch(readme, /Public finish audit commands:/, 'README.md should not promote finish runtime commands as public primary flow');
197
+ assert.doesNotMatch(readmeZh, /公开的 finish audit 命令:/, 'README.zh-CN.md should not promote finish runtime commands as public primary flow');
132
198
 
133
199
  const releaseNotesRoot = join(repoRoot, 'docs', 'release-notes');
134
200
  const releaseNotes = existsSync(releaseNotesRoot)
@@ -179,6 +245,16 @@ async function assertSkill(skillName, resolverText) {
179
245
  assert.equal(pluginManifest.version, packageJson.version, 'plugin manifest version must match package.json');
180
246
  assert.equal(existsSync(resolverPath), true, 'skills/RESOLVER.md missing');
181
247
  assert.equal(packageJson.files.includes('scripts/claude-workflow-hook.mjs'), true, 'npm package must include claude-workflow-hook.mjs');
248
+ assert.equal(packageJson.files.includes('skills/'), false, 'npm package must not include broad skills/ surface');
249
+ assert.equal(packageJson.files.includes('skills/RESOLVER.md'), true, 'npm package must include skills/RESOLVER.md');
250
+ for (const skillName of LOOPX_BUNDLED_SKILLS) {
251
+ assert.equal(packageJson.files.includes(`skills/${skillName}/`), true, `npm package missing bundled skill ${skillName}`);
252
+ }
253
+ assert.deepEqual(
254
+ packageJson.files.filter((path) => path.startsWith('skills/')).sort(),
255
+ ['skills/RESOLVER.md', ...LOOPX_BUNDLED_SKILLS.map((skillName) => `skills/${skillName}/`)].sort(),
256
+ 'npm package skills/ surface must exactly match bundled skills plus resolver',
257
+ );
182
258
 
183
259
  for (const relativePath of markdownPaths) {
184
260
  await assertMarkdownStructure(relativePath);
@@ -10,7 +10,7 @@ Read the selected skill file before acting. If multiple skills match, read every
10
10
  |---|---|
11
11
  | Ambiguous request, unclear scope, non-goals, decision boundaries, requirements interview | `skills/clarify/SKILL.md` |
12
12
  | Design方案, technical design, API/data/state/security decisions, or architecture tradeoffs | `skills/spec/SKILL.md` |
13
- | Approved requirements or design need a bite-sized implementation plan | `skills/plan/SKILL.md` |
13
+ | Approved requirements or design need a bite-sized implementation plan | `skills/plan-to-exec/SKILL.md` |
14
14
  | Approved plan has independent tasks and should run with subagents plus staged review | `skills/subagent-exec/SKILL.md` |
15
15
  | Approved plan should run inline or without subagent-first execution | `skills/exec/SKILL.md` |
16
16
  | Completed task, major feature, or pre-merge work needs independent code review | `skills/review/SKILL.md` |
@@ -34,8 +34,8 @@ Read the selected skill file before acting. If multiple skills match, read every
34
34
 
35
35
  1. If intent, scope, non-goals, or decision boundaries are unresolved, use `clarify`.
36
36
  2. If remaining questions are product behavior, API, state, data, permission, migration, compatibility, or architecture decisions, use `spec`.
37
- 3. If remaining questions are local implementation choices, use `plan`.
38
- 4. `plan` writes `docs/loopx/plans/*.md` and then offers `subagent-exec` or `exec`.
37
+ 3. If remaining questions are local implementation choices, use `plan-to-exec`.
38
+ 4. `plan-to-exec` writes `docs/loopx/plans/*.md` and then offers `subagent-exec` or `exec`.
39
39
  5. Use `subagent-exec` when subagents are available and the plan has independent tasks.
40
40
  6. Use `exec` when the user chooses inline execution or subagents are unavailable.
41
41
  7. Use `review` to request code review of completed task or checkpoint work.
@@ -43,7 +43,7 @@ Read the selected skill file before acting. If multiple skills match, read every
43
43
  9. Use `fix-review` only after feedback exists.
44
44
  10. Use `finish` only after implementation, final review, and verification are complete.
45
45
  11. Use `refactor-plan` for behavior-preserving refactor planning. If the refactor changes external behavior or contracts, route to `clarify` or `spec`.
46
- 12. Use `doc-readability` for document assessment or rewriting, especially PRDs, requirements docs, specs, meeting notes, and AI-like prose. If the document is a source artifact for implementation, assess or rewrite it first, then route clarified implementation work back through `clarify`, `spec`, or `plan`.
46
+ 12. Use `doc-readability` for document assessment or rewriting, especially PRDs, requirements docs, specs, meeting notes, and AI-like prose. If the document is a source artifact for implementation, assess or rewrite it first, then route clarified implementation work back through `clarify`, `spec`, or `plan-to-exec`.
47
47
  13. Treat `tdd`, `debug`, `verify`, `doc-readability`, `go-style`, and `kratos` as support lenses unless the user explicitly invokes them directly.
48
48
 
49
49
  ## Deterministic Guard
@@ -3,7 +3,7 @@ name: clarify
3
3
  description: "Grills ambiguous loopx work until material questions are answered, then routes to spec or plan using a design gate. Not for clear implementation tasks, approved specs, or code changes."
4
4
  when_to_use: "clarify, requirements, ambiguous request, unclear scope, non-goals, decision boundaries, acceptance criteria, 需求澄清, 范围不清"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # loopx Clarify
@@ -63,10 +63,10 @@ For `needs_spec`, immediately use the `spec` skill with the clarification contex
63
63
  Then stop before implementation planning and report:
64
64
 
65
65
  ```text
66
- $plan docs/loopx/design/<需求名>需求设计文档.md
66
+ $plan-to-exec docs/loopx/design/<需求名>需求设计文档.md
67
67
  ```
68
68
 
69
- For `direct_to_plan`, hand off to the `plan` skill with the clarification context bundle as the source. `plan` writes:
69
+ For `direct_to_plan`, hand off to the `plan-to-exec` skill with the clarification context bundle as the source. `plan-to-exec` writes:
70
70
 
71
71
  - `docs/loopx/plans/YYYY-MM-DD-<feature-name>.md`
72
72
 
@@ -3,7 +3,7 @@ name: debug
3
3
  description: "Finds root cause for bugs, failing tests, build failures, regressions, and unexpected behavior before fixes. Not for new feature planning or routine code review."
4
4
  when_to_use: "debug, bug, test failure, build failure, regression, unexpected behavior, root cause, 报错, 失败, 回归, 排查"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Systematic Debugging
@@ -3,7 +3,7 @@ name: doc-readability
3
3
  description: "Use when evaluating, rewriting, or editing documents for human readability, unclear viewpoints, AI-like prose, bloated specs, PRDs, requirements docs, meeting notes, strategy docs, or internal knowledge-base articles. Not for code review, implementation planning, or file-format conversion."
4
4
  when_to_use: "document readability, PRD assessment, requirements gaps, AI-like prose, unclear viewpoint, rewrite docs, editing docs, 文档可读性, 去AI味, 需求文档评估"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Doc Readability
@@ -3,7 +3,7 @@ name: exec
3
3
  description: "Executes a written loopx implementation plan sequentially with review checkpoints. Not for unclear plans, missing requirements, or subagent-first execution."
4
4
  when_to_use: "written implementation plan, inline execution, sequential plan execution, review checkpoints, no subagent lane"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Exec
@@ -24,6 +24,16 @@ Load plan, review critically, execute all tasks, report when complete.
24
24
  3. If concerns: Raise them with your human partner before starting
25
25
  4. If no concerns: create update_plan and proceed
26
26
 
27
+ ### Step 1.5: Record Finish Baseline
28
+
29
+ Before editing files or running the first task, run:
30
+
31
+ ```bash
32
+ loopx finish-start <slug> --source <plan-path>
33
+ ```
34
+
35
+ Use the plan filename slug when no workflow slug is available. This preserves the starting `HEAD` for finish learning/spec audit after the execution commits code.
36
+
27
37
  ### Step 2: Execute Tasks
28
38
 
29
39
  For each task:
@@ -70,7 +80,7 @@ After all tasks complete and verified:
70
80
  ## Integration
71
81
 
72
82
  **Required workflow skills:**
73
- - **loopx:plan** - Creates the plan this skill executes
83
+ - **loopx:plan-to-exec** - Creates the plan this skill executes
74
84
  - **loopx:final-review** - Final whole-feature runtime and integration risk review
75
85
  - **loopx:fix-review** - Handles final-review feedback before finish
76
86
  - **loopx:finish** - Complete development after all tasks
@@ -3,7 +3,7 @@ name: final-review
3
3
  description: "Performs whole-feature review after implementation and staged task review. Not for per-task review, unresolved scope, implementation, or pure documentation polish."
4
4
  when_to_use: "final-review, final code review, whole feature review, integration review, pre-finish review, after subagent-exec, runtime risk review, 最终评审"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Final Review
@@ -3,7 +3,7 @@ name: finish
3
3
  description: "Finishes completed loopx development work after tests pass by presenting merge, PR, keep, or discard options. Not for unfinished work or failing verification."
4
4
  when_to_use: "implementation complete, tests pass, finish branch, create pull request, merge locally, keep branch, discard work"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Finish
@@ -66,18 +66,33 @@ git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
66
66
 
67
67
  Or ask: "This branch split from main - is that correct?"
68
68
 
69
- ### Step 4: Learning Extraction
69
+ ### Step 4: Audit-First Learning Extraction
70
70
 
71
- Run learning extraction before presenting merge, PR, keep, or discard options.
71
+ Run `finish-audit` before presenting merge, PR, keep, or discard options.
72
+
73
+ `loopx:exec` and `loopx:subagent-exec` should have run `finish-start` before implementation. `finish-audit` uses that baseline to preserve committed `baseline..HEAD` evidence after the working tree is clean. It may also generate `audit.extraction_candidates` as draft memory/spec review prompts. These drafts are not automatically written to memory or specs.
72
74
 
73
75
  Allowed inputs:
74
- - current git diff
76
+ - `finish-state.json` `audit.change_window`, especially `baseline..HEAD` commits and changed files
77
+ - `finish-state.json` `audit.extraction_candidates`
78
+ - current uncommitted git diff and `git status --short`
75
79
  - executed verification output
76
80
  - plan, spec, and review artifacts used in this task
77
81
  - explicit user decisions in the current conversation
78
82
  - existing `.loopx/memory/MEMORY.md` and `.loopx/memory/index.jsonl`
83
+ - existing `docs/loopx/memory/*.md`
79
84
  - existing `docs/loopx/specs/*.md`
80
85
 
86
+ An empty git diff does not mean there is no learning candidate. When `audit.change_window.commit_count > 0`, inspect the committed range before deciding memory/spec candidates. "Already committed" is not a rejection reason; reject only when the committed change window contains no durable behavior, contract, invariant, pitfall, or user decision worth preserving.
87
+
88
+ Read the audit state from `.loopx/finish/<audit-id>/finish-state.json` before deciding what to record.
89
+ After learning extraction, update `finish-state.json` before any `done` record:
90
+ - set `status` to `"audited"`
91
+ - for every `audit.extraction_candidates[]` item, add either a matching `accepted_candidates` with evidence or a matching `rejected_candidates[]` item with `rejection_reason`
92
+ - when no extraction candidates exist and no candidate is accepted, replace `no_candidates_reason` with a specific reason
93
+
94
+ `finish-record --status done` will reject an audit while generated extraction candidates remain unreviewed.
95
+
81
96
  Learning extraction priority:
82
97
  1. Durable behavior, contracts, or constraints proven by the implementation
83
98
  2. State, file, CLI, API, install, migration, compatibility, or test invariants
@@ -87,11 +102,19 @@ Learning extraction priority:
87
102
 
88
103
  Do not infer durable rules from agent intuition alone. Do not promote unverified implementation details.
89
104
 
105
+ When the audit has no candidates, record `none` with the scanned inputs and a reason in `no_candidates_reason`.
106
+ Keep rejected candidates explicit when draft candidates are not accepted.
107
+ Accepted candidates require evidence from the audit state. Rejected candidates require reasons.
108
+ choice recording must persist the user's completion choice through `finish-record` before presenting the final completion outcome.
109
+
90
110
  #### Memory
91
111
 
92
- Memory is local, agent-queryable project context. It is not repo-tracked by default.
112
+ Memory has two scopes:
113
+
114
+ - local memory: agent-queryable project context for one machine; not repo-tracked
115
+ - shared memory: lightweight project knowledge that should follow a user across machines; repo-tracked
93
116
 
94
- Use:
117
+ Use local memory for machine-local facts, short-lived handoffs, and context that is useful only to the current agent environment:
95
118
 
96
119
  ```text
97
120
  .loopx/memory/MEMORY.md
@@ -104,7 +127,13 @@ Use:
104
127
 
105
128
  `index.jsonl` is a curated active index, not an append-only history. It should point only to active memory cards worth querying.
106
129
 
107
- Use memory only for facts that will help a future agent avoid rework, avoid mistakes, or preserve a decision. Do not record process negatives such as "no spec promotion".
130
+ Use shared memory for concise, evidence-backed notes that are useful across machines but not stable enough for specs:
131
+
132
+ ```text
133
+ docs/loopx/memory/
134
+ ```
135
+
136
+ Use memory only for facts that will help a future agent avoid rework, avoid mistakes, or preserve a decision. Do not record process negatives such as "no spec promotion". Do not store secrets, raw conversation logs, or machine-local paths in shared memory.
108
137
 
109
138
  One finish run may write 0-3 active memory cards. If more learnings appear, consolidate, promote to spec, archive stale cards, or skip low-signal items.
110
139
 
@@ -123,6 +152,8 @@ Allowed memory `type` values:
123
152
 
124
153
  Finish may automatically update `.loopx/memory/MEMORY.md`, `.loopx/memory/index.jsonl`, and active memory cards. The final response must list the memory changes.
125
154
 
155
+ When accepting an `audit.extraction_candidates[]` item with `kind: "memory"` and `scope: "shared"`, write the accepted note under `docs/loopx/memory/` so it is visible in the git diff. Promote shared memory to `docs/loopx/specs/` when it becomes a durable rule that planning or review should depend on.
156
+
126
157
  #### Spec Candidates
127
158
 
128
159
  Spec extraction is conditional. Run the audit every time, but write spec candidates only when the task produced stable, shared, reusable project rules.
@@ -295,6 +326,7 @@ Use this shape:
295
326
  ```text
296
327
  Memory:
297
328
  - updated: .loopx/memory/MEMORY.md
329
+ - shared: docs/loopx/memory/<file>.md
298
330
  - entries: <N> added, <N> archived
299
331
  - summary:
300
332
  - <high-signal memory change>
@@ -3,7 +3,7 @@ name: fix-review
3
3
  description: "Handles received code review feedback with verification, technical evaluation, pushback, and one-item-at-a-time fixes. Not for requesting a new review or implementing unrelated changes."
4
4
  when_to_use: "fix-review, received code review feedback, review comments, reviewer suggestions, requested changes, 处理评审意见"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Fix Review
@@ -3,7 +3,7 @@ name: go-style
3
3
  description: "Applies loopx Go coding style for .go edits, tests, errors, context, naming, and interface boundaries. Not for non-Go code or Kratos-specific architecture by itself."
4
4
  when_to_use: "go-style, Go, golang, .go files, go tests, gofmt, idiomatic Go, Go style, Go 代码"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Go Style
@@ -3,7 +3,7 @@ name: kratos
3
3
  description: "Supports Go-Kratos microservices, proto/buf APIs, service/biz/data layers, middleware, auth, config, and troubleshooting. Not for generic Go style alone."
4
4
  when_to_use: "kratos, Go-Kratos, proto, buf, service layer, biz layer, data layer, middleware, auth, config, Kratos 微服务"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Kratos
@@ -1,13 +1,13 @@
1
1
  ---
2
- name: plan
2
+ name: plan-to-exec
3
3
  description: "Creates bite-sized implementation plans from approved requirements, clarify output, or design specs with exact files, tests, commands, expected output, and execution handoff. Not for unresolved requirements, design decisions, PRD generation, or code changes."
4
- when_to_use: "plan, implementation plan, execution plan, task breakdown, approved requirements, approved design spec, docs/loopx/design, 实施计划, 执行计划, 任务拆分"
4
+ when_to_use: "plan-to-exec, plan, implementation plan, execution plan, task breakdown, approved requirements, approved design spec, docs/loopx/design, 实施计划, 执行计划, 任务拆分"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  argument-hint: "<design spec path or feature name>"
8
8
  ---
9
9
 
10
- # loopx Plan
10
+ # loopx Plan-To-Exec
11
11
 
12
12
  ## Overview
13
13
 
@@ -23,7 +23,7 @@ Use this skill after requirements are clear. The source may be:
23
23
 
24
24
  Do not re-decide product or architecture. If the source is incomplete, contradictory, or missing product behavior, API, data, state, permission, migration, compatibility, or architecture decisions, return to `clarify` or `spec` instead of filling those gaps inside `plan`.
25
25
 
26
- **Announce at start:** "I'm using the plan skill to create the implementation plan."
26
+ **Announce at start:** "I'm using the plan-to-exec skill to create the implementation plan."
27
27
 
28
28
  **Save plans to:** `docs/loopx/plans/YYYY-MM-DD-<feature-name>.md`
29
29
 
@@ -3,7 +3,7 @@ name: refactor-plan
3
3
  description: "Creates a behavior-preserving refactor plan with user interview, repo evidence, tiny commits, scope boundaries, and testing decisions. Not for feature changes or immediate implementation."
4
4
  when_to_use: "refactor-plan, refactor request, refactoring RFC, tiny commits, behavior-preserving cleanup, architecture cleanup, 重构计划"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  This skill will be invoked when the user wants to create a refactor request. You should go through the steps below. You may skip steps if you don't consider them necessary.
@@ -3,7 +3,7 @@ name: review
3
3
  description: "Dispatches a loopx code reviewer subagent against a concrete git range and requirements. Not for implementation, planning, or unresolved review scope."
4
4
  when_to_use: "request code review, completed task review, major feature review, pre-merge review, subagent code quality check"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Review
@@ -299,13 +299,13 @@
299
299
 
300
300
  ### 10.5 Planning Handoff
301
301
 
302
- - `plan` 可以决定:
302
+ - `plan-to-exec` 可以决定:
303
303
  - 必须返回 `spec` 的事项:
304
304
  - 必须返回 `clarify` 的事项:
305
305
  - 推荐下一步:
306
306
 
307
307
  ```text
308
- $plan docs/loopx/design/<需求名>需求设计文档.md
308
+ $plan-to-exec docs/loopx/design/<需求名>需求设计文档.md
309
309
  ```
310
310
 
311
311
  ## 十一、QA
@@ -3,7 +3,7 @@ name: spec
3
3
  description: "Writes software design specs from already-clarified requirements, including solution approach, architecture outline, detailed design, tradeoffs, verification design, and handoff context. Not for unresolved requirements, PRD generation, implementation task planning, or code changes."
4
4
  when_to_use: "spec, design spec, technical design, design proposal, detailed design, architecture design, 设计方案, 概要设计, 详细设计, 技术方案"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # loopx Spec
@@ -63,14 +63,14 @@ The Markdown spec must include these sections:
63
63
  - `十、排期与规划`
64
64
  - `十一、QA`
65
65
 
66
- The `十、排期与规划` section must include a `Planning Handoff` subsection stating what `plan` may decide without re-opening design and what must return to `clarify` or `spec`.
66
+ The `十、排期与规划` section must include a `Planning Handoff` subsection stating what `plan-to-exec` may decide without re-opening design and what must return to `clarify` or `spec`.
67
67
 
68
68
  ## Handoff
69
69
 
70
70
  After the spec is complete, recommend:
71
71
 
72
72
  ```text
73
- $plan docs/loopx/design/<需求名>需求设计文档.md
73
+ $plan-to-exec docs/loopx/design/<需求名>需求设计文档.md
74
74
  ```
75
75
 
76
- Use `plan` only after the design document is internally consistent and all material requirements questions are resolved.
76
+ Use `plan-to-exec` only after the design document is internally consistent and all material requirements questions are resolved.
@@ -3,7 +3,7 @@ name: subagent-exec
3
3
  description: "Executes approved loopx implementation plans with fresh subagents per independent task and staged review. Not for planning, unclear requirements, or tightly coupled edits."
4
4
  when_to_use: "approved implementation plan, independent tasks, subagent execution, staged spec review, code quality review, parallel-capable execution"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Subagent Exec
@@ -63,11 +63,13 @@ digraph process {
63
63
  "Mark task complete in update_plan" [shape=box];
64
64
  }
65
65
 
66
+ "Record finish baseline with loopx finish-start <slug> --source <plan-path>" [shape=box];
66
67
  "Read plan, extract all tasks with full text, note context, create update_plan" [shape=box];
67
68
  "More tasks remain?" [shape=diamond];
68
69
  "Use loopx:final-review for entire implementation" [shape=box];
69
70
  "Use loopx:finish" [shape=box style=filled fillcolor=lightgreen];
70
71
 
72
+ "Record finish baseline with loopx finish-start <slug> --source <plan-path>" -> "Read plan, extract all tasks with full text, note context, create update_plan";
71
73
  "Read plan, extract all tasks with full text, note context, create update_plan" -> "Dispatch implementer subagent (./implementer-prompt.md)";
72
74
  "Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer subagent asks questions?";
73
75
  "Implementer subagent asks questions?" -> "Answer questions, provide context" [label="yes"];
@@ -89,6 +91,16 @@ digraph process {
89
91
  }
90
92
  ```
91
93
 
94
+ ### Step 0: Record Finish Baseline
95
+
96
+ Before dispatching the first implementer, run:
97
+
98
+ ```bash
99
+ loopx finish-start <slug> --source <plan-path>
100
+ ```
101
+
102
+ Use the plan filename slug when no workflow slug is available. This preserves the starting `HEAD` so `finish-audit` can inspect `baseline..HEAD` even after implementers commit their work and the current `git diff` is empty.
103
+
92
104
  ## Model Selection
93
105
 
94
106
  Use the least powerful model that can handle each role to conserve cost and increase speed.
@@ -271,7 +283,7 @@ Done!
271
283
 
272
284
  **Required workflow skills:**
273
285
 
274
- - **loopx:plan** - Creates the plan this skill executes
286
+ - **loopx:plan-to-exec** - Creates the plan this skill executes
275
287
  - **loopx:review** - Code review template for reviewer subagents
276
288
  - **loopx:final-review** - Final whole-feature runtime and integration risk review
277
289
  - **loopx:finish** - Complete development after all tasks
@@ -3,7 +3,7 @@ name: tdd
3
3
  description: "Guides feature and bugfix implementation through a failing test before production code and red-green-refactor discipline. Not for generated files or throwaway prototypes."
4
4
  when_to_use: "tdd, failing test first, feature implementation, bugfix, regression test, red green refactor, 测试先行"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Test-Driven Development (TDD)
@@ -3,7 +3,7 @@ name: verify
3
3
  description: "Requires fresh verification evidence before claiming work is complete, fixed, passing, review-ready, or ready to commit. Not for speculative confidence or stale results."
4
4
  when_to_use: "verify, completion claim, fixed claim, tests pass, review-ready, commit, fresh evidence, 验证, 完成前检查"
5
5
  metadata:
6
- version: "0.2.4"
6
+ version: "0.2.8"
7
7
  ---
8
8
 
9
9
  # Verification Before Completion