sequant 1.0.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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/dist/bin/cli.d.ts +8 -0
  4. package/dist/bin/cli.d.ts.map +1 -0
  5. package/dist/bin/cli.js +70 -0
  6. package/dist/bin/cli.js.map +1 -0
  7. package/dist/src/commands/doctor.d.ts +8 -0
  8. package/dist/src/commands/doctor.d.ts.map +1 -0
  9. package/dist/src/commands/doctor.js +171 -0
  10. package/dist/src/commands/doctor.js.map +1 -0
  11. package/dist/src/commands/init.d.ts +11 -0
  12. package/dist/src/commands/init.d.ts.map +1 -0
  13. package/dist/src/commands/init.js +124 -0
  14. package/dist/src/commands/init.js.map +1 -0
  15. package/dist/src/commands/run.d.ts +18 -0
  16. package/dist/src/commands/run.d.ts.map +1 -0
  17. package/dist/src/commands/run.js +229 -0
  18. package/dist/src/commands/run.js.map +1 -0
  19. package/dist/src/commands/status.d.ts +5 -0
  20. package/dist/src/commands/status.d.ts.map +1 -0
  21. package/dist/src/commands/status.js +45 -0
  22. package/dist/src/commands/status.js.map +1 -0
  23. package/dist/src/commands/update.d.ts +10 -0
  24. package/dist/src/commands/update.d.ts.map +1 -0
  25. package/dist/src/commands/update.js +124 -0
  26. package/dist/src/commands/update.js.map +1 -0
  27. package/dist/src/index.d.ts +15 -0
  28. package/dist/src/index.d.ts.map +1 -0
  29. package/dist/src/index.js +13 -0
  30. package/dist/src/index.js.map +1 -0
  31. package/dist/src/lib/fs.d.ts +10 -0
  32. package/dist/src/lib/fs.d.ts.map +1 -0
  33. package/dist/src/lib/fs.js +44 -0
  34. package/dist/src/lib/fs.js.map +1 -0
  35. package/dist/src/lib/manifest.d.ts +14 -0
  36. package/dist/src/lib/manifest.d.ts.map +1 -0
  37. package/dist/src/lib/manifest.js +37 -0
  38. package/dist/src/lib/manifest.js.map +1 -0
  39. package/dist/src/lib/stacks.d.ts +22 -0
  40. package/dist/src/lib/stacks.d.ts.map +1 -0
  41. package/dist/src/lib/stacks.js +131 -0
  42. package/dist/src/lib/stacks.js.map +1 -0
  43. package/dist/src/lib/templates.d.ts +16 -0
  44. package/dist/src/lib/templates.d.ts.map +1 -0
  45. package/dist/src/lib/templates.js +118 -0
  46. package/dist/src/lib/templates.js.map +1 -0
  47. package/dist/src/lib/workflow/cli-args.d.ts +138 -0
  48. package/dist/src/lib/workflow/cli-args.d.ts.map +1 -0
  49. package/dist/src/lib/workflow/cli-args.js +210 -0
  50. package/dist/src/lib/workflow/cli-args.js.map +1 -0
  51. package/dist/src/lib/workflow/execute-issues.d.ts +42 -0
  52. package/dist/src/lib/workflow/execute-issues.d.ts.map +1 -0
  53. package/dist/src/lib/workflow/execute-issues.js +463 -0
  54. package/dist/src/lib/workflow/execute-issues.js.map +1 -0
  55. package/dist/src/lib/workflow/logger.d.ts +168 -0
  56. package/dist/src/lib/workflow/logger.d.ts.map +1 -0
  57. package/dist/src/lib/workflow/logger.js +249 -0
  58. package/dist/src/lib/workflow/logger.js.map +1 -0
  59. package/dist/src/lib/workflow/types.d.ts +89 -0
  60. package/dist/src/lib/workflow/types.d.ts.map +1 -0
  61. package/dist/src/lib/workflow/types.js +23 -0
  62. package/dist/src/lib/workflow/types.js.map +1 -0
  63. package/package.json +69 -0
  64. package/stacks/go.yaml +22 -0
  65. package/stacks/nextjs.yaml +28 -0
  66. package/stacks/python.yaml +24 -0
  67. package/stacks/rust.yaml +23 -0
  68. package/templates/hooks/post-tool.sh +301 -0
  69. package/templates/hooks/pre-tool.sh +350 -0
  70. package/templates/memory/constitution.md +60 -0
  71. package/templates/scripts/cleanup-worktree.sh +78 -0
  72. package/templates/scripts/list-worktrees.sh +50 -0
  73. package/templates/scripts/new-feature.sh +156 -0
  74. package/templates/settings.json +26 -0
  75. package/templates/skills/assess/SKILL.md +428 -0
  76. package/templates/skills/clean/SKILL.md +196 -0
  77. package/templates/skills/docs/SKILL.md +323 -0
  78. package/templates/skills/exec/SKILL.md +426 -0
  79. package/templates/skills/fullsolve/SKILL.md +479 -0
  80. package/templates/skills/loop/SKILL.md +310 -0
  81. package/templates/skills/qa/SKILL.md +261 -0
  82. package/templates/skills/qa/references/code-quality-exemplars.md +112 -0
  83. package/templates/skills/qa/references/code-review-checklist.md +77 -0
  84. package/templates/skills/qa/references/quality-gates.md +95 -0
  85. package/templates/skills/qa/references/testing-requirements.md +109 -0
  86. package/templates/skills/qa/scripts/quality-checks.sh +109 -0
  87. package/templates/skills/reflect/SKILL.md +159 -0
  88. package/templates/skills/reflect/references/documentation-tiers.md +70 -0
  89. package/templates/skills/reflect/references/phase-reflection.md +95 -0
  90. package/templates/skills/reflect/scripts/workflow-queries.ts +165 -0
  91. package/templates/skills/security-review/SKILL.md +344 -0
  92. package/templates/skills/security-review/references/security-checklists.md +377 -0
  93. package/templates/skills/solve/SKILL.md +242 -0
  94. package/templates/skills/spec/SKILL.md +169 -0
  95. package/templates/skills/spec/references/parallel-groups.md +72 -0
  96. package/templates/skills/spec/references/verification-criteria.md +104 -0
  97. package/templates/skills/test/SKILL.md +508 -0
  98. package/templates/skills/testgen/SKILL.md +561 -0
  99. package/templates/skills/verify/SKILL.md +266 -0
@@ -0,0 +1,428 @@
1
+ ---
2
+ name: assess
3
+ description: "Issue triage and status assessment - analyze current state and recommend next workflow phase."
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Read
10
+ - Glob
11
+ - Grep
12
+ - Bash(git *)
13
+ - Bash(gh *)
14
+ ---
15
+
16
+ # Issue Assessment & Triage
17
+
18
+ You are the "Assessment Agent" for the current repository.
19
+
20
+ ## Purpose
21
+
22
+ When invoked as `/assess`, your job is to:
23
+
24
+ 1. Analyze the current state of a GitHub issue
25
+ 2. Determine what phase it's in (planning, implementation, QA, complete, blocked)
26
+ 3. Detect what artifacts exist (plan comments, branches, PRs, worktrees)
27
+ 4. Identify blockers, missing information, or staleness
28
+ 5. Show AC coverage status if applicable
29
+ 6. **Recommend** the next appropriate slash command (but don't execute it)
30
+
31
+ ## Behavior
32
+
33
+ Invocation:
34
+
35
+ - `/assess 123`:
36
+ - Treat `123` as the GitHub issue number
37
+ - Fetch issue details, comments, and related artifacts
38
+ - `/assess <description>`:
39
+ - Treat the text as context about what to assess
40
+
41
+ ### When to Use This Command
42
+
43
+ **Good use cases:**
44
+ - Picking up an unfamiliar issue ("What's the status of #147?")
45
+ - Resuming work after days/weeks away ("Where did I leave off?")
46
+ - Handoff scenarios ("What did the previous dev complete?")
47
+ - Daily triage ("Which issues are ready for next steps?")
48
+ - Debugging stalled issues ("Why isn't this progressing?")
49
+
50
+ **Not needed for:**
51
+ - Active work on an issue you just touched (you know the state)
52
+ - Simple "implement this feature" requests (just use `/spec` → `/exec`)
53
+ - Issues where the next step is obvious
54
+
55
+ ## Assessment Process
56
+
57
+ ### 1. Issue Context Gathering
58
+
59
+ Collect information about the issue:
60
+
61
+ **From GitHub:**
62
+
63
+ - Issue title, body, labels, status
64
+ - Acceptance Criteria (explicit or inferred)
65
+ - **All comments** (read every comment to gather complete context):
66
+ - Look for plan drafts, progress updates, QA reviews
67
+ - Comments often contain clarifications, updates, or additional AC added after the initial issue description
68
+ - Review discussion about implementation details, edge cases, or requirements mentioned in comments
69
+ - Check for feedback from previous review cycles or iterations
70
+ - Last activity timestamp
71
+ - Assigned developer(s)
72
+
73
+ **From Git:**
74
+ - Check if branch exists: `git branch -a | grep <issue-number>`
75
+ - Check if worktree exists: `git worktree list | grep <issue-number>`
76
+ - Check for related PRs: `gh pr list --search "in:title <issue-number>"`
77
+ - If branch exists, check commit history: `git log --oneline feature/<issue-number>*`
78
+
79
+ **From Codebase:**
80
+
81
+ - Look for TODOs mentioning the issue: `grep -r "TODO.*#<issue-number>" .`
82
+ - Check for test files related to the feature
83
+ - Identify modified files (if branch exists)
84
+
85
+ ### 2. Phase Detection
86
+
87
+ Determine the current phase:
88
+
89
+ **Planning Phase** - Issue needs a plan:
90
+
91
+ - No plan comment exists
92
+ - AC are unclear or missing
93
+ - No technical approach documented
94
+ - **Indicators:** Issue just opened, labeled "needs planning", no detailed comments
95
+
96
+ **Implementation Phase** - Issue is being coded:
97
+
98
+ - Plan exists (in comments or inferred)
99
+ - Branch/worktree exists with commits
100
+ - Some AC partially met
101
+ - **Indicators:** Branch exists, recent commits, labeled "in progress"
102
+
103
+ **QA Phase** - Implementation complete, needs review:
104
+ - Branch has commits
105
+ - Developer claims implementation complete
106
+ - No QA review exists yet
107
+ - **Indicators:** PR open, labeled "ready for review", implementation comment exists
108
+
109
+ **Blocked Phase** - Issue is stuck:
110
+ - No activity for 7+ days
111
+ - Open questions in comments
112
+ - Dependency on another issue
113
+ - **Indicators:** Labeled "blocked", comments mention blockers, stale
114
+
115
+ **Complete Phase** - Issue is done:
116
+ - PR merged
117
+ - AC all met (based on QA review)
118
+ - Issue closed
119
+ - **Indicators:** Closed, PR merged, labeled "completed"
120
+
121
+ **Unclear Phase** - Can't determine state:
122
+ - Insufficient information
123
+ - Conflicting indicators
124
+ - **Action:** Request clarification
125
+
126
+ ### 3. Artifact Detection
127
+
128
+ List what exists:
129
+
130
+ **Planning Artifacts:**
131
+ - [ ] AC checklist in issue or comments
132
+ - [ ] Implementation plan (phases/steps)
133
+ - [ ] Architecture decisions documented
134
+ - [ ] Open questions identified
135
+
136
+ **Implementation Artifacts:**
137
+ - [ ] Feature branch: `feature/<issue-number>-<slug>`
138
+ - [ ] Worktree: `../worktrees/feature/<branch-name>/`
139
+ - [ ] Commits on branch: X commits since branching
140
+ - [ ] Modified files: [list key files]
141
+ - [ ] Tests written: [test file paths]
142
+
143
+ **QA Artifacts:**
144
+ - [ ] PR open: #<pr-number>
145
+ - [ ] QA review comment exists
146
+ - [ ] Test results: [passing/failing]
147
+ - [ ] Build status: [passing/failing]
148
+
149
+ **Blockers/Issues:**
150
+ - [ ] Open questions in comments
151
+ - [ ] Failed tests or build
152
+ - [ ] Dependency on issue #<other-issue>
153
+ - [ ] Missing resources or access
154
+ - [ ] Stale (no activity in X days)
155
+
156
+ ### 4. AC Coverage Analysis
157
+
158
+ If AC exist, assess coverage:
159
+
160
+ **For each AC item:**
161
+ - `MET` - Evidence suggests complete
162
+ - `IN_PROGRESS` - Partially implemented
163
+ - `NOT_STARTED` - No evidence of work
164
+ - `UNCLEAR` - Can't determine from available info
165
+
166
+ **Example:**
167
+ ```
168
+ AC Coverage:
169
+ - AC-1: Display fact-check queue in admin panel - MET
170
+ - AC-2: Allow editors to approve/reject items - IN_PROGRESS
171
+ - AC-3: Send email notifications on approval - NOT_STARTED
172
+ - AC-4: Log all actions in audit log - UNCLEAR (no audit log visible)
173
+
174
+ Coverage: 1/4 complete, 1/4 in progress, 1/4 not started, 1/4 unclear
175
+ ```
176
+
177
+ ### 5. Staleness Check
178
+
179
+ Flag if issue is stale:
180
+
181
+ - **Fresh:** Activity within 3 days
182
+ - **Aging:** 3-7 days since last activity
183
+ - **Stale:** 7-14 days since last activity
184
+ - **Abandoned:** 14+ days since last activity
185
+
186
+ For stale/abandoned issues, identify:
187
+ - Last actor (who touched it last)
188
+ - Last action type (commit, comment, label change)
189
+ - Likely cause of staleness (blocked, low priority, forgotten)
190
+
191
+ ## Output Structure
192
+
193
+ Produce a structured assessment:
194
+
195
+ ### Issue Summary
196
+ - **Issue:** #123 - <title>
197
+ - **Status:** <Open|Closed> | <labels>
198
+ - **Last Activity:** X days ago (<timestamp>)
199
+ - **Phase:** <Planning|Implementation|QA|Blocked|Complete|Unclear>
200
+
201
+ ### Acceptance Criteria
202
+ - AC-1: ... [MET|IN_PROGRESS|NOT_STARTED|UNCLEAR]
203
+ - AC-2: ... [MET|IN_PROGRESS|NOT_STARTED|UNCLEAR]
204
+ - ...
205
+ - **Coverage:** X/Y complete
206
+
207
+ (If AC don't exist or are unclear, note: "AC not clearly defined")
208
+
209
+ ### Artifacts Found
210
+ **Planning:**
211
+ - [x] Plan comment in issue #<comment-id>
212
+ - [ ] Architecture decisions documented
213
+
214
+ **Implementation:**
215
+ - [x] Branch: `feature/123-issue-slug` (5 commits)
216
+ - [x] Worktree: `../worktrees/feature/123-issue-slug/`
217
+ - [x] Modified files: `components/admin/FactCheckQueue.tsx`, `lib/queries/fact-checks.ts`
218
+ - [ ] Tests written
219
+
220
+ **QA:**
221
+ - [ ] PR open
222
+ - [ ] QA review complete
223
+
224
+ ### Blockers & Issues
225
+ - [ ] None identified
226
+ - [x] Stale (10 days since last commit)
227
+ - [x] Missing tests
228
+ - [ ] Depends on issue #<other>
229
+
230
+ ### Recommendation
231
+
232
+ Based on the assessment, recommend one of:
233
+
234
+ **If Phase = Planning:**
235
+ ```
236
+ RECOMMENDATION: Run `/spec 123`
237
+ - Issue needs a clear plan and AC before implementation
238
+ - This will establish AC checklist and technical approach
239
+ ```
240
+
241
+ **If Phase = Implementation (not started):**
242
+ ```
243
+ RECOMMENDATION: Run `/exec 123`
244
+ - Plan exists and AC are clear
245
+ - Ready to begin implementation
246
+ - This will create feature worktree and start coding
247
+ ```
248
+
249
+ **If Phase = Implementation (in progress):**
250
+ ```
251
+ RECOMMENDATION: Continue `/exec 123`
252
+ - Implementation is underway (5 commits on branch)
253
+ - Worktree exists at: ../worktrees/feature/123-issue-slug/
254
+ - AC coverage: 1/4 complete, 2/4 in progress
255
+ - Navigate to worktree and continue implementation
256
+ ```
257
+
258
+ **If Phase = QA:**
259
+ ```
260
+ RECOMMENDATION: Run `/qa 123`
261
+ - Implementation appears complete
262
+ - Branch has 12 commits, last commit 2 days ago
263
+ - No QA review exists yet
264
+ - Review code and validate against AC
265
+ ```
266
+
267
+ **If Phase = Blocked:**
268
+ ```
269
+ RECOMMENDATION: Resolve blockers first
270
+ - Issue depends on #145 (not yet merged)
271
+ - Open question in comments: "Should we use email or in-app notifications?"
272
+ - Suggest: Review #145 status, clarify notification approach with team
273
+ - Once unblocked, run `/exec 123` to continue
274
+ ```
275
+
276
+ **If Phase = Complete:**
277
+ ```
278
+ RECOMMENDATION: No action needed
279
+ - PR #156 merged 3 days ago
280
+ - All AC met (per QA review)
281
+ - Issue can be closed
282
+ ```
283
+
284
+ **If Phase = Unclear:**
285
+ ```
286
+ RECOMMENDATION: Gather more information
287
+ - Unable to determine current state
288
+ - Missing information: [list what's unclear]
289
+ - Suggest: Review issue comments, check with team, or run `/spec 123` to establish baseline
290
+ ```
291
+
292
+ ### Context for Next Command
293
+
294
+ Provide relevant context to help the next command:
295
+
296
+ **Key Files to Review:**
297
+ - `components/admin/FactCheckQueue.tsx` - Main component
298
+ - `lib/queries/fact-checks.ts` - Data layer
299
+ - `docs/ADMIN_ARCHITECTURE.md` - Related architecture
300
+
301
+ **Similar Patterns:**
302
+ - See `components/admin/news/ContentUpdatesList.tsx` for list pattern
303
+ - See `components/admin/shops/ApprovalQueue.tsx` for approval flow
304
+
305
+ **Potential Risks:**
306
+ - No error handling for failed approvals
307
+ - Email service integration not yet tested
308
+ - Database migration for `fact_checks` table may be needed
309
+
310
+ ## Examples
311
+
312
+ ### Example 1: Fresh Issue Needs Planning
313
+
314
+ ```
315
+ Issue Summary
316
+ - Issue: #147 - Add fact-check queue to admin panel
317
+ - Status: Open | needs-planning, admin
318
+ - Last Activity: 2 hours ago
319
+ - Phase: Planning
320
+
321
+ Acceptance Criteria
322
+ AC not clearly defined in issue
323
+ Inferred AC from description:
324
+ - Display pending fact-check items in queue
325
+ - Allow approval/rejection actions
326
+ - Send notifications on status change
327
+
328
+ Artifacts Found
329
+ Planning: None
330
+ Implementation: None
331
+ QA: None
332
+
333
+ Blockers & Issues
334
+ - [ ] No blockers
335
+
336
+ Recommendation
337
+ RECOMMENDATION: Run `/spec 147`
338
+ - Issue is fresh but lacks detailed AC and plan
339
+ - Need to establish clear requirements before implementation
340
+ ```
341
+
342
+ ### Example 2: Implementation In Progress, Stale
343
+
344
+ ```
345
+ Issue Summary
346
+ - Issue: #145 - Fix neighborhood extraction for Atlanta
347
+ - Status: Open | in-progress, bug
348
+ - Last Activity: 10 days ago
349
+ - Phase: Implementation (Stale)
350
+
351
+ Acceptance Criteria
352
+ - AC-1: Extract neighborhoods via ZIP mapping - MET
353
+ - AC-2: Handle edge cases (no ZIP, multiple ZIPs) - IN_PROGRESS
354
+ - AC-3: Backfill existing Atlanta shops - NOT_STARTED
355
+ Coverage: 1/3 complete
356
+
357
+ Artifacts Found
358
+ Implementation:
359
+ - [x] Branch: feature/145-atlanta-neighborhoods (3 commits)
360
+ - [x] Worktree: ../worktrees/feature/145-atlanta-neighborhoods/
361
+ - [x] Modified: lib/utils/neighborhood-extraction.ts
362
+ - [ ] Tests not found
363
+
364
+ Blockers & Issues
365
+ - [x] Stale (10 days since last commit)
366
+ - [x] Missing tests
367
+ - [ ] No known blockers
368
+
369
+ Recommendation
370
+ RECOMMENDATION: Resume `/exec 145`
371
+ - Implementation is 1/3 complete but stale
372
+ - Worktree still exists, resume work there
373
+ - Focus on AC-2 (edge cases) and AC-3 (backfill)
374
+ - Add tests before considering complete
375
+ ```
376
+
377
+ ### Example 3: Ready for QA
378
+
379
+ ```
380
+ Issue Summary
381
+ - Issue: #148 - Add bulk publishing to content updates
382
+ - Status: Open | ready-for-review
383
+ - Last Activity: 1 day ago
384
+ - Phase: QA
385
+
386
+ Acceptance Criteria
387
+ - AC-1: Multi-select in content updates list - UNCLEAR
388
+ - AC-2: Bulk publish action button - UNCLEAR
389
+ - AC-3: Confirmation dialog - UNCLEAR
390
+ - AC-4: Success/error feedback - UNCLEAR
391
+ Coverage: Unclear (need QA review to validate)
392
+
393
+ Artifacts Found
394
+ Implementation:
395
+ - [x] Branch: feature/148-bulk-publishing (15 commits)
396
+ - [x] Modified: components/admin/news/ContentUpdatesList.tsx, lib/admin/bulk-actions.ts
397
+ - [x] Tests: __tests__/bulk-publishing.test.ts
398
+ QA:
399
+ - [ ] No PR yet
400
+ - [ ] No QA review
401
+
402
+ Blockers & Issues
403
+ - [ ] No blockers
404
+ - Developer marked as "ready for review" in last comment
405
+
406
+ Recommendation
407
+ RECOMMENDATION: Run `/qa 148`
408
+ - Implementation appears complete (15 commits, tests added)
409
+ - Developer believes AC are met
410
+ - Need QA review to validate and assess A+ status
411
+ - Create PR if not exists, review code and test against AC
412
+ ```
413
+
414
+ ## Meta-Assessment
415
+
416
+ After providing the assessment, briefly note:
417
+
418
+ - **Confidence Level:** How certain are you about the phase detection? (High/Medium/Low)
419
+ - **Information Gaps:** What information would improve this assessment?
420
+ - **Alternative Interpretations:** Are there other ways to interpret the current state?
421
+
422
+ ## Notes
423
+
424
+ - This command is **read-only** - it analyzes but doesn't make changes
425
+ - It recommends but doesn't execute the next command
426
+ - Keep the assessment concise - aim for clarity, not exhaustiveness
427
+ - When in doubt about phase, say so - better to acknowledge uncertainty
428
+ - Use this to orient yourself, then proceed with the appropriate workflow command
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: clean
3
+ description: "Repository Cleanup Command"
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Bash(git branch:*)
10
+ - Bash(git status:*)
11
+ - Bash(git stash:*)
12
+ - Bash(git checkout:*)
13
+ - Bash(git clean:*)
14
+ - Bash(git add:*)
15
+ - Bash(git commit:*)
16
+ - Bash(git push:*)
17
+ - Bash(npm run build:*)
18
+ - Bash(npm run lint:*)
19
+ - Bash(ls:*)
20
+ - Bash(mv:*)
21
+ - Bash(mkdir:*)
22
+ - Bash(rm:*)
23
+ - Bash(find:*)
24
+ - Read
25
+ - Write
26
+ - Glob
27
+ - Grep
28
+ ---
29
+
30
+ # Repository Cleanup Command
31
+
32
+ Comprehensive, safe repository cleanup that archives stale files, removes artifacts, and commits changes.
33
+
34
+ ## Safety First
35
+
36
+ Before making ANY changes:
37
+ 1. Verify we're on `main` branch with clean working tree
38
+ 2. Run `npm run build` to ensure current state builds
39
+ 3. Create a safety checkpoint (stash any uncommitted work)
40
+
41
+ ## Cleanup Categories
42
+
43
+ ### Category 1: Safe to Auto-Archive (No Review Needed)
44
+
45
+ These files are always safe to archive - they're historical artifacts:
46
+
47
+ **Root directory patterns:**
48
+ - `*.backup` files (e.g., `CLAUDE.md.backup`)
49
+ - `CODE_REVIEW_PR_*.md` - Old PR reviews
50
+ - `*_AUDIT.md` files older than 30 days
51
+ - One-off shell scripts with dates in names
52
+
53
+ **docs/ patterns:**
54
+ - `ISSUE_*_PHASE_*.md` - Issue implementation specs (work is done)
55
+ - `*_IMPLEMENTATION.md` older than 30 days
56
+ - `content-audit-*.md` - Point-in-time audits
57
+ - City-specific audit files (e.g., `NYC_*_AUDIT.md`, `LA_*_REPORT.md`)
58
+
59
+ ### Category 2: Review Before Archiving
60
+
61
+ These need a quick check - might still be referenced:
62
+ - Files in `migrations/` (check if applied to Supabase)
63
+ - `context/` directory contents
64
+ - Any `APPLY_*.md` or `apply-*.sh` files
65
+
66
+ ### Category 3: Always Keep
67
+
68
+ Never archive these:
69
+ - `CLAUDE.md` - Active project instructions
70
+ - `README.md` - Project readme
71
+ - `docs/WORKFLOW_COMMANDS.md` - Active workflow docs
72
+ - `docs/patterns/*` - Active pattern catalog
73
+ - `docs/CONTENT_STANDARDS.md` - Active standards
74
+ - Any file modified in the last 7 days
75
+
76
+ ## Archive Structure
77
+
78
+ ```
79
+ scripts/archive/
80
+ ├── one-off-migrations/ # Shell scripts for one-time tasks
81
+ ├── adhoc-migrations/ # SQL files applied manually (not via Supabase CLI)
82
+ └── deprecated/ # Old/replaced scripts
83
+
84
+ docs/archive/
85
+ ├── audits/ # Completed audits and reviews
86
+ ├── issue-specs/ # GitHub issue implementation specs
87
+ ├── implementation-reports/ # Feature implementation summaries
88
+ └── context/ # Old project context files
89
+ ```
90
+
91
+ ## Execution Steps
92
+
93
+ ### Step 1: Pre-flight Checks
94
+ ```bash
95
+ # Verify branch and status
96
+ git branch --show-current # Must be 'main'
97
+ git status --porcelain # Should be empty or only untracked
98
+
99
+ # Verify build works
100
+ npm run build
101
+ ```
102
+
103
+ If build fails or we're not on main with clean tree, STOP and report.
104
+
105
+ ### Step 2: Identify Cleanup Candidates
106
+
107
+ Scan for files matching Category 1 and 2 patterns. Create a manifest of what will be archived.
108
+
109
+ Report to user:
110
+ - Files to auto-archive (Category 1)
111
+ - Files needing review (Category 2)
112
+ - Total space to be reclaimed
113
+
114
+ ### Step 3: Execute Cleanup
115
+
116
+ 1. Create archive directories if needed
117
+ 2. Move Category 1 files to appropriate archive locations
118
+ 3. Move Category 2 files (after user confirmation via manifest)
119
+ 4. Remove artifacts:
120
+ - `.DS_Store` files (except in node_modules)
121
+ - Empty directories (except .git, node_modules, .next)
122
+ 5. Update `docs/archive/README.md` with current date
123
+
124
+ ### Step 4: Verification
125
+
126
+ ```bash
127
+ # Verify build still works
128
+ npm run build
129
+
130
+ # Verify no breaking imports
131
+ npm run lint
132
+ ```
133
+
134
+ If either fails, ROLLBACK all changes immediately.
135
+
136
+ ### Step 5: Commit and Push
137
+
138
+ ```bash
139
+ # Stage all changes
140
+ git add -A
141
+
142
+ # Create descriptive commit
143
+ git commit -m "chore: repository cleanup $(date +%Y-%m-%d)
144
+
145
+ Archived:
146
+ - [X] old issue specs
147
+ - [X] completed audits
148
+ - [X] one-off migration scripts
149
+ - [X] stale documentation
150
+
151
+ Build verified: passing"
152
+
153
+ # Push to origin
154
+ git push origin main
155
+ ```
156
+
157
+ ## Rollback Procedure
158
+
159
+ If anything goes wrong:
160
+ ```bash
161
+ git checkout -- .
162
+ git clean -fd
163
+ ```
164
+
165
+ ## Output Format
166
+
167
+ Report final summary:
168
+ ```
169
+ Repository Cleanup Complete
170
+
171
+ Archived:
172
+ - X files from root directory
173
+ - X files from docs/
174
+ - X migration scripts
175
+
176
+ Removed:
177
+ - X .DS_Store files
178
+ - X empty directories
179
+
180
+ Commit: [hash] pushed to origin/main
181
+
182
+ Next cleanup recommended: [date + 30 days]
183
+ ```
184
+
185
+ ## Usage Notes
186
+
187
+ - Run monthly or when repo feels cluttered
188
+ - Safe to run multiple times (idempotent)
189
+ - Will not touch files modified in last 7 days
190
+ - Always verifies build before and after
191
+
192
+ ---
193
+
194
+ ## BEGIN EXECUTION
195
+
196
+ Execute the cleanup following the steps above. Be thorough but safe - when in doubt, skip a file rather than risk breaking something.