@c-d-cc/reap 0.9.1 → 0.10.1

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.
package/README.ja.md CHANGED
@@ -101,7 +101,7 @@ claude
101
101
  > ...
102
102
  ```
103
103
 
104
- ## ライフサイクル
104
+ ## ライフサイクル [↗](https://reap.cc/docs/lifecycle)
105
105
 
106
106
  各Generation(世代)は5段階のライフサイクルを経ます:
107
107
 
@@ -118,9 +118,9 @@ Objective → Planning → Implementation ⟷ Validation → Completion
118
118
  | **Validation** | テスト実行、完了条件の確認 | `04-validation.md` |
119
119
  | **Completion** | レトロスペクティブ + Genome変更反映 + Hook提案 + アーカイブ | `05-completion.md` |
120
120
 
121
- ## コアコンセプト
121
+ ## コアコンセプト [↗](https://reap.cc/docs/core-concepts)
122
122
 
123
- ### Genome
123
+ ### Genome [↗](https://reap.cc/docs/genome)
124
124
 
125
125
  アプリケーションの遺伝情報 — アーキテクチャ原則、ビジネスルール、開発コンベンション、技術制約の集合。
126
126
 
@@ -137,7 +137,7 @@ Objective → Planning → Implementation ⟷ Validation → Completion
137
137
 
138
138
  **Environment不変原則**: 現在の世代ではEnvironmentを直接変更しません。外部環境の変化を発見した場合はbacklogに記録し、Completionステージで反映します。
139
139
 
140
- ### Backlog
140
+ ### Backlog [↗](https://reap.cc/docs/backlog)
141
141
 
142
142
  `.reap/life/backlog/`に次に反映するすべての項目を保存します。各項目はmarkdown + frontmatter形式:
143
143
 
@@ -154,13 +154,13 @@ Objective → Planning → Implementation ⟷ Validation → Completion
154
154
 
155
155
  **部分完了は正常** — Genome変更に依存するタスクは`[deferred]`とマークし、次の世代に引き継ぎます。
156
156
 
157
- ### 4軸構造
157
+ ### 4軸構造 [↗](https://reap.cc/docs/core-concepts)
158
158
 
159
159
  ```
160
160
  .reap/
161
161
  ├── genome/ # 遺伝情報(世代を超えて進化)
162
162
  ├── environment/ # 外部環境(APIドキュメント、インフラ、ビジネス制約)
163
- ├── life/ # 現在の世代の状態と成果物
163
+ ├── life/ # ライフサイクル — 現在の世代の状態と成果物
164
164
  └── lineage/ # 完了した世代のアーカイブ
165
165
  ```
166
166
 
@@ -213,7 +213,7 @@ Machine A:
213
213
  - **サーバー不要** — すべてがローカル + Git。外部サービスは不要です。
214
214
  - **DAG lineage** — 各世代はハッシュベースのID(`gen-046-a3f8c2`)で親を参照し、有向非巡回グラフを形成するため、並行作業を自然にサポートします。
215
215
 
216
- ## CLIコマンド
216
+ ## CLIコマンド [↗](https://reap.cc/docs/cli-reference)
217
217
 
218
218
  | コマンド | 説明 |
219
219
  |----------|------|
@@ -235,7 +235,7 @@ reap update --dry-run # 変更のプレビュー
235
235
 
236
236
  REAPはスラッシュコマンドとセッションフックを通じてAIエージェントと統合します。現在サポートされているエージェント:**Claude Code**、**OpenCode**。
237
237
 
238
- ### スラッシュコマンド
238
+ ### スラッシュコマンド [↗](https://reap.cc/docs/command-reference)
239
239
 
240
240
  スラッシュコマンドが`.claude/commands/`にインストールされ、ワークフロー全体を駆動します:
241
241
 
@@ -246,13 +246,17 @@ REAPはスラッシュコマンドとセッションフックを通じてAIエ
246
246
  | `/reap.planning` | タスク分解 + 実装計画 |
247
247
  | `/reap.implementation` | AI+Human協力でコード実装 |
248
248
  | `/reap.validation` | テスト実行、完了条件の確認 |
249
- | `/reap.completion` | レトロスペクティブ + Genome変更反映 |
249
+ | `/reap.completion` | レトロスペクティブ + Genome変更反映 + lineage圧縮 |
250
250
  | `/reap.next` | 次のライフサイクルステージへ前進 |
251
251
  | `/reap.back` | 前のステージに回帰(micro loop) |
252
+ | `/reap.abort` | 現在のGenerationを中断(rollback/stash/hold + backlog保存) |
252
253
  | `/reap.status` | 現在のGeneration状態とプロジェクト健全性を表示 |
253
- | `/reap.sync` | ソースコードベースでGenomeを最新化 |
254
- | `/reap.help` | 24+トピックのcontextual AIヘルプ(workflow, genome, backlog, strict, agents, hooks, config, evolve, regression, authorおよび全コマンド名) |
255
- | `/reap.update` | REAPのアップデート確認と最新バージョンへのアップグレード |
254
+ | `/reap.sync` | GenomeとEnvironmentを同時に同期 |
255
+ | `/reap.sync.genome` | ソースコードベースでGenomeを最新化 |
256
+ | `/reap.sync.environment` | 外部環境依存関係の発見と文書化 |
257
+ | `/reap.report` | REAPプロジェクトにバグ/フィードバックを報告(プライバシー保護) |
258
+ | `/reap.help` | 24+トピックのcontextual AIヘルプ |
259
+ | `/reap.update` | REAPパッケージのアップグレード + コマンド/テンプレート/hook同期 |
256
260
  | **`/reap.evolve`** | **1つのGeneration全体を最初から最後まで実行(推奨)** |
257
261
  | **`/reap.pull <branch>`** | **Fetch + マージGeneration全体を実行(分散版 `/reap.evolve`)** |
258
262
  | **`/reap.merge <branch>`** | **ローカルブランチのマージGeneration全体を実行(fetchなし)** |
@@ -265,7 +269,7 @@ REAPはスラッシュコマンドとセッションフックを通じてAIエ
265
269
  | `/reap.merge.validation` | 機械的テストを実行(bun test、tsc、build) |
266
270
  | **`/reap.merge.evolve`** | **マージライフサイクル全体を自動実行** |
267
271
 
268
- ### SessionStart Hook
272
+ ### SessionStart Hook [↗](https://reap.cc/docs/hooks)
269
273
 
270
274
  毎セッション開始時に自動実行され、AIエージェントに以下を注入します:
271
275
 
@@ -305,7 +309,7 @@ strict:
305
309
 
306
310
  Strictモードはデフォルトで無効です(`strict: false`)。
307
311
 
308
- ### REAP Hooks
312
+ ### REAP Hooks [↗](https://reap.cc/docs/hooks)
309
313
 
310
314
  Hookはファイルベースで`.reap/hooks/`に保存されます。各Hookは`{event}.{name}.{md|sh}`形式のファイルです:
311
315
 
@@ -314,33 +318,47 @@ Hookはファイルベースで`.reap/hooks/`に保存されます。各Hookは`
314
318
 
315
319
  ```
316
320
  .reap/hooks/
317
- ├── onGenerationStart.context-load.md
318
- ├── onGenerationComplete.version-bump.md
319
- ├── onGenerationComplete.readme-update.md
320
- ├── onStageTransition.notify.sh
321
- └── onRegression.alert.sh
321
+ ├── onLifeStarted.context-load.md
322
+ ├── onLifeCompleted.version-bump.md
323
+ ├── onLifeCompleted.readme-update.md
324
+ ├── onLifeTransited.notify.sh
325
+ └── onLifeRegretted.alert.sh
322
326
  ```
323
327
 
324
328
  各Hookファイルは以下のフィールドを持つfrontmatterをサポートします:
325
329
 
326
330
  ```yaml
327
331
  ---
328
- condition: has-code-changes # always | has-code-changes | version-bumped
332
+ condition: has-code-changes # .reap/hooks/conditions/内のスクリプト名
329
333
  order: 10 # 実行順序(小さいほど先に実行)
330
334
  ---
331
335
  ```
332
336
 
337
+ **Normal Lifecycle Events:**
338
+
339
+ | イベント | トリガー |
340
+ |----------|----------|
341
+ | `onLifeStarted` | `/reap.start`で新しいGeneration作成後 |
342
+ | `onLifeObjected` | objectiveステージ完了後 |
343
+ | `onLifePlanned` | planningステージ完了後 |
344
+ | `onLifeImplemented` | implementationステージ完了後 |
345
+ | `onLifeValidated` | validationステージ完了後 |
346
+ | `onLifeCompleted` | completion + archiving後(git commit後に実行) |
347
+ | `onLifeTransited` | すべてのstage遷移時(汎用) |
348
+ | `onLifeRegretted` | `/reap.back` regression時 |
349
+
350
+ **Merge Lifecycle Events:**
351
+
333
352
  | イベント | トリガー |
334
353
  |----------|----------|
335
- | `onGenerationStart` | `/reap.start`で新しいGeneration作成後 |
336
- | `onStageTransition` | `/reap.next`で次のステージに前進後 |
337
- | `onGenerationComplete` | `/reap.next`で完了したGenerationをアーカイブ後 |
338
- | `onRegression` | `/reap.back`で前のステージに回帰後 |
339
- | `onMergeStart` | `/reap.merge.start`でマージGeneration作成後 |
340
- | `onGenomeResolved` | マージ中にGenomeの競合が解決された後 |
341
- | `onMergeComplete` | マージGenerationがアーカイブされた後 |
342
-
343
- HookはAIエージェントがプロジェクトルートディレクトリで実行します。`onGenerationComplete` Hookには自動バージョンバンプ判定が含まれています — patchレベルは自動適用され、minor/majorバンプはユーザー確認が必要です。
354
+ | `onMergeStarted` | `/reap.merge.start`でマージGeneration作成後 |
355
+ | `onMergeDetected` | detectステージ完了後 |
356
+ | `onMergeMated` | mateステージ完了後(genome確定) |
357
+ | `onMergeMerged` | mergeステージ完了後(ソースマージ) |
358
+ | `onMergeSynced` | syncステージ完了後 |
359
+ | `onMergeValidated` | merge validation完了後 |
360
+ | `onMergeCompleted` | merge completion + archiving後 |
361
+ | `onMergeTransited` | すべてのmerge stage遷移時(汎用) |
344
362
 
345
363
  ## `reap init`後のプロジェクト構造
346
364
 
package/README.ko.md CHANGED
@@ -118,9 +118,9 @@ Objective → Planning → Implementation ⟷ Validation → Completion
118
118
  | **Validation** | 테스트 실행, 완료 조건 점검 | `04-validation.md` |
119
119
  | **Completion** | 회고 + Genome 변경 반영 + Hook 제안 + 아카이빙 | `05-completion.md` |
120
120
 
121
- ## 핵심 개념
121
+ ## 핵심 개념 [↗](https://reap.cc/docs/core-concepts)
122
122
 
123
- ### Genome
123
+ ### Genome [↗](https://reap.cc/docs/genome)
124
124
 
125
125
  Application의 유전 정보 — 아키텍처 원칙, 비즈니스 규칙, 개발 컨벤션, 기술 제약의 집합.
126
126
 
@@ -137,7 +137,7 @@ Application의 유전 정보 — 아키텍처 원칙, 비즈니스 규칙, 개
137
137
 
138
138
  **Environment 불변 원칙**: 현재 세대에서는 Environment를 직접 수정하지 않습니다. 외부 환경 변화를 발견하면 backlog에 기록하고, Completion 단계에서 반영합니다.
139
139
 
140
- ### Backlog
140
+ ### Backlog [↗](https://reap.cc/docs/backlog)
141
141
 
142
142
  `.reap/life/backlog/`에 다음에 반영할 모든 항목을 저장합니다. 각 항목은 markdown + frontmatter 형식:
143
143
 
@@ -154,13 +154,13 @@ Application의 유전 정보 — 아키텍처 원칙, 비즈니스 규칙, 개
154
154
 
155
155
  **부분 완료는 정상** — Genome 변경에 의존하는 태스크는 `[deferred]`로 마킹하고 다음 세대로 인계합니다.
156
156
 
157
- ### 4축 구조
157
+ ### 4축 구조 [↗](https://reap.cc/docs/core-concepts)
158
158
 
159
159
  ```
160
160
  .reap/
161
161
  ├── genome/ # 유전 정보 (세대를 거치며 진화)
162
162
  ├── environment/ # 외부 환경 (API 문서, 인프라, 비즈니스 제약)
163
- ├── life/ # 현재 세대의 상태와 산출물
163
+ ├── life/ # 라이프사이클 — 현재 세대의 상태와 산출물
164
164
  └── lineage/ # 완료된 세대들의 아카이브
165
165
  ```
166
166
 
@@ -246,13 +246,17 @@ Slash command가 `.claude/commands/`에 설치되어 전체 워크플로우를
246
246
  | `/reap.planning` | 태스크 분해 + 구현 계획 |
247
247
  | `/reap.implementation` | AI+Human 협업 코드 구현 |
248
248
  | `/reap.validation` | 테스트 실행, 완료 조건 점검 |
249
- | `/reap.completion` | 회고 + Genome 변경 반영 |
249
+ | `/reap.completion` | 회고 + Genome 변경 반영 + lineage 압축 |
250
250
  | `/reap.next` | 다음 Life Cycle stage로 전진 |
251
251
  | `/reap.back` | 이전 stage로 복귀 (micro loop) |
252
+ | `/reap.abort` | 현재 Generation 중단 (rollback/stash/hold + backlog 저장) |
252
253
  | `/reap.status` | 현재 Generation 상태 및 프로젝트 건강 상태 표시 |
253
- | `/reap.sync` | 소스 코드 기반 Genome 최신화 |
254
- | `/reap.help` | 24+ 주제의 contextual AI 도움말 (workflow, genome, backlog, strict, agents, hooks, config, evolve, regression, author 및 모든 커맨드 이름) |
255
- | `/reap.update` | REAP 업데이트 확인최신 버전으로 업그레이드 |
254
+ | `/reap.sync` | Genome + Environment 동시 동기화 |
255
+ | `/reap.sync.genome` | 소스 코드 기반 Genome 최신화 |
256
+ | `/reap.sync.environment` | 외부 환경 의존성 탐색 문서화 |
257
+ | `/reap.report` | REAP 프로젝트에 버그/피드백 보고 (개인정보 보호) |
258
+ | `/reap.help` | 24+ 주제의 contextual AI 도움말 |
259
+ | `/reap.update` | REAP 패키지 업그레이드 + 커맨드/템플릿/훅 동기화 |
256
260
  | **`/reap.evolve`** | **한 Generation 전체를 처음부터 끝까지 실행 (권장)** |
257
261
  | **`/reap.pull <branch>`** | **Fetch + 전체 머지 Generation 실행 (분산 `/reap.evolve`)** |
258
262
  | **`/reap.merge <branch>`** | **로컬 브랜치 전체 머지 Generation 실행 (fetch 없음)** |
@@ -265,7 +269,7 @@ Slash command가 `.claude/commands/`에 설치되어 전체 워크플로우를
265
269
  | `/reap.merge.validation` | 기계적 테스트 실행 (bun test, tsc, build) |
266
270
  | **`/reap.merge.evolve`** | **전체 머지 라이프사이클 자동 실행** |
267
271
 
268
- ### SessionStart Hook
272
+ ### SessionStart Hook [↗](https://reap.cc/docs/hooks)
269
273
 
270
274
  매 세션 시작 시 자동으로 실행되어 AI 에이전트에게 다음을 주입합니다:
271
275
 
@@ -305,7 +309,7 @@ strict:
305
309
 
306
310
  Strict 모드는 기본적으로 비활성화되어 있습니다 (`strict: false`).
307
311
 
308
- ### REAP Hooks
312
+ ### REAP Hooks [↗](https://reap.cc/docs/hooks)
309
313
 
310
314
  Hook은 파일 기반이며 `.reap/hooks/`에 저장됩니다. 각 Hook은 `{event}.{name}.{md|sh}` 형식의 파일입니다:
311
315
 
@@ -314,33 +318,47 @@ Hook은 파일 기반이며 `.reap/hooks/`에 저장됩니다. 각 Hook은 `{eve
314
318
 
315
319
  ```
316
320
  .reap/hooks/
317
- ├── onGenerationStart.context-load.md
318
- ├── onGenerationComplete.version-bump.md
319
- ├── onGenerationComplete.readme-update.md
320
- ├── onStageTransition.notify.sh
321
- └── onRegression.alert.sh
321
+ ├── onLifeStarted.context-load.md
322
+ ├── onLifeCompleted.version-bump.md
323
+ ├── onLifeCompleted.readme-update.md
324
+ ├── onLifeTransited.notify.sh
325
+ └── onLifeRegretted.alert.sh
322
326
  ```
323
327
 
324
328
  각 Hook 파일은 다음 필드를 가진 frontmatter를 지원합니다:
325
329
 
326
330
  ```yaml
327
331
  ---
328
- condition: has-code-changes # always | has-code-changes | version-bumped
332
+ condition: has-code-changes # .reap/hooks/conditions/ 스크립트 이름
329
333
  order: 10 # 실행 순서 (낮을수록 먼저 실행)
330
334
  ---
331
335
  ```
332
336
 
337
+ **Normal Lifecycle Events:**
338
+
339
+ | 이벤트 | 트리거 |
340
+ |--------|--------|
341
+ | `onLifeStarted` | `/reap.start`로 새 Generation 생성 후 |
342
+ | `onLifeObjected` | objective 단계 완료 후 |
343
+ | `onLifePlanned` | planning 단계 완료 후 |
344
+ | `onLifeImplemented` | implementation 단계 완료 후 |
345
+ | `onLifeValidated` | validation 단계 완료 후 |
346
+ | `onLifeCompleted` | completion + archiving 후 (git commit 이후 실행) |
347
+ | `onLifeTransited` | 모든 stage 전환 시 (범용) |
348
+ | `onLifeRegretted` | `/reap.back` regression 시 |
349
+
350
+ **Merge Lifecycle Events:**
351
+
333
352
  | 이벤트 | 트리거 |
334
353
  |--------|--------|
335
- | `onGenerationStart` | `/reap.start`로 Generation 생성 후 |
336
- | `onStageTransition` | `/reap.next`로 다음 stage 전진 후 |
337
- | `onGenerationComplete` | `/reap.next`로 완료된 Generation 아카이빙 후 |
338
- | `onRegression` | `/reap.back`으로 이전 stage 복귀 후 |
339
- | `onMergeStart` | `/reap.merge.start`로 머지 Generation 생성 후 |
340
- | `onGenomeResolved` | 머지 Genome 충돌 해결 완료 후 |
341
- | `onMergeComplete` | 머지 Generation 아카이빙 후 |
342
-
343
- Hook은 AI 에이전트가 프로젝트 루트 디렉토리에서 실행합니다. `onGenerationComplete` Hook에는 자동 버전 범프 판단이 포함되어 있습니다 — patch 수준은 자동으로 적용되고, minor/major 범프는 사용자 확인을 거칩니다.
354
+ | `onMergeStarted` | `/reap.merge.start`로 머지 Generation 생성 후 |
355
+ | `onMergeDetected` | detect 단계 완료 후 |
356
+ | `onMergeMated` | mate 단계 완료(genome 확정) |
357
+ | `onMergeMerged` | merge 단계 완료(소스 병합) |
358
+ | `onMergeSynced` | sync 단계 완료 후 |
359
+ | `onMergeValidated` | merge validation 완료 후 |
360
+ | `onMergeCompleted` | merge completion + archiving 후 |
361
+ | `onMergeTransited` | 모든 merge stage 전환 시 (범용) |
344
362
 
345
363
  ## `reap init` 후 프로젝트 구조
346
364
 
package/README.md CHANGED
@@ -101,7 +101,7 @@ You can also drive each stage manually if you need finer control:
101
101
  > ...
102
102
  ```
103
103
 
104
- ## Life Cycle
104
+ ## Life Cycle [↗](https://reap.cc/docs/lifecycle)
105
105
 
106
106
  Each generation goes through a five-stage life cycle:
107
107
 
@@ -117,9 +117,9 @@ Objective → Planning → Implementation ⟷ Validation → Completion
117
117
  | **Validation** | Run tests, verify completion criteria | `04-validation.md` |
118
118
  | **Completion** | Retrospective + apply Genome changes + hook suggestion + archive | `05-completion.md` |
119
119
 
120
- ## Core Concepts
120
+ ## Core Concepts [↗](https://reap.cc/docs/core-concepts)
121
121
 
122
- ### Genome
122
+ ### Genome [↗](https://reap.cc/docs/genome)
123
123
 
124
124
  The application's genetic information — a collection of architecture principles, business rules, development conventions, and technical constraints.
125
125
 
@@ -136,7 +136,7 @@ The application's genetic information — a collection of architecture principle
136
136
 
137
137
  **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.
138
138
 
139
- ### Backlog
139
+ ### Backlog [↗](https://reap.cc/docs/backlog)
140
140
 
141
141
  All items to be addressed next are stored in `.reap/life/backlog/`. Each item uses markdown + frontmatter format:
142
142
 
@@ -153,17 +153,17 @@ At archiving time (`/reap.next` from Completion), `consumed` items move to linea
153
153
 
154
154
  **Partial completion is normal** — Tasks that depend on Genome changes are marked `[deferred]` and handed off to the next generation.
155
155
 
156
- ### Four-Axis Structure
156
+ ### Four-Axis Structure [↗](https://reap.cc/docs/core-concepts)
157
157
 
158
158
  ```
159
159
  .reap/
160
160
  ├── genome/ # Genetic information (evolves across generations)
161
161
  ├── environment/ # External context (API docs, infra, business constraints)
162
- ├── life/ # Current generation's state and artifacts
162
+ ├── life/ # Lifecycle — current generation's state and artifacts
163
163
  └── lineage/ # Archive of completed generations
164
164
  ```
165
165
 
166
- ## Distributed Workflow for Parallel Development
166
+ ## Distributed Workflow [↗](https://reap.cc/docs/distributed-workflow)
167
167
 
168
168
  > **⚠ Early Stage** — The distributed workflow requires further testing. Use with caution in production. We're collecting feedback — [open an issue](https://github.com/c-d-cc/reap/issues).
169
169
 
@@ -212,7 +212,7 @@ All distributed operations run through your AI agent:
212
212
  - **No server** — Everything is local + Git. No external services.
213
213
  - **DAG lineage** — Each generation references its parents via a hash-based ID (`gen-046-a3f8c2`), forming a directed acyclic graph that naturally supports parallel work.
214
214
 
215
- ## CLI Commands
215
+ ## CLI Commands [↗](https://reap.cc/docs/cli-reference)
216
216
 
217
217
  | Command | Description |
218
218
  |---------|-------------|
@@ -234,7 +234,7 @@ reap update --dry-run # Preview changes before applying
234
234
 
235
235
  REAP integrates with AI agents through slash commands and session hooks. Currently supported agents: **Claude Code** and **OpenCode**.
236
236
 
237
- ### Slash Commands
237
+ ### Slash Commands [↗](https://reap.cc/docs/command-reference)
238
238
 
239
239
  Slash commands are installed in `.claude/commands/` and drive the entire workflow:
240
240
 
@@ -245,13 +245,17 @@ Slash commands are installed in `.claude/commands/` and drive the entire workflo
245
245
  | `/reap.planning` | Task decomposition + implementation plan |
246
246
  | `/reap.implementation` | Code implementation with AI + human |
247
247
  | `/reap.validation` | Run tests, verify completion criteria |
248
- | `/reap.completion` | Retrospective + apply Genome changes |
248
+ | `/reap.completion` | Retrospective + apply Genome changes + lineage compression |
249
249
  | `/reap.next` | Advance to the next life cycle stage |
250
250
  | `/reap.back` | Return to a previous stage (micro loop) |
251
+ | `/reap.abort` | Abort current generation (rollback/stash/hold + backlog save) |
251
252
  | `/reap.status` | Show current generation state and project health |
252
- | `/reap.sync` | Synchronize Genome with current source code |
253
- | `/reap.help` | Contextual AI help with 24+ topics (workflow, genome, backlog, strict, agents, hooks, config, evolve, regression, author, and all command names) |
254
- | `/reap.update` | Check for REAP updates and upgrade to the latest version |
253
+ | `/reap.sync` | Synchronize both Genome and Environment |
254
+ | `/reap.sync.genome` | Synchronize Genome with current source code |
255
+ | `/reap.sync.environment` | Discover and document external environment dependencies |
256
+ | `/reap.report` | Report a bug or feedback to the REAP project (privacy-safe) |
257
+ | `/reap.help` | Contextual AI help with 24+ topics |
258
+ | `/reap.update` | Upgrade REAP package + sync commands/templates/hooks |
255
259
  | **`/reap.evolve`** | **Run an entire generation from start to finish (recommended)** |
256
260
  | **`/reap.pull <branch>`** | **Fetch + run full merge generation (distributed `/reap.evolve`)** |
257
261
  | **`/reap.merge <branch>`** | **Run full merge generation for a local branch (no fetch)** |
@@ -264,19 +268,21 @@ Slash commands are installed in `.claude/commands/` and drive the entire workflo
264
268
  | `/reap.merge.validation` | Run mechanical testing (bun test, tsc, build) |
265
269
  | **`/reap.merge.evolve`** | **Run the full merge lifecycle automatically** |
266
270
 
267
- ### SessionStart Hook
271
+ ### SessionStart Hook [↗](https://reap.cc/docs/hooks)
268
272
 
269
273
  Runs automatically at the start of every session, injecting the following into the AI agent:
270
274
 
271
275
  - The full REAP workflow guide (Genome, Life Cycle, Four-Axis Structure, etc.)
272
276
  - Current generation state (which stage you're in, what to do next)
277
+ - Environment summary (`environment/summary.md`) — external system context
273
278
  - Rules to follow the REAP lifecycle
274
- - Genome staleness detection — checks if code-related commits (`src/`, `tests/`, `package.json`, `tsconfig.json`, `scripts/`) have occurred since the last Genome update (docs-only changes are excluded)
275
- - Source-map drift detection — compares documented components in `source-map.md` against actual files in the project
279
+ - Genome staleness detection — checks if code-related commits have occurred since the last Genome update
280
+ - Source-map drift detection — compares documented components against actual files
281
+ - Slash command installation — copies commands from `~/.reap/commands/` to project `.claude/commands/`
276
282
 
277
283
  This ensures the agent immediately understands the project context even in a brand-new session.
278
284
 
279
- ### Strict Mode
285
+ ### Strict Mode [↗](https://reap.cc/docs/configuration)
280
286
 
281
287
  Strict mode controls what the AI agent is allowed to do. It supports two granular options:
282
288
 
@@ -304,7 +310,7 @@ Both are disabled by default. `strict: true` enables both.
304
310
 
305
311
  Strict mode is disabled by default (`strict: false`).
306
312
 
307
- ### REAP Hooks
313
+ ### REAP Hooks [↗](https://reap.cc/docs/hooks)
308
314
 
309
315
  Hooks are file-based and stored in `.reap/hooks/`. Each hook is a file named `{event}.{name}.{md|sh}`:
310
316
 
@@ -313,33 +319,47 @@ Hooks are file-based and stored in `.reap/hooks/`. Each hook is a file named `{e
313
319
 
314
320
  ```
315
321
  .reap/hooks/
316
- ├── onGenerationStart.context-load.md
317
- ├── onGenerationComplete.version-bump.md
318
- ├── onGenerationComplete.readme-update.md
319
- ├── onStageTransition.notify.sh
320
- └── onRegression.alert.sh
322
+ ├── onLifeStarted.context-load.md
323
+ ├── onLifeCompleted.reap-update.sh
324
+ ├── onLifeCompleted.docs-update.md
325
+ ├── onLifeTransited.notify.sh
326
+ └── onLifeRegretted.alert.sh
321
327
  ```
322
328
 
323
329
  Each hook file supports frontmatter with the following fields:
324
330
 
325
331
  ```yaml
326
332
  ---
327
- condition: has-code-changes # always | has-code-changes | version-bumped
333
+ condition: has-code-changes # script name in .reap/hooks/conditions/
328
334
  order: 10 # execution order (lower runs first)
329
335
  ---
330
336
  ```
331
337
 
338
+ **Normal Lifecycle Events:**
339
+
332
340
  | Event | Trigger |
333
341
  |-------|---------|
334
- | `onGenerationStart` | After `/reap.start` creates a new generation |
335
- | `onStageTransition` | After `/reap.next` advances to the next stage |
336
- | `onGenerationComplete` | After `/reap.next` archives a completed generation |
337
- | `onRegression` | After `/reap.back` returns to a previous stage |
338
- | `onMergeStart` | After `/reap.merge.start` creates a merge generation |
339
- | `onGenomeResolved` | After genome conflicts are resolved in a merge |
340
- | `onMergeComplete` | After a merge generation is archived |
342
+ | `onLifeStarted` | After `/reap.start` creates a new generation |
343
+ | `onLifeObjected` | After objective stage completes |
344
+ | `onLifePlanned` | After planning stage completes |
345
+ | `onLifeImplemented` | After implementation stage completes |
346
+ | `onLifeValidated` | After validation stage completes |
347
+ | `onLifeCompleted` | After completion + archiving (runs after git commit) |
348
+ | `onLifeTransited` | After any stage transition (generic) |
349
+ | `onLifeRegretted` | After `/reap.back` regression |
350
+
351
+ **Merge Lifecycle Events:**
341
352
 
342
- Hooks are executed by the AI agent in the project root directory. The `onGenerationComplete` hooks include automatic version bump judgment — patch-level bumps are applied automatically, while minor/major bumps require user confirmation.
353
+ | Event | Trigger |
354
+ |-------|---------|
355
+ | `onMergeStarted` | After `/reap.merge.start` creates a merge generation |
356
+ | `onMergeDetected` | After detect stage completes |
357
+ | `onMergeMated` | After mate stage completes (genome resolved) |
358
+ | `onMergeMerged` | After merge stage completes (source merged) |
359
+ | `onMergeSynced` | After sync stage completes |
360
+ | `onMergeValidated` | After merge validation completes |
361
+ | `onMergeCompleted` | After merge completion + archiving |
362
+ | `onMergeTransited` | After any merge stage transition (generic) |
343
363
 
344
364
  ## Project Structure After `reap init`
345
365
 
@@ -355,27 +375,38 @@ my-project/
355
375
  │ ├── constraints.md
356
376
  │ └── source-map.md
357
377
  ├── hooks/ # Lifecycle hooks (.md/.sh)
358
- ├── environment/ # External context
378
+ ├── environment/ # External context (3-layer)
379
+ │ ├── summary.md # Session context (~100 lines, auto-loaded)
380
+ │ ├── docs/ # Main reference docs
381
+ │ └── resources/ # Raw materials (user-managed)
359
382
  ├── life/ # Current generation
360
383
  │ ├── current.yml
361
384
  │ └── backlog/
362
385
  └── lineage/ # Completed generation archive
363
386
 
364
- ~/.claude/ # User-level (installed by reap init)
365
- ├── commands/ # Slash commands (/reap.*)
366
- └── settings.json # SessionStart hook registration
387
+ ~/.reap/ # User-level (installed by reap init)
388
+ ├── commands/ # Slash command originals
389
+ └── templates/ # Artifact templates
390
+
391
+ ~/.claude/
392
+ └── settings.json # SessionStart hook registration
393
+
394
+ .claude/commands/ # Project-level (copied by session-start hook)
395
+ └── reap.*.md # Active slash commands (auto-synced)
367
396
  ```
368
397
 
369
- ## Lineage Compression
398
+ ## Lineage Compression [↗](https://reap.cc/docs/lineage)
399
+
400
+ As generations accumulate, the lineage directory grows. REAP manages this with automatic two-level compression during the Completion stage:
370
401
 
371
- As generations accumulate, the lineage directory grows. REAP manages this with automatic two-level compression:
402
+ | Level | Input | Output | Trigger | Protection |
403
+ |-------|-------|--------|---------|------------|
404
+ | **Level 1** | Generation folder (5 artifacts) | `gen-XXX-{hash}.md` (40 lines) | lineage > 5,000 lines + 5+ generations | Recent 3 generations + DAG leaf nodes |
405
+ | **Level 2** | 100+ Level 1 files | Single `epoch.md` | Level 1 files > 100 | Recent 9 Level 1 files + fork points |
372
406
 
373
- | Level | Input | Output | Max lines | Trigger |
374
- |-------|-------|--------|-----------|---------|
375
- | **Level 1** | Generation folder (5 artifacts) | `gen-XXX-{hash}.md` | 40 lines | lineage > 5,000 lines + 5+ generations |
376
- | **Level 2** | 5 Level 1 files | `epoch-XXX.md` | 60 lines | 5+ Level 1 files |
407
+ **DAG preservation**: Level 1 files retain DAG metadata (id, parents, genomeHash) in frontmatter. Level 2 `epoch.md` stores a `generations` hash chain in frontmatter for DAG traversal.
377
408
 
378
- Compression runs automatically when a generation completes. The most recent 3 generations are always protected from compression. Compressed files preserve objectives and completion results while retaining only notable findings from intermediate stages.
409
+ **Fork guard**: Before Level 2 compression, all local and remote branches are scanned. Generations that serve as fork points for other branches are protected from epoch compression. Epoch-compressed generations cannot be used as merge bases.
379
410
 
380
411
  ## Evolution Flow
381
412
 
package/README.zh-CN.md CHANGED
@@ -101,7 +101,7 @@ claude
101
101
  > ...
102
102
  ```
103
103
 
104
- ## 生命周期
104
+ ## 生命周期 [↗](https://reap.cc/docs/lifecycle)
105
105
 
106
106
  每个Generation经历5个阶段的生命周期:
107
107
 
@@ -118,9 +118,9 @@ Objective → Planning → Implementation ⟷ Validation → Completion
118
118
  | **Validation** | 执行测试、检查完成条件 | `04-validation.md` |
119
119
  | **Completion** | 回顾 + 应用Genome变更 + Hook建议 + 归档 | `05-completion.md` |
120
120
 
121
- ## 核心概念
121
+ ## 核心概念 [↗](https://reap.cc/docs/core-concepts)
122
122
 
123
- ### Genome
123
+ ### Genome [↗](https://reap.cc/docs/genome)
124
124
 
125
125
  应用程序的遗传信息 — 架构原则、业务规则、开发约定、技术约束的集合。
126
126
 
@@ -137,7 +137,7 @@ Objective → Planning → Implementation ⟷ Validation → Completion
137
137
 
138
138
  **Environment不变原则**:当前世代不直接修改Environment。发现外部环境变化时记录在backlog中,在Completion阶段反映。
139
139
 
140
- ### Backlog
140
+ ### Backlog [↗](https://reap.cc/docs/backlog)
141
141
 
142
142
  `.reap/life/backlog/`中存储所有待反映的项目。每个项目使用markdown + frontmatter格式:
143
143
 
@@ -154,13 +154,13 @@ Objective → Planning → Implementation ⟷ Validation → Completion
154
154
 
155
155
  **部分完成是正常的** — 依赖Genome变更的任务标记为`[deferred]`并交接到下一个世代。
156
156
 
157
- ### 四轴结构
157
+ ### 四轴结构 [↗](https://reap.cc/docs/core-concepts)
158
158
 
159
159
  ```
160
160
  .reap/
161
161
  ├── genome/ # 遗传信息(跨世代进化)
162
162
  ├── environment/ # 外部环境(API文档、基础设施、业务约束)
163
- ├── life/ # 当前世代的状态和产出物
163
+ ├── life/ # 生命周期 — 当前世代的状态和产出物
164
164
  └── lineage/ # 已完成世代的归档
165
165
  ```
166
166
 
@@ -213,7 +213,7 @@ Machine A:
213
213
  - **无需服务器** — 一切基于本地 + Git,无需外部服务。
214
214
  - **DAG lineage** — 每个世代通过基于哈希的ID(`gen-046-a3f8c2`)引用其父代,形成有向无环图,天然支持并行工作。
215
215
 
216
- ## CLI命令
216
+ ## CLI命令 [↗](https://reap.cc/docs/cli-reference)
217
217
 
218
218
  | 命令 | 说明 |
219
219
  |------|------|
@@ -235,7 +235,7 @@ reap update --dry-run # 预览变更
235
235
 
236
236
  REAP通过斜杠命令和会话钩子与AI代理集成。当前支持的代理:**Claude Code**、**OpenCode**。
237
237
 
238
- ### 斜杠命令
238
+ ### 斜杠命令 [↗](https://reap.cc/docs/command-reference)
239
239
 
240
240
  斜杠命令安装在`.claude/commands/`中,驱动整个工作流:
241
241
 
@@ -246,13 +246,17 @@ REAP通过斜杠命令和会话钩子与AI代理集成。当前支持的代理
246
246
  | `/reap.planning` | 任务分解 + 实施计划 |
247
247
  | `/reap.implementation` | AI+人类协作编写代码 |
248
248
  | `/reap.validation` | 执行测试、检查完成条件 |
249
- | `/reap.completion` | 回顾 + 应用Genome变更 |
249
+ | `/reap.completion` | 回顾 + 应用Genome变更 + lineage压缩 |
250
250
  | `/reap.next` | 前进到下一个生命周期阶段 |
251
251
  | `/reap.back` | 回到前一个阶段(micro loop) |
252
+ | `/reap.abort` | 中止当前Generation(rollback/stash/hold + backlog保存) |
252
253
  | `/reap.status` | 显示当前Generation状态和项目健康度 |
253
- | `/reap.sync` | 基于源代码同步Genome |
254
- | `/reap.help` | 24+主题的上下文AI帮助(workflow, genome, backlog, strict, agents, hooks, config, evolve, regression, author及所有命令名) |
255
- | `/reap.update` | 检查REAP更新并升级到最新版本 |
254
+ | `/reap.sync` | 同时同步Genome和Environment |
255
+ | `/reap.sync.genome` | 基于源代码同步Genome |
256
+ | `/reap.sync.environment` | 发现和记录外部环境依赖 |
257
+ | `/reap.report` | 向REAP项目报告bug/反馈(隐私保护) |
258
+ | `/reap.help` | 24+主题的上下文AI帮助 |
259
+ | `/reap.update` | 升级REAP包 + 同步命令/模板/hook |
256
260
  | **`/reap.evolve`** | **从头到尾运行一个完整的Generation(推荐)** |
257
261
  | **`/reap.pull <branch>`** | **Fetch + 运行完整合并Generation(分布式 `/reap.evolve`)** |
258
262
  | **`/reap.merge <branch>`** | **本地分支完整合并Generation(无需fetch)** |
@@ -265,7 +269,7 @@ REAP通过斜杠命令和会话钩子与AI代理集成。当前支持的代理
265
269
  | `/reap.merge.validation` | 运行机械化测试(bun test、tsc、build) |
266
270
  | **`/reap.merge.evolve`** | **自动运行完整的合并生命周期** |
267
271
 
268
- ### SessionStart Hook
272
+ ### SessionStart Hook [↗](https://reap.cc/docs/hooks)
269
273
 
270
274
  每次会话开始时自动运行,向AI代理注入以下内容:
271
275
 
@@ -305,7 +309,7 @@ strict:
305
309
 
306
310
  Strict模式默认禁用(`strict: false`)。
307
311
 
308
- ### REAP Hooks
312
+ ### REAP Hooks [↗](https://reap.cc/docs/hooks)
309
313
 
310
314
  Hook基于文件,存储在`.reap/hooks/`中。每个Hook是一个以`{event}.{name}.{md|sh}`命名的文件:
311
315
 
@@ -314,33 +318,47 @@ Hook基于文件,存储在`.reap/hooks/`中。每个Hook是一个以`{event}.{
314
318
 
315
319
  ```
316
320
  .reap/hooks/
317
- ├── onGenerationStart.context-load.md
318
- ├── onGenerationComplete.version-bump.md
319
- ├── onGenerationComplete.readme-update.md
320
- ├── onStageTransition.notify.sh
321
- └── onRegression.alert.sh
321
+ ├── onLifeStarted.context-load.md
322
+ ├── onLifeCompleted.version-bump.md
323
+ ├── onLifeCompleted.readme-update.md
324
+ ├── onLifeTransited.notify.sh
325
+ └── onLifeRegretted.alert.sh
322
326
  ```
323
327
 
324
328
  每个Hook文件支持包含以下字段的frontmatter:
325
329
 
326
330
  ```yaml
327
331
  ---
328
- condition: has-code-changes # always | has-code-changes | version-bumped
332
+ condition: has-code-changes # .reap/hooks/conditions/中的脚本名称
329
333
  order: 10 # 执行顺序(数值越小越先执行)
330
334
  ---
331
335
  ```
332
336
 
337
+ **Normal Lifecycle Events:**
338
+
339
+ | 事件 | 触发时机 |
340
+ |------|----------|
341
+ | `onLifeStarted` | `/reap.start`创建新Generation后 |
342
+ | `onLifeObjected` | objective阶段完成后 |
343
+ | `onLifePlanned` | planning阶段完成后 |
344
+ | `onLifeImplemented` | implementation阶段完成后 |
345
+ | `onLifeValidated` | validation阶段完成后 |
346
+ | `onLifeCompleted` | completion + 归档后(git commit之后运行) |
347
+ | `onLifeTransited` | 所有stage转换时(通用) |
348
+ | `onLifeRegretted` | `/reap.back` regression时 |
349
+
350
+ **Merge Lifecycle Events:**
351
+
333
352
  | 事件 | 触发时机 |
334
353
  |------|----------|
335
- | `onGenerationStart` | `/reap.start`创建新Generation后 |
336
- | `onStageTransition` | `/reap.next`前进到下一阶段后 |
337
- | `onGenerationComplete` | `/reap.next`归档已完成的Generation后 |
338
- | `onRegression` | `/reap.back`回到前一阶段后 |
339
- | `onMergeStart` | `/reap.merge.start`创建合并Generation后 |
340
- | `onGenomeResolved` | 合并过程中Genome冲突解决完成后 |
341
- | `onMergeComplete` | 合并Generation归档后 |
342
-
343
- Hook由AI代理在项目根目录中执行。`onGenerationComplete` Hook包含自动版本号升级判断 — patch级别自动应用,minor/major级别需要用户确认。
354
+ | `onMergeStarted` | `/reap.merge.start`创建合并Generation后 |
355
+ | `onMergeDetected` | detect阶段完成后 |
356
+ | `onMergeMated` | mate阶段完成后(genome确定) |
357
+ | `onMergeMerged` | merge阶段完成后(源代码合并) |
358
+ | `onMergeSynced` | sync阶段完成后 |
359
+ | `onMergeValidated` | merge validation完成后 |
360
+ | `onMergeCompleted` | merge completion + 归档后 |
361
+ | `onMergeTransited` | 所有merge stage转换时(通用) |
344
362
 
345
363
  ## `reap init`后的项目结构
346
364
 
package/dist/cli.js CHANGED
@@ -9817,7 +9817,7 @@ async function initProject(projectRoot, projectName, entryMode, preset, onProgre
9817
9817
  log("GitHub CLI(gh) not found. Install from https://cli.github.com for auto issue reporting.");
9818
9818
  }
9819
9819
  const config = {
9820
- version: "0.1.0",
9820
+ version: "0.10.1",
9821
9821
  project: projectName,
9822
9822
  entryMode,
9823
9823
  autoUpdate: true,
@@ -10758,6 +10758,98 @@ async function migrateLineage(paths) {
10758
10758
  return result;
10759
10759
  }
10760
10760
 
10761
+ // src/core/migrations/0.0.0-to-0.10.0.ts
10762
+ var migration_0_0_0_to_0_10_0 = {
10763
+ fromVersion: "0.0.0",
10764
+ toVersion: "0.10.0",
10765
+ description: "Lineage DAG migration — legacy gen-NNN directories to gen-NNN-HASH format",
10766
+ async check(paths) {
10767
+ return needsMigration(paths);
10768
+ },
10769
+ async up(paths) {
10770
+ const result = await migrateLineage(paths);
10771
+ const messages = [];
10772
+ for (const m of result.migrated) {
10773
+ messages.push(`[lineage] ${m}`);
10774
+ }
10775
+ if (result.errors.length > 0) {
10776
+ throw new Error(`Lineage migration errors: ${result.errors.join("; ")}`);
10777
+ }
10778
+ return messages;
10779
+ }
10780
+ };
10781
+
10782
+ // src/core/migrations/index.ts
10783
+ var MIGRATIONS = [
10784
+ migration_0_0_0_to_0_10_0
10785
+ ];
10786
+ function compareSemver(a, b) {
10787
+ const pa = a.split(".").map(Number);
10788
+ const pb = b.split(".").map(Number);
10789
+ for (let i = 0;i < 3; i++) {
10790
+ const na = pa[i] ?? 0;
10791
+ const nb = pb[i] ?? 0;
10792
+ if (na < nb)
10793
+ return -1;
10794
+ if (na > nb)
10795
+ return 1;
10796
+ }
10797
+ return 0;
10798
+ }
10799
+ function normalizeVersion(version) {
10800
+ if (!version)
10801
+ return "0.0.0";
10802
+ if (version === "0.1.0")
10803
+ return "0.0.0";
10804
+ return version.replace(/\+.*$/, "");
10805
+ }
10806
+
10807
+ class MigrationRunner {
10808
+ static async run(paths, currentPackageVersion, dryRun = false) {
10809
+ const config = await ConfigManager.read(paths);
10810
+ const configVersion = normalizeVersion(config.version);
10811
+ const targetVersion = normalizeVersion(currentPackageVersion);
10812
+ const result = {
10813
+ migrated: [],
10814
+ skipped: [],
10815
+ errors: [],
10816
+ fromVersion: configVersion,
10817
+ toVersion: targetVersion
10818
+ };
10819
+ if (compareSemver(configVersion, targetVersion) >= 0) {
10820
+ return result;
10821
+ }
10822
+ const applicable = MIGRATIONS.filter((m) => compareSemver(configVersion, m.toVersion) < 0).filter((m) => compareSemver(m.toVersion, targetVersion) <= 0).sort((a, b) => compareSemver(a.toVersion, b.toVersion));
10823
+ for (const migration of applicable) {
10824
+ const needs = await migration.check(paths);
10825
+ if (!needs) {
10826
+ result.skipped.push(migration.description);
10827
+ continue;
10828
+ }
10829
+ if (dryRun) {
10830
+ result.migrated.push(`[dry-run] ${migration.description}`);
10831
+ continue;
10832
+ }
10833
+ try {
10834
+ const messages = await migration.up(paths);
10835
+ result.migrated.push(...messages);
10836
+ } catch (err) {
10837
+ const errorMsg = `${migration.description}: ${err instanceof Error ? err.message : String(err)}`;
10838
+ result.errors.push(errorMsg);
10839
+ break;
10840
+ }
10841
+ }
10842
+ if (result.errors.length === 0 && !dryRun) {
10843
+ config.version = currentPackageVersion;
10844
+ await ConfigManager.write(paths, config);
10845
+ }
10846
+ return result;
10847
+ }
10848
+ static getMigrations() {
10849
+ return MIGRATIONS;
10850
+ }
10851
+ }
10852
+
10761
10853
  // src/cli/commands/update.ts
10762
10854
  function selfUpgrade() {
10763
10855
  try {
@@ -10900,18 +10992,25 @@ async function updateProject(projectRoot, dryRun = false) {
10900
10992
  result.skipped.push(`.claude/commands/ (${reapCmdFiles.length} unchanged)`);
10901
10993
  }
10902
10994
  await migrateLegacyFiles(paths, dryRun, result);
10903
- if (await needsMigration(paths)) {
10904
- if (!dryRun) {
10905
- const migrationResult = await migrateLineage(paths);
10906
- for (const m of migrationResult.migrated) {
10907
- result.updated.push(`[lineage] ${m}`);
10908
- }
10909
- for (const e of migrationResult.errors) {
10910
- result.removed.push(`[lineage error] ${e}`);
10911
- }
10912
- } else {
10913
- result.updated.push("[lineage] DAG migration pending (dry-run)");
10914
- }
10995
+ const currentVersion = "0.10.1";
10996
+ const migrationResult = await MigrationRunner.run(paths, currentVersion, dryRun);
10997
+ for (const m of migrationResult.migrated) {
10998
+ result.updated.push(`[migration] ${m}`);
10999
+ }
11000
+ for (const s of migrationResult.skipped) {
11001
+ result.skipped.push(`[migration] ${s}`);
11002
+ }
11003
+ for (const e of migrationResult.errors) {
11004
+ result.removed.push(`[migration error] ${e}`);
11005
+ }
11006
+ if (migrationResult.errors.length > 0 && config?.autoIssueReport) {
11007
+ try {
11008
+ const { execSync: execSync3 } = await import("child_process");
11009
+ const errorSummary = migrationResult.errors.join("\\n");
11010
+ const title = `Migration failure: ${migrationResult.fromVersion} → ${migrationResult.toVersion}`;
11011
+ const body = `## Migration Error\\n\\nFrom: ${migrationResult.fromVersion}\\nTo: ${migrationResult.toVersion}\\n\\n### Errors\\n\\n${errorSummary}`;
11012
+ execSync3(`gh issue create --repo c-d-cc/reap --title "${title}" --label "auto-reported,migration" --body "${body}"`, { encoding: "utf-8", timeout: 15000, stdio: "pipe" });
11013
+ } catch {}
10915
11014
  }
10916
11015
  }
10917
11016
  return result;
@@ -11070,7 +11169,7 @@ async function fixProject(projectRoot) {
11070
11169
  // src/cli/index.ts
11071
11170
  init_fs();
11072
11171
  import { join as join12 } from "path";
11073
- program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.9.1");
11172
+ program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.10.1");
11074
11173
  program.command("init").description("Initialize a new REAP project (Genesis)").argument("[project-name]", "Project name (defaults to current directory name)").option("-m, --mode <mode>", "Entry mode: greenfield, migration, adoption", "greenfield").option("-p, --preset <preset>", "Bootstrap with a genome preset (e.g., bun-hono-react)").action(async (projectName, options) => {
11075
11174
  try {
11076
11175
  const cwd = process.cwd();
@@ -46,7 +46,7 @@ description: "REAP Back — Return to a previous lifecycle stage"
46
46
  ```
47
47
 
48
48
  ### Hook Execution (Regression)
49
- 7. Scan `.reap/hooks/` for files matching `onRegression.*`
49
+ 7. Scan `.reap/hooks/` for files matching `onLifeRegretted.*`
50
50
  - For each matched file (sorted by `order` from frontmatter, then alphabetically):
51
51
  1. Read the frontmatter (`condition`, `order`)
52
52
  2. Evaluate `condition` by running `.reap/hooks/conditions/{condition}.sh` (exit 0 = met, non-zero = skip):
@@ -81,10 +81,10 @@ Do NOT finalize Genome changes without running Validation Commands.
81
81
  a. **Describe the pattern**: "최근 N개 generation에서 '[작업 설명]'이 반복적으로 수행되었습니다."
82
82
  b. **Ask if it should be a hook**: "이 작업을 hook으로 자동화할까요? (yes/no)"
83
83
  c. If yes, ask **event**: "어떤 이벤트에서 실행할까요?"
84
- - `onGenerationComplete` — generation 완료 후
85
- - `onStageTransition` — stage 전환 시
86
- - `onGenerationStart` — generation 시작 시
87
- - `onRegression` — stage 회귀 시
84
+ - `onLifeCompleted` — generation 완료 후
85
+ - `onLifeTransited` — stage 전환 시
86
+ - `onLifeStarted` — generation 시작 시
87
+ - `onLifeRegretted` — stage 회귀 시
88
88
  d. Ask **condition**: "실행 조건은 무엇인가요?"
89
89
  - `always` — 항상
90
90
  - `has-code-changes` — src/ 변경이 있을 때
@@ -82,7 +82,7 @@ For command-name topics: read `reap.{name}.md` from the same directory as this f
82
82
  - **backlog** — `.reap/life/backlog/`. genome-change, environment-change, task. status: pending/consumed. consumed → lineage, pending → 이월.
83
83
  - **strict** — `strict: true`: no generation = 코드 수정 차단, non-implementation = 차단, implementation = plan scope만. Escape: "override"/"bypass strict".
84
84
  - **agents** — AgentAdapter 추상화. auto-detect (Claude Code, OpenCode). config.yml `agents` 오버라이드.
85
- - **hooks** — config.yml: onGenerationStart, onStageTransition, onGenerationComplete, onRegression. command/prompt 타입.
85
+ - **hooks** — config.yml: onLifeStarted, onLifeTransited, onLifeCompleted, onLifeRegretted. command/prompt 타입.
86
86
  - **config** — `.reap/config.yml`: version, project, entryMode, strict, language, agents, autoUpdate, hooks.
87
87
  - **evolve** — `/reap.evolve`: 전체 lifecycle 자율 실행. 사람 확인 없이 objective~completion 순차 진행.
88
88
  - **regression** — `/reap.back`: 이전 stage 회귀. timeline + artifact에 Regression 섹션 기록.
@@ -23,8 +23,17 @@ This command is the **ONLY legitimate way** to advance the lifecycle stage. All
23
23
  - Immediately create the next stage's artifact file from template (empty, ready to fill)
24
24
 
25
25
  ### Hook Execution (Stage Transition)
26
- - Scan `.reap/hooks/` for files matching `onStageTransition.*`
27
- - For each matched file (sorted by `order` from frontmatter, then alphabetically):
26
+ Execute two sets of hooks in order:
27
+
28
+ 1. **Stage-specific hook** — based on the stage that just completed:
29
+ - objective → planning: `onLifeObjected.*`
30
+ - planning → implementation: `onLifePlanned.*`
31
+ - implementation → validation: `onLifeImplemented.*`
32
+ - validation → completion: `onLifeValidated.*`
33
+
34
+ 2. **Generic transition hook** — `onLifeTransited.*` (fires on every transition)
35
+
36
+ For each matched file (sorted by `order` from frontmatter, then alphabetically):
28
37
  1. Read the frontmatter (`condition`, `order`)
29
38
  2. Evaluate `condition` by running `.reap/hooks/conditions/{condition}.sh` (exit 0 = met, non-zero = skip):
30
39
  - If `condition` is absent: treat as `always`
@@ -64,7 +73,7 @@ This command is the **ONLY legitimate way** to advance the lifecycle stage. All
64
73
  - If there are no code changes (REAP-only generation), use `chore(reap): [goal summary]`
65
74
 
66
75
  ### Hook Execution (Generation Complete)
67
- - Scan `.reap/hooks/` for files matching `onGenerationComplete.*`
76
+ - Scan `.reap/hooks/` for files matching `onLifeCompleted.*`
68
77
  - For each matched file (sorted by `order` from frontmatter, then alphabetically):
69
78
  1. Read the frontmatter (`condition`, `order`)
70
79
  2. Evaluate `condition` by running `.reap/hooks/conditions/{condition}.sh` (exit 0 = met, non-zero = skip):
@@ -41,7 +41,7 @@ description: "REAP Start — Start a new Generation"
41
41
  7. Immediately create `.reap/life/01-objective.md` from the artifact template with the Goal section filled in
42
42
 
43
43
  ### Hook Execution (Generation Start)
44
- 8. Scan `.reap/hooks/` for files matching `onGenerationStart.*`
44
+ 8. Scan `.reap/hooks/` for files matching `onLifeStarted.*`
45
45
  - For each matched file (sorted by `order` from frontmatter, then alphabetically):
46
46
  1. Read the frontmatter (`condition`, `order`)
47
47
  2. Evaluate `condition` by running `.reap/hooks/conditions/{condition}.sh` (exit 0 = met, non-zero = skip):
@@ -110,19 +110,18 @@ Hooks are defined as individual files in `.reap/hooks/` with the naming conventi
110
110
 
111
111
  ```
112
112
  .reap/hooks/
113
- ├── onGenerationComplete.version-bump.md
114
- ├── onGenerationComplete.reap-update.sh
115
- ├── onGenerationComplete.docs-update.md
116
- └── onGenerationComplete.release-notes.md
113
+ ├── onLifeCompleted.reap-update.sh
114
+ ├── onLifeCompleted.docs-update.md
115
+ ├── onLifeImplemented.lint-check.sh
116
+ └── onMergeMated.notify.md
117
117
  ```
118
118
 
119
119
  File naming: `{event}.{name}.{extension}`
120
- - Event: onGenerationStart, onStageTransition, onGenerationComplete, onRegression
121
120
  - Extension: `.md` (AI prompt) or `.sh` (shell script)
121
+ - Frontmatter: `condition` (default: `always`), `order` (default: 50, lower runs first)
122
122
 
123
- Frontmatter (`.md` files) or comment headers (`.sh` files):
124
- - `condition`: name of a script in `.reap/hooks/conditions/` (default: `always`)
125
- - `order`: execution order within the same event (default: 50, lower runs first)
123
+ Normal events: `onLifeStarted`, `onLifeObjected`, `onLifePlanned`, `onLifeImplemented`, `onLifeValidated`, `onLifeCompleted`, `onLifeTransited`, `onLifeRegretted`
124
+ Merge events: `onMergeStarted`, `onMergeDetected`, `onMergeMated`, `onMergeMerged`, `onMergeSynced`, `onMergeValidated`, `onMergeCompleted`, `onMergeTransited`
126
125
 
127
126
  ### Conditions
128
127
 
@@ -135,14 +134,13 @@ Default conditions (installed by `reap init`):
135
134
 
136
135
  Custom conditions: add any `.sh` script to `.reap/hooks/conditions/`. The hook's `condition` field matches the filename (without `.sh`).
137
136
 
138
- | Event | Trigger |
139
- |-------|---------|
140
- | `onGenerationStart` | After `/reap.start` creates a new generation |
141
- | `onStageTransition` | After `/reap.next` advances to the next stage |
142
- | `onGenerationComplete` | After `/reap.next` archives a completed generation (after commit) |
143
- | `onRegression` | After `/reap.back` returns to a previous stage |
137
+ ### Execution
144
138
 
145
- Hooks are executed by the AI agent by scanning `.reap/hooks/` for files matching the current event.
139
+ Hooks are executed by the AI agent by scanning `.reap/hooks/` for files matching the current event:
140
+ - `.md` files: read as AI prompt and follow the instructions
141
+ - `.sh` files: run as shell script in the project root directory
142
+ - Within the same event, hooks run in `order` (lower first), then alphabetically
143
+ - `onLifeCompleted`/`onMergeCompleted` hooks run after git commit — changes are uncommitted
146
144
 
147
145
  ## Multi-Agent Support
148
146
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-d-cc/reap",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "Recursive Evolutionary Autonomous Pipeline — AI and humans evolve software across generations",
5
5
  "type": "module",
6
6
  "license": "MIT",