Code RoomContext scope for monorepo changes
HardPrep Room Coding #4312

Context scope for monorepo changes

Vibe & agenticAlgorithms & data structuresSenior–Staff~18 min

You're adding a feature to a 600k-line monorepo. One engineer's plan: feed the entire repo into the model's context window every request 'so it has full knowledge.' Another: build a retrieval layer that pulls only relevant files. The task this week is a focused change to one service's auth middleware. Critique both approaches and say how you'd actually scope the context for THIS task.

Implement
select_context_files(target_path: str, import_edges: list[list[str]], max_hops: int) → list[str]
Examples
in["services/auth/middleware.ts",[["services/auth/middleware.test.ts","services/auth/middleware.ts"],["services/auth/routes.ts","services/auth/middleware.ts"],["services/auth/middleware.ts","lib/types.ts"],["services/billing/handler.ts","services/auth/routes.ts"],["lib/types.ts","lib/base.ts"]],1]out["lib/types.ts","services/auth/middleware.test.ts","services/auth/middleware.ts","services/auth/routes.ts"]
in["services/auth/middleware.ts",[["services/auth/middleware.test.ts","services/auth/middleware.ts"],["services/auth/routes.ts","services/auth/middleware.ts"],["services/auth/middleware.ts","lib/types.ts"],["services/billing/handler.ts","services/auth/routes.ts"],["lib/types.ts","lib/base.ts"]],0]out["services/auth/middleware.ts"]
in["services/auth/middleware.ts",[["services/auth/middleware.test.ts","services/auth/middleware.ts"],["services/auth/routes.ts","services/auth/middleware.ts"],["services/auth/middleware.ts","lib/types.ts"],["services/billing/handler.ts","services/auth/routes.ts"],["lib/types.ts","lib/base.ts"]],2]out["lib/base.ts","lib/types.ts","services/auth/middleware.test.ts","services/auth/middleware.ts","services/auth/routes.ts","services/billing/handler.ts"]
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 18 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.