@c-d-cc/reap 0.16.6 → 0.17.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.de.md +48 -0
- package/README.ja.md +48 -0
- package/README.ko.md +50 -0
- package/README.md +28 -0
- package/README.zh-CN.md +50 -0
- package/RELEASE_NOTICE.md +12 -0
- package/dist/cli/index.js +722 -496
- package/dist/templates/agents/reap-evaluate.md +21 -0
- package/dist/templates/agents/reap-evolve.md +49 -0
- package/dist/templates/migration/v0.17.1.md +56 -0
- package/dist/templates/reap-guide.md +170 -37
- package/package.json +1 -1
|
@@ -152,6 +152,27 @@ You evaluate the evolve agent's work, not your own. If asked to assess your own
|
|
|
152
152
|
- Pattern consistency with existing codebase
|
|
153
153
|
- No unintended side effects
|
|
154
154
|
4. Verify artifact completeness (all stages filled, no placeholders)
|
|
155
|
+
5. **Impact analysis via daemon (when `config.daemon: true`)** — for each
|
|
156
|
+
changed file in the diff, query the daemon's impact endpoint to
|
|
157
|
+
surface dependent files the builder may not have re-validated:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
curl -sf http://127.0.0.1:17224/health || exit 0 # skip if down
|
|
161
|
+
PROJECT_ID=$(curl -s http://127.0.0.1:17224/projects \
|
|
162
|
+
| jq -r --arg p "$PWD" '.data[] | select(.path==$p) | .id')
|
|
163
|
+
git diff --name-only HEAD~1..HEAD | while read f; do
|
|
164
|
+
curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/impact?file=$f"
|
|
165
|
+
done
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Cross-reference the daemon's `directFiles` / `indirectFiles` against
|
|
169
|
+
the validation artifact's test coverage. If indirect-impacted files
|
|
170
|
+
were not exercised by the test run, surface this as a concern.
|
|
171
|
+
Index staleness: check `lastIndexedCommit` from
|
|
172
|
+
`/projects/$PROJECT_ID/status` against `git rev-parse HEAD` —
|
|
173
|
+
trigger a re-index (`POST /projects/$PROJECT_ID/index`) if they
|
|
174
|
+
differ before relying on impact output. Daemon-down or
|
|
175
|
+
daemon-opted-out projects skip this step silently.
|
|
155
176
|
|
|
156
177
|
### Phase 3: Fitness Assessment
|
|
157
178
|
|
|
@@ -74,3 +74,52 @@ When REAP creates any file (artifacts, backlog, etc.) with template sections (`<
|
|
|
74
74
|
- Do NOT create backlog during adapt phase.
|
|
75
75
|
- Do NOT return to the parent agent before generation completion — handle user interactions within this session.
|
|
76
76
|
- tests/ is a git submodule — commit inside submodule first if modified.
|
|
77
|
+
|
|
78
|
+
## Code Intelligence (Daemon) — opt-in
|
|
79
|
+
|
|
80
|
+
REAP optionally integrates with a local code-intelligence daemon
|
|
81
|
+
(`localhost:17224`) that maintains a Tree-sitter symbol graph for the
|
|
82
|
+
project. When `config.daemon: true` is set, REAP auto-indexes at key
|
|
83
|
+
lifecycle moments (start, learning, implementation complete, completion
|
|
84
|
+
commit) and the daemon protocol section appears in your subagent prompt
|
|
85
|
+
and the SessionStart context. Use it to make exploration and impact
|
|
86
|
+
analysis faster.
|
|
87
|
+
|
|
88
|
+
### When to use the daemon
|
|
89
|
+
|
|
90
|
+
- **Learning stage** — find existing implementations by name before
|
|
91
|
+
reading source. Symbol search (`GET /projects/{id}/symbols?q=`)
|
|
92
|
+
returns file:line positions you can `Read` directly. Faster than
|
|
93
|
+
Grep for symbol-shaped queries (function/class/type names).
|
|
94
|
+
- **Implementation stage** — before editing a function, query its
|
|
95
|
+
callers (`GET /projects/{id}/symbols/{id}/callers`) to understand
|
|
96
|
+
the change's blast radius. Helps avoid breaking out-of-sight call
|
|
97
|
+
sites.
|
|
98
|
+
- **Validation stage** — for each changed file in your diff, query
|
|
99
|
+
`GET /projects/{id}/impact?file=<path>` to enumerate dependent
|
|
100
|
+
files. Cross-reference with your validation evidence.
|
|
101
|
+
|
|
102
|
+
### Protocol
|
|
103
|
+
|
|
104
|
+
Always probe first — daemon may be down or the user may not have
|
|
105
|
+
opted in:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
curl -sf http://127.0.0.1:17224/health || true # silent skip if down
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If healthy, look up the current project's ID once, then reuse it:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
PROJECT_ID=$(curl -s http://127.0.0.1:17224/projects \
|
|
115
|
+
| jq -r --arg p "$PWD" '.data[] | select(.path==$p) | .id')
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
See `~/.reap/reap-guide.md` § Code Intelligence (Daemon) for the full
|
|
119
|
+
query reference and staleness check protocol.
|
|
120
|
+
|
|
121
|
+
### Fallback behaviour
|
|
122
|
+
|
|
123
|
+
- Daemon down or `config.daemon !== true` → continue with normal
|
|
124
|
+
Read/Grep/Glob tools. The daemon is an accelerator, not a
|
|
125
|
+
requirement. Never block the lifecycle on a daemon problem.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# v0.17.1 — Vision Memory Content-Type Reorganization
|
|
2
|
+
|
|
3
|
+
## What changed
|
|
4
|
+
|
|
5
|
+
Up through v0.17.0, REAP's vision memory tiers (`.reap/vision/memory/{shortterm,midterm,longterm}.md`) were classified by **lifespan** — "how long will this live?" That heuristic forced the AI to predict the future and led to repeated misclassification + bloat.
|
|
6
|
+
|
|
7
|
+
Starting with v0.17.1, tiers are classified by **content-type** — "what is this content for?" The decision is now mechanical and bloat-resistant.
|
|
8
|
+
|
|
9
|
+
| File | Role (new) | 1-line decision rule |
|
|
10
|
+
|------|------------|----------------------|
|
|
11
|
+
| `shortterm.md` | **Session handoff** — immediate context for the next session | "Is this needed right now?" |
|
|
12
|
+
| `midterm.md` | **Ongoing tracks** — multi-generation work in progress | "Is this an incomplete large track?" |
|
|
13
|
+
| `longterm.md` | **Design lessons** — recurring lessons worth re-reading | "Does this lesson prevent the next generation from making the same mistake?" |
|
|
14
|
+
|
|
15
|
+
A mandatory **reflect-phase pruning policy** was also added: shortterm is replaced (not appended) every generation, midterm sections get deleted on track completion (key decisions promoted to longterm), and longterm gets periodic dedup vs genome.
|
|
16
|
+
|
|
17
|
+
See `~/.reap/reap-guide.md` § Memory and `.reap/genome/evolution.md` § Vision 활용 원칙 for the full rules.
|
|
18
|
+
|
|
19
|
+
## Required actions for the AI agent
|
|
20
|
+
|
|
21
|
+
Apply these in order. Do **not** treat this as a code change — it is an artifact reorganization. No source code is touched.
|
|
22
|
+
|
|
23
|
+
1. **Read** the current state of all three memory files:
|
|
24
|
+
- `.reap/vision/memory/shortterm.md`
|
|
25
|
+
- `.reap/vision/memory/midterm.md`
|
|
26
|
+
- `.reap/vision/memory/longterm.md`
|
|
27
|
+
|
|
28
|
+
2. **Reclassify each entry** using the new decision tree (apply top-to-bottom):
|
|
29
|
+
```
|
|
30
|
+
1. Is this needed in the next session immediately? → shortterm.md
|
|
31
|
+
2. Is this an ongoing, incomplete track or plan? → midterm.md
|
|
32
|
+
3. Is this a finished design lesson worth preserving? → longterm.md
|
|
33
|
+
4. Finished, no special lesson? → DELETE (lineage + git history preserve it)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
3. **Move misclassified entries** to the correct tier. Typical patterns to fix:
|
|
37
|
+
- "Will be useful eventually" / "background context" sitting in `longterm.md` but not driving any current behavior → delete
|
|
38
|
+
- Completed track summaries in `midterm.md` without a next step → delete (promote one-line lessons to `longterm.md` only if they prevent future mistakes)
|
|
39
|
+
- Stale session handoffs from earlier generations in `shortterm.md` → delete (shortterm is **replaced** every generation, not appended)
|
|
40
|
+
|
|
41
|
+
4. **Apply the size-bloat heuristics**:
|
|
42
|
+
- `longterm.md` should stay under ~30–50 lines. Over that = pruning was skipped.
|
|
43
|
+
- `midterm.md` should stay under ~50–70 lines. Over that = completed tracks weren't removed.
|
|
44
|
+
- `shortterm.md` should contain only the most recent 1–2 generations' handoff.
|
|
45
|
+
|
|
46
|
+
5. **Do NOT add new entries** during this migration. Goal is reorganization of what already exists. New lessons land in the next generation's normal reflect.
|
|
47
|
+
|
|
48
|
+
6. **Verify** the new classification by re-applying the decision tree to each entry one more time. If you can't justify keeping an entry under any of branches 1–3, delete it.
|
|
49
|
+
|
|
50
|
+
7. **Run** `reap update --mark-migrated` to record completion. This sets `lastMigratedVersion: 0.17.1` in `.reap/config.yml` so this instruction stops surfacing in subsequent SessionStart loads and `reap update` runs.
|
|
51
|
+
|
|
52
|
+
## Reference
|
|
53
|
+
|
|
54
|
+
- `~/.reap/reap-guide.md` § Memory — the canonical 3-tier definition + decision tree + pruning policy
|
|
55
|
+
- `.reap/genome/evolution.md` § Vision 활용 원칙 — same content in Korean (when project language is Korean)
|
|
56
|
+
- REAP gen-070 lineage entry — the generation that established this convention, with worked examples of compression (255 → 49 lines in this very project's longterm)
|
|
@@ -22,53 +22,72 @@ REAP consists of four interconnected layers:
|
|
|
22
22
|
|
|
23
23
|
## Memory
|
|
24
24
|
|
|
25
|
-
Memory is a free-form recording system under `.reap/vision/memory/` where AI can persist context across sessions and generations. Unlike Genome (which has modification constraints) or Lineage (which gets compressed), Memory is always accessible and freely writable.
|
|
25
|
+
Memory is a free-form recording system under `.reap/vision/memory/` where AI can persist project context across sessions and generations. Unlike Genome (which has modification constraints) or Lineage (which gets compressed), Memory is always accessible and freely writable.
|
|
26
26
|
|
|
27
|
-
### 3-Tier Structure
|
|
27
|
+
### 3-Tier Structure — content-type based
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|------|------|----------|---------|
|
|
31
|
-
| **Longterm** | `longterm.md` | Project lifetime | Lessons that bear repeating, recurring patterns, decision rationale, architecture choice reasons |
|
|
32
|
-
| **Midterm** | `midterm.md` | Multiple generations | Ongoing large task context, multi-generation plans, progress tracking |
|
|
33
|
-
| **Shortterm** | `shortterm.md` | 1-2 sessions | Next session handoff, immediate context to pass forward, unfinished discussions |
|
|
29
|
+
Tiers are classified by **what the content is for** (content-type), NOT by how long it will live (lifespan). Lifespan requires predicting the future, which the AI can't reliably do — that judgment burden has historically led to misclassification and bloat.
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
| File | Role | 1-line decision rule |
|
|
32
|
+
|------|------|----------------------|
|
|
33
|
+
| `shortterm.md` | **Session handoff** — immediate context to pass to the next session | "Is this needed right now?" |
|
|
34
|
+
| `midterm.md` | **Ongoing tracks** — multi-generation work in progress | "Is this an incomplete large track?" |
|
|
35
|
+
| `longterm.md` | **Design lessons** — recurring lessons worth re-reading | "Does this lesson prevent the next generation from making the same mistake?" |
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
- **AI discretion**: Content and timing are the AI's judgment. No mandatory updates
|
|
39
|
-
- **Tier fitness**: Place content in the tier matching its expected lifespan. Promote/demote between tiers as relevance changes
|
|
40
|
-
- **Keep concise**: Memory should be scannable, not exhaustive. Prefer bullet points over paragraphs
|
|
41
|
-
- **Empty is normal**: Memory files may be empty — this is a valid state
|
|
42
|
-
- **Git-committed**: Memory is committed with the project, accessible to any AI agent
|
|
37
|
+
### Memory Classification Decision Tree (mandatory for AI)
|
|
43
38
|
|
|
44
|
-
|
|
39
|
+
When you have something to write to memory, apply top-to-bottom:
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
```
|
|
42
|
+
1. Is this needed in the next session immediately?
|
|
43
|
+
→ Yes: shortterm.md
|
|
44
|
+
|
|
45
|
+
2. Is this an ongoing, incomplete track or plan?
|
|
46
|
+
→ Yes: midterm.md
|
|
47
|
+
|
|
48
|
+
3. Is this a finished design lesson worth preserving?
|
|
49
|
+
→ Yes: longterm.md
|
|
50
|
+
|
|
51
|
+
4. Is this finished with no special lesson?
|
|
52
|
+
→ Do NOT record (memory keeps no junk; lineage/git history preserves it)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Important**: Do not stash "might-be-useful" notes in longterm. If it disappears, it's still in lineage and git history.
|
|
56
|
+
|
|
57
|
+
### Memory Pruning Policy — mandatory in reflect phase
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
During `reap run completion --phase reflect`, the AI **must** perform cleanup:
|
|
51
60
|
|
|
52
|
-
**Shortterm
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- Current backlog state snapshot
|
|
61
|
+
**Shortterm — every generation, mandatory**:
|
|
62
|
+
- Delete previous handoff items that are "already acted on"
|
|
63
|
+
- **Replace** (overwrite) with the new generation's handoff. No accumulation.
|
|
64
|
+
- Result: shortterm.md stays within "last 1~2 generations of content".
|
|
57
65
|
|
|
58
|
-
**Midterm
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
66
|
+
**Midterm — at track completion**:
|
|
67
|
+
- When a track completes, **promote** its key decisions to longterm and **delete** the section from midterm
|
|
68
|
+
- Decision rule: "Does this track have a next step?" — No → delete
|
|
69
|
+
- Result: midterm.md stays within "tracks that are alive right now".
|
|
62
70
|
|
|
63
|
-
**Longterm
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
71
|
+
**Longterm — periodic (every ~10 generations or when bloat is detected in reflect)**:
|
|
72
|
+
- If a section is already documented in genome (application.md / evolution.md), it's a **duplicate → delete**
|
|
73
|
+
- If early project transition context (e.g., v0.X → v0.Y differences) is no longer a behavioral guide → **delete**
|
|
74
|
+
- Decision rule: "Without this lesson, would the next agent make the same mistake?" — No → delete
|
|
75
|
+
- Result: longterm.md stays within "lessons that still drive behavior today".
|
|
67
76
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
77
|
+
### Do NOT write to memory
|
|
78
|
+
|
|
79
|
+
- Code change details (`environment/summary.md` handles this)
|
|
80
|
+
- Test numbers, run logs (artifact handles this)
|
|
81
|
+
- Principles already stated in genome (no duplication)
|
|
82
|
+
- Generation-specific debug logs (lineage preserves them; don't crowd memory)
|
|
83
|
+
|
|
84
|
+
### Memory Usage — freedom with responsibility
|
|
85
|
+
|
|
86
|
+
- **Free access**: Read and write at any time — no permission needed
|
|
87
|
+
- **Cross-tier promotion/demotion is encouraged**: a shortterm note that evolves into a track moves to midterm; a midterm track that completes leaves only its lesson in longterm
|
|
88
|
+
- **Architecture changes must propagate**: when adding new features/structure, update evolution.md / application.md / memory together
|
|
89
|
+
- **Bloat is a failure signal**: if longterm exceeds ~30~50 lines or midterm exceeds ~50~70 lines, pruning was skipped. Clean up in the next reflect.
|
|
90
|
+
- **Empty is normal**: any memory file may be empty — that is a valid state
|
|
72
91
|
|
|
73
92
|
## .reap/ Structure
|
|
74
93
|
|
|
@@ -300,8 +319,122 @@ All REAP interactions go through `/reap.*` slash commands. These are the primary
|
|
|
300
319
|
- `reap make backlog --type <type> --title <title> [--body <body>] [--priority <priority>]` — Create backlog item (type: genome-change, environment-change, task)
|
|
301
320
|
- `reap make hook --event <event> --name <name> [--type md|sh] [--condition <condition>] [--order <order>]` — Create hook file with correct naming and frontmatter
|
|
302
321
|
- `reap cruise <count>` — Set cruise mode (pre-approve N generations for autonomous execution)
|
|
303
|
-
- `reap update` — Update project structure to match current REAP version (v0.15 migrate, v0.16 sync)
|
|
322
|
+
- `reap update` — Update project structure to match current REAP version (v0.15 migrate, v0.16 sync). When the project's `lastMigratedVersion` lags behind the installed package, pending per-version migration notes are surfaced in `context.pendingMigrations` (see § Migration Instruction Layer).
|
|
323
|
+
- `reap update --mark-migrated` — Mark this project as having applied all pending migration notes up to the current package version (gen-071 migration layer).
|
|
304
324
|
- `reap dump-state [--stdout] [--silent]` — Dump dynamic REAP context to `.reap/.session-state.md` (used by OpenCode plugin; useful for any external tool that needs current generation state)
|
|
325
|
+
- `reap daemon status|stop|index|query` — Inspect or control the local code-intelligence daemon (see § Code Intelligence below)
|
|
326
|
+
|
|
327
|
+
## Code Intelligence (Daemon)
|
|
328
|
+
|
|
329
|
+
REAP ships with a local code-intelligence daemon (`@c-d-cc/reap-daemon`) that runs on `localhost:17224`. It maintains a Tree-sitter–backed symbol graph (functions, classes, types, calls, imports) persisted to SQLite, supports incremental updates, and exposes a small HTTP API for symbol search, caller/callee lookup, and change-impact analysis.
|
|
330
|
+
|
|
331
|
+
### Opt-in
|
|
332
|
+
|
|
333
|
+
Daemon integration is opt-in via `.reap/config.yml`:
|
|
334
|
+
|
|
335
|
+
```yaml
|
|
336
|
+
daemon: true
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
When opted in, REAP lifecycle commands (`start`, `learning`, `implementation complete`, `completion commit`) automatically register the project and trigger indexing. When omitted or `false`, daemon-related CLI behaviour is a no-op — byte-identical to projects that have never enabled it.
|
|
340
|
+
|
|
341
|
+
### Auto-trigger points
|
|
342
|
+
|
|
343
|
+
| Lifecycle moment | What runs |
|
|
344
|
+
|---|---|
|
|
345
|
+
| `reap run start` (generation created) | `ensureRegistered` + full `triggerIndexing` |
|
|
346
|
+
| `reap run learning` (work phase) | `ensureRegistered` + `triggerIndexing` (keeps graph fresh before exploration) |
|
|
347
|
+
| `reap run implementation` (complete phase) | `triggerIndexing` (so validation/evaluator see the just-written code) |
|
|
348
|
+
| `reap run completion` (commit phase, post-archive) | `triggerIndexing` (graph reflects the committed state for the next generation) |
|
|
349
|
+
|
|
350
|
+
All four call sites silent-fail when the daemon process is unreachable. The CLI lifecycle is never blocked by a daemon problem.
|
|
351
|
+
|
|
352
|
+
### Querying the daemon
|
|
353
|
+
|
|
354
|
+
Always verify the daemon is alive before querying — otherwise skip silently:
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
curl -sf http://127.0.0.1:17224/health || echo "daemon down"
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Look up the current project's ID (set `CWD` to your project path):
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
PROJECT_ID=$(curl -s http://127.0.0.1:17224/projects \
|
|
364
|
+
| jq -r --arg p "$CWD" '.data[] | select(.path==$p) | .id')
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Common queries:
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Symbol search by name (function, class, type, etc.)
|
|
371
|
+
curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/symbols?q=consumeBacklog"
|
|
372
|
+
|
|
373
|
+
# Callers of a specific symbol
|
|
374
|
+
curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/symbols/<symbol-id>/callers"
|
|
375
|
+
|
|
376
|
+
# Callees of a specific symbol
|
|
377
|
+
curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/symbols/<symbol-id>/callees"
|
|
378
|
+
|
|
379
|
+
# Impact (blast radius) of a file change
|
|
380
|
+
curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/impact?file=src/core/lifecycle.ts"
|
|
381
|
+
|
|
382
|
+
# Project status — includes lastIndexedAt and lastIndexedCommit (gen-068)
|
|
383
|
+
curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/status"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Index staleness
|
|
387
|
+
|
|
388
|
+
`/projects/:id/status` returns `lastIndexedCommit` — the `git rev-parse HEAD` at the moment of the most recent successful indexing. To check whether the index is stale before a query:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
INDEXED=$(curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/status" | jq -r '.data.lastIndexedCommit // "none"')
|
|
392
|
+
HEAD=$(git rev-parse HEAD)
|
|
393
|
+
[ "$INDEXED" = "$HEAD" ] && echo "fresh" || echo "stale — trigger reindex"
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
If stale, you can request a re-index with `curl -X POST "http://127.0.0.1:17224/projects/$PROJECT_ID/index"`. The lifecycle auto-triggers above usually keep the index fresh; manual re-index is only needed for between-stage tweaks or out-of-band edits.
|
|
397
|
+
|
|
398
|
+
### When to use daemon vs filesystem search
|
|
399
|
+
|
|
400
|
+
- **Daemon-first**: symbol definition lookup, caller/callee traversal, multi-file impact analysis.
|
|
401
|
+
- **Filesystem-first (Grep/Glob)**: literal string search, comment search, files with no parser support, daemon down.
|
|
402
|
+
- The two are complementary — symbol-graph queries return file:line positions you can `Read` immediately.
|
|
403
|
+
|
|
404
|
+
## Migration Instruction Layer
|
|
405
|
+
|
|
406
|
+
When REAP itself evolves (e.g. memory tier semantics change in v0.17.1), existing user projects need to reorganize their artifacts to match the new conventions. The migration instruction layer (gen-071) closes this gap.
|
|
407
|
+
|
|
408
|
+
### How it works
|
|
409
|
+
|
|
410
|
+
1. Each REAP release that requires user-side reorganization ships a `vX.Y.Z.md` note at `src/templates/migration/` (bundled to `dist/templates/migration/` on install).
|
|
411
|
+
2. `config.yml` carries `lastMigratedVersion: "X.Y.Z"` — the most recent REAP version this project has acknowledged.
|
|
412
|
+
3. On every `reap update` and on every SessionStart (`reap load-context`), REAP compares `lastMigratedVersion` against the installed package version. Any `vX.Y.Z.md` file whose version falls in the gap (`lastMigratedVersion < v <= packageVersion`) is surfaced to the agent.
|
|
413
|
+
4. After the agent applies the listed reorganizations, it runs `reap update --mark-migrated`. This sets `lastMigratedVersion` to the current package version and the notes stop surfacing.
|
|
414
|
+
|
|
415
|
+
### Where pending migrations appear
|
|
416
|
+
|
|
417
|
+
- `reap update` output: `context.pendingMigrations: [{ version, instructions }, ...]` + a summary line in `message`.
|
|
418
|
+
- SessionStart context: a `# Pending Migrations` section in the additionalContext (Claude Code hookSpecificOutput / OpenCode instructions).
|
|
419
|
+
- `.reap/.session-state.md` sync dump (written by lifecycle commands): same section, byte-identical.
|
|
420
|
+
|
|
421
|
+
When `lastMigratedVersion >= packageVersion`, no section is added and output is byte-identical to pre-gen-071 behavior.
|
|
422
|
+
|
|
423
|
+
### Agent behavior
|
|
424
|
+
|
|
425
|
+
When you see a `# Pending Migrations` section:
|
|
426
|
+
|
|
427
|
+
1. Read each `## vX.Y.Z` subsection in order.
|
|
428
|
+
2. Apply the listed actions to the project's artifacts (memory, backlog, env, etc. — never to source code unless the note explicitly says so).
|
|
429
|
+
3. Once **all** pending migrations are applied, run `reap update --mark-migrated`. Do not call this halfway through — it marks every gap version as done.
|
|
430
|
+
4. Migration is best-effort and non-blocking. If you cannot apply a step (missing file, ambiguous instruction), record the partial state in the next reflect and skip `--mark-migrated` so the note re-surfaces in the next session.
|
|
431
|
+
|
|
432
|
+
### Authoring migration notes (REAP maintainers)
|
|
433
|
+
|
|
434
|
+
- File: `src/templates/migration/vX.Y.Z.md` (must match `^v\d+\.\d+\.\d+\.md$`).
|
|
435
|
+
- Audience: an AI agent that has *not* yet read the new REAP version's guide. Be explicit about what to read, what to change, and how to verify.
|
|
436
|
+
- Scope: artifact reorganization only by default. Source-code migrations belong in a separate generation, not in a migration note.
|
|
437
|
+
- Build is automatic — `scripts/build.sh` copies `src/templates/` wholesale to `dist/templates/`. No additional sync step.
|
|
305
438
|
|
|
306
439
|
## AI Client Support
|
|
307
440
|
|
package/package.json
CHANGED