/graft:graft-initfrom graft
Wires the graft CLI and skill system into Claude Code by installing the CLI, then writing usage rules to CLAUDE.md or AGENTS.md and a rule file under .claude/rules/graft.md. Idempotent.
Ships in graft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The skills reach the agent either from the graft plugin (marketplace) or from
graft setup. This skill does the rest: it makes sure the graft CLI is
installed, then tells the agent to actually use the skills, every session,
without being asked. One question, then it writes the files.
Run graft --version. If that fails, also try the default install location
directly - right after an install the PATH of this session is stale, on Windows
especially: ~/.graft/bin/graft --version ($env:USERPROFILE\.graft\bin\graft.exe
on Windows). Use whichever path answers for every graft command below.
Not installed. Ask before downloading anything (AskUserQuestion):
question: "graft is not installed. Install it now?"
header: "Install"
options:
- { label: "Install (recommended)", description: "Prebuilt, checksum-verified binaries into ~/.graft, plus the embedding model (~600 MB, downloaded once). No account, no API key." }
- { label: "Cancel", description: "Install nothing. graft-init cannot continue without the CLI." }
On Install, run the official installer, nothing else:
curl -fsSL https://raw.githubusercontent.com/AEndrix03/Graft/master/install.sh | shbrew tap AEndrix03/graft https://github.com/AEndrix03/Graft.git && brew install graftpowershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/AEndrix03/Graft/master/install.ps1 | iex"The model download takes minutes: give the command a long timeout (10 minutes) or run it in the background and wait for it. If it fails, show the last lines of its output and stop - do not retry with other flags or try to build from source.
Installed but older than this plugin. When the skills came from the plugin,
its manifest carries a version (.claude-plugin/plugin.json or
.codex-plugin/plugin.json in the plugin root, two levels above this skill's folder). If graft --version
is lower, say so in one line and offer graft upgrade --yes. Do not upgrade
without a yes.
Duplicate skills. If the skills came from the plugin, check for copies left by
an older graft setup: graft, graft-init, recall, memoryze, learn and
memory-audit under ~/.claude/skills or ~/.codex/skills, each with a
SKILL.md whose name: matches its folder. They make every skill appear twice
(/recall and /graft:recall). List what you found and offer to delete exactly
those folders; delete nothing else and nothing without a yes.
Use AskUserQuestion, multiSelect: false:
question: "Where should the graft rule live?"
header: "Scope"
options:
- { label: "Global (recommended)", description: "Every project on this machine. The graph is shared anyway, so this is normally what you want." }
- { label: "This project only", description: "Only this repo. Use it when the team should get the rule from version control, or when you are trying graft out." }
- { label: "Cancel", description: "Change nothing." }
On Cancel: reply Cancelled, nothing changed. and stop.
Ask nothing else. Do not ask about caching, retrieval frequency or save policy - the rule below is the answer to all three, and asking makes the user choose between options they have no basis to choose between yet.
Detect the agent from the directories that exist, and pick the paths:
| Agent | Global | Project |
|---|---|---|
Claude Code (~/.claude) | ~/.claude/CLAUDE.md + ~/.claude/rules/graft.md | ./CLAUDE.md + ./.claude/rules/graft.md |
Codex (~/.codex) | ~/.codex/AGENTS.md | ./AGENTS.md |
OpenCode (~/.config/opencode) | ~/.config/opencode/AGENTS.md | ./AGENTS.md |
| anything else | ~/AGENTS.md | ./AGENTS.md |
On Windows, ~ is $env:USERPROFILE. Create parent directories and missing
files as needed. If several agents are present, write for all of them - it costs
nothing and the user does not have to remember which one they are in today.
Claude Code: write the full rule to the rules/graft.md path, and put this
in the CLAUDE.md so it is loaded even where the rules directory is not scanned
automatically:
<!-- graft:start -->
## graft - persistent memory (configured by /graft-init)
@.claude/rules/graft.md
<!-- graft:end -->
Use the path that matches the scope you resolved in step 2 (~/.claude/rules/graft.md
for global, .claude/rules/graft.md for project-local).
Every other agent: write the full rule text directly between the markers in the AGENTS.md, with no import line.
The rule text, verbatim:
# graft - use the memory graph
You have a persistent memory graph (`graft`) shared across every session. It is a
prompter, not a cache: a close note is already a win. You run it - the user should
never have to think about it. The `graft` skill has the full lifecycle; these
rules always apply.
**Housekeeping, once per session in a project**: `graft status` (cheap, never
starts the daemon; a `graft:` session hint, when present, already carries it)
and act on its `next` list, bounded and never blocking the user's task:
`bootstrap` - one `/learn bootstrap` pass, task area first, in the background if
you can; `apply-safe` - run it; `resolve` / `refresh-sources` / `scan` - one
small batch, the `memory-audit` way. Empty `next` - nothing to do.
**Before non-trivial work** (a bug, an error, a design decision, a "how do I", a
substantial piece of code) search first: the `recall` skill, or
`graft query "<3-8 words>"`, then `graft retrieve --top-k 5`, `graft get <id>`.
`STRONG` means "something close exists", not "this is correct": check it.
**A note contradicted by what you see is repaired now**: insert the corrected
note, then `graft maintain resolve --node <old> --action supersede --by <new>`
(`--action stale` if you cannot write the correction). Never leave two
contradicting notes.
**After substantial work, close the gap**: insert what the graph did not have -
the fix, the gotcha, the decision and its reason, a reusable procedure (the
`memoryze` skill), with `--source file:<path>` when it comes from a file. Never
save secrets, transcripts, or what the code or git history already says.
Syntax: `graft insert --title T --body B --keyword K [--keyword K2]...
[--source file:<path>]` - title and body are flags, never positional, one
`--keyword` per keyword (no commas); 2-5 keywords, taken from
`graft classify --title T` (it reuses the graph's existing ones - guessed
keywords cause misses later); `graft <command> --help` prints the usage.
**Stay invisible.** Never ask the user about graft in the normal path; raise it
only when it is broken, data loss is suspected, or an irreversible action cannot
be decided from context. One recap line in a turn where graft gave or took
something is enough.
Skip all of this for mechanical edits and questions answered by code on screen.
Read each target file first.
<!-- graft:start --> ... <!-- graft:end -->, replace
exactly that span, markers included. Touch nothing else.rules/graft.md wholesale - it is entirely ours.Never duplicate the block, never remove content outside the markers.
Two lines, no more:
Wired graft into <path> (one line per file written).Do not paste the rule back to the user.
graft is not installed and the user cancels step 0 - stop, nothing written;
the rule is useless until the CLI answers.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub aendrix03/graft --plugin graft6 skills in this plugin
/graftPersistent graph memory shared across conversations and agents. Graft is a prompter, not a cache: it hands you notes that may be close to the problem in front of you, and a close note is already a win - it gives you a starting point and reminds you what was decided before. Search it before non-trivial work, and write to it whenever the answer you just produced was not already there. Companion skills: `/recall` (search), `/memoryze` (save), `/learn` (bulk ingest; `/learn docs` for a repository's documentation; `/learn bootstrap` for the unattended cold start of a project), `/memory-audit` (maintenance pass + health check). After `/graft-init` the agent runs the whole lifecycle itself (bootstrap, recall, repair, writeback, bounded maintenance) from one cheap `graft status` call, without asking the user. The daemon auto-starts on the first command./learnBatch knowledge ingestion from external sources (a folder, a codebase, a docs tree). Plans well-shaped nodes with reconciled keywords, shows the plan for approval, then executes idempotently. Triggered by `/learn`, "ingest this folder into memory", "porta questo codice nella memoria", "memorize this codebase". Docs mode (`/learn docs [path]`): all of a repository's documentation and nothing else, incremental on re-runs; "ingest the docs of this repo", "impara la documentazione del repo". Bootstrap mode (`/learn bootstrap [path]`): unattended, progressive cold start of a whole project's memory (topic map, bounded runs by importance, task area first, resumed via `graft project status`); "bootstrap graft for this project", "this project was never bootstrapped", "inizializza la memoria del progetto". Differs from `/memoryze` (1-5 nodes from conversation): `/learn` produces 10-200 nodes from external corpora./memory-auditMaintenance pass + health check of the graft graph. Runs the `graft maintain` loop: checks what is due, applies the mechanical cleanup, then adjudicates every maintenance candidate (near duplicates, supersessions, contradictions, memories whose source file changed or disappeared, keyword variants, stale low-value notes) against the current code and docs and resolves it with one audited, reversible action, without asking the user in the normal path. Ends with a short report (what was resolved, hit rate, reuse). Triggered by `/memory-audit`, "is the graph healthy", "audit memory", "clean up the memory", "check graft quality", or when `graft maintain status` recommends work./memoryzeDistill the current conversation (or a specified excerpt) into N high-quality graft nodes and save them. Triggered by `/memoryze`, "save this to memory", "ricorda questo", "memorize this", or whenever the user explicitly wants the agent to commit knowledge to the persistent graph. The user can hint at granularity ("split into 3 atomic nodes", "one comprehensive node"), focus ("save the WHY, not the diff"), and target profile. Auto-classifies keywords. Prefer this over a raw `graft insert` whenever you're saving more than a one-liner./recallSmart graft search that picks the right tool (query → retrieve → explore) based on the question's shape, escalates when results are weak, and presents findings ranked by confidence with the originating evidence. Triggered by `/recall`, "do we have something about X", "have we seen this before", "ricordi se", "search the graph". Prefer this over a raw `graft query` whenever the user is exploring rather than confirming a known answer.Other plugins' skills for the same job