@c-d-cc/reap 0.1.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 (32) hide show
  1. package/README.ko.md +309 -0
  2. package/README.md +308 -0
  3. package/dist/cli.js +9982 -0
  4. package/dist/templates/artifacts/01-objective.md +29 -0
  5. package/dist/templates/artifacts/02-planning.md +14 -0
  6. package/dist/templates/artifacts/03-implementation.md +19 -0
  7. package/dist/templates/artifacts/04-validation.md +20 -0
  8. package/dist/templates/artifacts/05-completion.md +47 -0
  9. package/dist/templates/commands/reap.back.md +54 -0
  10. package/dist/templates/commands/reap.completion.md +96 -0
  11. package/dist/templates/commands/reap.evolve.md +48 -0
  12. package/dist/templates/commands/reap.help.md +61 -0
  13. package/dist/templates/commands/reap.implementation.md +102 -0
  14. package/dist/templates/commands/reap.next.md +53 -0
  15. package/dist/templates/commands/reap.objective.md +171 -0
  16. package/dist/templates/commands/reap.planning.md +88 -0
  17. package/dist/templates/commands/reap.start.md +44 -0
  18. package/dist/templates/commands/reap.status.md +70 -0
  19. package/dist/templates/commands/reap.sync.md +95 -0
  20. package/dist/templates/commands/reap.validation.md +85 -0
  21. package/dist/templates/genome/constraints.md +38 -0
  22. package/dist/templates/genome/conventions.md +35 -0
  23. package/dist/templates/genome/domain/README.md +96 -0
  24. package/dist/templates/genome/principles.md +31 -0
  25. package/dist/templates/help/en.txt +32 -0
  26. package/dist/templates/help/ko.txt +32 -0
  27. package/dist/templates/hooks/reap-guide.md +188 -0
  28. package/dist/templates/hooks/session-start.sh +163 -0
  29. package/dist/templates/presets/bun-hono-react/constraints.md +28 -0
  30. package/dist/templates/presets/bun-hono-react/conventions.md +28 -0
  31. package/dist/templates/presets/bun-hono-react/principles.md +28 -0
  32. package/package.json +45 -0
@@ -0,0 +1,29 @@
1
+ # Objective
2
+
3
+ ## Goal
4
+
5
+
6
+ ## Completion Criteria
7
+
8
+
9
+ ## Requirements
10
+
11
+ ### Functional Requirements
12
+
13
+
14
+ ### Non-Functional Requirements
15
+
16
+
17
+ ## Scope
18
+ - **Related Genome Areas**:
19
+ - **Expected Change Scope**:
20
+ - **Exclusions**:
21
+
22
+ ## Genome Reference
23
+
24
+
25
+ ## Backlog (Genome Modifications Discovered)
26
+ None
27
+
28
+ ## Background
29
+
@@ -0,0 +1,14 @@
1
+ # Planning
2
+
3
+ ## Summary
4
+
5
+
6
+ ## Technical Context
7
+ - **Tech Stack**:
8
+ - **Constraints**:
9
+
10
+ ## Tasks
11
+
12
+
13
+ ## Dependencies
14
+
@@ -0,0 +1,19 @@
1
+ # Implementation Log
2
+
3
+ ## Completed Tasks
4
+ | Task | Description | Completed |
5
+ |------|-------------|-----------|
6
+ | | | |
7
+
8
+ ## Deferred Tasks
9
+ | Task | Description | Reason | Related Backlog |
10
+ |------|-------------|--------|-----------------|
11
+ | | | | |
12
+
13
+ ## Genome-Change Backlog Items
14
+ | Backlog File | Target | Description |
15
+ |-------------|--------|-------------|
16
+ | | | |
17
+
18
+ ## Implementation Notes
19
+ [Notable items, decisions made, and reference material from implementation]
@@ -0,0 +1,20 @@
1
+ # Validation Report
2
+
3
+ ## Result: pending
4
+
5
+ ## Completion Criteria Check
6
+ | Criterion | Result | Notes |
7
+ |-----------|--------|-------|
8
+
9
+ ## Test Results
10
+
11
+
12
+ ## Deferred Items
13
+
14
+
15
+ ## Minor Fixes (Fixed Directly in This Stage)
16
+ | File | Change | Reason |
17
+ |------|--------|--------|
18
+
19
+ ## Issues Discovered
20
+
@@ -0,0 +1,47 @@
1
+ # Completion
2
+
3
+ ## Summary
4
+ - **Goal**:
5
+ - **Period**: [startedAt] ~ [completedAt]
6
+ - **Genome Version**: v[N] → v[N+1]
7
+ - **Result**: [pass/partial/fail from validation]
8
+ - **Key Changes**:
9
+
10
+ ## Retrospective
11
+
12
+ ### Lessons Learned
13
+ #### What Went Well
14
+
15
+
16
+ #### Areas for Improvement
17
+
18
+
19
+ ### Genome Change Proposals
20
+ | Target File | Change Description | Reason |
21
+ |-------------|-------------------|--------|
22
+
23
+ ### Deferred Task Handoff
24
+ | Task | Description | Related Backlog | Backlog File |
25
+ |------|-------------|-----------------|-------------|
26
+
27
+ ### Next Generation Backlog
28
+
29
+
30
+ ---
31
+
32
+ ## Genome Changelog
33
+
34
+ ### Genome-Change Backlog Applied
35
+ | Backlog File | Target | Change Description | Applied |
36
+ |-------------|--------|-------------------|---------|
37
+
38
+ ### Retrospective Proposals Applied
39
+ | Target File | Change Description | Applied |
40
+ |-------------|-------------------|---------|
41
+
42
+ ### Genome Version
43
+ - Before:
44
+ - After:
45
+
46
+ ### Modified Genome Files
47
+
@@ -0,0 +1,54 @@
1
+ ---
2
+ description: "REAP Back — Return to a previous lifecycle stage"
3
+ ---
4
+
5
+ # Return to Previous Stage
6
+
7
+ ## Gate (Preconditions)
8
+ - Read `.reap/life/current.yml`
9
+ - If no active Generation: ERROR — "No active Generation." **STOP**
10
+ - If current stage is `objective` (first stage): ERROR — "Already at the first stage. Cannot go back." **STOP**
11
+
12
+ ## Steps
13
+
14
+ 1. Determine target stage:
15
+ - `/reap.back` alone: go to the immediately previous stage
16
+ - `/reap.back [stage]`: go directly to the specified stage
17
+ - Stage order: objective → planning → implementation → validation → completion
18
+ - Only backward transitions are allowed
19
+ 2. Ask the human for the reason for regression
20
+ 3. Collect regression reason and reference info:
21
+ - **reason**: why we are going back
22
+ - **refs**: related files/locations (artifact sections, source code locations)
23
+ 4. Modify `current.yml`:
24
+ - Change `stage` to the target stage
25
+ - Add a regression entry to `timeline`:
26
+ ```yaml
27
+ - stage: [target stage]
28
+ at: [current ISO 8601]
29
+ from: [original stage]
30
+ reason: [regression reason]
31
+ refs:
32
+ - [ref 1]
33
+ - [ref 2]
34
+ ```
35
+ 5. Artifact handling:
36
+ - **Before the target stage**: preserve
37
+ - **Target stage**: overwrite on re-entry (implementation only: append)
38
+ - **After the target stage**: preserve, overwrite on re-entry
39
+ 6. Record the regression reason at the top of the target stage artifact as a `## Regression` section:
40
+ ```markdown
41
+ ## Regression
42
+ - **From**: [original stage]
43
+ - **Reason**: [regression reason]
44
+ - **Refs**: [reference list]
45
+ - **Affected**: [affected subsequent artifacts]
46
+ ```
47
+
48
+ ### Hook Execution
49
+ 7. Read `.reap/config.yml` — if `hooks.onRegression` is defined, execute each hook in order:
50
+ - If hook has `command`: run the shell command
51
+ - If hook has `prompt`: follow the prompt instructions (AI agent executes the described task)
52
+
53
+ ## Completion
54
+ - "Returned to [stage] stage. Proceed with `/reap.[stage]`."
@@ -0,0 +1,96 @@
1
+ ---
2
+ description: "REAP Completion — Retrospect, evolve the Genome, and finalize the Generation"
3
+ ---
4
+
5
+ # Completion
6
+
7
+ <HARD-GATE>
8
+ Do NOT apply Genome changes without human confirmation — UNLESS called from `/reap.evolve` (Autonomous Override active).
9
+ Do NOT finalize Genome changes without running Validation Commands.
10
+ </HARD-GATE>
11
+
12
+ ## Gate (Preconditions)
13
+ - Read `.reap/life/current.yml` and verify that stage is `completion`
14
+ - Verify that `.reap/life/04-validation.md` exists
15
+ - If not met: ERROR — state the reason and **STOP**
16
+
17
+ ## Context (Generation Info)
18
+ - Read `.reap/life/current.yml` for the current generation info (id, goal, genomeVersion)
19
+
20
+ ## Steps
21
+
22
+ ### Phase 0: Summary
23
+
24
+ 1. Fill the `## Summary` section of `05-completion.md` using data from `current.yml` and `04-validation.md`:
25
+ - **Goal**: from `current.yml` goal
26
+ - **Period**: from `current.yml` startedAt ~ completedAt
27
+ - **Genome Version**: from `current.yml` genomeVersion (v[N] → v[N+1])
28
+ - **Result**: from `04-validation.md` result (pass/partial/fail)
29
+ - **Key Changes**: brief one-line summary of what was delivered
30
+
31
+ ### Phase 1: Retrospective
32
+
33
+ 2. Read all `type: genome-change` and `type: environment-change` items from `.reap/life/backlog/`
34
+ 3. Read the deferred task list from `.reap/life/03-implementation.md`
35
+ 4. Compile lessons learned from this generation
36
+ - **Limit**: Maximum 5 lessons. Keep only the most impactful ones.
37
+ 5. Compile genome changes to apply (which genome file to modify and how)
38
+
39
+ ### Phase 2: Garbage Collection (Codebase Health)
40
+
41
+ 6. Referencing the Enforced Rules in `.reap/genome/conventions.md`, check codebase consistency:
42
+ - Check whether new convention violations have been introduced
43
+ - Identify technical debt incurred during implementation
44
+ 7. For each piece of technical debt found, add it to `.reap/life/backlog/`:
45
+ ```markdown
46
+ ---
47
+ type: task
48
+ status: pending
49
+ ---
50
+ # [Title]
51
+ [Description]
52
+ ```
53
+
54
+ ### Phase 3: Backlog Cleanup
55
+
56
+ 8. Add deferred tasks to `.reap/life/backlog/` as `type: task`
57
+ 9. Also add other next-generation goal candidates to the backlog
58
+ 10. Finalize the retrospective with the human
59
+
60
+ ### Phase 4: Genome Application
61
+
62
+ 11. Read `type: genome-change` and `type: environment-change` items from `.reap/life/backlog/`
63
+ 12. Apply genome-change items to the corresponding files in `.reap/genome/`:
64
+ - **Map principle**: Each genome file should be **~100 lines or less**
65
+ - If exceeding 100 lines, extract into files under `domain/`
66
+ - **When writing domain/ files, follow the guide in `~/.reap/templates/domain-guide.md`**
67
+ 13. Apply environment-change items to the corresponding files in `.reap/environment/`
68
+ 14. **Verify**: Run the Validation Commands from constraints.md to confirm genome changes do not conflict with existing code
69
+ 15. **Human confirmation**:
70
+ - **If called from `/reap.evolve`** (Autonomous Override active): Apply genome changes automatically after Validation Commands pass. Do NOT pause for human confirmation.
71
+ - **If called standalone**: Show the modified genome/environment content to the human and get approval. Do NOT finalize changes until the human approves.
72
+ 16. For each applied `type: genome-change` and `type: environment-change` backlog item, update its frontmatter to `status: consumed` and add `consumedBy: gen-XXX`
73
+
74
+ ## Self-Verification
75
+ Before saving the artifact, verify:
76
+ - [ ] Are lessons concrete and applicable to the next generation? (No vague "do better next time")
77
+ - [ ] Have genome changes been confirmed by the human?
78
+ - [ ] Do Validation Commands still pass after the changes?
79
+ - [ ] Have deferred tasks been added to the backlog?
80
+
81
+ ❌ Bad lesson: "We should write more tests"
82
+ ✅ Good lesson: "SSE streaming responses are difficult to unit test, so prioritize integration tests"
83
+
84
+ ## Artifact Generation (Progressive Recording)
85
+ - **Language**: Write all artifact content in the user's configured language (see REAP Guide § Language).
86
+ - **Immediately upon entering this stage**: Read `~/.reap/templates/05-completion.md` and create `.reap/life/05-completion.md` with empty sections ready to fill
87
+ - **Update incrementally as each phase completes**:
88
+ - After Phase 1 (Retrospective) → fill in Lessons Learned, Genome Change Proposals
89
+ - After Phase 2 (Garbage Collection) → update with any tech debt findings
90
+ - After Phase 3 (Backlog Cleanup) → fill in Deferred Task Handoff, Next Generation Backlog
91
+ - After Phase 4 (Genome Application) → fill in Genome Changelog sections
92
+ - The artifact should reflect the current state of completion work at all times
93
+
94
+ ## Completion
95
+ - **If called from `/reap.evolve`** (Autonomous Override active): Proceed automatically to `/reap.next`.
96
+ - **If called standalone**: "Finalize the generation with `/reap.next`. Lineage archiving will be performed automatically."
@@ -0,0 +1,48 @@
1
+ ---
2
+ description: "REAP Evolve — Run the full lifecycle for a Generation"
3
+ ---
4
+
5
+ # Evolve (Full Lifecycle)
6
+
7
+ Run the entire Generation lifecycle from start to finish, interactively with the human.
8
+
9
+ <HARD-GATE>
10
+ NEVER modify `current.yml` directly to change the stage. ALWAYS use `/reap.next` to advance and `/reap.back` to regress.
11
+ Direct modification skips artifact creation and breaks the lifecycle. This is non-negotiable.
12
+ </HARD-GATE>
13
+
14
+ ## Gate (Preconditions)
15
+ - Read `.reap/life/current.yml`
16
+ - If no active Generation exists: run `/reap.start` first to create one
17
+ - If an active Generation exists: resume from the current stage
18
+
19
+ ## Autonomous Override
20
+ When `/reap.evolve` calls each stage command, the following overrides apply:
21
+ - **Skip routine human confirmations**: Do NOT pause to show artifacts and ask for approval at the end of each stage. Proceed autonomously.
22
+ - **Skip environment/genome interactive setup questions**: Use existing data, fill in what you can, skip what's empty.
23
+ - **STOP only when genuinely blocked**: ambiguous goal with multiple valid interpretations, uncertain technical decision with significant trade-offs, conflicts in the genome, or unexpected errors.
24
+ - **Escalation sections still apply**: If a stage's Escalation rules trigger, STOP and ask.
25
+ - This override does NOT apply when stages are invoked standalone (e.g., user runs `/reap.objective` directly).
26
+
27
+ ## Lifecycle Loop
28
+
29
+ Execute the following loop until the generation is complete:
30
+
31
+ 1. Read `current.yml` to determine the current stage
32
+ 2. Execute the corresponding stage command:
33
+ - `objective` → `/reap.objective`
34
+ - `planning` → `/reap.planning`
35
+ - `implementation` → `/reap.implementation`
36
+ - `validation` → `/reap.validation`
37
+ - `completion` → `/reap.completion`
38
+ 3. When the stage command completes, run `/reap.next` to advance
39
+ 4. If `/reap.next` archives the generation (from completion), the loop ends
40
+ 5. Otherwise, return to step 1
41
+
42
+ ## Handling Issues
43
+ - If validation fails: `/reap.back` to return to implementation (or earlier), then resume the loop
44
+ - If the human wants to pause: stop the loop, the generation state is preserved in `current.yml`
45
+ - If the human wants to skip a stage: advance with `/reap.next` without running the stage command
46
+
47
+ ## Completion
48
+ - "Generation [id] completed. All artifacts archived to lineage."
@@ -0,0 +1,61 @@
1
+ ---
2
+ description: "REAP Help — Contextual help based on current state"
3
+ ---
4
+
5
+ # Help
6
+
7
+ Provide contextual help to the user based on the current REAP state.
8
+
9
+ ## Steps
10
+
11
+ ### 1. Read Current State
12
+ - Read `.reap/life/current.yml`
13
+ - Read `.reap/config.yml` for strict mode status
14
+
15
+ ### 2. Contextual Guidance
16
+
17
+ **If no active Generation:**
18
+ - "No active Generation. To get started:"
19
+ - " `/reap.start` — Start a new Generation with a goal"
20
+ - " `/reap.evolve` — Start and run the full lifecycle autonomously"
21
+ - If there are items in `.reap/life/backlog/`, mention them
22
+
23
+ **If active Generation exists:**
24
+ - Show current generation ID, goal, and stage
25
+ - Show the next action: "Current stage is [stage]. Run `/reap.[stage]` to proceed, or `/reap.next` to advance."
26
+ - If in implementation stage with strict mode, note the planning scope restriction
27
+
28
+ ### 3. Command Reference
29
+
30
+ Show available slash commands with brief descriptions:
31
+
32
+ | Command | Description |
33
+ |---------|-------------|
34
+ | `/reap.start` | Start a new Generation |
35
+ | `/reap.evolve` | Run the full lifecycle autonomously |
36
+ | `/reap.objective` | Define goal + requirements |
37
+ | `/reap.planning` | Task decomposition + plan |
38
+ | `/reap.implementation` | Code implementation |
39
+ | `/reap.validation` | Run tests + verify |
40
+ | `/reap.completion` | Retrospective + genome updates |
41
+ | `/reap.next` | Advance to the next stage |
42
+ | `/reap.back` | Return to a previous stage |
43
+ | `/reap.status` | Show current state |
44
+ | `/reap.sync` | Synchronize Genome with source code |
45
+ | `/reap.help` | This help |
46
+
47
+ ### 4. Topic Help (Optional)
48
+
49
+ If the user provides a topic (e.g., `/reap.help workflow`), provide deeper explanation:
50
+
51
+ - **workflow** — Explain the 5-stage lifecycle in detail
52
+ - **commands** — Explain each slash command with examples
53
+ - **strict** — Explain strict mode, how to enable/disable, and escape hatch
54
+ - **genome** — Explain genome structure, immutability principle, and how to modify
55
+ - **backlog** — Explain backlog types, status management, and archiving rules
56
+
57
+ ### 5. Configuration Info
58
+
59
+ - Show strict mode status (enabled/disabled)
60
+ - Show project name and entry mode
61
+ - Show total completed generations
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: "REAP Implementation — Implement code through AI+Human collaboration"
3
+ ---
4
+
5
+ # Implementation
6
+
7
+ <HARD-GATE>
8
+ Do NOT write code without the task list from 02-planning.md.
9
+ Do NOT write code that violates the Genome (conventions.md, constraints.md).
10
+ Do NOT modify the Genome directly — if you discover an issue, record it in the backlog.
11
+ Do NOT modify the Environment directly — if you discover a change, record it in the backlog.
12
+ </HARD-GATE>
13
+
14
+ ## Gate (Preconditions)
15
+ - Read `.reap/life/current.yml` and verify that stage is `implementation`
16
+ - Verify that `.reap/life/02-planning.md` exists
17
+ - Check git working tree status (`git status`)
18
+ - If there are uncommitted changes that overlap with files this generation will modify:
19
+ - Ask the user: "There are uncommitted changes. Would you like to commit them before proceeding? (yes/no/show diff)"
20
+ - If yes: help the user commit the changes, then proceed
21
+ - If no: proceed with caution, noting the existing changes
22
+ - If show diff: show the diff, then ask again
23
+ - If there are uncommitted changes in unrelated files: proceed normally
24
+ - If the working tree is clean: proceed normally
25
+ - If not met: ERROR — state the reason and **STOP**
26
+
27
+ ## Context (Generation Info)
28
+ - Read `.reap/life/current.yml` for the current generation info (id, goal, genomeVersion)
29
+ - Read `.reap/genome/conventions.md` — rules to reference continuously during implementation
30
+ - Read `.reap/genome/constraints.md` — technical constraints
31
+
32
+ ## Re-entry Check
33
+ - If `.reap/life/03-implementation.md` already exists, this is a **re-entry due to regression**
34
+ - Read the existing log; if a `## Regression` section exists, understand the regression reason
35
+ - On regression re-entry, **append** to the existing log (preserve existing completion records)
36
+
37
+ ## Steps
38
+
39
+ ### 1. Load Task List
40
+ - Read the task list from `.reap/life/02-planning.md`
41
+ - If `03-implementation.md` already exists, read it (preserve existing records)
42
+ - Identify incomplete (`[ ]`) tasks
43
+
44
+ ### 2. Sequential Implementation
45
+ - Implement starting from the first incomplete task, in order
46
+ - **After EACH task completion**, immediately add it to the Completed Tasks table in `03-implementation.md`
47
+ - **After EACH deferred task decision**, immediately add it to the Deferred Tasks table
48
+ - **After EACH genome issue discovery**, immediately add it to the Genome-Change Backlog Items table
49
+ - Do NOT batch-write the log at the end. Update it as you go.
50
+ - **Strictly** follow the rules in conventions.md
51
+ - **Strictly** follow the technical constraints in constraints.md
52
+
53
+ ### 3. When Genome/Environment Changes Are Discovered
54
+ - If you discover something that must be implemented differently from the spec:
55
+ a. Record it in `.reap/life/backlog/`:
56
+ ```markdown
57
+ ---
58
+ type: genome-change
59
+ status: pending
60
+ target: genome/[relevant file]
61
+ ---
62
+ # [Title]
63
+ [What is different and how it should be changed]
64
+ ```
65
+ b. Mark tasks that depend on this change as `[deferred]` in `02-planning.md`
66
+ c. Record the reason for deferral
67
+ - **Do NOT modify Genome or Environment files directly. This is non-negotiable.**
68
+
69
+ ### 3b. When Out-of-Scope Issues Are Discovered
70
+ - If you discover issues outside the current generation's scope (outdated tests, tech debt, broken code unrelated to current tasks, etc.):
71
+ a. Record it in `.reap/life/backlog/`:
72
+ ```markdown
73
+ ---
74
+ type: task
75
+ status: pending
76
+ ---
77
+ # [Title]
78
+ [Description of the issue and what needs to be done]
79
+ ```
80
+ b. Do NOT fix it in the current generation unless the human explicitly approves
81
+ c. Record it in `03-implementation.md` under "Genome-Change Backlog Items" or "Implementation Notes"
82
+
83
+ ### 4. Completion Marking
84
+ - Mark completed tasks as `[x]` in `02-planning.md`
85
+
86
+ ## Escalation
87
+ In the following situations, **STOP and ask the human**:
88
+ - When task requirements are unclear
89
+ - When an architectural decision is needed but not covered in the plan
90
+ - When a conflict arises with existing code
91
+ - When the scope turns out to be significantly larger than expected
92
+
93
+ ## Artifact Generation (Progressive Recording)
94
+ - **Language**: Write all artifact content in the user's configured language (see REAP Guide § Language).
95
+ - **Immediately upon entering this stage**: Read `~/.reap/templates/03-implementation.md` and create `.reap/life/03-implementation.md` with empty tables ready to fill (or preserve existing content on re-entry)
96
+ - **Update continuously during Step 2**: After each task, deferral, or discovery, update the artifact immediately
97
+ - By the time all tasks are done, the artifact should already be complete — no separate "generation" step is needed
98
+ - Add Implementation Notes at the end summarizing notable decisions
99
+
100
+ ## Completion
101
+ - "Proceed to the Validation stage with `/reap.next`."
102
+ - "If issues are found during Validation, you can return with `/reap.back`."
@@ -0,0 +1,53 @@
1
+ ---
2
+ description: "REAP Next — Advance to the next lifecycle stage"
3
+ ---
4
+
5
+ # Next Stage
6
+
7
+ ## Gate (Preconditions)
8
+ - Read `.reap/life/current.yml`
9
+ - If no active Generation: ERROR — "No active Generation. Run `/reap.start` first." **STOP**
10
+
11
+ ## Steps
12
+
13
+ ### Stage Transition
14
+ - Stage order: objective → planning → implementation → validation → completion
15
+ - Update the `stage` in `current.yml` to the next stage
16
+ - Add an entry to `timeline`:
17
+ ```yaml
18
+ - stage: [next stage]
19
+ at: [current ISO 8601]
20
+ ```
21
+ - Immediately create the next stage's artifact file from template (empty, ready to fill)
22
+
23
+ ### Hook Execution (Stage Transition)
24
+ - Read `.reap/config.yml` — if `hooks.onStageTransition` is defined, execute each hook in order:
25
+ - If hook has `command`: run the shell command
26
+ - If hook has `prompt`: follow the prompt instructions (AI agent executes the described task)
27
+
28
+ ### When Advancing from Completion (Archiving)
29
+ - Add the current timestamp to `completedAt` in `current.yml`
30
+ - Move artifact files (`01-*.md` through `05-*.md`) from `.reap/life/` to `.reap/lineage/[gen-id]-[goal-slug]/`
31
+ - Goal slug: lowercase, non-alphanumeric/hangul replaced with `-`, max 30 chars
32
+ - Process backlog files from `.reap/life/backlog/`:
33
+ - Create `.reap/lineage/[gen-id]-[goal-slug]/backlog/` directory
34
+ - Files with `status: consumed` → move to `.reap/lineage/[gen-id]-[goal-slug]/backlog/`
35
+ - Files with `status: pending` or no status field → copy to `.reap/lineage/[gen-id]-[goal-slug]/backlog/` for record, then carry over to new `.reap/life/backlog/`
36
+ - Clear `current.yml` (write empty content)
37
+ - Recreate `.reap/life/backlog/` directory (with carried-over pending items already in place)
38
+ - **Commit all changes** (code + `.reap/` artifacts together):
39
+ - Stage all changed files: code changes from this generation + `.reap/` directory
40
+ - Commit message format: `feat(gen-NNN): [generation goal summary]`
41
+ - Use `feat` for feature generations, `fix` for bugfix generations, `chore` for maintenance
42
+ - Include both code and REAP artifacts in the same commit
43
+ - If there are no code changes (REAP-only generation), use `chore(reap): [goal summary]`
44
+
45
+ ### Hook Execution (Generation Complete)
46
+ - Read `.reap/config.yml` — if `hooks.onGenerationComplete` is defined, execute each hook in order:
47
+ - If hook has `command`: run the shell command
48
+ - If hook has `prompt`: follow the prompt instructions (AI agent executes the described task)
49
+ - Note: hooks run AFTER the commit, so any changes from hooks will be uncommitted
50
+
51
+ ## Completion
52
+ - If archived: "Generation [id] complete and archived. Run `/reap.start` to begin a new generation."
53
+ - Otherwise: "Advanced to [next stage]. Proceed with `/reap.[next stage]`."