recursive-knowledge
Process large document corpora (1000+ docs, millions of tokens) through knowledge graph construction and stateful multi-hop reasoning. Use when (1) User provides a large corpus exceeding context limits, (2) Questions require connections across multiple documents, (3) Multi-hop reasoning needed for complex queries, (4) User wants persistent queryable knowledge from documents. Replaces brute-force document stuffing with intelligent graph traversal.
What this skill does
# Recursive Knowledge Processing Process arbitrarily large document sets through knowledge graph construction and stateful multi-hop queries. Based on RLM research but with proper state management and termination logic. ## Core Concept Instead of stuffing documents into context (which causes degradation), this skill: 1. Indexes documents into a knowledge graph (entities, relationships) 2. Answers queries by traversing the graph 3. Tracks state to avoid redundant exploration 4. Uses confidence thresholds to know when to stop ## Workflow ### Phase 1: Indexing For a new corpus, run the indexer: ```python python3 scripts/index_corpus.py --input /path/to/documents --output /path/to/graph.json ``` This extracts: - **Entities**: People, organizations, concepts, dates, locations - **Relationships**: References, mentions, contradicts, supports, relates_to - **Metadata**: Source document, position, extraction confidence For details on entity/relationship schema, see [references/graph-schema.md](references/graph-schema.md). ### Phase 2: Querying For user queries against an indexed corpus: ```python python3 scripts/query.py --graph /path/to/graph.json --query "user question here" ``` The query engine: 1. Parses query into target entities/relationships 2. Finds entry points in graph 3. Traverses with state tracking 4. Stops when confidence threshold met 5. Returns answer with provenance ### Phase 3: Incremental Updates Add new documents to existing graph: ```python python3 scripts/index_corpus.py --input /path/to/new_docs --output /path/to/graph.json --append ``` ## State Management (Critical) The key improvement over naive recursive approaches is **stateful traversal**. See [references/state-management.md](references/state-management.md) for full details. **During query execution, track:** | State | Purpose | |-------|---------| | `visited_nodes` | Prevent re-exploring same entities | | `visited_edges` | Prevent re-traversing same relationships | | `findings` | Accumulated evidence with sources | | `confidence` | Current certainty level (0-1) | | `depth` | Current traversal depth | **Termination conditions:** ```python STOP if: - confidence >= 0.85 (high certainty) - len(corroborating_sources) >= 3 (multiple agreement) - depth > max_depth (prevent infinite exploration) - all relevant paths exhausted ``` ## Multi-Hop Reasoning For questions requiring connection across documents: 1. Identify query components (what entities/facts needed) 2. Find entry points for each component 3. Traverse from each entry point 4. Look for path intersections 5. Synthesize findings at intersection points Example: "Who worked with X on project Y?" - Entry point 1: Entity "X" → relationships → projects - Entry point 2: Entity "Project Y" → relationships → people - Intersection: People connected to both X and Project Y See [references/traversal-patterns.md](references/traversal-patterns.md) for patterns. ## When NOT to Use This Skill - Small document sets that fit in context (<50k tokens) - just use direct context - Simple keyword search - use grep/search tools instead - No multi-hop reasoning needed - simpler approaches work - Real-time streaming data - this is for static corpora ## File Reference - `scripts/index_corpus.py` - Build graph from documents - `scripts/query.py` - Execute queries with state management - `scripts/graph_ops.py` - Graph CRUD utilities - `references/graph-schema.md` - Entity and relationship types - `references/state-management.md` - Termination and confidence logic - `references/traversal-patterns.md` - Multi-hop query patterns
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.