home / skills / yonatangross / orchestkit / load-context
/plugins/ork/skills/load-context
This skill auto-loads relevant memories at session start from Mem0 and the knowledge graph to restore context and improve continuity.
npx playbooks add skill yonatangross/orchestkit --skill load-contextReview the files below or copy the command above to add this skill to your agents.
---
name: load-context
description: Auto-load relevant memories at session start from both mem0 and graph. Use when you need session context restored or preloaded.
tags: [memory, mem0, graph, session, context, continuity, auto-load]
user-invocable: true
allowedTools: [Read, Grep, Glob, mcp__mem0__search_memories, mcp__mem0__get_memories, mcp__memory__search_nodes, mcp__memory__read_graph]
auto-invoke: session-start
context: inherit
skills: [recall, remember]
version: 1.0.0
author: OrchestKit
---
# Load Context - Memory Fabric Initialization
Auto-load relevant memories at session start from both Mem0 semantic memory and the knowledge graph for seamless session continuity.
**CC 2.1.6 Context-Aware:** Loading adapts based on `context_window.used_percentage`.
## Overview
- **Automatically**: Invoked at session start via `auto-invoke: session-start`
- **Manually**: Run `/load-context` to reload memories mid-session
- **After MCP reconnect**: Refresh context if MCP servers were restarted
## Context-Aware Loading Tiers
Memory Fabric adjusts how much context to load based on current context pressure:
| Context Usage | Decisions | Blockers | Entities | Behavior |
|---------------|-----------|----------|----------|----------|
| 0-40% (Green) | 5 | 3 | 5 | Full context load |
| 40-70% (Yellow) | 3 | 1 | 3 | Reduced context |
| 70-90% (Orange) | 1 | critical only | 0 | Minimal context |
| >90% (Red) | 0 | 0 | 0 | Skip, show hint only |
## Workflow
### 1. Check Context Pressure
```
If context_window.used_percentage > 90%:
→ Output: "[Memory Fabric] Skipping - context at {X}%"
→ Exit early
If > 70%: Use minimal tier (1 decision, critical blockers only)
If > 40%: Use reduced tier (3 decisions, 1 blocker, 3 entities)
```
### 2. Query Recent Sessions (Mem0)
Call `mcp__mem0__search_memories`:
```json
{
"query": "session context blockers next steps",
"filters": {
"AND": [
{ "user_id": "{project}-continuity" },
{ "created_at": { "gte": "7 days ago" } }
]
},
"limit": 3,
"enable_graph": true
}
```
### 3. Query Recent Decisions (Mem0)
Call `mcp__mem0__get_memories`:
```json
{
"filters": {
"AND": [{ "user_id": "{project}-decisions" }]
},
"page_size": 5
}
```
### 4. Query Graph Entities
Call `mcp__memory__search_nodes`:
```json
{
"query": "recent decisions patterns"
}
```
### 5. Format Output
```
[Memory Fabric Loaded]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Recent Decisions ({count}):
- [{time ago}] {decision_text}
Unresolved Blockers ({count}):
- {blocker_text} (session {date})
Active Entities ({count}):
- {entity} -> {relation} -> {entity}
Next Steps from Last Session:
- {step_1}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
## Error Handling
### MCP Unavailable
Show configuration hints and continue without that source:
```
[Memory Fabric]
Mem0 MCP server unavailable. Run /configure to enable.
Continuing without semantic memory...
```
### No Memories Found
```
[Memory Fabric Loaded]
No memories found for this project.
This is normal for new projects. Use /remember to start building memory.
```
## Related Skills
- `mem0-sync` - Save context at session end
- `remember` - Store decisions and patterns manually
- `recall` - Search memories on-demand
## Arguments
- No arguments: Load context using default settings
- `--refresh`: Force reload even if recently loaded
- `--verbose`: Show detailed MCP query results
This skill auto-loads relevant memories at session start from both semantic memory (Mem0) and the knowledge graph to restore or preload session context. It adapts how much to load based on current context pressure and can be invoked automatically at session start or manually with a command. Use it to maintain continuity across reconnects, restarts, or when resuming work after interruptions.
At launch the skill checks context_window.used_percentage and selects a loading tier (full, reduced, minimal, or skip) to avoid overfilling the context window. It queries recent session summaries and decisions from Mem0 and recent nodes from the graph, then composes a compact, human-readable summary of recent decisions, unresolved blockers, active entities, and next steps. If an MCP source is unavailable it returns helpful hints and continues with available sources.
What happens if context is almost full?
The skill uses tiers: it reduces loaded content as context pressure rises and will skip loading entirely above 90%, emitting a skip hint.
What if the MCP Mem0 or graph is unavailable?
It logs a clear hint about the unavailable source, continues with remaining sources, and advises configuration steps to recover.
How do I force a full reload?
Run the command with --refresh to bypass recent-load checks and force reloading from Mem0 and the graph.