

Targeted Trajectory Repair: Low-Cost Continuations
How child runs inherit parent trajectory history to perform targeted grounding repairs at a 90% reduction in compute costs.
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.
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)pythonQuantitative Efficiency Comparison#
We benchmarked full trajectory reruns against targeted child continuations on grounding repair scenarios.
| Execution Strategy | Turns Executed | Tokens Burned | Latency (s) | Grounding Pass Rate | Cost Reduction |
|---|---|---|---|---|---|
| Full Trajectory Rerun | 15 | 44,080 | 222.8s | 100% | 0% (Baseline) |
| Targeted Child Continuation | 2 | 4,200 | 18.4s | 100% | 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#
- Clone Trajectories, Don’t Rerun: Inheriting parent message history preserves contextual state without re-executing search steps.
- Inject Explicit Targeted Prompts: Specifying the exact unverified file paths in the continuation prompt focuses model attention immediately on missing evidence.
- 90%+ Cost Reduction: Child continuations dramatically reduce evaluation costs across large agent benchmark suites.