Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By brandonrobertsMITIn 1 marketplace
Keeps local patches and forks of upstream dependencies working across releases, checking each change against your own tests. Early development: npm, Cargo, Go and PyPI are supported so far.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Agent-first tooling for keeping local modifications to upstream software in sync, automatically.
Teams modify upstream dependencies with patch files, vendored copies, and forks. When upstream releases a new version, those diffs break and someone has to figure out why the patch existed and port it by hand. Graft gives coding agents and CI the missing pieces:
graft.md): its intent and Invariants,graft) that checks whether each modification still fits a new upstream version and carries it forward when it does,Graft does not ship an LLM or hosted service. See docs/why-graft.md for why it exists and docs/dogfood.md for how this repo uses Graft on itself.
Status: early development. Works for npm (pnpm, npm, yarn, bun, upm), Cargo, Go, and PyPI (
patchmechanism), plus git forks (package mode and repo mode). See Roadmap.
pnpm add -D @graftsync/cli
pnpm exec graft init --agent # .grafts/, plus the skill for agents
pnpm exec graft add ms-fortnight --package ms --target index.js # graft.md + variant stub
# edit the installed package and run `graft capture ms-fortnight`
# (with pnpm, use `pnpm patch` / `pnpm patch-commit` instead of editing hardlinked node_modules)
pnpm exec graft apply # wire the package manager, reinstall, check anchors
# fill in Why / Invariants / Where to look / Anchors and cover each Invariant in your test suite
pnpm exec graft sync # green
pnpm exec graft sync --version 2.1.3 --install # upgrade, verify, bump
Paste this into Claude Code, Codex, Cursor or any agent that can run shell commands in your repo:
Set up Graft (https://github.com/brandonroberts/graft) in this repository so local modifications
to upstream software keep working, and keep being re-verified, when upstream releases new versions.
1. Run `npx -y @graftsync/cli@latest init --agent` (or `pnpm dlx @graftsync/cli@latest init --agent`,
or `bunx --bun @graftsync/cli@latest init --agent` on Bun ≥ 1.4), then read the graft-sync skill
it installs. Use that same CLI command for every graft command below.
2. Inspect this repository for modifications to upstream software: patch files (pnpm, bun, yarn,
patch-package), vendored or overridden dependencies (including Cargo `[patch]`, Go `replace`,
or Python overrides), or a fork relationship (such as an `upstream` git remote or commits on
top of an upstream repo). Tell me what you found and confirm which modification(s) to graft
and why they exist before changing anything. If none exist yet, ask me what we're modifying
and why, and make the change first.
3. Scaffold the graft:
- a dependency: `graft add <id> --package <pkg> --target <files>`, make the change in the
installed package, then `graft capture <id>` writes it as the variant (with pnpm, use
`pnpm patch` instead of editing `node_modules` in place: its files are hard links into the store);
- a fork whose code is installed as a dependency: `graft add <id> --package <pkg> --mechanism fork`,
and fill in the `fork:` block and the `{ ref, base }` variant;
- a fork that is the product itself, with this checkout as the fork:
`graft add <id> --package <name> --mechanism fork --in-place --version <upstream version it is based on>`.
4. Write graft.md's body: Why, Invariants (observable behaviors, one per bullet), Where to look
(described by behavior, not file paths), Anchors, History.
Ask me how I upgrade the package by hand. If it's more than a version bump (companion
packages, a migration tool), record that command as `upgrade` in `.grafts/config.json`.
5. Make sure the project's own tests cover each Invariant (add tests where they don't), and
note under Invariants which tests those are. Show they fail without the modification and
pass with it.
6. Run `graft apply` (except for a fork that is the product), then `graft sync`, until it is
green. `graft replay <id>` shows which published versions the variant already fits.
7. Add a `graft check` step to my CI right after dependencies are installed, so a graft that
isn't applied fails the build. Then ask me whether to automate re-verification with the Graft
GitHub Action (https://github.com/brandonroberts/graft/tree/main/packages/action). If I say
yes, ask how often it should run, whether it should propose prereleases or only stable
releases (`tags: latest`), and whether failing grafts should go to a coding agent
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub brandonroberts/graft --plugin graftPlugins from other owners that cover similar ground