Applied Prompt Engineering

From theory to practice: How we use advanced techniques to build intelligent software systems.

Context Engineering MCP Integration

Quest Keeper AI: Modular Game State

Challenge: Managing complex, persistent D&D game states (inventory, combat, spells) across multiple sessions without overwhelming the LLM's context window.

Solution: Implemented the **Model Context Protocol (MCP)** to separate concerns. A Rust-based backend handles state logic, while the LLM acts as an orchestrator, calling specific tools (`roll_dice`, `get_inventory`) only when needed.

Rust MCP React Context Federation
Self-Reflection Automated Debugging

Watchdog System: Self-Healing AI

Challenge: AI agents can fail silently or hallucinate parameters when calling complex tools.

Solution: Created a **Watchdog Service** with a circular log buffer. When an error occurs, the system captures the exact context and tool input, feeding it back to a secondary "Debugger Agent" loop to analyze and fix the issue automatically.

Zod Validation Circular Buffer Error Recovery
System 2 Thinking Reactive Agents

Event-Driven Window Management

Challenge: Traditional polling for window states creates lag and consumes resources, leading to flaky desktop automation.

Solution: Shifted to an **Event-Driven Architecture** using UI Automation hooks. The agent waits for specific system events (e.g., "Save As" dialog open) before proceeding, mimicking human "System 2" deliberate attention.

C# / .NET Win32 API Reactive Patterns

Start Building Your Own

Use these techniques in your next project.