Vvkmnn avatar

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-emporium

Run it inside Claude Code after adding the marketplace with /plugin marketplace add Vvkmnn/claude-emporium.

Contents

Discovered from source

Skills 1

Praetorian Plugin

Context guard. Saves and restores valuable context at the right moments — before planning, after research, when subagents complete.

Hooks

HookWhenAction
PreToolUse(EnterPlanMode)Before planningLists prior compactions, suggests restoring
PreCompactBefore context resetsPrompts to save decisions/insights/findings
PostToolUse(WebFetch/WebSearch)After web researchPrompts to compact as web_research
SubagentStopAfter subagent completesPrompts to compact as task_result

Commands

CommandDescription
/compact-praetorian [type] [title]Save current context
/restore-praetorian [query]Load previous context

Workflows

Compact (standalone)

  1. Identify what's worth saving (research, decisions, patterns)
  2. praetorian_compact(type, title, key_insights, refs)
  3. Verify with praetorian_restore(title) to confirm it saved

Compact (with siblings)

  1. If historian active: search_plans() to check if past context already covers this
  2. If oracle active: include any tool discoveries in key_insights
  3. praetorian_compact(type, title, key_insights, refs)
  4. If vigil active: files are also checkpointed via quicksave

Restore (standalone)

  1. praetorian_restore() — list recent compactions
  2. praetorian_restore("query") — search for specific topic
  3. Summarize findings for the current task

Restore (with siblings)

  1. praetorian_restore("query") — load praetorian context
  2. If historian active: search_conversations("query") for broader session history
  3. If oracle active: search("query") for tools relevant to the restored context
  4. Combine all sources into a unified briefing

Sibling Synergy

SiblingValueHow
HistorianPast plans surface during planning compactionssearch_plans() enriches pre-plan hook
OracleTool discoveries included in compactionsOracle results added to key_insights
GladiatorObservations inform what to compactFailure patterns highlight important context
VigilFiles checkpointed alongside contextQuicksave 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

TypeUse For
web_researchWebFetch results, API docs, research
task_resultSubagent results, exploration findings
file_readsCodebase patterns, architecture insights
decisionsTechnical decisions with rationale

Action

Call praetorian_compact() with:

  • type: One of the types above
  • title: Concise description of what's being saved
  • key_insights: Array of main findings
  • refs: 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

More from Vvkmnn/claude-emporium

All 6