relay-workflow 2.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 (34) hide show
  1. package/.claude/skills/relay-analyze/SKILL.md +6 -0
  2. package/.claude/skills/relay-analyze/workflow.md +108 -0
  3. package/.claude/skills/relay-brainstorm/SKILL.md +6 -0
  4. package/.claude/skills/relay-brainstorm/workflow.md +114 -0
  5. package/.claude/skills/relay-cleanup/SKILL.md +6 -0
  6. package/.claude/skills/relay-cleanup/workflow.md +53 -0
  7. package/.claude/skills/relay-design/SKILL.md +6 -0
  8. package/.claude/skills/relay-design/workflow.md +108 -0
  9. package/.claude/skills/relay-discover/SKILL.md +6 -0
  10. package/.claude/skills/relay-discover/workflow.md +56 -0
  11. package/.claude/skills/relay-help/SKILL.md +6 -0
  12. package/.claude/skills/relay-help/workflow.md +165 -0
  13. package/.claude/skills/relay-new-issue/SKILL.md +6 -0
  14. package/.claude/skills/relay-new-issue/workflow.md +90 -0
  15. package/.claude/skills/relay-notebook/SKILL.md +6 -0
  16. package/.claude/skills/relay-notebook/workflow.md +264 -0
  17. package/.claude/skills/relay-order/SKILL.md +6 -0
  18. package/.claude/skills/relay-order/workflow.md +51 -0
  19. package/.claude/skills/relay-plan/SKILL.md +6 -0
  20. package/.claude/skills/relay-plan/workflow.md +133 -0
  21. package/.claude/skills/relay-resolve/SKILL.md +6 -0
  22. package/.claude/skills/relay-resolve/workflow.md +135 -0
  23. package/.claude/skills/relay-review/SKILL.md +6 -0
  24. package/.claude/skills/relay-review/workflow.md +163 -0
  25. package/.claude/skills/relay-scan/SKILL.md +6 -0
  26. package/.claude/skills/relay-scan/workflow.md +103 -0
  27. package/.claude/skills/relay-setup/SKILL.md +6 -0
  28. package/.claude/skills/relay-setup/workflow.md +296 -0
  29. package/.claude/skills/relay-verify/SKILL.md +6 -0
  30. package/.claude/skills/relay-verify/workflow.md +100 -0
  31. package/LICENSE +21 -0
  32. package/README.md +374 -0
  33. package/package.json +43 -0
  34. package/tools/cli.js +186 -0
package/README.md ADDED
@@ -0,0 +1,374 @@
1
+ ```
2
+ ██████╗ ███████╗ ██╗ █████╗ ██╗ ██╗
3
+ ██╔══██╗ ██╔════╝ ██║ ██╔══██╗ ╚██╗ ██╔╝
4
+ ██████╔╝ █████╗ ██║ ███████║ ╚████╔╝
5
+ ██╔══██╗ ██╔══╝ ██║ ██╔══██║ ╚██╔╝
6
+ ██║ ██║ ███████╗ ███████╗ ██║ ██║ ██║
7
+ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝
8
+ persistent memory for AI workflows
9
+ ```
10
+
11
+ [![Version](https://img.shields.io/npm/v/relay-workflow?style=flat-square&color=blue)](https://www.npmjs.com/package/relay-workflow)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green?style=flat-square)](LICENSE)
13
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-brightgreen?style=flat-square&logo=node.js)](https://nodejs.org)
14
+ [![Claude Code](https://img.shields.io/badge/Claude_Code-Skills-blueviolet?style=flat-square)](https://docs.anthropic.com/en/docs/claude-code)
15
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square)](CONTRIBUTING.md)
16
+
17
+ A skill-driven workflow system that gives AI coding agents persistent memory of what was built, what broke, and what's next. It replaces the ephemeral, conversation-scoped context that AI models operate in with a structured documentation system that survives across sessions, models, and teams.
18
+
19
+ ## The Problem
20
+
21
+ When you use an AI model to build and maintain a codebase, every conversation starts from zero. The model doesn't know:
22
+
23
+ - What issue it fixed last week and how
24
+ - What feature it designed two hours ago
25
+ - Which approach was tried and rejected for a similar problem
26
+ - What other parts of the codebase were affected by recent changes
27
+ - What work is queued up and in what order it should be tackled
28
+
29
+ This means you repeat context, re-explain decisions, risk re-introducing fixed bugs, and lose the thread of multi-session work. The bigger the project gets, the worse this becomes.
30
+
31
+ ## The Solution
32
+
33
+ Relay creates a **living documentation layer** that serves as the AI's project memory:
34
+
35
+ - **Issues and features** are documented in structured `.md` files with full context
36
+ - **Implementation plans, reviews, and verifications** are appended to those files as work progresses
37
+ - **Verification notebooks** (`.ipynb`) provide executable proof that changes work
38
+ - **Resolved items** are archived with implementation docs, preserving the full decision trail
39
+ - **Status and ordering** files are regenerated to reflect current project state
40
+ - **Project-specific customizations** are auto-detected during setup and maintained as the codebase evolves
41
+
42
+ Every AI session reads this documentation before acting. Every session writes back what it did. The result is a continuous, auditable record that any AI model (or human) can pick up and continue.
43
+
44
+ ## Quick Start
45
+
46
+ ### 1. Install
47
+
48
+ ```bash
49
+ # Install with npx (recommended)
50
+ cd your-project
51
+ npx relay-workflow install
52
+ ```
53
+
54
+ Or install manually:
55
+
56
+ ```bash
57
+ git clone https://github.com/momobits/Relay.git /tmp/relay
58
+ cp -r /tmp/relay/.claude/skills/relay-* your-project/.claude/skills/
59
+ rm -rf /tmp/relay
60
+ ```
61
+
62
+ ### 2. Setup
63
+
64
+ In Claude Code, run:
65
+
66
+ ```
67
+ /relay-setup
68
+ ```
69
+
70
+ This creates the `.relay/` data directory, generates initial status files, and scans your project for customizations (edge cases, test commands, notebook patterns).
71
+
72
+ ### 3. First Run
73
+
74
+ ```
75
+ /relay-discover — scan the codebase for issues
76
+ /relay-scan — generate relay-status.md
77
+ /relay-order — prioritize the work
78
+ /relay-analyze — start working on the highest-priority item
79
+ ```
80
+
81
+ Or explore a new feature idea:
82
+ ```
83
+ /relay-brainstorm — interactive feature exploration
84
+ ```
85
+
86
+ Need help? Run `/relay-help` to see where you are and what to do next.
87
+
88
+ ---
89
+
90
+ ## How It Works
91
+
92
+ Relay uses **Claude Code skills** — each workflow step is a skill you invoke with `/relay-*`. The skills read and write to the `.relay/` data directory, building up persistent documentation across sessions.
93
+
94
+ ### Workflow Categories
95
+
96
+ ```
97
+ PREPARE DISCOVERY FEATURE CODE
98
+ (status) (find work) (design work) (do work)
99
+
100
+ /relay-scan /relay-discover /relay-brainstorm /relay-analyze
101
+ | (scan for | |
102
+ /relay-order issues) /relay-design /relay-plan
103
+ /relay-new-issue | |
104
+ (file item) /relay-cleanup /relay-review
105
+ (archive stale |
106
+ brainstorms) *implement*
107
+ |
108
+ /relay-verify
109
+ |
110
+ /relay-notebook
111
+ |
112
+ /relay-resolve
113
+ ```
114
+
115
+ The flow between categories: discovery/feature skills create docs → prepare skills prioritize them → code skills implement them. Each skill tells you what to run next.
116
+
117
+ ### Workflow Paths
118
+
119
+ There are three entry points depending on what you're doing:
120
+
121
+ ```
122
+ Specific issue → /relay-new-issue → /relay-scan → /relay-order → /relay-analyze → ... → /relay-resolve
123
+ Systematic scan → /relay-discover → /relay-scan → /relay-order → /relay-analyze → ... → /relay-resolve
124
+ Feature idea → /relay-brainstorm → /relay-design → /relay-scan → /relay-order → /relay-analyze → ... → /relay-resolve
125
+ ```
126
+
127
+ All paths converge on the same **code pipeline** for implementation, ensuring every change gets the same rigor regardless of how it was discovered.
128
+
129
+ ---
130
+
131
+ ## Skill Reference
132
+
133
+ ### Prepare — Project status and maintenance
134
+
135
+ | Skill | Purpose |
136
+ |-------|---------|
137
+ | **/relay-scan** | Scans all docs and codebase, produces `relay-status.md` with current state of every tracked item. Flags regressions in archived items. |
138
+ | **/relay-order** | Reads relay-status.md and all outstanding items, analyzes dependencies, produces `relay-ordering.md` with prioritized phases. |
139
+
140
+ ### Discovery — Finding and documenting work
141
+
142
+ | Skill | Purpose |
143
+ |-------|---------|
144
+ | **/relay-discover** | Systematic codebase scan for bugs, gaps, dead code, security issues, performance problems, test gaps. Creates issue files in `.relay/issues/`. |
145
+ | **/relay-new-issue** | Quick-file tool for a specific bug or gap. Redirects features to `/relay-brainstorm`. Supports in-context and cross-chat handoff. |
146
+
147
+ ### Feature — Designing new features
148
+
149
+ | Skill | Purpose |
150
+ |-------|---------|
151
+ | **/relay-brainstorm** | Interactive exploration of a feature idea. Asks clarifying questions, explores codebase, presents approaches with trade-offs. Creates a brainstorm file. |
152
+ | **/relay-design** | Takes the brainstorm and designs each feature in detail. Creates individual feature files with architecture, interfaces, data flow, and integration points. |
153
+ | **/relay-cleanup** | Archives abandoned brainstorm files that were never completed through `/relay-design`. |
154
+
155
+ ### Code — Implementation pipeline
156
+
157
+ | Skill | Purpose |
158
+ |-------|---------|
159
+ | **/relay-analyze** | Validates the item still exists, performs root cause analysis, maps blast radius. Reads ALL items and archives for full context. |
160
+ | **/relay-plan** | Creates atomic, independently-verifiable implementation steps. Each step specifies WHAT, HOW, WHY, RISK, VERIFY, ROLLBACK. |
161
+ | **/relay-review** | Adversarial review that tries to break the plan. Tests edge cases, checks for regressions. Produces APPROVED, APPROVED WITH CHANGES, or REJECTED verdict. |
162
+ | **/relay-verify** | Post-implementation check: diff vs plan, completeness, correctness, regression tests. |
163
+ | **/relay-notebook** | Creates a Jupyter verification notebook that exercises the real project API end-to-end, runs every cell, iterates until all pass. |
164
+ | **/relay-resolve** | Archives resolved items, creates implementation docs in `.relay/implemented/`, updates brainstorm files and ordering. |
165
+
166
+ ### Navigation
167
+
168
+ | Skill | Purpose |
169
+ |-------|---------|
170
+ | **/relay-help** | Analyzes current project state and recommends what to do next. Shows where you are in the workflow. |
171
+
172
+ ---
173
+
174
+ ## Walkthrough: Fixing a Bug
175
+
176
+ ### Step 1: Discover the issue
177
+
178
+ Run `/relay-discover` or `/relay-new-issue`. The AI scans the codebase and creates `.relay/issues/user_auth_token_expired_silently.md`.
179
+
180
+ ### Step 2: Update status and ordering
181
+
182
+ Run `/relay-scan` then `/relay-order`. The issue appears in relay-ordering.md based on severity.
183
+
184
+ ### Step 3: Analyze (`/relay-analyze`)
185
+
186
+ The AI reads ALL issues, features, archives, and implemented docs. Produces a structured analysis **appended to the issue file**: validation, root cause, blast radius, approach.
187
+
188
+ ### Step 4: Plan (`/relay-plan`)
189
+
190
+ Creates an atomic plan with WHAT/HOW/WHY/RISK/VERIFY/ROLLBACK for each step. **Appended to the issue file**.
191
+
192
+ ### Step 5: Review (`/relay-review`)
193
+
194
+ Adversarial review tries to break the plan. Verdict: APPROVED, APPROVED WITH CHANGES, or REJECTED.
195
+
196
+ ### Step 6: Implement
197
+
198
+ Write the code changes per the finalized plan.
199
+
200
+ ### Step 7: Verify (`/relay-verify`)
201
+
202
+ Checks each step against the plan, runs regression tests.
203
+
204
+ ### Step 8: Notebook (`/relay-notebook`)
205
+
206
+ Creates and runs a Jupyter notebook that exercises the real project API end-to-end.
207
+
208
+ ### Step 9: Resolve (`/relay-resolve`)
209
+
210
+ Archives the issue, creates implementation doc, updates ordering. Then run `/relay-scan` and `/relay-order` to refresh status.
211
+
212
+ **The full lifecycle is documented in one place** — the archived issue file contains the original problem, plan, review, and verification report.
213
+
214
+ ---
215
+
216
+ ## Walkthrough: Building a Feature
217
+
218
+ ### Step 1: Brainstorm (`/relay-brainstorm`)
219
+
220
+ Interactive exploration of the feature idea. Creates a brainstorm file with approaches, trade-offs, decisions, and feature breakdown.
221
+
222
+ ### Step 2: Design (`/relay-design`)
223
+
224
+ Designs each feature in detail. Creates individual feature files with architecture, interfaces, data flow.
225
+
226
+ ### Step 3: Prepare
227
+
228
+ Run `/relay-scan` and `/relay-order` to integrate features into the backlog.
229
+
230
+ ### Step 4-9: Code pipeline
231
+
232
+ For each feature, in order:
233
+ ```
234
+ /relay-analyze → /relay-plan → /relay-review → implement → /relay-verify → /relay-notebook → /relay-resolve
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Lifecycle of an Item
240
+
241
+ Every issue or feature follows the same documentation lifecycle. Each phase appends to the item file, building a complete record:
242
+
243
+ ```
244
+ ┌───────────────────────────────────────────────────────────┐
245
+ │ .relay/issues/some_bug.md (or .relay/features/...) │
246
+ │ │
247
+ │ # Original Issue │ ← /relay-discover or /relay-new-issue
248
+ │ Problem, impact, proposed fix, affected files │
249
+ │ │
250
+ │ --- │
251
+ │ ## Analysis │ ← /relay-analyze
252
+ │ Validation, root cause, blast radius, approach │
253
+ │ │
254
+ │ --- │
255
+ │ ## Implementation Plan │ ← /relay-plan
256
+ │ Steps with WHAT/HOW/WHY/RISK/VERIFY/ROLLBACK │
257
+ │ │
258
+ │ --- │
259
+ │ ## Adversarial Review │ ← /relay-review
260
+ │ Issues found, edge cases, regression risk, verdict │
261
+ │ │
262
+ │ --- │
263
+ │ ## Implementation Guidelines │ ← /relay-review (APPROVED)
264
+ │ Step-by-step execution rules, deviation logging │
265
+ │ │
266
+ │ --- │
267
+ │ ## Verification Report │ ← /relay-verify
268
+ │ Step-by-step status table, test results, verdict │
269
+ │ │
270
+ │ --- │
271
+ │ ## Post-Implementation Fix #1 (if needed) │ ← /relay-notebook
272
+ │ Problem, plan, rollback for issues found in tests │
273
+ │ │
274
+ └───────────────────────────────────────────────────────────┘
275
+
276
+ ▼ (/relay-resolve)
277
+ ┌───────────────────────────────────────────────────────────┐
278
+ │ .relay/archive/issues/some_bug.md │
279
+ │ > ARCHIVED — See implementation doc │
280
+ │ [full history preserved] │
281
+ ├───────────────────────────────────────────────────────────┤
282
+ │ .relay/implemented/some_bug.md │
283
+ │ Summary, files modified, verification, caveats │
284
+ ├───────────────────────────────────────────────────────────┤
285
+ │ .relay/archive/notebooks/some_bug.ipynb │
286
+ │ Executable verification proof │
287
+ └───────────────────────────────────────────────────────────┘
288
+ ```
289
+
290
+ ---
291
+
292
+ ## Directory Structure
293
+
294
+ After setup, your project will have:
295
+
296
+ ```
297
+ your-project/
298
+ ├── .claude/
299
+ │ └── skills/
300
+ │ ├── relay-setup/ # Initialize Relay
301
+ │ ├── relay-scan/ # Generate status
302
+ │ ├── relay-order/ # Prioritize work
303
+ │ ├── relay-discover/ # Scan for issues
304
+ │ ├── relay-new-issue/ # File a specific issue
305
+ │ ├── relay-brainstorm/ # Explore feature ideas
306
+ │ ├── relay-design/ # Design features
307
+ │ ├── relay-cleanup/ # Archive stale brainstorms
308
+ │ ├── relay-analyze/ # Validate before implementation
309
+ │ ├── relay-plan/ # Create implementation plan
310
+ │ ├── relay-review/ # Adversarial review
311
+ │ ├── relay-verify/ # Verify implementation
312
+ │ ├── relay-notebook/ # Verification notebook
313
+ │ ├── relay-resolve/ # Close out and archive
314
+ │ └── relay-help/ # Navigation guidance
315
+
316
+ ├── .relay/ # Data directory (created by /relay-setup)
317
+ │ ├── version.md # Installed version and skills manifest
318
+ │ ├── relay-readme.md # Relay documentation
319
+ │ ├── relay-config.md # Project-specific settings
320
+ │ ├── relay-status.md # Generated — current state
321
+ │ ├── relay-ordering.md # Generated — prioritized work
322
+ │ ├── issues/ # Active bug/gap reports
323
+ │ ├── features/ # Active feature designs and brainstorms
324
+ │ ├── implemented/ # Resolution docs for completed work
325
+ │ ├── notebooks/ # Verification notebooks
326
+ │ └── archive/
327
+ │ ├── issues/ # Archived (resolved) issues
328
+ │ ├── features/ # Archived (resolved) features
329
+ │ └── notebooks/ # Archived verification notebooks
330
+ ```
331
+
332
+ ---
333
+
334
+ ## Key Design Decisions
335
+
336
+ **Everything is persisted in `.md` files.** Plans, reviews, and verifications are appended to the item file — not left in conversation history. Any AI model or human can pick up where the last session left off.
337
+
338
+ **The code pipeline is the same for issues and features.** Whether you're fixing a one-line bug or building a multi-part feature, the same analyze → plan → review → implement → verify → notebook → resolve sequence applies.
339
+
340
+ **Archives are memory, not trash.** Resolved items go to `.relay/archive/`, not deleted. Every code skill reads the archives to avoid re-introducing old bugs.
341
+
342
+ **Reviews are adversarial by design.** `/relay-review` is framed as "try to break the plan" rather than "confirm it's good."
343
+
344
+ **Notebooks provide executable proof.** Verification notebooks aren't just documentation — they're run against the actual codebase.
345
+
346
+ **Every skill tells you what to do next.** Each skill ends with a Navigation section that explicitly tells you which skill to run next.
347
+
348
+ ---
349
+
350
+ ## Adding Skills
351
+
352
+ To extend the workflow with a new skill:
353
+
354
+ 1. Create a new directory in `.claude/skills/relay-[name]/` with:
355
+ - `SKILL.md` — frontmatter (name, description) + "Follow the instructions in ./workflow.md."
356
+ - `workflow.md` — the full skill instructions
357
+
358
+ 2. Wire it into the workflow:
359
+ - Add a Navigation entry in the preceding skill that routes to the new one
360
+ - Add it to the skill reference table in this file
361
+
362
+ 3. If the skill requires project-specific customization:
363
+ - Add a Phase 2 step in `/relay-setup` that detects project-specific values and populates `relay-config.md`
364
+
365
+ ## Maintenance
366
+
367
+ **When to update skills:**
368
+ - After adding new integrations, services, or test frameworks — run `/relay-resolve` to refresh customizations, or re-run `/relay-setup` Phase 2
369
+ - After changing project structure (module renames, directory moves) — update scoping paths and test commands in `.relay/relay-config.md`
370
+ - After finding a workflow gap — fix the skill's `workflow.md`
371
+
372
+ **Feature file status lifecycle:**
373
+ - Brainstorm files: `BRAINSTORMING → READY FOR DESIGN → DESIGN COMPLETE → COMPLETE`
374
+ - Individual feature files: `DESIGNED` (created by `/relay-design`) → `IMPLEMENTED` (set by `/relay-resolve` before archiving)
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "relay-workflow",
3
+ "version": "2.0.0",
4
+ "description": "Persistent memory for AI coding workflows — Claude Code skills that give agents memory of what was built, what broke, and what's next",
5
+ "main": "tools/cli.js",
6
+ "bin": {
7
+ "relay-workflow": "tools/cli.js"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "echo 'Run: npx relay-workflow install'"
11
+ },
12
+ "keywords": [
13
+ "claude",
14
+ "claude-code",
15
+ "ai-workflow",
16
+ "ai-memory",
17
+ "coding-agent",
18
+ "skills",
19
+ "persistent-memory",
20
+ "issue-tracking",
21
+ "code-review",
22
+ "verification"
23
+ ],
24
+ "author": "Momo",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/momobits/Relay.git"
29
+ },
30
+ "homepage": "https://github.com/momobits/Relay",
31
+ "bugs": {
32
+ "url": "https://github.com/momobits/Relay/issues"
33
+ },
34
+ "engines": {
35
+ "node": ">=18.0.0"
36
+ },
37
+ "files": [
38
+ "tools/cli.js",
39
+ ".claude/skills/relay-*/**/*",
40
+ "README.md",
41
+ "LICENSE"
42
+ ]
43
+ }
package/tools/cli.js ADDED
@@ -0,0 +1,186 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const VERSION = "2.0.0";
7
+ const SKILLS_DIR = ".claude/skills";
8
+
9
+ const RELAY_SKILLS = [
10
+ "relay-analyze",
11
+ "relay-brainstorm",
12
+ "relay-cleanup",
13
+ "relay-design",
14
+ "relay-discover",
15
+ "relay-help",
16
+ "relay-new-issue",
17
+ "relay-notebook",
18
+ "relay-order",
19
+ "relay-plan",
20
+ "relay-resolve",
21
+ "relay-review",
22
+ "relay-scan",
23
+ "relay-setup",
24
+ "relay-verify",
25
+ ];
26
+
27
+ function copyDirRecursive(src, dest) {
28
+ fs.mkdirSync(dest, { recursive: true });
29
+ const entries = fs.readdirSync(src, { withFileTypes: true });
30
+ for (const entry of entries) {
31
+ const srcPath = path.join(src, entry.name);
32
+ const destPath = path.join(dest, entry.name);
33
+ if (entry.isDirectory()) {
34
+ copyDirRecursive(srcPath, destPath);
35
+ } else {
36
+ fs.copyFileSync(srcPath, destPath);
37
+ }
38
+ }
39
+ }
40
+
41
+ function install(targetDir) {
42
+ const skillsSrc = path.join(__dirname, "..", SKILLS_DIR);
43
+ const skillsDest = path.join(targetDir, SKILLS_DIR);
44
+
45
+ // Verify source skills exist
46
+ if (!fs.existsSync(skillsSrc)) {
47
+ console.error("Error: Relay skills not found in package. Reinstall with: npm install relay-workflow");
48
+ process.exit(1);
49
+ }
50
+
51
+ // Create .claude/skills/ in target
52
+ try {
53
+ fs.mkdirSync(skillsDest, { recursive: true });
54
+ } catch (err) {
55
+ console.error(`\n Error: Cannot create ${skillsDest}\n ${err.message}\n`);
56
+ process.exit(1);
57
+ }
58
+
59
+ // Copy each relay skill
60
+ let installed = 0;
61
+ let skipped = 0;
62
+
63
+ for (const skill of RELAY_SKILLS) {
64
+ const src = path.join(skillsSrc, skill);
65
+ const dest = path.join(skillsDest, skill);
66
+
67
+ if (!fs.existsSync(src)) {
68
+ console.warn(` Warning: ${skill} not found in package, skipping`);
69
+ skipped++;
70
+ continue;
71
+ }
72
+
73
+ // Check for existing installation
74
+ if (fs.existsSync(dest)) {
75
+ const existingSkill = path.join(dest, "SKILL.md");
76
+ if (fs.existsSync(existingSkill)) {
77
+ // Overwrite — update to latest
78
+ fs.rmSync(dest, { recursive: true, force: true });
79
+ }
80
+ }
81
+
82
+ copyDirRecursive(src, dest);
83
+ installed++;
84
+ }
85
+
86
+ console.log(`\n Installed ${installed} Relay skills into ${path.relative(process.cwd(), skillsDest)}/`);
87
+ if (skipped > 0) {
88
+ console.log(` Skipped ${skipped} (not found in package)`);
89
+ }
90
+
91
+ // Show next steps
92
+ console.log(`
93
+ Next steps:
94
+ 1. Open Claude Code in your project
95
+ 2. Run /relay-setup to initialize the .relay/ data directory
96
+ 3. Run /relay-help to see what to do next
97
+
98
+ Skills installed:`);
99
+
100
+ for (const skill of RELAY_SKILLS) {
101
+ const dest = path.join(skillsDest, skill);
102
+ if (fs.existsSync(dest)) {
103
+ console.log(` /${skill}`);
104
+ }
105
+ }
106
+
107
+ console.log("");
108
+ }
109
+
110
+ function uninstall(targetDir) {
111
+ const skillsDest = path.join(targetDir, SKILLS_DIR);
112
+ let removed = 0;
113
+
114
+ for (const skill of RELAY_SKILLS) {
115
+ const dest = path.join(skillsDest, skill);
116
+ if (fs.existsSync(dest)) {
117
+ fs.rmSync(dest, { recursive: true, force: true });
118
+ removed++;
119
+ }
120
+ }
121
+
122
+ if (removed > 0) {
123
+ console.log(`\n Removed ${removed} Relay skills from ${path.relative(process.cwd(), skillsDest)}/`);
124
+ console.log(" Note: .relay/ data directory was NOT removed (your issues, features, and history are preserved)\n");
125
+ } else {
126
+ console.log("\n No Relay skills found to remove.\n");
127
+ }
128
+ }
129
+
130
+ function showHelp() {
131
+ console.log(`
132
+ relay-workflow v${VERSION}
133
+ Persistent memory for AI coding workflows
134
+
135
+ Usage:
136
+ npx relay-workflow install Install Relay skills into current project
137
+ npx relay-workflow uninstall Remove Relay skills (keeps .relay/ data)
138
+ npx relay-workflow version Show version
139
+ npx relay-workflow help Show this help
140
+
141
+ What it does:
142
+ Copies 15 Claude Code skills into .claude/skills/relay-*/
143
+ These skills give AI agents persistent memory across sessions.
144
+
145
+ After install:
146
+ 1. Open Claude Code
147
+ 2. Run /relay-setup to initialize
148
+ 3. Run /relay-help for guidance
149
+ `);
150
+ }
151
+
152
+ // --- Main ---
153
+
154
+ const args = process.argv.slice(2);
155
+ const command = args[0] || "help";
156
+ const targetDir = args[1] || process.cwd();
157
+
158
+ switch (command) {
159
+ case "install":
160
+ console.log(`\n relay-workflow v${VERSION} — installing...`);
161
+ install(targetDir);
162
+ break;
163
+
164
+ case "uninstall":
165
+ case "remove":
166
+ console.log(`\n relay-workflow v${VERSION} — uninstalling...`);
167
+ uninstall(targetDir);
168
+ break;
169
+
170
+ case "version":
171
+ case "--version":
172
+ case "-v":
173
+ console.log(VERSION);
174
+ break;
175
+
176
+ case "help":
177
+ case "--help":
178
+ case "-h":
179
+ showHelp();
180
+ break;
181
+
182
+ default:
183
+ console.error(`\n Unknown command: ${command}`);
184
+ showHelp();
185
+ process.exit(1);
186
+ }