Changelog
v1.4.1 β 2026-08-26β
Review hardening, thread safety, path sanitization, atomic writes, and documentation updates.
Bug Fixesβ
- Thread safety in graph mutations:
InMemoryGraph._lockupgraded fromLocktoRLock;remove_entities_for_fileandadd_entities_for_filenow wrap mutations inwith graph._lock:for atomic multi-entity updates without deadlocking. - Path sanitization in MCP tools: Replaced naive
str.replace("\\", "/")with_canonicalize_untrusted_path()ingraph_overview,graph_query,get_file_graph, andbatho_difffor proper canonicalization per the path sanitization ADR. - Config validation fail-fast:
get_config_with_rootnow raisesRuntimeErroron invalid config instead of silently backing up and overwriting the user'sbatho.yaml. - Atomic resolution cache writes:
ResolutionCachemetadata writes now usetempfile.mkstemp+os.replaceto prevent cache corruption on interruption. - AST cache mtime invalidation:
AstCache.getnow accepts an optionalmtimeparameter to detect stale entries even when content hash matches. - Unicode identifier extraction:
extractor.pyandfallback_parser.pyregexes updated from[a-zA-Z_]to[^\W0-9]for PEP 3131 compliance, preserving non-ASCII identifiers. - Case-insensitive XML entity detection:
manifest_parser.pynow uppercases content before checking for<!ENTITY/<!DOCTYPE, matching XML's case-insensitive grammar. - Unified cache field types:
is_indexedchanged frominttobool;last_run_idrenamed tolast_run_uuidto match the actual schema. - Bundle reader zero-copy preservation: Removed redundant sort in
BathoBundleReader(writer already sorts byfile_id); index now handles non-contiguousfile_idranges with multi-slice support. - Blob repairer memory:
blob_repairer.pynow usespa.ipc.new_filewith a table directly instead ofto_pylist(), avoiding unnecessary row materialization.
Security Hardeningβ
- Tamper-evident audit log:
FixContextaudit entries now includeprevious_hashandhashfields forming a SHA-256 chain, enabling tamper detection. - Security audit flag gating: BSG plugin hit collection in
apply_bsg_rules_to_entitiesis now guarded behindsecurity_audit_enabled, avoiding unnecessary work when the flag is off.
Performanceβ
- Early stream cleanup:
store.cleanup_streams()moved before community detection inbuild.pyto free memory earlier in the pipeline.
Other Changesβ
schema_versioninConfignow usesLiteral["batho-config.v1"]for stricter validation.- Added error
hintparameters to_err()calls inbatho_export,batho_diff,batho_gc, andbatho_fixMCP tools. - Documentation: added
graph,community_detection, andmemoryconfig sections; documentedwatch,debounce_ms,max_file_size_kbparams foradd_repo. - Added
CITATION.cffto the bump-version script's file list for future releases. - Fixed
CHANGELOG_PATHNameErroringenerate_changelog_entry.py. - 966 tests (up from 864).
v1.4.0 β 2026-08-04β
Stdlib expansion, graph builder phases 4-5, BSG interceptors, and security/performance hardening.
New Featuresβ
- Stdlib expansion to 27 languages: Standard library symbol tables now cover 27 languages (up from 5), including C/C++, Java, Ruby, C#, PHP, Kotlin, Swift, Scala, Dart, Haskell, Lua, R, Perl, Julia, Zig, Bash, Objective-C, Erlang, OCaml, Hack, and Verilog.
- Multi-ecosystem dependency introspection: Live introspection now supports five package ecosystems β Python (venv), npm (
node_modules/), Cargo (~/.cargo/registry/), Go modules (~/go/pkg/mod/), and Maven (~/.m2/repository/) β with package-name validation on all ecosystems to prevent path traversal. - Graph builder Phase 4 β Confidence scoring: Every resolved stub is tagged with a
resolution_confidencescore (0.0β0.95) andresolution_strategylabel across 6 tiers, enabling downstream consumers to filter by confidence level. - Graph builder Phase 4 β Conservative pruning: Unresolved stubs targeting common stdlib method names on unknown receiver types are pruned instead of left as false gaps, reducing graph noise.
- Graph builder Phase 5 β Receiver-type inference: Method calls are resolved by inferring the receiver variable's declared type from scope, following the rust-analyzer two-phase resolution pattern.
- Graph builder Phase 5 β Lazy resolution: When
lazy=True, stubs remain pending and are resolved on-demand viaresolve_stub_on_demand(), avoiding unnecessary work for stubs that no query will ever reference. - 9 BSG interceptor plugins enhanced: API Contract Guardian, Auth Boundary Shield, Dependency Blast Radius, Hardcoded Secret Catcher, IaC Drift Sentinel, N+1 Query Catcher, Resource Leak Preventer, Schema Migration Enforcer, and Silent Failure Catcher updated with improved detection patterns.
Security Hardeningβ
- Custom rules path sanitization:
_resolve_custom_rules_pathnow routes throughbatho.utils.path_sanitizer.sanitize_path, rejecting traversal and unsafe absolute paths. - Log file path sanitization:
configure_loggingsanitizes the configured log file path before creating directories or opening a FileHandler. - Non-Python introspector validation: All language introspectors (npm, Cargo, Go, Maven) now validate package names with
_is_safe_dependency_nameand use safe-join path construction.
Bug Fixesβ
- External symbol double-write: Removed duplicate
EXTERNAL_SYMBOLentity insertion in the build pipeline that inflatedentity_countmetrics and produced duplicate Arrow rows. - Atomic scope manager cache writes: Scope manager cache IPC is now written to
.tmpfiles and atomicallyPath.replaced into place, preventing partial writes on interruption. - Agent views filtering in patch:
agent_viewstable is now filtered withpyarrow.computebeforeto_pylist(), materializing only needed rows and reducing RSS on large repos.
Other Changesβ
- Capped
structlogdependency to<26to prevent breaking changes. - Added stdlib resolution benchmark (
benchmarks/bench_stdlib_resolution.py). - Added 9 new test modules covering stdlib expansion, pipeline serialization, sentinel cache, graph phases 4-5, and incremental synthetic paths.
- 864 tests (up from 609).
v1.3.2 β 2026-07-27β
- H2: Hardened path sanitization with shared canonicalization helper (
_canonicalize_untrusted_path) to reject encoded, Unicode, and null-byte traversal vectors acrosssanitize_path,safe_join,sanitize_diff_path, andis_safe_filename. - H5: Added Unicode identifier support for Python and JavaScript entities in extraction and hierarchical descriptors; fallback parser regexes now match PEP 3131-style identifiers.
v1.3.1 β 2026-07-22β
Bug fixes and MCP UX improvements.
Bug Fixesβ
- CLI root resolution crash:
batho_cli.pyno longer crashes when--rootis omitted or passed as a string.args.rootis now wrapped inPath()and checked forNonebefore calling.resolve(). - MCP test isolation:
test_repos_resource_no_registrynow usesregistry_path=tmp_pathinstead of reading the real~/.batho/mcp-repos.json, preventing failures when a local registry exists.
MCP UX Improvementsβ
- Entity ID visibility:
search_entities,format_concise, andformat_detailedmarkdown output now include entity_ids in backticks, enabling agents to copy-paste them intoget_entityandtrace_path. - Name-based lookup fallback:
get_entityandtrace_pathnow accept display names as fallback when an exact entity_id is not found. If the name uniquely matches, it resolves automatically. If multiple matches exist, a disambiguation list with entity_ids is returned.
Testsβ
- 9 new tests in
tests/mcp/test_entity_lookup.pycovering entity_id visibility and name-based lookup. - Updated
tests/mcp/test_dual_output.pyto reflect that entity_ids are now intentionally included in markdown. - Total: 609 tests passing.
v1.3.0 β 2026-07-22β
Arrow graph backend, build metrics accuracy, memory optimization, and documentation cleanup.
New Featuresβ
- Arrow Graph Backend: Columnar memory-mapped graph storage (
ArrowGraph) as an alternative to the defaultInMemoryGraph, enabling streaming compaction for large codebases without holding the entire graph in RAM. - Graph Backend Auto-Selection: Heuristic-based backend resolution using file count and estimated entity count thresholds (
auto_threshold_files=500,auto_threshold_entities=30,000). Automatically selects Arrow for large repos. - Graph Backend Protocol: Formal
GraphBackendprotocol defining the contract between in-memory and Arrow backends. - Public API Exports:
ArrowGraphandcreate_graphnow exported frombathotop-level package.
Bug Fixesβ
symbol_index_sizereporting: AddedScopeManager.global_symbol_countproperty to accurately report total global symbols across all partitions instead of reporting 0.- Unresolved stub resolution counts:
resolve_contextual_stubsnow returns(resolved_count, unresolved_count)tuple, propagated tobuild_statsfor accurate metrics. - Self-loop cycle detection false positives:
find_cyclesnow skips self-loops only forIMPORTSrelationships (where they're noise), preservingINHERITSself-loop detection (which indicates real circular inheritance). - Negative RSS recovery logging:
gc.collect()that increases RSS now logs a warning instead of info, with a descriptive message about memory pressure.
Performanceβ
- Memory optimization in extraction pipeline:
agent_blobandstorage_blobare stripped fromraw_resultsafter being streamed viaresult_callback, preventing ~1.6 GB of redundant blob retention during graph materialization on large repos. - Worker log suppression:
load_effective_rulesacceptsquiet=Trueto suppress info-level logging in worker processes, eliminating log spam during parallel extraction. - RSS flush log spam reduction:
rss_flush_released_memorynow only logs when memory was actually recovered (> 0) or when RSS increased (< 0), silencing no-opgc.collect()calls that recovered 0 MB.
Configurationβ
- Updated default memory thresholds:
warning_threshold_mbraised to 800 MB,critical_threshold_mbto 1,500 MB,rss_flush_threshold_mbto 1,000 MB β better suited for large codebase indexing.
Documentationβ
- Stale SQLite references cleanup: Replaced all legacy "SQLite" references in docstrings and comments with accurate terminology ("AST cache (flat-file msgpack)", "Arrow Bundle") across 15 source and test files.
Testsβ
- 600 tests (up from 507) β new tests for Arrow graph backend, graph factory, backend config validation, and graph consistency.
v1.2.1 β 2026-07-20β
Bug fixes, concurrency safety, and documentation alignment.
Bug Fixesβ
- Critical:
patch.pyNameError on delete-only runs βindexervariable was only defined inside theif added_or_modified:block; delete-only patch runs crashed withNameError. Fixed by initializingindexer = Noneand guarding thegetattrcall. RepoRegistryrace condition βadd()andremove()performed loadβmutateβsave without locking. Concurrent MCP tool calls could lose entries. Fixed withthreading.Lockand atomic file writes.ResolutionCachenon-atomic writes βput_symbols()and_save_index()wrote directly to cache files without temp+rename. Crash during write could corrupt the cache. Fixed withtempfile.mkstemp+os.replacepattern.
Improvementsβ
graph_overviewtruncation indicator β Truncated output now appends a visible notice to the markdown, matchinggraph_queryandget_file_graphbehavior.get_file_graphcross-file ref performance β Replaced per-entitypc.equal()loop with singlepc.is_in()batch filter.graph_overviewfile entity counts β Fixed hardcodedentities: 0in file list; now computes actual entity counts per file from the agent table.- Dependency introspector input validation β Added package name regex validation before subprocess execution.
- Git subprocess hardening β Added
GIT_PAGER=catto environment to prevent pager invocation.
Documentationβ
- Updated all version references from
v1.2.0tov1.2.1across whitepaper, CI/CD, configuration, and test docs.
v1.2.0 β 2026-07-05β
MCP server, multi-repo registry, and community detection β Batho becomes an AI agent platform.
New Features & Enhancementsβ
- MCP Server (
batho mcp): FastMCP-based stdio server exposing 10 tools for AI agents to query the code graph:graph_overviewβ high-level codebase summary with entity counts, relationships, and communitiesgraph_queryβ filtered graph query by file, entity type, relation type, or name patternget_entityβ detailed info for a single entity with relationships and optional source codetrace_pathβ shortest dependency path between two entities (BFS traversal)get_file_graphβ all entities and relationships within a single filesearch_entitiesβ substring/regex search across entity namesget_deltaβ incremental changes from the latest patchlist_repos/add_repo/remove_repoβ multi-repo registry management
- Multi-Repo Registry: JSON-based registry at
~/.batho/mcp-repos.jsonβ one MCP config entry serves all repos. Register repos at runtime viaadd_repotool. - Community Detection: Greedy modularity clustering via
networkxβ automatically groups related entities into communities for codebase overview. - Dual-Output Architecture: All MCP tools return both markdown
content(model-facing, ~34% fewer tokens) and JSONstructuredContent(machine-facing). - Token Budget Truncation: Configurable
max_tokensparameter on graph tools with automatic truncation and reporting. - MCP Prompts: Workflow-specific prompt templates for agent onboarding (
explore_codebase,understand_function,analyze_file,trace_dependency,review_changes,impact_analysis,architecture_overview). - MCP Resources: Static schema and dynamic repo-list resources accessible via URI references.
- Structured Error Handling: Typed errors (
CLIENT_ERROR,EXTERNAL_ERROR) with retry hints and actionable messages. - SKILL.md: AI agent setup skill file for automated global install, MCP configuration across Claude Desktop, Cursor, Windsurf, and VS Code.
- GitHub Actions Fleet Indexer: Automated code graph indexing workflow with incremental patching on every push/PR.
- New CLI Command:
batho mcpβ starts the MCP server (8th CLI command). - New Dependencies:
fastmcp>=3.4.0,networkx>=3.0,watchdog>=6.0.0
Testsβ
- 507 tests (up from 381) β 126 new MCP tests covering tools, prompts, resources, registry, community detection, token budget, and error handling.
v1.1.0 β 2026-06-10β
Refactored v1.1.0 release focusing on unified configuration, performance, and CLI simplicity.
New Features & Enhancementsβ
- Unified Configuration: All settings consolidated into a single
./batho.yaml(seebatho.yaml.examplefor the complete schema). - Arrow IPC Bundle Storage: Relational data and symbol indices are serialized in high-performance Arrow IPC table formats directly in the
.batho/artifact/directory. - Lossless Bidirectional Traversal: Graph-to-code reconstruction supported via
SYNTAX_GLUEentity preservation and cryptographic hash validation. - Simplified CLI Interface: Restructured the toolchain into exactly 7 command entrypoints:
buildβ baseline repository builds.patchβ native content-hash-based incremental indexing.exportβ JSON and pack ZIP exports.fixβ database diagnostic and auto-repair routines.diffβ node-level evolution history.gcβ garbage collection, Sweeping, and vacuums.loadβ unpack transport ZIPs.
Removalsβ
- Subsystem Removal: Removed the legacy Web Dashboard, REST API Bridge, MCP Hub Context Server, and client-side Git Hook automation to focus exclusively on high-performance developer command-line workflows.
v1.0.0 β 2026-05-17β
Initial pre-refactor production baseline.
Featuresβ
- Multi-language AST extraction (40+ languages via tree-sitter).
- In-memory hypergraph with cross-file symbol resolution.
- BSG compression with token-budgeted rendering.
- Time Machine snapshots with incremental patching.
- Pre-refactor subsystems (legacy dashboard, REST bridge, MCP server, git hooks).
- 381 automated tests.