Skip to content

Commit 539101a

Browse files
authored
feat(zed): add Zed editor integration (MCP context server + recall/retain rule) (#2153)
MCP-only Zed integration: hindsight-zed init wires the Hindsight MCP server into Zed's settings.json (via mcp-remote) plus a recall/retain rule in AGENTS.md. Validated end-to-end in real Zed.
1 parent efa37cb commit 539101a

21 files changed

Lines changed: 1252 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
integrations-paperclip: ${{ steps.filter.outputs.integrations-paperclip }}
5151
integrations-opencode: ${{ steps.filter.outputs.integrations-opencode }}
5252
integrations-cursor: ${{ steps.filter.outputs.integrations-cursor }}
53+
integrations-zed: ${{ steps.filter.outputs.integrations-zed }}
5354
integrations-n8n: ${{ steps.filter.outputs.integrations-n8n }}
5455
integrations-zapier: ${{ steps.filter.outputs.integrations-zapier }}
5556
integrations-cloudflare-oauth-proxy: ${{ steps.filter.outputs.integrations-cloudflare-oauth-proxy }}
@@ -166,6 +167,8 @@ jobs:
166167
- 'hindsight-integrations/opencode/**'
167168
integrations-cursor:
168169
- 'hindsight-integrations/cursor/**'
170+
integrations-zed:
171+
- 'hindsight-integrations/zed/**'
169172
integrations-n8n:
170173
- 'hindsight-integrations/n8n/**'
171174
integrations-zapier:
@@ -488,6 +491,37 @@ jobs:
488491
working-directory: ./hindsight-integrations/cursor
489492
run: python -m pytest tests/ -v
490493

494+
test-zed-integration:
495+
needs: [detect-changes]
496+
if: >-
497+
github.event_name != 'pull_request_review' &&
498+
(github.event_name == 'workflow_dispatch' ||
499+
needs.detect-changes.outputs.integrations-zed == 'true' ||
500+
needs.detect-changes.outputs.ci == 'true')
501+
runs-on: ubuntu-latest
502+
503+
steps:
504+
- uses: actions/checkout@v6
505+
with:
506+
ref: ${{ github.event.pull_request.head.sha || '' }}
507+
508+
- name: Set up Python
509+
uses: actions/setup-python@v6
510+
with:
511+
python-version: '3.11'
512+
513+
- name: Install package and pytest
514+
working-directory: ./hindsight-integrations/zed
515+
# Installs the package (incl. the zstandard runtime dep) so the threads.db
516+
# reader tests can decompress Zed's zstd blobs.
517+
run: pip install -e . pytest
518+
519+
- name: Run tests
520+
working-directory: ./hindsight-integrations/zed
521+
# PR CI runs only the deterministic bucket; the real-LLM E2E bucket
522+
# (requires_real_llm) needs a live Hindsight server and runs separately.
523+
run: python -m pytest tests/ -v -m "not requires_real_llm"
524+
491525
test-omo-integration:
492526
needs: [detect-changes]
493527
if: >-
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
sidebar_position: 7
3+
title: "Zed Persistent Memory with Hindsight | Integration"
4+
description: "Add long-term memory to the Zed editor's AI assistant with Hindsight via MCP. One command wires up the Hindsight MCP server plus a recall/retain rule, so memory works automatically in the Agent Panel."
5+
---
6+
7+
# Zed
8+
9+
Long-term memory for the [Zed](https://zed.dev) editor's AI assistant, powered by [Hindsight](https://vectorize.io/hindsight). One command connects Zed's Agent Panel to the Hindsight MCP server and adds a rule telling the agent to use it — so it recalls relevant memory at the start of a task and retains durable facts as it goes. Recall happens at query time against your actual message, and from your seat it's automatic.
10+
11+
## How It Works
12+
13+
Zed has no pre-prompt hook, but it supports two things this integration uses:
14+
15+
- **MCP context servers:** Zed runs MCP servers configured under `context_servers` in `settings.json` and surfaces their tools in the Agent Panel. `hindsight-zed` registers the Hindsight MCP server there, giving the agent `recall` / `retain` / `reflect` tools.
16+
- **A global instructions file** (`~/.config/zed/AGENTS.md`) that Zed includes in every conversation. The integration adds a small rule there telling the agent to recall first and retain what it learns.
17+
18+
Zed doesn't yet have native HTTP-MCP transport, so the server is connected through the [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) stdio bridge (run via `npx`), which means Node.js must be installed.
19+
20+
## Setup
21+
22+
```bash
23+
pip install hindsight-zed
24+
hindsight-zed init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-memory
25+
```
26+
27+
`init` adds the `hindsight` MCP server to `~/.config/zed/settings.json` and the recall/retain rule to `~/.config/zed/AGENTS.md`. Restart Zed, open the Agent Panel, and the `hindsight` server should show a green dot.
28+
29+
Use a [Hindsight Cloud](https://hindsight.vectorize.io) key, or point at a self-hosted server with `--api-url http://localhost:8888` (no token needed for an open local server). If your `settings.json` has comments (JSONC), `init` prints the entry to paste rather than rewriting the file — or run `hindsight-zed init --print-only` anytime.
30+
31+
## Commands
32+
33+
| Command | Description |
34+
| --- | --- |
35+
| `hindsight-zed init` | Add the MCP server + recall/retain rule |
36+
| `hindsight-zed status` | Show whether the server + rule are configured |
37+
| `hindsight-zed uninstall` | Remove the server + rule |
38+
39+
## Note
40+
41+
Recall and retain run through MCP tools the agent calls, guided by the always-on rule. This makes recall query-time precise (no lag), with the tradeoff that it relies on the agent following the "recall first" instruction rather than the editor enforcing it.
42+
43+
See the [package README](https://github.com/vectorize-io/hindsight/tree/main/hindsight-integrations/zed) for full configuration options.

hindsight-docs/src/data/integrations.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@
180180
"link": "/sdks/integrations/cursor",
181181
"icon": "/img/icons/cursor.svg"
182182
},
183+
{
184+
"id": "zed",
185+
"name": "Zed",
186+
"description": "Long-term memory for the Zed editor's AI assistant via the Hindsight MCP server. One command wires up the MCP context server plus a recall/retain rule, so memory works automatically in the Agent Panel.",
187+
"type": "official",
188+
"by": "hindsight",
189+
"category": "tool",
190+
"link": "/sdks/integrations/zed",
191+
"icon": "/img/icons/zed.svg"
192+
},
183193
{
184194
"id": "cline",
185195
"name": "Cline",
Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.venv/
2+
__pycache__/
3+
*.pyc
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# hindsight-zed
2+
3+
Long-term memory for the [Zed](https://zed.dev) editor's AI assistant, powered by
4+
[Hindsight](https://github.com/vectorize-io/hindsight).
5+
6+
`hindsight-zed init` wires Zed's Agent Panel to the Hindsight **MCP server** and
7+
adds a rule telling the agent to use it — so it recalls relevant memory at the
8+
start of a task and retains durable facts as it goes. Recall happens at query
9+
time against your actual message (no lag), and from your seat it's automatic.
10+
11+
## How it works
12+
13+
Zed has no pre-prompt hook, but it does support two things this integration uses:
14+
15+
- **MCP context servers** — Zed runs MCP servers configured under
16+
`context_servers` in `settings.json` and exposes their tools in the Agent
17+
Panel. We register the Hindsight MCP server there, giving the agent
18+
`recall` / `retain` / `reflect` tools.
19+
- **A global instructions file** (`~/.config/zed/AGENTS.md`) that Zed includes in
20+
every conversation. We add a small rule there telling the agent to recall
21+
first and retain what it learns.
22+
23+
Zed doesn't yet have native HTTP-MCP transport, so the server is connected
24+
through the [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) stdio bridge
25+
(run via `npx`) — that means you need Node.js installed.
26+
27+
## Install
28+
29+
```bash
30+
pip install hindsight-zed
31+
hindsight-zed init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-memory
32+
```
33+
34+
`init` adds the `hindsight` MCP server to `~/.config/zed/settings.json` and the
35+
recall/retain rule to `~/.config/zed/AGENTS.md`. Restart Zed, open the Agent
36+
Panel, and the `hindsight` server should show a green dot.
37+
38+
Use a [Hindsight Cloud](https://hindsight.vectorize.io) key, or point at a
39+
self-hosted server with `--api-url http://localhost:8888` (no token needed for an
40+
open local server).
41+
42+
> If your `settings.json` contains comments (JSONC), `init` won't rewrite it —
43+
> it prints the exact `context_servers` entry for you to paste instead. Use
44+
> `hindsight-zed init --print-only` any time to see the snippet without writing.
45+
46+
## Commands
47+
48+
| Command | Description |
49+
| --- | --- |
50+
| `hindsight-zed init` | Add the MCP server + recall/retain rule |
51+
| `hindsight-zed status` | Show whether the server + rule are configured |
52+
| `hindsight-zed uninstall` | Remove the server + rule |
53+
| `hindsight-zed init --print-only` | Print the config to add manually |
54+
55+
## What gets written
56+
57+
`~/.config/zed/settings.json`:
58+
59+
```jsonc
60+
{
61+
"context_servers": {
62+
"hindsight": {
63+
"source": "custom",
64+
"command": "npx",
65+
"args": [
66+
"-y", "mcp-remote",
67+
"https://api.hindsight.vectorize.io/mcp/my-memory/",
68+
"--header", "Authorization: Bearer YOUR_HINDSIGHT_API_KEY"
69+
]
70+
}
71+
}
72+
}
73+
```
74+
75+
`~/.config/zed/AGENTS.md` (inside a fenced `<!-- HINDSIGHT -->` block that leaves
76+
the rest of the file untouched): a short rule telling the agent to `recall` at
77+
the start of each task and `retain` durable facts.
78+
79+
## Configuration
80+
81+
| Setting | Env var | Default |
82+
| --- | --- | --- |
83+
| API URL | `HINDSIGHT_API_URL` | `https://api.hindsight.vectorize.io` |
84+
| API token | `HINDSIGHT_API_TOKEN` | _(none; required for Cloud)_ |
85+
| Bank id | `HINDSIGHT_ZED_BANK_ID` | `zed` |
86+
87+
These can also live in `~/.hindsight/zed.json` (written by `init`).
88+
89+
## Development
90+
91+
```bash
92+
uv sync
93+
uv run pytest tests -v -m 'not requires_real_llm' # deterministic suite
94+
uv run pytest tests -v -m requires_real_llm # gated MCP-endpoint check
95+
```
96+
97+
## License
98+
99+
MIT
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Hindsight memory integration for the Zed editor."""
2+
3+
__version__ = "0.1.0"

0 commit comments

Comments
 (0)