Guard hot path invariants
You're letting an AI agent work in a C++ networking codebase to add a new packet-parsing path. The codebase has a hard rule: the hot path must do zero heap allocation, and there's a region of legacy code that's fragile and must not be touched. How do you set up guardrails so the agent stays out of the no-go zone and respects the no-allocation invariant — given the agent can't 'see' these rules unless you make them visible?
find_guardrail_violations(diff_lines: list[str], forbidden_prefix: str, hot_path_prefix: str) → list[str][["net/hot/parse.cpp| std::vector<uint8_t> buf(len);","net/hot/parse.cpp| memcpy(dst, src, len);","legacy/framer.cpp| fixed_buffer_reset(&fb);","tools/dump.cpp| std::string report = build_report();"],"legacy/","net/hot/"]out["net/hot/parse.cpp|heap_allocation","legacy/framer.cpp|no_go_zone"][["net/hot/parse.cpp| // a std::vector here would allocate, so we use the pool","net/hot/parse.cpp| Pool::acquire(scratch, len);"],"legacy/","net/hot/"]out[]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.
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.