Skip to content

spacetimedecor/ConductAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒŸ ConductDoc: Recursive AI Documentation Generator

     โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
     โ”‚  ๐Ÿ”„ RECURSIVE KNOWLEDGE SYNTHESIS PIPELINE     โ”‚
     โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
                            โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚          ๐Ÿ“ Repository Analysis           โ”‚
        โ”‚     ๐Ÿ•ท๏ธ Crawl โ†’ ๐Ÿง  Analyze โ†’ ๐Ÿ“ Generate    โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚
     โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
     โ”‚  ๐ŸŒณ RECURSIVE SUMMARIZATION STRATEGY             โ”‚
     โ”‚                                                  โ”‚
     โ”‚  Files โ†’ Modules โ†’ Packages โ†’ Architecture       โ”‚
     โ”‚    โ†“        โ†“         โ†“           โ†“             โ”‚
     โ”‚  Each summary enriches the embeddings database   โ”‚
     โ”‚  Creating a self-reinforcing knowledge web ๐Ÿ•ธ๏ธ   โ”‚
     โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

An AI-powered documentation generator that creates living, breathing documentation through recursive knowledge synthesis.


โœจ What Makes ConductDoc Special

๐Ÿ”„ The Recursive Intelligence Engine

ConductDoc doesn't just analyze codeโ€”it builds understanding recursively, creating a self-enriching knowledge ecosystem:

graph TD
    A[๐Ÿ“„ Individual Files] --> B[๐Ÿง  File Summaries]
    B --> C[๐Ÿ“š Embeddings Database]
    C --> D[๐Ÿ” Enhanced Context]
    D --> E[๐Ÿ“ฆ Module Summaries]
    E --> C
    C --> F[๐Ÿ—๏ธ Architecture Understanding]
    F --> C
    C --> G[๐Ÿ’Ž Final Documentation]
    
    style C fill:#e1f5fe
    style G fill:#c8e6c9
Loading

๐ŸŒฑ Self-Enriching Knowledge Web

  1. Bottom-Up Understanding: Starts with individual files and builds toward architectural comprehension
  2. Recursive Feedback: Each generated summary feeds back into the embeddings database
  3. Context Amplification: Later analyses benefit from all previous insights
  4. Dual Summarization: Generates both concise abstracts and detailed explanations

๐Ÿš€ The Magic in Action

Phase 1: ๐Ÿ•ท๏ธ Intelligent Crawling

# Discovers source structure automatically
src_path = find_source_directory(repo_path)
docs_path = find_docs_directory(repo_path)

# Builds comprehensive code understanding
elements, import_graph, ast_map = crawl_source_code(src_path)

Phase 2: ๐Ÿง  Recursive Analysis with RAG

# The secret sauce: Recursive summarization that enriches itself
def generate_recursive_summary(elements, retriever, readme_content):
    # 1. Build file-level summaries
    for file_path, elements_in_file in grouped_elements:
        abstractive_summary = ai_summarize_file(file_path, context)
        detailed_summary = ai_detailed_analysis(file_path, context)
        
        # ๐Ÿ”ฅ KEY: Feed summary back into retrieval system
        retriever.add_chunks([f"AI Summary: {abstractive_summary}"])
    
    # 2. Build module-level understanding (now enriched with file summaries)
    for module_path in modules:
        module_summary = ai_summarize_module(module_path, enhanced_context)
        retriever.add_chunks([f"Module Summary: {module_summary}"])
    
    # 3. Build architectural understanding (enriched with everything)
    final_summary = ai_architectural_analysis(all_enriched_context)

Phase 3: ๐Ÿ“ Beautiful Generation

# Creates stunning interactive documentation
create_documentation_file(analysis_result, all_elements_with_docs)

๐ŸŽจ What You Get: Living Documentation

๐Ÿ  Interactive Architecture Diagrams

  • D3.js powered tree visualizations
  • Hover tooltips with AI-generated summaries
  • Collapsible nodes for exploration
  • Zoom and pan for large codebases

๐Ÿ“– Intelligent Content Structure

  • Executive Summary: High-level overview for stakeholders
  • Interactive Architecture: Visual code exploration
  • Code Examples: AI-curated, ready-to-run snippets
  • API Reference: Complete documentation with context

โšก Performance Optimized

  • Intelligent Caching: LLM responses cached by content hash
  • Deterministic Operations: Consistent results across runs
  • Incremental Updates: Only re-analyzes changed components

๐Ÿ”ง Quick Start

1. Setup

# Clone and install
git clone <repository-url>
cd ConductAI
pip install -r requirements.txt

# Configure your LLM (OpenRouter recommended)
echo "OPENROUTER_API_KEY=your_key_here" > .env

2. Generate Documentation

# Analyze any Python repository
python main.py --repo-url https://github.com/ManimCommunity/manim.git --llm-mode openrouter

# Or use local Ollama
python main.py --repo-url https://github.com/your/repo.git --llm-mode local

3. Explore the Results

# Open the beautiful documentation
open output/documentation.html

๐Ÿ—๏ธ Architecture: The Recursive Engine

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿง  RECURSIVE RAG PIPELINE                โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                             โ”‚
โ”‚  ๐Ÿ“ Repository                                              โ”‚
โ”‚    โ”œโ”€โ”€ ๐Ÿ” AST Analysis                                      โ”‚
โ”‚    โ”œโ”€โ”€ ๐Ÿ“Š Import Graph                                      โ”‚
โ”‚    โ””โ”€โ”€ ๐Ÿ“š Existing Docs                                     โ”‚
โ”‚                     โ”‚                                       โ”‚
โ”‚                     โ–ผ                                       โ”‚
โ”‚  ๐Ÿ—„๏ธ Embeddings Database โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”‚
โ”‚    โ”œโ”€โ”€ Original documentation                   โ”‚           โ”‚
โ”‚    โ”œโ”€โ”€ Code structure                          โ”‚           โ”‚
โ”‚    โ”œโ”€โ”€ README context                          โ”‚           โ”‚
โ”‚    โ””โ”€โ”€ Generated summaries (recursive!) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ”‚
โ”‚                     โ”‚                                       โ”‚
โ”‚                     โ–ผ                                       โ”‚
โ”‚  ๐Ÿ”„ Recursive Summarization                                 โ”‚
โ”‚    โ”œโ”€โ”€ ๐Ÿ“„ File Analysis    โ†’ Enhanced Context              โ”‚
โ”‚    โ”œโ”€โ”€ ๐Ÿ“ฆ Module Synthesis โ†’ More Enhanced Context         โ”‚
โ”‚    โ”œโ”€โ”€ ๐Ÿ—๏ธ Architecture     โ†’ Fully Enhanced Context       โ”‚
โ”‚    โ””โ”€โ”€ ๐Ÿ’Ž Final Documentation                              โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฉ Core Components

Component Purpose Magic
๐Ÿ•ท๏ธ Crawler Repository analysis AST parsing, import tracking, doc ingestion
๐Ÿง  Analyzer Recursive RAG engine Self-enriching embeddings, dual summarization
๐Ÿ“ Generator Beautiful HTML creation D3.js diagrams, responsive design, copy buttons
โšก Retriever Semantic search Vector embeddings, context enhancement
๐Ÿ’พ Cache Performance optimization Content-based caching, deterministic keys

๐ŸŽฏ The Recursive Advantage

๐Ÿ”„ Self-Reinforcing Knowledge

Each analysis phase enriches the knowledge base for subsequent phases:

  1. File summaries help understand modules
  2. Module summaries help understand architecture
  3. Architectural insights help generate examples
  4. Everything together creates coherent, contextual documentation

๐ŸŽจ Context-Aware Generation

Unlike traditional documentation generators, ConductDoc understands:

  • Intent: What the code is trying to achieve
  • Relationships: How components work together
  • Patterns: Common usage scenarios
  • Evolution: How the codebase is structured and why

โšก Smart Caching

The caching system ensures:

  • Consistency: Identical inputs always produce identical outputs
  • Speed: Subsequent runs are lightning fast
  • Efficiency: Only changed content is re-analyzed

๐ŸŒŸ Advanced Features

๐ŸŽ›๏ธ Flexible Configuration

# Use different LLM providers
python main.py --repo-url <repo> --llm-mode openrouter
python main.py --repo-url <repo> --llm-mode local

# Override auto-detection
python main.py --repo-url <repo> --src-dir custom/source --docs-dir docs/

# Debug and optimize
python main.py --repo-url <repo> --save-debug-data --clear-cache

๐Ÿ” Debug Mode

# Saves intermediate data for analysis
python main.py --repo-url <repo> --save-debug-data

# Generates:
# .temp/debug_import_graph.json     - Code dependencies
# .temp/debug_module_map.json       - Module structure  
# .temp/debug_docs_context.html     - Processed documentation

โšก Performance Options

# Clear LLM cache for fresh analysis
python main.py --repo-url <repo> --clear-cache

# Cache directory: .cache/
# Each response cached by content hash for consistency

๐Ÿ”ฎ Future Vision

๐Ÿง  Enhanced Intelligence

  • Multi-language support: Beyond Python to JavaScript, TypeScript, Go
  • Cross-repository analysis: Understanding dependencies and relationships
  • Evolutionary documentation: Tracking how codebases change over time

๐ŸŽฏ Advanced Features

  • Interactive Q&A: Natural language queries about the codebase
  • Code quality insights: Automated suggestions for improvements
  • Documentation validation: Detecting outdated or incorrect documentation

๐ŸŒ Integration Ecosystem

  • IDE extensions: Real-time documentation in your editor
  • CI/CD integration: Automated documentation updates
  • Team collaboration: Shared understanding across development teams

๐ŸŽจ Sample Output

The generated documentation includes:

๐Ÿ“Š Interactive Architecture Diagram

A beautiful D3.js visualization showing:

  • ๐Ÿ“ Directory structure with collapsible nodes
  • ๐Ÿ Python modules with type indicators
  • ๐Ÿ“„ Configuration files with distinct styling
  • ๐Ÿ’ฌ Hover tooltips with AI-generated summaries

๐Ÿ“š Comprehensive Content

  • Executive Overview: Perfect for stakeholders and new team members
  • Code Examples: Curated, runnable examples for common tasks
  • API Reference: Complete documentation with source code
  • Navigation: Smooth scrolling, sticky navigation, responsive design

๐Ÿค Contributing

This project demonstrates the power of recursive AI analysis for code understanding. The architecture is designed for:

  • ๐Ÿ”ง Extensibility: Easy to add new analysis types
  • ๐Ÿงช Testability: Clear separation of concerns
  • ๐Ÿ“ˆ Scalability: Efficient caching and incremental updates
  • ๐ŸŽจ Beauty: Modern, responsive, interactive output

๐Ÿ“„ License

MIT License - Feel free to use this as inspiration for your own documentation automation projects!


Built with โค๏ธ and recursive intelligence - where each analysis makes the next one smarter.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors