hipocampus-compaction

hipocampus-compaction is a skill for Claude Code from kevin-hs-sohn/hipocampus. It costs 45 tokens per session (3,087 once invoked), scanned A, original, MIT.

A system that builds layered summaries and indexes from the agent's memory logs. It organizes daily, weekly, monthly, and root-level summaries while keeping the original logs.

In plain words
What is it for?
Use it to compact session history, maintain a searchable memory structure, and prepare persistent context for future sessions.
Why use it?
It makes large amounts of history easier to search without discarding the source records. Ongoing periods can be updated, while finished periods can be kept unchanged.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: built for openclaw.

Part of the hipocampus plugin — 5 skills, 3 hooks shipped together

Good fit Use it to compact session history, maintain a searchable memory structure, and prepare persistent context for future sessions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevin-hs-sohn/hipocampus/compaction
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.

Any agent
npx skills add kevin-hs-sohn/hipocampus --skill compaction
Clone the repo
git clone --depth 1 https://github.com/kevin-hs-sohn/hipocampus

Made for: Claude Code.

Or install hipocampus, the plugin that ships this one along with the rest of its 5 skills, 3 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 hipocampus-compaction

README.md
[![agentmods](https://agentmods.dev/badge/skills/kevin-hs-sohn/hipocampus/compaction/github.svg)](https://agentmods.dev/skills/kevin-hs-sohn/hipocampus/compaction)
Your own site
<a href="https://agentmods.dev/skills/kevin-hs-sohn/hipocampus/compaction"><img src="https://agentmods.dev/badge/skills/kevin-hs-sohn/hipocampus/compaction/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for hipocampus-compaction

Your own site · 80×15
<a href="https://agentmods.dev/skills/kevin-hs-sohn/hipocampus/compaction"><img src="https://agentmods.dev/badge/skills/kevin-hs-sohn/hipocampus/compaction.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,087 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00045 $0.03087
Opus 5 $0.00023 $0.01543
Sonnet 5 $0.00009 $0.00617
Haiku 4.5 $0.00005 $0.00309

Measured 9d ago against content hash 45ea0e6f0143, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

hipocampus-compaction 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 9d 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/compaction/SKILL.md · 307 lines

How it starts

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

Memory Compaction Tree

5-level hierarchical index over raw memory logs. Compaction nodes are search indices — originals are never deleted.

Hierarchy

memory/
  ROOT.md                      <- root node (topic index, ~3K tokens, Layer 1)
  2026-03-15.md                <- raw daily log (permanent, append-only)
  daily/2026-03-15.md          <- daily compaction node
  weekly/2026-W11.md           <- weekly compaction node
  monthly/2026-03.md           <- monthly compaction node

Compaction chain: Raw → Daily → Weekly → Monthly → Root

Tree traversal (search): Root → Monthly → Weekly → Daily → Raw

Fixed vs Tentative Nodes

Every compaction node has a status:

  • tentative — period is still ongoing, regenerated when new data arrives
  • fixed — period ended, never updated again
# Indicated in YAML frontmatter
---
type: weekly
status: tentative
period: 2026-W11
---

Key: tentative nodes are created immediately — ROOT.md is usable from day one.

When to Run

Called from hipocampus:core Session Start step 7, or directly by an external scheduler (e.g., OpenClaw heartbeat). Check trigger conditions below.

Trigger Conditions

Level Tentative Create/Update Fixed Transition
Raw → Daily On each new raw addition Date changes
Daily → Weekly On daily add/change ISO week ended + 7 days elapsed
Weekly → Monthly On weekly add/change Month ended + 7 days elapsed
Monthly → Root On monthly add/change Never (root accumulates forever)

Smart Thresholds

Below threshold: copy/concat verbatim (no information loss). Above threshold: generate LLM keyword-dense summary.

Level Threshold Above Below
Raw → Daily ~200 lines LLM keyword-dense summary Copy raw verbatim
Daily → Weekly ~300 lines combined LLM keyword-dense summary Concat dailies
Weekly → Monthly ~500 lines combined LLM keyword-dense summary Concat weeklies
Monthly → Root Always Recursive recompaction (N/A)

Read the full file on GitHub · 307 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. 9d ago First seen · 307 lines · 45 tokens per session scan A 45ea0e6f0143

Subscribe to this mod's changes

hipocampus-compaction is a skill published in the GitHub repository kevin-hs-sohn/hipocampus (206 stars, last pushed 3mo ago), licensed MIT. It adds 45 tokens to every session and 3,087 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.

Related

Other skills, from other repositories

mnemo-cortex

Installs and wires Mnemo Cortex (local-first persistent memory) into OpenClaw and other MCP-capable agents. Use for cross-session recall, decision history, or multi-agent shared memory.

GuyMannDude/mnemo-cortex · 44 tokens

capture-knowledge

A guide for saving useful, reusable knowledge from conversations and documents into a structured personal knowledge base. It separates original source material from concise pages about individual concepts.

YusenZhang0601/context-canopy · 92 tokens

second-brain-doctor

A read-only health check for an agent’s connection to a local Second Brain. It checks the authoritative files, installed skills, supporting service, access rules, version drift, and behavior in a new session.

YusenZhang0601/context-canopy · 117 tokens

second-brain-learn

A learning tool that reviews the current conversation and work evidence to find durable preferences, project rules, reusable methods, and lessons. It routes each finding to the appropriate long-term owner or leaves it unsaved when it has no lasting value.

YusenZhang0601/context-canopy · 145 tokens

second-brain-attach

A setup process for connecting a new or reset AI agent to a local Second Brain—a personal collection of rules, identity information, and reusable skills. It installs the required skills, connects the supporting service, and checks the setup in a fresh session.

YusenZhang0601/context-canopy · 111 tokens

second-brain-distill

A skill for extracting reusable knowledge from selected historical AI-agent conversations and archiving the results. It can process conversations only within a clearly defined, authorized batch.

YusenZhang0601/context-canopy · 123 tokens