| 1 |
--- |
| 2 |
name: boundary-contract |
| 3 |
description: Use before implementing a structural change in clnkr to prevent file-splitting without real ownership or cohesion. |
| 4 |
--- |
| 5 |
|
| 6 |
# Boundary Contract |
| 7 |
|
| 8 |
Use this before adding packages, moving code, extracting files, or accepting an |
| 9 |
agent-authored design that changes clnkr's architecture. |
| 10 |
|
| 11 |
## Required Contract |
| 12 |
|
| 13 |
Write the contract before implementation: |
| 14 |
|
| 15 |
- Owner: package, file, or layer that owns the behavior. |
| 16 |
- Inbound callers: which packages/files may call into it. |
| 17 |
- Outbound dependencies: which packages/files it may depend on. |
| 18 |
- State and data owned: what it stores, computes, or validates. |
| 19 |
- Boundary exclusions: what must not cross this boundary. |
| 20 |
- Depth test: why this is a deeper interface, not a one-for-one file split. |
| 21 |
- Verification: command or report that will show the boundary held. |
| 22 |
|
| 23 |
## Review Rules |
| 24 |
|
| 25 |
Reject the design if: |
| 26 |
|
| 27 |
- ownership is named by filename only |
| 28 |
- every extracted function is still called by the old owner |
| 29 |
- both sides import or call back into each other |
| 30 |
- the new module is mostly pass-through wrappers |
| 31 |
- the justification is "organization" without lower coupling or clearer ownership |
| 32 |
|
| 33 |
Prefer existing clnkr boundaries: |
| 34 |
|
| 35 |
- root package: importable core agent API and typed events |
| 36 |
- `internal/core/`: shared core helpers that do not depend on frontend or providers |
| 37 |
- `internal/providers/`: provider adapters and provider wire protocols |
| 38 |
- `internal/providerfactory/`: frontend-safe provider construction boundary |
| 39 |
- `cmd/internal/clnkrapp/`: CLI coordination and session/provider composition |
| 40 |
- `cmd/clnkr/` and `cmd/clnkrd/`: executable adapters |
| 41 |
|
| 42 |
Use `make architecture-shape-report` and `make semantic-cohesion-report` as |
| 43 |
manual evidence when a structural claim depends on coupling or cohesion. |