@c-d-cc/reap 0.16.6 → 0.17.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.
@@ -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.
@@ -302,6 +302,84 @@ All REAP interactions go through `/reap.*` slash commands. These are the primary
302
302
  - `reap cruise <count>` — Set cruise mode (pre-approve N generations for autonomous execution)
303
303
  - `reap update` — Update project structure to match current REAP version (v0.15 migrate, v0.16 sync)
304
304
  - `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)
305
+ - `reap daemon status|stop|index|query` — Inspect or control the local code-intelligence daemon (see § Code Intelligence below)
306
+
307
+ ## Code Intelligence (Daemon)
308
+
309
+ 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.
310
+
311
+ ### Opt-in
312
+
313
+ Daemon integration is opt-in via `.reap/config.yml`:
314
+
315
+ ```yaml
316
+ daemon: true
317
+ ```
318
+
319
+ 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.
320
+
321
+ ### Auto-trigger points
322
+
323
+ | Lifecycle moment | What runs |
324
+ |---|---|
325
+ | `reap run start` (generation created) | `ensureRegistered` + full `triggerIndexing` |
326
+ | `reap run learning` (work phase) | `ensureRegistered` + `triggerIndexing` (keeps graph fresh before exploration) |
327
+ | `reap run implementation` (complete phase) | `triggerIndexing` (so validation/evaluator see the just-written code) |
328
+ | `reap run completion` (commit phase, post-archive) | `triggerIndexing` (graph reflects the committed state for the next generation) |
329
+
330
+ All four call sites silent-fail when the daemon process is unreachable. The CLI lifecycle is never blocked by a daemon problem.
331
+
332
+ ### Querying the daemon
333
+
334
+ Always verify the daemon is alive before querying — otherwise skip silently:
335
+
336
+ ```bash
337
+ curl -sf http://127.0.0.1:17224/health || echo "daemon down"
338
+ ```
339
+
340
+ Look up the current project's ID (set `CWD` to your project path):
341
+
342
+ ```bash
343
+ PROJECT_ID=$(curl -s http://127.0.0.1:17224/projects \
344
+ | jq -r --arg p "$CWD" '.data[] | select(.path==$p) | .id')
345
+ ```
346
+
347
+ Common queries:
348
+
349
+ ```bash
350
+ # Symbol search by name (function, class, type, etc.)
351
+ curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/symbols?q=consumeBacklog"
352
+
353
+ # Callers of a specific symbol
354
+ curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/symbols/<symbol-id>/callers"
355
+
356
+ # Callees of a specific symbol
357
+ curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/symbols/<symbol-id>/callees"
358
+
359
+ # Impact (blast radius) of a file change
360
+ curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/impact?file=src/core/lifecycle.ts"
361
+
362
+ # Project status — includes lastIndexedAt and lastIndexedCommit (gen-068)
363
+ curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/status"
364
+ ```
365
+
366
+ ### Index staleness
367
+
368
+ `/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:
369
+
370
+ ```bash
371
+ INDEXED=$(curl -s "http://127.0.0.1:17224/projects/$PROJECT_ID/status" | jq -r '.data.lastIndexedCommit // "none"')
372
+ HEAD=$(git rev-parse HEAD)
373
+ [ "$INDEXED" = "$HEAD" ] && echo "fresh" || echo "stale — trigger reindex"
374
+ ```
375
+
376
+ 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.
377
+
378
+ ### When to use daemon vs filesystem search
379
+
380
+ - **Daemon-first**: symbol definition lookup, caller/callee traversal, multi-file impact analysis.
381
+ - **Filesystem-first (Grep/Glob)**: literal string search, comment search, files with no parser support, daemon down.
382
+ - The two are complementary — symbol-graph queries return file:line positions you can `Read` immediately.
305
383
 
306
384
  ## AI Client Support
307
385
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-d-cc/reap",
3
- "version": "0.16.6",
3
+ "version": "0.17.0",
4
4
  "description": "Recursive Evolutionary Autonomous Pipeline — AI and humans evolve software across generations",
5
5
  "license": "MIT",
6
6
  "author": "HyeonIL Choi <hichoi@c-d.cc> (C to D)",