home / skills / zpankz / mcp-skillset / context-router

context-router skill

/context-router

This skill routes context extraction to the appropriate CLI tools, enabling parallel, single, or augmented modes for past conversations, docs, and code.

npx playbooks add skill zpankz/mcp-skillset --skill context-router

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
2.8 KB
---
name: context-router
description: |
  Routes context extraction requests to appropriate CLI tools. Triggers on /context,
  /limitless, /research, /pieces, or detected context needs from intent hook.
  Supports single, parallel, and augmented extraction modes.
---

# Context Router

Routes external context extraction to the three-CLI system.

**Trigger Keywords**: context, lifelog, research, ltm, recall, lookup, pieces, limitless, pendant, documentation

## Trigger Conditions

Activate when:
- Explicit commands: `/context`, `/limitless`, `/research`, `/pieces`
- Intent hook signals context need (balanced detection)
- User asks about past conversations, technical docs, or code history

## Source Categories

| Source | CLI | Triggers | Data Type |
|:-------|:----|:---------|:----------|
| **Personal** | limitless | lifelog, pendant, daily, personal, meeting | Transcripts, chats |
| **Research** | research | fact-check, docs, academic, verify, sdk | Citations, documentation |
| **Local** | pieces | ltm, saved, snippets, my code, history | Code, snippets |

## Routing Decision Tree

```
Request Received
    │
    ├── Explicit Command?
    │   ├── /context → Parallel (all sources)
    │   ├── /limitless → Single (limitless)
    │   ├── /research → Single (research)
    │   └── /pieces → Single (pieces)
    │
    ├── Hook Signal Present?
    │   ├── need_limitless=true → Route to limitless
    │   ├── need_research=true → Route to research
    │   ├── need_pieces=true → Route to pieces
    │   └── Multiple → Parallel mode
    │
    └── No Signal
        └── Skip (no context needed)
```

## Mode Selection

| Mode | Trigger | Process |
|------|---------|---------|
| **Single** | Clear single-source intent | Route to one CLI |
| **Parallel** | `/context` or multi-domain | Spawn all relevant CLIs |
| **Augmented** | With deep-research | Pre-enrich Phase 0 |

## CLI Commands

### Limitless (Personal)
```bash
limitless lifelogs search "query" --limit 10 --format json
limitless workflow daily YYYY-MM-DD --format json
limitless workflow recent --hours 24 --format json
```

### Research (Online)
```bash
research docs -t "query" -k "framework" --format json
research fact-check -t "claim" --format json
research pex-grounding -t "medical query" --format json
```

### Pieces (Local)
```bash
pieces ask "query" --ltm
pieces search --mode ncs "pattern"
```

## Integration

- **Skill**: `skill-db/context-orchestrator/SKILL.md`
- **Rules**: `rules/context/*.md`
- **Subagents**: `skill-db/context-orchestrator/agents/*.md`
- **Commands**: `skill-db/context-orchestrator/commands/*.md`
- **Also listed in**: `skills/routers/skills-router/SKILL.md` (Context Skills category)
- **Hooks**: `hooks/context-intent-detector.ts`, `hooks/session-context-primer.sh`

Overview

This skill routes context extraction requests to the appropriate CLI tools to fetch personal, research, or local code context. It recognizes explicit commands and intent signals, then runs single, parallel, or augmented extraction modes to gather relevant passages. The goal is fast, targeted context retrieval to enrich replies or support fact-checking and code lookup. It supports three CLIs: limitless (personal), research (online), and pieces (local).

How this skill works

The router inspects incoming messages and intent hooks for trigger keywords or explicit slash commands. For explicit commands it selects a mode: /context runs parallel extraction across all sources, while /limitless, /research, and /pieces target a single CLI. When the intent hook signals one or more needs, the router routes accordingly and can spawn multiple CLIs concurrently or perform a pre-enrichment phase for deep research.

When to use it

  • User issues /context to search across personal, research, and local sources at once
  • User issues /limitless, /research, or /pieces to target a specific source
  • Agent detects an intent hook indicating need for past conversations, docs, or code history
  • Preparing answers that require citations, technical documentation, or personal logs
  • When you need parallel retrieval to combine multiple context sources for a single response

Best practices

  • Prefer explicit commands when you know which source is needed to reduce latency
  • Use /context for broad queries that benefit from combined context and cross-checking
  • Enable augmented mode for deep research tasks that need pre-enrichment before retrieval
  • Limit parallel runs for very broad queries to avoid noisy or irrelevant results
  • Include concise query terms to improve CLI search precision and reduce returned volume

Example use cases

  • Ask /limitless for meeting transcripts and recent lifelog entries to summarize yesterday’s work
  • Use /research to fact-check a technical claim and return documentation citations
  • Run /pieces to locate local code snippets, prior commits, or saved notes relevant to a bug
  • Invoke /context to gather personal logs, docs, and local snippets when drafting a project update
  • Trigger intent-based routing when the assistant detects a user question about past conversations

FAQ

What happens when multiple intent signals are present?

The router defaults to parallel mode and spawns the relevant CLIs so results from all signaled sources can be combined.

How do I reduce noisy results from parallel extraction?

Narrow your query, prefer single-source commands when possible, or enable augmented mode to pre-enrich and filter results before retrieval.