CertainLogic Context Manager
/install certainlogic-context-tokenreducer
Context Manager
Keeps sessions lean. Tracks query count, warns before context bloats, saves a handoff summary so work continues cleanly in the next session.
How It Works
- Counter — Increment
session_query_count.txtevery turn - Warn — At threshold, write
handoff.mdand alert the user - Reset — User runs
/new; next session reads and deleteshandoff.md
Files
| File | Purpose |
|---|---|
session_query_count.txt |
Integer. Increment each turn. Create if missing (default 0). |
handoff.md |
Workspace root. Written at threshold. Read + deleted on next session start. |
Every Turn (mandatory)
1. Read session_query_count.txt (default 0 if missing)
2. Increment by 1
3. Write back
4. If count == THRESHOLD: trigger handoff flow
Default threshold: 10. Configurable per deployment.
Handoff Flow (at threshold)
- Write
handoff.md— see handoff-format.md for exact spec - Tell the user:
⚠️ 10 queries in — context is getting heavy. Handoff saved. Run
/newwhen ready to continue. - Do NOT auto-reset. User controls the reset.
Session Start Flow
1. Check if handoff.md exists
2. If exists AND file is \x3C 3 hours old:
a. Read it
b. Apply context to current session
c. Delete handoff.md
3. Reset session_query_count.txt to 0
Topic Switch Detection
When the user says "BTW", "switching gears", "new topic", or starts a clearly unrelated task:
- Write/overwrite
handoff.mdimmediately (don't wait for threshold) - Tell the user: "Handoff saved —
/newwhen ready" - Resume or continue current task
Why This Matters
Session context is cumulative. Every prior message, tool call, and assistant response is re-sent on every new query. Without resets, a lean 18K-token session becomes 50K–400K+ within hours.
See token-math.md for cost impact data and reset savings estimates.
Commands
| Command | Behavior |
|---|---|
/new or /reset |
User-triggered. New session starts; skill reads handoff.md if present. |
/handoff |
Explicit handoff write. Same as threshold flow, on demand. |
/counter |
Report current query count and threshold. |
Configuration
Override defaults in AGENTS.md or equivalent workspace config:
- CONTEXT_THRESHOLD: 10 # Queries before warning (default: 10)
- HANDOFF_TTL_HOURS: 3 # Hours before handoff.md is considered stale (default: 3)
Reliability Rules
- Never skip the counter increment — even for one-liner responses
- Never auto-reset — the user owns the session lifecycle
- Handoff must be written before warning — never warn without saving state first
- Counter file is source of truth — do not track in memory
What This Saves You
| Without this skill | With this skill |
|---|---|
| Sessions balloon to 400K+ tokens | Sessions stay under 25K |
| Cost multiplies 22x over a day | Cost stays near baseline |
| Work lost on manual /new resets | Handoff auto-saved, resumed next session |
| No signal before context degrades | Warning fires before quality drops |
See token-math.md for the full cost breakdown.
Built by CertainLogic — trusted fact infrastructure for AI agents.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install certainlogic-context-tokenreducer - After installation, invoke the skill by name or use
/certainlogic-context-tokenreducer - Provide required inputs per the skill's parameter spec and get structured output
What is CertainLogic Context Manager?
Prevent AI session token bloat and runaway costs. Tracks query count per session, warns at a configurable threshold, auto-writes a dense handoff summary befo... It is an AI Agent Skill for Claude Code / OpenClaw, with 81 downloads so far.
How do I install CertainLogic Context Manager?
Run "/install certainlogic-context-tokenreducer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is CertainLogic Context Manager free?
Yes, CertainLogic Context Manager is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does CertainLogic Context Manager support?
CertainLogic Context Manager is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created CertainLogic Context Manager?
It is built and maintained by CertainLogicAI (@certainlogicai); the current version is v1.0.1.