How bhuvan0611/smartdoc-framework works
SmartDoc generates NatSpec documentation for Solidity contracts through static extraction, multi-agent analysis, LLM synthesis, validation, and source injection. The CLI entry point explicitly calls artifact extraction, orchestration, and injection; the README documents the broader agent and validation stages. The graph includes the documented extraction and evaluation capabilities, but several internal connections rely on README descriptions because their implementation files were not sampled.
Main entry points: artifact_extractor.py Artifact Extractor · orchestrator.py Agent Orchestrator · main_pipeline.py Pipeline Entry · comment_synthesis_agent.py Comment Synthesis
Components 23
Pipeline
- Pipeline Entry
main_pipeline.py - Code Injector
injection/code_injector.py
Contract Analysis
- Artifact Extractor
extractor/artifact_extractor.py - AST Extraction
extractor/ast_extractor.py - CFG Extraction
extractor/cfg_extractor.py - Call Graph Extraction
extractor/callgraph_extractor.py - Bytecode Extraction
extractor/bytecode_extractor.py - Opcode Extraction
extractor/opcode_extractor.py - Agent Orchestrator
agents/orchestrator.py - Structural Agent
agents/structural_agent.py - Semantic Agent
agents/semantic_agent.py - Gas Agent
agents/gas_agent.py - Security Agent
agents/security_agent.py
Comment Generation
- Comment Synthesis
synthesis/comment_synthesis_agent.py - Prompt Builder
utils/prompt_builder.py - Documentation Models
utils/data_models.py
Validation and Evaluation
- NatSpec Validator
validation/validator.py - Hallucination Detector
validation/hallucination_detector.py - S³ Evaluation
tools/s3_evaluator.py
Other components
- Contract Developer
- Solidity Source
- Ollama LLM
- Annotated Solidity
Connections 23
- Contract Developer → Pipeline Entry: runs
README.md - Pipeline Entry → Solidity Source: reads
main_pipeline.py - Pipeline Entry → Artifact Extractor: calls
main_pipeline.py - Artifact Extractor → AST Extraction: extracts
README.md - Artifact Extractor → CFG Extraction: extracts
README.md - Artifact Extractor → Call Graph Extraction: extracts
README.md - Artifact Extractor → Bytecode Extraction: extracts
README.md - Artifact Extractor → Opcode Extraction: extracts
- Pipeline Entry → Agent Orchestrator: calls
main_pipeline.py - Agent Orchestrator → Structural Agent: dispatches
README.md - Agent Orchestrator → Semantic Agent: dispatches
README.md - Agent Orchestrator → Gas Agent: dispatches
README.md - Agent Orchestrator → Security Agent: dispatches
README.md - Agent Orchestrator → Comment Synthesis: synthesizes
README.md - Comment Synthesis → Prompt Builder: builds prompt
synthesis/comment_synthesis_agent.py - Comment Synthesis → Documentation Models: uses models
synthesis/comment_synthesis_agent.py - Comment Synthesis → Ollama LLM: requests completion
README.md - Comment Synthesis → NatSpec Validator: validates
README.md - NatSpec Validator → Hallucination Detector: checks claims
README.md - Pipeline Entry → Code Injector: calls
main_pipeline.py - Code Injector → Documentation Models: consumes results
injection/code_injector.py - Code Injector → Annotated Solidity: produces
README.md - Annotated Solidity → S³ Evaluation: scores quality
README.md