Change Recipes
Use these recipes to route changes through the correct modules without crossing layer boundaries.
Add or Modify a Session Workflow🔗
- Update orchestration in
crates/agentty/src/app/session/(lifecycle.rs,worker.rs,task.rs, etc.). - Keep persistence in
crates/agentty/src/infra/db.rs. - Keep git operations behind
GitClientincrates/agentty/src/infra/git/client.rs(re-exported fromcrates/agentty/src/infra/git.rs). - Update docs when lifecycle/status behavior changes:
docs/site/content/docs/usage/workflow.md.
Add a New Agent Backend or Model🔗
- Update domain model declarations in
crates/agentty/src/domain/agent.rs. - Add backend behavior in
crates/agentty/src/infra/agent/and wiring inbackend.rs. - If app-server-based, extend routing in
crates/agentty/src/infra/app_server_router.rs. - Register transport mode in
crates/agentty/src/infra/agent/backend.rs(transport_mode()). - The channel layer (
infra/channel.rs) routes automatically based on transport mode - no change needed there. - Update
docs/site/content/docs/agents/backends.mdwith backend/model documentation.
Add a Keybinding or Mode Interaction🔗
- Update the handler in
crates/agentty/src/runtime/mode/. - If a new mode/state is needed, extend
crates/agentty/src/ui/state/app_mode.rs. - If help content changes, update
crates/agentty/src/ui/state/help_action.rsas needed. - Update
docs/site/content/docs/usage/keybindings.md.
Add or Change Database Schema🔗
- Add a new migration file in
crates/agentty/migrations/(NNN_description.sql). - Never modify existing migration files.
- Keep query changes in
crates/agentty/src/infra/db.rs. - Ensure any status/model behavior changes are reflected in docs pages affected by user-facing behavior.
Add a New UI Page or Component🔗
- Add the page in
crates/agentty/src/ui/page/or component incrates/agentty/src/ui/component/. - Wire the page into
crates/agentty/src/ui/router.rs. - If a new
AppModeis needed, extendcrates/agentty/src/ui/state/app_mode.rsand add a key handler incrates/agentty/src/runtime/mode/.
Contributor Checklist for Architecture-Safe Changes🔗
- Keep workflow/state transitions in
app/, not in UI rendering modules. - Keep external integrations in
infra/behind traits. - Keep business entities and enums in
domain/. - In
app/andruntime/orchestration, avoid directCommand::new,Instant::now,SystemTime::now, and direct filesystem/process calls unless they run behind trait boundaries. - New external boundaries should get a trait with
#[cfg_attr(test, mockall::automock)]. - Update docs in
docs/site/content/docs/whenever user-facing behavior changes. - Update
docs/site/content/docs/architecture/module-map.md,docs/site/content/docs/architecture/runtime-flow.md, anddocs/site/content/docs/architecture/testability-boundaries.mdwhen architecture responsibilities change. - When adding/removing files in
runtime/mode/, update the runtime-mode file list indocs/site/content/docs/architecture/module-map.md. - When changing
TurnRequest/TurnEvent/TurnResultshapes ininfra/channel.rs, update the key-types table indocs/site/content/docs/architecture/runtime-flow.md. - When adding/removing
#[cfg_attr(test, mockall::automock)]external-boundary traits, updatedocs/site/content/docs/architecture/testability-boundaries.md. - Run quality gates from
AGENTS.mdbefore opening a PR.