Connecting a modern IDE (Cursor, Claude Code, Codex, Windsurf, Antigravity) to the hosted
MCP endpoint is separate — follow that agent’s install guide.
setup and init are how you make the connection useful across machines and repos.
# Option A — run it on demand, nothing installed (recommended)
npxstatelode-bridge<command>
# Option B — install it globally, then call it directly
npminstall-gstatelode-bridge
statelode-bridge<command>
npx downloads and runs the latest published version each time, so you never have a stale
copy. The examples below use the npx form; drop the npx prefix if you installed globally.
If a copied command misbehaves, your document may have rewritten -- as an en-dash.
Sanitize smart punctuation before running:
Configure every IDE once. Run this once per machine. It writes a short, conservative StateLode rule into the
global instruction file of each IDE you actually have installed, so every agent treats
StateLode consistently without you teaching each project from scratch:
Terminal window
npxstatelode-bridgesetup
What it touches (and only if that IDE is installed):
IDE
Where the rule goes
Claude Code
~/.claude/CLAUDE.md
Codex
~/.codex/AGENTS.md
Windsurf
~/.codeium/windsurf/memories/global_rules.md
Cursor, VS Code (Copilot)
Printed for you to paste into app settings (they keep global rules in settings, not a file)
The rule is marker-aware and ask-first by design:
In a repo with a statelode.json, the agent uses that project automatically.
In a repo without one, the agent never guesses or auto-creates a project. It offers,
once, to pin the repo (statelode-bridge init) and only proceeds if you agree.
It’s safe to re-run — it upserts a single delimited block and never clobbers your existing
rules. Preview without writing anything:
Terminal window
npxstatelode-bridgesetup--dry-run
After setup, pin individual repos with init (next).
Pin a repo to a project. Run this once in each repo you want StateLode to manage:
Terminal window
npxstatelode-bridgeinit<project-slug>
Omit the slug to derive it from the directory name (on a re-run it reuses the pin already
in statelode.json). Re-running is also how you refresh: npx statelode-bridge@latest init
rewrites the guide blocks with the latest agent rules and keeps the existing pin — use
@latest so npx doesn’t serve a cached older bridge. It writes two things, both safe to
commit and safe to re-run:
statelode.json — a machine-readable marker { "projectId": "<slug>", "endpoint": "…" }.
The field is named projectId so it reads exactly like the argument agents pass to the
tools. (Older pins used project; re-running init migrates them.)
An ## StateLode block in both AGENTS.md and CLAUDE.md — Codex and Cursor read
AGENTS.md; Claude Code reads CLAUDE.md. Writing both means every agent scopes
task_search to this project at session start.
No token is required to run init — it only writes local files. For the full model of how
the slug, your workspace token, and IDE install scope fit together, see
Workspaces, projects & tokens.