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). The artefact is capped at 32 KB with Layers 1 and 5 protected from truncation; if protected content cannot fit, or an existing session has no room for a new block, the save fails without touching the existing bytes.
  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

Reporting the result

Apply Human Outcome Reporting before a human-facing update or result. Explain the user-visible outcome, the original conditions, checks and evidence, and open limitations. A stage result does not mean the entire task is complete. Keep exact protocols and technical records intact. To explain again without continuing work, use /dr-explain.