@ai-content-space/loopx 0.1.10 → 0.2.0

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 (72) hide show
  1. package/AGENTS.md +50 -0
  2. package/README.md +59 -450
  3. package/README.zh-CN.md +59 -461
  4. package/docs/loopx/design/loopx-skill-suite-v1-design.md +73 -0
  5. package/docs/loopx/plans/loopx-skill-suite-v1-implementation.md +77 -0
  6. package/package.json +5 -2
  7. package/plugins/loopx/.codex-plugin/plugin.json +4 -4
  8. package/plugins/loopx/scripts/plugin-install.test.mjs +20 -20
  9. package/plugins/loopx/skills/clarify/SKILL.md +38 -311
  10. package/plugins/loopx/skills/debug/SKILL.md +1 -1
  11. package/plugins/loopx/skills/exec/SKILL.md +71 -0
  12. package/plugins/loopx/skills/finish/SKILL.md +254 -0
  13. package/plugins/loopx/skills/fix-review/SKILL.md +216 -0
  14. package/plugins/loopx/skills/go-style/SKILL.md +1 -1
  15. package/plugins/loopx/skills/kratos/SKILL.md +1 -1
  16. package/plugins/loopx/skills/plan/SKILL.md +138 -271
  17. package/plugins/loopx/skills/refactor-plan/SKILL.md +71 -0
  18. package/plugins/loopx/skills/review/SKILL.md +72 -105
  19. package/plugins/loopx/skills/review/code-reviewer.md +168 -0
  20. package/plugins/loopx/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
  21. package/plugins/loopx/skills/spec/SKILL.md +76 -0
  22. package/plugins/loopx/skills/subagent-exec/SKILL.md +282 -0
  23. package/plugins/loopx/skills/subagent-exec/agents/openai.yaml +3 -0
  24. package/plugins/loopx/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
  25. package/plugins/loopx/skills/subagent-exec/codex-subagents.md +37 -0
  26. package/plugins/loopx/skills/subagent-exec/implementer-prompt.md +113 -0
  27. package/plugins/loopx/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
  28. package/plugins/loopx/skills/tdd/SKILL.md +1 -1
  29. package/plugins/loopx/skills/verify/SKILL.md +1 -1
  30. package/scripts/claude-workflow-hook.mjs +109 -0
  31. package/scripts/codex-workflow-hook.mjs +2 -5
  32. package/scripts/install-skills.mjs +3 -3
  33. package/scripts/verify-skills.mjs +32 -1
  34. package/skills/RESOLVER.md +26 -17
  35. package/skills/clarify/SKILL.md +38 -311
  36. package/skills/debug/SKILL.md +1 -1
  37. package/skills/exec/SKILL.md +71 -0
  38. package/skills/finish/SKILL.md +254 -0
  39. package/skills/fix-review/SKILL.md +216 -0
  40. package/skills/go-style/SKILL.md +1 -1
  41. package/skills/kratos/SKILL.md +1 -1
  42. package/skills/plan/SKILL.md +138 -271
  43. package/skills/refactor-plan/SKILL.md +71 -0
  44. package/skills/review/SKILL.md +72 -105
  45. package/skills/review/code-reviewer.md +168 -0
  46. package/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
  47. package/skills/spec/SKILL.md +76 -0
  48. package/skills/subagent-exec/SKILL.md +282 -0
  49. package/skills/subagent-exec/agents/openai.yaml +3 -0
  50. package/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
  51. package/skills/subagent-exec/codex-subagents.md +37 -0
  52. package/skills/subagent-exec/implementer-prompt.md +113 -0
  53. package/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
  54. package/skills/tdd/SKILL.md +1 -1
  55. package/skills/verify/SKILL.md +1 -1
  56. package/src/autopilot-runtime.mjs +1 -1
  57. package/src/cli.mjs +77 -5
  58. package/src/context-manifest.mjs +2 -2
  59. package/src/html-views.mjs +129 -195
  60. package/src/install-discovery.mjs +210 -6
  61. package/src/next-skill.mjs +2 -4
  62. package/src/plan-runtime.mjs +571 -93
  63. package/src/runtime-maintenance.mjs +5 -2
  64. package/src/workflow.mjs +865 -68
  65. package/templates/architecture.md +58 -16
  66. package/templates/development-plan.md +42 -12
  67. package/plugins/loopx/skills/archive/SKILL.md +0 -55
  68. package/plugins/loopx/skills/autopilot/SKILL.md +0 -93
  69. package/plugins/loopx/skills/build/SKILL.md +0 -228
  70. package/skills/archive/SKILL.md +0 -55
  71. package/skills/autopilot/SKILL.md +0 -93
  72. package/skills/build/SKILL.md +0 -228
@@ -0,0 +1,254 @@
1
+ ---
2
+ name: finish
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
+ when_to_use: "implementation complete, tests pass, finish branch, create pull request, merge locally, keep branch, discard work"
5
+ metadata:
6
+ version: "0.2.0"
7
+ ---
8
+
9
+ # Finish
10
+
11
+ ## Overview
12
+
13
+ Guide completion of development work by presenting clear options and handling chosen workflow.
14
+
15
+ **Core principle:** Verify tests → Detect environment → Present options → Execute choice → Clean up.
16
+
17
+ **Announce at start:** "I'm using the finish skill to complete this work."
18
+
19
+ ## The Process
20
+
21
+ ### Step 1: Verify Tests
22
+
23
+ **Before presenting options, verify tests pass:**
24
+
25
+ ```bash
26
+ # Run project's test suite
27
+ npm test / cargo test / pytest / go test ./...
28
+ ```
29
+
30
+ **If tests fail:**
31
+ ```
32
+ Tests failing (<N> failures). Must fix before completing:
33
+
34
+ [Show failures]
35
+
36
+ Cannot proceed with merge/PR until tests pass.
37
+ ```
38
+
39
+ Stop. Don't proceed to Step 2.
40
+
41
+ **If tests pass:** Continue to Step 2.
42
+
43
+ ### Step 2: Detect Environment
44
+
45
+ **Determine workspace state before presenting options:**
46
+
47
+ ```bash
48
+ GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
49
+ GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
50
+ ```
51
+
52
+ This determines which menu to show and how cleanup works:
53
+
54
+ | State | Menu | Cleanup |
55
+ |-------|------|---------|
56
+ | `GIT_DIR == GIT_COMMON` (normal repo) | Standard 4 options | No worktree to clean up |
57
+ | `GIT_DIR != GIT_COMMON`, named branch | Standard 4 options | Provenance-based (see Step 6) |
58
+ | `GIT_DIR != GIT_COMMON`, detached HEAD | Reduced 3 options (no merge) | No cleanup (externally managed) |
59
+
60
+ ### Step 3: Determine Base Branch
61
+
62
+ ```bash
63
+ # Try common base branches
64
+ git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
65
+ ```
66
+
67
+ Or ask: "This branch split from main - is that correct?"
68
+
69
+ ### Step 4: Present Options
70
+
71
+ **Normal repo and named-branch worktree — present exactly these 4 options:**
72
+
73
+ ```
74
+ Implementation complete. What would you like to do?
75
+
76
+ 1. Merge back to <base-branch> locally
77
+ 2. Push and create a Pull Request
78
+ 3. Keep the branch as-is (I'll handle it later)
79
+ 4. Discard this work
80
+
81
+ Which option?
82
+ ```
83
+
84
+ **Detached HEAD — present exactly these 3 options:**
85
+
86
+ ```
87
+ Implementation complete. You're on a detached HEAD (externally managed workspace).
88
+
89
+ 1. Push as new branch and create a Pull Request
90
+ 2. Keep as-is (I'll handle it later)
91
+ 3. Discard this work
92
+
93
+ Which option?
94
+ ```
95
+
96
+ **Don't add explanation** - keep options concise.
97
+
98
+ ### Step 5: Execute Choice
99
+
100
+ #### Option 1: Merge Locally
101
+
102
+ ```bash
103
+ # Get main repo root for CWD safety
104
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
105
+ cd "$MAIN_ROOT"
106
+
107
+ # Merge first — verify success before removing anything
108
+ git checkout <base-branch>
109
+ git pull
110
+ git merge <feature-branch>
111
+
112
+ # Verify tests on merged result
113
+ <test command>
114
+
115
+ # Only after merge succeeds: cleanup worktree (Step 6), then delete branch
116
+ ```
117
+
118
+ Then: Cleanup worktree (Step 6), then delete branch:
119
+
120
+ ```bash
121
+ git branch -d <feature-branch>
122
+ ```
123
+
124
+ #### Option 2: Push and Create PR
125
+
126
+ ```bash
127
+ # Push branch
128
+ git push -u origin <feature-branch>
129
+
130
+ # Create PR
131
+ gh pr create --title "<title>" --body "$(cat <<'EOF'
132
+ ## Summary
133
+ <2-3 bullets of what changed>
134
+
135
+ ## Test Plan
136
+ - [ ] <verification steps>
137
+ EOF
138
+ )"
139
+ ```
140
+
141
+ **Do NOT clean up worktree** — user needs it alive to iterate on PR feedback.
142
+
143
+ #### Option 3: Keep As-Is
144
+
145
+ Report: "Keeping branch <name>. Worktree preserved at <path>."
146
+
147
+ **Don't cleanup worktree.**
148
+
149
+ #### Option 4: Discard
150
+
151
+ **Confirm first:**
152
+ ```
153
+ This will permanently delete:
154
+ - Branch <name>
155
+ - All commits: <commit-list>
156
+ - Worktree at <path>
157
+
158
+ Type 'discard' to confirm.
159
+ ```
160
+
161
+ Wait for exact confirmation.
162
+
163
+ If confirmed:
164
+ ```bash
165
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
166
+ cd "$MAIN_ROOT"
167
+ ```
168
+
169
+ Then: Cleanup worktree (Step 6), then force-delete branch:
170
+ ```bash
171
+ git branch -D <feature-branch>
172
+ ```
173
+
174
+ ### Step 6: Cleanup Workspace
175
+
176
+ **Only runs for Options 1 and 4.** Options 2 and 3 always preserve the worktree.
177
+
178
+ ```bash
179
+ GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
180
+ GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
181
+ WORKTREE_PATH=$(git rev-parse --show-toplevel)
182
+ ```
183
+
184
+ **If `GIT_DIR == GIT_COMMON`:** Normal repo, no worktree to clean up. Done.
185
+
186
+ **If worktree path is under `.worktrees/`, `worktrees/`, or `~/.config/loopx/worktrees/`:** loopx created this worktree — we own cleanup.
187
+
188
+ ```bash
189
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
190
+ cd "$MAIN_ROOT"
191
+ git worktree remove "$WORKTREE_PATH"
192
+ git worktree prune # Self-healing: clean up any stale registrations
193
+ ```
194
+
195
+ **Otherwise:** The host environment (harness) owns this workspace. Do NOT remove it. If your platform provides a workspace-exit tool, use it. Otherwise, leave the workspace in place.
196
+
197
+ ## Quick Reference
198
+
199
+ | Option | Merge | Push | Keep Worktree | Cleanup Branch |
200
+ |--------|-------|------|---------------|----------------|
201
+ | 1. Merge locally | yes | - | - | yes |
202
+ | 2. Create PR | - | yes | yes | - |
203
+ | 3. Keep as-is | - | - | yes | - |
204
+ | 4. Discard | - | - | - | yes (force) |
205
+
206
+ ## Common Mistakes
207
+
208
+ **Skipping test verification**
209
+ - **Problem:** Merge broken code, create failing PR
210
+ - **Fix:** Always verify tests before offering options
211
+
212
+ **Open-ended questions**
213
+ - **Problem:** "What should I do next?" is ambiguous
214
+ - **Fix:** Present exactly 4 structured options (or 3 for detached HEAD)
215
+
216
+ **Cleaning up worktree for Option 2**
217
+ - **Problem:** Remove worktree user needs for PR iteration
218
+ - **Fix:** Only cleanup for Options 1 and 4
219
+
220
+ **Deleting branch before removing worktree**
221
+ - **Problem:** `git branch -d` fails because worktree still references the branch
222
+ - **Fix:** Merge first, remove worktree, then delete branch
223
+
224
+ **Running git worktree remove from inside the worktree**
225
+ - **Problem:** Command fails silently when CWD is inside the worktree being removed
226
+ - **Fix:** Always `cd` to main repo root before `git worktree remove`
227
+
228
+ **Cleaning up harness-owned worktrees**
229
+ - **Problem:** Removing a worktree the harness created causes phantom state
230
+ - **Fix:** Only clean up worktrees under `.worktrees/`, `worktrees/`, or `~/.config/loopx/worktrees/`
231
+
232
+ **No confirmation for discard**
233
+ - **Problem:** Accidentally delete work
234
+ - **Fix:** Require typed "discard" confirmation
235
+
236
+ ## Red Flags
237
+
238
+ **Never:**
239
+ - Proceed with failing tests
240
+ - Merge without verifying tests on result
241
+ - Delete work without confirmation
242
+ - Force-push without explicit request
243
+ - Remove a worktree before confirming merge success
244
+ - Clean up worktrees you didn't create (provenance check)
245
+ - Run `git worktree remove` from inside the worktree
246
+
247
+ **Always:**
248
+ - Verify tests before offering options
249
+ - Detect environment before presenting menu
250
+ - Present exactly 4 options (or 3 for detached HEAD)
251
+ - Get typed confirmation for Option 4
252
+ - Clean up worktree for Options 1 & 4 only
253
+ - `cd` to main repo root before worktree removal
254
+ - Run `git worktree prune` after removal
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: fix-review
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
+ when_to_use: "fix-review, received code review feedback, review comments, reviewer suggestions, requested changes, 处理评审意见"
5
+ metadata:
6
+ version: "0.2.0"
7
+ ---
8
+
9
+ # Fix Review
10
+
11
+ ## Overview
12
+
13
+ Code review requires technical evaluation, not emotional performance.
14
+
15
+ **Core principle:** Verify before implementing. Ask before assuming. Technical correctness over social comfort.
16
+
17
+ ## The Response Pattern
18
+
19
+ ```
20
+ WHEN receiving code review feedback:
21
+
22
+ 1. READ: Complete feedback without reacting
23
+ 2. UNDERSTAND: Restate requirement in own words (or ask)
24
+ 3. VERIFY: Check against codebase reality
25
+ 4. EVALUATE: Technically sound for THIS codebase?
26
+ 5. RESPOND: Technical acknowledgment or reasoned pushback
27
+ 6. IMPLEMENT: One item at a time, test each
28
+ ```
29
+
30
+ ## Forbidden Responses
31
+
32
+ **NEVER:**
33
+ - "You're absolutely right!" (explicit CLAUDE.md violation)
34
+ - "Great point!" / "Excellent feedback!" (performative)
35
+ - "Let me implement that now" (before verification)
36
+
37
+ **INSTEAD:**
38
+ - Restate the technical requirement
39
+ - Ask clarifying questions
40
+ - Push back with technical reasoning if wrong
41
+ - Just start working (actions > words)
42
+
43
+ ## Handling Unclear Feedback
44
+
45
+ ```
46
+ IF any item is unclear:
47
+ STOP - do not implement anything yet
48
+ ASK for clarification on unclear items
49
+
50
+ WHY: Items may be related. Partial understanding = wrong implementation.
51
+ ```
52
+
53
+ **Example:**
54
+ ```
55
+ your human partner: "Fix 1-6"
56
+ You understand 1,2,3,6. Unclear on 4,5.
57
+
58
+ ❌ WRONG: Implement 1,2,3,6 now, ask about 4,5 later
59
+ ✅ RIGHT: "I understand items 1,2,3,6. Need clarification on 4 and 5 before proceeding."
60
+ ```
61
+
62
+ ## Source-Specific Handling
63
+
64
+ ### From your human partner
65
+ - **Trusted** - implement after understanding
66
+ - **Still ask** if scope unclear
67
+ - **No performative agreement**
68
+ - **Skip to action** or technical acknowledgment
69
+
70
+ ### From External Reviewers
71
+ ```
72
+ BEFORE implementing:
73
+ 1. Check: Technically correct for THIS codebase?
74
+ 2. Check: Breaks existing functionality?
75
+ 3. Check: Reason for current implementation?
76
+ 4. Check: Works on all platforms/versions?
77
+ 5. Check: Does reviewer understand full context?
78
+
79
+ IF suggestion seems wrong:
80
+ Push back with technical reasoning
81
+
82
+ IF can't easily verify:
83
+ Say so: "I can't verify this without [X]. Should I [investigate/ask/proceed]?"
84
+
85
+ IF conflicts with your human partner's prior decisions:
86
+ Stop and discuss with your human partner first
87
+ ```
88
+
89
+ **your human partner's rule:** "External feedback - be skeptical, but check carefully"
90
+
91
+ ## YAGNI Check for "Professional" Features
92
+
93
+ ```
94
+ IF reviewer suggests "implementing properly":
95
+ grep codebase for actual usage
96
+
97
+ IF unused: "This endpoint isn't called. Remove it (YAGNI)?"
98
+ IF used: Then implement properly
99
+ ```
100
+
101
+ **your human partner's rule:** "You and reviewer both report to me. If we don't need this feature, don't add it."
102
+
103
+ ## Implementation Order
104
+
105
+ ```
106
+ FOR multi-item feedback:
107
+ 1. Clarify anything unclear FIRST
108
+ 2. Then implement in this order:
109
+ - Blocking issues (breaks, security)
110
+ - Simple fixes (typos, imports)
111
+ - Complex fixes (refactoring, logic)
112
+ 3. Test each fix individually
113
+ 4. Verify no regressions
114
+ ```
115
+
116
+ ## When To Push Back
117
+
118
+ Push back when:
119
+ - Suggestion breaks existing functionality
120
+ - Reviewer lacks full context
121
+ - Violates YAGNI (unused feature)
122
+ - Technically incorrect for this stack
123
+ - Legacy/compatibility reasons exist
124
+ - Conflicts with your human partner's architectural decisions
125
+
126
+ **How to push back:**
127
+ - Use technical reasoning, not defensiveness
128
+ - Ask specific questions
129
+ - Reference working tests/code
130
+ - Involve your human partner if architectural
131
+
132
+ **Signal if uncomfortable pushing back out loud:** "Strange things are afoot at the Circle K"
133
+
134
+ ## Acknowledging Correct Feedback
135
+
136
+ When feedback IS correct:
137
+ ```
138
+ ✅ "Fixed. [Brief description of what changed]"
139
+ ✅ "Good catch - [specific issue]. Fixed in [location]."
140
+ ✅ [Just fix it and show in the code]
141
+
142
+ ❌ "You're absolutely right!"
143
+ ❌ "Great point!"
144
+ ❌ "Thanks for catching that!"
145
+ ❌ "Thanks for [anything]"
146
+ ❌ ANY gratitude expression
147
+ ```
148
+
149
+ **Why no thanks:** Actions speak. Just fix it. The code itself shows you heard the feedback.
150
+
151
+ **If you catch yourself about to write "Thanks":** DELETE IT. State the fix instead.
152
+
153
+ ## Gracefully Correcting Your Pushback
154
+
155
+ If you pushed back and were wrong:
156
+ ```
157
+ ✅ "You were right - I checked [X] and it does [Y]. Implementing now."
158
+ ✅ "Verified this and you're correct. My initial understanding was wrong because [reason]. Fixing."
159
+
160
+ ❌ Long apology
161
+ ❌ Defending why you pushed back
162
+ ❌ Over-explaining
163
+ ```
164
+
165
+ State the correction factually and move on.
166
+
167
+ ## Common Mistakes
168
+
169
+ | Mistake | Fix |
170
+ |---------|-----|
171
+ | Performative agreement | State requirement or just act |
172
+ | Blind implementation | Verify against codebase first |
173
+ | Batch without testing | One at a time, test each |
174
+ | Assuming reviewer is right | Check if breaks things |
175
+ | Avoiding pushback | Technical correctness > comfort |
176
+ | Partial implementation | Clarify all items first |
177
+ | Can't verify, proceed anyway | State limitation, ask for direction |
178
+
179
+ ## Real Examples
180
+
181
+ **Performative Agreement (Bad):**
182
+ ```
183
+ Reviewer: "Remove legacy code"
184
+ ❌ "You're absolutely right! Let me remove that..."
185
+ ```
186
+
187
+ **Technical Verification (Good):**
188
+ ```
189
+ Reviewer: "Remove legacy code"
190
+ ✅ "Checking... build target is 10.15+, this API needs 13+. Need legacy for backward compat. Current impl has wrong bundle ID - fix it or drop pre-13 support?"
191
+ ```
192
+
193
+ **YAGNI (Good):**
194
+ ```
195
+ Reviewer: "Implement proper metrics tracking with database, date filters, CSV export"
196
+ ✅ "Grepped codebase - nothing calls this endpoint. Remove it (YAGNI)? Or is there usage I'm missing?"
197
+ ```
198
+
199
+ **Unclear Item (Good):**
200
+ ```
201
+ your human partner: "Fix items 1-6"
202
+ You understand 1,2,3,6. Unclear on 4,5.
203
+ ✅ "Understand 1,2,3,6. Need clarification on 4 and 5 before implementing."
204
+ ```
205
+
206
+ ## GitHub Thread Replies
207
+
208
+ When replying to inline review comments on GitHub, reply in the comment thread (`gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies`), not as a top-level PR comment.
209
+
210
+ ## The Bottom Line
211
+
212
+ **External feedback = suggestions to evaluate, not orders to follow.**
213
+
214
+ Verify. Question. Then implement.
215
+
216
+ No performative agreement. Technical rigor always.
@@ -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.1.10"
6
+ version: "0.2.0"
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.1.10"
6
+ version: "0.2.0"
7
7
  ---
8
8
 
9
9
  # Kratos