session-guard

session-guard is a skill for Claude Code from Adit-Jain-srm/skill-forge. It costs 88 tokens per session (1,233 once invoked), scanned A, original, MIT.

A session-monitoring skill for coding agents that watches for instruction loss and declining reliability during long tasks. It reinforces important rules and recommends splitting work before the session degrades.

In plain words
What is it for?
Use it during complex, multi-step work or when a conversation is becoming long. It helps preserve instructions and decide when to start a fresh session.
Why use it?
Long agent sessions can repeat tool results, claim unfinished work is done, or forget project instructions after context is compressed. This helps detect those warning signs early.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md; mentions Claude Code.

Part of the skill-forge plugin — 19 skills shipped together

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 skills/adit-jain-srm/skill-forge/session-guard
Any agent
npx skills add Adit-Jain-srm/skill-forge --skill session-guard
Clone the repo
git clone --depth 1 https://github.com/Adit-Jain-srm/skill-forge

Made for: Claude Code.

Or install skill-forge, the plugin that ships this one along with the rest of its 19 skills.

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 session-guard

README.md
[![agentmods](https://agentmods.dev/badge/skills/adit-jain-srm/skill-forge/session-guard.svg)](https://agentmods.dev/skills/adit-jain-srm/skill-forge/session-guard)
Your own site
<a href="https://agentmods.dev/skills/adit-jain-srm/skill-forge/session-guard"><img src="https://agentmods.dev/badge/skills/adit-jain-srm/skill-forge/session-guard.svg" alt="Measured on agentmods" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,233 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.1 $0.00088 $0.01233
Opus 5 $0.00044 $0.00616
Sonnet 5 $0.00018 $0.00247
Haiku 4.5 $0.00009 $0.00123

Measured 6d ago against content hash 255b7c725adf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

session-guard 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 6d 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.

skills/session-guard/SKILL.md · 130 lines

How it starts

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

Session Guard

Overview

Long sessions corrupt silently. Context compaction drops your instructions without warning. This skill prevents both: monitors health, anchors critical rules through compaction, and splits before damage occurs. No packages, no SQLite, no MCP — pure behavioral enforcement that works in Cursor AND Claude Code.

Process

Monitor session health passively. At checkpoints, RECITE critical rules to self-anchor. Split BEFORE corruption appears — once it occurs, it's invisible and irreversible.

Persistence

ACTIVE every session. Monitors passively. Escalates on threshold breach. Recites critical rules at checkpoints.

The Problem (June 2026, confirmed across platforms)

Two distinct failure modes:

1. Tool Call Degradation (50+ calls):

  • Hallucinated tool results (content that doesn't match files on disk)
  • Tool results duplicated (same read echoed 2-8x)
  • False progress (agent claims "done" for incomplete work)

2. Context Compaction Amnesia:

  • CLAUDE.md instructions silently dropped after compaction
  • Naming conventions, architectural rules, file structure constraints forgotten
  • Agent operates from "degraded mental model" without knowing it
  • Compaction summary creates "narrative momentum" that overrides re-injected rules

Both are PLATFORM limitations. Smart session management mitigates both completely.

Health Signals

Signal Threshold Action
Tool call count >40 YELLOW: checkpoint + recite critical rules
Tool call count >60 RED: split or compact with anchor
Agent contradicts earlier decision Any VERIFY: re-read source of truth
Style/naming conventions drift Any RECITE: state the active rules aloud
File read returns unexpected content Any RE-READ: don't trust cached state
Repeated failed tool calls 3+ same error PAUSE: diagnose before continuing
Task scope growing unbounded Continuous SPLIT: one task per session

Protocol

Read the full file on GitHub · 130 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. 6d ago First seen · 130 lines · 88 tokens per session scan A 255b7c725adf

Subscribe to this mod's changes

session-guard is a skill published in the GitHub repository Adit-Jain-srm/skill-forge (2 stars, last pushed 2mo ago), licensed MIT. It adds 88 tokens to every session and 1,233 once invoked, about $0.0004 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-31.

Related

Other skills, from other repositories

karpathy-llm-wiki

Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.

Astro-Han/karpathy-llm-wiki · 67 tokens

user-research-cookiy

End-to-end user research assistant — qualitative and quantitative. Use this skill whenever the user mentions user research, user interviews, discussion guides, interview guides, research plans, qualitative research, quantitative research, user surveys, survey design, usability studies, participant recruitment…

cookiy-ai/user-research-skill · 154 tokens

daily-journal

A passive daily work journal that Claude keeps FOR you so you never have to write it yourself. Append short entries after meaningful work (what was done, what you focused on, artifacts touched) to 01-daily/journal/YYYY-MM-DD.md. Run a guided reflection at night or in the morning. Use when you run /daily-journal, say…

huytieu/COG-second-brain · 107 tokens

memorix-sessions

Use when resuming work, preparing handoff context, binding an HTTP control-plane project, or deciding whether sessionstart is useful.

AVIDS2/memorix · 31 tokens

init

Install or update OwnMem in the current repository. Use when the user asks to set up OwnMem, add local project memory for coding agents, or refresh an existing OwnMem installation after a version bump.

grpcer/ownmem · 43 tokens

ijfw-handoff

Session handoff generation and loading. Trigger: session end, context full, /handoff.

FerroxLabs/ijfw · 23 tokens