27 MAR 2026

kpprasanna

engineering patterns

homedocs

Engineering Patterns

This codebase favors deterministic, maintainable structure over fast first drafts.

Core Rules

Required Workflow Before Coding

For any non-trivial change:

  1. Identify the owning domain.
  2. Compare at least two plausible patterns.
  3. Choose one pattern explicitly and state why it wins.
  4. Name the blast radius.
  5. State what is intentionally out of scope.
  6. Then implement.

Preferred Module Shape

When a feature grows beyond a small edit, separate it into clear concerns:

Not every feature needs every module, but no feature should collapse all concerns into one file if it is expected to grow.

Forbidden Patterns

Refactor Triggers

Stop extending a file and decompose it when:

Current Refactor Priorities

1. Connect Flow

src/app/connect/mod.rs currently mixes:

Recommended split:

2. App State

src/app/state/app_state.rs should gradually move toward bounded feature substates such as:

3. Panel Dispatch

src/app/runtime/panel_dispatch.rs should be split by modal/panel domain instead of remaining a shared control monolith.

4. Backend Integration

Before deeper Codex/Responses support lands, crates/agent_core/src/llm_backend.rs should be decomposed along transport/protocol boundaries so new providers do not stack onto one chokepoint.

Review Standard

Every meaningful change should be understandable and defensible to another engineer immediately.

Prefer:

Avoid: