Code RoomRestore architecture in agent-written code
HardPrep Room Coding #4103

Restore architecture in agent-written code

Vibe & agenticAlgorithms & data structuresSenior–Staff~22 min

Over a quarter, agents have filled out a service where each feature lives in its own module — and each module is fine, but they leak: business logic seeps into HTTP controllers, the DB schema is queried directly from three layers, and there's no clear domain boundary anymore because no single agent run ever 'owned' the architecture. The system works and ships. As the staff engineer, how do you reassert clean abstraction boundaries across a largely machine-written codebase, and what do you change about HOW you delegate so the boundaries hold next quarter?

Implement
find_layer_violations(from_paths: list[str], to_paths: list[str]) → list[str]
Examples
in[["controllers/orders.ts","services/orders.ts","controllers/orders.ts"],["services/orders.ts","repositories/orderRepo.ts","repositories/orderRepo.ts"]]out["controllers/orders.ts -> repositories/orderRepo.ts: skips-layer"]
in[["repositories/db.ts","services/pricing.ts"],["controllers/checkout.ts","controllers/checkout.ts"]]out["repositories/db.ts -> controllers/checkout.ts: upward","services/pricing.ts -> controllers/checkout.ts: upward"]
in[["controllers/health.ts","lib/logger.ts"],["lib/logger.ts","services/orders.ts"]]out["lib/logger.ts -> services/orders.ts: shared-reaches-in"]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 22 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.