SIGN IN SIGN UP

fix: [ENG-2858] address PR review feedback on tool-mode dream

P1 / correctness (from auto-review + codex bot):

- undo.ts docstring: removed false claim that undo "rolls back curate
  writes via review-backup". Reality: undoLastDream restores finalize
  archives and legacy CONSOLIDATE/SYNTHESIZE ops, but curate writes
  emitted between scan and finalize live in independent curate-log
  entries and must be undone via `brv review reject <taskId>`.

- dream cancel text: same correction. Previously pointed users at
  `brv dream undo` to roll back curate writes; this is wrong and
  dangerous — undo would revert an unrelated prior dream while leaving
  the curate writes from the cancelled session in place.

- finalize required-one error: dropped the "use --archive ""..." hint.
  Empty string is falsy and the same guard rejected it, so the hint was
  a paradox.

- scan + finalize text renderers: surface daemon-side {status:'error',
  error:'...'} payloads as error messages instead of printing a normal
  "Archived: 0" / empty candidate summary that automation can read as
  success.

- agent-process: gate `dream-finalize` and `dream-scan` on
  postWorkRegistry.awaitProject(projectPath) so they don't race against
  a prior curate's detached Phase 4 _index.md rebuild. finalize renames
  files; scan reads the tree; both want a stable manifest snapshot.

P2 / consistency:

- agent-process dream-finalize task type: thread the incoming
  `trigger ?? 'cli'` into the DreamLogEntry instead of hardcoding 'cli',
  so an idle / MCP-driven finalize in a future revision is labelled
  correctly.

- prune-candidates: clamp `daysSinceModified` with `Math.max(0, ...)`
  so future-dated mtimes (clock skew, restored backups) don't sort
  ahead of present-day topics.

UX nits:

- scan text mode: list `synthesize` domains with topic counts instead
  of just the domain total. Previously the text output was strictly
  less actionable than JSON for the synthesize bucket.

- topic-loader: corrected the dot-dir-skip comment. `.archive` is a
  sibling of `context-tree/`, not inside it, so the previous comment
  was misleading.
N
Nguyễn Thuận Phát committed
a2e79acc3f7691cf2783d592b8685c038809dc15
Parent: c676195