Repository Architecture and Boundaries
Status: Current Last updated: 2026-05-01 05:30 EDT
Top-level layout
spec/ canonical syntax and error spec source
spec/tools/ deterministic generators + validators (separate Cargo workspace)
grammar/ tree-sitter grammar source + generated parser artifacts
crates/ all Rust crates (root Cargo workspace)
talkbank-model/ data model, validation, alignment, errors, parser API trait
talkbank-derive/ proc macros (SemanticEq, SpanShift, ValidationTagged, error_code_enum)
talkbank-parser/ canonical parser (tree-sitter)
talkbank-parser-re2c/ alternate parser (specification oracle, opt-in batch parser)
talkbank-parser-tests/ parser equivalence and roundtrip tests
talkbank-transform/ pipelines, CHAT↔JSON, caching, parallel validation
clan-core/ CLAN analysis commands and format converters
chatter-cli/ the `chatter` CLI binary
chatter-lsp/ LSP server
send2clan-sys/ C FFI to the legacy CLAN app
batchalign/ Batchalign runtime: CLI, axum server, dispatch, FA, morphosyntax, Rev.AI client
batchalign-types/ Batchalign shared domain + worker IPC types
batchalign-pyo3/ PyO3 bridge — builds the `batchalign_core` Python extension
batchalign/ Batchalign Python worker code (ML inference hosting only)
apps/ desktop apps (Tauri v2 + React): chatter-gui, dashboard-desktop
apps/batchalign/cli-web-statuspage/ React dashboard for the Batchalign server
apps/vscode-extension/ VS Code extension (TypeScript)
corpus/ reference corpus (must pass 100%)
schema/ JSON Schema for ChatFile AST
tests/ workspace-level integration tests and fixtures
fuzz/ fuzz targets (separate Cargo workspace)
book/ mdBook documentation source
docs/ release-contract policy documents and the auto-generated error catalog
Architectural principles
- Clear boundaries between specification, generation, runtime logic, and documentation.
- Generated artifacts and hand-authored code are kept separate with
hard guardrails —
parser.c,node-types.json, generated tests and error-doc artifacts are never edited by hand. - Each crate has a single clear responsibility.
- Entry-point docs guide new contributors to authoritative references quickly.
Canonical ownership rules
spec/owns the language intent and accepted examples — what CHAT means.grammar/owns tokenization and CST shape only, not semantic validation policy.talkbank-modelowns semantic validity, serialization invariants, error types, and parser API contracts.talkbank-transformowns pipelines and JSON schema validation.batchalign(the crate) owns the Batchalign-specific runtime, server, and ML-pipeline orchestration; it consumes the talkbank-* crates above.
Dependency direction rules
specdoes not depend on runtime crates.grammaris consumed by parser crates, not vice versa.talkbank-modelis dependency-minimal and stable; all other talkbank-* crates depend on it.- The
batchaligncrate consumes the talkbank-* core crates (model, parser, transform, etc.) but never reimplements CHAT primitives. - CLI / LSP / desktop apps depend on stable internal APIs, never directly on unstable internals of other crates.
- Generator tools may read specs and grammar metadata but do not become runtime dependencies.
Acceptance criteria
- Every top-level directory has a clear purpose statement.
- No crate depends on internal modules outside declared boundaries.
- No generated artifact is edited manually.
- New contributors can identify authoritative docs in less than five minutes.