index-knowledge

Generate hierarchical AGENTS.md knowledge base for a codebase. Creates root + complexity-scored subdirectory documentation.

By tursodatabase · 1,229 installs

npx skills add tursodatabase/turso --skill index-knowledge

Source repository · Upstream listing

index knowledge Generate hierarchical AGENTS.md files. Root + complexity scored subdirectories. Usage Default: Update mode (modify existing + create new where warranted) Workflow (High Level) 1. Discovery + Analysis (concurrent) Launch parallel explore agents (multiple Task calls in one message) Main session: bash structure + LSP codemap + read existing AGENTS.md 2. Score & Decide Determine AGENTS.md locations from merged findings 3. Generate Root first, then subdirs in parallel 4. Review Deduplicate, trim, validate <critical TodoWrite ALL phases. Mark in progress → completed in real time. </critical Phase 1: Discovery + Analysis (Concurrent) Mark "discovery" as in progress. Launch Parallel Explore Agents Multiple Task calls in a single message execute in parallel. Results return directly. <dynamic agents DYNAMIC AGENT SPAWNING : After bash analysis, spawn ADDITIONAL explore agents based on project scale: Factor Threshold Additional Agents Total files 100 +1 per 100 files Total lines 10k +1 per 10k lines Directory depth ≥4 +2 for deep exploration Large files ( 500 lines) 10 files +1 for complexity hotspots Monorepo detected +1 per package/workspace Multiple languages 1 +1 per language Example spawning (all in ONE message for parallel execution): </dynamic agents Main Session: Concurrent Analysis While Task agents execute , main session does: 1. Bash Structural Analysis 2. Read Existing AGENTS.md If create new : Read all existing first (preserve context) → then delete all → regenerate. 3. LSP Codemap (if available) LSP Fallback : If unavailable, rely on explore agents + AST grep. Merge: bash + LSP + existing + Task agent results. Mark "discovery" as completed. Phase 2: Scoring & Location Decision Mark "scoring" as in progress. Scoring Matrix Factor Weight High Threshold Source File count 3x 20 bash Subdir count 2x 5 bash Code ratio 2x 70% bash Unique patterns 1x Has own config explore Module boundary 2x Has index.ts/ init .py bash Symbol density 2x 30 symbols LSP Export count 2x 10 exports LSP Reference centrality 3x 20 refs LSP Decision Rules Score Action Root (.) ALWAYS create 15 Create AGENTS.md 8 15 Create if distinct domain <8 Skip (parent covers) Output Mark "scoring" as completed. Phase 3: Generate AGENTS.md Mark "generate" as in progress. Root AGENTS.md (Full Treatment) Quality gates : 50 150 lines, no generic advice, no obvious info. Subdirectory AGENTS.md (Parallel) Launch general agents for each location in ONE message (parallel execution): Results return directly. Mark "generate" as completed. Phase 4: Review & Deduplicate Mark "review" as in progress. For each generated file: Remove generic advice Remove parent duplicates Trim to size limits Verify telegraphic style Mark "review" as completed. Final Report Anti Patterns Static agent count : MUST vary agents based on project size/depth Sequential execution : MUST parallel (multiple Task calls in one message) Ignoring existing : ALWAYS read existing first, even with create new Over documenting : Not every dir needs AGENTS.md Redundancy : Child never repeats parent Generic content : Remove anything that applies to ALL projects Verbose style : Telegraphic or die