Wiki bfs

From jleechanorg/claude-commands · View interactive version

Wiki bfs is an AI agent skill from the GitHub repository jleechanorg/claude-commands. Run breadth-first research on a topic and route approved wiki changes through /wiki-ingest.

How to use this skill

Skill file

/wiki-bfs — Breadth-First Research + Wiki Ingest

This skill researches, deduplicates, and prepares candidate content. All writes

to wiki pages, directories, indexes, sources, or logs must go through

/wiki-ingest; this workflow never edits the wiki directly.

Usage

/wiki-bfs <topic> [--layers N] [--ingest] [--wiki <wiki_dir>]

Performs N-layer breadth-first search on a topic and prepares candidate source pages for /wiki-ingest.

Default: 2 layers. Use --layers N for N layers.

--wiki <wiki_dir> overrides the default wiki location (~/llm_wiki/wiki). The raw/ directory is derived as $(dirname <wiki_dir>)/raw.

Execution

Phase 1: Parse arguments

Phase 2: Resolve wiki path

# Check for local wiki default (project-level override)
if [ -f ".wiki-default" ]; then
  WIKI=$(cat .wiki-default)
elif [ -f "$HOME/.wiki-default" ]; then
  WIKI=$(cat "$HOME/.wiki-default")
else
  WIKI="$HOME/llm_wiki/wiki"
fi
# --wiki flag always wins over .wiki-default
if args contain "--wiki <path>"; then
  WIKI="<path>"
fi
# Read existing pages for deduplication only; `/wiki-ingest` owns creation.

Phase 3: BFS Research (N layers)

Launch parallel research agents per layer. Each layer discovers new topics that become the next layer's research targets.

Layer architecture:

Layer 0 (seed): <TOPIC>
Layer 1: Explore <TOPIC>'s primary systems/frameworks/people
Layer 2: Explore Layer 1's supporting infrastructure, alternatives, critics
Layer N: Explore Layer N-1's ecosystem, downstream, upstream

Research areas per topic (auto-detected):

For each layer:

  1. Search web for the topic's canonical projects, papers, people
  2. Fetch accessible pages (arxiv, github readmes, official docs)
  3. Extract entity names (people, companies, projects) and concept names (patterns, methods, architectures)
  4. Compile findings into structured report

Phase 4: Deduplicate against existing wiki

# Check which entities already exist
for entity in "${ENTITIES[@]}"; do
  slug=$(echo "$entity" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
  if [ -f "$WIKI/entities/$slug.md" ]; then
    echo "EXISTS: $entity"
  else
    echo "NEW: $entity"
  fi
done

# Check which concepts already exist
for concept in "${CONCEPTS[@]}"; do
  slug=$(echo "$concept" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
  if [ -f "$WIKI/concepts/$slug.md" ]; then
    echo "EXISTS: $concept"
  else
    echo "NEW: $concept"
  fi
done

Phase 5: Prepare and ingest candidate pages

Prepare candidate source documents outside the wiki. To persist them, invoke

/wiki-ingest <candidate-source> --wiki "$WIKI" for each approved source and

let that command create the source/entity/concept pages in the selected wiki.

Do not create or edit wiki files here.

Entity page template:

---
title: "<EntityName>"
type: entity
tags: [<topic-area>, <type>]
date: YYYY-MM-DD
---

## Overview
2–3 sentence overview.

## Key Properties
- **Type**: 
- **Key features**: 

## Connections
- [[RelatedConcept]] — relationship
- [[RelatedEntity]] — relationship

## See Also
- [[RelatedConcept]]

Concept page template:

---
title: "<ConceptName>"
type: concept
tags: [<topic-area>, <pattern-type>]
date: YYYY-MM-DD
---

## Overview
2–3 sentence overview.

## Key Properties
- **What**: 
- **Why matters**: 

## Related Systems
| System | Type | Relevance |
|--------|------|-----------|

## Connection to <TOPIC>
How this concept relates to the BFS root topic.

## See Also
- [[RelatedEntity]]
- [[RelatedConcept]]

Phase 6: Index and entity/concept updates

Route index, entity, and concept changes through /wiki-ingest; do not edit

wiki/index.md or page files directly.

Phase 7: Log through ingest

Include the BFS topic and discovered entity/concept counts in the candidate

source document ingested through /wiki-ingest. Do not append directly to

wiki/log.md.

Phase 8: (Optional) wiki-assess

If --ingest is set, ingest each approved candidate with

/wiki-ingest <candidate-source> --wiki "$WIKI", then run

/wiki-assess --wiki "$WIKI" against that same destination. The flag does not

authorize direct wiki writes.

BFS Layer Routing

| Topic keywords | Layer 1 research areas | Layer 2 research areas |

|---|---|---|

| governance, constraint, fail-closed | policy engines, constitutional AI, OPA, GitOps | stream governance, RBAC, drift detection, value alignment |

| multi-agent, orchestration, coordination | LangGraph, AutoGen, CrewAI, MetaGPT | CAMEL, router-architecture, prompt registry, multi-turn alignment |

| coding agent, SWE, evidence | SWE-bench, OpenHands, Voyager, Devin | AgentBench, skill library, self-verification, iterative prompting |

| workflow, durability, execution | Temporal, Prefect, Archon, Airbyte | event sourcing, durable execution, MCP Server, YAML DAGs |

| policy, ACL, authorization | OPA, Rego, Constitutional AI, RLAIF | CIRL, value alignment, scalable oversight, constitutional classifiers |

Research Output Format

Each layer agent returns:

## Entities discovered
- EntityName: type, key properties, source

## Concepts discovered
- ConceptName: definition, key properties, source

## Key quotes
> "Quote" — source

## New topics for next layer
- NextTopicName (reason: discovered in this layer)

Quality Standards

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.