Skip to content

Let AI agents restructure guides with snapshots before deletions, step moves and screenshot changes - #185

Merged
Twest2 merged 7 commits into
mainfrom
feat/184-agent-restructure
Oct 29, 2026
Merged

Twest2 merged 7 commits into
mainfrom
feat/184-agent-restructure

Conversation

@Twest2

@Twest2 Twest2 commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Issue

Closes #184

Summary

AI agents connected over MCP could only rewrite text and add things. Now they can also create and delete guides and steps, reorder steps, replace or remove screenshots, and delete blocks and annotations. Before deletions, step creation or moves, and screenshot changes, StepForge snapshots the existing guide so the user can undo them from More → Backups & snapshots. Creating a guide, text rewrites, nesting changes through update_step, added placeholders and added annotations do not create agent snapshots. Agents still can't change or delete placeholders, delete brand profiles, or delete blurs.

Changes

  • New agent tools in core/agent-tools.js: create_guide, delete_guide (moves the guide to the Trash), create_step, move_step, delete_step, delete_blocks, set_screenshot, remove_screenshot and delete_annotations. Screenshots come from a PNG file the agent names by its full path.
  • Every tool that deletes, moves, adds a step or replaces something calls the new createAgentSnapshot first. These snapshots are labeled with what the agent was about to do ("before agent deletes step 3"). Automatic backups don't prune them; StepForge keeps the newest 50 per guide.
  • delete_annotations refuses blurs: deleting one would show the agent what the blur hides the next time it looks at the step.
  • GuideStore.deleteStep moves a deleted step's substeps up to its parent, not to the top level, so a nested delete no longer breaks numbering. Undo in the editor is unaffected.
  • The app drops a guide an agent deleted from search. If that guide is open, the app cancels pending saves and returns to the library. guide:save and step:save refuse a guide that is in the Trash, so a late save can't recreate it and block restoring it.
  • Editor autosaves merge guide details, blocks and annotations against their loaded baseline, so unsaved text does not resurrect agent-deleted blocks or erase newly added annotations. Current step order, parents and screenshot metadata survive stale saves; undo remains available.
  • Delayed image and background writes refuse trashed guides before writing files, so they cannot create ghost folders that prevent restoring the guide.
  • Screenshot imports refuse raw library files, including symlinks, and screenshot replacements retain automatic privacy blurs.
  • Docs: AI_AGENTS.md (the can/can't table and an undo section), PRIVACY.md and ARCHITECTURE.md.

Area

  • Guide editor
  • Library
  • Documentation
  • Tests

Testing

  • bash tests/run_test.sh passes (not run: it launches the app)
  • Tested manually

npm test passes: 1038 pass, 0 fail, 20 skipped. Workflow and regression tests cover each tool, refused calls taking no snapshot, restoring snapshots, pruning, nested deletion, blurred-image import refusal, preserving privacy blurs, stale editor reconciliation, undo, and delayed writes after Trash. The repository structure check and git diff --check also pass. I haven't tried it with a real agent or in the running app yet.

Screenshots or recordings

N/A

Rollout notes

None. A guide an agent deletes goes to the local Trash only; like other local Trash, cloud sync doesn't delete it from Drive.

Checklist

  • Linked to an issue above
  • Scope is limited to that issue
  • Docs updated for user-visible changes
  • No new network calls, runtime dependencies, or third-party branding

@Twest2 Twest2 changed the title Let AI agents create, delete, reorder and replace guide content, snapshotting the guide before each change Let AI agents restructure guides with snapshots before deletions, step moves and screenshot changes Oct 29, 2026
@Twest2
Twest2 merged commit a5f05b1 into main Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let AI agents restructure guides, with a snapshot before every destructive change

1 participant