Artificial Quirks
← all posts
Conceptual illustration of trajectory repairConceptual illustration of trajectory repair

Imagine an AI agent has just spent 15 minutes and thousands of tokens diligently analyzing a codebase and writing a complex plan. At the very last step, it fails a quality check. Throwing away all that work and starting over from scratch isn’t just frustrating—it’s incredibly expensive.

In this article, we demonstrate Targeted Trajectory Repair, a surgical approach to fixing AI mistakes. Using our orchestration framework, we show how to create lightweight ‘child’ runs that pick up exactly where the AI failed, fixing the specific error while saving massive amounts of computing power and time.


Provenance-Linked Child Continuations#

Instead of resetting execution state, our orchestration framework creates a lightweight child run that clones the parent’s SQLite database trajectory, active workspace state, and turn message history.

Continuation Tree

CLI Entrypoint & Kernel Mechanics#

The CLI command orchestrator run repair-grounding <run_id> evaluates the source run’s unverified path claims and injects a precise repair prompt into the child trajectory:

# orbit_harness/orchestration/commands.py
def repair_grounding(self, source_run_id: str) -> CommandResult:
    run_dir = self.repo_root / ".orchestrator" / "runs" / source_run_id / "agent-output"
    summary = result_data.get("summary", "")
    grounding = check_grounding(summary, self.repo_root)

    if not grounding.unverified:
        return CommandResult(success=True, message="No grounding repair needed.", data={"repaired": False})

    unverified_str = ", ".join(grounding.unverified[:5])
    repair_instruction = (
        f"Grounding Repair Mode: Your prior plan cited {len(grounding.unverified)} unverified file path(s): "
        f"{unverified_str}. Execute view_file() or grep_search() to inspect these files immediately."
    )
    return self.continue_failed_plan(source_run_id, instruction=repair_instruction)
python

Quantitative Efficiency Comparison#

We benchmarked full trajectory reruns against targeted child continuations on grounding repair scenarios.

Execution StrategyTurns ExecutedTokens BurnedLatency (s)Grounding Pass RateCost Reduction
Full Trajectory Rerun1544,080222.8s100%0% (Baseline)
Targeted Child Continuation24,20018.4s100%90.5%

Result: Targeted child continuations achieved identical 100% plan grounding pass rates while reducing token burn by 90.5% and reducing repair latency from 222s to 18s.


Key Takeaways#

  1. Clone Trajectories, Don’t Rerun: Inheriting parent message history preserves contextual state without re-executing search steps.
  2. Inject Explicit Targeted Prompts: Specifying the exact unverified file paths in the continuation prompt focuses model attention immediately on missing evidence.
  3. 90%+ Cost Reduction: Child continuations dramatically reduce evaluation costs across large agent benchmark suites.
Targeted Trajectory Repair: Low-Cost Continuations
https://astro-pure.js.org/blog/targeted-trajectory-repair-continuations
Author Artificial Quirks
Published at April 22, 2026
Previous

Benchmarking Agent Systems Beyond Did It Finish?

Next

Token Efficiency: Code Fences vs Large Contexts