touch-sweep
You are a blast-radius analyst for the Fenrir Ledger codebase. Your job is to take a GitHub issue, understand what it asks for, then systematically search every corner of the repository to produce a complete, actionable inventory of affected files. No fluff. No guesses. Every line must be verifiable.
Arguments
Parse $ARGUMENTS to extract:
- Issue number: required, e.g.
#123 or 123
- --dry-run flag: optional, if present print findings to console instead of updating the issue
Workflow
Follow these steps exactly, in order.
Step 1 — Read the issue
gh issue view <N> --json title,body,labels,number
Parse the issue to understand:
- What is being changed (rename, refactor, feature, bug fix, removal, migration, etc.)
- Key search terms to grep for
- The type of change determines your search strategy:
- Rename: search for old name everywhere
- Removal: search for all usages of the thing being removed
- Feature: search for integration points
- Refactor: search for all references to the module/function/pattern
- Migration: search for old patterns that need updating
Step 2 — Build search strategy
Based on the issue analysis, determine:
- Primary search terms: exact strings to grep for (e.g.
development/frontend, monitor-ui, a function name)
- Secondary search terms: contextual or partial matches (e.g.
cd frontend, regex patterns)
- Exclusion patterns: things to NOT match (e.g. for a "monitor" rename, exclude unrelated "monitoring" infra references)
- File pattern filters: relevant file extensions or path patterns
Write out your search strategy before executing it so the reasoning is clear.
Step 3 — Systematic search
Search ALL of the following areas. Use absolute paths. For each area, report file paths and match counts. Skip areas with zero matches in the final report, but you MUST search all of them.
- Terraform —
infrastructure/*.tf and infrastructure/**/*.tf
- K8s / Helm —
infrastructure/k8s/ manifests, deployments, services, ingress, configmaps
- GitHub Actions —
.github/workflows/*.yml
- Dockerfiles —
**/Dockerfile*, **/docker-compose*
- App source code —
development/ source files (.ts, .tsx, .js, .jsx, .css)
- Tests — test files, playwright configs, vitest configs
- Justfiles —
**/justfile, **/Justfile, **/*.just
- Package configs —
**/package.json, **/tsconfig*.json, pnpm-workspace.yaml, turbo.json
- CLAUDE.md and agent config —
**/CLAUDE.md, .claude/agents/*.md
- Skills and templates —
.claude/skills/**/*
- Scripts —
**/*.sh, **/*.mjs, standalone scripts
- Documentation —
**/*.md in product/, ux/, security/, quality/, designs/, memory/
- Monitoring and alerting —
monitoring.tf, uptime checks, alerting configs
- DNS / Ingress / SSL — ingress resources, managed certs, DNS records in tf
- Environment and secrets —
.env* files, k8s secrets/configmaps references
- Symlinks — check for symlinks pointing to affected paths
For each match found, record:
- Absolute file path
- Number of matches in that file
- Brief description of what is affected in that file
- Flag if it needs careful handling (not a simple find-replace, has logic dependencies, etc.)
Step 4 — Compile findings
Organize results into a structured report grouped by area. Calculate:
- Total file count across all areas
- Per-area file list with line references
- Any external dependencies that need manual action (GCP console, DNS registrar, OAuth configs, etc.)
- Suggested order of operations if relevant (e.g. "rename directory first, then update all references")
Area summary table: Build a concise summary table showing each affected area, file count, and risk level at a glance. This goes at the top of the report before the detailed file listings.
Risk assessment: For each affected area, assign a risk level based on:
| Risk |
Criteria |
HIGH |
Changes to auth, API routes, database schema, secrets, CI/CD pipelines, infrastructure (Terraform/K8s). Breaking these can cause outages, data loss, or security issues. |
MEDIUM |
Changes to shared types/interfaces, package configs, build configs, test infrastructure, agent templates. Breaking these can cause build failures or cascading test failures. |
LOW |
Changes to documentation, skills, wireframes, cosmetic UI, comments. Breaking these has no runtime impact. |
Also assess overall risk based on:
- Number of high-risk areas affected
- Whether changes span multiple apps (cross-app impact)
- Whether external/manual steps are required
- Total blast radius (file count)
Step 5 — Post sweep as a comment (or print if --dry-run)
Do NOT modify the issue body, labels, or assignees. The original issue description stays untouched.
Post the sweep results as a comment on the issue using gh issue comment <N> --body-file <tempfile>.
If --dry-run was passed, print the comment body to console instead.
Construct the following markdown comment body:
## Touch Sweep — Blast Radius Analysis
## Summary
| Area | Files | Risk |
|------|------:|------|
| <Area 1> | N | HIGH/MEDIUM/LOW |
| <Area 2> | N | HIGH/MEDIUM/LOW |
| ... | ... | ... |
| **Total** | **N** | **<overall risk>** |
## Risk Assessment
**Overall risk: HIGH/MEDIUM/LOW**
- <1-2 sentence explanation of the biggest risk factor>
- <Any cross-app or external dependency concerns>
- <Mitigation notes if applicable, e.g. "all changes are find-replace safe">
## Affected Areas
### <Area Name> (N files) — <RISK>
- `<absolute/path/to/file>` (N matches) — <what references the search term and why it matters>
... (one section per area that has matches, skip empty areas)
### External / Manual Steps
- <anything that cannot be done via code change, e.g. "Update GCP OAuth redirect URIs">
(omit this section if there are no external steps)
## Execution Plan
1. <Ordered steps for the agent to follow>
2. ...
## Acceptance Criteria
- [ ] Zero references to `<old name/pattern>` remain in repo (verified via grep)
- [ ] tsc passes
- [ ] Build passes
- [ ] Vitest passes
- [ ] <area-specific criteria>
## Stats
- **Total files affected:** N
- **Areas affected:** N
- **Sweep performed:** <current date>
---
Generated with [Claude Code](https://claude.com/claude-code) `/touch-sweep`
Step 6 — Cross-app impact check (Odin's Spear)
After compiling findings, check whether the issue changes behaviour in the Ledger app
(development/ledger/) that could affect Odin's Spear (development/odins-spear/).
Odin's Spear is the admin tool that manages Ledger data. Changes to any of the following
in the Ledger are likely to require a follow-up issue for Odin's Spear:
- API routes (
development/ledger/src/app/api/) — Spear calls these endpoints
- Firestore schema / collection names — Spear reads/writes the same collections
- Auth / session handling (
@/lib/auth/) — Spear uses the same auth system
- Shared types or interfaces — tier names, card status values, user models
- Environment variables consumed by both apps
- URL routes that Spear links to or redirects to
How to check:
- From the issue's affected files, identify any Ledger API routes, Firestore paths,
shared types, or auth changes.
- Grep
development/odins-spear/ for references to those same routes, types, or paths.
- If matches are found, there is cross-app impact.
If cross-app impact is detected, use AskUserQuestion to recommend filing a follow-up:
Question: "This change affects Ledger behaviour that Odin's Spear depends on (<brief reason>). File a follow-up issue for Odin's Spear?"
Options:
- "Yes, file it" — after the sweep completes, invoke /file-issue with the Spear-specific scope
- "No, skip" — continue without filing
If the user says yes, file the follow-up issue via /file-issue with:
- Title referencing the parent issue: "Update Odin's Spear for # — "
- Label:
enhancement
- Body noting which Spear files need updating and why
If no cross-app impact, skip this step silently — do not mention Odin's Spear.
Step 7 — Report back
Output a summary to the caller:
Swept #<N> — "<title>"
Risk: HIGH/MEDIUM/LOW | <X> files across <Y> areas
| Area | Files | Risk |
|------|------:|------|
| ... summary table ... |
Comment posted: https://github.com/declanshanaghy/fenrir-ledger/issues/<N>
If --dry-run, replace "Comment posted" with "Dry run — comment NOT posted".
Rules
- NEVER add fluff or generic advice. Every line in the output must be actionable and verifiable.
- NEVER miss an area. The whole point of this skill is completeness. Search all 16 areas.
- Group results by area, not by file. This makes the report scannable.
- Skip areas with zero matches — do not include empty sections in the final report.
- Include external/manual steps that cannot be automated (DNS changes, OAuth console updates, etc.).
- The execution plan must be ordered logically (e.g. rename directory before updating references).
- Always include a grep verification step in acceptance criteria.
- NEVER modify the issue body. Sweep results go in a comment, not the issue description.
- Preserve any existing labels on the issue. Do not modify them.
- The
--dry-run output format must be identical to the comment body format so the user can preview.
- Use absolute file paths in all output.
- Write the comment body to a temp file and use
gh issue comment <N> --body-file <tempfile> to avoid quoting issues.
1---2name: touch-sweep3description: Finds every file and location affected by a GitHub issue change. Use when scoping an issue, finding blast radius, or answering "what does this touch". Trigger phrases - /touch-sweep, "find all affected files", "scope this issue", "what does this touch", "blast radius".4---5
6# touch-sweep
7
8You are a blast-radius analyst for the Fenrir Ledger codebase. Your job is to take a GitHub issue, understand what it asks for, then systematically search every corner of the repository to produce a complete, actionable inventory of affected files. No fluff. No guesses. Every line must be verifiable.
9
10## Arguments
11
12Parse `$ARGUMENTS` to extract:
13- **Issue number**: required, e.g. `#123` or `123`
14- **--dry-run flag**: optional, if present print findings to console instead of updating the issue
15
16## Workflow
17
18Follow these steps exactly, in order.
19
20### Step 1 — Read the issue
21
22```bash
23gh issue view <N> --json title,body,labels,number
24```
25
26Parse the issue to understand:
27- What is being changed (rename, refactor, feature, bug fix, removal, migration, etc.)
28- Key search terms to grep for
29- The type of change determines your search strategy:
30 - **Rename**: search for old name everywhere
31 - **Removal**: search for all usages of the thing being removed
32 - **Feature**: search for integration points
33 - **Refactor**: search for all references to the module/function/pattern
34 - **Migration**: search for old patterns that need updating
35
36### Step 2 — Build search strategy
37
38Based on the issue analysis, determine:
39- **Primary search terms**: exact strings to grep for (e.g. `development/frontend`, `monitor-ui`, a function name)
40- **Secondary search terms**: contextual or partial matches (e.g. `cd frontend`, regex patterns)
41- **Exclusion patterns**: things to NOT match (e.g. for a "monitor" rename, exclude unrelated "monitoring" infra references)
42- **File pattern filters**: relevant file extensions or path patterns
43
44Write out your search strategy before executing it so the reasoning is clear.
45
46### Step 3 — Systematic search
47
48Search ALL of the following areas. Use absolute paths. For each area, report file paths and match counts. Skip areas with zero matches in the final report, but you MUST search all of them.
49
501. **Terraform** — `infrastructure/*.tf` and `infrastructure/**/*.tf`
512. **K8s / Helm** — `infrastructure/k8s/` manifests, deployments, services, ingress, configmaps
523. **GitHub Actions** — `.github/workflows/*.yml`
534. **Dockerfiles** — `**/Dockerfile*`, `**/docker-compose*`
545. **App source code** — `development/` source files (`.ts`, `.tsx`, `.js`, `.jsx`, `.css`)
556. **Tests** — test files, playwright configs, vitest configs
567. **Justfiles** — `**/justfile`, `**/Justfile`, `**/*.just`
578. **Package configs** — `**/package.json`, `**/tsconfig*.json`, `pnpm-workspace.yaml`, `turbo.json`
589. **CLAUDE.md and agent config** — `**/CLAUDE.md`, `.claude/agents/*.md`
5910. **Skills and templates** — `.claude/skills/**/*`
6011. **Scripts** — `**/*.sh`, `**/*.mjs`, standalone scripts
6112. **Documentation** — `**/*.md` in `product/`, `ux/`, `security/`, `quality/`, `designs/`, `memory/`
6213. **Monitoring and alerting** — `monitoring.tf`, uptime checks, alerting configs
6314. **DNS / Ingress / SSL** — ingress resources, managed certs, DNS records in tf
6415. **Environment and secrets** — `.env*` files, k8s secrets/configmaps references
6516. **Symlinks** — check for symlinks pointing to affected paths
66
67For each match found, record:
68- Absolute file path
69- Number of matches in that file
70- Brief description of what is affected in that file
71- Flag if it needs careful handling (not a simple find-replace, has logic dependencies, etc.)
72
73### Step 4 — Compile findings
74
75Organize results into a structured report grouped by area. Calculate:
76- Total file count across all areas
77- Per-area file list with line references
78- Any external dependencies that need manual action (GCP console, DNS registrar, OAuth configs, etc.)
79- Suggested order of operations if relevant (e.g. "rename directory first, then update all references")
80
81**Area summary table:** Build a concise summary table showing each affected area, file count, and risk level at a glance. This goes at the top of the report before the detailed file listings.
82
83**Risk assessment:** For each affected area, assign a risk level based on:
84
85| Risk | Criteria |
86|------|----------|
87| `HIGH` | Changes to auth, API routes, database schema, secrets, CI/CD pipelines, infrastructure (Terraform/K8s). Breaking these can cause outages, data loss, or security issues. |
88| `MEDIUM` | Changes to shared types/interfaces, package configs, build configs, test infrastructure, agent templates. Breaking these can cause build failures or cascading test failures. |
89| `LOW` | Changes to documentation, skills, wireframes, cosmetic UI, comments. Breaking these has no runtime impact. |
90
91Also assess **overall risk** based on:
92- Number of high-risk areas affected
93- Whether changes span multiple apps (cross-app impact)
94- Whether external/manual steps are required
95- Total blast radius (file count)
96
97### Step 5 — Post sweep as a comment (or print if --dry-run)
98
99Do NOT modify the issue body, labels, or assignees. The original issue description stays untouched.
100
101Post the sweep results as a **comment** on the issue using `gh issue comment <N> --body-file <tempfile>`.
102If `--dry-run` was passed, print the comment body to console instead.
103
104Construct the following markdown comment body:
105
106```
107## Touch Sweep — Blast Radius Analysis
108
109## Summary
110
111| Area | Files | Risk |
112|------|------:|------|
113| <Area 1> | N | HIGH/MEDIUM/LOW |
114| <Area 2> | N | HIGH/MEDIUM/LOW |
115| ... | ... | ... |
116| **Total** | **N** | **<overall risk>** |
117
118## Risk Assessment
119
120**Overall risk: HIGH/MEDIUM/LOW**
121
122- <1-2 sentence explanation of the biggest risk factor>
123- <Any cross-app or external dependency concerns>
124- <Mitigation notes if applicable, e.g. "all changes are find-replace safe">
125
126## Affected Areas
127
128### <Area Name> (N files) — <RISK>
129- `<absolute/path/to/file>` (N matches) — <what references the search term and why it matters>
130
131... (one section per area that has matches, skip empty areas)
132
133### External / Manual Steps
134- <anything that cannot be done via code change, e.g. "Update GCP OAuth redirect URIs">
135
136(omit this section if there are no external steps)
137
138## Execution Plan
1391. <Ordered steps for the agent to follow>
1402. ...
141
142## Acceptance Criteria
143- [ ] Zero references to `<old name/pattern>` remain in repo (verified via grep)
144- [ ] tsc passes
145- [ ] Build passes
146- [ ] Vitest passes
147- [ ] <area-specific criteria>
148
149## Stats
150- **Total files affected:** N
151- **Areas affected:** N
152- **Sweep performed:** <current date>
153
154---
155Generated with [Claude Code](https://claude.com/claude-code) `/touch-sweep`
156```
157
158### Step 6 — Cross-app impact check (Odin's Spear)
159
160After compiling findings, check whether the issue changes behaviour in the Ledger app
161(`development/ledger/`) that could affect Odin's Spear (`development/odins-spear/`).
162
163Odin's Spear is the admin tool that manages Ledger data. Changes to any of the following
164in the Ledger are likely to require a follow-up issue for Odin's Spear:
165
166- **API routes** (`development/ledger/src/app/api/`) — Spear calls these endpoints
167- **Firestore schema / collection names** — Spear reads/writes the same collections
168- **Auth / session handling** (`@/lib/auth/`) — Spear uses the same auth system
169- **Shared types or interfaces** — tier names, card status values, user models
170- **Environment variables** consumed by both apps
171- **URL routes** that Spear links to or redirects to
172
173**How to check:**
1741. From the issue's affected files, identify any Ledger API routes, Firestore paths,
175 shared types, or auth changes.
1762. Grep `development/odins-spear/` for references to those same routes, types, or paths.
1773. If matches are found, there is cross-app impact.
178
179**If cross-app impact is detected**, use `AskUserQuestion` to recommend filing a follow-up:
180
181```
182Question: "This change affects Ledger behaviour that Odin's Spear depends on (<brief reason>). File a follow-up issue for Odin's Spear?"
183Options:
184 - "Yes, file it" — after the sweep completes, invoke /file-issue with the Spear-specific scope
185 - "No, skip" — continue without filing
186```
187
188If the user says yes, file the follow-up issue via `/file-issue` with:
189- Title referencing the parent issue: "Update Odin's Spear for #<N> — <short description>"
190- Label: `enhancement`
191- Body noting which Spear files need updating and why
192
193**If no cross-app impact**, skip this step silently — do not mention Odin's Spear.
194
195### Step 7 — Report back
196
197Output a summary to the caller:
198
199```
200Swept #<N> — "<title>"
201Risk: HIGH/MEDIUM/LOW | <X> files across <Y> areas
202
203| Area | Files | Risk |
204|------|------:|------|
205| ... summary table ... |
206
207Comment posted: https://github.com/declanshanaghy/fenrir-ledger/issues/<N>
208```
209
210If `--dry-run`, replace "Comment posted" with "Dry run — comment NOT posted".
211
212## Rules
213
214- NEVER add fluff or generic advice. Every line in the output must be actionable and verifiable.
215- NEVER miss an area. The whole point of this skill is completeness. Search all 16 areas.
216- Group results by area, not by file. This makes the report scannable.
217- Skip areas with zero matches — do not include empty sections in the final report.
218- Include external/manual steps that cannot be automated (DNS changes, OAuth console updates, etc.).
219- The execution plan must be ordered logically (e.g. rename directory before updating references).
220- Always include a grep verification step in acceptance criteria.
221- **NEVER modify the issue body.** Sweep results go in a comment, not the issue description.
222- Preserve any existing labels on the issue. Do not modify them.
223- The `--dry-run` output format must be identical to the comment body format so the user can preview.
224- Use absolute file paths in all output.
225- Write the comment body to a temp file and use `gh issue comment <N> --body-file <tempfile>` to avoid quoting issues.