This prompt is designed for a specific moment in a human-in-the-loop agent system: an operator has reviewed the agent's proposed next step or current trajectory and decided to intervene. The intervention might be a rejection of a planned step, a modification of a sub-goal, or a complete redirection of the workflow. The core job-to-be-done is to translate this human judgment into a surgical plan patch that applies the override without forcing the agent to discard all prior progress. The ideal user is a developer or AI engineer building the agent runtime's override handler, where the system must accept an operator's natural language command and produce a structured, machine-readable plan update.
Prompt
Agent Plan Patching Prompt for Human Override

When to Use This Prompt
Defines the precise job-to-be-done for the human override plan patching prompt, its ideal user, required context, and clear boundaries for when it should not be used.
To use this prompt effectively, you must provide it with the current plan state, including completed steps, in-progress steps, and their dependency graph. You also need the operator's override instruction and a clear output schema for the patch. The prompt's value is in its ability to preserve unaffected work and generate a minimal diff. Do not use this prompt for fully autonomous replanning triggered by tool failures, unexpected outputs, or new evidence; those scenarios have dedicated sibling prompts (e.g., 'Agent Plan Patching Prompt for Tool Failure') with different evaluation criteria and failure modes. Using this prompt for autonomous error recovery will produce patches that incorrectly treat a system error as a human strategic decision, missing the required diagnostic and fallback logic.
Before wiring this into your application, ensure your harness can validate the patch's scope. A common failure mode is an override that implicitly invalidates a completed step's output without the patch explicitly marking it for re-evaluation. Your implementation should check that the patch's affected_steps list includes all downstream dependencies of the overridden step. If the operator's instruction is ambiguous, the system should request clarification rather than guess, as a misapplied patch in a high-risk workflow can corrupt state silently. The next section provides the copy-ready prompt template you will integrate into this handler.
Use Case Fit
Where the Agent Plan Patching Prompt for Human Override works well and where it introduces risk. Use these cards to decide if this prompt fits your operator workflow before wiring it into a production agent harness.
Good Fit: Supervised Autonomy with Human Operators
Use when: A human operator reviews agent plans and issues specific overrides—rejecting a step, modifying a goal, or redirecting execution—and the system must produce a coherent patch that respects the override without discarding valid completed work. Guardrail: Scope the override input to a single, well-formed directive per patch request. Multiple simultaneous overrides increase the risk of conflicting patches and should be sequenced.
Bad Fit: Fully Autonomous Agent Loops
Avoid when: The agent runtime has no human review step and must self-correct without operator input. This prompt assumes an external override signal; using it in a fully autonomous loop without a human trigger will produce patches based on synthetic or stale override data. Guardrail: Pair this prompt with a human-in-the-loop gating mechanism. For autonomous replanning, use the sibling Agent Replanning Decision Prompt instead.
Required Inputs: Override Directive and Current Plan State
Risk: The prompt cannot produce a safe patch without knowing exactly what the operator changed and what the agent has already completed. Missing state leads to patches that re-execute finished steps or skip dependencies. Guardrail: Always provide a structured current plan snapshot including step statuses, completed outputs, and dependency edges. Validate that the override directive references specific plan elements rather than vague instructions.
Operational Risk: Downstream Impact Blind Spots
Risk: A human override on one step can invalidate assumptions that downstream steps depend on, but the operator may not see those dependencies. The patch might preserve downstream steps that are now unsound. Guardrail: Include a downstream impact analysis step in the harness that flags all steps affected by the override before the patch is applied. Require operator confirmation when the impact radius exceeds a configurable threshold.
Operational Risk: Audit Trail Gaps
Risk: In regulated or compliance-sensitive workflows, overriding a plan step without preserving the original plan, the override rationale, and the resulting patch creates an audit gap that reviewers cannot reconstruct. Guardrail: Log the pre-override plan, the operator's override directive, the generated patch, and the operator's approval of the patch as an atomic audit event. Never overwrite the original plan record.
Operational Risk: Override Scope Creep
Risk: An operator override intended to fix one step may inadvertently alter the goal, constraints, or resource assumptions of the entire plan if the patching prompt interprets the override too broadly. Guardrail: Constrain the patch generation to the minimum plan segment affected by the override. Use explicit scope boundaries in the prompt template and validate that untouched plan segments remain byte-identical after patching.
Copy-Ready Prompt Template
A copy-ready prompt for generating a plan patch that respects a human override while preserving completed work and minimizing downstream rework.
This template is designed to be pasted directly into your agent runtime when a human operator has rejected a step, modified a goal, or redirected execution. It instructs the model to produce a surgical plan patch—not a full replan—that respects the override, preserves completed and in-progress work, and identifies which downstream steps are impacted. The prompt expects structured context about the current plan state, the override details, and the execution history so the model can reason about minimal changes rather than starting from scratch.
textYou are an agent plan patching module operating in a human-in-the-loop system. Your task is to generate a minimal plan patch that incorporates a human override while preserving completed work and minimizing unnecessary re-execution. ## CURRENT PLAN STATE [ORIGINAL_PLAN] ## EXECUTION HISTORY [COMPLETED_STEPS] [IN_PROGRESS_STEPS] [PENDING_STEPS] ## HUMAN OVERRIDE Override Type: [OVERRIDE_TYPE] # One of: STEP_REJECTION, GOAL_MODIFICATION, REDIRECTION, CONSTRAINT_CHANGE Override Details: [OVERRIDE_DETAILS] Operator Notes: [OPERATOR_NOTES] ## PATCHING CONSTRAINTS - Preserve all completed steps unless the override explicitly invalidates their outputs. - For in-progress steps, determine whether they can complete safely or must be interrupted. - Identify downstream steps that depend on overridden or modified outputs. - Minimize rework: only mark steps for re-execution if their inputs or assumptions have changed. - Do not alter steps that are independent of the override. ## OUTPUT SCHEMA Return a JSON object with this structure: { "patch_id": "string", "override_summary": "One-sentence summary of what the human changed", "impact_assessment": { "invalidated_completed_steps": ["step_ids"], "interrupted_in_progress_steps": ["step_ids"], "affected_pending_steps": ["step_ids"], "unaffected_steps": ["step_ids"], "estimated_rewind_cost": "description of lost work if any" }, "patch_operations": [ { "operation": "RETAIN | MODIFY | DELETE | INSERT | REORDER", "target_step_id": "string or null for INSERT", "new_step_definition": "full step spec if MODIFY or INSERT, otherwise null", "reason": "Why this operation is necessary" } ], "revised_plan": ["ordered list of step_ids after patching"], "requires_human_review": true or false, "review_rationale": "Explain why human review is or is not needed before resuming execution" } ## ADDITIONAL CONTEXT [TOOL_CATALOG] [CONSTRAINT_POLICIES] [RISK_LEVEL] Generate only the JSON patch object. Do not include explanatory text outside the JSON.
Adaptation notes: Replace [ORIGINAL_PLAN] with the full plan structure including step IDs, descriptions, dependencies, and expected outputs. [COMPLETED_STEPS] and [IN_PROGRESS_STEPS] should include step IDs, actual outputs, and any side effects observed. For [OVERRIDE_TYPE], constrain to the four enumerated values to prevent the model from inventing override categories. The [TOOL_CATALOG] should list available tools with their schemas so the model can validate that modified or inserted steps reference valid tools. In high-risk domains, set [RISK_LEVEL] to high and ensure the requires_human_review field is evaluated against your organization's approval policy before resuming execution. Always validate the returned JSON against the schema before applying the patch to your plan state.
Prompt Variables
Every placeholder required by the Agent Plan Patching Prompt for Human Override. Use these to populate the prompt template, validate inputs before execution, and ensure the override is scoped correctly.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[CURRENT_PLAN] | The full execution plan state before the override, including completed, in-progress, and pending steps with their statuses and dependencies. | {"plan_id": "exec-42", "steps": [{"id": "1", "status": "completed", "summary": "Fetch user profile"}, {"id": "2", "status": "in_progress", "summary": "Generate report", "depends_on": ["1"]}]} | Must be valid JSON. Check that step IDs are unique, status values are from allowed enum (completed, in_progress, pending, failed), and dependency references resolve to existing step IDs. |
[OVERRIDE_INSTRUCTION] | The human operator's explicit directive describing what to change, reject, or redirect. This is the raw override input. | Reject step 3 and instead generate a summary limited to Q3 data only. Mark the Q4 analysis as out of scope. | Must be non-empty string. Check for ambiguous directives (e.g., 'fix it') and flag for clarification if no specific step or outcome is referenced. Log the raw instruction for audit trail. |
[OVERRIDE_SOURCE] | Identifier for the human operator or system that issued the override, used for audit trail and authorization checks. | operator:alice.chen@company.com | Must match authorized operator registry if role-based access control is enforced. Validate format (e.g., email, user ID). Reject if source is null or anonymous in audited workflows. |
[OVERRIDE_TIMESTAMP] | ISO 8601 timestamp when the override was issued, used to correlate with plan state and detect stale overrides. | 2025-01-15T14:32:00Z | Must parse as valid ISO 8601 datetime. Compare against [CURRENT_PLAN] last_updated timestamp; warn if override is older than plan state (possible race condition). |
[COMPLETED_WORK] | Explicit list of completed step IDs and their outputs that must be preserved in the patched plan. Prevents the patch from undoing finished work. | ["1", "2"] | Must be array of step IDs present in [CURRENT_PLAN] with status 'completed'. Validate each ID exists and status matches. If empty, confirm override intent to allow full replan. |
[CONSTRAINTS] | Boundary conditions the patch must respect: budget, time, tool availability, permission scope, and policy limits. | {"max_additional_steps": 3, "deadline": "2025-01-15T16:00:00Z", "allowed_tools": ["report_generator", "data_fetcher"]} | Must be valid JSON object. Validate that allowed_tools intersect with tools referenced in [CURRENT_PLAN]. Check deadline feasibility against estimated step durations. Flag if constraints conflict with [OVERRIDE_INSTRUCTION]. |
[AUDIT_LOG_REQUIREMENTS] | Specification for what must be recorded in the audit trail: reason for override, scope of change, downstream impacts, and approval chain. | {"log_reason": true, "log_impacted_steps": true, "require_approval": true, "approval_threshold": "any_step_change"} | Must be valid JSON. Validate that require_approval is true for high-risk domains. Check that log_reason and log_impacted_steps are not false in regulated workflows. Reject if approval_threshold is missing when require_approval is true. |
[DOWNSTREAM_IMPACT_RADIUS] | The maximum number of downstream steps the patch is allowed to modify. Constrains the blast radius of the override. | 3 | Must be positive integer or 'unlimited'. If integer, validate that patched plan does not modify more than this many steps beyond the directly overridden step. Compare against dependency graph depth from override point. |
Implementation Harness Notes
How to wire the Agent Plan Patching Prompt for Human Override into an agent runtime with validation, retry, logging, and human-review gates.
This prompt is designed to sit inside a human-in-the-loop (HITL) approval gateway within an agent execution loop. When a human operator rejects a step, modifies a goal, or redirects execution via a review interface, the runtime captures the override instruction, the current plan state, and the execution history, then calls this prompt to generate a minimal, safe patch. The prompt is not a standalone chatbot interaction; it is a structured API call within a stateful agent harness. The harness is responsible for providing accurate [CURRENT_PLAN], [COMPLETED_STEPS], [OVERRIDE_INSTRUCTION], and [CONSTRAINTS] context. Without this harness, the model cannot reliably preserve completed work or calculate downstream impact.
Wiring the prompt into an agent runtime requires a pre-call validation layer and a post-call execution gate. Before calling the model, the harness must validate that the [OVERRIDE_INSTRUCTION] is non-empty, that the [CURRENT_PLAN] is structurally valid (e.g., a list of steps with IDs and statuses), and that the [COMPLETED_STEPS] list is consistent with the plan's recorded state. After receiving the model's output, the harness must parse the proposed plan patch—typically a JSON object containing patch_type, affected_step_ids, new_steps, removed_step_ids, and impact_analysis—and run a series of deterministic checks before applying it. These checks include: verifying that no completed step is modified or removed unless explicitly flagged for rollback; confirming that all new or modified steps reference valid tool schemas from [AVAILABLE_TOOLS]; and ensuring the patch does not introduce circular dependencies. If any check fails, the harness should log the failure, surface the conflict to the operator, and request clarification rather than silently applying a broken patch.
Retry and fallback logic must be designed for the specific failure modes of this prompt. Common failures include: the model proposing a patch that deletes a completed step without a rollback plan; generating a step that uses a tool not present in [AVAILABLE_TOOLS]; or producing a patch that is syntactically valid but semantically empty (e.g., no steps changed). The harness should implement a retry loop with a maximum of 2-3 attempts, each time appending the specific validation error to the prompt context as a [PREVIOUS_PATCH_ERROR]. If retries are exhausted, the harness must escalate to a human operator with the full plan context and the failed patch attempts, never falling back to autonomous application of a rejected patch. Logging and audit trail preservation are critical: every override event, the generated patch, validation results, and the final applied (or rejected) patch must be written to an append-only audit log with timestamps and operator identity. This log serves as the evidence trail for compliance reviews and debugging.
Model choice and tool integration affect how this prompt is deployed. The prompt requires strong instruction-following and structured output capabilities; models like Claude 3.5 Sonnet, GPT-4o, or Gemini 1.5 Pro are appropriate. The harness should call the model with response_format set to a JSON schema that matches the expected patch structure, reducing the need for repair prompts. The prompt's [AVAILABLE_TOOLS] placeholder should be populated from the agent's live tool registry, not a static list, to prevent the model from suggesting unavailable tools. If the agent runtime uses a tool-calling API (e.g., OpenAI function calling), the harness should map the model's textual tool references to actual function signatures before execution. Human-review gates are the final safety layer: for high-risk overrides—such as those modifying steps that involve write operations, financial transactions, or data deletion—the harness should require explicit operator confirmation of the patched plan before resuming execution, even if all automated validation checks pass.
Expected Output Contract
Fields, data types, and validation rules for the plan patch object generated by the Agent Plan Patching Prompt for Human Override. Use this contract to validate the model's output before applying it to the agent's execution state.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
patch_id | string (UUID v4) | Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ | |
override_source | object | Must contain 'operator_id' (string), 'timestamp' (ISO 8601), and 'reason' (string). 'reason' must be non-empty and match one of the override categories defined in the system prompt. | |
original_plan_snapshot | object | Must include 'plan_id' (string), 'version' (integer), and 'steps' (array of step objects with 'step_id', 'status', 'description'). 'status' values must be from enum: ['completed', 'in_progress', 'pending', 'blocked']. | |
patch_operations | array | Must contain 1-20 operation objects. Each operation must have 'op' (enum: ['replace', 'remove', 'add', 'reorder']), 'target_step_id' (string matching an existing step_id or null for 'add'), and 'payload' (object with step definition for 'add'/'replace', null for 'remove'). | |
downstream_impact | array | Must list all step_ids affected by the patch beyond the directly targeted steps. Each entry must have 'step_id' (string), 'impact_type' (enum: ['input_changed', 'dependency_broken', 'obsolete', 'reordered']), and 'mitigation' (string describing how the patch handles the impact). | |
completed_work_preservation | array | Must enumerate all step_ids marked 'completed' in original_plan_snapshot. Each entry must have 'step_id' (string), 'preserved' (boolean), and 'preservation_note' (string). If 'preserved' is false, 'preservation_note' must explain why rework is unavoidable. | |
audit_trail_entry | object | Must contain 'patch_reason_summary' (string, max 500 chars), 'operator_override_text' (string, the raw override input), and 'approval_flag' (boolean). If 'approval_flag' is true, execution must halt until a separate approval signal is received. | |
patch_confidence | number | If present, must be a float between 0.0 and 1.0. Values below 0.7 should trigger a human review flag in the harness regardless of approval_flag. |
Common Failure Modes
When an operator overrides an agent's plan, the patch prompt must respect the human decision without corrupting completed work or creating downstream contradictions. These are the most common production failure modes and how to guard against them.
Override Scope Creep
What to watch: The patch prompt applies the human override too broadly, invalidating completed steps that were not in scope of the operator's intent. This causes unnecessary rework and erodes trust in the override mechanism. Guardrail: Constrain the patch to only the explicitly overridden step and its direct dependents. Include a scope boundary check in the prompt that lists what must remain untouched.
Silent Dependency Breakage
What to watch: The patched plan reorders or removes a step that a downstream completed step depends on, creating an inconsistent state where later steps reference outputs that no longer exist. Guardrail: Require the prompt to perform a dependency graph walk before finalizing the patch. Output an explicit dependency impact report listing every downstream step affected and whether it requires re-execution.
Audit Trail Corruption
What to watch: The patch overwrites or discards the original plan, the override reason, or the operator's identity, making it impossible to reconstruct what happened and why for compliance review. Guardrail: The prompt must produce a patch that appends to the plan history rather than replacing it. Include an audit record with timestamp, operator ID, override reason, and a diff of plan changes.
Override Rejection Through Drift
What to watch: The prompt technically accepts the override but subtly reinterprets or dilutes it across subsequent steps, effectively reverting to the original plan behavior over time. Guardrail: Add a post-patch consistency check that compares the final patched plan against the operator's stated intent. Flag any step that contradicts or weakens the override for human review before execution resumes.
Partial Completion State Loss
What to watch: The patch resets or discards partially completed work from the overridden step, losing side effects that were already applied and cannot be safely repeated. Guardrail: The prompt must inventory the current state of the overridden step before generating the patch. Distinguish between committed side effects, in-flight operations, and unapplied changes. Only roll back what is safe to undo.
Operator Intent Misalignment
What to watch: The prompt misinterprets ambiguous override language from the operator, producing a patch that is syntactically valid but semantically wrong. This is especially dangerous when the operator uses shorthand or domain jargon. Guardrail: Include a clarification step in the prompt that restates the operator's intent in structured form before generating the patch. If ambiguity is detected, request confirmation rather than guessing.
Evaluation Rubric
Criteria for testing the Agent Plan Patching Prompt for Human Override before production deployment. Each row defines a pass standard, a failure signal, and a concrete test method to validate the prompt's behavior under override scenarios.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Override Fidelity | The generated patch strictly respects the human operator's override instruction without reinterpreting, softening, or extending its scope. | The patch modifies steps unrelated to the override, adds unsolicited optimizations, or ignores explicit constraints in the override. | Run 10 override scenarios with varying specificity. Assert that the patch diff only touches steps within the override's stated scope and preserves all other plan elements unchanged. |
Completed Work Preservation | All steps marked as completed in the input plan state remain untouched in the generated patch. No re-execution, modification, or invalidation of completed work occurs. | The patch suggests re-running, altering, or discarding a completed step. A completed step's output is overwritten or marked as stale without explicit operator instruction. | Provide plans with 3-5 completed steps and an override targeting a pending step. Validate that completed step IDs, statuses, and outputs are identical in the output patch and input plan. |
Downstream Impact Analysis | The patch explicitly lists which downstream steps are affected by the override, why they are affected, and what change is applied to each. | The patch silently modifies downstream steps without explanation, misses a dependency that should be invalidated, or leaves orphaned steps that depend on overridden output. | Use a plan with a known dependency chain. Override a mid-chain step. Assert the output contains an impact section enumerating every dependent step and the reason for its inclusion. |
Rework Minimization | The patch modifies only the minimum set of steps required to satisfy the override. Unaffected parallel branches and independent steps remain scheduled as-is. | The patch reorders, reschedules, or re-validates steps that have no dependency on the overridden step. The plan diff is larger than the dependency graph requires. | Compare the set of modified step IDs against the transitive dependency closure of the overridden step. Assert zero modifications outside that closure. |
Audit Trail Preservation | The generated patch includes a structured audit record: the original step state, the override instruction, the rationale for each change, and a before/after diff. | The patch provides only the new plan without traceability to the original. The audit record is missing fields, contains placeholder text, or omits the operator's raw override input. | Parse the output for an audit or changelog section. Assert it contains the original step ID, the override text verbatim, a human-readable rationale per changed step, and a machine-readable diff. |
Schema Compliance | The output strictly conforms to the expected plan patch schema: all required fields present, no extra fields, correct types, and valid enum values for step statuses. | The output is missing required fields like patch_id or timestamp. Step statuses use undefined values. The diff format does not match the specified patch schema. | Validate the output against the JSON Schema definition for the plan patch contract. Assert no schema violations. Run with 5 different valid input plans to confirm consistency. |
Conflict Detection | When the human override contradicts a prior completed step or an in-progress step's output, the patch flags the conflict explicitly and requests clarification instead of silently resolving it. | The patch silently picks one version, overwrites completed work without warning, or ignores the contradiction and produces an internally inconsistent plan. | Provide an override that directly contradicts a completed step's output. Assert the output contains a conflict flag, describes the contradiction, and does not modify the completed step. |
Idempotency Check | Applying the same override to the same plan state twice produces identical patches. The patch generation is deterministic given fixed inputs. | Repeated generation produces different step orderings, varying rationale text, or inconsistent impact analysis for the same override and plan state. | Run the same override and plan state through the prompt 3 times with temperature=0. Assert the patch diff, affected step list, and audit record are byte-identical across runs. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Add strict output schema validation, retry logic for malformed patches, and structured logging of every override event. Implement a downstream impact analyzer that checks whether patched steps invalidate any completed work. Wire the prompt into a human-in-the-loop queue where the patch is previewed before execution.
code[OVERRIDE_INSTRUCTION]: Operator [USER_ID] rejected step [STEP_ID] at [TIMESTAMP]. Override type: [REJECT | MODIFY | REDIRECT]. Details: [OVERRIDE_DETAILS] [PLAN_STATE]: [FULL_PLAN_WITH_DEPENDENCIES] [COMPLETED_STEPS]: [COMPLETED_STEPS_WITH_OUTPUTS] [AUDIT_TRAIL]: [PRIOR_OVERRIDE_EVENTS] Generate a plan patch that: 1. Respects the override scope exactly 2. Preserves all completed work unless directly invalidated 3. Flags any downstream steps that need re-validation 4. Produces an audit entry explaining the change
Watch for
- Silent format drift in patch JSON across model versions
- Patches that modify steps outside the override scope
- Missing audit trail entries when overrides chain

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us