VALMORIA Weekly dispatch

23 August 2026

Code-Enforced Guardrails, Not Prompt Whispers

When building an AI phone agent designed for critical interactions, the temptation is strong to rely solely on prompt engineering for guardrails. Instructions like 'Don't say X,' or 'always do Y' are common. However, it's crucial to recognize that for a language model, these are ultimately suggestions; they are not guarantees. In a system where financial or legal obligations are at stake, or where factual integrity is paramount, this distinction is not merely academic—it's foundational. This week, I implemented an honesty floor for such an agent, specifically to prevent hallucination of critical information. This floor isn't a complex set of prompt directives; it's a layer enforced directly in code. If the model generates a response that violates a predefined set of factual or operational constraints, the system intervenes. It will either correct the output with verified data or, if the information is genuinely unavailable or ambiguous, it will defer, perhaps by routing to a human or stating its limitation, rather than allowing a fabricated response to be delivered. This robust, code-level enforcement ensures the agent remains consistently truthful, regardless of the underlying model's occasional tendency to improvise. The result is a system that maintains roughly one-second conversational turns, operating effectively in a bilingual context, where integrity is a non-negotiable feature. This design philosophy echoes the approach I took with a fiscal-enrichment engine: AI plays a powerful role in the tooling that helps build and refine the rules, but the runtime path that handles legal obligations remains entirely free of LLMs. This separation ensures determinism, auditability, and speed where they are most critical. The lesson I keep relearning is that knowing precisely where not to put the model is often the highest-leverage skill in modern AI engineering.

Centralizing for Resilience

Building resilient and reliable systems hinges on anticipating common failure modes and implementing robust, centralized solutions. Consider the challenge of notification systems, which are vital for operational awareness. Distributing deduplication and throttling logic across every individual service that might trigger an alert is a recipe for eventual failure. It's a guarantee that one call site will inevitably miss an update, or implement the logic incorrectly, leading to either an overwhelming flood of redundant alerts during an incident or, worse, the suppression of critical messages. This week, I reinforced the principle that deduplication and throttling belong squarely within the notification service itself—the notifier—not scattered among the disparate upstream services that call it. This centralized architecture ensures that the entire system benefits from a consistent and dependable notification policy. My implementation ensures that deduplication is committed only after a notification has been successfully sent. This means if a transmission fails due to a transient network issue or an API timeout, that notification is not suppressed from a subsequent retry attempt. This prevents critical alerts from being silently dropped due to temporary outages. Furthermore, the system incorporates both per-channel and global throttle windows. These limits cap the overall volume of alerts, preventing any single incident, however severe, from overwhelming operators with a cascade of notifications. This approach transforms what could easily become a chaotic, manually managed process prone to human error into an idempotent, automated pipeline that consistently delivers critical information without noise.

The Cost of Waiting

In an era where attention spans are measured in milliseconds, an eight-second load time for a digital portfolio, especially one showcasing 3D work, doesn't just feel slow—it actively detracts from its marketing value. A prolonged loading spinner creates negative user experience, often leading to immediate tab closure before any content is even seen. This week, I tackled precisely this challenge for a sophisticated 3D portfolio, where the initial download size of the application and its numerous libraries was simply unacceptable. The solution wasn't found in cutting corners on content or features, but in meticulous, performance-driven engineering: manually splitting the substantial 3D vendor bundle from the main application bundle. Specifically, core libraries like React and the various large 3D rendering libraries are now chunked into entirely separate, distinct vendor bundles. This strategy ensures that the initial load contains only the absolute essentials for the application shell. Subsequently, specific sections of the portfolio—each potentially containing heavy 3D assets or complex interactive components—are then lazy-loaded behind `React.lazy` and `Suspense`. This pattern ensures that the user only downloads the necessary code and assets precisely when they navigate to that particular section. Critically, module preloading is explicitly disabled across the application. While preloading can sometimes offer perceived speed benefits, in this context, it would have inadvertently downloaded large, unneeded bundles in the background, negating the primary goal of chunking for a fast initial render. This optimization isn't merely about technical elegance; it's a direct investment in the user's experience. It's about respecting their time and ensuring that the very first impression is one of speed, responsiveness, and professional polish, rather than a frustrating wait. This project served as a powerful reminder that performance is not just a technical metric; it is a fundamental feature, and the engineering decisions made to achieve it directly impact the perceived quality and business value of the entire product.

These diverse engineering challenges—from enforcing strict honesty in AI interactions to building resilient notification pipelines and optimizing complex web performance—all underscore a unifying principle. The most impactful and high-leverage engineering decisions often reside not in simply deploying the newest technology, but in deeply understanding system boundaries, identifying critical failure points, and choosing the most appropriate tool or pattern for the specific job. It is about building systems that are inherently honest, performant, and robust, turning potential vulnerabilities into guaranteed outcomes.

To apply this: take a critical look at a system you are currently responsible for. Identify one specific, critical path or interaction where a 'suggestion' to a component, or a manual step in a process, could lead to a significant failure or undesirable outcome. Then, challenge yourself to design and implement a code-enforced guarantee around it. Make it idempotent. Make it auditable. Make it honest.

Del Rey Valmoria Software & Automation Engineer