en un clic
claude-praetorian
// Cross-session memory - save insights after research, restore context at session start. Reduces re-exploration and prevents token waste.
// Cross-session memory - save insights after research, restore context at session start. Reduces re-exploration and prevents token waste.
| name | claude-praetorian |
| description | Cross-session memory - save insights after research, restore context at session start. Reduces re-exploration and prevents token waste. |
| triggers | ["PreToolUse","PostToolUse","SubagentStop","PreCompact"] |
Context guard with automatic workflow nudges. Hooks fire at natural decision points — you decide whether to act on them.
Hooks emit one-line nudges (~20 tokens each). No disk I/O. You judge relevance.
| Hook | When It Fires | What It Says | Your Call |
|---|---|---|---|
| PreToolUse | Before Task, WebSearch, WebFetch | "Check restore — prior context may exist" | Restore if topic is familiar. Skip if clearly novel. |
| PostToolUse | After WebFetch, WebSearch | "Save key findings" | Compact research results. Reuse title to merge. |
| SubagentStop | After subagent completes | "Save key findings" | Compact subagent results. Don't let findings die with the agent. |
| PreCompact | Before any compact call | "Reuse title to merge" | Always follow — prevents duplicate compactions. |
When you see ⚜️ Check praetorian_restore(query="..."):
detail="full"When you see ⚜️ Save key findings: praetorian_compact(...):
praetorian_restore(query="auth JWT") # summary scan (~50 tokens/result)
praetorian_restore(query="auth JWT", detail="full") # full detail for relevant hit
praetorian_restore(project="current") # scope to this project
praetorian_restore() # recent compactions
Hooks handle: PreToolUse nudges before Task/WebSearch/WebFetch.
You handle manually: Before planning sessions, before launching subagents, at session start, after /clear.
Do your research, run subagents, make decisions. Hooks will nudge after.
praetorian_compact(type="web_research", title="auth JWT research",
key_insights=["JWT rotation every 15min", "RS256 preferred over HS256"],
refs=["src/auth/middleware.ts:45"])
Hooks handle: PostToolUse nudges after WebSearch/WebFetch, SubagentStop nudges after agents. You handle manually: After subagents return, after multi-file exploration, after solving a hard problem. Don't wait — compact incrementally.
Critical: Always reuse an existing title to merge. Creating a new compaction costs 1 of 13 slots per project. Merging is free.
praetorian_manage(action="status") # per-project counts, disk usage
praetorian_manage(action="prune", count=3) # remove 3 oldest
praetorian_manage(action="prune", project="/path/to/old-project")
Auto-limit: 13 per project. Oldest auto-pruned when exceeded. Only surface to user when >50 total or >500KB. If store is healthy, stay quiet.
When historian is active, check historian FIRST for conversation-level context, then praetorian for distilled insights. They complement:
When vigil is active, vigil handles file checkpoints. Praetorian handles knowledge checkpoints. Don't duplicate — vigil saves files, praetorian saves understanding.
Good compaction:
Bad compaction:
| Command | Description |
|---|---|
/compact-praetorian [type] [title] | Save current context |
/restore-praetorian [query] | Load previous context |
Automatic tool discovery across 19 sources — INVOKE before planning, before adding dependencies, or when looking for tools to discover relevant skills, plugins, and MCP servers
Use after writing or editing a plan file, after exiting plan mode, or when asked "why did you choose this?" — surfaces decisions, risks, and blind spots before implementation.
Continuous learning — INVOKE after sessions with many errors or corrections to record patterns and improve rules, hooks, and skills
Session history search — INVOKE before planning, before web research, after errors, or when looking for past conversation content. Use INSTEAD of manually grepping .jsonl session files.
File checkpoint and recovery — auto-quicksaves before destructive commands, INVOKE before implementing a plan or starting risky multi-file changes. Also use when user asks to undo changes or compare current state to a prior checkpoint.
Prompt rhetoric coach — deterministic scoring and restructuring using Anthropic best practices