/dreamlake Claude Code skill
Typing /dreamlake inside a running Claude Code session registers that session
with DreamLake before the model sees the prompt, prints the saved session ID
and the dl sessions control send recipe, and writes a private env file
that any other shell can source so its memo and artifact writes link to the
same session. The CLI side is dl sessions register --write-env
(registration and visibility); the
skill is one shell line around it.
Skills are owned by the public
dreamlake-skills repository
and this repository never generates them. Until the skill lands there, this
page is the spec: copy the block below to ~/.claude/skills/dreamlake/SKILL.md
(personal) or .claude/skills/dreamlake/SKILL.md (per project). It needs the
CLI release that ships --write-env and the CLAUDE_CODE_SESSION_ID fallback.
SKILL.md
How it works
- The
!`…`line is Claude Code's dynamic-context syntax: the command runs in the session's shell before the prompt reaches the model and its output replaces the placeholder. Claude Code exportsCLAUDE_CODE_SESSION_IDto the commands it runs; the fallback expression also honours an explicitCLAUDE_SESSION_ID. dl sessions registerposts the provider and native UUID to/terminal-sessions/register, which returns the existing saved row when one matches, so the line is safe to run on every invocation.--write-envwritesexport DREAMLAKE_TERMINAL_SESSION_ID='…'andexport DREAMLAKE_SESSION_NAMESPACE='…'with mode 600. The assignments are exported, sosource-ing the file passes the pair to everydreamlakeprocess that shell starts. That pair is the explicit saved-session context the CLI reads first, before any native id, so a shell that sources it links its writes without a lookup.- The plain (non-
--json) output is written for the model: saved ID, namespace, visibility, thecontrol sendandcontrol statusrecipes.
Codex mirror
Codex skills cannot run shell before the prompt. The Codex skill carries the
same text with an instruction block instead of the !`…` line: the model
runs dl sessions register --provider codex --session "$CODEX_THREAD_ID" --cwd "$PWD" --visibility private --write-env "$HOME/.dreamlake/sessions/$CODEX_THREAD_ID.env"
itself and reports the receipt. CODEX_THREAD_ID is the native id Codex
exports; the CLI already reads it for automatic affiliation.
Zero-typing variant: a SessionStart hook
To register every Claude Code session without typing anything, add a
SessionStart hook in ~/.claude/settings.json. Hooks receive the session id
on stdin as JSON, so the hook does not depend on the environment variable:
The || true keeps a logged-out CLI or an offline network from blocking the
session start; the skill remains the way to get the recipe printed on demand.
Verifying an installation
- In a Claude Code session, type
/dreamlake. The reply names a 24-hex saved ID and asessions control sendline. dl sessions show <saved-id> --namespace <ns>shows providerclaude, the native UUID andprivate.- Type
/dreamlakeagain: the same saved ID comes back. cat "$HOME/.dreamlake/sessions/<native-uuid>.env"holds the two variables and is mode600; in another terminal,sourceit and create a note:dl sessions resources <saved-id> --namespace <ns>lists that memo.- With
dl sessions serve --max-human-permission workspace-writerunning on the machine, record the level once, on a terminal:dl sessions control restart <saved-id> --permission workspace-write --raise --namespace <ns>(a registered session has no recorded level, and a runner refuses a turn without one). Thendl sessions control send <saved-id> "Summarize your state" --namespace <ns>returns a receipt with the session's reply (headless) ordelivered: true(tmux).