Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
alinaqi avatar

Mnemos

  • 3 installs
  • 706 repo stars
  • Updated July 14, 2026
  • alinaqi/maggy

mnemos is a Claude Code skill that provides task-scoped working memory as a typed graph with per-type eviction policies and hook-driven checkpointing to survive context compaction.

About

mnemos is a task-scoped memory lifecycle skill that prevents lossy context compaction from destroying an agent's structured knowledge. It models working memory as a typed graph (MnemoGraph) where goals and constraints are never evicted, results are compressed, and checkpoints persist to disk. A four-dimension fatigue model watches token usage and behavior to trigger auto-checkpoints, and a three-layer defense re-injects the checkpoint after Claude Code compacts. A developer uses it to keep decisions and handoffs durable across long agent sessions.

  • Typed MnemoGraph so goals/constraints are never evicted while context nodes can be
  • A 4-dimension fatigue model that auto-checkpoints and consolidates from hook data
  • Three-layer post-compaction recovery that re-injects the checkpoint after Claude Code compacts

Mnemos by the numbers

  • 3 all-time installs (skills.sh)
  • Ranked #13,675 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

mnemos capabilities & compatibility

Free; stores everything locally in a gitignored .mnemos/ SQLite database.

Capabilities
memory · checkpointing · context recovery · orchestration
Use cases
memory · orchestration
Runs
Runs locally
Pricing
Free
From the docs

What mnemos says it does

Mnemos prevents lossy context compaction from destroying the structured knowledge you need most.
SKILL.md
**GoalNodes** and **ConstraintNodes** are NEVER evicted — they survive all compaction
SKILL.md
Everything lives in `.mnemos/` (gitignored):
SKILL.md
npx skills add https://github.com/alinaqi/maggy --skill mnemos

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3
repo stars706
Last updatedJuly 14, 2026
Repositoryalinaqi/maggy

What it does

Give a coding agent durable working memory across context compactions by checkpointing goals, constraints, and decisions and re-injecting them after compaction.

Who is it for?

Long-running coding-agent tasks that hit context compaction and need to preserve decisions and handoffs.

Skip if: Short sessions that never approach the context limit and need no durable memory.

When should I use this skill?

When you need durable working memory across compactions - checkpoint decisions, preserve task handoffs, or audit what was remembered.

What you get

Goals and constraints survive all compaction, checkpoints persist to disk, and a full checkpoint is re-injected after compaction so the agent resumes.

  • .mnemos/ store (mnemo.db, fatigue.json, checkpoints)
  • hook-driven checkpoint and re-injection setup

By the numbers

  • 4-dimension fatigue model (token 0.40, scope 0.25, re-read 0.20, error 0.15)
  • Three-layer post-compaction recovery
  • Compaction triggers around 83% full

Files

SKILL.mdMarkdownGitHub ↗

Mnemos — Task-Scoped Memory Lifecycle

What It Does

Mnemos prevents lossy context compaction from destroying the structured knowledge you need most. It treats your working memory as a typed graph (MnemoGraph) where different types of knowledge have different eviction policies:

  • GoalNodes and ConstraintNodes are NEVER evicted — they survive all compaction
  • ResultNodes are compressed (summary kept) before eviction
  • ContextNodes are evictable when their activation weight drops
  • CheckpointNodes persist to disk for session resume

Fatigue Model

Mnemos monitors 4 dimensions of "agent fatigue" — all passively observed from hook data, no manual input needed:

DimensionWeightSignal SourceWhat It Measures
Token utilization0.40Statusline JSONHow full the context window is
Scope scatter0.25PreToolUse file pathsHow many directories the agent is bouncing between
Re-read ratio0.20PreToolUse Read callsHow often the agent re-reads files it already read (context loss)
Error density0.15PostToolUse outcomesWhat fraction of tool calls are failing (agent struggling)

Fatigue states and actions:

StateScoreAction
FLOW0.0–0.4Normal operation
COMPRESS0.4–0.6Micro-consolidation runs (compress 3 ResultNodes, evict 1 cold ContextNode)
PRE-SLEEP0.6–0.75Checkpoint written, consolidation runs
REM0.75–0.9Emergency checkpoint, consider wrapping up
EMERGENCY0.9+Checkpoint written, hand off immediately

How To Use

Automatic (hooks handle everything):

1. Statusline writes fatigue.json on every API call 2. PreToolUse hook reads fatigue before every edit, auto-checkpoints at 0.60+ 3. PreCompact hook writes emergency checkpoint, compaction marker, and tells summarizer what to preserve 4. SessionStart "compact" fires immediately after compaction, re-injects full checkpoint (primary restore) 5. SessionStart "startup|resume" loads last checkpoint on new/resumed sessions 6. PreToolUse fallback (no matcher) detects compaction marker if SessionStart didn't fire 7. Stop hook writes final checkpoint for next session

Post-Compaction Recovery (Three-Layer Defense):

When Claude Code compacts the context (~83% full), Mnemos uses three layers:

  • Layer 1 (PreCompact): Outputs strong preservation instructions with inline checkpoint content for the summarizer. Writes .mnemos/just-compacted marker.
  • Layer 2 (SessionStart "compact"): PRIMARY re-injection. Fires immediately when Claude resumes after compaction — before any agent action. Consumes the marker and injects the full checkpoint into the fresh context. This is the recommended approach per the RFC (Wake State Reconstruction).
  • Layer 3 (PreToolUse fallback): If SessionStart doesn't fire (older versions, edge cases), the first tool call triggers mnemos-post-compact-inject.sh which detects the marker and injects. Safety net only.

The result: after compaction, you'll see a "CONTEXT RESTORED AFTER COMPACTION" block with your goal, constraints, what you were working on, and progress. Resume from there.

Manual CLI:

mnemos init                    # Initialize .mnemos/
mnemos status                  # Show node counts + fatigue
mnemos fatigue                 # Detailed fatigue breakdown
mnemos checkpoint --force      # Write checkpoint now
mnemos resume                  # Output checkpoint for context
mnemos consolidate             # Run micro-consolidation
mnemos nodes --type goal       # List active GoalNodes
mnemos add goal "Build auth"   # Add a GoalNode
mnemos bridge-icpg             # Import iCPG ReasonNodes

Agent Instructions

When working on a task:

1. Create a GoalNode at the start: mnemos add goal "what you're trying to achieve" --task-id session-1 2. Add ConstraintNodes for invariants: mnemos add constraint "API backward compatibility" --scope src/api/ 3. Check fatigue before long operations: mnemos fatigue 4. Checkpoint at sub-goal boundaries: mnemos checkpoint 5. On session resume: the SessionStart hook automatically loads your checkpoint

iCPG Integration

Mnemos bridges with iCPG (Intent-Augmented Code Property Graph):

  • mnemos bridge-icpg imports active ReasonNodes as GoalNodes
  • Postconditions/invariants become ConstraintNodes
  • Checkpoint includes iCPG state (active intent, unresolved drift)

Storage

Everything lives in .mnemos/ (gitignored):

  • mnemo.db — SQLite MnemoGraph
  • fatigue.json — Live token metrics (updated per API call by statusline)
  • signals.jsonl — Behavioral signal log (appended by PreToolUse + PostToolUse hooks)
  • checkpoint-latest.json — Most recent checkpoint
  • checkpoints/ — Archived checkpoints

Related skills

FAQ

What survives compaction?

GoalNodes and ConstraintNodes are never evicted; ResultNodes are compressed; ContextNodes are evictable; CheckpointNodes persist to disk.

How does it recover after compaction?

A three-layer defense: PreCompact preservation instructions, a primary SessionStart 'compact' re-injection, and a PreToolUse fallback that detects a compaction marker.

AI & Agent Buildingagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.