layout: post title: "Architecting Agentic Workflows: Lessons in Context Injection and State Management" date: 2026-06-05 tags: [ai, anthropic, claude-code, agentic-workflows]
The prevailing discourse surrounding Large Language Models (LLMs) often centers on the art of "prompt engineering"—the pursuit of the perfect, high-entropy instruction set. However, recent insights into how Anthropic’s non-engineering teams (including Legal, Marketing, Design, and Finance) utilize Claude Code suggest a fundamental paradigm shift. The focus is moving away from complex prompt construction and toward context orchestration, modular skill architecture, and deterministic state management.
For technical practitioners looking to move beyond simple chat interfaces into true agentic workflows, the implementation patterns used by these non-engineering teams provide a blueprint for building robust, scalable, and low-error automated systems.
1. From Prompt Engineering to Contextual Injection
The most significant takeaway from Anthropic's internal usage is that "clever" prompting is secondary to high-fidelity context injection. While many users attempt to cram vast amounts of instruction into a single prompt, Anthropic’s teams utilize specialized files to define the model's persona and operational boundaries before a single task-specific instruction is issued.
The core of this approach relies on the claude.md file (and similar shared context fields). Rather than describing a task, these teams focus on:
- Identity Definition: Establishing a persistent "memory" of who the agent is (e.g., "You are a product designer with minimal coding experience").
- Operational Constraints: Defining how the model should process information (e.g., "Process tasks incrementally; do not attempt multi-step execution without verification").
- Contextual Anchoring: Using files like brand voice guides or positioning documents to ensure all outputs align with predefined organizational parameters.
By treating the LLM's environment as a structured knowledge base rather than a blank slate, the "prompting" becomes a trivial act of triggering pre-established context.
2. The Anatomy of a Modular Skill: Scalable Instruction Sets
To handle repetitive operational tasks, Anthropic teams have moved away from monolithic scripts toward a modular skill architecture. A "skill" in this ecosystem is essentially a specialized, versioned instruction set stored within a directory that Claude Code can programmatically access.
Building an effective skill requires a three-tier architectural approach:
Tier 1: The Metadata Layer (Discovery)
Every skill must begin with a highly specific name and description. This is not merely for human readability; it is the primary mechanism for agentic retrieval. Claude uses this metadata to decide whether to load the skill into its active context. A robust description includes:
- Trigger Conditions: "Use when a user requests marketing copy review."
- Negative Constraints: "Do not trigger for blog post generation."
- Functional Scope: "Analyzes copy against proven frameworks and writes to match brand voice."
Tier 2: The Logic Layer (skill.md)
The skill.md file contains the step-by-step procedural logic. A critical technical constraint here is token management. To prevent context window bloat and instruction drift, these files should be kept lean—ideally under 200 lines. The goal is to provide a high-level orchestration of steps rather than exhaustive detail.
Tier 3: The Reference Layer (RAG-lite)
For complex tasks requiring deep domain knowledge, the skill.md should not contain the data itself. Instead, it should point to external reference files. This creates a hierarchical retrieval pattern where Claude only loads heavy, detailed examples or datasets when the specific step in the logic layer necessitates it. This minimizes noise and preserves the model's attention on the primary task.
3. Agentic Design Patterns: Sub-Agents and Human-in-the-Loop (HITL)
A common pitfall in agentic implementation is the pursuit of "full autonomy." Anthropic’s teams explicitly avoid this, opting instead for a Human-in-the-Loop (HITL) design principle. The goal is not to replace the human, but to automate the "heavy lifting" while keeping the human at the critical decision points.
This is best exemplified by their use of specialized sub-agents. Rather than one agent attempting to manage an entire marketing workflow, they decompose the task into discrete, specialized units:
- Agent A: Specialized solely in headline generation. /
- Agent B: Specialized solely in description drafting.
By narrowing the scope of each agent, you ensure a cleaner context and higher output quality. The workflow follows a predictable pattern: Input $\rightarrow$ Data Transformation (via Sub-Agents) $\rightarrow$ Human Review Checkpoint $\rightarrow$ Output.
This checkpoint is the primary defense against "AI slop"—the degradation of quality that occurs when models are left to iterate without oversight.
4. State Management: The "Slot Machine" Paradigm
Perhaps the most radical technical takeaway is how these teams handle model drift. In standard LLM interactions, users often attempt to "correct" a model after it has made an error, leading to a compounding of errors and a loss of instructional integrity.
Anthropic’s data science and engineering teams treat Claude Code like a slot machine:
- Execute: Let the agent run for a set duration (e.g., 30 minutes).
- Evaluate: Check the output against the desired state.
- Reset or Accept: If the result is successful, commit it. If the model has drifted off course, do not attempt to "fix" the current session. Instead, use the
rewindflag or start a completely fresh session from a known good checkpoint.
The empirical evidence suggests that restarting with a clean state and re-running the task has a significantly higher success rate than attempting to rescue a corrupted context window. This approach treats LLM execution as a stochastic process where state management is more important than error correction.
Conclusion
Building effective workflows with Claude Code requires moving beyond the "chat" mindset. By focusing on structured context injection, modular skill architecture, sub-agent decomposition, and aggressive state resets, you can build agentic systems that are not only powerful but also highly predictable and scalable across non-technical domains.