Replanning AI Agents Without Starting Over

November 24, 2026 | 13 minutes

An agent can correctly understand that the user changed their mind and still keep executing work that no longer makes sense. In Conversation History Is Not State: Designing Agents for Evolving User Intent, I explored one part of this problem: representing intent as explicit application state. The idea behind evolving intent is that an LLM interprets what changed, a deterministic reducer updates the current intent, and a state machine controls how the agent responds. The approach gives the agent a current account of what the user wants, but it still has to reconcile that account with work already underway.

For example, suppose an agent is implementing authentication. It's built the login UI, generated a database migration, and drafted the authentication handlers, while a worker is still refining the persistence adapter. Then the user says:

Actually, this repo should use Drizzle, not Prisma.

The agent can update its constraints and transition back to planning, but that doesn't tell it what to do with the existing work. The migration was generated for Prisma, so it needs to be replaced. The UI might still be useful, and the handlers might work with a different adapter. Restarting everything would discard those possibilities, while continuing the existing plan would preserve an assumption the user just corrected. To handle this, the planning step needs to answer a more specific question: when intent changes, how much of the existing plan should survive?

Map the Dependencies Between Tasks

To answer that, we need to know what each task depends on. A task graph gives us a way to record those relationships and follow them when an input changes. Hanako’s post about agent loops and graphs describes how a loop produces, checks, and corrects an individual unit of work, while a graph organizes the relationships between units. That division fits this problem: a worker can refine an adapter within its own loop, while the graph lets the coordinator determine which other tasks depend on that adapter.

Explicit intent state supplies another part of that picture by recording the requirements those tasks are meant to satisfy. Related research, including Intent-Driven Situation Tracking for User-Centric Multi-Turn Agents, maintains state alongside the dialogue to track user intents, constraints, execution status, and facts with provenance. It uses that information to update which actions can proceed as the situation changes. Building on these established ideas about state tracking and selective repair, I want to work through how an agent could respond to the ORM correction without losing valid work or accepting an outdated result.

For the authentication example, we can start by establishing the contract between the login UI and the server, along with the persistence interface the handlers will use. Once those contracts exist, some implementation work can proceed independently, while validation still depends on the pieces working together. The graph makes those relationships explicit:

Arrows point from an input or task output to the work that depends on it. The dashed arrow marks the adapter's role in validating the handlers: the handlers can be drafted against the persistence interface before the adapter is ready, but they still need to be checked against its implementation.

The UI's independence depends on the contract staying stable and the implementation avoiding ORM-specific types. If the UI imports a type generated by Prisma, that dependency belongs in the graph too. Recording these relationships gives us information a numbered checklist doesn't provide: why a task needs another task's output, and which results become questionable when that output changes.

This graph can be ordinary data managed by the state machine from the previous post. The state machine still controls transitions between resolving intent, planning, executing, and waiting for approval. Within that lifecycle, the graph describes the work being managed and the dependencies the planner needs to inspect. We don't need a second orchestration framework just to keep track of those relationships.

Turn an Intent Change into a Reconciliation Plan

With that representation in place, we can trace the effect of the ORM correction. The persistence adapter and generated migration read the ORM constraint directly, so both are affected. Following their dependencies brings the handlers and integration tests into consideration as well, while the UI may remain valid under the unchanged HTTP contract. This gives us two stages of impact analysis: find tasks that read the changed intent fields, then follow the graph to find work that may have consumed affected results.

Being affected doesn't always mean needing to be rewritten, though. If the new adapter preserves the persistence interface and its required behavior, the handler implementation may still work. So, I would start by marking dependent work for validation and reuse it only when there is evidence that its inputs and contracts remain compatible. That extends the original post's shouldReplan decision into a reconciliation plan with specific actions:

1type ReconciliationPlan = {
2  keep: string[]; // taskIds
3  revalidate: string[]; // taskIds
4  replace: string[]; // taskIds
5  cancelAttempts: string[]; // executions that should stop
6};

The first three categories contain task IDs, while cancelAttempts identifies executions that should stop. Separating tasks from attempts lets us express both decisions for the same piece of work: the persistence task needs a replacement result, and the worker producing its current result needs to be canceled. Once the dependencies and policies are known, deterministic application code can make these decisions and enforce which results are eligible for reuse. A model may still help propose the revised implementation plan.

Reconcile the Authentication Plan Step by Step

For a concrete example, let's follow an illustrative run at intent revision 7. The authentication contract includes an ORM-independent persistence interface, and the login UI uses only the HTTP contract. The handler draft passes unit tests against a stub, but hasn't been validated against a Drizzle adapter. The Prisma migration has been generated but hasn't been applied. Under those assumptions, the correction produces these decisions:

TaskState when the correction arrivesDecision
Authentication contractComplete; no Prisma-specific typesKeep
Login UIComplete; consumes the unchanged HTTP contractKeep
Persistence adapterPrisma draft exists; attempt adapter-7b is refining itReplace the draft and cancel the attempt
Database migrationPrisma migration generated, not appliedReplace
Authentication handlersDraft complete; compatibility with the new adapter is unverifiedRevalidate
Integration testsScheduled against the Prisma artifacts, not startedReplace the scheduled run

After the intent reducer records Drizzle at revision 8, we can represent those decisions as:

1const reconciliation: ReconciliationPlan = {
2  keep: ["auth_contract", "login_ui"],
3  revalidate: ["auth_handlers"],
4  replace: ["persistence_adapter", "database_migration", "integration_tests"],
5  cancelAttempts: ["adapter-7b"],
6};

These actions apply to the work scheduled or produced by each task. Replacing the integration-test run means scheduling it against the new artifacts; the test suite itself may remain unchanged. Keeping the UI preserves its implementation, but the UI still participates in the final integration tests. With those distinctions in place, the runtime can carry out the reconciliation:

  1. Record revision 8 and make adapter-7b ineligible to commit as part of the same coordinated update, then request cancellation.
  2. Preserve the contract and UI artifacts, and remove the old adapter draft and migration from the active plan while retaining their provenance.
  3. Generate a Drizzle adapter and migration against the same persistence interface and target schema.
  4. Validate the existing handler draft against the new adapter. If it passes, keep it. If it fails because it relied on Prisma-specific behavior, revise it and record that dependency.
  5. Run integration tests with the retained UI, validated handlers, new adapter, and a test database prepared with the new migration.

Suppose adapter-7b returns its Prisma implementation between steps 3 and 4. Even if its own tests pass, the runtime rejects it because the attempt is no longer eligible and its ORM input is stale. That allows the new plan to proceed with the retained UI and revalidated handlers without the late result replacing the Drizzle artifact.

Track the Inputs Behind Each Result

Making those decisions requires more information than the earlier example's completedGoals array provides. An entry such as "create_database_migration" tells us that work finished, but doesn't identify the ORM and schema it used or whether the migration was merely generated or already applied. Completion records what happened. To decide whether that work is reusable now, we also need to know the conditions under which it was produced.

Each result therefore needs provenance that connects it to its task, attempt, relevant intent inputs, and upstream artifacts. A small conceptual record could look like this:

1type TaskResult = {
2  taskId: string;
3  attemptId: string;
4  intentRevision: number;
5  inputFingerprint: string; // hash of tasks's relevant inputs + versions of upstream artifacts that went into it
6  artifactId: string;
7};

The intent revision gives the runtime an initial signal to check. A result arriving from revision 7 after the agent has moved to revision 8 may be outdated, but rejecting every older result would also discard independent work. The UI result in our example can remain valid because the ORM change didn't affect its inputs. Comparing those relevant inputs gives us a more selective basis for reuse than the revision number alone.

For that comparison, inputFingerprint should cover both the task's relevant inputs and the versions of upstream artifacts it consumed. Hashing the entire intent object would make every intent change invalidate every result, while hashing only direct intent fields would miss changes passed through another task's output. The fingerprint is useful only if we have identified the dependencies that belong in it.

Handle Missing Dependencies Conservatively

For a small system, I would start with task definitions owned by the application. The persistence task would declare that it reads constraints and the authentication contract, and the runtime would record the specific contract artifact supplied to each attempt. Tool and artifact access can provide additional evidence about what a worker consumed. If an LLM proposes new tasks or dependencies, the runtime would still need to validate those declarations before relying on them for reuse.

This becomes harder when a worker has access to more context than the runtime tracks. A worker given the entire repository might import a Prisma-generated type into the login component without that dependency appearing in its task definition. The graph would then suggest that the UI is unaffected even though its implementation depends on the old ORM. Observed reads help, but they only cover access the runtime can see; a missing edge doesn't establish that two tasks are independent.

The November 2026 preprint When Facts Change, Which Decisions Break? Dependency-Aware Context Graphs for Agents examines this limitation using dependencies extracted from agent read traces. In its controlled workflows, selective repair can reduce the work reviewed and estimated cost, but omitted dependencies and missing repair context can reduce correctness. It also distinguishes decisions that are potentially affected from those that actually need to change. Those results support looking at dependency quality alongside reuse, although they don't establish the same trade-offs across arbitrary tasks.

In our design, incomplete dependency information would cause the runtime to widen validation. If we can't establish that the UI is independent, it moves from keep to revalidate. If validation can't establish compatibility either, the affected work needs to be regenerated under the current inputs. That can mean rebuilding a larger part of the plan than we hoped, which increases tokens and latency, but the decision to preserve work needs evidence behind it.

Reject Stale Results When Workers Finish

Dependency information also helps with the other condition in our example: work that is still running when intent changes. Requesting cancellation doesn't guarantee that a worker stops immediately, so the runtime needs to check results when they arrive. Before incorporating one, it should verify that the task still exists, the attempt remains eligible, and its inputs are valid. That acceptance check must be coordinated with intent updates so a result can't pass validation and then commit after its assumptions have changed.

The PIVOT project explores this boundary with a runtime that tracks constraint reads, preserves unaffected work, and rejects stale results at commit time. It's a hackathon implementation with deterministic providers, which makes it a related implementation to examine rather than evidence that the broader problem is solved. Its treatment of late results is relevant here, though, because cancellation alone would not prevent the Prisma worker from returning after revision 8 has begun.

For a coding agent, enforcing acceptance is easier when workers produce isolated patches or workspaces for a coordinator to incorporate. If they modify shared files directly, an outdated worker may already have changed the repository by the time the coordinator rejects its result. The same limitation applies to external effects: rejecting a generated migration can keep it out of the current plan, but rejecting the result of an already-applied migration doesn't undo the database change. Those effects need their own recovery policy.

Evaluate How the Agent Responds to Changes

Once the revised plan is running, the runtime also needs to distinguish a failed implementation from another change in requirements. If a handler returns the wrong status code, a failed test can guide another attempt under the current requirements. If the user switches from passwords to magic links, retrying the password handler would keep improving work the user no longer wants. Both events may interrupt execution, but only the latter requires reconsidering the requirements and the tasks that depend on them. Retries should also have a budget, since repeated failures may point to a faulty plan, a broken check, or an unavailable dependency instead of an implementation that just needs another attempt.

These distinctions give us a way to evaluate the architecture beyond checking the final repository. I would extend the evolving-intent tests from the previous post with corrections that arrive at specific points during execution, then inspect the trace to see how the runtime responded:

  • Did an unrelated task get restarted?
  • Was a dependent result reused after its inputs changed?
  • Did an intentionally omitted dependency cause invalid work to be preserved?
  • Did a canceled worker's late result enter the current plan?
  • Did the system distinguish a failed check from a revised requirement?
  • Was approval still attached to the exact artifact and scope being acted on?

The approval check follows from the same reasoning as result reuse. If the user approved one artifact and reconciliation replaces it, the runtime needs to determine whether the replacement is still covered by that approval before acting. A record that approval happened is incomplete without the artifact and scope it applied to.

The authentication example brings these pieces together. Explicit intent state records the switch to Drizzle, the task graph identifies the work that depends on the ORM, and result provenance helps the runtime decide what can be preserved. Acceptance checks then keep the old Prisma attempt from re-entering the plan. Making those dependencies and decisions explicit is the next step I would take with the evolving intent example: give the agent enough information to revise its work as carefully as it revises its understanding of the request.

Related Posts