Agent System Design: A Three-Dimensional Framework for Prompt, Context, and Harness Engineering
This article breaks down agent capability gains into three engineering dimensions: Prompt Engineering, Context Engineering, and Harness Engineering. It explains how runtime prompt assembly, context budgeting, layered memory, progressive capability disclosure, and least-privilege tool execution work together, and offers practical patterns, code snippets, and rollout advice for building controllable agent systems.
1. Introduction: The “Integration Leap” in Agent Capabilities
Over the past two years, improvements in AI agent capabilities have rarely come from breakthroughs in a single algorithm. More often, they come from the systematic integration of engineering components. Dynamic prompt assembly, context compression and retrieval, layered memory management, modular capability reuse with progressive disclosure, pluggable hooks, guardrail-based safety constraints, and tool-calling abilities with steadily expanding permission boundaries are combined into a single runtime. The result is a system that shows noticeably stronger autonomy and task completion. This resembles the shape of several earlier technology curves: once key components accumulate to a certain level and the way they are combined changes, overall capability improves non-linearly.
It is worth emphasizing that this leap is not a proprietary trait of any single product, but the result of industry-wide co-evolution. For developers, the most valuable thing to retain is a transferable design methodology. This article organizes it into three dimensions: Prompt Engineering, Context Engineering, and Harness Engineering (also called scaffolding engineering), and provides practical engineering guidance for each.
2. The Prompt Dimension: From Static Templates to Runtime Assembly
2.1 A prompt is no longer a string, but a structured runtime object
The traditional approach treats a prompt as a fixed block of text, refined through manual trial and error. The engineering approach treats it as a layered, assembled object: the system layer describes the role and boundaries, the capability layer describes available tools and invocation constraints, the task layer describes the current objective, and the output layer constrains format and structure. Each layer is versioned independently and assembled at runtime according to the scenario.
[System] Role, scope of responsibility, refusal and escalation policy[Capability] Tool list, parameter constraints, permission scope[Task] Current objective, acceptance criteria, constraints[Format] Output structure, field definitions, failure behavior
2.2 Dynamic assembly and cache-friendly ordering
The key to dynamic assembly is a stable prefix and a variable suffix. Placing frequently changing items such as timestamps and conversation summaries at the end improves prefix cache hit rates and reduces latency and cost. Prompts should also carry version numbers and support canary rollouts, so that any change is traceable, comparable, and rollback-able.
2.3 Constraints must be verifiable
A statement like “please operate carefully” is not executable. A more reliable approach is to express constraints as checkable rules, for example parameter allowlists, numeric ranges, and categories of actions that require explicit confirmation, with validation performed both before and after execution. The prompt expresses intent; the code enforces boundaries. Neither can replace the other.
3. The Context Dimension: Managing Information Within a Limited Window
3.1 Context is a scarce resource that needs budgeted governance
The context window is limited and attention is unevenly distributed, so context should be managed like memory: set budget quotas, allocate separate limits for system constraints, retrieved snippets, historical summaries, and the current task, and evict by priority when the budget is exceeded.
3.2 Compression, retrieval, and layered memory
A common pattern is a three-tier structure: the short term keeps the most recent turns verbatim; the mid term compresses history into structured summaries that retain decisions, conclusions, and open items; the long term uses hybrid recall combining vector retrieval and keyword retrieval, injecting only relevant snippets into the current window. The compression process must preserve traceable references so that “summary drift” does not push later reasoning away from the facts.
def build_context(task, history, memory_store, budget=6000):parts = [system_prompt(), capability_block()]parts.append(retrieve(task, memory_store, limit=budget // 3))parts.append(summarize(history, keep=["decisions", "open_items"]))parts.append(task.render())return fit_budget(parts, budget) # Trim by priority when over budget
3.3 Write policy determines long-term quality
Memory writes require deduplication, conflict resolution, and freshness markers. When a new version of the same fact appears, it should overwrite the old value while keeping a change record. Uncertain information should be tagged with a confidence level so that incorrect conclusions are not repeatedly recalled and amplified.
4. The Harness Dimension: Expanding Capability in a Controlled Way
4.1 Harness engineering focuses on the “execution environment,” not wording
The harness is the scaffolding in which the agent runs: tool registration and discovery, execution sandboxes, hooks, guardrails, logging, and replay. It determines whether model capability can be safely converted into real actions. Differences in maturity usually show up at this layer rather than in the prompt text.
4.2 Progressive capability disclosure
Initially, expose only a small set of high-frequency capabilities with concise parameter descriptions, then load additional capability descriptions progressively as the task requires. This both reduces context usage and lowers the probability of incorrect tool calls. Capability descriptions should include applicable scenarios, prerequisites, and failure semantics.
4.3 Least privilege and device-side boundaries
When tool calls expand from cloud APIs to personal devices and local file systems, the risk level rises significantly. Key practices include: read-only by default, explicit authorization for writes, exclusion of sensitive directories, action tiering (auto-allowed / confirmation required / prohibited), full audit logging, and rollback-capable design.
tools:- name: file_readscope: read_onlyallow: ["./workspace"]- name: file_writescope: confirm_requireddeny: ["~/.ssh", "~/.config"]hooks:pre_exec: [policy_check, rate_limit]post_exec: [audit_log, redact_secrets]
4.4 Observability and replay
Every run should record the prompt version, recalled snippets, tool inputs, and result summaries to form a replayable trace. When an anomaly occurs, replay first to locate the cause, then decide whether to fix the prompt, the retrieval, or the policy, instead of blindly tuning parameters.
5. How the Three Dimensions Work Together, and Rollout Advice
The three dimensions have clear division of labor: the prompt expresses intent, the context determines what the model “sees,” and the harness determines what the model “can do and to what extent.” A weakness in any dimension becomes the system’s ceiling. A practical rollout proceeds in four steps: first establish a minimal closed loop with audit capability; then add context budgeting and retrieval tiering; then introduce progressive disclosure and action tiering; finally complete replay and an evaluation set, using a fixed task suite to regression-test every change.
For infrastructure such as compute, storage, logging, and monitoring, you can use a container platform to host the runtime, object storage to hold replay data, a message queue to decouple task scheduling, and logging plus monitoring and alerting services for observability, keeping attention focused on the agent logic itself. Overall, competitiveness in agent engineering has shifted from “whose wording is better” to “whose environment is more controllable, whose context is cleaner, and whose boundaries are clearer.”
