Incremental engine for long horizon agents π Star if you like it!
Rust agentic-data-frameworkaiai-agentschange-data-capturecodebase-intelligencecontext-engineeringdata-engineeringdata-indexingdata-processingetlhelp-wantedindexingknowledge-graphllmlong-horizon-agentpythonragreal-timerustsemantic-search
Multi-Codebase Summarization π
Rust equivalent of the Python multi_codebase_summarization example.
Scans subdirectories of a root folder (each treated as a Python project), uses an LLM to extract structured info (public classes, functions, CocoIndex pipeline graphs), aggregates into project-level summaries, and outputs markdown documentation.
Prerequisites
- An OpenAI-compatible API key:
export LLM_API_KEY="sk-..."
# Optional overrides:
export LLM_MODEL="gpt-4o-mini" # default
export LLM_BASE_URL="https://api.openai.com/v1" # default
Build
cd examples/rust/multi_codebase_summarization
cargo build --release
Usage
Summarize all Python examples in this repo:
cargo run -- ../.. ./output
This will:
- Scan each subdirectory of
../..as a project - Walk
*.pyand**/*.pyfiles in each project - Extract per-file info via LLM (memoized β unchanged files skip the LLM)
- Aggregate into a project-level summary via LLM (memoized β unchanged projects skip the LLM)
- Write
output/<project_name>.mdfor each project and remove stale markdown for deleted projects
Re-run β unchanged files and unchanged project summaries are cached (memoized in LMDB), so a fully warm rerun makes zero LLM calls:
cargo run -- ../.. ./output
# Much faster β skips files and project summaries already analyzed
Switch the model β the model and the CodebaseInfo schema are in the LLM steps' deps, so a new LLM_MODEL re-analyzes every file, unchanged ones included:
LLM_MODEL=gpt-4o cargo run -- ../.. ./output
Macro Showcase
This example demonstrates:
| Macro | Purpose |
|---|---|
#[cocoindex::function(deps = llm_deps())] |
extract_file_info β one component per file, skipped while the file and deps are unchanged |
#[cocoindex::function(memo, deps = llm_deps())] |
aggregate_project_info β LLM call cached until any file summary or deps changes |
#[cocoindex::function] |
generate_markdown β pure transform, no caching needed |
ctx.scope(...) |
Mirror Python's per-project coco.mount(...) component |
ctx.mount_each(...) |
Process all files concurrently within each project |
OnceLock<LlmClient> |
Access a process-wide shared LLM client |