🧠 Context Compactor
Condense a long agent session into a handoff memo — decisions, open tasks, risks, facts — without losing what matters.
Every agent developer knows the pain: your session grows to 200k tokens, context gets
compacted, and the important stuff vanishes — the decision you made, the task you
promised, the URL you need tomorrow.
Context Compactor reads a raw transcript (txt/md, any language mix of Russian/English)
and produces a compact handoff memo grouped into:
- ✅ Decisions — what was actually decided
- 📌 Open tasks — what still needs to be done
- ⚠️ Risks — blockers, broken things, dependencies
- 🔗 Facts & links — URLs, handles, versions
Safety first: secrets never leak into the memo
Handoff memos travel to other agents and files. Context Compactor therefore
redacts credential values before scoring: password, пароль, token,
api key, secret, private key, sk-…/ghp_… tokens and BEGIN PRIVATE KEY
blocks become <REDACTED: …>. The decision/context around them is kept —
the secret value is not. --self-test asserts this with a planted-secret case.
Why you need it
- Survive context compaction: paste the memo back into the next session.
- Hand work to another agent (or a human) without dumping 500KB of transcript.
- Daily session digest in one command.
Install
npx -y @vibo-dev/context-compactor --input session.md
Quick start
git clone https://github.com/vnbochkarev-netizen/context-compactor
cd context-compactor
python3 compactor.py --input session.md
python3 compactor.py --input session.md --output handoff.md
python3 compactor.py --self-test
No dependencies. Python 3.8+. Works on Linux/macOS.
How it works
Heuristic line scoring (no LLM, no API costs, runs offline):
- Decision verbs: «решили / договорились / делаем», "decided / agreed / we will"
- Task markers: «нужно / осталось / напомни», "todo / next step / don't forget"
- Risk words: «риск / баг / блокер», "broken / blocker / depends on"
- Links, handles and version-like facts get boosted
- Code dumps, tool output and noise are filtered out
- Bucketing is context-aware: "договорились, ссылка: " is a fact, not a decision;
strong verbs («решили», "decided") always win
- Long transcripts: the head AND the tail are analyzed (final decisions usually sit at
the end); skipped middle is counted and reported in the memo header, which also carries
the tool version, date and source file
Example memo
# Handoff memo (auto-compacted)
## ✅ Decisions / Решения
- решили сделать skill-injection-scanner на python, MIT-лицензия
- договорились: завтра публикуем
## 📌 Open tasks / Открытые задачи
- надо проверить его тестами перед публикацией
## ⚠️ Risks / Риски
- риск: без тестов будет много ложных срабатываний
## 🔗 Facts & links / Факты и ссылки
- репозиторий проекта: https://github.com/vnbochkarev-netizen/skill-injection-scanner
Use cases
- Handoff files after context compaction (Hermes, Claude, OpenClaw, Codex…)
- Agent-to-agent handoff — pass the memo through an agent bridge
- Daily digests — what did we actually do today?
License
MIT © 2026 Viacheslav Bochkarev