Feature dreams
Each feature gets its own dream that lives until its PR, or its whole PR stack, merges. Its lasting lessons then move into team rules on main, the way sleep turns the day’s memories into long-term memory.
Two kinds of memory#
| Long-term: team rules | Short-term: a feature dream | |
|---|---|---|
| What | Architecture, review learnings, conventions | The plan, decisions, dead ends, facts, file claims |
| Where | .claude/rules/ on main | .lucid/dreams/<feature>/, out of git |
| Lives | For good; changed through PRs | From lucid init until the feature’s PRs merge |
| Seen by | Every branch, every teammate | The feature’s branches, worktrees and agents |
| When the feature merges | Gets the lessons the feature taught | Is consolidated, proposes its lessons, then is archived |
Where a dream lives, and who sees it#
- One dream per feature.
lucid init(or/lucid:swarm) starts a dream named after the branch, in the main checkout’s.lucid/dreams/<feature>/. lucid keeps it out of git through.git/info/exclude, so it never shows ingit statusand can’t reach main by accident. - Every worktree of the clone shares it. A session in any worktree finds its branch’s dream. A worktree on another feature has its own, and nothing leaks between them.
- Workers follow their lead. A subagent works in its lead’s dream wherever its worktree is, including Claude Code’s isolated agent worktrees. lucid adds
--dream <feature>to everylucidcommand an agent runs. - Stacks share one dream. A branch cut from a feature branch that has commits joins that feature’s dream, so
feat-1→feat-2→feat-3share one plan with any stack tool.lucid dream use <name>joins a dream by hand.
When the feature merges#
At the start of each session, lucid checks whether a feature’s branches have all landed on the default branch. It checks ancestry for merge commits and fast-forwards, and asks gh about squash merges (cached for 10 minutes). When they have, the session is told so, and Claude runs /lucid:dream <feature> on its own:
- It consolidates the log: merges duplicates, re-checks stale entries and writes a digest.
- It proposes the lasting lessons as team rules, each with a kind:
architecture(how parts fit, and why),review(what review caught) orconvention(how code is written here). - It promotes them into
.claude/rules/<kind>/, shows you the diff, and asks before opening a PR to main. It never commits, pushes or opens a PR without a yes. lucid dream archive <feature>moves the dream to.lucid/dreams/.archive/.
Claude Code asks before writing into .claude/, so you’ll approve the rule files as they’re written. That’s the moment to read them.
Sharing a dream with teammates#
A dream is private to your clone by default. When several people build one feature, share it:
lucid dream share # move this feature's dream into this checkout's .lucid/dreams/<feature>/ and stop excluding itgit add .lucid/dreams && git commit -m "Share the feature dream"lucid dream unshare # private again; commit the removalA teammate who checks out the branch gets the same plan and log, and their lucid binds it automatically. Logs merge line by line, so two people appending never conflict. A shared dream reaches main with the feature, and the learnings PR removes it when it archives the dream.
Commands#
lucid init [--name N] # start this feature's dream (default name: the branch)lucid dream # list dreams: branches, shared, ended, merged; * marks yourslucid dream use NAME # this branch joins dream NAMElucid dream share|unshare # commit it on the branch for teammates, or make it private againlucid dream archive [NAME] # shelve a finished dreamlucid dream path # its folderlucid --dream NAME <cmd> # any command, on another feature's dreamUpgrading from 0.5#
A repo whose main checkout has a .lucid/log.jsonl keeps the single shared dream it had, unchanged. So do projects outside git, and LUCID_ROOT. To switch a repo to feature dreams, move .lucid/plan.md, log.jsonl and digest.md out (or git rm them), then run lucid init on a feature branch. Team rules work the same either way: see Team rules.
Seen in a live run#
This was headless claude -p on Haiku, with prompts that never mentioned lucid. A clone had a dream for feat-a, and a separate worktree held feat-b. Asked for two tasks done by two parallel subagents, Claude started a feat-b dream, and its workers claimed their files and logged decisions there. There were no permission prompts. git status showed only the code, and nothing from feat-a leaked in. After feat-b was merged, a new session on main was asked only “anything I should take care of?”. Claude consolidated the dream, proposed an architecture and a convention rule, and stopped to ask before writing the rule files or opening a PR.