
claude-praetorian
Automatic context preservation hooks for praetorian MCP (saves 50-60% tokens)
- version
- 1.0.0
- GitHub stars
- 80
Install
/plugin install claude-praetorian@claude-emporiumRun it inside Claude Code after adding the marketplace with /plugin marketplace add Vvkmnn/claude-emporium.
Contents
Discovered from sourceSkills 1
Praetorian Plugin
Context guard. Saves and restores valuable context at the right moments — before planning, after research, when subagents complete.
Hooks
| Hook | When | Action |
|---|---|---|
| PreToolUse(EnterPlanMode) | Before planning | Lists prior compactions, suggests restoring |
| PreCompact | Before context resets | Prompts to save decisions/insights/findings |
| PostToolUse(WebFetch/WebSearch) | After web research | Prompts to compact as web_research |
| SubagentStop | After subagent completes | Prompts to compact as task_result |
Commands
| Command | Description |
|---|---|
/compact-praetorian [type] [title] | Save current context |
/restore-praetorian [query] | Load previous context |
Workflows
Compact (standalone)
- Identify what's worth saving (research, decisions, patterns)
praetorian_compact(type, title, key_insights, refs)- Verify with
praetorian_restore(title)to confirm it saved
Compact (with siblings)
- If historian active:
search_plans()to check if past context already covers this - If oracle active: include any tool discoveries in
key_insights praetorian_compact(type, title, key_insights, refs)- If vigil active: files are also checkpointed via quicksave
Restore (standalone)
praetorian_restore()— list recent compactionspraetorian_restore("query")— search for specific topic- Summarize findings for the current task
Restore (with siblings)
praetorian_restore("query")— load praetorian context- If historian active:
search_conversations("query")for broader session history - If oracle active:
search("query")for tools relevant to the restored context - Combine all sources into a unified briefing
Sibling Synergy
| Sibling | Value | How |
|---|---|---|
| Historian | Past plans surface during planning compactions | search_plans() enriches pre-plan hook |
| Oracle | Tool discoveries included in compactions | Oracle results added to key_insights |
| Gladiator | Observations inform what to compact | Failure patterns highlight important context |
| Vigil | Files checkpointed alongside context | Quicksave protects files during compaction |
Requires
claude mcp add praetorian -- npx claude-praetorian-mcp
Commands 2
/compact-praetorian
Save valuable context for future sessions using praetorian memory.
Usage
/compact-praetorian- Interactive mode (you'll be asked for type and title)/compact-praetorian web_research- Save as web research/compact-praetorian task_result "Auth implementation"- Save with title
Types
| Type | Use For |
|---|---|
web_research | WebFetch results, API docs, research |
task_result | Subagent results, exploration findings |
file_reads | Codebase patterns, architecture insights |
decisions | Technical decisions with rationale |
Action
Call praetorian_compact() with:
type: One of the types abovetitle: Concise description of what's being savedkey_insights: Array of main findingsrefs: Array of file:line references (if applicable)
Example
praetorian_compact(
type: "web_research",
title: "React 19 Server Components",
key_insights: [
"Server components can't use useState/useEffect",
"Use 'use client' directive for client components",
"Server components can directly access databases"
],
refs: []
)
/restore-praetorian
Load previous work from praetorian memory.
Usage
/restore-praetorian- Show recent compactions (last 3-5)/restore-praetorian auth- Search for auth-related context/restore-praetorian "API design"- Search for specific topic
Action
Call praetorian_restore(query?) and summarize the results:
- Without query: Returns most recent compactions
- With query: Semantic search across all compactions
When to Use
- Session start: Check if previous work exists for current task
- Resuming work: Load context from previous sessions
- Context low: Restore key insights before compaction clears context
Example Output
Found 2 relevant compactions:
1. "Auth Implementation" (decisions, Jan 9)
- Using JWT with refresh tokens
- Storing tokens in httpOnly cookies
- Middleware pattern at src/middleware/auth.ts
2. "API Research" (web_research, Jan 8)
- REST best practices from OpenAPI spec
- Rate limiting patterns
MCP servers 1
Sponsors
Details
- Marketplace
- Vvkmnn/claude-emporium
- Source
- plugins/claude-praetorian
- Author
- vvkmnn
- Category
- Productivity