Skip to main content
Loom integrates with code editors through the Agent Client Protocol (ACP), enabling seamless AI assistance directly in your development environment.

Supported Editors

VS Code

Official support via ACP over stdio

Zed

Native ACP support (built-in)

Custom Clients

Any editor with ACP support

Agent Client Protocol (ACP)

ACP is a protocol for connecting AI agents to code editors. Loom implements ACP to provide a consistent interface across different editors.

Architecture

Key concepts:
An ACP session corresponds to a Loom thread (conversation). Sessions persist across editor restarts and maintain full conversation history.
User input is sent as ACP content blocks (text, images, etc.). Loom currently supports text blocks:
Assistant responses are streamed as content chunks for real-time display:
Tool calls are executed locally (not in the editor). The agent runs tools via Loom’s tool registry and streams results back.

Message Flow

VS Code (via ACP)

Connect Loom to VS Code using the ACP protocol over stdio.

Setup

1

Install Loom CLI

2

Configure VS Code

Create a VS Code task to launch the ACP agent:.vscode/tasks.json:
Or configure in settings:
3

Start Session

  1. Open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
  2. Run “ACP: Start Session”
  3. Select “Loom” from the agent list
  4. Start chatting in the ACP panel

Authentication

The ACP agent uses the same authentication as the CLI:
Credentials are stored in ~/.loom/credentials.json and automatically used by the ACP agent.

Available Commands

The ACP agent supports all Loom tools:

read_file

Read file contents

write_file

Create or overwrite files

edit_file

Search and replace in files

list_files

List directory contents

search_files

Search code with regex

run_command

Execute shell commands

github_search

Search GitHub code

read_url

Fetch web pages
Example interaction:

Implementation Details

Session Management

Sessions map 1:1 to Loom threads:
Session lifecycle:

Streaming Implementation

Loom streams LLM responses as ACP notifications:

Type Conversions

All conversions between ACP and Loom types are pure functions:

Custom ACP Clients

You can build custom ACP clients for any editor or environment:

Protocol Overview

ACP uses JSON-RPC 2.0 over stdio:

Supported Methods

Example Client (Python)

Debugging

Enable Debug Logs

Inspect Protocol Messages

Use tee to capture stdio traffic:

Common Issues

Symptom: Editor shows “Failed to start agent”Solutions:
  • Check loom is in PATH: which loom
  • Test manually: loom acp
  • Check logs: LOOM_LOG=debug loom acp
Symptom: “Unauthorized” or “Invalid API key”Solutions:
  • Run loom login to authenticate
  • Check credentials: cat ~/.loom/credentials.json
  • Set API keys: export ANTHROPIC_API_KEY=...
Symptom: Tool calls fail or time outSolutions:
  • Check file permissions for read_file/write_file
  • Verify command exists for run_command
  • Check network for github_search/read_url

Best Practices

Persist Sessions

Sessions are automatically persisted to disk. You can resume conversations after restarting the editor.

Use Specific Models

Configure model per session based on task complexity. Use Claude Sonnet for coding, GPT-4 for general tasks.

Monitor Token Usage

Track token usage in notifications. Large codebases can consume significant context.

Graceful Shutdown

The agent handles SIGTERM/SIGINT gracefully, ensuring all threads are saved before exit.

Source Code Reference

  • ACP Agent: crates/loom-cli-acp/src/agent.rs
  • Type Bridge: crates/loom-cli-acp/src/bridge.rs
  • Session Management: crates/loom-cli-acp/src/session.rs
  • CLI Integration: crates/loom-cli/src/main.rs
Agent Client Protocol specification: https://github.com/zed-industries/acp