Skip to content

init --agents <subset> silently converges: README/--help say "wire only these", but it also removes other hosts' user-level wiring #482

Open

Description

@djbclark

Narrowed after a closer search: the --dry-run omission is already tracked in #329 (retraction targets are on its list), and the retraction itself was introduced on purpose in #247, whose description calls it "a behaviour change worth knowing about". What remains here is that nothing tells the user, and that the blast radius reaches outside the repo.

Summary

graft init --agents <subset> converges: it retracts the wiring of every host not listed (added in #247). The README and --help still describe the flag as additive — "wire only these agents", "graft init --agents claude to … wire Claude Code alone" — and neither mentions that the retraction also removes user-level files for the unlisted hosts: mcpServers.graft in ~/.claude.json, the four graft hooks + helpers/graft-hooks.cjs under ~/.claude, ~/.codex/hooks.json + ~/.codex/hooks/graft/ + [mcp_servers.graft] in ~/.codex/config.toml, and ~/.gemini/skills/graft/SKILL.md.

Version: @nanonets/graft 0.20.0, macOS, npm global.

What happened

In a repo already wired for Claude Code (global + project), I added Hermes:

graft init --agents hermes --no-build

Beyond the repo-level removals (project .mcp.json lost its only key and was deleted), every user-level Claude Code, Codex and Antigravity wiring on the machine was removed — so all repos lost graft's hooks and MCP server, not just this one. The - removed … — agent not selected lines do print, but only after the fact, and a user reading the README has no reason to expect a repo-scoped command to edit ~/.claude.json.

Asks

  1. Document convergence in the README --agents row and in graft init --help: "wires only these and removes graft's wiring for every other host, including user-level files; pass every host you use".
  2. Consider scoping the retraction of scope: 'global' targets: only retract a host's user-level files when the user asks (--converge/--only, or uninstall), or when no other wired repo still selects that host. A repo-level --agents choice removing another agent's machine-wide config is a large blast radius for a flag that reads as additive.

Workaround

Always pass the full list of hosts wired on the machine (e.g. --agents claude agents antigravity hermes), or copy the fenced instruction block by hand instead of running init to add one agent's section.

Related: #247 (introduced convergence), #329 (--dry-run should list retractions), #118 (reconcile rewrites .mcp.json).

Activity

  1. changed the title [-]init --agents <subset> retracts every other host's wiring, including user-level files, and --dry-run does not show it[/-] [+]init --agents <subset> silently converges: README/--help say "wire only these", but it also removes other hosts' user-level wiring[/+] on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions