Loading...
Loading...
Orchestrates context retrieval from three CLI sources: limitless (personal life transcripts), research (online documentation/facts), pieces (local code/LTM). Use when external context is needed beyond the current codebase. Triggers on /context, /limitless, /research, /pieces, or balanced detection on complex prompts involving personal memory, technical documentation, or development history.
npx skill4agent add zpankz/mcp-skillset context-orchestrator/context [query]/limitless [query]/research [query]/pieces [query]README.md| Source | CLI | Data Type | Best For |
|---|---|---|---|
| Personal | | Life transcripts, meetings, conversations | "What did I discuss...", "Yesterday's meeting..." |
| Online | | Documentation, facts, academic papers | "How to implement...", "Verify that..." |
| Local | | Code snippets, work history, LTM | "My previous implementation...", "Code I wrote..." |
| Command | Description | Mode |
|---|---|---|
| Multi-source extraction | Parallel (all relevant) |
| Personal life context | Single (limitless) |
| Online documentation | Single (research) |
| Local code context | Single (pieces) |
personal_context:
patterns:
- "what did (I|we) (discuss|talk|say|mention)"
- "meeting|conversation|daily|yesterday|last week"
- "lifelog|pendant|recording"
- "(told me|mentioned|said) about"
primary_cli: limitless
fallback: pieces (if code-related)
online_research:
patterns:
- "documentation|docs for|how to"
- "fact-check|verify|confirm|is it true"
- "api|sdk|library|framework"
- "best practice|implementation guide"
- "pex|medical|grounding"
primary_cli: research
fallback: pieces (for code examples)
local_context:
patterns:
- "my code|code I wrote|my implementation"
- "saved|snippet|previous solution"
- "ltm|long-term memory|work history"
- "what was I working on"
primary_cli: pieces
fallback: limitless (for discussion context)User Request
│
├── Explicit Command?
│ ├── /context → Parallel Mode (all sources)
│ ├── /limitless → Single Mode (limitless)
│ ├── /research → Single Mode (research)
│ └── /pieces → Single Mode (pieces)
│
├── Intent Detection (from hook signal)
│ ├── Personal patterns → limitless
│ ├── Research patterns → research
│ ├── Local patterns → pieces
│ └── Multiple matches → Parallel Mode
│
└── No Clear Signal
└── Skip (no external context needed)mode: single
process:
1. Identify primary CLI from intent
2. Construct appropriate command
3. Execute and capture output
4. Return structured context
latency: 1-5 seconds/contextmode: parallel
process:
1. Spawn subagents for each relevant CLI
2. Execute extractions in parallel
3. Collect and merge results
4. Deduplicate and rank by relevance
latency: Max of individual CLIs (5-15 seconds)mode: augmented
process:
1. Pre-enrichment: Gather personal/local context
2. Hand off to deep-research Phase 1
3. Use research CLI as primary in Phase 3
4. Include pieces patterns in triangulation
integration_point: Phase 0 pre-enrichment# SEMANTIC SEARCH (Recommended) - Vector-based similarity
limitless semantic-search "ICU critical care" --types Lifelog,Chat,Person --limit 5 --json
# Hybrid search (semantic + full-text)
limitless search "medical exam" --mode hybrid --json
# Full-text search (keyword)
limitless lifelogs search "query" --limit 10 --format json
# Get today's snapshot
limitless workflow daily $(date +%Y-%m-%d) --format json
# Get recent activity (last N hours)
limitless workflow recent --hours 24 --format json
# Cross-source search
limitless workflow search "query" --format json
# Graph query (for relationships - FalkorDBLite)
limitless graph query "MATCH (p:Person)-[:SPOKE_IN]->(l:Lifelog) RETURN p.name, count(l) ORDER BY count(l) DESC LIMIT 5"
# Check embedding status
limitless index status# Technical documentation
research docs -t "query" -k "framework" --format json
# Fact verification
research fact-check -t "claim to verify" --graph
# Medical/PEX grounding
research pex-grounding -t "medical query"
# SDK/API reference
research sdk-api -t "api question"
# Academic search
research academic -t "research topic"# Ask with LTM (Long-Term Memory)
pieces ask "query" --ltm
# Semantic code search
pieces search --mode ncs "pattern"
# With file context
pieces ask "query" -f file1.py file2.py
# With saved materials
pieces ask "query" -m 1 2 3
# Full-text search
pieces search --mode fts "exact text"limitless_agent:
type: general-purpose
prompt: "Extract personal context using limitless CLI. Query: {query}"
spec: agents/limitless-agent.md
research_agent:
type: researcher
prompt: "Extract online documentation using research CLI. Query: {query}"
spec: agents/research-agent.md
pieces_agent:
type: general-purpose
prompt: "Extract local code context using pieces CLI. Query: {query}"
spec: agents/pieces-agent.mdcache_location: ~/.claude/.context-cache/session-context.json
ttl_by_source:
limitless: 30 minutes # Personal data stable
research: 60 minutes # Docs change slowly
pieces: 15 minutes # Active development
cache_key_format: "{source}:{command_type}:{query_hash}"
invalidation:
- New session starts
- Explicit refresh request
- TTL expiration# Check cache before CLI invocation
cache_key = f"{source}:{hash(query)}"
if cached := get_cache(cache_key):
if not expired(cached):
return cached.result
# After successful extraction
set_cache(cache_key, result, ttl=TTL_BY_SOURCE[source])phase_0_context:
trigger: User has relevant personal/local background
actions:
personal_background:
cli: limitless
query: "Search for relevant conversations about {topic}"
local_patterns:
cli: pieces
query: "Find related code I've written about {topic}"
output:
format: Context briefing for Phase 1 scoping
content:
- Relevant past discussions
- Related code implementations
- Known constraints from experience| Deep-Research Phase | Context Integration |
|---|---|
| Phase 1 (Scoping) | Include personal context as background |
| Phase 3 (Querying) | Use research CLI as primary retrieval |
| Phase 4 (Triangulation) | Add pieces code patterns as evidence |
{
"source": "limitless|research|pieces",
"query": "original query",
"results": [
{
"title": "Result title",
"content": "Extracted content...",
"metadata": {
"timestamp": "ISO8601",
"confidence": 0.85,
"source_type": "lifelog|document|snippet"
}
}
],
"cached": false,
"latency_ms": 1234
}{
"mode": "parallel",
"sources": {
"limitless": { ... },
"research": { ... },
"pieces": { ... }
},
"merged_context": "Synthesized context from all sources...",
"total_latency_ms": 3456
}on_cli_unavailable:
limitless: "Limitless CLI not configured. Skip personal context."
research: "Research CLI not available. Skip online lookup."
pieces: "Pieces not running. Skip local context."
fallback: Continue with available sourcestimeouts:
limitless: 10s
research: 15s
pieces: 8s
on_timeout:
action: Return partial results
message: "Context extraction timed out. Proceeding with available data."{need_limitless: true, confidence: 0.9}limitless lifelogs search "John API deadline" --limit 5 --format json{need_research: true, confidence: 0.85}research docs -t "WebSocket authentication" -k "bun" --format json/context What approach should I use for the auth refactor?/context--limit| CLI | Installation | Required For |
|---|---|---|
| | Personal context |
| | Online documentation |
| | Local code/LTM |
bash ~/.claude/hooks/session-context-primer.sh~/.claude/hooks/context-intent-detector.ts~/.claude/hooks/session-context-primer.sh| File | Purpose | When Loaded |
|---|---|---|
| Quick start, command reference | Always (main skill) |
| Configuration, debugging, upgrades | On maintenance request |
| Subagent specifications | When parallel mode triggered |
| Detailed CLI documentation | When deep reference needed |
| Cache/metrics utilities | On explicit invocation |
grep context ~/.claude/settings.jsonecho '{"prompt":"your query"}' | bun run ~/.claude/hooks/context-intent-detector.ts/context <query>bash ~/.claude/hooks/session-context-primer.shlimitless config showresearch --helppieces mcp statuscat ~/.claude/.context-cache/session-context.jsonpython3 ~/.claude/skill-db/context-orchestrator/scripts/cache-manager.py clearpython3 ~/.claude/skill-db/context-orchestrator/scripts/cache-manager.py stats