session-management

session-management is a skill for Claude Code, Codex from QBall-Inc/clear. It costs 39 tokens per session (3,154 once invoked), scanned A, original, Apache-2.0.

A set of instructions for managing a coding session's lifecycle in the CLEAR framework. It covers checking token use, handing work to another session, and ending a session early.

In plain words
What is it for?
Use it to check token usage, prepare session handoffs, resolve first-session command setup, and close sessions according to the framework's procedures.
Why use it?
It helps manage session limits and avoid failures when a session needs to continue elsewhere or the available context is running low.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the clear plugin — 15 skills, 3 agents, 7 hooks 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/qball-inc/clear/session-management
Any agent
npx skills add QBall-Inc/clear --skill session-management
Clone the repo
git clone --depth 1 https://github.com/QBall-Inc/clear

Made for: Claude Code, Codex.

Or install clear, the plugin that ships this one along with the rest of its 15 skills, 3 agents, 7 hooks.

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-management

README.md
[![agentmods](https://agentmods.dev/badge/skills/qball-inc/clear/session-management.svg)](https://agentmods.dev/skills/qball-inc/clear/session-management)
Your own site
<a href="https://agentmods.dev/skills/qball-inc/clear/session-management"><img src="https://agentmods.dev/badge/skills/qball-inc/clear/session-management.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,154 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.00039 $0.03154
Opus 5 $0.00019 $0.01577
Sonnet 5 $0.00008 $0.00631
Haiku 4.5 $0.00004 $0.00315

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

Security

Grade A, and why

session-management 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 4d 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-management/SKILL.md · 222 lines

How it starts

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

CLI Usage: When unsure about a CLI's interface or flags, run it with --help first. Do NOT attempt to discover functionality by reading plugin source code — doing so leads to incorrect execution from assumptions made without context of the holistic flow.

Session Management Skill

Purpose

This skill provides guidance for Claude on managing session lifecycle in the CLEAR framework. It explains token thresholds, handoff procedures, and how to manually invoke session operations.

Plugin Root Resolution

CLI commands in this skill reference $CLEAR_PLUGIN_ROOT — a .claude/settings.json env var the shell expands. The SessionStart hook persists it, but settings env vars load at session launch, so on a brand-new consumer's first session (before its next restart) the variable is empty and node "$CLEAR_PLUGIN_ROOT/build/..." fails with MODULE_NOT_FOUND.

First-session bootstrap — if $CLEAR_PLUGIN_ROOT is empty, set it inline in the same Bash call as the CLI (each Bash call is a fresh shell, so a separate export would not carry over):

export CLEAR_PLUGIN_ROOT="${CLEAR_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"

Prepend it to the CLI in one shell line: export CLEAR_PLUGIN_ROOT="${CLEAR_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"; <node "$CLEAR_PLUGIN_ROOT/build/..." command>. ${CLAUDE_PLUGIN_ROOT} resolves in this SKILL.md body to the actually-loaded plugin path; once the consumer restarts, $CLEAR_PLUGIN_ROOT is populated and the assignment is a harmless no-op. Reference files are left unchanged.

When to Take Action vs. Just Answer

TAKE ACTION (run scripts) when user says:

  • "check my token usage" / "how much context have I used"
  • "prepare session handoff" / "prepare for handoff"
  • "end session early" / "wrap up this session"
  • "initialize session tracking"

JUST READ FILES (no scripts) when user asks:

  • "have we completed the handoff?" → Check .clear/state/session.json
  • "what was in the last handoff?" → Read .clear/sessions/*.md
  • "how many sessions have we had?" → Read .clear/state/session-history.json
  • "what happened in session 14?" → Read the specific session file

Read the full file on GitHub · 222 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. 4d ago First seen · 222 lines · 39 tokens per session scan A dc4c8b7b5df8

Subscribe to this mod's changes

session-management is a skill published in the GitHub repository QBall-Inc/clear (3 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 39 tokens to every session and 3,154 once invoked, about $0.0002 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.