Willder documentation
Connect Claude Code.
No repository to clone. Connect Claude Code, then add the hook that hands each new session what your scope already holds.
Before you start
You need Claude Code, Node 20 or later, and a Willder token with write permission. New to Willder? What you see after sign-up shows where the token comes from.
1Load your token
Open a terminal in your project. Run this and paste your token when asked. Nothing shows as you paste. It works in zsh and bash.
printf 'Willder token: '
stty -echo; read -r WILLDER_TOKEN; stty echo
printf '\n'
export WILLDER_TOKENRun every command below, and start claude, in this same terminal. In a new terminal, load the token again first.
2Connect Claude Code
claude mcp add --transport http willder https://willder.ai/api/mcp \
--header "Authorization: Bearer $WILLDER_TOKEN"This saves the token in your own Claude Code settings, not in the project. If WILLDER_TOKEN is not set, the command saves the header without a token, so run step 1 first.
Prefer a file in the project? Save this as .mcp.json in the project root instead. It names the variable, not the token, so it is safe to commit. Claude Code asks once to approve it.
{
"mcpServers": {
"willder": {
"type": "http",
"url": "https://willder.ai/api/mcp",
"headers": {
"Authorization": "Bearer ${WILLDER_TOKEN}"
}
}
}
}3Add the session hook
Claude Code calls a Willder tool only when it decides to. Without the hook, a new session can start without your memory. The hook asks Willder on your first message of every session and hands Claude what your scope holds, before Claude reads your message.
Download the hook into the project. It ends by printing “Willder hook installed.” If you do not see that line, run it again.
mkdir -p .claude/hooks &&
curl -fsSL -o .claude/hooks/willder-changes.mjs https://willder.ai/hooks/willder-changes.mjs &&
curl -fsSL -o .claude/hooks/willder-capture.mjs https://willder.ai/hooks/willder-capture.mjs &&
curl -fsSL -o .claude/hooks/willder-redact.mjs https://willder.ai/hooks/willder-redact.mjs &&
echo "Willder hook installed."Then save this as .claude/settings.json. If the file already exists, add the hooks key to it instead of replacing it.
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/willder-changes.mjs\"",
"timeout": 5
}
]
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/willder-changes.mjs\"",
"timeout": 5
}
]
}
]
}
}What the hook does:
- On your first message of a session, it brings in the rules and decisions saved in your scope: once per Claude Code session, and again after 30 minutes without a call. If Claude also calls a Willder tool, that tool’s first answer may repeat them.
- After each tool call, it brings in what other agents or people changed in your scope.
- It reads
WILLDER_TOKENwhen it runs. Without the token, or when Willder does not answer within 2 seconds, it stays silent and Claude carries on. - It sends the first 512 characters of your message, with anything that looks like a secret replaced first, to pick the most relevant rules. Willder does not store it.
These are the same files willder init installs from a copy of the repository.
4Check it works
Save a decision in one session, then open a new session and ask about it. The exact words are in step 3 of the quickstart.
Without the hook, Claude sees saved rules only when it calls a Willder tool. Each time Claude Code starts it opens a new connection, and the first Willder tool answer on that connection carries them, however soon after the last session. On a connection that stays open, they come again only after 30 minutes without a call.
When your token expires
Willder answers HTTP 401 and the hook goes quiet. Issue a new token and load it with step 1. If you connected with claude mcp add, also run claude mcp remove willder and step 2 again: that command saved the old token.