@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
package/README.ko.md ADDED
@@ -0,0 +1,309 @@
1
+ <p align="center">
2
+ <img src="media/logo.png" alt="REAP" width="80" height="80" />
3
+ </p>
4
+
5
+ <h1 align="center">REAP</h1>
6
+
7
+ <p align="center">
8
+ <strong>Recursive Evolutionary Autonomous Pipeline</strong><br>
9
+ AI와 인간이 세대(Generation)를 거듭하며 소프트웨어를 진화시키는 개발 파이프라인.
10
+ </p>
11
+
12
+ > For English version, see [README.md](README.md).
13
+
14
+ ```
15
+ Genome (설계와 지식) → Evolution (세대를 거친 진화) → Civilization (Source Code)
16
+ ```
17
+
18
+ REAP은 Application의 유전 정보(Genome)를 정의하고, 각 세대에서 목표를 설정하여 구현하고, 그 과정에서 발견한 Genome 결함을 다음 단계에서 반영합니다. 세대를 거듭하며 Genome이 진화하고, Source Code(Civilization)가 성장합니다.
19
+
20
+ ## Why REAP?
21
+
22
+ AI 에이전트와 함께 개발할 때 이런 문제를 겪어본 적 있나요?
23
+
24
+ - **컨텍스트 유실** — 새 세션을 열면 에이전트가 프로젝트 맥락을 잊어버림
25
+ - **산발적 개발** — 명확한 목표 없이 여기저기 코드를 수정
26
+ - **설계와 코드의 괴리** — 문서는 따로, 코드는 따로 놀면서 점점 벌어짐
27
+ - **교훈의 망각** — 삽질한 경험이 다음 작업에 반영되지 않음
28
+
29
+ REAP은 **세대 기반 진화 모델**로 이 문제들을 해결합니다:
30
+
31
+ - 매 세대마다 하나의 목표에 집중 (Objective → Completion)
32
+ - AI 에이전트가 매 세션 시작 시 현재 맥락을 자동으로 인식 (SessionStart Hook)
33
+ - 구현 중 발견한 설계 문제는 backlog에 기록, Completion에서 반영
34
+ - 회고(Completion)에서 도출한 교훈이 Genome에 축적
35
+
36
+ ## 설치
37
+
38
+ ```bash
39
+ # npm
40
+ npm install -g @c-d-cc/reap
41
+
42
+ # 또는 Bun
43
+ bun install -g @c-d-cc/reap
44
+ ```
45
+
46
+ > **요구사항**: [Bun](https://bun.sh) 런타임, [Claude Code](https://claude.ai/claude-code) CLI
47
+
48
+ ## 빠른 시작
49
+
50
+ ```bash
51
+ # 1. 프로젝트 초기화
52
+
53
+ # 새 프로젝트
54
+ reap init my-project
55
+
56
+ # 기존 프로젝트
57
+ cd my-project
58
+ reap init
59
+
60
+ # 2. Claude Code에서 한 Generation 전체 실행
61
+ claude
62
+ > /reap.evolve "사용자 인증 구현"
63
+ ```
64
+
65
+ `/reap.evolve`는 한 세대의 전체 lifecycle을 — Objective부터 Completion까지 — 사용자와 대화하며 자동으로 실행합니다. Generation 생성, 각 stage 실행, stage 간 전진을 모두 처리합니다. 일상적인 개발에서 가장 많이 사용하는 핵심 명령어입니다.
66
+
67
+ 더 세밀한 제어가 필요하면 각 stage를 수동으로 진행할 수도 있습니다:
68
+
69
+ ```bash
70
+ > /reap.start # 새 Generation 시작
71
+ > /reap.objective # 목표 + 명세 정의
72
+ > /reap.next # 다음 단계로 전진
73
+ > /reap.planning # 구현 계획
74
+ > /reap.next
75
+ > /reap.implementation # AI+Human 협업 코드 구현
76
+ > ...
77
+ ```
78
+
79
+ ## 생애주기 (Life Cycle)
80
+
81
+ 한 세대(Generation)는 5단계의 생애주기를 거칩니다:
82
+
83
+ ```
84
+ Objective → Planning → Implementation ⟷ Validation → Completion
85
+ (목표 정의) (계획) (구현) (검증) (완성)
86
+ ```
87
+
88
+ | 단계 | 하는 일 | 산출물 |
89
+ |------|---------|--------|
90
+ | **Objective** | 목표 + 요구사항 + 수용기준 정의 | `01-objective.md` |
91
+ | **Planning** | 태스크 분해, 구현 접근법, 의존관계 | `02-planning.md` |
92
+ | **Implementation** | AI+Human 협업으로 코드 구현 | `03-implementation.md` |
93
+ | **Validation** | 테스트 실행, 완료 조건 점검 | `04-validation.md` |
94
+ | **Completion** | 회고 + Genome 변경 반영 + 아카이빙 | `05-completion.md` |
95
+
96
+ ## 핵심 개념
97
+
98
+ ### Genome
99
+
100
+ Application의 유전 정보 — 아키텍처 원칙, 비즈니스 규칙, 개발 컨벤션, 기술 제약의 집합.
101
+
102
+ ```
103
+ .reap/genome/
104
+ ├── principles.md # 아키텍처 원칙/결정
105
+ ├── domain/ # 비즈니스 규칙 (모듈별)
106
+ ├── conventions.md # 개발 규칙/컨벤션
107
+ └── constraints.md # 기술 제약/선택
108
+ ```
109
+
110
+ **Genome 불변 원칙**: 현재 세대에서는 Genome을 직접 수정하지 않습니다. 문제를 발견하면 backlog에 기록하고, Completion 단계에서만 반영합니다.
111
+
112
+ **Environment 불변 원칙**: 현재 세대에서는 Environment를 직접 수정하지 않습니다. 외부 환경 변화를 발견하면 backlog에 기록하고, Completion 단계에서 반영합니다.
113
+
114
+ ### Backlog
115
+
116
+ `.reap/life/backlog/`에 다음에 반영할 모든 항목을 저장합니다. 각 항목은 markdown + frontmatter 형식:
117
+
118
+ - `type: genome-change` — Completion에서 Genome에 반영
119
+ - `type: environment-change` — Completion에서 Environment에 반영
120
+ - `type: task` — 다음 Objective에서 goal 후보 (deferred 태스크, 기술 부채 등)
121
+
122
+ 각 항목은 `status` 필드도 가집니다:
123
+
124
+ - `status: pending` — 미처리 항목 (기본값)
125
+ - `status: consumed` — 현재 세대에서 처리 완료 (`consumedBy: gen-XXX` 필수)
126
+
127
+ 아카이빙 시점(`/reap.next` from Completion)에 `consumed` 항목은 lineage로 이동하고, `pending` 항목은 다음 세대 backlog로 이월됩니다.
128
+
129
+ **부분 완료는 정상** — Genome 변경에 의존하는 태스크는 `[deferred]`로 마킹하고 다음 세대로 인계합니다.
130
+
131
+ ### 4축 구조
132
+
133
+ ```
134
+ .reap/
135
+ ├── genome/ # 유전 정보 (세대를 거치며 진화)
136
+ ├── environment/ # 외부 환경 (API 문서, 인프라, 비즈니스 제약)
137
+ ├── life/ # 현재 세대의 상태와 산출물
138
+ └── lineage/ # 완료된 세대들의 아카이브
139
+ ```
140
+
141
+ ## CLI 명령어
142
+
143
+ | 명령어 | 설명 |
144
+ |--------|------|
145
+ | `reap init <name>` | 프로젝트 초기화. `.reap/` 구조 생성 |
146
+ | `reap status` | 현재 Generation 상태 확인 |
147
+ | `reap update` | 커맨드/템플릿/훅을 최신 버전으로 동기화 |
148
+ | `reap fix` | `.reap/` 구조 진단 및 복구 |
149
+ | `reap help` | CLI 명령어 + 슬래시 커맨드 + 워크플로우 요약 출력 |
150
+
151
+ ### 옵션
152
+
153
+ ```bash
154
+ reap init my-project --mode adoption # 기존 프로젝트에 REAP 적용
155
+ reap init my-project --preset bun-hono-react # 프리셋으로 Genome 초기화
156
+ reap update --dry-run # 변경사항 미리보기
157
+ ```
158
+
159
+ ## Claude Code 연동
160
+
161
+ REAP은 Claude Code의 두 가지 메커니즘으로 AI 에이전트와 통합됩니다:
162
+
163
+ ### Slash Commands
164
+
165
+ Slash command가 `.claude/commands/`에 설치되어 전체 워크플로우를 구동합니다:
166
+
167
+ | 명령어 | 설명 |
168
+ |--------|------|
169
+ | `/reap.start` | 새 Generation 시작 |
170
+ | `/reap.objective` | 목표 + 요구사항 정의 |
171
+ | `/reap.planning` | 태스크 분해 + 구현 계획 |
172
+ | `/reap.implementation` | AI+Human 협업 코드 구현 |
173
+ | `/reap.validation` | 테스트 실행, 완료 조건 점검 |
174
+ | `/reap.completion` | 회고 + Genome 변경 반영 |
175
+ | `/reap.next` | 다음 Life Cycle stage로 전진 |
176
+ | `/reap.back` | 이전 stage로 복귀 (micro loop) |
177
+ | `/reap.status` | 현재 Generation 상태 및 프로젝트 건강 상태 표시 |
178
+ | `/reap.sync` | 소스 코드 기반 Genome 최신화 |
179
+ | `/reap.help` | 현재 상태에 따른 contextual AI 도움말 (topic: workflow, commands, strict, genome, backlog) |
180
+ | **`/reap.evolve`** | **한 Generation 전체를 처음부터 끝까지 실행 (권장)** |
181
+
182
+ ### SessionStart Hook
183
+
184
+ 매 세션 시작 시 자동으로 실행되어 AI 에이전트에게 다음을 주입합니다:
185
+
186
+ - REAP 워크플로우 전체 가이드 (Genome, Life Cycle, 4축 구조 등)
187
+ - 현재 Generation 상태 (어떤 stage인지, 다음에 뭘 해야 하는지)
188
+ - REAP lifecycle을 따르라는 규칙
189
+
190
+ 이를 통해 새 세션을 열어도 에이전트가 프로젝트 맥락을 즉시 파악합니다.
191
+
192
+ ### Strict 모드
193
+
194
+ `.reap/config.yml`에 `strict: true`를 설정하면 AI 에이전트가 REAP 워크플로우 외부에서 코드를 수정하는 것을 제한합니다:
195
+
196
+ ```yaml
197
+ # .reap/config.yml
198
+ strict: true # 기본값: false
199
+ ```
200
+
201
+ | 상황 | 동작 |
202
+ |------|------|
203
+ | 활성 Generation 없음 / 구현 단계 외 | 코드 수정 완전 차단 |
204
+ | Implementation 단계 | `02-planning.md` 범위 내에서만 수정 허용 |
205
+ | Escape hatch | 사용자가 "override", "bypass strict" 등 명시적 요청 시 허용 |
206
+
207
+ Strict 모드는 기본적으로 비활성화되어 있습니다 (`strict: false`).
208
+
209
+ ### REAP Hooks
210
+
211
+ `.reap/config.yml`에 hook을 정의하여 lifecycle 이벤트에 명령 또는 AI 프롬프트를 실행할 수 있습니다:
212
+
213
+ ```yaml
214
+ hooks:
215
+ onGenerationStart:
216
+ - command: "echo 'Generation started'"
217
+ onStageTransition:
218
+ - command: "echo 'Stage changed'"
219
+ onGenerationComplete:
220
+ - command: "reap update"
221
+ - prompt: "이번 Generation 변경사항을 README에 반영하라."
222
+ onRegression:
223
+ - command: "echo 'Regressed'"
224
+ ```
225
+
226
+ 각 hook은 `command` (shell 명령) 또는 `prompt` (AI 에이전트 지시) 중 하나를 사용합니다.
227
+
228
+ | 이벤트 | 트리거 |
229
+ |--------|--------|
230
+ | `onGenerationStart` | `/reap.start`로 새 Generation 생성 후 |
231
+ | `onStageTransition` | `/reap.next`로 다음 stage 전진 후 |
232
+ | `onGenerationComplete` | `/reap.next`로 완료된 Generation 아카이빙 후 |
233
+ | `onRegression` | `/reap.back`으로 이전 stage 복귀 후 |
234
+
235
+ Hook은 AI 에이전트가 프로젝트 루트 디렉토리에서 실행합니다.
236
+
237
+ ## `reap init` 후 프로젝트 구조
238
+
239
+ ```
240
+ my-project/
241
+ ├── src/ # Civilization (소스 코드)
242
+ └── .reap/
243
+ ├── config.yml # 프로젝트 설정
244
+ ├── genome/ # 유전 정보
245
+ │ ├── principles.md
246
+ │ ├── domain/
247
+ │ ├── conventions.md
248
+ │ └── constraints.md
249
+ ├── environment/ # 외부 환경
250
+ ├── life/ # 현재 세대
251
+ │ ├── current.yml
252
+ │ └── backlog/
253
+ └── lineage/ # 완료된 세대 아카이브
254
+
255
+ ~/.claude/ # 사용자 레벨 (reap init 시 설치)
256
+ ├── commands/ # Slash commands (/reap.*)
257
+ └── settings.json # SessionStart hook 등록
258
+ ```
259
+
260
+ ## 계보 압축 (Lineage Compression)
261
+
262
+ 세대가 쌓이면 lineage 디렉토리가 커집니다. REAP은 자동 2단계 압축으로 이를 관리합니다:
263
+
264
+ | 레벨 | 입력 | 출력 | 최대 줄 수 | 트리거 |
265
+ |------|------|------|-----------|--------|
266
+ | **Level 1** | 세대 폴더 (5개 산출물) | `gen-XXX.md` | 40줄 | lineage > 10,000줄 + 5세대 이상 |
267
+ | **Level 2** | Level 1 파일 5개 | `epoch-XXX.md` | 60줄 | Level 1이 5개 이상 |
268
+
269
+ 압축은 세대 완료 시 자동 실행됩니다. 압축된 파일은 목표(Objective)와 결과(Completion)를 중심으로 보존하고, 중간 과정은 특이사항만 남깁니다.
270
+
271
+ ## 진화 흐름 (Evolution Flow)
272
+
273
+ ```
274
+ Generation #1 (Genome v1)
275
+ → Objective: "사용자 인증 구현"
276
+ → Planning → Implementation
277
+ → Implementation 중 OAuth2 필요 발견 → backlog에 genome-change 기록
278
+ → Validation (partial)
279
+ → Completion → 회고 + genome 반영 → Genome v2 → 아카이빙
280
+
281
+ Generation #2 (Genome v2)
282
+ → Objective: "OAuth2 연동 + 권한 관리"
283
+ → 이전 세대의 deferred 태스크 + 새 목표
284
+ → ...
285
+ ```
286
+
287
+ ## 프리셋 (Presets)
288
+
289
+ `reap init --preset`으로 기술 스택에 맞는 Genome 초기 설정을 적용할 수 있습니다.
290
+
291
+ | 프리셋 | 스택 |
292
+ |--------|------|
293
+ | `bun-hono-react` | Bun + Hono + React |
294
+
295
+ ```bash
296
+ reap init my-project --preset bun-hono-react
297
+ ```
298
+
299
+ ## 진입 모드 (Entry Modes)
300
+
301
+ | 모드 | 설명 |
302
+ |------|------|
303
+ | `greenfield` | 새 프로젝트를 처음부터 구축 (기본값) |
304
+ | `migration` | 기존 시스템을 참조하여 새로 구축 |
305
+ | `adoption` | 기존 코드베이스에 REAP을 적용 |
306
+
307
+ ## 라이선스
308
+
309
+ MIT
package/README.md ADDED
@@ -0,0 +1,308 @@
1
+ <p align="center">
2
+ <img src="media/logo.png" alt="REAP" width="80" height="80" />
3
+ </p>
4
+
5
+ <h1 align="center">REAP</h1>
6
+
7
+ <p align="center">
8
+ <strong>Recursive Evolutionary Autonomous Pipeline</strong><br>
9
+ A development pipeline where AI and humans evolve software across generations.
10
+ </p>
11
+
12
+ > 한국어 버전은 [README.ko.md](README.ko.md)를 참조하세요.
13
+
14
+ ```
15
+ Genome (Design & Knowledge) → Evolution (Generational Progress) → Civilization (Source Code)
16
+ ```
17
+
18
+ REAP defines an application's genetic information (Genome), sets objectives for each generation to implement, and feeds back any Genome defects discovered along the way into subsequent stages. As generations accumulate, the Genome evolves and the Source Code (Civilization) grows.
19
+
20
+ ## Why REAP?
21
+
22
+ Have you ever run into these problems when developing with AI agents?
23
+
24
+ - **Context loss** — The agent forgets the project context every time you start a new session
25
+ - **Scattered development** — Code gets modified here and there with no clear goal
26
+ - **Design–code drift** — Documentation and code diverge over time
27
+ - **Forgotten lessons** — Hard-won insights from past struggles never carry forward
28
+
29
+ REAP solves these with a **generation-based evolution model**:
30
+
31
+ - Each generation focuses on a single objective (Objective → Completion)
32
+ - The AI agent automatically picks up current context at every session start (SessionStart Hook)
33
+ - Design issues discovered during implementation are logged in the backlog and addressed at Completion
34
+ - Lessons drawn from retrospectives (Completion) accumulate in the Genome
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ # npm
40
+ npm install -g @c-d-cc/reap
41
+
42
+ # or Bun
43
+ bun install -g @c-d-cc/reap
44
+ ```
45
+
46
+ > **Requirements**: [Bun](https://bun.sh) runtime, [Claude Code](https://claude.ai/claude-code) CLI
47
+
48
+ ## Quick Start
49
+
50
+ ```bash
51
+ # 1. Initialize the project
52
+
53
+ # New project
54
+ reap init my-project
55
+
56
+ # Existing project
57
+ cd my-project
58
+ reap init
59
+
60
+ # 2. Open Claude Code and run a full generation
61
+ claude
62
+ > /reap.evolve "Implement user authentication"
63
+ ```
64
+
65
+ `/reap.evolve` runs the entire generation lifecycle — from Objective through Completion — interactively with you. It automatically starts a generation, executes each stage in order, and advances between them. This is the primary command you'll use for day-to-day development.
66
+
67
+ You can also drive each stage manually if you need finer control:
68
+
69
+ ```bash
70
+ > /reap.start # Start a new generation
71
+ > /reap.objective # Define objective + spec
72
+ > /reap.next # Advance to the next stage
73
+ > /reap.planning # Create implementation plan
74
+ > /reap.next
75
+ > /reap.implementation # Build with AI + human collaboration
76
+ > ...
77
+ ```
78
+
79
+ ## Life Cycle
80
+
81
+ Each generation goes through a five-stage life cycle:
82
+
83
+ ```
84
+ Objective → Planning → Implementation ⟷ Validation → Completion
85
+ ```
86
+
87
+ | Stage | What happens | Artifact |
88
+ |-------|-------------|----------|
89
+ | **Objective** | Define goal, requirements, and acceptance criteria | `01-objective.md` |
90
+ | **Planning** | Break down tasks, choose approach, map dependencies | `02-planning.md` |
91
+ | **Implementation** | Build with AI + human collaboration | `03-implementation.md` |
92
+ | **Validation** | Run tests, verify completion criteria | `04-validation.md` |
93
+ | **Completion** | Retrospective + apply Genome changes + archive | `05-completion.md` |
94
+
95
+ ## Core Concepts
96
+
97
+ ### Genome
98
+
99
+ The application's genetic information — a collection of architecture principles, business rules, development conventions, and technical constraints.
100
+
101
+ ```
102
+ .reap/genome/
103
+ ├── principles.md # Architecture principles/decisions
104
+ ├── domain/ # Business rules (per module)
105
+ ├── conventions.md # Development rules/conventions
106
+ └── constraints.md # Technical constraints/choices
107
+ ```
108
+
109
+ **Genome Immutability Principle**: The Genome is never modified directly during the current generation. When an issue is found, it is recorded in the backlog and only applied at the Completion stage.
110
+
111
+ **Environment Immutability Principle**: The Environment is never modified directly during the current generation. External changes are recorded in the backlog and applied at the Completion stage.
112
+
113
+ ### Backlog
114
+
115
+ All items to be addressed next are stored in `.reap/life/backlog/`. Each item uses markdown + frontmatter format:
116
+
117
+ - `type: genome-change` — Applied to the Genome at Completion
118
+ - `type: environment-change` — Applied to the Environment at Completion
119
+ - `type: task` — Candidate goals for the next Objective (deferred tasks, tech debt, etc.)
120
+
121
+ Each item also carries a `status` field:
122
+
123
+ - `status: pending` — Not yet processed (default)
124
+ - `status: consumed` — Processed in the current generation (requires `consumedBy: gen-XXX`)
125
+
126
+ At archiving time (`/reap.next` from Completion), `consumed` items move to lineage while `pending` items are carried forward to the next generation's backlog.
127
+
128
+ **Partial completion is normal** — Tasks that depend on Genome changes are marked `[deferred]` and handed off to the next generation.
129
+
130
+ ### Four-Axis Structure
131
+
132
+ ```
133
+ .reap/
134
+ ├── genome/ # Genetic information (evolves across generations)
135
+ ├── environment/ # External context (API docs, infra, business constraints)
136
+ ├── life/ # Current generation's state and artifacts
137
+ └── lineage/ # Archive of completed generations
138
+ ```
139
+
140
+ ## CLI Commands
141
+
142
+ | Command | Description |
143
+ |---------|-------------|
144
+ | `reap init <name>` | Initialize project. Creates the `.reap/` structure |
145
+ | `reap status` | Check the current generation's status |
146
+ | `reap update` | Sync commands/templates/hooks to the latest version |
147
+ | `reap fix` | Diagnose and repair the `.reap/` structure |
148
+ | `reap help` | Print CLI commands, slash commands, and workflow summary |
149
+
150
+ ### Options
151
+
152
+ ```bash
153
+ reap init my-project --mode adoption # Apply REAP to an existing project
154
+ reap init my-project --preset bun-hono-react # Initialize Genome with a preset
155
+ reap update --dry-run # Preview changes before applying
156
+ ```
157
+
158
+ ## Claude Code Integration
159
+
160
+ REAP integrates with the AI agent through two Claude Code mechanisms:
161
+
162
+ ### Slash Commands
163
+
164
+ Slash commands are installed in `.claude/commands/` and drive the entire workflow:
165
+
166
+ | Command | Description |
167
+ |---------|-------------|
168
+ | `/reap.start` | Start a new generation |
169
+ | `/reap.objective` | Define goal + requirements |
170
+ | `/reap.planning` | Task decomposition + implementation plan |
171
+ | `/reap.implementation` | Code implementation with AI + human |
172
+ | `/reap.validation` | Run tests, verify completion criteria |
173
+ | `/reap.completion` | Retrospective + apply Genome changes |
174
+ | `/reap.next` | Advance to the next life cycle stage |
175
+ | `/reap.back` | Return to a previous stage (micro loop) |
176
+ | `/reap.status` | Show current generation state and project health |
177
+ | `/reap.sync` | Synchronize Genome with current source code |
178
+ | `/reap.help` | Contextual AI help based on current state (topic: workflow, commands, strict, genome, backlog) |
179
+ | **`/reap.evolve`** | **Run an entire generation from start to finish (recommended)** |
180
+
181
+ ### SessionStart Hook
182
+
183
+ Runs automatically at the start of every session, injecting the following into the AI agent:
184
+
185
+ - The full REAP workflow guide (Genome, Life Cycle, Four-Axis Structure, etc.)
186
+ - Current generation state (which stage you're in, what to do next)
187
+ - Rules to follow the REAP lifecycle
188
+
189
+ This ensures the agent immediately understands the project context even in a brand-new session.
190
+
191
+ ### Strict Mode
192
+
193
+ When `strict: true` is set in `.reap/config.yml`, the AI agent is restricted from modifying code outside the REAP workflow:
194
+
195
+ ```yaml
196
+ # .reap/config.yml
197
+ strict: true # default: false
198
+ ```
199
+
200
+ | Context | Behavior |
201
+ |---------|----------|
202
+ | No active generation / non-implementation stage | Code modifications are fully blocked |
203
+ | Implementation stage | Only modifications within the scope of `02-planning.md` are allowed |
204
+ | Escape hatch | User explicitly requests "override" or "bypass strict" to allow modifications |
205
+
206
+ Strict mode is disabled by default (`strict: false`).
207
+
208
+ ### REAP Hooks
209
+
210
+ Projects can define hooks in `.reap/config.yml` to run commands or AI prompts at lifecycle events:
211
+
212
+ ```yaml
213
+ hooks:
214
+ onGenerationStart:
215
+ - command: "echo 'Generation started'"
216
+ onStageTransition:
217
+ - command: "echo 'Stage changed'"
218
+ onGenerationComplete:
219
+ - command: "reap update"
220
+ - prompt: "Update README if this generation changed any features."
221
+ onRegression:
222
+ - command: "echo 'Regressed'"
223
+ ```
224
+
225
+ Each hook supports `command` (shell) or `prompt` (AI agent instruction).
226
+
227
+ | Event | Trigger |
228
+ |-------|---------|
229
+ | `onGenerationStart` | After `/reap.start` creates a new generation |
230
+ | `onStageTransition` | After `/reap.next` advances to the next stage |
231
+ | `onGenerationComplete` | After `/reap.next` archives a completed generation |
232
+ | `onRegression` | After `/reap.back` returns to a previous stage |
233
+
234
+ Hooks are executed by the AI agent in the project root directory.
235
+
236
+ ## Project Structure After `reap init`
237
+
238
+ ```
239
+ my-project/
240
+ ├── src/ # Civilization (your code)
241
+ └── .reap/
242
+ ├── config.yml # Project configuration
243
+ ├── genome/ # Genetic information
244
+ │ ├── principles.md
245
+ │ ├── domain/
246
+ │ ├── conventions.md
247
+ │ └── constraints.md
248
+ ├── environment/ # External context
249
+ ├── life/ # Current generation
250
+ │ ├── current.yml
251
+ │ └── backlog/
252
+ └── lineage/ # Completed generation archive
253
+
254
+ ~/.claude/ # User-level (installed by reap init)
255
+ ├── commands/ # Slash commands (/reap.*)
256
+ └── settings.json # SessionStart hook registration
257
+ ```
258
+
259
+ ## Lineage Compression
260
+
261
+ As generations accumulate, the lineage directory grows. REAP manages this with automatic two-level compression:
262
+
263
+ | Level | Input | Output | Max lines | Trigger |
264
+ |-------|-------|--------|-----------|---------|
265
+ | **Level 1** | Generation folder (5 artifacts) | `gen-XXX.md` | 40 lines | lineage > 10,000 lines + 5+ generations |
266
+ | **Level 2** | 5 Level 1 files | `epoch-XXX.md` | 60 lines | 5+ Level 1 files |
267
+
268
+ Compression runs automatically when a generation completes. Compressed files preserve objectives and completion results while retaining only notable findings from intermediate stages.
269
+
270
+ ## Evolution Flow
271
+
272
+ ```
273
+ Generation #1 (Genome v1)
274
+ → Objective: "Implement user authentication"
275
+ → Planning → Implementation
276
+ → OAuth2 need discovered during Implementation → genome-change logged in backlog
277
+ → Validation (partial)
278
+ → Completion → Retrospective + genome update → Genome v2 → Archive
279
+
280
+ Generation #2 (Genome v2)
281
+ → Objective: "OAuth2 integration + permission management"
282
+ → Deferred tasks from previous generation + new goals
283
+ → ...
284
+ ```
285
+
286
+ ## Presets
287
+
288
+ Use `reap init --preset` to apply an initial Genome configuration tailored to your tech stack.
289
+
290
+ | Preset | Stack |
291
+ |--------|-------|
292
+ | `bun-hono-react` | Bun + Hono + React |
293
+
294
+ ```bash
295
+ reap init my-project --preset bun-hono-react
296
+ ```
297
+
298
+ ## Entry Modes
299
+
300
+ | Mode | Description |
301
+ |------|-------------|
302
+ | `greenfield` | Build a new project from scratch (default) |
303
+ | `migration` | Build anew while referencing an existing system |
304
+ | `adoption` | Apply REAP to an existing codebase |
305
+
306
+ ## License
307
+
308
+ MIT