multi-language source code parsing with ast extraction
Scaffold parses source code across multiple programming languages using language-specific parsers (tree-sitter based) to extract Abstract Syntax Trees (ASTs). The system decomposes code into structural entities (files, classes, methods, functions) and captures their syntactic relationships, enabling downstream graph generation. This approach preserves code semantics rather than relying on regex or simple text analysis.
Unique: Uses tree-sitter-based language-agnostic parsing with fallback strategies for unsupported languages, enabling consistent AST extraction across 15+ languages without custom parser implementation per language. Caches parsed ASTs in memory to avoid re-parsing during incremental updates.
vs alternatives: More accurate than regex-based code analysis and faster than full semantic analysis tools like Roslyn or LLVM, while supporting more languages than language-specific solutions like Jedi (Python-only)
dual-database knowledge graph persistence (postgresql + neo4j)
Scaffold persists parsed code structure into two complementary databases: PostgreSQL stores relational metadata (files, entities, timestamps, ownership) while Neo4j maintains the knowledge graph with semantic relationships (inheritance, method calls, imports, dependencies). This polyglot persistence strategy optimizes for both structured queries (SQL) and graph traversal operations (Cypher), enabling efficient context retrieval at scale. The system maintains bidirectional sync between databases to ensure consistency.
Unique: Implements polyglot persistence with explicit dual-database architecture rather than single-database solutions; PostgreSQL handles relational queries while Neo4j optimizes graph traversal. Maintains consistency through transactional sync logic and supports incremental updates without full re-indexing.
vs alternatives: Outperforms single-database solutions (e.g., PostgreSQL with JSON columns) for graph queries by 10-100x, and provides better relational query performance than Neo4j-only approaches while maintaining architectural flexibility
codebase search with semantic and structural filtering
Scaffold provides a search interface that combines keyword matching with semantic and structural filtering. Users can search for code entities by name, type, or relationship (e.g., 'find all classes that inherit from BaseController'). The search engine leverages the knowledge graph to understand entity types, relationships, and context, enabling more precise results than simple text search. Results can be filtered by entity type, location, or relationship properties.
Unique: Combines keyword search with graph-based structural filtering, enabling queries like 'find all classes implementing interface X' or 'find all functions called by method Y'. Leverages Neo4j indexing for fast keyword matching combined with relationship traversal.
vs alternatives: More precise than text-based code search (grep, ripgrep) by understanding code structure and relationships. More flexible than IDE-based search by supporting complex relationship queries and cross-file patterns.
incremental codebase indexing with change detection
Scaffold monitors source code changes (via file system watchers or git hooks) and incrementally updates the knowledge graph without re-parsing the entire codebase. The system detects modified, added, and deleted files, re-parses only affected code, and updates both PostgreSQL and Neo4j with delta changes. This approach avoids expensive full re-indexing and enables near-real-time graph synchronization as developers commit code.
Unique: Implements delta-based indexing with file-level change detection and selective re-parsing, avoiding full codebase re-indexing on every change. Maintains file hash tracking and timestamp metadata to detect stale entries and enable efficient incremental synchronization.
vs alternatives: Faster than full re-indexing approaches (e.g., Elasticsearch reindexing) by 50-100x for typical code changes, and more reliable than naive git-diff approaches by tracking actual file content hashes rather than relying on git metadata alone
context-aware code entity retrieval via graph queries
Scaffold provides a query interface (Cypher for Neo4j, SQL for PostgreSQL) to retrieve code entities and their relationships based on semantic context. Queries can traverse dependency graphs (e.g., 'find all functions called by this method'), retrieve related code (e.g., 'find all classes in the same module'), or identify architectural patterns (e.g., 'find all implementations of this interface'). Results are ranked by relevance and formatted as structured context suitable for LLM injection.
Unique: Combines Neo4j graph traversal with PostgreSQL relational queries to provide both semantic relationship discovery and structured metadata retrieval. Implements relevance ranking based on graph centrality and relationship types, enabling intelligent context prioritization for LLM injection.
vs alternatives: More precise than keyword-based code search (e.g., grep, ripgrep) by understanding semantic relationships, and faster than AST-based analysis tools by leveraging pre-computed graph structure rather than re-analyzing code on each query
model context protocol (mcp) integration for ai agent communication
Scaffold implements the Model Context Protocol (MCP) standard, providing a standardized interface through which AI agents and LLMs can request code context without direct database access. The MCP layer exposes Scaffold's knowledge graph as a set of tools/resources (e.g., 'get_entity_context', 'find_related_code', 'get_dependency_graph') that agents can invoke via standard MCP messages. This abstraction decouples agents from Scaffold's internal architecture and enables multi-agent coordination.
Unique: Implements MCP as a first-class integration layer, exposing knowledge graph queries as standardized tools that AI agents can discover and invoke. Provides schema-based tool definitions with input validation and structured result formatting, enabling type-safe agent interactions.
vs alternatives: More standardized and interoperable than custom REST APIs or direct database access, enabling seamless integration with multiple AI agents without custom adapter code. Provides better security and access control than exposing database credentials directly to agents.
living knowledge graph with automatic documentation generation
Scaffold generates and maintains living documentation by extracting code structure, relationships, and patterns from the knowledge graph and synthesizing them into human-readable documentation. Unlike static docs, this documentation is automatically updated whenever code changes are indexed, ensuring it stays synchronized with the actual codebase. The system can generate architecture diagrams, dependency maps, API documentation, and module overviews directly from graph data.
Unique: Generates documentation directly from the knowledge graph rather than parsing comments or docstrings, ensuring documentation always reflects actual code structure. Automatically updates documentation on every code change, eliminating documentation decay.
vs alternatives: More current than manual documentation and more accurate than LLM-generated docs without code understanding. Faster to generate than tools requiring full codebase re-analysis (e.g., Doxygen) by leveraging pre-computed graph structure.
codebase-aware context injection for llm prompts
Scaffold provides utilities to automatically inject relevant code context into LLM prompts based on the task at hand. Given a user query or code location, the system retrieves related entities from the knowledge graph and formats them as context (code snippets, signatures, relationships, documentation) that is prepended to the LLM prompt. This approach enables LLMs to understand codebase-specific patterns, conventions, and architecture without requiring the entire codebase in the prompt.
Unique: Implements intelligent context selection using graph-based relevance ranking rather than simple keyword matching or BM25 scoring. Formats context with code structure awareness (signatures, relationships, documentation) rather than raw code snippets.
vs alternatives: More precise than keyword-based context selection (e.g., BM25 in traditional RAG) by understanding semantic relationships, and more efficient than sending entire codebases by selecting only relevant entities based on graph distance and relationship types.
+3 more capabilities