opencode-simple: Command for Claude Code

.opencode/commands/save-session.md

save-session is a command for Claude Code, OpenCode from zhmxiaowo/opencode-simple. It costs 28 tokens per session (2,149 once invoked), scanned A, a copy of save-session, MIT.

A command that records the current coding session in a dated file so it can be continued later.

In plain words
What is it for?
Use it before closing a session, starting a fresh one, or handing work to a future session.
Why use it?
It prevents important decisions, changes, errors, and unfinished work from being lost when a session ends or runs out of context.

Command for Claude CodeOpenCode

Written for OpenCode and Claude Code: installed under .opencode/, but also a Claude Code command (commands/*.md). Also seen: reads .claude/ paths; mentions Claude Code.

This is zhmxiaowo/opencode-simple's own configuration. It tells Claude Code and OpenCode how to work on opencode-simple itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything opencode-simple configures →

Reuse

Borrowing it

Nothing to install: this file belongs to zhmxiaowo/opencode-simple. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/zhmxiaowo/opencode-simple/main/.opencode/commands/save-session.md
Clone the repo
git clone --depth 1 https://github.com/zhmxiaowo/opencode-simple

Made for: Claude Code, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for save-session

README.md
[![agentmods](https://agentmods.dev/badge/commands/zhmxiaowo/opencode-simple/save-session/github.svg)](https://agentmods.dev/commands/zhmxiaowo/opencode-simple/save-session)
Your own site
<a href="https://agentmods.dev/commands/zhmxiaowo/opencode-simple/save-session"><img src="https://agentmods.dev/badge/commands/zhmxiaowo/opencode-simple/save-session/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for save-session

Your own site · 80×15
<a href="https://agentmods.dev/commands/zhmxiaowo/opencode-simple/save-session"><img src="https://agentmods.dev/badge/commands/zhmxiaowo/opencode-simple/save-session.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,149 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 88% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.02149
Opus 5.5 $0.00011 $0.00860
Sonnet 5.5 $0.00006 $0.00430
Haiku 4.5 $0.00003 $0.00215

Measured 1mo ago against content hash f4a5799907d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

save-session scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

88% identical to save-session — 7 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.opencode/commands/save-session.md · 276 lines

How it starts

The opening of the file, as written. The whole thing — 276 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Save Session Command

Capture everything that happened in this session — what was built, what worked, what failed, what's left — and write it to a dated file so the next session can pick up exactly where this one left off.

When to Use

  • End of a work session before closing Claude Code
  • Before hitting context limits (run this first, then start a fresh session)
  • After solving a complex problem you want to remember
  • Any time you need to hand off context to a future session

Process

Step 1: Gather context

Before writing the file, collect:

  • Read all files modified during this session (use git diff or recall from conversation)
  • Review what was discussed, attempted, and decided
  • Note any errors encountered and how they were resolved (or not)
  • Check current test/build status if relevant

Step 2: Create the sessions folder if it doesn't exist

Create the canonical sessions folder in the user's Claude home directory:

mkdir -p ~/.claude/sessions

Step 3: Write the session file

Create ~/.claude/sessions/YYYY-MM-DD-<short-id>-session.tmp, using today's actual date and a short-id that satisfies the rules enforced by SESSION_FILENAME_REGEX in session-manager.js:

  • Allowed characters: lowercase a-z, digits 0-9, hyphens -
  • Minimum length: 8 characters
  • No uppercase letters, no underscores, no spaces

Valid examples: abc123de, a1b2c3d4, frontend-worktree-1 Invalid examples: ABC123de (uppercase), short (under 8 chars), test_id1 (underscore)

Full valid filename example: 2024-01-15-abc123de-session.tmp

The legacy filename YYYY-MM-DD-session.tmp is still valid, but new session files should prefer the short-id form to avoid same-day collisions.

Step 4: Populate the file with all sections below

Write every section honestly. Do not skip sections — write "Nothing yet" or "N/A" if a section genuinely has no content. An incomplete file is worse than an honest empty section.

Step 5: Show the file to the user

Read the full file on GitHub · 276 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 276 lines · 28 tokens per session scan A f4a5799907d5

Subscribe to this mod's changes

save-session is a command published in the GitHub repository zhmxiaowo/opencode-simple (2 stars, last pushed 7mo ago), licensed MIT. It adds 28 tokens to every session and 2,149 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 88% identical to save-session, differing in 7 lines, and is treated as a copy.