Skip to main content

Zed Editor Integration

Zed has native support for the Agent Client Protocol. Here’s how to set up Terramind with Zed.

Prerequisites

  1. Install Terramind:
npm install -g terramind
  1. Verify installation:
terramind --version

Configuration

Add Terramind to your Zed configuration file: Location: ~/.config/zed/settings.json
{
  "agent_servers": {
    "Terramind": {
      "command": "terramind",
      "args": ["acp"]
    }
  }
}

Using Terramind in Zed

  1. Open your project in Zed
  2. Open the AI assistant panel
  3. Select Terramind from the agent list
  4. Start coding with AI assistance!

Custom Working Directory

To specify a working directory:
{
  "agent_servers": {
    "Terramind": {
      "command": "terramind",
      "args": ["acp", "--cwd", "/path/to/your/project"]
    }
  }
}

Multiple Projects

Set up different Terramind instances for different projects:
{
  "agent_servers": {
    "Terramind-Project1": {
      "command": "terramind",
      "args": ["acp", "--cwd", "/path/to/project1"]
    },
    "Terramind-Project2": {
      "command": "terramind",
      "args": ["acp", "--cwd", "/path/to/project2"]
    }
  }
}

Manual Testing

Test the ACP server manually before editor integration:

Start the Server

terramind acp
The server communicates via stdio (standard input/output).

Send Test Request

Initialize the protocol:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1}}' | terramind acp
Expected response:
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": 1,
    "agentCapabilities": {
      "supportsStreaming": false,
      "supportsTools": true
    }
  }
}

Troubleshooting

Symptoms: Terramind ACP server fails to start in editorSolutions:
  1. Verify Terramind is installed: which terramind
  2. Check the command works in terminal: terramind acp
  3. Review editor logs for error messages
  4. Ensure correct path in configuration
Symptoms: Prompts sent but no response receivedSolutions:
  1. Check API key is configured: terramind auth
  2. Verify network connectivity
  3. Check for error messages in terminal
  4. Try with --debug flag: terramind acp --debug
Symptoms: Terramind can’t read/write filesSolutions:
  1. Check file permissions in your project
  2. Verify working directory is correct
  3. Ensure .gitignore isn’t blocking necessary files
  4. Check editor has file system access
Symptoms: Terramind accessing wrong filesSolutions:
  1. Verify --cwd argument is correct
  2. Check you’re in the right workspace
  3. Restart the editor/server
  4. Clear any cached state

Advanced Configuration

Environment Variables

Set environment variables for the ACP server:
{
  "agent_servers": {
    "Terramind": {
      "command": "terramind",
      "args": ["acp"],
      "env": {
        "TERRAMIND_MODEL": "claude-sonnet-4-5",
        "TERRAMIND_LOG_LEVEL": "debug"
      }
    }
  }
}

Custom Port (Future)

For network-based communication (when supported):
{
  "agent_servers": {
    "Terramind": {
      "command": "terramind",
      "args": ["acp", "--port", "8080"]
    }
  }
}

MCP Server Configuration

Configure MCP servers for extended capabilities: First, add MCP servers to your Terramind config:
terramind mcp add --name filesystem --command "npx -y @modelcontextprotocol/server-filesystem /path/to/dir"
Then use in editor as normal - Terramind will automatically use configured MCP servers.

Editor-Specific Features

Zed Features

When using Terramind in Zed:
  • Inline suggestions as you type
  • Quick actions on selected code
  • Chat interface for conversations
  • File context automatically included
  • Multi-file editing support

Keybindings

Set up custom keybindings in Zed for quick access:
{
  "bindings": {
    "cmd-k": "ai_assistant::toggle",
    "cmd-shift-k": "ai_assistant::new_conversation"
  }
}

Best Practices

Prompt Engineering

Get better results with clear prompts: Good:
"Refactor the handleSubmit function in Form.tsx to use async/await and add proper error handling"
Better:
"In Form.tsx, refactor handleSubmit to:
1. Use async/await instead of .then()
2. Add try/catch for error handling
3. Show user-friendly error messages
4. Follow our project's error handling pattern from utils/errors.ts"

Context Management

Help Terramind understand your intent:
  • Mention specific files when relevant
  • Describe the desired outcome clearly
  • Reference related code that should be considered
  • Specify patterns to follow

Iterative Development

Work iteratively with Terramind:
  1. Start broad: “Create a user profile component”
  2. Refine: “Add form validation”
  3. Enhance: “Add loading states and error handling”
  4. Polish: “Add accessibility attributes”

Performance Tips

Optimize Response Time

  • Be specific to reduce unnecessary analysis
  • Limit context to relevant files only
  • Use focused prompts for quick tasks
  • Choose appropriate models (Haiku for speed)

Reduce Token Usage

  • Clear old conversations when switching topics
  • Reference files by name instead of pasting content
  • Use concise language in prompts
  • Avoid redundant context

Security Considerations

File Access

Terramind requests permission before:
  • Writing or modifying files
  • Executing bash commands
  • Accessing sensitive files
Review permissions carefully!

API Keys

  • Never commit API keys to repositories
  • Use environment variables for sensitive data
  • Rotate keys periodically
  • Restrict permissions to minimum necessary

Code Review

Always review AI-generated code:
  • Check for security issues
  • Verify logic correctness
  • Test thoroughly
  • Follow team standards

Next Steps