The feedback relocate command updates the anchor location of a feedback entry when the original anchor has become stale or inaccurate due to spec changes.When you relocate feedback:
A new anchor is created at the specified line
The original location is preserved in anchor.original_location
Anchor status is set to "relocated"
The updated_at timestamp is updated
Changes are exported to JSONL
Use this command when:
Feedback shows as stale but content still exists in spec
Line numbers shifted due to spec edits
You know the correct new location for the feedback
Anchor needs manual correction
Relocation requires you to specify the correct line number. Review the spec content first to ensure accuracy.
for fb_id in $(sudocode --json feedback stale | jq -r '.[] | .id'); do echo "=== Relocating $fb_id ===" # Show feedback details sudocode feedback show "$fb_id" # Show spec spec_id=$(sudocode --json feedback show "$fb_id" | jq -r '.spec_id') echo "" echo "Spec content:" sudocode spec show "$spec_id" | head -50 # Ask for new line echo "" echo "Enter new line number (or 'skip'):" read line_num if [[ "$line_num" =~ ^[0-9]+$ ]]; then sudocode feedback relocate "$fb_id" --line "$line_num" else echo "Skipped $fb_id" fi echo ""done
# Map of FB-ID to new line numberdeclare -A relocations=( ["FB-004"]=50 ["FB-007"]=130 ["FB-012"]=95)for fb_id in "${!relocations[@]}"; do line="${relocations[$fb_id]}" echo "Relocating $fb_id to line $line" sudocode feedback relocate "$fb_id" --line "$line"done
# Create a plan before executingecho "Relocation Plan"echo "==============="sudocode --json feedback stale | jq -r '.[] |"FB: \(.id)Spec: \(.spec_id)Current Line: \(.anchor.line_number)Original Line: \(.anchor.original_location.line_number)Section: \(.anchor.section_heading)Content: \(.content | .[0:60])...---"'echo ""echo "Review the plan above, then run relocations manually"
# Get the snippet from feedbacksnippet=$(sudocode --json feedback show FB-004 | jq -r '.anchor.text_snippet')# Search spec for snippetsudocode spec show SPEC-001 | grep -n "$snippet"
Yes, you can relocate feedback multiple times. Each relocation updates the line number but preserves the original location from the first creation.
Copy
sudocode feedback relocate FB-004 --line 50 # First relocationsudocode feedback relocate FB-004 --line 55 # Second relocation
The original_location always refers to the first anchor location.
How do I know what line to relocate to?
Show the feedback to see the snippet:
Copy
sudocode feedback show FB-004
Search the spec for that content:
Copy
sudocode spec show SPEC-001 | grep -n "snippet text"
Use the line number from grep output
Can I relocate feedback to a different spec?
No, relocation only changes the line number within the same spec. To move feedback to a different spec, you must:
Dismiss the old feedback
Create new feedback on the new spec
What happens to original_location after multiple relocations?
It always preserves the very first location where feedback was created, not intermediate relocations. This maintains the complete history.
Can I relocate valid anchors?
Yes, technically you can relocate any feedback, not just stale ones. But it’s usually only necessary for stale anchors. Relocating a valid anchor would change its status to “relocated”.
Is there a way to undo a relocation?
Not directly. To undo:
Copy
# Get original line numberorig_line=$(sudocode --json feedback show FB-004 | jq -r '.anchor.original_location.line_number')# Relocate backsudocode feedback relocate FB-004 --line "$orig_line"
However, the status will still show “relocated” not “valid”.