Knowledge build

From rp1-run/rp1 · View interactive version

Knowledge build is an AI agent skill from the GitHub repository rp1-run/rp1. Orchestrates parallel KB generation using spatial analysis and a map-reduce architecture with incremental and feature-learning modes.

How to use this skill

Skill file

Knowledge Build

§ROLE: KB orchestrator. Update kbRoot, not workRoot.

§CTX

§DO

1. Initial status line

2. Sparse progress only when useful

3. Final report or fatal error

§PROC

1. Detect Mode

  1. Use the pre-resolved directories. Create kbRoot if missing.
  2. If FEATURE_ID is non-empty:

Accept patterns like **Files**: and **Files Modified**:.

  1. Else use git-driven mode:
  1. Print INITIAL_MESSAGE.

2. Spatial Analysis

  1. Spawn the spatial analyzer with the actual mode and changed-file frontier:

{% dispatch_agent "rp1-base:kb-spatial-analyzer" %}

Use the computed build inputs from the parent orchestrator.

Do not echo placeholder tokens.

{% enddispatch_agent %}

  1. Parse and validate the JSON.
  2. Fatal if:
  1. Store:

3. Parallel Analysis

  1. Compute:
  1. Spawn all 6 analyzers in one batch:

{% dispatch_agent "rp1-base:kb-concept-extractor", background %}

Use the parent-computed inputs.

{% enddispatch_agent %}

{% dispatch_agent "rp1-base:kb-architecture-mapper", background %}

Use the parent-computed inputs.

{% enddispatch_agent %}

{% dispatch_agent "rp1-base:kb-interaction-mapper", background %}

Use the parent-computed inputs.

{% enddispatch_agent %}

{% dispatch_agent "rp1-base:kb-module-analyzer", background %}

Use the parent-computed inputs.

{% enddispatch_agent %}

{% dispatch_agent "rp1-base:kb-pattern-extractor", background %}

Use the parent-computed inputs.

{% enddispatch_agent %}

{% dispatch_agent "rp1-base:kb-feature-extractor", background %}

Use the parent-computed inputs.

{% enddispatch_agent %}

  1. Wait for all 6 agents to finish.
  2. Parse JSON from each response.
  3. Failure policy:

4. Reduce + Write

  1. Read needed KB templates directly from plugins/base/skills/artifact-templates/templates/knowledge-base/ (fall back to rp1-base:artifact-templates SKILL.md index if a direct path fails).
  2. Merge analyzer output into:
  1. Validate the architecture.md Mermaid diagram via rp1-base:mermaid.
  1. Write these files first:
  1. Count lines for the written markdown files.
  2. Generate index.md directly from aggregated results plus measured line counts.
  3. Write {kbRoot}/index.md last.
  4. Write {kbRoot}/state.json with:
  1. Write {kbRoot}/meta.json with:
  1. meta.json is local-only. Write it, but do not register it anywhere.

§FAIL

Fatal errors:

On any fatal error:

§OUT

User-visible output only:

Final report must include:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.