home / skills / bdambrosio / cognitive_workbench / nav-backtrack
This skill recovers to a recent safe navigation state by exploring nav history and executing atomic moves to a validated target.
npx playbooks add skill bdambrosio/cognitive_workbench --skill nav-backtrackReview the files below or copy the command above to add this skill to your agents.
---
name: nav-backtrack
type: python
description: "Attempt to return to a recently known safe navigation state using bounded local motion."
---
# nav-backtrack
Recovery tool that searches `world_state("nav")` history for a safe prior cell and attempts to reach it using atomic nav primitives.
## Input
- `max_targets`: Integer maximum number of safe targets to try (default: `3`)
## Output
Success (`status: "success"`):
- `value`: Summary text
- `extra.recovered_to`: `{x, y, z, yaw}` position recovered to
- `extra.method`: `"step"` | `"climb"` | `"descend"`
- `extra.yaw`: Final yaw
Failure (`status: "failed"`):
- `reason`: One of `"NO_HISTORY"`, `"STATUS_FAILED"`, `"NO_SAFE_TARGET"`, `"UNREACHABLE"`
## Behavior
- Reads `world_state("nav")` and chooses up to `max_targets` safe entries
- Uses `nav-turn` + one of: `nav-move`, `nav-climb`, `nav-descend`
- Verifies cell match via `mc-status`
## Planning Notes
- Requires navigation history to be maintained by nav tools
- If recovery fails, consider `mc-place-until-supported` or broader replanning
## Example
```json
{"type":"nav-backtrack","max_targets":3,"out":"$recovery"}
```
This skill attempts to return the robot to a recently known safe navigation cell by replaying bounded local motions. It inspects the stored navigation history, selects safe past poses, and tries atomic primitives to reach one of them. The goal is a fast, local recovery without full replanning.
The skill reads world_state("nav") history and picks up to max_targets safe entries. For each candidate it issues a nav-turn followed by a single motion primitive: nav-move, nav-climb, or nav-descend. After executing a primitive it verifies the robot reached the expected cell using mc-status and reports the recovered pose and method.
What does the skill return on success?
It returns a summary, the recovered {x,y,z,yaw}, the method used (step, climb, or descend), and final yaw.
Why would recovery fail?
Failures include no nav history, no safe targets, primitives failing, or targets being unreachable; check mc-status and consider broader replanning.