stash

A command for saving session context under a chosen name. The saved brief can include decisions, current work, findings, and other details needed to resume after a context change or handoff.

In plain words
What is it for?
Use it to create a compact handoff or recovery note in the session stash, with a fuller write-up generated from that brief.
Why use it?
It reduces the risk of losing important session details when work is compacted, paused, or passed to another process.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/hamr0/liteagents/stash
Clone the repo
git clone --depth 1 https://github.com/hamr0/liteagents
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 675 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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 $0.00009 $0.00675
Opus 5 $0.00005 $0.00338
Sonnet 5 $0.00002 $0.00135
Haiku 4.5 $0.00001 $0.00068

Measured 2d ago against content hash c582e8d02f1c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

stash 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 2d 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.

packages/ampcode/commands/stash.md · 66 lines

What it actually says

Save session context for compaction recovery or handoffs.

Guardrails

  • Favor straightforward, minimal implementations first and add complexity only when requested or clearly required.
  • Keep changes tightly scoped to the requested outcome.
  • Mid-tier model, not hardcoded. The write-up subagent (step 2) uses a mid-tier model — capable of semantic judgment, cheaper/faster than your top reasoning tier (e.g. Claude's Sonnet vs Opus). Use whatever your tool designates as that balanced default; never hardcode a vendor-specific model name.
  • Background dispatch where supported. Run the write-up subagent in the background (non-blocking) so the session isn't held up waiting on formatting/file I/O. Fall back to writing inline (today's behavior) if your tool has no subagent or background-dispatch mechanism.

What it does

  1. Drafts a compact brief of current conversation context, key decisions, active work in progress, and findings/insights — done inline, since only the running session holds full conversation context

  2. Hands the brief to a subagent on the mid-tier model (see Guardrails) to expand into the full stash file at .amp/stash/<name>.md, dispatched in the background where the tool supports it. Falls back to writing inline if subagent/background dispatch isn't available

  3. Enables context restoration after compaction

  4. Consolidation nudge — whichever actor wrote the file (the subagent, or the session itself on the inline fallback) counts the unprocessed backlog after saving: unprocessed = (files in .amp/stash/*.md) − (entries in .amp/remember/.processed) (a missing .processed manifest means 0 processed). If unprocessed >= 5, end with one line:

    📝 N stashes since last consolidation — run /remember to fold them into memory.

    No counter is stored — the count is derived each time, and running /remember updates .processed, so the backlog drops on its own. Just emit the nudge; never run /remember automatically.

When to use

  • Before long-running tasks that may trigger compaction
  • When handing off work to another agent or session
  • After completing major investigation or analysis
  • Before taking a break from complex multi-step work

Commands

# Stash with auto-generated name
/stash

# Stash with custom name
/stash "feature-auth-investigation"

# List available stashes
ls .amp/stash/

# Restore from stash
cat .amp/stash/<name>.md

Reference

  • Stashes stored in .amp/stash/ (project-local)
  • Automatically includes: timestamp, active plan, recent decisions
  • Maximum context retention with minimal token usage
  • When dispatched in the background, the "Stashed to X" confirmation and consolidation nudge arrive as the subagent's completion notification rather than inline in the same turn
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. 2d ago First seen · 66 lines · 9 tokens per session scan A c582e8d02f1c

Subscribe to this mod's changes

stash is a command published in the GitHub repository hamr0/liteagents (22 stars, last pushed 3d ago), licensed Apache-2.0. It adds 9 tokens to every session and 675 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.