agentsclimarketplace

Recursive knowledge

Skill bg-szy/TOP-SKILLS/skills/marketplace/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.From its SKILL.md

Install
npx -y skills add bg-szy/TOP-SKILLS --skill recursive-knowledge

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.0 KB, 795 tokens by cl100k_base, as published. Nobody here has run it

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:

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.

Phase 2: Querying

For user queries against an indexed corpus:

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:

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 for full details.

During query execution, track:

StatePurpose
visited_nodesPrevent re-exploring same entities
visited_edgesPrevent re-traversing same relationships
findingsAccumulated evidence with sources
confidenceCurrent certainty level (0-1)
depthCurrent traversal depth

Termination conditions:

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 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

What ships with it: 1 file

52.1 KB alongside SKILL.md

Keep looking

Skills are one crate of 326,750. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.