@c-d-cc/reap 0.10.2 → 0.11.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 (46) hide show
  1. package/README.ja.md +30 -8
  2. package/README.ko.md +30 -8
  3. package/README.md +22 -6
  4. package/README.zh-CN.md +30 -8
  5. package/dist/cli.js +4644 -1307
  6. package/dist/templates/artifacts/01-objective.md +1 -0
  7. package/dist/templates/artifacts/02-planning.md +1 -0
  8. package/dist/templates/artifacts/03-implementation.md +1 -0
  9. package/dist/templates/artifacts/04-validation.md +1 -0
  10. package/dist/templates/artifacts/05-completion.md +1 -0
  11. package/dist/templates/artifacts/merge/01-detect.md +1 -0
  12. package/dist/templates/artifacts/merge/02-mate.md +1 -0
  13. package/dist/templates/artifacts/merge/03-merge.md +1 -0
  14. package/dist/templates/artifacts/merge/04-sync.md +1 -0
  15. package/dist/templates/artifacts/merge/05-validation.md +1 -0
  16. package/dist/templates/artifacts/merge/06-completion.md +1 -0
  17. package/dist/templates/commands/reap.abort.md +1 -69
  18. package/dist/templates/commands/reap.back.md +1 -58
  19. package/dist/templates/commands/reap.completion.md +2 -145
  20. package/dist/templates/commands/reap.evolve.md +1 -51
  21. package/dist/templates/commands/reap.help.md +1 -90
  22. package/dist/templates/commands/reap.implementation.md +1 -98
  23. package/dist/templates/commands/reap.merge.completion.md +2 -17
  24. package/dist/templates/commands/reap.merge.detect.md +1 -16
  25. package/dist/templates/commands/reap.merge.evolve.md +1 -24
  26. package/dist/templates/commands/reap.merge.mate.md +1 -23
  27. package/dist/templates/commands/reap.merge.md +1 -43
  28. package/dist/templates/commands/reap.merge.merge.md +1 -18
  29. package/dist/templates/commands/reap.merge.start.md +1 -18
  30. package/dist/templates/commands/reap.merge.sync.md +1 -28
  31. package/dist/templates/commands/reap.merge.validation.md +1 -21
  32. package/dist/templates/commands/reap.next.md +1 -87
  33. package/dist/templates/commands/reap.objective.md +1 -252
  34. package/dist/templates/commands/reap.planning.md +1 -97
  35. package/dist/templates/commands/reap.pull.md +1 -49
  36. package/dist/templates/commands/reap.push.md +1 -14
  37. package/dist/templates/commands/reap.report.md +1 -123
  38. package/dist/templates/commands/reap.start.md +1 -53
  39. package/dist/templates/commands/reap.status.md +1 -76
  40. package/dist/templates/commands/reap.sync.environment.md +1 -80
  41. package/dist/templates/commands/reap.sync.genome.md +1 -105
  42. package/dist/templates/commands/reap.sync.md +1 -13
  43. package/dist/templates/commands/reap.update.md +1 -40
  44. package/dist/templates/commands/reap.validation.md +1 -81
  45. package/dist/templates/hooks/reap-guide.md +1 -0
  46. package/package.json +1 -1
@@ -2,52 +2,4 @@
2
2
  description: "REAP Pull — Fetch remote, detect divergence, and run a full merge generation"
3
3
  ---
4
4
 
5
- # Pull
6
-
7
- Fetch from the remote, detect new generations, and run a full merge generation lifecycle. This is the distributed equivalent of `/reap.evolve`.
8
-
9
- If the target branch already includes all local work (fast-forward), skip the merge lifecycle entirely.
10
-
11
- ## Gate (Preconditions)
12
- - Verify no active generation exists (`.reap/life/current.yml` must be empty)
13
- - If an active generation exists: ERROR — "Complete the current generation before pulling."
14
-
15
- ## Arguments
16
- - `{branch}` — Target remote branch to pull from (required)
17
-
18
- ## Steps
19
-
20
- ### Phase 1: Fetch + Detect
21
- 1. Run `git fetch origin` (or the specified remote)
22
- 2. Verify the target branch exists: `git rev-parse --verify {branch}`
23
- - If not found: ERROR — "Branch {branch} does not exist. Run `git fetch` first."
24
- 3. Scan the target branch's `.reap/lineage/` via git refs:
25
- - `git ls-tree -r --name-only {branch} -- .reap/lineage/`
26
- - Read `meta.yml` files via `git show {branch}:.reap/lineage/{dir}/meta.yml`
27
- 4. Compare with local lineage to identify new generations
28
- 5. If no new generations: "Already up to date. No new generations on {branch}." → STOP
29
- 6. Report: list new generation IDs + goals found on the target branch
30
-
31
- ### Phase 1.5: Fast-Forward Check
32
- 7. Determine the local latest generation ID and the remote latest generation ID
33
- 8. Build a combined DAG from both local and remote lineage metadata
34
- 9. Check if the local latest generation is an ancestor of the remote latest generation:
35
- - **If yes (fast-forward possible)**:
36
- - Run `git merge --ff {branch}`
37
- - Run `git submodule update --init` to sync submodules
38
- - Report: "Fast-forwarded to {branch}. Local lineage now includes {remote-latest-id}. No merge generation needed."
39
- - **STOP** — no merge lifecycle needed
40
- - **If same generation**: "Already up to date." → **STOP**
41
- - **If no (diverged)**: Continue to Phase 2
42
-
43
- ### Phase 2: Merge Generation
44
- 10. Execute `/reap.merge.start` with the target branch
45
- - This creates the merge generation and runs detect (01-detect.md)
46
- 11. Execute `/reap.merge.evolve` to run the full merge lifecycle:
47
- - Detect → Mate → Merge → Sync → Validation → Completion
48
- 12. Run `git submodule update --init` to sync submodules after merge
49
- 13. The merge generation is archived upon completion
50
-
51
- ## Completion
52
- - Fast-forward: "Fast-forwarded to {branch}. No merge generation needed."
53
- - Full merge: "Pull complete. Merged {branch} into {current-branch}. Generation {id} archived."
5
+ Run `reap run pull` and follow the stdout instructions exactly.
@@ -2,17 +2,4 @@
2
2
  description: "REAP Push — Validate REAP state and push current branch"
3
3
  ---
4
4
 
5
- # Push
6
-
7
- Validate the current REAP state and push the current branch to the remote.
8
-
9
- ## Steps
10
-
11
- 1. Read `.reap/life/current.yml`
12
- 2. If an active generation exists and stage is not `completion`:
13
- - Warn: "Generation {id} is in progress (stage: {stage}). Complete it before pushing."
14
- - Ask the user: "Push anyway? (yes/no)"
15
- - If no: STOP
16
- 3. Get current branch: `git rev-parse --abbrev-ref HEAD`
17
- 4. Run `git push origin {branch}`
18
- 5. Report: "Pushed {branch} to origin."
5
+ Run `reap run push` and follow the stdout instructions exactly.
@@ -2,126 +2,4 @@
2
2
  description: "REAP Report — Report a bug or issue to the REAP project"
3
3
  ---
4
4
 
5
- # Report
6
-
7
- Report a bug, malfunction, or feedback to the REAP project via GitHub Issue.
8
- **Language**: All user-facing messages must follow the user's configured language setting (see REAP Guide § Language).
9
-
10
- ## Gate (Preconditions)
11
- - Check if `gh` CLI is available: `which gh`
12
- - If not available: inform user that GitHub CLI is required (https://cli.github.com), then `gh auth login`. **STOP**
13
- - Check if authenticated: `gh auth status`
14
- - If not authenticated: inform user to run `gh auth login`. **STOP**
15
- - Read `.reap/config.yml` — check `autoIssueReport` is not explicitly `false`
16
- - If `autoIssueReport: false`: inform user that issue reporting is disabled and how to enable it in config.yml. **STOP**
17
-
18
- ## Mode Detection
19
-
20
- **Auto mode** (called by agent when malfunction detected):
21
- - The agent provides error context as arguments
22
- - Skip to Step 2 with pre-filled context
23
-
24
- **Manual mode** (user calls `/reap.report` directly):
25
- - Ask the user what they want to report:
26
- - Bug / malfunction
27
- - Feature request
28
- - Other feedback
29
- - Gather description from the user
30
-
31
- ## Steps
32
-
33
- ### 1. Collect Context
34
- Automatically gather (do NOT ask the user for these):
35
- - REAP version: `reap --version`
36
- - Node version: `node --version`
37
- - OS: `uname -sr`
38
- - Agent: detect from environment (Claude Code, OpenCode, etc.)
39
- - Generation state: read `.reap/life/current.yml` (id, stage — if active)
40
- - Genome hash: compute from `.reap/genome/`
41
- - Config: read `.reap/config.yml`
42
-
43
- ### 2. Draft Issue
44
-
45
- <PRIVACY_GATE>
46
- **BEFORE writing any issue content, apply these rules:**
47
- - Do NOT include: file contents, source code, environment variables, API keys,
48
- tokens, passwords, usernames, email addresses, IP addresses, domain names,
49
- database URLs, project-specific business logic, or any proprietary information.
50
- - ONLY include: REAP version, Node version, OS, generation ID, stage name,
51
- command name, genome hash, generic error messages, and REAP config structure
52
- (with all values masked).
53
- - When in doubt, OMIT the information rather than include it.
54
- </PRIVACY_GATE>
55
-
56
- Draft the issue using this template (issue body is always in English for the public repo):
57
-
58
- ```markdown
59
- ## {Bug Report / Feature Request / Feedback} (Auto-generated by REAP)
60
-
61
- **REAP Version**: v{version}
62
- **Node Version**: v{nodeVersion}
63
- **OS**: {os}
64
- **Agent**: {agentName}
65
-
66
- ### Context
67
- - **Generation**: {genId or "none"} (stage: {stage or "n/a"})
68
- - **Command**: {command that triggered the issue}
69
- - **Genome Hash**: {genomeHash}
70
-
71
- ### Description
72
- {user description or auto-detected malfunction description}
73
-
74
- ### Expected Behavior
75
- {what should have happened}
76
-
77
- ### Actual Behavior
78
- {what actually happened}
79
-
80
- ### Steps to Reproduce
81
- 1. {step}
82
-
83
- ### Config
84
- ```yaml
85
- version: {version}
86
- project: {projectName}
87
- strict: {on/off}
88
- autoUpdate: {on/off}
89
- # all other values masked
90
- ```
91
-
92
- ---
93
- *Auto-reported by REAP agent. Repository: c-d-cc/reap*
94
- ```
95
-
96
- ### 3. Post-format Sanitization
97
- Scan the drafted issue body and mask/remove:
98
- - Email patterns: `*@*.*` → `[REDACTED_EMAIL]`
99
- - API key/token patterns: `sk-*`, `ghp_*`, `Bearer *`, `token:*` → `[REDACTED]`
100
- - URLs with credentials: `https://user:pass@` → `https://[REDACTED]@`
101
- - Environment variable values: `KEY=value` → `KEY=[REDACTED]`
102
- - User paths: `/Users/{name}/` or `/home/{name}/` → `/Users/***/`
103
- - IP addresses: digit patterns like `\d+\.\d+\.\d+\.\d+` → `[REDACTED_IP]`
104
- - Source code blocks: if any project source code is included, remove it
105
-
106
- ### 4. User Confirmation
107
- Show the sanitized issue to the user (in user's language):
108
- - Explain that this report greatly helps improve the REAP project
109
- - Ask the user to verify no sensitive information is included
110
- - Present the full issue body
111
- - Ask: yes / no / edit
112
- - **yes**: proceed to Step 5
113
- - **no**: report cancelled
114
- - **edit**: let user modify, then re-run Step 3 sanitization and re-confirm
115
-
116
- ### 5. Submit
117
- - Determine labels (comma-separated, always include `auto-reported`):
118
- - Bug: `bug,auto-reported`
119
- - Feature request: `enhancement,auto-reported`
120
- - Feedback: `feedback,auto-reported`
121
- - Add context labels if applicable: `lifecycle`, `genome`, `cli`
122
- - Run: `gh issue create --repo c-d-cc/reap --title "{title}" --label "{labels}" --body "{sanitized body}"`
123
- - Show the issue URL to the user
124
- - Thank the user for their contribution to improving REAP
125
-
126
- ## Completion
127
- - "Issue #{number} reported: {url}"
5
+ Run `reap run report` and follow the stdout instructions exactly.
@@ -2,56 +2,4 @@
2
2
  description: "REAP Start — Start a new Generation"
3
3
  ---
4
4
 
5
- # Start a New Generation
6
-
7
- ## Gate (Preconditions)
8
- - Read `.reap/life/current.yml`
9
- - If an active Generation exists: ERROR — "Generation [id] is in progress (stage: [stage]). Complete it before starting a new generation." **STOP**
10
-
11
- ## Steps
12
-
13
- ### 0. Backlog Scan
14
- - Read all files in `.reap/life/backlog/`
15
- - If backlog items exist:
16
- - Present the list with title and priority for each item
17
- - Ask: "Would you like to select one of these, or enter a new goal?"
18
- - If the human selects a backlog item: **note the selection** (do NOT mark consumed yet — ID is not generated)
19
- - If the human wants a new goal: proceed to Step 1
20
- - If no backlog items exist: proceed to Step 1
21
-
22
- 1. Ask the human for the goal of this generation (or use selected backlog item's goal)
23
- 2. Count existing generations in `.reap/lineage/` to determine the genomeVersion
24
- 3. Generate the next generation ID:
25
- - Format: `gen-{NNN}-{hash}` (e.g. `gen-042-a3f8c2`)
26
- - `{NNN}`: zero-padded 3-digit sequence (existing count + 1)
27
- - `{hash}`: 6-character hex (0-9a-f only) — first 6 chars of `sha256(JSON.stringify({parents, goal, genomeHash, machineId, startedAt}))`
28
- - Generate: `node -e "const c=require('crypto'),o=require('os');console.log(c.createHash('sha256').update(JSON.stringify({parents:[],goal:'YOUR_GOAL',genomeHash:'',machineId:o.hostname(),startedAt:new Date().toISOString()})).digest('hex').slice(0,6))"`
29
- 4. **If a backlog item was selected in Step 0**: now mark it as `status: consumed` and add `consumedBy: gen-XXX-{hash}` (using the ID just generated)
30
- 6. Write the following to `current.yml`:
31
- ```yaml
32
- id: gen-XXX-{hash}
33
- goal: [goal provided by the human]
34
- stage: objective
35
- genomeVersion: [generation count + 1]
36
- startedAt: [current ISO 8601 timestamp]
37
- timeline:
38
- - stage: objective
39
- at: [current ISO 8601 timestamp]
40
- ```
41
- 7. Immediately create `.reap/life/01-objective.md` from the artifact template with the Goal section filled in
42
-
43
- ### Hook Execution (Generation Start)
44
- 8. Scan `.reap/hooks/` for files matching `onLifeStarted.*`
45
- - For each matched file (sorted by `order` from frontmatter, then alphabetically):
46
- 1. Read the frontmatter (`condition`, `order`)
47
- 2. Evaluate `condition` by running `.reap/hooks/conditions/{condition}.sh` (exit 0 = met, non-zero = skip):
48
- - If `condition` is absent: treat as `always`
49
- - If the condition script doesn't exist: warn and skip the hook
50
- - Default conditions: `always`, `has-code-changes`, `version-bumped`
51
- - Users can add custom conditions by placing scripts in `.reap/hooks/conditions/`
52
- 3. Execute based on file extension:
53
- - `.md`: read the file content (after frontmatter) as AI prompt and follow the instructions
54
- - `.sh`: run as shell script in the project root directory
55
-
56
- ## Completion
57
- - "Generation gen-XXX-{hash} started. Proceed with `/reap.objective` to define the goal, or `/reap.evolve` to run the full lifecycle."
5
+ Run `reap run start` and follow the stdout instructions exactly.
@@ -2,79 +2,4 @@
2
2
  description: "REAP Status — Show current generation state and project health"
3
3
  ---
4
4
 
5
- # Status
6
-
7
- Display a comprehensive overview of the current REAP project state.
8
-
9
- ## IMPORTANT: File Access Rules
10
- - ONLY read files explicitly listed in the steps below. Do NOT guess or infer file paths.
11
- - If a file read fails or the file does not exist, skip it silently and continue.
12
- - Do NOT attempt to read files like `reaprc.json`, `.reaprc`, or any file not specified in this command.
13
- - The REAP project structure uses ONLY: `.reap/config.yml`, `.reap/life/current.yml`, `.reap/life/backlog/`, `.reap/life/0X-*.md`, `.reap/genome/`, `.reap/lineage/`
14
-
15
- ## Steps
16
-
17
- ### 1. Project Info (MUST execute all of these)
18
- - Read `.reap/config.yml` for project name, entryMode, strict, autoUpdate, language
19
- - Count completed generations in `.reap/lineage/`
20
- - **REQUIRED**: Run the shell command `reap --version` to get the installed version. You MUST actually execute this command, do not skip it.
21
- - Show "REAP: v{installed}" — do NOT run `npm view` here (slow network call). Users can run `/reap.update` to check for updates.
22
-
23
- ### 2. Current Generation
24
- - Read `.reap/life/current.yml`
25
- - If no active generation: report "No active Generation" and skip to Step 5
26
- - Display: Generation ID, goal, current stage, genomeVersion, startedAt
27
-
28
- ### 3. Stage Progress
29
- - Read the current stage's artifact file (`.reap/life/0X-*.md`)
30
- - Summarize what has been done so far in this stage (completed tasks, decisions made, etc.)
31
- - If the artifact doesn't exist yet, report "Stage not started"
32
-
33
- ### 4. Timeline & Notable Events
34
- - Display the full timeline from `current.yml`:
35
- - Stage transitions with timestamps
36
- - Regressions (from, reason, refs)
37
- - Flag notable events:
38
- - Any regressions in this generation
39
- - Deferred tasks (from `03-implementation.md` if exists)
40
- - Genome-change backlog items pending
41
-
42
- ### 5. Backlog Summary
43
- - Read all files in `.reap/life/backlog/`
44
- - Count by type: `genome-change`, `environment-change`, `task`
45
- - List titles briefly
46
-
47
- ### 6. Genome Health
48
- - Quick check of `.reap/genome/` files:
49
- - Any files that are still placeholder-only?
50
- - Any files exceeding their line limit? (default: ~100 lines. For source-map.md, read the file's own header to find its adaptive line limit.)
51
- - Is `domain/` empty (no rule files)?
52
-
53
- ## Output Format
54
- Present as a structured summary the human can quickly scan:
55
-
56
- ```
57
- 📊 REAP Status
58
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
59
- REAP: v[installed] (run `/reap.update` to check for updates)
60
- Project: [name] ([entryMode])
61
- Strict: [on/off] Auto-Update: [on/off] Language: [lang]
62
- Genome Version: v[N]
63
- Completed Generations: [count]
64
-
65
- 🔄 Active Generation: [id]
66
- Goal: [goal]
67
- Stage: [stage]
68
- Started: [date]
69
-
70
- 📋 Stage Progress:
71
- [summary of current artifact]
72
-
73
- 📅 Timeline:
74
- [stage transitions]
75
-
76
- 📦 Backlog: [N] items
77
- genome-change: [n] environment-change: [n] task: [n]
78
-
79
- 🧬 Genome Health: [status]
80
- ```
5
+ Run `reap status` and present the output to the human.
@@ -2,83 +2,4 @@
2
2
  description: "REAP Sync Environment — Discover and document external environment dependencies"
3
3
  ---
4
4
 
5
- # Sync Environment
6
-
7
- Discover external systems, APIs, infrastructure, and constraints that affect this project. Populate the `.reap/environment/` 3-layer structure.
8
-
9
- ## Gate (Preconditions)
10
- - Read `.reap/life/current.yml`
11
- - If active Generation exists: switch to **Backlog Mode** (record as `type: environment-change`)
12
- - If no active Generation: proceed with **Sync Mode** (modify environment directly after human confirmation)
13
-
14
- ## Environment 3-Layer Structure
15
-
16
- ```
17
- .reap/environment/
18
- ├── summary.md # Session context (~100 lines max)
19
- ├── docs/ # Main reference docs (agent reads these)
20
- └── resources/ # Raw materials (user-managed)
21
- ├── *.pdf, *.md # Original documents
22
- └── links.md # External URLs + summaries
23
- ```
24
-
25
- - **summary.md**: Auto-generated overview of all docs/. Loaded into session context.
26
- - **docs/**: One file per environment topic. ~100 lines each. AI + human maintained.
27
- - **resources/**: User-provided originals. No line limit. AI reads when deeper detail needed.
28
-
29
- ## Steps
30
-
31
- ### 1. Source Code Scan
32
- Detect hints of external dependencies from:
33
- - `package.json` / `requirements.txt` / `go.mod` — SDK/client libraries (e.g., `discord.js`, `@aws-sdk/*`, `stripe`)
34
- - Config files — `.env`, `.env.example`, `wrangler.toml`, `docker-compose.yml`, `vercel.json`
35
- - API client code — HTTP clients, webhook handlers, OAuth configs
36
- - Infrastructure — Dockerfile, CI/CD configs, deployment scripts
37
-
38
- Present findings:
39
- ```
40
- 🔍 Detected external dependencies:
41
- - discord.js → Discord Bot API
42
- - @supabase/supabase-js → Supabase (DB + Auth)
43
- - wrangler.toml → Cloudflare Workers
44
- ```
45
-
46
- ### 2. User Interview
47
- Ask the user to confirm and expand. Goal: **capture ALL external systems** that affect this project.
48
-
49
- Questions (one at a time, skip if already covered):
50
- 1. "감지된 외부 서비스들이 맞나요? 추가/수정할 것이 있나요?"
51
- 2. "그 외에 연동되는 외부 서비스, API, 시스템이 있나요?"
52
- 3. "배포/인프라 환경을 알려주세요 (호스팅, CI/CD, 도메인 등)"
53
- 4. "따라야 하는 조직 규칙이나 외부 제약이 있나요? (보안 정책, 규제 등)"
54
- 5. "참고해야 할 외부 문서나 링크가 있나요? (API docs, 스펙 등)"
55
-
56
- For each confirmed item:
57
- - Ask: "관련 문서/링크가 있으면 알려주세요 (없으면 skip)"
58
- - If provided: save to `resources/` (file or `links.md` entry)
59
-
60
- ### 3. Generate docs/
61
- For each confirmed environment topic, create a file in `docs/`:
62
- - File name: `{topic-slug}.md` (e.g., `discord-api.md`, `infrastructure.md`)
63
- - Content: structured markdown with key info the agent needs during implementation
64
- - Sections: Overview, Key Constraints, API/Config Details, References (→ resources/)
65
- - ~100 lines max per file
66
-
67
- ### 4. Generate summary.md
68
- Aggregate all docs/ into a concise summary:
69
- - One section per environment topic
70
- - Key constraints and gotchas highlighted
71
- - Links to docs/ files for detail
72
- - **~100 lines max** (this gets loaded into every session)
73
-
74
- ### 5. Verify
75
- - List all created/updated files
76
- - Show summary.md content to user for confirmation
77
- - Ask: "빠진 환경 정보가 있나요?"
78
-
79
- ## Backlog Mode (active Generation)
80
- - Record each discovered environment item as `type: environment-change` in `.reap/life/backlog/`
81
- - "Environment 변경사항이 backlog에 기록되었습니다. Completion에서 적용됩니다."
82
-
83
- ## Completion
84
- - "Environment synced. {N} docs created, summary.md updated."
5
+ Run `reap run sync-environment` and follow the stdout instructions exactly.
@@ -2,108 +2,4 @@
2
2
  description: "REAP Sync Genome — Synchronize Genome with current source code"
3
3
  ---
4
4
 
5
- # Sync Genome
6
-
7
- Analyze the current source code and update the Genome to reflect reality.
8
-
9
- <HARD-GATE>
10
- If an active Generation exists (`.reap/life/current.yml` has content), do NOT modify Genome directly.
11
- Instead, record discovered differences as `type: genome-change` items in `.reap/life/backlog/` and inform the human.
12
- Only proceed with direct Genome modification when NO active Generation exists.
13
- </HARD-GATE>
14
-
15
- ## Gate (Preconditions)
16
- - Read `.reap/life/current.yml`
17
- - If active Generation exists: switch to **Backlog Mode** (record differences, do not modify Genome)
18
- - If no active Generation: proceed with **Sync Mode** (modify Genome directly after human confirmation)
19
-
20
- ## Steps
21
-
22
- ### 1. Read Current Genome
23
- - Read all files in `.reap/genome/` (principles.md, conventions.md, constraints.md, domain/)
24
- - Note current genomeVersion from the most recent generation in `.reap/lineage/`
25
-
26
- ### 2. Analyze Source Code
27
- Scan the project to understand its current state:
28
-
29
- **Tech Stack & Dependencies**:
30
- - package.json, tsconfig.json, Dockerfile, docker-compose.yml, etc.
31
- - New dependencies added, removed, or version-changed since Genome was last updated
32
-
33
- **Architecture & Structure**:
34
- - Directory structure and patterns (layers, modules, services)
35
- - Entry points, routing, API structure
36
- - Database, ORM, migration setup
37
-
38
- **Conventions**:
39
- - Linter/formatter configs (.eslintrc, .prettierrc, biome.json, etc.)
40
- - Test setup and patterns (test framework, file naming, coverage config)
41
- - Git hooks, CI/CD config
42
- - Code patterns observed in the source (naming, error handling, etc.)
43
-
44
- **Constraints**:
45
- - Build commands, test commands, validation commands
46
- - Environment requirements, runtime constraints
47
- - External service dependencies
48
-
49
- **Domain Knowledge** (→ `genome/domain/`):
50
- - Read `~/.reap/templates/domain-guide.md` for domain file writing principles
51
- - Scan source code for business rules NOT derivable from infrastructure analysis:
52
- - State machines and status transitions (e.g., post lifecycle, order states)
53
- - Policy rules with thresholds, limits, or conditions (e.g., rate limits, scoring criteria)
54
- - Classification/branching logic driven by business categories (e.g., template selection by type)
55
- - Hardcoded domain constants (keyword lists, prompt templates, magic numbers with business meaning)
56
- - Workflow orchestration sequences (e.g., approval flows, pipeline stages)
57
- - For each discovered domain rule cluster, evaluate:
58
- - "Would an agent implementing this feature ask 'where is this rule?'" → YES = create domain file
59
- - "Does a single item in an upper-level genome file require 3+ lines of explanation?" → YES = extract to domain file
60
- - Even if `genome/domain/` is currently empty, treat it as "not yet created" rather than "not needed"
61
-
62
- ### 3. Diff Analysis
63
- Compare source analysis with current Genome and identify:
64
- - **Additions**: Things in code but not in Genome
65
- - **Changes**: Things in Genome that no longer match code
66
- - **Removals**: Things in Genome that no longer exist in code
67
- - **Gaps**: Areas where Genome has placeholders but code has established patterns
68
- - **Domain gaps**: Business rules in code that have no corresponding `domain/` file
69
-
70
- ### 4. Report to Human
71
- Present a structured diff report:
72
-
73
- ```
74
- 🔄 Genome Sync Report
75
- ━━━━━━━━━━━━━━━━━━━━━
76
-
77
- 📝 principles.md
78
- + [New] API-first design pattern observed
79
- ~ [Changed] Layer structure: added shared/ directory
80
-
81
- 📝 conventions.md
82
- + [New] Biome used for linting (replacing ESLint)
83
- ~ [Changed] Test pattern: using vitest instead of jest
84
-
85
- 📝 constraints.md
86
- + [New] Validation command: bun test
87
- ~ [Changed] Runtime: Node.js compatible (was Bun-only)
88
-
89
- 📁 domain/
90
- + [Suggest] Create lifecycle-rules.md for REAP lifecycle logic
91
- ```
92
-
93
- ### 5. Apply Changes
94
-
95
- **Sync Mode** (no active Generation):
96
- - For each difference, ask the human: "Apply this change? (yes/no/modify)"
97
- - Apply confirmed changes to the corresponding Genome files
98
- - Follow Genome writing principles:
99
- - Each file ≤ 100 lines
100
- - If exceeding, extract to `domain/`
101
- - Follow `~/.reap/templates/domain-guide.md` for domain files
102
-
103
- **Backlog Mode** (active Generation):
104
- - Record each difference as a `type: genome-change` backlog item in `.reap/life/backlog/`
105
- - Inform: "Genome changes recorded in backlog. They will be applied at the Completion stage."
106
-
107
- ## Completion
108
- - **Sync Mode**: "Genome synchronized. [N] changes applied."
109
- - **Backlog Mode**: "Genome differences recorded as [N] backlog items. Apply during Completion."
5
+ Run `reap run sync-genome` and follow the stdout instructions exactly.
@@ -2,16 +2,4 @@
2
2
  description: "REAP Sync — Synchronize both Genome and Environment with current state"
3
3
  ---
4
4
 
5
- # Sync (Full)
6
-
7
- Run both Genome and Environment synchronization.
8
-
9
- ## Steps
10
-
11
- 1. Execute `/reap.sync.genome` — synchronize Genome with source code
12
- 2. Execute `/reap.sync.environment` — discover and document external environment
13
-
14
- ## Usage
15
- - `/reap.sync` — full sync (recommended after init or major changes)
16
- - `/reap.sync.genome` — genome only
17
- - `/reap.sync.environment` — environment only
5
+ Run `reap run sync` and follow the stdout instructions exactly.
@@ -2,43 +2,4 @@
2
2
  description: "REAP Update — Check for updates and upgrade REAP"
3
3
  ---
4
4
 
5
- # Update
6
-
7
- Check for REAP updates and upgrade to the latest version.
8
-
9
- ## IMPORTANT: File Access Rules
10
- - Do NOT access global node_modules or any path outside the project.
11
- - If a command fails, report the error and stop.
12
-
13
- ## Steps
14
-
15
- ### 1. Check Current Version
16
- - Run `reap --version` to get the installed version
17
- - Run `npm view @c-d-cc/reap version` to get the latest published version
18
- - Compare the two versions
19
-
20
- ### 2. Update Decision
21
- **If installed == latest:**
22
- - "REAP v{version} is already up to date. (latest)"
23
- - Then skip to Step 4.
24
-
25
- **If installed < latest (patch only — same major.minor, different patch):**
26
- - Show: "Patch update available: v{installed} → v{latest}. Updating automatically..."
27
- - Proceed directly to Step 3 (no user confirmation needed)
28
-
29
- **If installed < latest (minor or major change):**
30
- - Show: "Update available: v{installed} → v{latest}"
31
- - Ask the user: "Update now? (yes/no)"
32
- - If yes: proceed to Step 3
33
- - If no: "Skipped. Run `/reap.update` anytime to update."
34
-
35
- ### 3. Perform Update
36
- - Run: `npm update -g @c-d-cc/reap`
37
- - If the command fails, suggest: `sudo npm update -g @c-d-cc/reap` or `npm install -g @c-d-cc/reap@latest`
38
- - After npm update, run: `reap update` to sync commands, templates, and hooks to all detected agents
39
- - Show the update result summary
40
-
41
- ### 4. Sync Check
42
- - Run: `reap update --dry-run` to check if commands/templates need syncing
43
- - If changes detected: run `reap update` and show results
44
- - If no changes: "All commands and templates are up to date."
5
+ Run `reap update` and follow the output. For detailed update steps, run `reap update --dry-run` first.