Command Utility

/dr-save

Save current session state to disk before context is destroyed

Overview

/dr-save captures the current session to a self-contained markdown artefact at datarim/sessions/SESSION-{YYYYMMDD-HHMMSS}.session.md. It is designed to be run before closing the terminal, switching runtimes, or resetting the agent context — so work can resume with /dr-continue in a fresh window.

Usage

/dr-save

What It Does

  1. Collects 5-layer body — Layer 1 (git state per repo, non-truncatable), Layer 2 (active task snapshots), Layer 3 (related files), Layer 4 (open questions), Layer 5 (failed approaches, non-truncatable).
  2. Enforces claim provenance — every line containing pushed, merged, deployed, green, or passing must carry a verified: or assumed: tag. The writer rejects untagged claims with exit 1.
  3. Scans and redacts secrets — API key / credential patterns replaced with [REDACTED] before write (T-8).
  4. Writes atomically — mkdir-lock, atomic rename, chmod 600, append-only (a second /dr-save appends, never truncates prior blocks).
  5. Emits resume block — prints /dr-continue {SESSION-ID} as the copy-paste command (the session id selects exactly this saved session, so a bare /dr-continue cannot pick up another agent's session by modification time in a shared workspace), with a ↳ {TASK-ID} — {title} annotation and saved-time so a human recognises the work being resumed. Still warns against claude --continue / codex resume / Cursor history.

Cross-Runtime Support

Works identically in Claude Code, Codex CLI, and Cursor. The artefact is plain markdown — zero MCP dependency. All three runtimes read it via native file-read on resume.

Related