@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
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: doc-readability
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
+ when_to_use: "document readability, PRD assessment, requirements gaps, AI-like prose, unclear viewpoint, rewrite docs, editing docs, 文档可读性, 去AI味, 需求文档评估"
5
+ metadata:
6
+ version: "0.2.7"
7
+ ---
8
+
9
+ # Doc Readability
10
+
11
+ ## Principle
12
+
13
+ Readable documents help a specific reader make a decision, execute work, or verify a claim with minimal reconstruction. Do not confuse readability with shortness or smooth prose. Preserve factual meaning, domain vocabulary, and useful specificity while removing noise.
14
+
15
+ ## First Move
16
+
17
+ Read the actual document before judging it. If the document is a URL, cloud doc, wiki page, local file, PDF, or exported artifact, fetch or read the content with the appropriate available tool. If only an excerpt is provided, state that the assessment is based on the excerpt.
18
+
19
+ Start by inferring:
20
+
21
+ | Question | Why it matters |
22
+ |---|---|
23
+ | Who is the reader? | Reviewers, engineers, operators, executives, and future maintainers need different structures. |
24
+ | What job must the document do? | PRDs, engineering specs, SOPs, decision memos, and general notes have different standards. |
25
+ | What is the main claim? | If the claim is hard to state in one sentence, the document likely has a structure problem. |
26
+ | What action should follow? | Readability is poor when the reader cannot tell what to do next. |
27
+
28
+ If these are clear from the request and document, use them to make a recommendation. The document type still needs user confirmation unless the user explicitly asks for a quick assessment or says to use judgment.
29
+
30
+ ## Setup Flow
31
+
32
+ User choices override inference. Support explicit inputs such as:
33
+
34
+ ```text
35
+ Document type: engineering spec
36
+ Reader: engineering reviewers
37
+ Mode: assessment only
38
+ Strictness: review-ready
39
+ ```
40
+
41
+ Do not turn setup into a form. Use this order:
42
+
43
+ 1. Confirm document type first. If the user has not explicitly specified document type, ask Step 1 before evaluating. Do not proceed based only on inference.
44
+ 2. If the document appears to mix multiple types, ask which lens should be primary. Do not silently choose the primary type.
45
+ 3. After document type is chosen, read enough of the document to judge its actual condition: title, headings, first screen, conclusion, and key sections. For long documents, sample the main path and high-risk sections.
46
+ 4. Only after reading the document may the agent recommend an action mode. Do not recommend assessment-only, targeted suggestions, or rewrite before reading the document.
47
+ 5. Recommendations must be dynamic, based on the user request, chosen document type, document content, headings, visible structure, and previous user choices.
48
+ 6. Do not hard-code a default recommendation in the skill.
49
+ 7. If the user says "quick assessment", "use your judgment", "don't ask", or equivalent, proceed with inference and state assumptions.
50
+
51
+ Ask setup questions sequentially:
52
+
53
+ ```text
54
+ I want to confirm the document type. Based on the title and headings, I would treat this as "...", because ...
55
+
56
+ Which document type should I use?
57
+ 1. Engineering spec / interface contract / rules document
58
+ 2. Requirements document / PRD
59
+ 3. Engineering design document
60
+ 4. SOP / operating procedure
61
+ 5. Decision memo
62
+ 6. Research / analysis document
63
+ 7. Meeting notes / discussion record
64
+ 8. Postmortem / RCA
65
+ 9. Project plan / roadmap
66
+ 10. General note / knowledge-base article
67
+ ```
68
+
69
+ After the user chooses the type, read the document. Then decide whether action mode needs confirmation:
70
+
71
+ ```text
72
+ I have read the document's main path. Given the chosen type and the document's actual condition, I recommend "...", because ...
73
+
74
+ How should I handle it?
75
+ 1. Assessment only
76
+ 2. Assessment plus targeted improvement suggestions
77
+ 3. Assessment, then rewrite only if there are blocking issues
78
+ 4. Rewrite directly
79
+ ```
80
+
81
+ Ask strictness only when it would change the result:
82
+
83
+ ```text
84
+ Strictness will affect this assessment. I recommend "...", because ...
85
+
86
+ Which strictness should I use?
87
+ 1. Usable for internal handoff
88
+ 2. Review-ready
89
+ 3. Publication-ready
90
+ ```
91
+
92
+ If strictness is not worth asking, choose a sensible default and state it briefly.
93
+
94
+ When the confirmed document type is `Requirements document / PRD`, read `references/prd.md` before assessment or rewrite. Use it to check requirement completeness and testability, not just prose clarity.
95
+
96
+ ## Document Types
97
+
98
+ Use the document type to set the evaluation bar.
99
+
100
+ | Type | Readability standard |
101
+ |---|---|
102
+ | Requirements / PRD | Reader can identify problem, users, goals, non-goals, scope, workflows, requirements, acceptance criteria, priorities, and open questions. Also read `references/prd.md` for PRD-specific completeness checks. |
103
+ | Engineering design | Reader can identify context, proposed design, key decisions, rejected alternatives, contracts, data flow, failure modes, rollout, and boundaries. |
104
+ | Engineering spec / interface contract / rules document | Reader can identify the first-screen conclusion, main decision path, canonical rules, field/status definitions, and where details live. Long tables, enum lists, field contracts, state tables, and long sections are acceptable when they are locatable and support implementation. Judge clarity of path and lookup, not shortness. |
105
+ | SOP / operating procedure | Reader can identify trigger, owner, prerequisites, step order, checks, exceptions, and escalation path. |
106
+ | Decision memo | Reader can identify recommendation, rationale, tradeoffs, risks, decision owner, and next action. |
107
+ | Research / analysis | Reader can identify question, method, evidence, conclusion, confidence, limitations, and implications. |
108
+ | Meeting notes / discussion record | Reader can identify decisions, unresolved questions, owners, due dates, and context needed later. |
109
+ | Postmortem / RCA | Reader can identify impact, timeline, root cause, contributing factors, fixes, owners, and prevention checks. |
110
+ | Project plan / roadmap | Reader can identify objective, milestones, dependencies, owners, risks, dates, and decision points. |
111
+ | General note / knowledge-base article | Reader can identify topic, takeaway, section map, and why each section exists. |
112
+
113
+ If a document mixes types, name the primary and secondary type. Judge the primary reading path first; suggest moving secondary material to an appendix or companion doc only when it interferes with the main job.
114
+
115
+ ## Diagnostic Rubric
116
+
117
+ Evaluate across these dimensions:
118
+
119
+ | Dimension | Good | Poor |
120
+ |---|---|---|
121
+ | Viewpoint | The document makes defensible claims and repeats them consistently. | It lists related facts without choosing what matters. |
122
+ | Reader path | The reader can predict where conclusions, rules, examples, and details live. | Background, rules, fields, cases, and tasks are mixed together. |
123
+ | Information hierarchy | Important decisions appear first; details support them. | Long tables and sections force the reader to synthesize conclusions manually. |
124
+ | Actionability | Owners, timing, inputs, outputs, states, and exceptions are concrete. | Sentences say "support", "process", "handle", or "optimize" without operational meaning. |
125
+ | Density | Each paragraph changes what the reader knows or can do. | Repeated sentence frames and generic transitions create drag. |
126
+ | Boundary clarity | Scope, non-goals, risks, blockers, and "not automatic" rules are explicit. | Boundaries are scattered, softened, or buried after implementation detail. |
127
+ | Human voice | The prose shows judgment, tradeoffs, and emphasis. | The prose is neutral, padded, symmetric, and unwilling to choose. |
128
+
129
+ Lead with a practical verdict in the user's language: `Readable`, `Partly readable`, or `Hard to read`.
130
+
131
+ Separate findings by severity:
132
+
133
+ | Severity | Meaning |
134
+ |---|---|
135
+ | Blocking | The target reader cannot understand the conclusion, decision path, required action, or authoritative rule. This usually requires restructuring or rewriting. |
136
+ | Important | The document is usable, but readers will waste time or may implement inconsistently. Recommend focused changes. |
137
+ | Optional | The document can be improved, but the issue does not block review or execution. Do not present optional polish as readability failure. |
138
+
139
+ For an already rewritten or structured document, use this severity split instead of listing every possible flaw as a main obstacle.
140
+
141
+ ## AI-Like Smells
142
+
143
+ Treat these as signals to tighten or restructure:
144
+
145
+ - Broad openings like "This document is used to..." without a decision.
146
+ - Repeated section patterns that say the same thing for every case.
147
+ - Tables whose cells are long paragraphs.
148
+ - Grammatically parallel bullets that are not intellectually prioritized.
149
+ - Generic terms like `support`, `process`, `optimize`, `capability`, `workflow`, `closed loop`, `improve`, `ensure`.
150
+ - Every section ending with "notes" that restate prior content.
151
+ - Long chains of "need to / can / generate / receive / process" without owner, timing, or output.
152
+ - Balanced summaries that avoid saying "do this", "do not do this", or "this is the rule".
153
+
154
+ Do not remove domain terms merely because they are technical. Remove vagueness, not expertise.
155
+
156
+ ## Rewrite Strategy
157
+
158
+ Choose structure by document job:
159
+
160
+ | Job | Preferred shape |
161
+ |---|---|
162
+ | Requirements / PRD | Problem -> users -> goals/non-goals -> scope -> workflows -> requirements -> acceptance criteria -> open questions |
163
+ | Engineering design | Context -> decision -> architecture -> alternatives -> contracts -> data flow -> failure modes -> rollout |
164
+ | Engineering spec / contract / rules | Conclusion -> hard rules -> decision path -> canonical definitions -> field/status contracts -> examples -> appendix |
165
+ | SOP | Trigger -> owner -> prerequisites -> steps -> checks -> exceptions -> escalation |
166
+ | Decision memo | Verdict -> decisions -> tradeoffs -> risks -> next action -> appendix |
167
+ | Research / analysis | Question -> method -> evidence -> findings -> confidence -> limitations -> implications |
168
+ | Meeting notes | Context -> decisions -> action items -> open questions -> reference notes |
169
+ | Postmortem / RCA | Impact -> timeline -> root cause -> contributing factors -> fixes -> prevention |
170
+ | General note / KB | Orientation -> key takeaway -> section map -> details |
171
+
172
+ For long documents, do not polish in place first. Extract the spine:
173
+
174
+ 1. One-sentence main claim.
175
+ 2. Three to seven decisions or rules.
176
+ 3. Who owns each action.
177
+ 4. Which details belong in appendix/reference.
178
+ 5. Which repeated sections can share one template.
179
+
180
+ Then rewrite only within the user-approved action mode.
181
+
182
+ ## Output Rules
183
+
184
+ Match the user's requested mode. Use natural headings in the user's language. Do not expose rigid labels like `Main claim I extracted`, `Main reading obstacles`, or `Rewritten version` unless the user asks for a machine-readable template.
185
+
186
+ For assessment, cover:
187
+
188
+ - Chosen or inferred setup.
189
+ - Readability verdict.
190
+ - Core viewpoint extracted from the document.
191
+ - Blocking issues, important improvements, and optional polish.
192
+ - Whether rewrite is recommended.
193
+
194
+ Rewrite control:
195
+
196
+ - If mode is `assessment only`, do not output a rewritten version. State whether rewrite is recommended.
197
+ - If mode is `assessment plus targeted suggestions`, provide focused changes, not a full rewrite.
198
+ - If mode is `rewrite only if blocking`, provide a rewritten version only when blocking issues exist.
199
+ - If mode is `rewrite directly`, rewrite directly with a short diagnosis first.
200
+ - For long documents, rewrite the most important section first unless the user explicitly asks for the full document.
201
+
202
+ ## Editing Rules
203
+
204
+ - Lead with conclusions and rules before explanation.
205
+ - Prefer prose over a table when table cells become paragraphs.
206
+ - Split source-of-truth rules from implementation details.
207
+ - Make negative rules explicit: "do not auto-post cash", "do not rewrite historical trades", "do not send Plan before confirmation".
208
+ - Replace repeated prose with one shared rule plus event-specific exceptions.
209
+ - Keep strong domain nouns, exact dates, fields, statuses, and enumerations.
210
+ - Preserve real uncertainty, but name what is unknown and who resolves it.
211
+ - Remove performative transitions unless they add structure.
212
+ - Do not make formal documents chatty. Human writing means judgment and economy, not casual tone.
213
+
214
+ ## Final Check
215
+
216
+ Before claiming the document is improved, verify:
217
+
218
+ - The main claim is visible in the first screen or first section.
219
+ - A new reader can state the next action after reading the conclusion.
220
+ - Repeated content has been collapsed or justified.
221
+ - Boundaries and non-goals are not buried.
222
+ - Any removed text was redundant, not a lost requirement.
@@ -0,0 +1,269 @@
1
+ # PRD Readability and Completeness
2
+
3
+ Use this reference only when the confirmed document type is `Requirements document / PRD`, or when the user explicitly asks to evaluate a document as a PRD.
4
+
5
+ ## Core Standard
6
+
7
+ A PRD is readable only if it lets reviewers decide whether the product should be built and lets designers, engineers, QA, operations, and stakeholders understand what must be delivered. For PRDs, readability includes requirement completeness, not just prose clarity.
8
+
9
+ ## Required Checks
10
+
11
+ Check the PRD across these areas:
12
+
13
+ | Area | What must be clear |
14
+ |---|---|
15
+ | Problem | What problem exists, who has it, why it matters now, and what current workaround or failure it replaces. |
16
+ | Goal | What outcome this release must achieve, and how success will be judged. |
17
+ | Non-goals | What is explicitly out of scope, deferred, or intentionally unsupported. |
18
+ | Users / roles | Which user roles exist, what each role can see or do, and which role owns each decision or operation. |
19
+ | Scope and priority | What is MVP / phase-one / required, what is optional, and what is future work. |
20
+ | Workflow | Trigger, preconditions, main path, branch paths, exception paths, and terminal states. |
21
+ | Functional requirements | Inputs, outputs, state changes, permissions, validation, dependencies, and failure handling. |
22
+ | Business rules | Who evaluates the rule, using which fields, at what time, and what happens when the rule fails. |
23
+ | Page / operation behavior | Entry point, displayed fields, action buttons, enable/disable conditions, submit validation, success/failure feedback, and audit logs. |
24
+ | Data / integration | Source systems, target systems, required fields, idempotency, versioning, retries, and consistency expectations. |
25
+ | Acceptance criteria | Testable Given/When/Then-style outcomes or equivalent concrete verification criteria. |
26
+ | Open questions | Unknowns, decision owners, deadlines, and whether they block delivery. |
27
+
28
+ ## Detail Gap Patterns
29
+
30
+ Flag these as PRD detail gaps, even if the prose is readable:
31
+
32
+ - A feature says `support`, `process`, `identify`, `generate`, `sync`, `notify`, `confirm`, or `handle`, but does not define input, output, owner, timing, or terminal state.
33
+ - A workflow lists stages but omits trigger, precondition, branch conditions, exception handling, or completion criteria.
34
+ - A status is named but its transitions, allowed actions, owner, or exit condition are missing.
35
+ - A page lists fields but omits action behavior, button availability, validation, empty states, errors, permissions, or logs.
36
+ - A rule describes intent but not the exact field, calculation, priority, source of truth, or conflict handling.
37
+ - A Plan / task / event is generated, but the recipient, payload, idempotency, retry, cancellation, and failure handling are unclear.
38
+ - A dependency is mentioned but its contract, SLA, missing-data behavior, or fallback is undefined.
39
+ - A requirement cannot be tested because it lacks concrete examples or acceptance criteria.
40
+
41
+ ## Ambiguity Probes
42
+
43
+ Use these probes to expose unclear requirements. Do not ask all of them to the user; use them to inspect the document and report the gaps that matter.
44
+
45
+ ### Feature Scope
46
+
47
+ - What exactly does `support X` include and exclude?
48
+ - What is the minimum acceptable behavior for phase one?
49
+ - Is this automatic, manual, or semi-automatic?
50
+ - Who can trigger it, and from where?
51
+ - What happens if the user starts but does not finish?
52
+ - What behavior is intentionally not supported?
53
+ - What is the smallest shippable version of the feature?
54
+ - Which users, accounts, markets, regions, products, channels, or data types are included?
55
+ - Which cases are explicitly excluded even if they look similar?
56
+ - Does "support" mean display only, calculate, persist, send, execute, reconcile, notify, or audit?
57
+ - Does the requirement apply to historical data, only new data, or both?
58
+ - Is there a migration, backfill, or cleanup requirement?
59
+
60
+ ### Actors and Ownership
61
+
62
+ - Which role owns each decision, confirmation, correction, and exception?
63
+ - Which actions are system actions, user actions, operator actions, or downstream-system actions?
64
+ - Who is allowed to override system output?
65
+ - Who reviews or approves high-risk actions?
66
+ - Who is notified when something is blocked, failed, revised, or completed?
67
+ - Who owns manual follow-up when automation cannot continue?
68
+
69
+ ### Workflow and State
70
+
71
+ - What triggers the workflow?
72
+ - What preconditions must be true?
73
+ - What is the happy path?
74
+ - What branches exist and what condition selects each branch?
75
+ - What are the terminal states?
76
+ - Which states allow edit, retry, cancel, ignore, approve, reject, archive, or rollback?
77
+ - Who owns each state transition?
78
+ - What happens when two events, tasks, or users act on the same object concurrently?
79
+ - What is the first state after creation?
80
+ - What is the difference between draft, pending, confirmed, sent, failed, completed, archived, ignored, or cancelled?
81
+ - Which transitions are automatic and which require user action?
82
+ - Are any transitions irreversible?
83
+ - What events reopen or revise a completed item?
84
+ - What stale states require timeout handling or escalation?
85
+ - What should the system do if a workflow is interrupted mid-step?
86
+
87
+ ### Timing and Snapshot
88
+
89
+ - Which date or time controls eligibility, calculation, display, execution, and notification?
90
+ - Is the date in user timezone, market timezone, system timezone, or source-system timezone?
91
+ - What snapshot is used for positions, balances, orders, customers, permissions, or source data?
92
+ - Can the snapshot be regenerated? If yes, does it replace or version prior results?
93
+ - What happens if source data arrives late, is revised, or is cancelled?
94
+ - What is the cutoff time for each action?
95
+ - What is allowed before cutoff, after cutoff, and after execution?
96
+
97
+ ### Data and Rules
98
+
99
+ - What is the source of truth for each important field?
100
+ - Which field is required, optional, calculated, derived, or manually entered?
101
+ - What is the rule priority when multiple rules match?
102
+ - What happens when source systems disagree?
103
+ - What happens when required data is missing, stale, duplicated, revised, or cancelled?
104
+ - Are historical values preserved when current effective values change?
105
+ - Is there versioning, and which version is current?
106
+ - What is the unique key for deduplication?
107
+ - Which fields are immutable after creation?
108
+ - Which fields can be manually corrected, and how are original/system/manual/effective values preserved?
109
+ - What validation prevents invalid combinations?
110
+ - What precision, rounding, currency, unit, or formatting rule applies?
111
+ - What happens when two rules produce different outputs?
112
+ - What is the conflict priority between source data, manual confirmation, downstream return, and recalculation?
113
+ - Is the rule evaluated per user, per account, per task, per event, per order, or per item?
114
+
115
+ ### Page and Operation Behavior
116
+
117
+ - Where is the entry point?
118
+ - What fields are visible by default, and what is hidden behind details?
119
+ - Which actions are available in each status?
120
+ - What disables an action button?
121
+ - What validation runs before submit?
122
+ - What confirmation, warning, or preview is shown before an irreversible operation?
123
+ - What success, failure, partial-success, retry, and timeout feedback does the user see?
124
+ - What audit log is written?
125
+ - What filters, sorting, grouping, search, export, or bulk actions are required?
126
+ - What empty, loading, error, no-permission, and no-data states are shown?
127
+ - What fields are editable, read-only, calculated, or drill-down only?
128
+ - What happens when a user edits data that has already changed in the background?
129
+ - What is the behavior for batch selection, partial selection, and disabled rows?
130
+ - What is the exact result of save, submit, approve, reject, retry, ignore, archive, cancel, rollback, or resend?
131
+ - Does the user need a preview of generated output before sending?
132
+
133
+ ### Integration and Execution
134
+
135
+ - Who receives generated tasks, events, Plans, notifications, or files?
136
+ - What payload is sent?
137
+ - What idempotency key or duplicate-prevention rule exists?
138
+ - What is retryable and what requires manual intervention?
139
+ - What happens on partial success?
140
+ - What happens if the downstream system accepts the request but later reports failure?
141
+ - What cancellation, correction, reversal, or compensation path exists?
142
+ - Is execution synchronous, asynchronous, scheduled, or manual?
143
+ - What acknowledgement does the upstream system need?
144
+ - What return payload is expected?
145
+ - What retry policy applies: count, interval, backoff, manual retry, or no retry?
146
+ - What makes a request idempotent?
147
+ - How are duplicate sends, duplicate callbacks, or out-of-order callbacks handled?
148
+ - What monitoring, alerting, or reconciliation is required?
149
+ - What should happen when integration is unavailable but users continue operating?
150
+
151
+ ### Permissions and Risk
152
+
153
+ - Who can view, create, edit, approve, send, retry, cancel, or archive?
154
+ - Which operations require dual review or elevated permission?
155
+ - What is the blast radius of a wrong operation?
156
+ - What guardrails prevent sending incomplete, stale, or unconfirmed data?
157
+ - What must be recoverable from logs?
158
+ - Which fields or actions are sensitive?
159
+ - Which roles can see customer-level, account-level, financial, or operational details?
160
+ - Is approval required before customer-facing or financially impactful actions?
161
+ - What is the rollback or compensation path for wrong execution?
162
+ - What operational dashboard or report proves the feature is healthy?
163
+ - What audit evidence must be retained for compliance or customer support?
164
+
165
+ ### Notifications and External Visibility
166
+
167
+ - Who receives notifications: internal operators, downstream teams, customers, support, or all?
168
+ - What triggers notification creation?
169
+ - What template, channel, language, and timing are required?
170
+ - What fields are shown to customers versus internal users?
171
+ - What happens if notification delivery fails?
172
+ - Can notifications be resent, corrected, suppressed, or cancelled?
173
+ - What customer support or audit view is needed after notification?
174
+
175
+ ## Acceptance Criteria Patterns
176
+
177
+ When a requirement is vague, propose a testable acceptance shape. Use domain language from the document.
178
+
179
+ ```text
180
+ Given [precondition / status / role / data]
181
+ When [user action / system trigger / external event]
182
+ Then [observable result / state change / generated output]
183
+ And [audit / notification / error / retry behavior]
184
+ ```
185
+
186
+ Include acceptance coverage for:
187
+
188
+ - Happy path.
189
+ - Missing or invalid input.
190
+ - Permission denied.
191
+ - Duplicate submission or duplicate event.
192
+ - External dependency failure.
193
+ - Partial success.
194
+ - Revised or cancelled source data.
195
+ - No impacted users / empty result.
196
+ - Manual override.
197
+ - Audit and traceability.
198
+
199
+ For page requirements, check:
200
+
201
+ ```text
202
+ Given [task status and user role]
203
+ When [page opens or action is clicked]
204
+ Then [fields/actions visible]
205
+ And [disabled/enabled conditions]
206
+ And [validation / feedback / log behavior]
207
+ ```
208
+
209
+ For rules, check:
210
+
211
+ ```text
212
+ Given [source data and priority conditions]
213
+ When [rule evaluation runs]
214
+ Then [selected result]
215
+ And [fallback or conflict result]
216
+ ```
217
+
218
+ ## PRD Severity
219
+
220
+ Use this severity model in addition to the main skill's severity model:
221
+
222
+ | Severity | Meaning |
223
+ |---|---|
224
+ | Blocking requirement gap | A builder or reviewer cannot know what to implement, test, approve, or operate. |
225
+ | Important requirement gap | The requirement is implementable only with assumptions; different readers may implement it differently. |
226
+ | Optional refinement | The requirement is understandable, but examples, wording, or organization could reduce review effort. |
227
+
228
+ Do not label every missing detail as blocking. A missing detail is blocking only if implementation, testing, or review would require guessing.
229
+
230
+ ## PRD Output Requirement
231
+
232
+ When assessing a PRD, include a section for requirement detail gaps. Use natural headings in the user's language. Cover:
233
+
234
+ - The gap.
235
+ - Why it affects delivery or review.
236
+ - What question must be answered or what detail must be added.
237
+ - A suggested acceptance or clarification shape when useful.
238
+
239
+ Example shape:
240
+
241
+ ```text
242
+ Requirement detail gaps:
243
+ - [Gap]: ...
244
+ Impact: ...
245
+ Need to clarify: ...
246
+ Suggested acceptance shape: ...
247
+ ```
248
+
249
+ ## Rewrite Guidance for PRDs
250
+
251
+ When rewriting a PRD, prefer this structure:
252
+
253
+ ```text
254
+ 1. Summary
255
+ 2. Background / problem
256
+ 3. Goals and non-goals
257
+ 4. Users and roles
258
+ 5. Scope and priorities
259
+ 6. Core workflows
260
+ 7. Functional requirements
261
+ 8. Rules and edge cases
262
+ 9. Page / operation requirements
263
+ 10. Data and integration requirements
264
+ 11. Acceptance criteria
265
+ 12. Open questions
266
+ 13. Appendix
267
+ ```
268
+
269
+ Keep implementation contracts in the PRD only when they are needed for product review. Move exhaustive field tables, enum lists, API payloads, and state-machine details to appendices or companion engineering specs when they interrupt the product decision path.
@@ -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.3"
6
+ version: "0.2.7"
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:
@@ -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.3"
6
+ version: "0.2.7"
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.3"
6
+ version: "0.2.7"
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.3"
6
+ version: "0.2.7"
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.3"
6
+ version: "0.2.7"
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.3"
6
+ version: "0.2.7"
7
7
  ---
8
8
 
9
9
  # Kratos
@@ -3,7 +3,7 @@ name: plan
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
4
  when_to_use: "plan, implementation plan, execution plan, task breakdown, approved requirements, approved design spec, docs/loopx/design, 实施计划, 执行计划, 任务拆分"
5
5
  metadata:
6
- version: "0.2.3"
6
+ version: "0.2.7"
7
7
  argument-hint: "<design spec path or feature name>"
8
8
  ---
9
9