Skip to main content

12. Appendix: Schema Reference

12.1 Schema Versions

ArtifactSchema VersionFile
Graphgraph.v1.ctn/<id>/graph.json
BSGbsg.v1.ctn/<id>/bsg.json
Snapshotsnapshot.v1.ctn/snapshots/<id>.json
Index Metadataindex-metadata.v1.ctn/index.json
File Cachefile-cache.v1.ctn/local/cache/ast_cache.db
BSG Pluginbsg-plugin.v1batho/bsg/schemas/bsg-plugin-schema-v1.json

Schema Dependency Graph

Figure 27: Schema Dependency Graph - Dependency diagram showing the relationships between configuration schemas, runtime artifacts, and cache layers.

12.2 Directory Structure

.ctn/
├── index.json # Index metadata + history
├── local/
│ ├── cache/
│ │ └── ast_cache.db # SQLite AST entity cache
│ ├── metrics/
│ │ └── metrics.json # Indexing performance metrics
│ └── sync/
│ └── artifact_registry.db # SQLite artifact registry
├── snapshots/
│ └── batho_<uuid>_<ts>.json # Time Machine snapshots
└── <index_id>/
├── graph.json # Entities + relationships
├── bsg.json # Structured symbol graph
└── files.md # All files by category

12.3 Glossary

TermDefinition
ASTAbstract Syntax Tree — structured representation of source code
BSGBatho Structured Graph — compressed, queryable code representation
CTNContent directory — Batho's output workspace
EntityA node in the code graph (function, class, etc.)
HypergraphGraph where edges can connect any number of nodes
PatchIncremental update to a snapshot
RelationshipA directed edge between entities
SnapshotImmutable point-in-time capture of the code graph
Symbol IndexCross-file lookup table for imports and exports

12.4 Error Codes

CodeDescription
E001File not found
E002Parse error
E003Cache corruption
E004Snapshot mismatch
E005Permission denied
E100Configuration error
E200Plugin load failure
E300Storage error