DEV Community

Walter Ceder
Walter Ceder

Posted on

I built 11 hooks that give Claude Code persistent memory, safety guards, and AFK mode

Claude Code loses all context between sessions. /compact makes it worse.
Dangerous commands run with no warning.

I built AutoDream to fix all three.

What it does

  • Persistent memory — injects project context into every prompt automatically
  • Safety guard — dual-layer danger scoring blocks risky commands before they run
  • /compact survival — saves state before compaction, re-injects it after
  • Auto-learning — captures decisions and key edits every session
  • AFK mode — drop tasks in a queue, agents work while you're away

Three operating modes

Active — 11 hooks fire automatically while you work across all 6 Claude Code hook events (PreToolUse, UserPromptSubmit, PostToolUse, PreCompact, PostCompact, Stop)

AFK — scheduled agents process your task queue while you're away, write a report, wait for your return

Maintenance — memory consolidates and deduplicates itself overnight

Hook architecture

Event Hooks
PreToolUse guardian, critic-evaluator, circuit-breaker
UserPromptSubmit context injection
PostToolUse learn, verification, microcompact
PreCompact state saver
PostCompact reorient
Stop memory-extractor, dream

Install


bash
git clone https://github.com/JaWaMi73/AutoDream ~/.claude/autodream
cp ~/.claude/autodream/hooks/*.cjs ~/.claude/hooks/

MIT licensed. Full install guide in the repo.
GitHub: https://github.com/JaWaMi73/AutoDream
Enter fullscreen mode Exit fullscreen mode

Top comments (0)