home / skills / yonatangross / orchestkit / recall
/plugins/ork/skills/recall
This skill helps you search the knowledge graph to recall past decisions and patterns with graph-first accuracy.
npx playbooks add skill yonatangross/orchestkit --skill recallReview the files below or copy the command above to add this skill to your agents.
---
name: recall
description: Search and retrieve decisions and patterns from knowledge graph. Use when recalling patterns, retrieving memories, finding past decisions.
context: none
version: 2.1.0
author: OrchestKit
tags: [memory, search, decisions, patterns, graph-memory, mem0, unified-memory]
user-invocable: true
allowedTools: [Read, Grep, Glob, Bash, mcp__memory__search_nodes, mcp__mem0__search_memories]
skills: [remember, memory-fabric]
---
# Recall - Search Knowledge Graph
Search past decisions and patterns from the knowledge graph with optional cloud semantic search enhancement.
## Graph-First Architecture (v2.1)
The recall skill uses **graph memory as PRIMARY** search:
1. **Knowledge Graph (PRIMARY)**: Entity and relationship search via `mcp__memory__search_nodes` - FREE, zero-config, always works
2. **Semantic Memory (mem0)**: Optional cloud search via `search-memories.py` script - requires MEM0_API_KEY, use with `--mem0` flag
**Benefits of Graph-First:**
- Zero configuration required - works out of the box
- Explicit entity and relationship queries
- Fast local search with no network latency
- No cloud dependency for basic operation
- Optional cloud enhancement with `--mem0` flag for semantic similarity search
## Overview
- Finding past architectural decisions
- Searching for recorded patterns
- Looking up project context
- Retrieving stored knowledge
- Querying cross-project best practices
- Finding entity relationships
## Usage
```
/recall <search query>
/recall --category <category> <search query>
/recall --limit <number> <search query>
# Cloud-enhanced search (v2.1.0+)
/recall --mem0 <query> # Search BOTH graph AND mem0 cloud
/recall --mem0 --limit 20 <query> # More results from both systems
# Scoped search
/recall --agent <agent-id> <query> # Filter by agent scope
/recall --global <query> # Search cross-project best practices
```
## Advanced Flags
| Flag | Behavior |
|------|----------|
| (default) | Search graph only |
| `--mem0` | Search BOTH graph and mem0 cloud |
| `--limit <n>` | Max results (default: 10) |
| `--category <cat>` | Filter by category |
| `--agent <agent-id>` | Filter results to a specific agent's memories |
| `--global` | Search cross-project best practices |
## Context-Aware Result Limits (CC 2.1.6)
Result limits automatically adjust based on `context_window.used_percentage`:
| Context Usage | Default Limit | Behavior |
|---------------|---------------|----------|
| 0-70% | 10 results | Full results with details |
| 70-85% | 5 results | Reduced, summarized results |
| >85% | 3 results | Minimal with "more available" hint |
## Workflow
### 1. Parse Input
```
Check for --category <category> flag
Check for --limit <number> flag
Check for --mem0 flag β search_mem0: true
Check for --agent <agent-id> flag β filter by agent_id
Check for --global flag β search global scope
Extract the search query
```
### 2. Search Knowledge Graph (PRIMARY)
Use `mcp__memory__search_nodes`:
```json
{
"query": "user's search query"
}
```
**Knowledge Graph Search:**
- Searches entity names, types, and observations
- Returns entities with their relationships
- Finds patterns like "X uses Y", "X recommends Y"
**Entity Types to Look For:**
- `Technology`: Tools, frameworks, databases (pgvector, PostgreSQL, React)
- `Agent`: OrchestKit agents (database-engineer, backend-system-architect)
- `Pattern`: Named patterns (cursor-pagination, connection-pooling)
- `Decision`: Architectural decisions
- `Project`: Project-specific context
- `AntiPattern`: Failed patterns
### 3. Search mem0 (OPTIONAL - only if --mem0 flag)
**Skip if `--mem0` flag NOT set or MEM0_API_KEY not configured.**
Execute the script IN PARALLEL with step 2:
```bash
!bash skills/mem0-memory/scripts/crud/search-memories.py \
--query "user's search query" \
--user-id "orchestkit-{project-name}-decisions" \
--limit 10 \
--enable-graph
```
**User ID Selection:**
- Default: `orchestkit-{project-name}-decisions`
- With `--global`: `orchestkit-global-best-practices`
**Filter Construction:**
- Always include `user_id` filter
- With `--category`: Add `{ "metadata.category": "{category}" }` to AND array
- With `--agent`: Add `{ "agent_id": "ork:{agent-id}" }` to AND array
### 4. Merge and Deduplicate Results (if --mem0)
**Only when both systems return results:**
1. Collect results from both systems
2. For each mem0 memory, check if its text matches a graph entity observation
3. If matched, mark as `[CROSS-REF]` and merge metadata
4. Remove pure duplicates (same content from both systems)
5. Sort: graph results first, then mem0 results, cross-refs highlighted
### 5. Format Results
**Graph-Only Results (default):**
```
π Found {count} results matching "{query}":
[GRAPH] {entity_name} ({entity_type})
β {relation1} β {target1}
β {relation2} β {target2}
Observations: {observation1}, {observation2}
[GRAPH] {entity_name2} ({entity_type2})
Observations: {observation}
```
**With --mem0 (combined results):**
```
π Found {count} results matching "{query}":
[GRAPH] {entity_name} ({entity_type})
β {relation} β {target}
Observations: {observation}
[GRAPH] {entity_name2} ({entity_type2})
Observations: {observation}
[MEM0] [{time ago}] ({category}) {memory text}
[MEM0] [{time ago}] ({category}) {memory text}
[CROSS-REF] {memory text} (linked to {N} graph entities)
π Linked entities: {entity1}, {entity2}
```
**With --mem0 when MEM0_API_KEY not configured:**
```
π Found {count} results matching "{query}":
[GRAPH] {entity_name} ({entity_type})
β {relation} β {target}
Observations: {observation}
β οΈ mem0 search requested but MEM0_API_KEY not configured (graph-only results)
```
**High Context Pressure (>85%):**
```
π Found 12 matches (showing 3 due to context pressure at 87%)
[GRAPH] pgvector (Technology)
β USED_FOR β RAG
[GRAPH] cursor-pagination (Pattern)
[GRAPH] database-engineer (Agent)
β RECOMMENDS β pgvector
More results available. Use /recall --limit 10 to override.
```
### 6. Handle No Results
```
π No results found matching "{query}"
Searched:
β’ Knowledge graph: 0 entities
Try:
β’ Broader search terms
β’ /remember to store new decisions
β’ --global flag to search cross-project best practices
β’ --mem0 flag to include cloud semantic search
```
## Time Formatting
| Duration | Display |
|----------|---------|
| < 1 day | "today" |
| 1 day | "yesterday" |
| 2-7 days | "X days ago" |
| 1-4 weeks | "X weeks ago" |
| > 4 weeks | "X months ago" |
## Examples
### Basic Graph Search
**Input:** `/recall database`
**Output:**
```
π Found 3 results matching "database":
[GRAPH] PostgreSQL (Technology)
β CHOSEN_FOR β ACID-requirements
β USED_WITH β pgvector
Observations: Chosen for ACID requirements and team familiarity
[GRAPH] database-engineer (Agent)
β RECOMMENDS β pgvector
β RECOMMENDS β cursor-pagination
Observations: Uses pgvector for RAG applications
[GRAPH] cursor-pagination (Pattern)
Observations: Scales well for large datasets
```
### Category Filter
**Input:** `/recall --category architecture API`
**Output:**
```
π Found 2 results matching "API" (category: architecture):
[GRAPH] api-gateway (Architecture)
β IMPLEMENTS β rate-limiting
β USES β JWT-authentication
Observations: Central entry point for all services
[GRAPH] REST-API (Pattern)
β FOLLOWS β OpenAPI-spec
Observations: Standard for external-facing APIs
```
### Cloud-Enhanced Search
**Input:** `/recall --mem0 database`
**Output:**
```
π Found 5 results matching "database":
[GRAPH] PostgreSQL (Technology)
β CHOSEN_FOR β ACID-requirements
Observations: Chosen for ACID requirements
[GRAPH] database-engineer (Agent)
β RECOMMENDS β pgvector
Observations: Uses pgvector for RAG
[MEM0] [2 days ago] (decision) PostgreSQL chosen for ACID requirements and team familiarity
[MEM0] [1 week ago] (pattern) Database connection pooling with pool_size=10, max_overflow=20
[CROSS-REF] [3 days ago] pgvector for RAG applications (linked to 2 entities)
π Linked: database-engineer, pgvector
```
### Agent-Scoped Search
**Input:** `/recall --agent backend-system-architect "API patterns"`
**Output:**
```
π Found 2 results from backend-system-architect:
[GRAPH] backend-system-architect (Agent)
β RECOMMENDS β cursor-pagination
β RECOMMENDS β repository-pattern
Observations: Use versioned endpoints: /api/v1/, /api/v2/
[GRAPH] repository-pattern (Pattern)
Observations: Separate controllers, services, and repositories
```
### Cross-Project Search
**Input:** `/recall --global --category pagination`
**Output:**
```
π Found 3 GLOBAL best practices (pagination):
[GRAPH] cursor-pagination (Pattern)
β SCALES_FOR β large-datasets
β PREFERRED_OVER β offset-pagination
Observations: From project: ecommerce, analytics, cms
[GRAPH] keyset-pagination (Pattern)
β USED_FOR β real-time-feeds
Observations: From project: analytics
[GRAPH] offset-pagination (AntiPattern)
Observations: Caused timeouts on 1M+ rows
```
### Relationship Query
**Input:** `/recall what does database-engineer recommend`
**Output:**
```
π Found relationships for database-engineer:
[GRAPH] database-engineer (Agent)
β RECOMMENDS β pgvector
β RECOMMENDS β cursor-pagination
β RECOMMENDS β connection-pooling
β USES β PostgreSQL
Observations: Specialist in database architecture
```
## Related Skills
- remember: Store information for later recall
## Error Handling
- If knowledge graph unavailable, show configuration instructions
- If --mem0 requested without MEM0_API_KEY, proceed with graph-only and notify user
- If search query empty, show recent entities instead
- If no results, suggest alternatives
- If --agent used without agent-id, show available agents
- If --global returns no results, suggest storing with /remember --global
- If --mem0 returns partial results (mem0 failed), show graph results with degradation notice
This skill searches and retrieves past decisions, patterns, and relationships from a project knowledge graph, with optional cloud semantic enhancement via mem0. It is graph-first: local graph search works out of the box and mem0 is optional for semantic similarity. Use it to quickly surface architectural decisions, best practices, agent recommendations, and cross-project patterns.
The skill parses flags (--mem0, --limit, --category, --agent, --global) and the query, then executes a primary graph search using mcp__memory__search_nodes to find entities, types, observations and relationships. If --mem0 is set and a MEM0_API_KEY is configured, it concurrently runs a mem0 semantic search and then merges, deduplicates, and highlights cross-references. Results are formatted with graph entries first, mem0 entries next, and contextual trimming when the conversation context window is high.
What happens if I request --mem0 but MEM0_API_KEY is not configured?
The skill returns graph-only results and includes a notice that mem0 was requested but not configured.
How does the skill avoid duplicate results between graph and mem0?
When both systems return matches, mem0 texts are compared to graph observations; matches are marked as cross-references, merged metadata, and pure duplicates are removed.