You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: [ENG-2697] correct dream.md sub-skill to match codebase
- Expand kind action notes (link/merge/prune/synthesize) with thresholds,
candidate shapes, and accurate `related=` ref convention from curate.md.
- Add sample scan + finalize JSON envelopes with all candidate fields.
- Describe `path-exists` as a writer response on curate continuation
(kickoff returns generate-html only; validation runs on the submitted HTML).
- Reframe undo: bit-exact restore of content + original mtime + sidecar
signals; `brv dream undo` takes no arguments.
- Note that `dream sessions` / `dream cancel` JSON envelopes carry a
`note` field disclosing v1 statelessness.
Copy file name to clipboardExpand all lines: src/server/templates/skill/dream.md
+72-10Lines changed: 72 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,12 +38,45 @@ brv dream scan --format json
38
38
39
39
Returns a `sessionId` (uuid) and `candidates` keyed by kind. Hold the `sessionId` until Phase 3.
40
40
41
-
| Kind | Meaning | How to act |
42
-
|---|---|---|
43
-
|`link`| BM25-similar topic pairs not yet cross-linked | Extend each topic's `related=` attribute on `<bv-topic>` with the partner's path (comma-separated `@domain/topic` refs, no `.html` extension), then re-call `brv curate` at each existing path. The `path-exists` kickoff branch returns `existingContent`; merge your additions in and continue with `--overwrite`. |
44
-
|`merge`| BM25 near-duplicates | Pick a survivor, author HTML combining both topic bodies, write via the same `brv curate``path-exists` / `--overwrite` flow at the survivor's existing path, then archive the loser in Phase 3. |
45
-
|`prune`| Low-importance or stale-mtime topics | Decide per candidate: archive in Phase 3, leave alone, or treat as a `merge` candidate against another topic. |
46
-
|`synthesize`| Per-domain topic groups plus existing synthesis topics | Author a new `<bv-topic>` at a fresh path under `synthesis/<slug>` and call `brv curate` — no `path-exists` branch applies because the path is new. |
41
+
-`link` — BM25-similar topic pairs not yet cross-linked. To act: extend each topic's `related=` attribute on `<bv-topic>` (comma-separated refs) with the partner's path, then re-call `brv curate` at each existing path. The documented convention is the bare `@domain/topic` form (see `curate.md` examples like `related="@security/cookies,@security/oauth"`); the topic loader normalizes by appending `.html` internally, so both `@security/oauth` and `@security/oauth.html` resolve to the same edge. Prefer bare to match the convention; if you copy a path verbatim from `dream scan` (which emits the `.html`-suffixed form), that also works. When you submit the authored HTML during the curate continuation step, the writer detects that the topic already exists and returns `kind: "path-exists"` with the topic's `existingContent`; merge your additions in and re-emit with `--overwrite` to apply the write.
42
+
-`merge` — BM25 near-duplicates. Pick a survivor, author HTML combining both topic bodies, write it via the same `brv curate``path-exists` / `--overwrite` flow at the survivor's existing path, then archive the loser via `brv dream finalize`. The writer normalizes the `<bv-topic path="...">` attribute idempotently — both `path="auth/jwt"` (bare convention) and `path="auth/jwt.html"` (the form `dream scan` emits) resolve to the same on-disk file at `auth/jwt.html` and trigger the path-exists guard identically. Either form is safe.
43
+
-`prune` — Low-importance (sidecar `importance < 35`) or stale-mtime (draft >60d / validated >120d) topics. Topics with `maturity: 'core'` are never surfaced. Each candidate carries `reason: 'low-importance' | 'stale-mtime' | 'both'`, `daysSinceModified`, and the full `signals` block. Decide per candidate: archive it via `brv dream finalize`, leave it alone, or treat it as a `merge` candidate against another topic.
44
+
-`synthesize` — Per-domain topic groups plus existing synthesis topics. To act: author a new `<bv-topic>` at a fresh path under `synthesis/<slug>` and call `brv curate` to write it — no `path-exists` branch applies because the path is new.
45
+
46
+
Sample scan envelope (top-level JSON object emitted by `--format json`):
Invoke `brv curate` (per `curate.md`) for each candidate you decide to act on. Keep the `sessionId` from Phase 1 — you need it for finalize.
57
90
58
-
For `link` and `merge` actions, the existing topic path returns `kind: "path-exists"`on curate kickoff. Read `existingContent`, merge with your additions, and continue the same curate session with `--overwrite`. Never shrink the topic — enrichment only; every prior fact stays.
91
+
For `link` and `merge` actions, the writer returns `kind: "path-exists"`when you submit the authored HTML during the curate continuation step (the kickoff step just hands you a `generate-html` prompt with no validation). Read `existingContent` from that error, merge with your additions, and continue the same curate session with `--overwrite`. Never shrink the topic — enrichment only; every prior fact stays.
59
92
60
93
### Phase 3 — Finalize
61
94
@@ -68,18 +101,47 @@ Archive paths MUST match exactly what `dream scan` emitted: full relative path u
68
101
-`--archive` and `--archive-file <path>` are mutually exclusive; exactly one is required.
69
102
- The archive list is capped at 200 entries per call; split into multiple finalize calls for larger batches.
70
103
104
+
Sample finalize response (top-level JSON object emitted by `--format json`):
`skipped` entries carry `{"path": "...", "reason": "already-archived|not-found|rename-failed|unsafe-path"}`. `logId` identifies the dream-log entry (only emitted when at least one path was archived); `brv dream undo` takes no arguments and always reverts the most recent finalize from the on-disk dream state.
116
+
71
117
### Undo The Most Recent Finalize
72
118
73
119
```bash
74
120
brv dream undo --format json
75
121
```
76
122
77
-
Restores archived topics to their original locations (content byte-identical; mtime resets to current time). Curate writes from Phase 2 are NOT rolled back by undo — use `brv review reject <taskId>` for those (see `review.md`).
123
+
Restores archived topics to their original locations bit-exact: content, original mtime, and sidecar runtime signals (importance / maturity / accessCount / etc.) are all restored. Pruned topics that re-qualify will re-surface on the next scan. Curate writes from Phase 2 are NOT rolled back by undo — use `brv review reject <taskId>` for those (see `review.md`).
124
+
125
+
### Worked Example — Prune The Stalest Topic (No Curate Detour)
126
+
127
+
```bash
128
+
# 1. Scan only prune candidates
129
+
brv dream scan --kinds prune --format json
130
+
# → response carries candidates.prune[]; pick the highest daysSinceModified entry,
131
+
# say "legacy/old-notes.html"
132
+
133
+
# 2. Archive it. sessionId from step 1 is opaque; pass any string in v1.
0 commit comments