Module Documentation
TunaCode is structured in seven layers. Dependencies flow downward only.
ui Textual TUI, widgets, renderers, screens
|
core Agent loop, compaction, session, logging, state machine
|
tools Tool implementations exposed to the LLM
|
configuration Settings, model registry, paths, limits, pricing
|
infrastructure Cache manager, invalidation strategies, named caches
|
utils Message conversion, token estimation, gitignore file listing
|
types Base aliases, callback protocols, canonical message model
Reading Order
Start from the bottom if you need to understand the type system.
Start from the top if you need to change the UI.
Start from core/core.md if you need to understand how a user prompt becomes an LLM response.
| Layer |
Document |
Key concern |
| types |
types/types.md |
Aliases, protocols, canonical model |
| utils |
utils/utils.md |
Message adapter, token estimation |
| infrastructure |
infrastructure/infrastructure.md |
Thread-safe caching |
| configuration |
configuration/configuration.md |
User config, model registry |
| tools |
tools/tools.md |
LLM-callable tool implementations |
| core |
core/core.md |
Agent loop, compaction, session |
| ui |
ui/ui.md |
Textual app, widgets, theming |
Root-Level Files
These files live directly under src/tunacode/ and do not belong to any sub-package.
| File |
Purpose |
__init__.py |
Package marker (empty). |
constants.py |
Global constants: version, color palettes, theme builders, tool names, UI sizing. |
exceptions.py |
Exception hierarchy rooted at TunaCodeError. Every custom exception lives here. |
1---2name: 097-index-1c9230a43description: Module Documentation4---56# Module Documentation78TunaCode is structured in seven layers. Dependencies flow downward only.910```11ui Textual TUI, widgets, renderers, screens12 |13core Agent loop, compaction, session, logging, state machine14 |15tools Tool implementations exposed to the LLM16 |17configuration Settings, model registry, paths, limits, pricing18 |19infrastructure Cache manager, invalidation strategies, named caches20 |21utils Message conversion, token estimation, gitignore file listing22 |23types Base aliases, callback protocols, canonical message model24```2526## Reading Order2728Start from the bottom if you need to understand the type system.29Start from the top if you need to change the UI.30Start from `core/core.md` if you need to understand how a user prompt becomes an LLM response.3132| Layer | Document | Key concern |33|-----------------|------------------------------------------|--------------------------------------|34| types | [types/types.md](types/types.md) | Aliases, protocols, canonical model |35| utils | [utils/utils.md](utils/utils.md) | Message adapter, token estimation |36| infrastructure | [infrastructure/infrastructure.md](infrastructure/infrastructure.md) | Thread-safe caching |37| configuration | [configuration/configuration.md](configuration/configuration.md) | User config, model registry |38| tools | [tools/tools.md](tools/tools.md) | LLM-callable tool implementations |39| core | [core/core.md](core/core.md) | Agent loop, compaction, session |40| ui | [ui/ui.md](ui/ui.md) | Textual app, widgets, theming |4142## Root-Level Files4344These files live directly under `src/tunacode/` and do not belong to any sub-package.4546| File | Purpose |47|-------------------|-----------------------------------------------------------------|48| `__init__.py` | Package marker (empty). |49| `constants.py` | Global constants: version, color palettes, theme builders, tool names, UI sizing. |50| `exceptions.py` | Exception hierarchy rooted at `TunaCodeError`. Every custom exception lives here. |