@sentry/warden 0.21.0 → 0.22.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 (55) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/README.md +3 -3
  3. package/dist/cli/commands/runs.d.ts.map +1 -1
  4. package/dist/cli/commands/runs.js +68 -10
  5. package/dist/cli/commands/runs.js.map +1 -1
  6. package/dist/cli/log-cleanup.d.ts.map +1 -1
  7. package/dist/cli/log-cleanup.js +4 -0
  8. package/dist/cli/log-cleanup.js.map +1 -1
  9. package/dist/cli/main.d.ts.map +1 -1
  10. package/dist/cli/main.js +218 -26
  11. package/dist/cli/main.js.map +1 -1
  12. package/dist/cli/output/index.d.ts +1 -1
  13. package/dist/cli/output/index.d.ts.map +1 -1
  14. package/dist/cli/output/index.js +1 -1
  15. package/dist/cli/output/index.js.map +1 -1
  16. package/dist/cli/output/ink-runner.d.ts.map +1 -1
  17. package/dist/cli/output/ink-runner.js +19 -1
  18. package/dist/cli/output/ink-runner.js.map +1 -1
  19. package/dist/cli/output/jsonl-schema-gen.d.ts.map +1 -1
  20. package/dist/cli/output/jsonl-schema-gen.js +4 -2
  21. package/dist/cli/output/jsonl-schema-gen.js.map +1 -1
  22. package/dist/cli/output/jsonl.d.ts +110 -4
  23. package/dist/cli/output/jsonl.d.ts.map +1 -1
  24. package/dist/cli/output/jsonl.js +177 -7
  25. package/dist/cli/output/jsonl.js.map +1 -1
  26. package/dist/cli/output/tasks.d.ts +4 -1
  27. package/dist/cli/output/tasks.d.ts.map +1 -1
  28. package/dist/cli/output/tasks.js +17 -1
  29. package/dist/cli/output/tasks.js.map +1 -1
  30. package/dist/sdk/analyze.d.ts.map +1 -1
  31. package/dist/sdk/analyze.js +20 -0
  32. package/dist/sdk/analyze.js.map +1 -1
  33. package/dist/sdk/runner.d.ts +1 -1
  34. package/dist/sdk/runner.d.ts.map +1 -1
  35. package/dist/sdk/types.d.ts +19 -0
  36. package/dist/sdk/types.d.ts.map +1 -1
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/index.d.ts.map +1 -1
  39. package/dist/types/index.js +13 -0
  40. package/dist/types/index.js.map +1 -1
  41. package/package.json +1 -1
  42. package/skills/warden/SKILL.md +5 -5
  43. package/skills/warden/SOURCES.md +39 -0
  44. package/skills/warden/references/cli-reference.md +11 -4
  45. package/skills/warden/references/config-schema.md +9 -0
  46. package/skills/warden/references/configuration.md +9 -0
  47. package/skills/warden-sweep/SKILL.md +43 -365
  48. package/skills/warden-sweep/SOURCES.md +43 -0
  49. package/skills/warden-sweep/references/issue-phase.md +24 -0
  50. package/skills/warden-sweep/references/organize-phase.md +31 -0
  51. package/skills/warden-sweep/references/patch-phase.md +142 -0
  52. package/skills/warden-sweep/references/resume-and-artifacts.md +51 -0
  53. package/skills/warden-sweep/references/scan-phase.md +46 -0
  54. package/skills/warden-sweep/references/script-interfaces.md +127 -0
  55. package/skills/warden-sweep/references/verify-phase.md +69 -0
@@ -1,5 +1,14 @@
1
1
  # warden.toml Configuration Schema
2
2
 
3
+ ## Contents
4
+
5
+ - Top-Level Structure
6
+ - Defaults Section
7
+ - Skills Section
8
+ - Severity Values
9
+ - Built-in Skip Patterns
10
+ - Environment Variables
11
+
3
12
  ## Top-Level Structure
4
13
 
5
14
  ```toml
@@ -1,5 +1,14 @@
1
1
  # Configuration (warden.toml)
2
2
 
3
+ ## Contents
4
+
5
+ - Minimal Example
6
+ - Skill Configuration
7
+ - Common Patterns
8
+ - Model Precedence
9
+ - Environment Variables
10
+ - Troubleshooting
11
+
3
12
  See [config-schema.md](config-schema.md) for the complete schema reference.
4
13
 
5
14
  ## Minimal Example
@@ -1,350 +1,70 @@
1
1
  ---
2
2
  name: warden-sweep
3
- description: Full-repository code sweep. Scans every file with warden, verifies findings via deep tracing, creates draft PRs for validated issues. Use when asked to "sweep the repo", "scan everything", "find all bugs", "full codebase review", "batch code analysis", or run warden across the entire repository.
3
+ description: Full-repository code sweep. Scans every file with Warden, verifies findings through deep tracing, creates draft PRs for validated issues. Use when asked to "sweep the repo", "scan everything", "find all bugs", "full codebase review", "batch code analysis", or run Warden across the entire repository.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # Warden Sweep
8
8
 
9
- Full-repository code sweep: scan every file, verify findings with deep tracing, create draft PRs for validated issues.
9
+ Run a full-repository Warden sweep: scan files, verify findings, create a tracking issue, open draft PRs for validated issues, and organize the final report.
10
10
 
11
- **Requires**: `warden`, `gh`, `git`, `jq`, `uv`
11
+ **Requires**: `warden`, `gh`, `git`, `jq`, `uv`.
12
12
 
13
- **Important**: Run all scripts from the repository root using `${CLAUDE_SKILL_ROOT}`. Output goes to `.warden/sweeps/<run-id>/`.
13
+ Run commands from the repository root. Use the host's skill-root path for bundled scripts and references.
14
14
 
15
- ## Bundled Scripts
15
+ Output goes to `.warden/sweeps/<run-id>/`.
16
16
 
17
- ### `scripts/scan.py`
17
+ ## References
18
18
 
19
- Runs setup and scan in one call: generates run ID, creates sweep dir, checks deps, creates `warden` label, enumerates files, runs warden per file, extracts findings.
19
+ Load only the reference for the current phase:
20
20
 
21
- ```bash
22
- uv run ${CLAUDE_SKILL_ROOT}/scripts/scan.py [file ...]
23
- --sweep-dir DIR # Resume into existing sweep dir
24
- ```
25
-
26
- ### `scripts/index_prs.py`
27
-
28
- Fetches open warden-labeled PRs, builds file-to-PR dedup index, caches diffs for overlapping PRs.
29
-
30
- ```bash
31
- uv run ${CLAUDE_SKILL_ROOT}/scripts/index_prs.py <sweep-dir>
32
- ```
33
-
34
- ### `scripts/create_issue.py`
35
-
36
- Creates a GitHub tracking issue summarizing sweep results. Run after verification, before patching.
37
-
38
- ```bash
39
- uv run ${CLAUDE_SKILL_ROOT}/scripts/create_issue.py <sweep-dir>
40
- ```
41
-
42
- ### `scripts/organize.py`
43
-
44
- Tags security findings, labels security PRs, updates finding reports with PR links, posts final results to tracking issue, generates summary report, finalizes manifest.
45
-
46
- ```bash
47
- uv run ${CLAUDE_SKILL_ROOT}/scripts/organize.py <sweep-dir>
48
- ```
49
-
50
- ### `scripts/extract_findings.py`
51
-
52
- Parses warden JSONL log files and extracts normalized findings. Called automatically by `scan.py`.
53
-
54
- ```bash
55
- uv run ${CLAUDE_SKILL_ROOT}/scripts/extract_findings.py <log-path-or-directory> -o <output.jsonl>
56
- ```
57
-
58
- ### `scripts/generate_report.py`
59
-
60
- Builds `summary.md` and `report.json` from sweep data. Called automatically by `organize.py`.
61
-
62
- ```bash
63
- uv run ${CLAUDE_SKILL_ROOT}/scripts/generate_report.py <sweep-dir>
64
- ```
65
-
66
- ### `scripts/find_reviewers.py`
67
-
68
- Finds top 2 git contributors for a file (last 12 months).
69
-
70
- ```bash
71
- uv run ${CLAUDE_SKILL_ROOT}/scripts/find_reviewers.py <file-path>
72
- ```
73
-
74
- Returns JSON: `{"reviewers": ["user1", "user2"]}`
75
-
76
- ---
77
-
78
- ## Phase 1: Scan
79
-
80
- **Run** (1 tool call):
81
-
82
- ```bash
83
- uv run ${CLAUDE_SKILL_ROOT}/scripts/scan.py
84
- ```
85
-
86
- To resume a partial scan:
87
-
88
- ```bash
89
- uv run ${CLAUDE_SKILL_ROOT}/scripts/scan.py --sweep-dir .warden/sweeps/<run-id>
90
- ```
91
-
92
- Parse the JSON stdout. Save `runId` and `sweepDir` for subsequent phases.
93
-
94
- **Report** to user:
95
-
96
- ```
97
- ## Scan Complete
98
-
99
- Scanned **{filesScanned}** files, **{filesTimedOut}** timed out, **{filesErrored}** errors.
100
-
101
- ### Findings ({totalFindings} total)
102
-
103
- | # | Severity | Skill | File | Title |
104
- |---|----------|-------|------|-------|
105
- | 1 | **HIGH** | security-review | `src/db/query.ts:42` | SQL injection in query builder |
106
- ...
107
- ```
21
+ | Need | Read |
22
+ |------|------|
23
+ | Script arguments, outputs, and side effects | `references/script-interfaces.md` |
24
+ | Phase 1 scan workflow | `references/scan-phase.md` |
25
+ | Phase 2 verification workflow | `references/verify-phase.md` |
26
+ | Phase 3 tracking issue workflow | `references/issue-phase.md` |
27
+ | Phase 4 patch and draft PR workflow | `references/patch-phase.md` |
28
+ | Phase 5 organize and final report workflow | `references/organize-phase.md` |
29
+ | Resume behavior and artifact layout | `references/resume-and-artifacts.md` |
30
+ | Verification task prompt template | `references/verify-prompt.md` |
31
+ | Patch task prompt template | `references/patch-prompt.md` |
108
32
 
109
- Render every finding from the `findings` array. Bold severity for high and above.
33
+ ## Workflow
110
34
 
111
- **On failure**: If exit code 1, show the error JSON and stop. If exit code 2, show the partial results. List timed-out files separately from errored files so users know which can be retried.
35
+ Track progress across phases:
112
36
 
113
- ---
114
-
115
- ## Phase 2: Verify
116
-
117
- Deep-trace each finding using Task subagents to qualify or disqualify.
37
+ - [ ] Phase 1: Scan repository files with Warden.
38
+ - [ ] Phase 2: Verify findings before patching.
39
+ - [ ] Phase 3: Create a tracking issue.
40
+ - [ ] Phase 4: Patch verified findings and open draft PRs.
41
+ - [ ] Phase 5: Organize results and produce the final report.
118
42
 
119
- **For each finding in `data/all-findings.jsonl`:**
43
+ ## Phase Order
120
44
 
121
- Check if `data/verify/<finding-id>.json` already exists (incrementality). If it does, skip.
45
+ 1. Read `references/script-interfaces.md` once before running scripts.
46
+ 2. Run Phase 1 from `references/scan-phase.md`. Save `runId` and `sweepDir`.
47
+ 3. Run Phase 2 from `references/verify-phase.md`. Verify every finding before patching.
48
+ 4. Run Phase 3 from `references/issue-phase.md`. Continue if issue creation fails.
49
+ 5. Run Phase 4 from `references/patch-phase.md`. Patch sequentially, one finding at a time.
50
+ 6. Run Phase 5 from `references/organize-phase.md`.
51
+ 7. For interrupted or partial runs, read `references/resume-and-artifacts.md` and continue from the first incomplete phase.
122
52
 
123
- Launch a Task subagent (`subagent_type: "general-purpose"`) for each finding. Process findings in parallel batches of up to 8 to improve throughput.
53
+ ## Non-Negotiable Rules
124
54
 
125
- **Task prompt for each finding:**
55
+ - Verify findings before creating fixes.
56
+ - Use draft PRs for generated patches.
57
+ - Branch every patch from the repository default branch.
58
+ - Patch findings sequentially; do not run patch workers in parallel.
59
+ - Skip existing entries in sweep artifacts instead of duplicating work.
60
+ - Record failures in sweep data and continue to the next finding when possible.
61
+ - Clean up each worktree after patch success or failure.
126
62
 
127
- Read `${CLAUDE_SKILL_ROOT}/references/verify-prompt.md` for the prompt template. Substitute the finding's values into the `${...}` placeholders.
63
+ ## Final Response
128
64
 
129
- **Process results:**
130
-
131
- Parse the JSON from the subagent response and:
132
- - Write result to `data/verify/<finding-id>.json`
133
- - Append to `data/verified.jsonl` or `data/rejected.jsonl`
134
- - For verified findings, generate `findings/<finding-id>.md`:
65
+ After organizing, report:
135
66
 
136
67
  ```markdown
137
- # ${TITLE}
138
-
139
- **ID**: ${FINDING_ID} | **Severity**: ${SEVERITY} | **Confidence**: ${CONFIDENCE}
140
- **Skill**: ${SKILL} | **File**: ${FILE_PATH}:${START_LINE}
141
-
142
- ## Description
143
- ${DESCRIPTION}
144
-
145
- ## Verification
146
- **Verdict**: Verified (${VERIFICATION_CONFIDENCE})
147
- **Reasoning**: ${REASONING}
148
- **Code trace**: ${TRACE_NOTES}
149
-
150
- ## Suggested Fix
151
- ${FIX_DESCRIPTION}
152
- ```diff
153
- ${FIX_DIFF}
154
- ```
155
- ```
156
-
157
- Update manifest: set `phases.verify` to `"complete"`.
158
-
159
- **Report** to user after all verifications:
160
-
161
- ```
162
- ## Verification Complete
163
-
164
- **{verified}** verified, **{rejected}** rejected.
165
-
166
- ### Verified Findings
167
-
168
- | # | Severity | Confidence | File | Title | Reasoning |
169
- |---|----------|------------|------|-------|-----------|
170
- | 1 | **HIGH** | high | `src/db/query.ts:42` | SQL injection in query builder | User input flows directly into... |
171
- ...
172
-
173
- ### Rejected ({rejected_count})
174
-
175
- - `{findingId}` {file}: {reasoning}
176
- ...
177
- ```
178
-
179
- ---
180
-
181
- ## Phase 3: Issue
182
-
183
- Create a tracking issue that ties all PRs together and gives reviewers a single overview.
184
-
185
- **Run** (1 tool call):
186
-
187
- ```bash
188
- uv run ${CLAUDE_SKILL_ROOT}/scripts/create_issue.py ${SWEEP_DIR}
189
- ```
190
-
191
- Parse the JSON stdout. Save `issueUrl` and `issueNumber` for Phase 4.
192
-
193
- **Report** to user:
194
-
195
- ```
196
- ## Tracking Issue Created
197
-
198
- {issueUrl}
199
- ```
200
-
201
- **On failure**: Show the error. Continue to Phase 4 (PRs can still be created without a tracking issue).
202
-
203
- ---
204
-
205
- ## Phase 4: Patch
206
-
207
- For each verified finding, create a worktree, fix the code, and open a draft PR. Process findings **sequentially** (one at a time) since parallel subagents cross-contaminate worktrees.
208
-
209
- **Severity triage**: Patch HIGH and above. For MEDIUM, only patch findings from bug-detection skills (e.g., `code-review`, `security-review`). Skip LOW and INFO findings.
210
-
211
- **Step 0: Setup** (run once before the loop):
212
-
213
- ```bash
214
- uv run ${CLAUDE_SKILL_ROOT}/scripts/index_prs.py ${SWEEP_DIR}
215
- ```
216
-
217
- Parse the JSON stdout. Use `fileIndex` for dedup checks.
218
-
219
- Determine the default branch and fetch latest so worktrees branch from current upstream:
220
-
221
- ```bash
222
- DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')
223
- git fetch origin "${DEFAULT_BRANCH}"
224
- ```
225
-
226
- **For each finding in `data/verified.jsonl`:**
227
-
228
- Check if finding ID already exists in `data/patches.jsonl` (incrementality). If it does, skip.
229
-
230
- **Dedup check**: Use the file index from `index_prs.py` output to determine if an existing open PR already addresses the same issue.
231
-
232
- 1. **File match**: Look up the finding's file path in the `fileIndex`. If no PR touches that file, no conflict; proceed to Step 1.
233
- 2. **Chunk overlap**: If a PR does touch the same file, read its cached diff from `data/pr-diffs/<number>.diff` and check whether the PR's changed hunks overlap with the finding's line range (startLine-endLine). Overlapping or adjacent hunks (within ~10 lines) indicate the same code region.
234
- 3. **Same concern**: If the hunks overlap, compare the PR title and the finding title/description. Are they fixing the same kind of defect? A PR fixing an off-by-one error and a finding about a null check in the same function are different issues; both should proceed.
235
-
236
- Skip the finding only when there is both chunk overlap AND the PR addresses the same concern. Record it in `data/patches.jsonl` with `"status": "existing"` and `"prUrl"` pointing to the matching PR, then continue to the next finding.
237
-
238
- **Step 1: Create worktree**
239
-
240
- ```bash
241
- BRANCH="warden-sweep/${RUN_ID}/${FINDING_ID}"
242
- WORKTREE="${SWEEP_DIR}/worktrees/${FINDING_ID}"
243
- git worktree add "${WORKTREE}" -b "${BRANCH}" "origin/${DEFAULT_BRANCH}"
244
- ```
245
-
246
- Each finding branches from the repo's default branch so PRs contain only the fix commit.
247
-
248
- **Step 2: Generate fix**
249
-
250
- Launch a Task subagent (`subagent_type: "general-purpose"`) to apply the fix in the worktree. Read `${CLAUDE_SKILL_ROOT}/references/patch-prompt.md` for the prompt template. Substitute the finding's values and worktree path into the `${...}` placeholders.
251
-
252
- **Step 2b: Handle skipped findings**
253
-
254
- If the subagent returned `"status": "skipped"` (not `"applied"`), do NOT proceed to Steps 3-4. Instead:
255
- 1. Record the finding in `data/patches.jsonl` with `"status": "error"` and `"error": "Subagent skipped: ${skipReason}"`
256
- 2. Clean up the worktree
257
- 3. Continue to the next finding
258
-
259
- **Step 3: Find reviewers**
260
-
261
- ```bash
262
- uv run ${CLAUDE_SKILL_ROOT}/scripts/find_reviewers.py "${FILE_PATH}"
263
- ```
264
-
265
- **Step 4: Create draft PR**
266
-
267
- ```bash
268
- cd "${WORKTREE}" && git push -u origin HEAD:"${BRANCH}"
269
- ```
270
-
271
- Create the PR with a 1-2 sentence "What" summary based on the finding and fix, followed by the finding description and verification reasoning:
272
-
273
- ```bash
274
- REVIEWERS=""
275
- # If find_reviewers.py returned reviewers, build the flags
276
- # e.g., REVIEWERS="--reviewer user1 --reviewer user2"
277
-
278
- gh pr create --draft \
279
- --label "warden" \
280
- --title "fix: ${TITLE}" \
281
- --body "$(cat <<'EOF'
282
- ${FIX_WHAT_DESCRIPTION}
283
-
284
- ${DESCRIPTION}
285
-
286
- ${REASONING}
287
-
288
- Automated fix for Warden finding ${FINDING_ID} (${SEVERITY}, detected by ${SKILL}).
289
-
290
- <!-- Only include the next line if Phase 3 succeeded and ISSUE_NUMBER is available -->
291
- Ref #${ISSUE_NUMBER}
292
-
293
- > This PR was auto-generated by a Warden Sweep (run ${RUN_ID}).
294
- > The finding has been validated through automated deep tracing,
295
- > but human confirmation is requested as this is batch work.
296
- EOF
297
- )" ${REVIEWERS}
298
- ```
299
-
300
- Save the PR URL.
301
-
302
- **Step 5: Record and cleanup**
303
-
304
- Append to `data/patches.jsonl` (use `"created"` as status for successful PRs, not the subagent's `"applied"`):
305
- ```json
306
- {"findingId": "...", "prUrl": "https://...", "branch": "...", "reviewers": ["user1", "user2"], "filesChanged": ["..."], "status": "created|existing|error"}
307
- ```
308
-
309
- Remove the worktree:
310
- ```bash
311
- cd "$(git rev-parse --show-toplevel)"
312
- git worktree remove "${WORKTREE}" --force
313
- ```
314
-
315
- **Error handling**: On failure at any step, write to `data/patches.jsonl` with `"status": "error"` and `"error": "..."`, clean up the worktree, and continue to the next finding.
316
-
317
- Update manifest: set `phases.patch` to `"complete"`.
318
-
319
- **Report** to user after all patches:
320
-
321
- ```
322
- ## PRs Created
323
-
324
- **{created}** created, **{skipped}** skipped (existing), **{failed}** failed.
325
-
326
- | # | Finding | PR | Status |
327
- |---|---------|-----|--------|
328
- | 1 | `security-review-a1b2c3d4` SQL injection in query builder | #142 | created |
329
- | 2 | `code-review-e5f6g7h8` Null pointer in handler | - | existing (#138) |
330
- ...
331
- ```
332
-
333
- ---
334
-
335
- ## Phase 5: Organize
336
-
337
- **Run** (1 tool call):
338
-
339
- ```bash
340
- uv run ${CLAUDE_SKILL_ROOT}/scripts/organize.py ${SWEEP_DIR}
341
- ```
342
-
343
- Parse the JSON stdout.
344
-
345
- **Report** to user:
346
-
347
- ```
348
68
  ## Sweep Complete
349
69
 
350
70
  | Metric | Count |
@@ -356,45 +76,3 @@ Parse the JSON stdout.
356
76
 
357
77
  Full report: `{summaryPath}`
358
78
  ```
359
-
360
- **On failure**: Show the error and note which steps completed.
361
-
362
- ---
363
-
364
- ## Resuming a Sweep
365
-
366
- Each phase is incremental. To resume from where you left off:
367
-
368
- 1. Check `data/manifest.json` to see which phases are complete
369
- 2. For scan: pass `--sweep-dir` to `scan.py`
370
- 3. For verify: existing `data/verify/<id>.json` files are skipped
371
- 4. For issue: `create_issue.py` is idempotent (skips if `issueUrl` in manifest)
372
- 5. For patch: existing entries in `data/patches.jsonl` are skipped
373
- 6. For organize: safe to re-run (idempotent)
374
-
375
- ## Output Directory Structure
376
-
377
- ```
378
- .warden/sweeps/<run-id>/
379
- summary.md # Stats, key findings, PR links
380
- findings/ # One markdown per verified finding
381
- <finding-id>.md
382
- security/ # Security-specific view
383
- index.jsonl # Security findings index
384
- <finding-id>.md # Copies of security findings
385
- data/ # Structured data for tooling
386
- manifest.json # Run metadata, phase state
387
- scan-index.jsonl # Per-file scan tracking
388
- all-findings.jsonl # Every finding from scan
389
- verified.jsonl # Findings that passed verification
390
- rejected.jsonl # Findings that failed verification
391
- patches.jsonl # Finding -> PR URL -> reviewers
392
- existing-prs.json # Cached open warden PRs
393
- report.json # Machine-readable summary
394
- verify/ # Individual verification results
395
- <finding-id>.json
396
- logs/ # Warden JSONL logs per file
397
- <hash>.jsonl
398
- pr-diffs/ # Cached PR diffs for dedup
399
- <number>.diff
400
- ```
@@ -0,0 +1,43 @@
1
+ # Warden Sweep Sources
2
+
3
+ ## Source Inventory
4
+
5
+ | Source | Trust tier | Confidence | Usage constraints |
6
+ |--------|------------|------------|-------------------|
7
+ | `skills/warden-sweep/SKILL.md` | canonical runtime | high | Keep as router and phase overview. |
8
+ | `skills/warden-sweep/references/*.md` | bundled runtime references | high | Keep focused by phase or lookup need. |
9
+ | `skills/warden-sweep/scripts/*.py` | executable workflow | high | Script interfaces in references must match these files. |
10
+ | `src/cli/output/jsonl.ts` | Warden output contract | high | Verify JSONL parsing assumptions when Warden output changes. |
11
+ | `src/output/renderer.ts` and `src/types/` | finding/report semantics | high | Verify severity, confidence, and finding fields here. |
12
+ | GitHub CLI commands used by scripts | external tool contract | medium | Confirm command flags when GitHub CLI behavior changes. |
13
+
14
+ ## Coverage Matrix
15
+
16
+ | Dimension | Coverage status | Evidence |
17
+ |-----------|-----------------|----------|
18
+ | Workflow phases | covered | `SKILL.md` routes scan, verify, issue, patch, organize, and resume behavior to focused references. |
19
+ | Script interfaces | covered | `references/script-interfaces.md` lists scripts, arguments, outputs, and side effects. |
20
+ | Artifact schema | covered | `references/resume-and-artifacts.md` documents directories and key JSONL/JSON files. |
21
+ | Verification behavior | covered | `references/verify-phase.md` and `references/verify-prompt.md` define qualification and rejection behavior. |
22
+ | Patch behavior | covered | `references/patch-phase.md` and `references/patch-prompt.md` define triage, worktree isolation, draft PR creation, and cleanup. |
23
+ | Known issues/workarounds | partial | Resume, partial scans, skipped findings, and existing PR dedup are covered; CI follow-up and rate-limit recovery are not. |
24
+ | Version/migration variance | partial | Current artifact names and script interfaces are documented; no formal migration path exists for old sweep directories. |
25
+
26
+ ## Decisions
27
+
28
+ - Split phase detail out of `SKILL.md` so agents load only the current phase instructions.
29
+ - Keep script interface documentation separate from phase runbooks because scripts are reused across phases and by resume workflows.
30
+ - Describe verification and patch work in host-neutral terms while allowing parallel agent tasks when the host supports them.
31
+ - Keep prompt templates as separate references because they are substituted into delegated verification and patch work.
32
+ - Keep generated sweep artifacts under `.warden/sweeps/<run-id>/` so runs are resumable and isolated from normal source files.
33
+
34
+ ## Open Gaps
35
+
36
+ - Add a redacted fixture sweep to validate the full workflow without touching real GitHub repositories.
37
+ - Document rate-limit and permission failure recovery if these become common in real sweeps.
38
+ - Add migration notes if artifact schemas change after users have existing sweep directories.
39
+ - Consider adding a script-level dry-run mode for issue and PR creation.
40
+
41
+ ## Changelog
42
+
43
+ - 2026-04-27: Reverse-engineered maintenance spec and split the distributed `warden-sweep` workflow into phase references.
@@ -0,0 +1,24 @@
1
+ # Issue Phase
2
+
3
+ Create a tracking issue that ties all generated PRs together and gives reviewers one overview.
4
+
5
+ ## Run
6
+
7
+ ```bash
8
+ uv run <skill-root>/scripts/create_issue.py ${SWEEP_DIR}
9
+ ```
10
+
11
+ ## Process
12
+
13
+ 1. Parse the JSON stdout.
14
+ 2. Save `issueUrl` and `issueNumber`.
15
+ 3. If the script fails, show the error and continue to the patch phase. PRs can still be created without a tracking issue.
16
+ 4. Update the checklist: Phase 3 complete.
17
+
18
+ ## Report Template
19
+
20
+ ```markdown
21
+ ## Tracking Issue Created
22
+
23
+ {issueUrl}
24
+ ```
@@ -0,0 +1,31 @@
1
+ # Organize Phase
2
+
3
+ Finalize sweep artifacts, security views, PR links, and the summary report.
4
+
5
+ ## Run
6
+
7
+ ```bash
8
+ uv run <skill-root>/scripts/organize.py ${SWEEP_DIR}
9
+ ```
10
+
11
+ ## Process
12
+
13
+ 1. Parse the JSON stdout.
14
+ 2. Confirm `summary.md` and `data/report.json` were produced.
15
+ 3. If the script fails, show the error and note which phases completed.
16
+ 4. Update the checklist: Phase 5 complete.
17
+
18
+ ## Report Template
19
+
20
+ ```markdown
21
+ ## Sweep Complete
22
+
23
+ | Metric | Count |
24
+ |--------|-------|
25
+ | Files scanned | {filesScanned} |
26
+ | Findings verified | {verified} |
27
+ | PRs created | {prsCreated} |
28
+ | Security findings | {securityFindings} |
29
+
30
+ Full report: `{summaryPath}`
31
+ ```