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.
npx agentmods add commands/fmarzochi/egc/save-sessiongit clone --depth 1 https://github.com/Fmarzochi/EGCWrote 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.
[](https://agentmods.dev/commands/fmarzochi/egc/save-session)<a href="https://agentmods.dev/commands/fmarzochi/egc/save-session"><img src="https://agentmods.dev/badge/commands/fmarzochi/egc/save-session.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00028 | $0.02160 |
| Opus 5 | $0.00014 | $0.01080 |
| Sonnet 5 | $0.00006 | $0.00432 |
| Haiku 4.5 | $0.00003 | $0.00216 |
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 3d 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.
This is a copy
80% identical to save-session — 93 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.
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 Gemini 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 Gemini home directory:
mkdir -p ~/.gemini/session-data
Step 3: Write the session file
Create ~/.gemini/session-data/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:
- Compatibility characters: letters
a-z/A-Z, digits0-9, hyphens-, underscores_ - Compatibility minimum length: 1 character
- Recommended style for new files: lowercase letters, digits, and hyphens with 8+ characters to avoid collisions
Valid examples: abc123de, a1b2c3d4, frontend-worktree-1, ChezMoi_2
Avoid for new files: A, test_id1, ABC123de
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.
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.
- 3d ago First seen · 276 lines · 28 tokens per session scan A d2d56f1d2b7f
save-session is a command published in the GitHub repository Fmarzochi/EGC (48 stars, last pushed today), licensed Apache-2.0. It adds 28 tokens to every session and 2,160 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 80% identical to save-session, differing in 93 lines, and is treated as a copy.
Other commands, from other repositories
context-save
An elite context engineering specialist focused on comprehensive, semantic, and dynamically adaptable context preservation across AI workflows. This tool orchestrates advanced context capture, serialization, and retrieval strategies to maintain institutional knowledge and enable seamless multi-session collaboration.
memory-why
Show why a memory recall returned what it did -- BM25 vs vector vs hybrid provenance.
mac 应用规则沉淀
这次解决问题的过程很棒。请你复盘一下:为了让以后类似的问题能直接被解决,或者避免刚才出现的错误,我应该在未来增加哪几条规则才能避免出现类似的情况?请用最精简的逻辑、最简单的语音总结出来,然后录入到我的这个文档当中: 企微SCRM/企微托管/Mac客户端/规则沉淀.md.
kaeru
kaeru re-entry ritual — load process state + epistemic state for an initiative.
export-memory
Export the generated memory as portable Markdown files.
Context Search
Search prior work to add context to a request, or browse previous sessions on a topic. Use before/after a request to ground it in past work, or standalone to recall and familiarize before asking.