chatty-core
UI-agnostic core of the Chatty agent. Contains every piece of logic that both the GPUI desktop app and the Ratatui terminal app share: models, services, tools, settings, repositories, factories, exporters, and the sandbox.
This crate has no GPUI dependency. Optional GPUI Global trait impls
are gated behind the gpui-globals feature; chatty-gpui enables it,
chatty-tui does not.
Module layout
| Path | Responsibility |
|---|---|
auth/ | Azure / OAuth credential acquisition |
curated_mcp.rs | Built-in MCP catalog seeded on first launch |
exporters/ | Conversation export (markdown, PDF, ATIF, …) |
factories/agent_factory/ | Build AgentClient per provider; tool registration |
gpui_globals.rs | impl Global for core types (feature-gated) |
install.rs | Hive module install/uninstall (validated names, capped download, .chatty-install.json record) and first-launch seeding |
models/ | Pure data types: Conversation, Message, stores |
repositories/ | Persistence abstractions (SQLite for conversations) |
sandbox/ | Bollard/Docker sandbox backend + manager |
services/ | Math/Mermaid renderers, shell, MCP, git, memory, skills, … and the delegation seams: worker_tree (one git worktree per worker), virtual_agents / worker_endpoint (roster → runner specs and per-endpoint budgets), team (team directories), spend_gate (hosted cap hook) |
session/ | AgentSession: the frontend-agnostic turn loop, usage pricing and delegated-usage rollup |
settings_snapshot.rs | SettingsSnapshot / SettingsDelta: canonical serialization, delta and apply across every settings family |
settings/ | Settings models + JSON repositories |
token_budget/ | Tokenization, context-window accounting, summarizer |
tools/ | LLM tool implementations (filesystem, shell, MCP, …) |
Process-global singletons
A single comment block at the top of src/lib.rs lists every
process-global singleton in the workspace, where it lives, and the
rationale for whether it’s centralized or domain-local. Update that
inventory whenever you add or move a singleton.
Build / test
From the workspace root:
cargo test -p chatty-core --lib # fast inner loop (no integration tests)
cargo test -p chatty-core # includes integration tests
make test # full CI-equivalent run
See AGENTS.md for repo-wide conventions and
CLAUDE.md for coding patterns.