Repository navigation
Dreaming mode: learn a person's work offline and suggest improvements - #300
Conversation
Per the issue, this is the spec-and-ADR-first step before any code. It adds only the design: - docs/decisions/0144-...md (status: proposed): how Dreaming mode keeps ADR 0063. Detection is code over code-derived columns and the model only words a suggestion from the evidence; a suggestion is a proposal shown with its evidence that does nothing until a person accepts it; suggestions live in their own table labelled model-authored and are never read as evidence by recall, the memory block, or messages; it is local, off by default, and a person starts it, with no model tool turning it on. - docs/superpowers/specs/2026-10-27-dreaming-mode-design.md: the shape, the detectors, the dream pass, storage, surfaces, and the tests it would get. No implementation is included. This is a person's call before any code, so the ADR is `proposed` and waiting on approval. Part of #296 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K7qLzxWmLqkYQQLiQqJtiu
Implements the design approved in the spec and ADR 0144 (now accepted).
Detection is code, and a suggestion is a proposal:
- zorp-agent/src/dream/: detectors over code-derived columns (recurring
requests, unfiled clusters, repeated failures), the dream pass, and the
Phraser trait. The default TemplatePhraser uses no model; phrase_prompt
builds the fenced, nonce-marked block a model-backed phraser would send.
accept() creates a project or writes an untrusted flavor through the same
code path a person uses.
- The suggestions table (session.rs): kind, evidence ids, model-authored
wording, and state (new/accepted/dismissed), kept apart from messages the
way display_title is from task.
- CLI: zorp-agent dreams, with run, accept, and dismiss.
- zorp-web: GET /api/dreams, POST /api/dreams/run, and
/api/dreams/:id/{accept,dismiss}, in every build, plus the "While you were
away" card in the sidebar. The background pass runs only when ZORP_DREAM is
set, beside the recall sweep.
Guards:
- no_tool_starts_a_dream_pass pins that no model tool runs a pass or acts on
a suggestion.
- tests/dream_isolation.rs pins that the wording never reaches messages,
task, or the recall and memory code.
- Listed in state.rs so it can be seen and cleared.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7qLzxWmLqkYQQLiQqJtiu
|
CI status on the current head ( The one non-green check is I can't re-run the job myself (the GitHub App lacks Generated by Claude Code Generated by Claude Code |
accept() looked a suggestion up in any state and always created its object, so a double click, a stale card, or a repeated CLI invocation created a second project or rewrote the flavor. Guard on the stored state (not the caller's possibly stale row): only a `new` suggestion can be accepted. Add a test for the stale-row path, and a test that a flavor description carrying a backslash, a quote and TOML brackets stays one key. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K7qLzxWmLqkYQQLiQqJtiu
# Conflicts: # docs/DECISIONS.md # zorp-agent/src/lib.rs # zorp-agent/src/session.rs # zorp-agent/src/state.rs
Closes #296.
Adds Dreaming mode: while zorp is idle it looks over how a person has worked and comes back with suggestions, each one a proposal backed by the exact conversations it came from and doing nothing until the person accepts it.
The first commit on this branch was the spec and ADR only, for approval (the issue's step 1). That was approved, and this adds the implementation. ADR 0144 is now
accepted.The rule it is designed around (ADR 0063)
zorp stores no sentence a model composed about the person, because the agent's guesses must never become its own evidence. Dreaming mode keeps that four ways, and each has a test:
zorp-agent/src/dream/detectors.rsruns over code-derived columns only (the verbatim first message, project membership, the code-derived exit status of the commands a conversation ran) and returns evidence rows, never prose — the same splitcritiqueand the aryabhatta detectors use. The three detectors are recurring requests, unfiled clusters, and repeated failures.TemplatePhraserwrites the suggestion from the pattern's own code-derived summary with no model call, so Dreaming mode works offline.phrase_promptbuilds the fenced, nonce-markeduserblock a model-backedPhraserwould send (the shapememoryandtitleuse); the trait is the seam, and none of the rules change with it. This is the one departure from the original sketch, called out in the ADR.messages,task, the recall index, or the memory block. They live in their ownsuggestionstable (kind, evidence ids, model-authored wording, statenew/accepted/dismissed), kept apart the waydisplay_titleis fromtask(ADR 0069).What's here
zorp-agent/src/dream/— detectors, the pass (run_pass, dedup by signature against every stored suggestion), thePhrasertrait +TemplatePhraser,gather(reads the local store), andaccept.zorp-agent/src/session.rs— thesuggestionstable and its methods.zorp-agent dreams(list),dreams run,dreams accept <id>,dreams dismiss <id>.zorp-web—GET /api/dreams,POST /api/dreams/run,POST /api/dreams/:id/accept,POST /api/dreams/:id/dismiss, in every build (a suggestion is a store row, like a project). The "While you were away" card in the sidebar (web/src/dreams.ts), with evidence links and Accept / Dismiss; the model-authored wording lands throughtextContent, labelled. The background pass is a worker beside the recall sweep, off unlessZORP_DREAMis set (ZORP_DREAM_SWEEP_SECSfor the interval).Tests
no_tool_starts_a_dream_pass(zorp-agent/src/agent.rs): no model tool runs a pass or acts on a suggestion.zorp-agent/tests/dream_isolation.rs: the wording never lands inmessagesortask, the recall and memory code never reads the suggestions table, and a dismissed pattern is not raised again.web/test/dreams.test.ts(the wording is never markup; the kind is said in code; evidence opens the cited conversation).zorp-agent/src/state.rsso it can be seen and cleared.Where the issue and the code disagreed: the issue sketches a model phrasing every suggestion; the default here phrases in code (
TemplatePhraser) so the feature works offline, with a model-backed phraser as a drop-in behind thePhrasertrait. The ADR records this.Ran
cargo fmt --all,cargo build --workspace,cargo clippy --workspace --all-targets,cargo test -p zorp-agent,cargo test -p zorp-web, andnpm run check,npm test,npm run buildinweb/.The Mac app's native card for this is a follow-up (the desktop app mirrors the browser API; this adds the routes it would call).
Generated by Claude Code