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 skills/ariaxhan/kernel-claude/context-mgmtnpx skills add ariaxhan/kernel-claude --skill context-mgmtgit clone --depth 1 https://github.com/ariaxhan/kernel-claudeWrote 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/skills/ariaxhan/kernel-claude/context-mgmt)<a href="https://agentmods.dev/skills/ariaxhan/kernel-claude/context-mgmt"><img src="https://agentmods.dev/badge/skills/ariaxhan/kernel-claude/context-mgmt.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 | $0.00042 | $0.00936 |
| Opus 5 | $0.00021 | $0.00468 |
| Sonnet 5 | $0.00008 | $0.00187 |
| Haiku 4.5 | $0.00004 | $0.00094 |
Grade A, and why
context-mgmt 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.
What it actually says
Reasoning fidelity is the real metric, not token count. Quality degrades at ~60-70% fill, not at the limit.
<core_principles>
- COMPACTION: Summarize and reinitialize. Keep architecture decisions, discard noise.
- STRUCTURED NOTES: AgentDB + active.md persist across context resets.
- MULTI-AGENT: Delegate research to subagents. They explore, report summaries.
- MINIMAL READS: grep/glob to find, then read specific sections.
- TOOL RESULT CLEARING: Old tool output rarely needs to stay in context. </core_principles>
<token_budget>
- CLAUDE.md: <150 lines (always loaded)
- rules/: <100 lines (always loaded)
- Skills: metadata only at startup, full content on demand
- Commands: only when invoked
- Reference docs: only when skill explicitly reads them </token_budget>
<compaction_protocol>
- CHECK fill level via /context. (gate: <60% → continue; ≥60% → proceed to step 2)
- Write critical state:
agentdb write-end '{"did":"X","next":"Y","blocked":"Z"}' - Commit any uncommitted changes. (gate: clean working tree)
- Generate handoff if complex work in progress:
/kernel:handoff - Trigger compaction.
- POST-COMPACT RESTORE:
a. Read active.md for project context.
b. Run
agentdb read-startfor failures, patterns, contracts. c. Check for pending checkpoints to review. </compaction_protocol>
<fidelity_signals> Watch for reasoning degradation BEFORE the token meter shows a problem:
- Hypothesis depth dropping: agent defaults to first idea, stops exploring alternatives
- Backtracking absent: errors patched in place instead of root-caused
- Step count contracting: multi-step plans collapse to one-shot attempts
- Cross-file awareness fading: agent forgets earlier files in the same session
- Inline checks disappearing: agent stops verifying assumptions before acting
Any one of these → compact or hand off NOW, even if /context shows <60% fill. </fidelity_signals>
<what_to_preserve> Never compact away:
- Current task context and goal
- Active decisions and their rationale
- Blocking issues and error states
- File paths currently being worked on
- Uncommitted changes description
- Contract IDs and branch names </what_to_preserve>
<what_to_compact> Aggressively compress:
- Exploratory searches → "searched X, found Y at path:line"
- File reads → "read file, key insight: Z"
- Successful operations → "completed: X"
- Debugging traces → "root cause: X, fix: Y"
- Tool call history → "N tool calls, outcome: X"
- Research context → offload to AgentDB, keep one-line summary </what_to_compact>
<failure_modes>
- Agent tries too much at once → context exhausted mid-work Fix: Incremental progress with commits at each step.
- Later agent assumes done prematurely → work incomplete Fix: Explicit done-when criteria with evidence required. </failure_modes>
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 4d ago First seen · 100 lines · 42 tokens per session scan A a113c067c1f6
context-mgmt is a skill published in the GitHub repository ariaxhan/kernel-claude (12 stars, last pushed today), licensed MIT. It adds 42 tokens to every session and 936 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-30.
Other skills, from other repositories
prolong
Recover and use durable coding-session history from PRO-LONG's local append-only log. Use on long-running coding tasks, after context compaction or session resume, when reconstructing prior decisions or tool results, or before repeating work that may already have been attempted.
lemmalog
Externalize working memory and logical state into the lemmalog Datalog engine (MCP). Use for ANY multi-step task where state should outlive one context window or span agents: long investigations, debugging sessions, audits, multi-agent searches, systematic explorations, planning with many interdependent constraints…
causal-memory
Causal memory for agents — install/setup the causal-memory MCP server, then record decisions/outcomes and recall them before acting. Trigger when the user asks to install or set up causal-memory/agent memory, when causal-memory MCP tools are available and the agent faces a non-trivial decision (architecture, debugging…
release_followup_lookup
Use this checklist when a user vaguely references a previous release or vendor decision.
another-brain
Use the another-brain MCP tools (remember, search, recent, get, reinforce, forget) as shared long-term memory. Activates at the start of a task that may continue previous work, when recalling past decisions/fixes/preferences, when learning something worth remembering across sessions or agents, or after using a…
memory
Two-layer memory system with grep-based recall.