implementation-order · git:20260507.fc5df68 · 2026-05-07 · sha256 39942dc8699d8015

implementation-order git:20260507.fc5df68A

Immutable. This exact content never changes and is served at /api/v1/blob/39942dc8699d8015.

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

# Implementation order

For **new behavior**, **`workflow.mdc` 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 **`testing.mdc`**).
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 **`api-layer.mdc`** and **`workflow.mdc`**.

## Forbidden

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

## References

@architecture.mdc
@workflow.mdc
@api-layer.mdc