Status: needs technical refinement. This is a UX-focused design sketch. It has a genuine open design question (how undo knows what to remove) that must be settled before implementation — see "Open questions."
Problem
If a user scaffolds the wrong flavor, or decides they don't want the agentic envelope after all, there is no way to cleanly reverse it. They must manually hunt down and delete .agent/, the symlink trio (AGENTS.md, CLAUDE.md, .agent/CLAUDE.md), .devcontainer/, Justfile, .pre-commit-config.yaml, the .gitignore block (once the visibility feature lands), and any fresh-project files — and do it without nuking their own content. That's error-prone and makes trying agent-init feel risky: there's no easy exit. A tool that's easy to undo is a tool people are willing to experiment with.
Goal
One command to cleanly remove what agent-init added — e.g. agent-init uninstall [target] (name TBD: uninstall / undo / remove / clean). Seamless, safe, and previewable. Removing a scaffold should feel as routine as creating one.
Proposed UX (illustrative — exact shape is a refinement item)
agent-init: uninstall scaffold from ./myapp
remove .agent/ (created by agent-init)
remove .devcontainer/
remove Justfile
remove AGENTS.md, CLAUDE.md (symlinks)
keep .agent/AGENTS.md (modified since scaffold — left in place) <- safety
remove .gitignore block (agent-init fenced block; file kept)
Remove 11 items, keep 1 modified. Proceed? [y/N]
Design principles:
Provisional acceptance criteria (pending refinement)
Open questions (need technical refinement) — the core one is load-bearing
- How does undo know what to remove without nuking user content? This is the central design decision:
- Option A — install manifest. Write a small manifest at
init time (e.g. .agent/.install-manifest listing created paths + a content hash per file). Undo removes exactly those paths and detects user-modified files via hash mismatch (keep + warn). Precise and safe, but adds a file and couples init/uninstall.
- Option B — derive from the flavor registry at undo time. Reconstruct the created set from the flavor definition. No extra file, but requires knowing/recording which flavor was used, and is fragile if templates changed between versions.
- Option C — hybrid. Prefer the manifest; fall back to registry-derivation when no manifest exists (e.g. scaffolds created before this feature).
- Leaning Option A (manifest) for safety/precision, but this is explicitly a refinement decision.
- Scope: full envelope only, or also remove fresh-project files (
cmd/, go.mod, …)? The latter is much more dangerous — likely envelope-only by default, with the project files left alone.
- Naming:
uninstall vs undo vs remove vs clean.
- Handling already-committed scaffold files: remove from the working tree only, or also
git rm? (Probably remove files and let the user commit the deletion; don't auto-commit.)
- Symlink-trio removal order and broken-symlink edge cases.
Related
Problem
If a user scaffolds the wrong flavor, or decides they don't want the agentic envelope after all, there is no way to cleanly reverse it. They must manually hunt down and delete
.agent/, the symlink trio (AGENTS.md,CLAUDE.md,.agent/CLAUDE.md),.devcontainer/,Justfile,.pre-commit-config.yaml, the.gitignoreblock (once the visibility feature lands), and any fresh-project files — and do it without nuking their own content. That's error-prone and makes trying agent-init feel risky: there's no easy exit. A tool that's easy to undo is a tool people are willing to experiment with.Goal
One command to cleanly remove what agent-init added — e.g.
agent-init uninstall [target](name TBD:uninstall/undo/remove/clean). Seamless, safe, and previewable. Removing a scaffold should feel as routine as creating one.Proposed UX (illustrative — exact shape is a refinement item)
Design principles:
--dry-runshows exactly what would be removed before anything happens (reuses the plan machinery from feat(cli): conflict-aware plan preview for init (enhance --dry-run) #62). Same colored output + tally.--yes; never deletes files the user modified since scaffolding, and never touches files that pre-existed or unrelated project files. Modified files are reported and kept..gitignore/.git/info/exclude/ global excludes, uninstall removes that block (leaving the file).Provisional acceptance criteria (pending refinement)
uninstall [target]removes the agent-init-created envelope, leaving unrelated files intact.--force), with a clear report of what was kept and why.--dry-runpreviews the removal and writes nothing; a confirmation prompt guards real removal unless--yes.init(remove/keep + tally; color per init output: fix symlink paths, add clarity + color #58).Open questions (need technical refinement) — the core one is load-bearing
inittime (e.g..agent/.install-manifestlisting created paths + a content hash per file). Undo removes exactly those paths and detects user-modified files via hash mismatch (keep + warn). Precise and safe, but adds a file and couplesinit/uninstall.cmd/,go.mod, …)? The latter is much more dangerous — likely envelope-only by default, with the project files left alone.uninstallvsundovsremovevsclean.git rm? (Probably remove files and let the user commit the deletion; don't auto-commit.)Related
--dry-runpreview machinery.