@rune-kit/rune 2.1.1
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.
- package/LICENSE +21 -0
- package/README.md +357 -0
- package/agents/.gitkeep +0 -0
- package/agents/architect.md +29 -0
- package/agents/asset-creator.md +11 -0
- package/agents/audit.md +11 -0
- package/agents/autopsy.md +11 -0
- package/agents/brainstorm.md +11 -0
- package/agents/browser-pilot.md +11 -0
- package/agents/coder.md +29 -0
- package/agents/completion-gate.md +11 -0
- package/agents/constraint-check.md +11 -0
- package/agents/context-engine.md +11 -0
- package/agents/cook.md +11 -0
- package/agents/db.md +11 -0
- package/agents/debug.md +11 -0
- package/agents/dependency-doctor.md +11 -0
- package/agents/deploy.md +11 -0
- package/agents/design.md +11 -0
- package/agents/docs-seeker.md +11 -0
- package/agents/fix.md +11 -0
- package/agents/hallucination-guard.md +11 -0
- package/agents/incident.md +11 -0
- package/agents/integrity-check.md +11 -0
- package/agents/journal.md +11 -0
- package/agents/launch.md +11 -0
- package/agents/logic-guardian.md +11 -0
- package/agents/marketing.md +11 -0
- package/agents/onboard.md +11 -0
- package/agents/perf.md +11 -0
- package/agents/plan.md +11 -0
- package/agents/preflight.md +11 -0
- package/agents/problem-solver.md +11 -0
- package/agents/rescue.md +11 -0
- package/agents/research.md +11 -0
- package/agents/researcher.md +29 -0
- package/agents/review-intake.md +11 -0
- package/agents/review.md +11 -0
- package/agents/reviewer.md +28 -0
- package/agents/safeguard.md +11 -0
- package/agents/sast.md +11 -0
- package/agents/scanner.md +28 -0
- package/agents/scope-guard.md +11 -0
- package/agents/scout.md +11 -0
- package/agents/sentinel.md +11 -0
- package/agents/sequential-thinking.md +11 -0
- package/agents/session-bridge.md +11 -0
- package/agents/skill-forge.md +11 -0
- package/agents/skill-router.md +11 -0
- package/agents/surgeon.md +11 -0
- package/agents/team.md +11 -0
- package/agents/test.md +11 -0
- package/agents/trend-scout.md +11 -0
- package/agents/verification.md +11 -0
- package/agents/video-creator.md +11 -0
- package/agents/watchdog.md +11 -0
- package/agents/worktree.md +11 -0
- package/commands/.gitkeep +0 -0
- package/commands/rune.md +168 -0
- package/compiler/__tests__/openclaw-adapter.test.js +140 -0
- package/compiler/__tests__/parser.test.js +55 -0
- package/compiler/adapters/antigravity.js +59 -0
- package/compiler/adapters/claude.js +37 -0
- package/compiler/adapters/cursor.js +67 -0
- package/compiler/adapters/generic.js +60 -0
- package/compiler/adapters/index.js +45 -0
- package/compiler/adapters/openclaw.js +150 -0
- package/compiler/adapters/windsurf.js +60 -0
- package/compiler/bin/rune.js +288 -0
- package/compiler/doctor.js +153 -0
- package/compiler/emitter.js +240 -0
- package/compiler/parser.js +208 -0
- package/compiler/transformer.js +69 -0
- package/compiler/transforms/branding.js +27 -0
- package/compiler/transforms/cross-references.js +29 -0
- package/compiler/transforms/frontmatter.js +38 -0
- package/compiler/transforms/hooks.js +68 -0
- package/compiler/transforms/subagents.js +36 -0
- package/compiler/transforms/tool-names.js +60 -0
- package/contexts/dev.md +34 -0
- package/contexts/research.md +43 -0
- package/contexts/review.md +55 -0
- package/extensions/ai-ml/PACK.md +517 -0
- package/extensions/analytics/PACK.md +557 -0
- package/extensions/backend/PACK.md +678 -0
- package/extensions/chrome-ext/PACK.md +995 -0
- package/extensions/content/PACK.md +381 -0
- package/extensions/devops/PACK.md +520 -0
- package/extensions/ecommerce/PACK.md +280 -0
- package/extensions/gamedev/PACK.md +393 -0
- package/extensions/mobile/PACK.md +273 -0
- package/extensions/saas/PACK.md +805 -0
- package/extensions/security/PACK.md +536 -0
- package/extensions/trading/PACK.md +597 -0
- package/extensions/ui/PACK.md +947 -0
- package/package.json +47 -0
- package/skills/.gitkeep +0 -0
- package/skills/adversary/SKILL.md +271 -0
- package/skills/asset-creator/SKILL.md +157 -0
- package/skills/audit/SKILL.md +466 -0
- package/skills/autopsy/SKILL.md +200 -0
- package/skills/ba/SKILL.md +279 -0
- package/skills/brainstorm/SKILL.md +266 -0
- package/skills/browser-pilot/SKILL.md +168 -0
- package/skills/completion-gate/SKILL.md +151 -0
- package/skills/constraint-check/SKILL.md +165 -0
- package/skills/context-engine/SKILL.md +176 -0
- package/skills/cook/SKILL.md +636 -0
- package/skills/db/SKILL.md +256 -0
- package/skills/debug/SKILL.md +240 -0
- package/skills/dependency-doctor/SKILL.md +235 -0
- package/skills/deploy/SKILL.md +174 -0
- package/skills/design/DESIGN-REFERENCE.md +365 -0
- package/skills/design/SKILL.md +462 -0
- package/skills/doc-processor/SKILL.md +254 -0
- package/skills/docs/SKILL.md +336 -0
- package/skills/docs-seeker/SKILL.md +166 -0
- package/skills/fix/SKILL.md +192 -0
- package/skills/git/SKILL.md +285 -0
- package/skills/hallucination-guard/SKILL.md +204 -0
- package/skills/incident/SKILL.md +241 -0
- package/skills/integrity-check/SKILL.md +169 -0
- package/skills/journal/SKILL.md +190 -0
- package/skills/launch/SKILL.md +330 -0
- package/skills/logic-guardian/SKILL.md +240 -0
- package/skills/marketing/SKILL.md +229 -0
- package/skills/mcp-builder/SKILL.md +311 -0
- package/skills/onboard/SKILL.md +298 -0
- package/skills/perf/SKILL.md +297 -0
- package/skills/plan/SKILL.md +520 -0
- package/skills/preflight/SKILL.md +231 -0
- package/skills/problem-solver/SKILL.md +284 -0
- package/skills/rescue/SKILL.md +434 -0
- package/skills/research/SKILL.md +122 -0
- package/skills/review/SKILL.md +354 -0
- package/skills/review-intake/SKILL.md +222 -0
- package/skills/safeguard/SKILL.md +188 -0
- package/skills/sast/SKILL.md +190 -0
- package/skills/scaffold/SKILL.md +276 -0
- package/skills/scope-guard/SKILL.md +150 -0
- package/skills/scout/SKILL.md +232 -0
- package/skills/sentinel/SKILL.md +320 -0
- package/skills/sentinel-env/SKILL.md +226 -0
- package/skills/sequential-thinking/SKILL.md +234 -0
- package/skills/session-bridge/SKILL.md +287 -0
- package/skills/skill-forge/SKILL.md +317 -0
- package/skills/skill-router/SKILL.md +267 -0
- package/skills/surgeon/SKILL.md +203 -0
- package/skills/team/SKILL.md +397 -0
- package/skills/test/SKILL.md +271 -0
- package/skills/trend-scout/SKILL.md +145 -0
- package/skills/verification/SKILL.md +201 -0
- package/skills/video-creator/SKILL.md +201 -0
- package/skills/watchdog/SKILL.md +166 -0
- package/skills/worktree/SKILL.md +140 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rescue
|
|
3
|
+
description: "Legacy refactoring orchestrator. Use when user says 'refactor', 'modernize', 'clean up this mess', 'rescue', or when dealing with old/messy/legacy code. Multi-session workflow — autopsy, safety net, incremental surgery, progress tracking."
|
|
4
|
+
context: fork
|
|
5
|
+
agent: general-purpose
|
|
6
|
+
metadata:
|
|
7
|
+
author: runedev
|
|
8
|
+
version: "0.3.0"
|
|
9
|
+
layer: L1
|
|
10
|
+
model: sonnet
|
|
11
|
+
group: orchestrator
|
|
12
|
+
tools: "Read, Write, Edit, Bash, Glob, Grep"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# rescue
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
Legacy refactoring orchestrator for safely modernizing messy codebases. Rescue runs a multi-session workflow: assess damage (autopsy), build safety nets (safeguard), perform incremental surgery (surgeon), and track progress (journal). Designed to handle the chaos of real-world legacy code without breaking everything.
|
|
20
|
+
|
|
21
|
+
<HARD-GATE>
|
|
22
|
+
- Surgery MUST NOT begin until safety net is committed and tagged.
|
|
23
|
+
- ONE module per session. NEVER refactor two coupled modules simultaneously.
|
|
24
|
+
- Full test suite must pass before rescue is declared complete.
|
|
25
|
+
</HARD-GATE>
|
|
26
|
+
|
|
27
|
+
## Triggers
|
|
28
|
+
|
|
29
|
+
- `/rune rescue` — manual invocation on legacy project
|
|
30
|
+
- Auto-trigger: when autopsy health score < 40/100
|
|
31
|
+
|
|
32
|
+
## Calls (outbound)
|
|
33
|
+
|
|
34
|
+
- `autopsy` (L2): Phase 0 RECON — full codebase health assessment
|
|
35
|
+
- `safeguard` (L2): Phase 1 SAFETY NET — characterization tests and protective measures
|
|
36
|
+
- `surgeon` (L2): Phase 2-N SURGERY — incremental refactoring (1 module per session)
|
|
37
|
+
- `journal` (L3): state tracking across rescue sessions
|
|
38
|
+
- `plan` (L2): create refactoring plan based on autopsy findings
|
|
39
|
+
- `review` (L2): verify each surgery phase
|
|
40
|
+
- `session-bridge` (L3): save rescue state between sessions
|
|
41
|
+
- `onboard` (L2): generate context for unfamiliar legacy project
|
|
42
|
+
- `dependency-doctor` (L3): audit dependencies in legacy project
|
|
43
|
+
|
|
44
|
+
## Called By (inbound)
|
|
45
|
+
|
|
46
|
+
- User: `/rune rescue` direct invocation
|
|
47
|
+
- `team` (L1): when team delegates rescue work
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Execution
|
|
52
|
+
|
|
53
|
+
### Step 0 — Initialize TodoWrite
|
|
54
|
+
|
|
55
|
+
Rescue is multi-session. On first invocation, build full todo list. On resume, read RESCUE-STATE.md and restore todo list to current phase.
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
TodoWrite([
|
|
59
|
+
{ content: "RECON: Run autopsy, onboard, and save initial state", status: "pending", activeForm: "Assessing codebase health" },
|
|
60
|
+
{ content: "SAFETY NET: Add characterization tests and rollback points", status: "pending", activeForm: "Building safety net" },
|
|
61
|
+
{ content: "SURGERY [Module N]: Refactor one module with surgeon", status: "pending", activeForm: "Performing surgery on module N" },
|
|
62
|
+
{ content: "CLEANUP: Remove @legacy and @bridge markers", status: "pending", activeForm: "Cleaning up markers" },
|
|
63
|
+
{ content: "VERIFY: Run full test suite and compare health scores", status: "pending", activeForm: "Verifying rescue outcome" }
|
|
64
|
+
])
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Note: SURGERY todos are added dynamically — one per module identified in Phase 0. Each module gets its own todo entry.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Phase 0 — RECON
|
|
72
|
+
|
|
73
|
+
Mark todo[0] `in_progress`.
|
|
74
|
+
|
|
75
|
+
**0a. Full health assessment.**
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
REQUIRED SUB-SKILL: rune:autopsy
|
|
79
|
+
→ Invoke `autopsy` with scope: "full".
|
|
80
|
+
→ autopsy returns:
|
|
81
|
+
- health_score: number (0-100)
|
|
82
|
+
- modules: list of { name, path, loc, cyclomatic_complexity, test_coverage, health }
|
|
83
|
+
- issues: list of { severity, file, description }
|
|
84
|
+
- recommended_patterns: map of module → refactoring pattern
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**0b. Generate project context if missing.**
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Check: does CLAUDE.md exist in project root?
|
|
91
|
+
If NO:
|
|
92
|
+
REQUIRED SUB-SKILL: rune:onboard
|
|
93
|
+
→ Invoke `onboard` to generate CLAUDE.md with project conventions.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**0c. Audit dependencies.**
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
REQUIRED SUB-SKILL: rune:dependency-doctor
|
|
100
|
+
→ Invoke `dependency-doctor` to identify: outdated packages, security vulnerabilities, unused deps.
|
|
101
|
+
→ Capture: dependency report (used in surgeon prompts).
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**0d. Save initial state.**
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
REQUIRED SUB-SKILL: rune:journal
|
|
108
|
+
→ Invoke `journal` to write RESCUE-STATE.md with:
|
|
109
|
+
- health_score_baseline: [autopsy score]
|
|
110
|
+
- modules_to_rescue: [ordered list from autopsy, worst-first]
|
|
111
|
+
- current_phase: "RECON complete"
|
|
112
|
+
- sessions_used: 1
|
|
113
|
+
- dependency_report: [summary]
|
|
114
|
+
|
|
115
|
+
REQUIRED SUB-SKILL: rune:session-bridge
|
|
116
|
+
→ Invoke `session-bridge` to snapshot state for cross-session resume.
|
|
117
|
+
|
|
118
|
+
Bash: git tag rune-rescue-baseline
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**0e. Build module surgery queue.**
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
From autopsy.modules, filter: health < 60
|
|
125
|
+
Sort: ascending health score (worst first)
|
|
126
|
+
Add one TodoWrite entry per module:
|
|
127
|
+
{ content: "SURGERY [module.name]: [recommended_pattern]", status: "pending", ... }
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Mark todo[0] `completed`.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### Phase 1 — SAFETY NET
|
|
135
|
+
|
|
136
|
+
Mark todo[1] `in_progress`. This phase runs once before any surgery.
|
|
137
|
+
|
|
138
|
+
**1a. Characterization tests.**
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
REQUIRED SUB-SKILL: rune:safeguard
|
|
142
|
+
→ Invoke `safeguard` with action: "characterize".
|
|
143
|
+
→ safeguard writes tests that capture CURRENT behavior (even buggy behavior).
|
|
144
|
+
→ These tests are the rollback oracle — if they break, surgery went wrong.
|
|
145
|
+
→ Capture: test file paths, test count.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**1b. Add boundary markers.**
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
REQUIRED SUB-SKILL: rune:safeguard
|
|
152
|
+
→ Invoke `safeguard` with action: "mark".
|
|
153
|
+
→ safeguard adds inline markers to legacy code:
|
|
154
|
+
@legacy — old implementation to be replaced
|
|
155
|
+
@new-v2 — new implementation being introduced
|
|
156
|
+
@bridge — compatibility shim between old and new
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**1c. Config freeze + rollback point.**
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
REQUIRED SUB-SKILL: rune:safeguard
|
|
163
|
+
→ Invoke `safeguard` with action: "freeze".
|
|
164
|
+
→ safeguard commits current state as checkpoint.
|
|
165
|
+
|
|
166
|
+
Bash: git add -A && git commit -m "chore: rescue safety net — characterization tests + markers"
|
|
167
|
+
Bash: git tag rune-rescue-safety-net
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Mark todo[1] `completed`.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### Phase 2-N — SURGERY (one module per session)
|
|
175
|
+
|
|
176
|
+
For each module in the surgery queue (one per session):
|
|
177
|
+
|
|
178
|
+
Mark the corresponding SURGERY todo `in_progress`.
|
|
179
|
+
|
|
180
|
+
**Sa. Pre-surgery check.**
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Verify:
|
|
184
|
+
[ ] Safety net tests pass (run characterization tests)
|
|
185
|
+
[ ] Module is not coupled to another in-progress module
|
|
186
|
+
[ ] Blast radius ≤ 5 files
|
|
187
|
+
|
|
188
|
+
Blast radius check:
|
|
189
|
+
Bash: grep -r "import.*[module-name]\|require.*[module-name]" --include="*.ts" --include="*.js" -l
|
|
190
|
+
Count files. If > 5:
|
|
191
|
+
→ STOP surgery on this module
|
|
192
|
+
→ Report: "Blast radius [N] files exceeds limit of 5 — use Strangler Fig pattern to reduce scope first"
|
|
193
|
+
→ Pick a smaller sub-module to start with
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Sb. Execute surgery.**
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
REQUIRED SUB-SKILL: rune:surgeon
|
|
200
|
+
→ Invoke `surgeon` with:
|
|
201
|
+
- module: [module name and path]
|
|
202
|
+
- pattern: [recommended_pattern from autopsy]
|
|
203
|
+
- blast_radius_files: [list from pre-surgery check]
|
|
204
|
+
- dependency_report: [from Phase 0]
|
|
205
|
+
- characterization_tests: [paths from Phase 1]
|
|
206
|
+
|
|
207
|
+
Supported patterns:
|
|
208
|
+
Strangler Fig — for modules > 500 LOC: route traffic to new impl gradually
|
|
209
|
+
Branch by Abstraction — for replacing implementations: introduce interface first
|
|
210
|
+
Expand-Migrate-Contract — for safe transitions: expand API, migrate callers, contract old API
|
|
211
|
+
Extract & Simplify — for cyclomatic complexity > 10: extract pure functions
|
|
212
|
+
|
|
213
|
+
surgeon returns: modified files list, refactoring summary, test results.
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Sc. Review surgery output.**
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
REQUIRED SUB-SKILL: rune:review
|
|
220
|
+
→ Invoke `review` with: modified files, surgeon summary.
|
|
221
|
+
→ review checks: code quality, pattern adherence, no regressions introduced.
|
|
222
|
+
→ Capture: review verdict (pass | fail | warnings).
|
|
223
|
+
|
|
224
|
+
If review verdict == fail:
|
|
225
|
+
→ STOP, do not commit
|
|
226
|
+
→ Report review findings to user
|
|
227
|
+
→ Revert surgeon changes: Bash: git checkout [modified-files]
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Sd. Run characterization tests.**
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
Bash: [project test command, e.g. npm test or pytest]
|
|
234
|
+
If tests fail:
|
|
235
|
+
→ STOP immediately
|
|
236
|
+
→ Report: "Characterization tests broken by surgery on [module] — reverting"
|
|
237
|
+
→ Bash: git checkout [modified-files]
|
|
238
|
+
→ Do NOT mark todo complete
|
|
239
|
+
→ Update RESCUE-STATE.md with failure note
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Se. Commit and save state.**
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
Bash: git add [modified-files]
|
|
246
|
+
Bash: git commit -m "refactor([module]): [pattern] — [brief description]"
|
|
247
|
+
|
|
248
|
+
REQUIRED SUB-SKILL: rune:journal
|
|
249
|
+
→ Update RESCUE-STATE.md:
|
|
250
|
+
- module [name]: status=complete, health_before=[X], health_after=[Y]
|
|
251
|
+
- sessions_used: [increment]
|
|
252
|
+
|
|
253
|
+
REQUIRED SUB-SKILL: rune:session-bridge
|
|
254
|
+
→ Save updated state for next session resume.
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Context check — before continuing to next module:**
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
If approaching context limit (50+ tool calls or user signals fatigue):
|
|
261
|
+
→ STOP after current module commit
|
|
262
|
+
→ Report: "Session limit reached. Rescue state saved. Resume with /rune rescue to continue."
|
|
263
|
+
→ Do NOT start next module in same session
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Mark SURGERY todo `completed`.
|
|
267
|
+
|
|
268
|
+
Repeat for each module in queue across subsequent sessions.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
### Phase N+1 — CLEANUP
|
|
273
|
+
|
|
274
|
+
Mark CLEANUP todo `in_progress`.
|
|
275
|
+
|
|
276
|
+
Run only after ALL surgery todos are `completed`.
|
|
277
|
+
|
|
278
|
+
**Remove boundary markers.**
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
Grep: find all @legacy, @bridge markers in codebase
|
|
282
|
+
Bash: grep -rn "@legacy\|@bridge" --include="*.ts" --include="*.js" -l
|
|
283
|
+
|
|
284
|
+
For each file with markers:
|
|
285
|
+
→ Remove @legacy blocks (old implementation replaced)
|
|
286
|
+
→ Remove @bridge shims (migration complete)
|
|
287
|
+
→ Keep @new-v2 comments only if they add documentation value; otherwise remove
|
|
288
|
+
Edit each file to strip markers.
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Verify markers removed.**
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
Bash: grep -rn "@legacy\|@bridge" --include="*.ts" --include="*.js"
|
|
295
|
+
Expected: no output. If any remain → fix before continuing.
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
Bash: git add -A && git commit -m "chore: rescue cleanup — remove @legacy and @bridge markers"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Mark CLEANUP todo `completed`.
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### Phase N+2 — VERIFY
|
|
307
|
+
|
|
308
|
+
Mark VERIFY todo `in_progress`.
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
Bash: [full test command]
|
|
312
|
+
Capture: passed, failed, coverage %.
|
|
313
|
+
|
|
314
|
+
If tests fail:
|
|
315
|
+
→ Do NOT mark rescue complete
|
|
316
|
+
→ Identify which module introduced failure
|
|
317
|
+
→ Report: "Final verify failed: [failing test list]"
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
```
|
|
321
|
+
REQUIRED SUB-SKILL: rune:autopsy
|
|
322
|
+
→ Invoke `autopsy` again with scope: "full".
|
|
323
|
+
→ Capture: health_score_final.
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Compare health scores.**
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
health_score_baseline: [from Phase 0 RESCUE-STATE.md]
|
|
330
|
+
health_score_final: [from this autopsy]
|
|
331
|
+
improvement: [final - baseline]
|
|
332
|
+
|
|
333
|
+
Report:
|
|
334
|
+
Rescue complete.
|
|
335
|
+
Health: [baseline] → [final] (+[improvement] points)
|
|
336
|
+
Modules refactored: [count]
|
|
337
|
+
Sessions used: [count]
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
REQUIRED SUB-SKILL: rune:journal
|
|
342
|
+
→ Final RESCUE-STATE.md update: status=complete, health_final=[score].
|
|
343
|
+
|
|
344
|
+
Bash: git tag rune-rescue-complete
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Mark VERIFY todo `completed`.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Status Command
|
|
352
|
+
|
|
353
|
+
`/rune rescue status` — reads RESCUE-STATE.md via `journal` and presents:
|
|
354
|
+
|
|
355
|
+
```
|
|
356
|
+
## Rescue Dashboard
|
|
357
|
+
- **Health Score**: [before] → [current] (target: [goal])
|
|
358
|
+
- **Modules**: [completed]/[total]
|
|
359
|
+
- **Current Phase**: [phase]
|
|
360
|
+
- **Sessions Used**: [count]
|
|
361
|
+
|
|
362
|
+
### Module Status
|
|
363
|
+
| Module | Status | Health | Pattern |
|
|
364
|
+
|--------|--------|--------|---------|
|
|
365
|
+
| auth | done | 72→91 | Strangler Fig |
|
|
366
|
+
| payments | in-progress | 34→?? | Extract & Simplify |
|
|
367
|
+
| legacy-api | pending | 28 | TBD |
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Safety Rules
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
NEVER refactor 2 coupled modules in same session
|
|
376
|
+
ALWAYS run characterization tests after each surgery
|
|
377
|
+
Max blast radius: 5 files per session
|
|
378
|
+
If context low → STOP, save state via journal + session-bridge, commit partial
|
|
379
|
+
Rollback point: git tag rune-rescue-baseline (set in Phase 0)
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Constraints
|
|
383
|
+
|
|
384
|
+
1. MUST run autopsy diagnostic BEFORE planning any refactoring — understand before changing
|
|
385
|
+
2. MUST create safety net (characterization tests via safeguard) BEFORE any code surgery
|
|
386
|
+
3. MUST NOT refactor two coupled modules simultaneously — one module per session
|
|
387
|
+
4. MUST run full test suite after EVERY individual edit — never accumulate failing tests
|
|
388
|
+
5. MUST tag a safe rollback point before starting surgery
|
|
389
|
+
6. MUST NOT exceed blast radius of 5 files per surgical session
|
|
390
|
+
|
|
391
|
+
## Mesh Gates
|
|
392
|
+
|
|
393
|
+
| Gate | Requires | If Missing |
|
|
394
|
+
|------|----------|------------|
|
|
395
|
+
| Autopsy Gate | autopsy report with health score before planning | Run rune:autopsy first |
|
|
396
|
+
| Safety Gate | safeguard characterization tests passing before surgery | Run rune:safeguard first |
|
|
397
|
+
| Surgery Gate | Each edit verified individually (tests pass) | Revert last edit, fix, re-verify |
|
|
398
|
+
|
|
399
|
+
## Output Format
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
## Rescue Report: [Module Name]
|
|
403
|
+
- **Status**: complete | partial | blocked
|
|
404
|
+
- **Modules Refactored**: [count]
|
|
405
|
+
- **Tests Before**: [count] ([pass rate]%)
|
|
406
|
+
- **Tests After**: [count] ([pass rate]%)
|
|
407
|
+
- **Health Score**: [before] → [after]
|
|
408
|
+
- **Rollback Tag**: [git tag name]
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## Sharp Edges
|
|
412
|
+
|
|
413
|
+
Known failure modes for this skill. Check these before declaring done.
|
|
414
|
+
|
|
415
|
+
| Failure Mode | Severity | Mitigation |
|
|
416
|
+
|---|---|---|
|
|
417
|
+
| Starting surgery before safety net committed and tagged | CRITICAL | HARD-GATE: `rune-rescue-safety-net` git tag must exist before Phase 2 |
|
|
418
|
+
| Refactoring two coupled modules in the same session | HIGH | HARD-GATE: one module per session — split coupled modules into sequential sessions |
|
|
419
|
+
| Blast radius > 5 files before surgery halted | HIGH | Count importers before each surgery — stop if > 5 and split scope |
|
|
420
|
+
| Not saving state between sessions (rescue spans many sessions) | MEDIUM | journal + session-bridge mandatory after each session — RESCUE-STATE.md must be current |
|
|
421
|
+
| Continuing surgery after characterization tests fail on current code | MEDIUM | Tests must PASS on unmodified code first — fix the test if current behavior is captured wrongly |
|
|
422
|
+
|
|
423
|
+
## Done When
|
|
424
|
+
|
|
425
|
+
- autopsy complete with quantified health score and surgery queue
|
|
426
|
+
- safeguard characterization tests passing on current code (HARD-GATE)
|
|
427
|
+
- All modules in surgery queue processed (one per session)
|
|
428
|
+
- @legacy and @bridge markers removed from codebase (CLEANUP phase)
|
|
429
|
+
- Final autopsy run — health_score_final > health_score_baseline
|
|
430
|
+
- Rescue Report emitted with before/after health comparison and session count
|
|
431
|
+
|
|
432
|
+
## Cost Profile
|
|
433
|
+
|
|
434
|
+
~$0.10-0.30 per session. Sonnet for surgery, opus for autopsy. Multi-session workflow.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research
|
|
3
|
+
description: Web search and external knowledge lookup. Gathers data on technologies, libraries, best practices, and competitor solutions.
|
|
4
|
+
metadata:
|
|
5
|
+
author: runedev
|
|
6
|
+
version: "0.2.0"
|
|
7
|
+
layer: L3
|
|
8
|
+
model: haiku
|
|
9
|
+
group: knowledge
|
|
10
|
+
tools: "Read, Glob, Grep, WebFetch, WebSearch"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# research
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Web research utility. Receives a research question, executes targeted searches, deep-dives into top results, and returns structured findings with sources. Stateless — no memory between calls.
|
|
18
|
+
|
|
19
|
+
## Calls (outbound)
|
|
20
|
+
|
|
21
|
+
None — pure L3 utility using `WebSearch` and `WebFetch` tools directly.
|
|
22
|
+
|
|
23
|
+
## Called By (inbound)
|
|
24
|
+
|
|
25
|
+
- `plan` (L2): external knowledge for architecture decisions
|
|
26
|
+
- `brainstorm` (L2): data for informed ideation
|
|
27
|
+
- `marketing` (L2): competitor analysis, SEO data
|
|
28
|
+
- `hallucination-guard` (L3): verify package existence on npm/pypi
|
|
29
|
+
- `autopsy` (L2): research best practices for legacy patterns
|
|
30
|
+
|
|
31
|
+
## Execution
|
|
32
|
+
|
|
33
|
+
### Input
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
research_question: string — what to research
|
|
37
|
+
focus: string (optional) — narrow the scope (e.g., "security", "performance")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Step 1 — Formulate Queries
|
|
41
|
+
|
|
42
|
+
Generate 2-3 targeted search queries from the research question. Vary phrasing to cover different angles:
|
|
43
|
+
- Primary: direct question as search terms
|
|
44
|
+
- Secondary: "[topic] best practices 2026" or "[topic] vs alternatives"
|
|
45
|
+
- Tertiary: "[topic] example" or "[topic] tutorial" if implementation detail needed
|
|
46
|
+
|
|
47
|
+
### Step 2 — Search
|
|
48
|
+
|
|
49
|
+
Call `WebSearch` for each query. Collect result titles, URLs, and snippets. Identify the top 3-5 most relevant URLs based on:
|
|
50
|
+
- Source authority (official docs, major blogs, GitHub repos)
|
|
51
|
+
- Recency (prefer 2025-2026)
|
|
52
|
+
- Relevance to the query
|
|
53
|
+
|
|
54
|
+
### Step 3 — Deep Dive
|
|
55
|
+
|
|
56
|
+
Call `WebFetch` on the top 3-5 URLs identified in Step 2. Hard limit: **max 5 WebFetch calls** per research invocation. For each fetched page:
|
|
57
|
+
- Extract key facts, API signatures, code examples
|
|
58
|
+
- Note the source URL and publication date if visible
|
|
59
|
+
|
|
60
|
+
### Step 4 — Synthesize
|
|
61
|
+
|
|
62
|
+
Across all fetched content:
|
|
63
|
+
- Identify points of consensus across sources
|
|
64
|
+
- Flag any conflicting information explicitly (e.g., "Source A says X, Source B says Y")
|
|
65
|
+
- Assign confidence: `high` (3+ sources agree), `medium` (1-2 sources), `low` (single source or unclear)
|
|
66
|
+
|
|
67
|
+
### Step 5 — Report
|
|
68
|
+
|
|
69
|
+
Return structured findings in the output format below.
|
|
70
|
+
|
|
71
|
+
## Constraints
|
|
72
|
+
|
|
73
|
+
- Always cite source URL for every finding
|
|
74
|
+
- Flag conflicting information — never silently pick one side
|
|
75
|
+
- Max 5 WebFetch calls per invocation
|
|
76
|
+
- If no useful results found, report that explicitly rather than fabricating
|
|
77
|
+
|
|
78
|
+
## Output Format
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
## Research Results: [Query]
|
|
82
|
+
- **Sources fetched**: [n]
|
|
83
|
+
- **Confidence**: high | medium | low
|
|
84
|
+
|
|
85
|
+
### Key Findings
|
|
86
|
+
- [finding] — [source URL]
|
|
87
|
+
- [finding] — [source URL]
|
|
88
|
+
|
|
89
|
+
### Conflicts / Caveats
|
|
90
|
+
- [Source A] says X. [Source B] says Y. Recommend verifying against [authority].
|
|
91
|
+
|
|
92
|
+
### Code Examples
|
|
93
|
+
```[lang]
|
|
94
|
+
[relevant snippet]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Recommendations
|
|
98
|
+
- [actionable suggestion based on findings]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Sharp Edges
|
|
102
|
+
|
|
103
|
+
Known failure modes for this skill. Check these before declaring done.
|
|
104
|
+
|
|
105
|
+
| Failure Mode | Severity | Mitigation |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| Fabricating findings when no useful results found | CRITICAL | Constraint: report "no useful results found" explicitly — never invent citations |
|
|
108
|
+
| Reporting conflicting sources without flagging the conflict | HIGH | Constraint: flag conflicting information explicitly, never silently pick one side |
|
|
109
|
+
| Assigning "high" confidence from a single source | MEDIUM | High = 3+ sources agree; 1-2 sources = medium confidence |
|
|
110
|
+
| Exceeding 5 WebFetch calls per invocation | MEDIUM | Hard limit: prioritize top 3-5 URLs from search, fetch only the most relevant |
|
|
111
|
+
|
|
112
|
+
## Done When
|
|
113
|
+
|
|
114
|
+
- 2-3 search queries formulated and executed
|
|
115
|
+
- Top 3-5 URLs identified and fetched (max 5 WebFetch calls)
|
|
116
|
+
- Conflicting information between sources explicitly flagged
|
|
117
|
+
- Confidence level assigned (high/medium/low) with rationale
|
|
118
|
+
- Research Results emitted with source URLs for every key finding
|
|
119
|
+
|
|
120
|
+
## Cost Profile
|
|
121
|
+
|
|
122
|
+
~300-800 tokens input, ~200-500 tokens output. Haiku. Fast and cheap.
|