Module Map

This guide maps source paths to responsibilities so contributors can quickly choose the correct module when implementing changes.

Composition Root🔗

PathWhat lives here
crates/agentty/src/main.rsBinary entry point: database bootstrap, RoutingAppServerClient creation, App construction, runtime launch.
crates/agentty/src/lib.rsPublic module exports and crate-level re-exports.

Application Layer (app/)🔗

PathWhat lives here
crates/agentty/src/app.rsApp module router and public re-exports for app orchestration APIs.
crates/agentty/src/app/core.rsApp facade, event reducer, startup loading, background task wiring.
crates/agentty/src/app/assist.rsShared assistance helpers for commit and rebase recovery loops.
crates/agentty/src/app/merge_queue.rsMerge queue state machine (Queued/Merging progression rules).
crates/agentty/src/app/project.rsProjectManager - project CRUD and selection orchestration.
crates/agentty/src/app/service.rsAppServices dependency container (Database, FsClient, GitClient, app-server client, event sender).
crates/agentty/src/app/session_state.rsSessionState - per-session runtime state container.
crates/agentty/src/app/setting.rsSettingsManager - settings management and persistence.
crates/agentty/src/app/tab.rsTabManager - top-level tab definitions and tab selection state.
crates/agentty/src/app/task.rsApp-scoped background tasks (git status polling, version checks, review assists, app-server turns).
crates/agentty/src/app/session/Session-specific orchestration split by concern:
- core.rsSessionManager, session clock boundary, shared constants, and session module tests.
- workflow/access.rsSession lookup helpers.
- workflow/lifecycle.rsSession creation, prompt/reply workflows.
- workflow/load.rsSession snapshot loading.
- workflow/merge.rsMerge/rebase workflows.
- workflow/refresh.rsPeriodic refresh scheduling.
- workflow/review.rsReview transcript replay and review-mode restoration helpers.
- workflow/task.rsSession process execution and status persistence.
- workflow/worker.rsPer-session command queue orchestration, AgentChannel turn dispatch.

Domain Layer (domain/)🔗

PathWhat lives here
crates/agentty/src/domain/agent.rsAgent kinds, models, model metadata, and agent-related enums.
crates/agentty/src/domain/input.rsInput state management.
crates/agentty/src/domain/permission.rsPermissionMode and permission logic.
crates/agentty/src/domain/project.rsProject entities and display helpers.
crates/agentty/src/domain/session.rsSession entities, statuses, sizes, and stats-focused domain types.
crates/agentty/src/domain/setting.rsShared persisted setting keys used across app and infrastructure layers.

Infrastructure Layer (infra/)🔗

PathWhat lives here
crates/agentty/src/infra/db.rsSQLite persistence and queries; database open config enables WAL and foreign keys.
crates/agentty/src/infra/fs.rsFsClient trait and production async filesystem adapter used by app orchestration.
crates/agentty/src/infra/git.rs + infra/git/Git module router plus async git workflow commands (merge.rs, rebase.rs, repo.rs, sync.rs, worktree.rs).
crates/agentty/src/infra/git/client.rsGitClient trait boundary, RealGitClient production adapter, and git client integration tests.
crates/agentty/src/infra/channel.rs + infra/channel/AgentChannel trait and provider-agnostic turn execution:
- cli.rsCliAgentChannel - CLI subprocess adapter (Claude).
- app_server.rsAppServerAgentChannel - app-server RPC adapter (Codex/Gemini).
crates/agentty/src/infra/agent/Per-provider backend command builders and response parsing:
- backend.rsAgentBackend trait, transport mode selection, prompt templates.
- claude.rsClaude backend implementation.
- codex.rsCodex backend implementation.
- gemini.rsGemini backend implementation.
- protocol.rsStructured response contract (AgentResponse, AgentResponseMessage, AgentResponseMessageKind), JSON-schema generation, parsing, stream normalization, and repair prompt helpers.
- response_parser.rsProvider-specific final/stream output parsing and usage extraction for Claude, Gemini, and Codex.
crates/agentty/src/infra/app_server.rsAppServerClient trait and shared request/response stream types.
crates/agentty/src/infra/app_server_router.rsRoutingAppServerClient - provider routing for app-server models (Codex/Gemini).
crates/agentty/src/infra/app_server_transport.rsShared stdio JSON-RPC transport utilities for app-server processes.
crates/agentty/src/infra/codex_app_server.rsCodex app-server transport/session integration.
crates/agentty/src/infra/gemini_acp.rsGemini ACP transport/session integration.
crates/agentty/src/infra/file_index.rsGitignore-aware file indexing and fuzzy filtering for @ mentions in prompts.
crates/agentty/src/infra/tmux.rsTmuxClient trait and tmux subprocess adapter used by App worktree-open orchestration.
crates/agentty/src/infra/version.rsVersion checking infrastructure.

Runtime Layer (runtime/)🔗

PathWhat lives here
crates/agentty/src/runtime.rsRuntime module router and public runtime entry re-exports.
crates/agentty/src/runtime/core.rsTerminal lifecycle, event/render loop orchestration, TerminalGuard.
crates/agentty/src/runtime/terminal.rsTerminal setup/cleanup plus EditorLauncher trait boundary for external editor subprocesses.
crates/agentty/src/runtime/event.rsEventSource trait, event reader spawn, tick processing, and app-event integration.
crates/agentty/src/runtime/key_handler.rsMode dispatch for key events.
crates/agentty/src/runtime/mode/Key handlers for each AppMode:
- list.rsSession list mode.
- session_view.rsSession view mode navigation.
- prompt.rsPrompt mode editing and submit.
- question.rsClarification question input mode handling and follow-up reply submission.
- diff.rsDiff mode handling.
- help.rsHelp overlay mode.
- confirmation.rsShared yes/no confirmation mode.
- sync_blocked.rsSync-blocked popup key handling.

UI Layer (ui/)🔗

PathWhat lives here
crates/agentty/src/ui/render.rsFrame composition and render context.
crates/agentty/src/ui/router.rsMode-to-page routing for content rendering.
crates/agentty/src/ui/layout.rsLayout helper utilities.
crates/agentty/src/ui/overlay.rsOverlay rendering dispatch (help, info, confirmation).
crates/agentty/src/ui/markdown.rsMarkdown rendering utilities.
crates/agentty/src/ui/diff_util.rsDiff parsing and rendering helpers.
crates/agentty/src/ui/icon.rsIcon constants and helpers.
crates/agentty/src/ui/text_util.rsText manipulation helpers.
crates/agentty/src/ui/activity_heatmap.rsActivity heatmap visualization.
crates/agentty/src/ui/util.rsGeneral UI utilities.
crates/agentty/src/ui/page/Full-screen page implementations:
- diff.rsDiff view page.
- project_list.rsProject list page.
- session_chat.rsSession chat page (new sessions and replies).
- session_list.rsSession list page.
- setting.rsSettings page.
- stat.rsStats/analytics page.
crates/agentty/src/ui/component/Reusable widgets and overlays:
- chat_input.rsChat input widget.
- confirmation_overlay.rsConfirmation dialog overlay.
- file_explorer.rsDiff file explorer component.
- footer_bar.rsFooter bar widget.
- help_overlay.rsHelp overlay component.
- info_overlay.rsInfo overlay component.
- session_output.rsSession output display widget.
- status_bar.rsStatus bar widget.
- tab.rsTabs navigation widget.
crates/agentty/src/ui/state/UI state types:
- app_mode.rsAppMode enum and mode transitions.
- help_action.rsHelp content definitions.
- prompt.rsPrompt editor state.