Set up LoopGuard

Start with the extension if you want loop alerts inside your editor. Add the local helper when you want your AI agent to read only the code that matters — not whole files — and get cleaner terminal output.

What you get in 60 seconds

  • Loop alerts — LoopGuard notices when you keep hitting the same error and tells you before you waste another hour.
  • Focused context copy — instead of pasting an entire file into AI chat, copy only the few lines that actually matter.
  • Smaller AI prompts — the helper trims noisy terminal output so your AI agent gets a compact, useful summary instead of 3,000 lines of npm logs.
Editor path
Loop alerts, focused copy, in-editor dashboard

Install the VS Code extension in VS Code, Cursor, or Windsurf and start coding right away.

Helper path
Smarter AI reads, agent setup, cleaner terminal output

Install loopguard-ctx to let your AI agent read only the relevant code, not whole files. Works with Claude Code, Cursor, Codex CLI, and more.

VS Code

extension
1

Install from Marketplace

Search for LoopGuard in the Extensions panel, or install from the terminal:

code --install-extension LoopGuard.loopguard

The bundled helper is included in the extension package. No separate Rust install is required for the editor workflow.

2

Open any workspace

LoopGuard activates automatically. The status bar item appears, loop detection starts, and Copy Optimized Context is ready to use.

3

Optional: sign in for history

Use this only if you want web dashboard history and synced session metrics.

LoopGuard: Sign In

Core loop detection and focused context still work fully without an account.

Cursor

extension + optional MCP
1

Install the LoopGuard extension in Cursor

Cursor can use the same extension as VS Code. Open the Extensions panel and install LoopGuard there first.

2

Use the editor features right away

Loop alerts, focused context copy, and the in-editor dashboard all work the same way as in VS Code.

3

Optional: add agent tools for Cursor chat

If you want focused MCP reads inside Cursor’s agent flow, choose one of these:

LoopGuard: Configure MCP Server

A picker appears — select Cursor from the list.

or from your project root:

loopguard-ctx setup --agent=cursor
The CLI path writes ~/.cursor/mcp.json and, when run from a project root, adds .cursor/rules/loopguard-ctx.mdc so the agent starts from the focused LoopGuard tools.

Windsurf

extension + optional MCP
1

Install the LoopGuard extension in Windsurf

Use Windsurf’s extension support exactly like VS Code. Install LoopGuard from the Extensions panel.

2

Work normally inside the editor

Loop detection, focused context copy, and sign-in behave the same way as they do in VS Code.

3

Optional: add agent tools for Windsurf

Use the built-in command or the standalone helper from your project root:

LoopGuard: Configure MCP Server

A picker appears — select Windsurf from the list.

or:

loopguard-ctx setup --agent=windsurf
The helper writes ~/.codeium/windsurf/mcp_config.json and, from a project root, installs .windsurfrules so Windsurf can favor LoopGuard’s focused tools.

Codex CLI

MCP

Codex can use LoopGuard as an MCP server for focused reads, compact search, and smaller shell output.

1

Fastest path: configure it from the extension

LoopGuard: Configure MCP Server

A picker appears — select Codex CLI from the list.

This writes the MCP server entry to ~/.codex/config.toml using the bundled helper path.

2

Standalone helper path

If you are not using the extension, install the helper and run:

loopguard-ctx setup --agent=codex
This adds the MCP entry in ~/.codex/config.toml and writes a small LoopGuard instruction file in ~/.codex/.
3

Restart Codex

Restart Codex so it reloads MCP servers. If you are coming back to a long-running project later, ctx_session load can restore the last saved helper session.

Claude Code (terminal)

helper + MCP

No editor required. This path is for terminal-first agent workflows where you want LoopGuard’s focused reads and smaller shell output.

1

Install loopguard-ctx

Choose the method that suits you.

Homebrew (macOS / Linux)

brew tap rodthenewcomer/loopguard https://github.com/rodthenewcomer/loopguard brew install loopguard-ctx

npm (any platform with Node 16+)

npm install -g loopguard-ctx-bin

Or curl installer

curl -fsSL https://loopguard.vercel.app/install.sh | sh -s -- --download

Verify:

loopguard-ctx --version
2

Wire Claude Code

This sets up the Claude MCP entry plus the local helper guidance files.

loopguard-ctx setup --agent=claude
Today this writes ~/.claude.json for MCP, ~/.claude/settings.json for local hooks, and ~/.claude/CLAUDE.md for tool guidance.
3

Restart Claude Code and verify

Restart your terminal session, then run the doctor if you want a full check:

loopguard-ctx doctor
4

Restore previous session context

Run this inside Claude Code before starting work to restore context from the previous session:

ctx_session load

Gemini CLI

MCP

Gemini CLI and compatible Gemini-family tools such as Antigravity can use LoopGuard as an MCP server for focused context reads and smaller shell output.

1

Run the setup command

loopguard-ctx setup --agent=gemini
This adds the MCP entry in ~/.gemini/settings/mcp.json and installs the local guidance file the Gemini-family tools use.
2

Resume agent session

Restart the tool after setup so it reloads the MCP list and starts using LoopGuard’s focused helper tools.

Shell helper

bash · zsh · fish

The shell helper is the lightest-weight install: same machine, same commands, less noisy output before it reaches an AI tool.

1

Install the helper

If you do not already have loopguard-ctx, install it:

curl -fsSL https://loopguard.vercel.app/install.sh | sh -s -- --download

Then verify: loopguard-ctx --version

2

Install shell hooks

loopguard-ctx init

This updates your shell config and adds the LoopGuard shell wrapper.

3

Restart your terminal

Open a new shell and try a noisy command.

$ npm install

[LoopGuard: compressed 3,420 → 280 tokens · 91% reduction]

Need the deeper reference, command details, or troubleshooting steps?