skills/o9k-setup/SKILL.md
First-time install of hmem: MCP server, skill files, and auto-memory hooks for Claude Code, Gemini CLI, or OpenCode. Use on 'set up memory', 'install hmem', 'initialize hmem', or 'first-time setup'.
npx skillsauth add Bumblebiber/hmem o9k-setupInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
hmem initInstall hmem globally, then run the interactive installer:
npm install -g its-over-9k
hmem init
hmem init performs all setup steps automatically:
.mcp.json with the correct paths for each detected toolhmem.config.json with sensible defaultsAfter hmem init, install the slash-command skills:
npx hmem update-skills
Restart your AI tool and call read_memory() to verify.
Non-interactive mode (CI / scripting):
hmem init --global --tools claude-code --dir ~/.hmem --no-example
hmem init registers 4 hooks in ~/.claude/settings.json. Each hook is a bash script in ~/.claude/hooks/.
Script: ~/.claude/hooks/o9k-startup.sh
additionalContext telling the agent to call read_memory() silently. Also injects H-entries (ID + title; pinned H-entries include their L2 children inline so canonical identity/preference info is visible without extra reads — since v1.3.3), active device apps, infrastructure favorites, recent projects, checkpoint status, and an --- hmem-sync --- block showing link state (✓ linked / ⚠ partial / ✗ not linked / ✗ not configured). Block is always emitted since v1.2.9.checkpointInterval, default 20): injects a checkpoint reminder.
checkpointMode: "remind" — adds an additionalContext nudge; the agent decides what to save.checkpointMode: "auto" — checkpoint is handled by the Stop hook instead (no reminder injected).parentUuid) are skipped./tmp/claude-o9k-counter-{SESSION_ID}.Script: ~/.claude/hooks/o9k-log-exchange.sh
transcript_path and last_assistant_message) to hmem log-exchange.hmem log-exchange reads the last user message from the JSONL transcript, combines it with the agent response, and appends both to the currently active O-entry (session history).checkpointInterval, default 20), triggers a checkpoint:
hmem checkpoint in background — Haiku subagent with MCP tools that:
contextTokenThreshold (default 100k tokens).Fires only after /clear (matcher: "clear"). Two hooks run in sequence:
a) hmem context-inject — outputs additionalContext containing:
[*])read_memory({prefix:"P", titles_only:true}) for the full listload_project call for the active project (if any)read_memory() call.b) hmem deactivate — resets the active project for the new session:
projectId: null, deactivated: true for the new session_id/tmp/o9k-active-<pid>.txt)no project after /clear until load_project is calledPlace hmem.config.json in your memory directory (the path you chose during hmem init). All keys are optional — defaults are applied for anything missing.
{
"memory": {
"maxCharsPerLevel": [200, 2500, 10000, 25000, 50000],
"maxDepth": 5,
"defaultReadLimit": 100,
"maxTitleChars": 50,
"checkpointInterval": 20,
"checkpointMode": "remind",
"recentOEntries": 10,
"contextTokenThreshold": 100000,
"bulkReadV2": {
"topAccessCount": 3,
"topNewestCount": 5,
"topObsoleteCount": 3,
"topSubnodeCount": 3,
"newestPercent": 20,
"newestMin": 5,
"newestMax": 15,
"accessPercent": 10,
"accessMin": 3,
"accessMax": 8
}
}
}
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| maxCharsPerLevel | number[] | [200,2500,10000,25000,50000] | Character limit per tree depth (L1..L5). Alternative: set maxL1Chars + maxLnChars and levels are interpolated linearly. |
| maxDepth | number | 5 | Max tree depth (1 = L1 only, 5 = full). |
| defaultReadLimit | number | 100 | Max entries returned by a default read_memory(). |
| maxTitleChars | number | 50 | Max characters for auto-extracted titles. |
| checkpointInterval | number | 20 | Messages between checkpoint reminders. Set 0 to disable. |
| checkpointMode | "remind" or "auto" | "remind" | "remind" = inject a save-reminder via additionalContext. "auto" = spawn a Haiku subagent that saves directly (no user interaction). |
| recentOEntries | number | 10 | Number of recent O-entries (session logs) injected at startup and on load_project. Set 0 to disable. |
| contextTokenThreshold | number | 100000 | Token threshold for context-clear recommendation. When cumulative hmem output exceeds this, the agent is told to flush + /clear. Set 0 to disable. |
Bulk-read tuning (bulkReadV2): controls which entries get expanded (all L2 children shown) in a default read_memory() call. Per prefix category, the top N newest + top M most-accessed entries are expanded. Favorites are always expanded.
| Key | Default | Description |
|-----|---------|-------------|
| topAccessCount | 3 | Fixed fallback: top-accessed entries to expand. |
| topNewestCount | 5 | Fixed fallback: newest entries to expand. |
| topObsoleteCount | 3 | Obsolete entries to keep visible. |
| topSubnodeCount | 3 | Entries with most sub-nodes to always expand. |
| newestPercent | 20 | Percentage-based selection (overrides topNewestCount). |
| newestMin / newestMax | 5 / 15 | Clamp for percentage-based newest selection. |
| accessPercent | 10 | Percentage-based selection (overrides topAccessCount). |
| accessMin / accessMax | 3 / 8 | Clamp for percentage-based access selection. |
Use these steps only if hmem init is not available (e.g., local clone without global install).
node --version # must be >= 18
npm --version # any recent version
better-sqlite3 requires native build tools:
| OS | Install |
|----|---------|
| Linux (Debian/Ubuntu) | sudo apt install python3 make g++ |
| Linux (Arch) | sudo pacman -S python make gcc |
| macOS | xcode-select --install |
| Windows | npm install -g windows-build-tools |
git clone https://github.com/Bumblebiber/its-over-9k.git
cd its-over-9k
npm install
npm run build
Verify: dist/mcp-server.js must exist after build.
mkdir -p ~/.hmem
The SQLite .hmem file is created automatically on first write.
Add hmem to your .mcp.json (create it at your project root if it does not exist). All paths must be absolute.
{
"mcpServers": {
"hmem": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/hmem/dist/mcp-server.js"],
"env": {
"HMEM_PATH": "/absolute/path/to/your/memory.hmem",
"HMEM_AGENT_ROLE": "worker"
}
}
}
}
| Variable | Description |
|----------|-------------|
| HMEM_PATH | Absolute path to your .hmem file (e.g. ~/.hmem/memory.hmem) |
| HMEM_AGENT_ROLE | Permission level: worker / al / pl / ceo |
Copy skill files to the global skills directory for your tool:
Claude Code:
mkdir -p ~/.claude/skills/o9k-read ~/.claude/skills/o9k-write ~/.claude/skills/save ~/.claude/skills/memory-curate
cp /path/to/hmem/skills/o9k-read/SKILL.md ~/.claude/skills/o9k-read/SKILL.md
cp /path/to/hmem/skills/o9k-write/SKILL.md ~/.claude/skills/o9k-write/SKILL.md
cp /path/to/hmem/skills/save/SKILL.md ~/.claude/skills/save/SKILL.md
cp /path/to/hmem/skills/memory-curate/SKILL.md ~/.claude/skills/memory-curate/SKILL.md
Gemini CLI:
mkdir -p ~/.gemini/skills/o9k-read ~/.gemini/skills/o9k-write ~/.gemini/skills/save ~/.gemini/skills/memory-curate
cp /path/to/hmem/skills/*/SKILL.md to corresponding ~/.gemini/skills/*/SKILL.md
Fully restart your AI tool (exit and reopen — /clear is not enough). Then call:
read_memory()
Expected: Memory is empty (or your existing memories).
| Symptom | Likely cause |
|---------|-------------|
| HMEM_PATH not set | Path missing or wrong env var name in .mcp.json |
| No such tool: read_memory | Tool not restarted after adding .mcp.json |
| npm install fails | Missing build tools (see Prerequisites above) |
| read_memory returns empty after writing | MCP server process is stale — restart tool |
| Hooks not firing | Check ~/.claude/settings.json — hooks must be registered there |
| Checkpoint reminders not appearing | Verify checkpointInterval > 0 in hmem.config.json |
read_memory() # see all L1 memories
read_memory(id="L0001") # drill into one entry
write_memory(prefix="L", content="Short title\n\nDetailed body text\n\tL2 sub-node")
search_memory(query="error node.js") # search across all memories
Separate title from body with a blank line (hidden in listings, shown on drill-down). See o9k-write skill for details.
See skills/o9k-read/SKILL.md and skills/o9k-write/SKILL.md for full usage.
tools
Update flow for its-over-9k (hmem). Runs `npm update -g`, syncs skills, applies migrations, verifies hooks, shows the changelog. Use when the user asks to update/upgrade hmem, o9k, o9k-mcp, or its-over-9k (any language), or when the startup version-check flags a new release. Runs the npm update itself — don't assume it's already done.
development
Mandatory entry point for every Cortex session — invoke at conversation start, after /clear, and after any load_project call. All stable context (H-entries, projects, device, sync) is pre-injected by the hook — no read_memory(mode='essentials') needed. Surfaces pending git work, Next Steps + open T-tasks, and runs the O-entry routing check.
tools
Curate an .hmem file (your own or foreign) — mark obsolete/irrelevant, fix titles, consolidate duplicates, repair broken links. **Requires the `hmem-curate` MCP server** (skill prompts the user to enable it on entry). Use whenever the user says 'aufräumen', 'memory aufräumen', 'Speicher aufräumen', 'hmem aufräumen', 'clean up memory', 'tidy up hmem', 'curate memory', 'consolidate duplicates', 'merge duplicate entries', 'fix broken links', 'kümmer dich um die Memory', or invokes /o9k-curate. Also trigger when `memory_health()` flags BLOCKER/WARNING issues, when a P-entry's load_project output exceeds 4k tokens (session-start noise check defers to this skill), or before any batch cleanup of L, E, D, P entries. Skipping this skill and editing memory directly bypasses health checks, severity triage, and obsolete-chain integrity — never curate without it.
testing
Add a new rule and place it correctly — decide between a cross-project R-entry and a project-specific subnode under the active project's Rules section. Use whenever the user says 'neue Regel', 'Regel hinzufügen', 'new rule', 'add a rule', or invokes /o9k-new-rule. Critical safeguard: project-specific rules placed as R-entries pollute the session-start Rules listing across every project — get the scope right BEFORE writing.