hermes-session-maintenance
Skill75 starsChanged 4 months agoMITView on GitHub
hermes-session-maintenance — Maintain Hermes Agent session history: inspect size, export backups, prune old ended sessions, and configure safe auto-prune retention.
We split this skill into the rules it gives an agent
30 rules. About 0 are common, 20 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈20
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Use this skill when the user asks about pruning Hermes sessions, session retention, session DB size, hermes sessions prune, …
- Very specific: line 28
Treat this as Hermes configuration/maintenance work.
- Distinctive: line 29
Do not assume retention policy from memory.
- Distinctive: line 35
Only ended sessions are prune candidates.
- Distinctive: line 43
Use total sessions, messages, per-source counts, and DB size to shape the recommendation.
- Distinctive: line 50
Check current config values:
- Very specific: line 54
If the summary output does not include the session settings, inspect the config file's sessions: block directly.
- Distinctive: line 61
Before first major prune, export a backup:
- Very specific: line 76
Add --yes only if the user has authorized non-interactive deletion.
- Distinctive: line 85
When one channel is the bloat source, prune only that source:
- Distinctive: line 92
Use this when the user wants to preserve messaging history longer than CLI scratch sessions.
- Distinctive: line 110
When the user explicitly asks to clear all CLI sessions, first try the CLI pruner:
- Distinctive: line 122
Do not present the 90-day default as a hard cap.
- Very specific: line 123
Do not say auto-prune is active just because retention_days is set.
- Very specific: line 124
Do not skip hermes sessions stats.
- Distinctive: line 127
Do not imply memory, skills, cron jobs, notes, or project files are affected by session pruning.
- Distinctive: line 128
Do not over-explain when the user asks for a go/no-go recommendation.
- Distinctive: line 133
Use this skill not only for pruning/retention, but also when the user says a session "looped," burned too many tokens, felt unusually slow, …
- Distinctive: line 137
Read the session from the DB and identify whether the waste came from:
- Very specific: line 142
Check session totals in state.db:
- Distinctive: line 167
Check gateway timing/delivery behavior:
- Very specific: line 168
look for inbound message, response ready,
- Very specific: line 179
If gateway logs show one inbound and one response ready, with content_delivered=True, call it an internal tool-call cascade or …
- Distinctive: line 180
If a single loaded skill or search result dominates payload size, call that out explicitly.
- Distinctive: line 185
Do not call every high-token session a "loop." Many are just over-eager research/tool fan-out.
- Distinctive: line 186
Do not blame Telegram delivery when gateway logs show suppression of duplicate final send.
- Very specific: line 187
Do not stop at session_search() if the user is asking about token burn.
- Distinctive: line 188
Do not save transient missing-binary issues as durable skill knowledge.
- Distinctive: line 193
prefer one direct extract/read path first,
- Distinctive: line 194
avoid loading a full skill unless the tool is truly needed for writes or auth-specific operations,
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hermes Session Maintenance
Use this skill when the user asks about pruning Hermes sessions, session retention, session DB size, hermes sessions prune, sessions.auto_prune, sessions.retention_days, session export/backup, or whether old conversations should be capped.
Operating principles
- Treat this as Hermes configuration/maintenance work. If broader Hermes setup or CLI behavior is involved, also load
hermes-agentfor authoritative command references. - Do not assume retention policy from memory. Check live state before recommending destructive cleanup.
- Pruning is deletion. Prefer exporting a safety snapshot before the first aggressive prune or before reducing retention substantially.
- Distinguish default behavior from active behavior:
hermes sessions prunedefaults to--older-than 90.sessions.retention_daysmay also default to 90.sessions.auto_prune: falsemeans nothing is being deleted automatically.- Only ended sessions are prune candidates; active sessions are not pruned.
Standard workflow
- Inspect current volume:
hermes sessions statsUse total sessions, messages, per-source counts, and DB size to shape the recommendation.
- Inspect prune command behavior when needed:
hermes sessions prune --help- Check current config values:
hermes config showIf the summary output does not include the session settings, inspect the config file's sessions: block directly. Do not use hermes config get; this CLI supports show, edit, set, path, env-path, check, and migrate, not get.
- Recommend retention based on actual size and user needs.
- 90 days is conservative/default.
- 30 days is reasonable when the DB is multi-GB and session search is mostly used for recent operational continuity.
- Shorter than 30 days should usually be explicit user preference or a storage emergency.
- Before first major prune, export a backup:
hermes sessions export ~/hermes-sessions-backup-$(date +%Y%m%d).jsonl- Enable auto-prune if approved:
hermes config set sessions.auto_prune true
hermes config set sessions.retention_days 30- Reclaim space immediately with a manual prune:
hermes sessions prune --older-than 30Add --yes only if the user has authorized non-interactive deletion.
- Verify after pruning:
hermes sessions statsSource-specific cleanup
When one channel is the bloat source, prune only that source:
hermes sessions prune --older-than 30 --source cli
hermes sessions prune --older-than 90 --source telegramUse this when the user wants to preserve messaging history longer than CLI scratch sessions.
For ongoing split retention, do not rely on global sessions.auto_prune because it has one retention window and can prematurely prune the longer-lived source. Use a quiet script under ~/.hermes/scripts/ and a local no-agent cron job instead:
hermes config set sessions.auto_prune false
hermes config set sessions.retention_days 45 # documentation/default only when auto_prune is off
# ~/.hermes/scripts/prune-sessions-by-source.sh:
# hermes sessions prune --older-than 15 --source cli --yes
# hermes sessions prune --older-than 45 --source telegram --yesSchedule it daily with deliver='local' and no_agent=true so it does not message the user unless it fails. Cron script paths must be relative to ~/.hermes/scripts/, not absolute.
For the detailed split-retention pattern and one-time CLI purge procedure, see references/source-specific-retention-and-cli-clear.md.
One-time CLI clears
When the user explicitly asks to clear all CLI sessions, first try the CLI pruner:
hermes sessions prune --older-than 0 --source cli --yesThen verify. If many CLI sessions remain, check whether they are unended/active (ended_at IS NULL). The built-in pruner only removes prune candidates, so historical CLI sessions that were never marked ended may remain.
For an explicit destructive CLI-only clear, keep the newest/current CLI session, delete messages and sessions rows for other source='cli' sessions directly in ~/.hermes/state.db, then checkpoint/VACUUM after stopping processes that hold the DB. Preserve Telegram/Discord/cron/subagent sessions unless separately requested. See the reference file above for the SQL and verification queries.
Pitfalls
- Do not present the 90-day default as a hard cap. It is a default cutoff for pruning/retention, not an immutable limit.
- Do not say auto-prune is active just because
retention_daysis set.sessions.auto_prunemust be true. - Do not skip
hermes sessions stats; the right recommendation depends on live DB size and source mix. - The live session store is typically
~/.hermes/state.db, not~/.hermes/sessions.db. If reclaiming disk space manually, inspectstate.dband its-wal/-shmcompanions. - SQLite may not physically shrink after pruning while Hermes CLI/gateway/dashboard processes hold
state.dbopen. A WAL checkpoint may need gateway/dashboard temporarily stopped; a full VACUUM may still require all Hermes CLI sessions to exit. Do not leave a largestate.db-walbehind after attempting VACUUM — runPRAGMA wal_checkpoint(TRUNCATE);once locks are clear. - Do not imply memory, skills, cron jobs, notes, or project files are affected by session pruning. Session pruning affects session transcripts/state only.
- Do not over-explain when the user asks for a go/no-go recommendation. Give the recommendation, the tradeoff, and the exact commands.
- For the user, session-retention questions usually want a direct recommendation first, not a long policy discussion. If live stats show a multi-GB DB and mostly recent operational use, recommend 30 days with auto-prune; mention 45 days as the conservative alternative and 90 days only for deliberate archive-style use.
Session forensics: token burn, suspected loops, and runaway turns
Use this skill not only for pruning/retention, but also when the user says a session "looped," burned too many tokens, felt unusually slow, or may have resent content repeatedly.
Fast diagnostic workflow
- Read the session from the DB and identify whether the waste came from:
- repeated assistant/tool turns inside one user request,
- duplicate gateway delivery,
- oversized skill/tool payloads,
- or a genuinely long final answer.
- Check session totals in
state.db:
sqlite3 ~/.hermes/state.db <<'SQL'
.headers on
.mode column
SELECT id, source, title, model, input_tokens, output_tokens,
cache_read_tokens, reasoning_tokens, api_call_count, message_count,
datetime(started_at,'unixepoch','localtime') AS started,
datetime(ended_at,'unixepoch','localtime') AS ended
FROM sessions
WHERE id='SESSION_ID';
SQL- Inspect per-message shape to see the turn pattern and tool payload sizes:
sqlite3 ~/.hermes/state.db <<'SQL'
.headers on
.mode column
SELECT id, role, tool_name, tool_call_id, length(COALESCE(content,'')) AS content_len,
datetime(timestamp,'unixepoch','localtime') AS ts
FROM messages
WHERE session_id='SESSION_ID'
ORDER BY id;
SQL- Check gateway timing/delivery behavior:
- look for
inbound message,response ready, - and especially
Suppressing normal final send ... content_delivered=True. That pattern usually means streaming already delivered the final answer once, so the problem was not duplicate send.
- Attribute blame precisely:
- large
skill_viewpayloads, - multiple overlapping
web_search/web_extractcalls, - repeated assistant-empty/tool turns,
- or unnecessary env dumps for simple lookup questions.
What to conclude
- If gateway logs show one inbound and one
response ready, withcontent_delivered=True, call it an internal tool-call cascade or context-growth problem — not a transport resend loop. - If a single loaded skill or search result dominates payload size, call that out explicitly. Quantify it.
- Distinguish input-token burn from output-token size. Often the answer is short; the cost came from replaying tool results back into the model.
Pitfalls
- Do not call every high-token session a "loop." Many are just over-eager research/tool fan-out.
- Do not blame Telegram delivery when gateway logs show suppression of duplicate final send.
- Do not stop at
session_search()if the user is asking about token burn. Usestate.dbandgateway.logso the diagnosis is grounded. - Do not save transient missing-binary issues as durable skill knowledge. The durable lesson is to avoid loading bulky skills or fanning out searches unnecessarily when a cheap-first path would answer the question.
Cheap-first guidance to recommend after diagnosis
For lightweight link-analysis or one-question sessions:
- prefer one direct extract/read path first,
- avoid loading a full skill unless the tool is truly needed for writes or auth-specific operations,
- cap redundant searches,
- and use minimal env queries for session-ID lookups instead of broad dumps.
See also: references/session-forensics-token-burn.md.
References
references/session-pruning-retention.md— condensed notes from the session where 30-day auto-prune was evaluated against a 6.7GB session DB.references/session-forensics-token-burn.md— diagnosing whether a session burned tokens because of duplicate delivery, internal tool cascades, or oversized tool payloads.
Public support files
references/session-forensics-token-burn.mdreferences/session-pruning-retention.mdreferences/source-specific-retention-and-cli-clear.md
Other versions1 project uses a version of this.
Word for word · 1
- AtlasOmnia/donna-starter★ 136100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository74 other files it gives its agents.
- apple-remindersSkill
- application-security-reviewSkill
- browser-harness-authoringSkill
- claude-designSkill
- codebase-inspectionSkill
- coding-worktree-recoverySkill
- computer-useSkill
- content-styleSkill
- cross-browser-typography-qaSkill
- daily-news-digestsSkill
- daily-note-wrapupSkill
- destination-trip-planningSkill
- discord-connectSkill
- dogfoodSkill
- domestic-trip-planningSkill
- dynamic-content-extractionSkill
- evidence-based-repliesSkill
- external-model-reviewSkill
- github-authSkill
- github-code-reviewSkill
- github-issuesSkill
- github-pre-push-gatesSkill
- github-pr-workflowSkill
- github-readme-maintenanceSkill
- github-repo-managementSkill
- github-workflowsSkill
- google-workspaceSkill
- hermes-agent-skill-authoringSkill
- hermes-agentSkill
- hermes-config-editingSkill
- hermes-context-optimizationSkill
- hermes-desktop-pluginsSkill
- hermes-diagnostic-reviewSkill
- hermes-mnemosyneSkill
- hermes-nightly-self-check-decisionsSkill
- hermes-overnight-autonomySkill
- hermes-plugin-developmentSkill
- hermes-plugin-evaluationSkill
- hermes-self-evaluationSkill
- hermes-themesSkill
- hf-model-card-researchSkill
- imessageSkill
- inspecting-hermes-desktop-domSkill
- local-app-github-publishingSkill
- local-discoverySkill
- local-model-selectionSkill
- macos-app-automationSkill
- macos-storage-managementSkill
- mapsSkill
- marketing-collateral-designSkill
- marketplace-purchase-vettingSkill
- meal-trackerSkill
- messaging-gateway-troubleshootingSkill
- meta-business-postingSkill
- mnemosyne-maintenanceSkill
- notes-automation-workflowsSkill
- notion-artifact-captureSkill
- notionSkill
- obsidian-memory-architectureSkill
- obsidianSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

