implementation-order · git:20261004.8e8554b · 2026-10-04 · sha256 4da6f68a47c42fb1

implementation-order git:20261004.8e8554bA

Immutable. This exact content never changes and is served at /api/v1/blob/4da6f68a47c42fb1.

---
description: Layered implementation order (cake model)
globs: cmd/**/*.go, internal/**/*.go, external/**/*.go, lib/**/*.go, tools/**/*.go
alwaysApply: false
---

# Implementation order

For **new behavior**, the **workflow rule** wins on red-green order. Use this file to decide **where** code lives and which layer to extend first.

1. Extend the **lowest** layer that can own the change with no new upward dependencies.
2. Add tests at that layer before or with the change (see the **testing rule**).
3. Wire through **`internal/agent`** or **`internal/acp`** only after lower pieces exist and pass tests.
4. Optional HTTP surface - last mile in **`external/httpserver`**, then refresh **`openapi.go`** and docs per the **API-layer** and **workflow** rules.

## Forbidden

- Skipping tests for new behavior.
- Placing domain logic in **`cmd/`** or duplicating it in HTTP handlers instead of reusing **`internal/`** APIs.

## References

@docs/contributing/architecture.md