The Chat Feature That Worked on the First Try
I shipped a new chat sub-command for ShipClip (the newly-renamed VidPipe) last week. The feature worked perfectly on the first iteration. Not “mostly worked.” Not “worked after three debugging sessions.” It just worked.
This never happens when you vibe code something. You try it, it breaks, you fix it, it breaks differently, you fix that, and eventually it works. But this time I planned it, executed on it, and the agent showed me my scheduled posts exactly as designed. The chat agent manipulated my actual Late.co calendar — swapping posts, rebuilding my entire content week around an “agentic DevOps” theme.
The difference? I didn’t just vibe code it. I enforced test coverage at the architectural level, and I made the AI build its own cage.
Test Enforcement: Not Just Coverage Reports
Here’s the problem with most test coverage tools: they’re backward-looking. They generate a report after you’ve already written the code. By then, you’re in rationalization mode. “80% coverage is pretty good, right?” You merge it. The untested 20% breaks in production.
I built something different. A pre-tool-use hook that analyzes what lines you changed and verifies that tests specifically cover those exact lines. Not “do tests exist.” Not “is overall coverage above 80%.” But “did you write tests for the code you just modified?”
This is line-level coverage verification, enforced at commit time. The hook doesn’t let you commit until tests prove they hit the modified lines. It’s surgical.
The AI agent initially suggested Option A: a fast pre-tool-use hook that just checks if test files exist. Safe. Reasonable. Useless.
I pushed back. “Get them all, dude. I don’t care. The point of this is to be conservative.”
We went with Option B: full coverage verification. The hook analyzes diffs, extracts modified line numbers, runs tests with coverage instrumentation, and blocks the commit if any changed line isn’t executed by at least one test. Copilot agent hooks have evolved from simple gatekeepers to full enforcement mechanisms — this is the logical endpoint.
Configurable Thresholds, Layer-Aware Requirements
The enforcement isn’t a blunt 100% hammer. It’s configurable with layer-aware test tier requirements. Different parts of the codebase have different risk profiles.
- L3 (Core Domain Logic): 90% coverage required. This is business logic — if it breaks, everything breaks.
- L4 (Application Services): 80% coverage. Orchestration layer where use cases live.
- L5 (Infrastructure Adapters): 70% coverage. Database and API integration points.
- L6 (Entry Points): 60% coverage. CLI commands and web endpoints — tested mostly through integration.
The defaults are aggressive (80% minimum), but you can dial them per layer. The idea is stolen from hexagonal architecture’s dependency rules: layers have responsibilities, and their test requirements should match their criticality.
This isn’t about hitting a number. It’s about making low test coverage a conscious decision that requires overriding the system. You want to ship untested code? Fine. But you have to explicitly say so.
The Architecture Caught What I Missed
Here’s where it got beautiful. The layer architecture policies caught an invalid import before I even ran the tests. I was working on L3 (domain logic), and I tried to import something from L4 (application services).
The hook blocked it instantly. L3 can’t import from L4 — that’s an architectural violation. Dependency flows inward in hexagonal architecture, never outward. If the domain layer depends on the application layer, you’ve inverted the structure.
The agent didn’t argue. It figured out the proper solution: put the shared code in L5 (a loader abstraction), re-export it from L6 (the public API layer), and import it from there. The architecture enforcement was working exactly as designed, and the AI adapted to it without friction.
This is what I wrote about in Agentic DevOps — shifting quality gates left into the development environment itself. The agent isn’t just writing code. It’s being constrained by Copilot hooks that prevent entire classes of bugs before they exist.
Why Planning Beats Vibing (Sometimes)
I’ve spent the last year deep in agent harnesses and context engineering. The thesis has always been: AI agents need constraints to be useful. Give them too much freedom and they produce technically correct garbage. Give them the right constraints and they produce architecturally sound systems.
The chat feature working on the first try wasn’t luck. It was the result of:
- Clear architectural boundaries — layer rules that prevent dependency violations
- Enforced test coverage — line-level verification that blocks untested changes
- Pre-tool-use enforcement — quality gates that run before code enters version control
- AI-aware tooling — hooks that explain violations in terms the agent can act on
When you vibe code something, you’re relying on intuition and iteration. You write code, run it, see what breaks, fix it, repeat. O’Reilly’s guide to writing specs for AI agents makes the point clearly: agents perform dramatically better with structured requirements than with vague instructions.
When you plan it — when you define the architecture, write the tests first, enforce the boundaries — the AI agent just executes. And it executes correctly.
The 90/10 Rule: Agents Are Still Software
Here’s what nobody wants to hear about AI agents: they’re about 90% software engineering and only 10% AI. The novel part is the LLM. The hard part is the infrastructure, observability, testing, deployment pipelines, rollback strategies, and guardrails.
ShipClip (formerly VidPipe) isn’t impressive because it uses AI to trim videos. It’s impressive because it has a 15-stage pipeline with layer isolation, configurable test enforcement, architectural dependency rules, and a chat interface that manipulates real scheduling APIs without breaking anything.
The test enforcement architecture is what makes the AI safe to use. Without it, the agent could ship anything. With it, the agent can only ship code that:
- Passes layer dependency checks
- Meets minimum test coverage thresholds
- Covers modified lines with executable tests
- Follows architectural boundaries
That’s not prompt engineering. That’s DevOps.
What This Actually Looks Like in Practice
The enforcement workflow is straightforward:
- Agent modifies code in layer L3 (domain logic).
- Pre-tool-use hook triggers and analyzes the diff.
- Layer checker validates that L3 isn’t importing from L4 or higher.
- Coverage analyzer extracts modified line numbers (e.g., lines 45–67).
- Test runner executes with coverage instrumentation enabled.
- Line coverage mapper checks if tests executed lines 45–67.
- Threshold enforcer compares coverage % against L3’s requirement (90%).
- Commit succeeds or fails based on whether all checks pass.
If any step fails, the commit is blocked and the agent gets structured feedback: “Line 52 in domain/video.py is not covered by tests. Add test coverage or override with --no-verify.”
The agent doesn’t need to understand the enforcement mechanism. It just needs to respond to the error message. Which it does, by writing the missing test.
The Bigger Picture: Agentic DevOps Infrastructure
This is the natural evolution of what I’ve been calling Agentic DevOps. Traditional DevOps put quality gates in CI/CD pipelines — after you’ve written the code, before you deploy it. Agentic DevOps puts quality gates in the development environment, where the agent is actively writing code.
The goal isn’t to catch bugs in the pipeline. It’s to prevent bugs from being written in the first place by constraining what the agent can do.
Anthropic’s research on agent evals shows that agents propagate and compound mistakes across multiple turns. A bad architectural decision in turn 1 becomes a cascade of bad decisions in turns 2–10. The enforcement architecture breaks that cascade by rejecting the bad decision immediately.
The test enforcement system is part of a larger infrastructure that includes:
- Layer-aware dependency rules (hexagonal architecture enforcement)
- Configurable coverage thresholds per architectural layer
- Line-level diff analysis to focus verification on changed code
- Pre-tool-use hooks that block invalid commits before they enter version control
- Structured error feedback that agents can parse and act on
All of this runs locally, in the development environment, before anything touches a remote branch. By the time code reaches CI/CD, it’s already passed architectural validation and test enforcement.
What I Learned Building This
The biggest surprise wasn’t that it worked. It was how naturally the AI agent adapted to the constraints. When the layer checker blocked the L3→L4 import, the agent didn’t thrash. It didn’t try to work around it. It found the architecturally correct solution: refactor the shared code into a lower layer and re-export it properly.
This matches what I’ve seen across hundreds of hours building agent harnesses: AI agents don’t resist good constraints. They work within them. The chaos comes from poorly-defined boundaries, not from enforcement itself.
The test coverage enforcement is strict by design. It defaults to 80% coverage and yells at you if you don’t hit it. But that strictness creates predictability. The agent knows exactly what’s required. Write code, write tests, verify coverage, commit. No ambiguity.
When you vibe code, every commit is a negotiation with your future self about whether “this is probably fine.” When you enforce architecture and tests, there’s no negotiation. Either it passes or it doesn’t.
The Bottom Line
The chat feature worked on the first try because I didn’t let the AI ship code without tests. The architecture caught the dependency violation because I encoded the rules in Copilot pre-tool-use hooks. The agent adapted to both constraints without friction because good constraints make agents more effective, not less.
Test enforcement isn’t a nice-to-have for AI-assisted development. It’s the foundation. You can’t trust an agent to write production code if you’re relying on manual review to catch test gaps. You need automated enforcement that runs before the commit, analyzes exactly what changed, and blocks anything that doesn’t meet the bar.
This is what Agentic DevOps actually looks like in 2026. Not dashboards and observability (though those matter). Not prompt engineering and context windows (though those matter too). But architectural enforcement at the development layer, where agents are constrained by the same rules that make human-written code maintainable.
ShipClip’s test enforcement architecture is open source, along with the rest of the pipeline. If you’re building AI agents that write code, you need something like this. Not because it’s clever. Because shipping untested code at agent velocity is how you build a house of cards.
And at 3:47 AM when it collapses, you won’t be able to vibe code your way out of it.