Skip to content

Commit c05ab91

Browse files
authored
feat(continue): add Continue.dev integration via HTTP context provider (#2213)
Adds hindsight-continue: Hindsight memory for Continue.dev via its native http context provider (@hindsight recall) plus an optional MCP-server + rules setup. Includes the adapter package, tests against Continue's HTTP contract + a gated E2E, CI job, release registration, docs, and registry entry.
1 parent 359b2bc commit c05ab91

24 files changed

Lines changed: 2281 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
integrations-claude-code: ${{ steps.filter.outputs.integrations-claude-code }}
3838
integrations-cline: ${{ steps.filter.outputs.integrations-cline }}
3939
integrations-codex: ${{ steps.filter.outputs.integrations-codex }}
40+
integrations-continue: ${{ steps.filter.outputs.integrations-continue }}
4041
integrations-cursor-cli: ${{ steps.filter.outputs.integrations-cursor-cli }}
4142
integrations-crewai: ${{ steps.filter.outputs.integrations-crewai }}
4243
integrations-litellm: ${{ steps.filter.outputs.integrations-litellm }}
@@ -136,6 +137,8 @@ jobs:
136137
- 'hindsight-integrations/cline/**'
137138
integrations-codex:
138139
- 'hindsight-integrations/codex/**'
140+
integrations-continue:
141+
- 'hindsight-integrations/continue/**'
139142
integrations-cursor-cli:
140143
- 'hindsight-integrations/cursor-cli/**'
141144
integrations-crewai:
@@ -3054,6 +3057,45 @@ jobs:
30543057
# (requires_real_llm) needs a live Hindsight server and runs separately.
30553058
run: uv run pytest tests -v -m "not requires_real_llm"
30563059

3060+
test-continue-integration:
3061+
needs: [detect-changes]
3062+
if: >-
3063+
(github.event_name == 'workflow_dispatch' ||
3064+
needs.detect-changes.outputs.integrations-continue == 'true' ||
3065+
needs.detect-changes.outputs.ci == 'true')
3066+
runs-on: ubuntu-latest
3067+
timeout-minutes: 30
3068+
3069+
steps:
3070+
- uses: actions/checkout@v6
3071+
with:
3072+
ref: ${{ github.event.pull_request.head.sha || '' }}
3073+
3074+
- name: Install uv
3075+
uses: astral-sh/setup-uv@v7
3076+
with:
3077+
enable-cache: true
3078+
prune-cache: false
3079+
3080+
- name: Set up Python
3081+
uses: actions/setup-python@v6
3082+
with:
3083+
python-version-file: ".python-version"
3084+
3085+
- name: Build continue integration
3086+
working-directory: ./hindsight-integrations/continue
3087+
run: uv build
3088+
3089+
- name: Install dependencies
3090+
working-directory: ./hindsight-integrations/continue
3091+
run: uv sync --frozen
3092+
3093+
- name: Run tests
3094+
working-directory: ./hindsight-integrations/continue
3095+
# PR CI runs only the deterministic bucket; the real-LLM E2E bucket
3096+
# (requires_real_llm) needs a live Hindsight server and runs separately.
3097+
run: uv run pytest tests -v -m "not requires_real_llm"
3098+
30573099
test-smolagents-integration:
30583100
needs: [detect-changes]
30593101
if: >-
@@ -4616,6 +4658,7 @@ jobs:
46164658
- test-integration
46174659
- test-ag2-integration
46184660
- test-autogen-integration
4661+
- test-continue-integration
46194662
- test-smolagents-integration
46204663
- test-dify-integration
46214664
- test-flowise-integration
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
sidebar_position: 36
3+
title: "Continue.dev Persistent Memory with Hindsight | Integration"
4+
description: "Add long-term memory to the Continue.dev coding assistant with Hindsight. Recall project memory into chat with @hindsight, plus optional automatic recall/retain via the Hindsight MCP server."
5+
---
6+
7+
# Continue
8+
9+
Long-term memory for the [Continue.dev](https://continue.dev) coding assistant, powered by [Hindsight](https://vectorize.io/hindsight). Recall relevant project memory directly into chat, and optionally let the agent recall and retain automatically in agent mode.
10+
11+
## How It Works
12+
13+
Continue has no hook that runs before a message is sent, but it supports two native extension points that `hindsight-continue` uses:
14+
15+
- **HTTP context provider (precise recall):** type `@hindsight <query>` (or a bare `@hindsight`) in Continue chat and relevant memory is recalled and injected into the model's context **at query time**. The package ships a small adapter server that implements Continue's HTTP context-provider contract (`{query, fullInput, options, workspacePath}` → context items) on top of Hindsight recall.
16+
- **MCP server + rules (automatic):** point Continue's agent mode at the Hindsight MCP server for `retain`/`recall`/`reflect` tools, with a rules file that instructs the agent to recall at the start of every task and retain durable facts.
17+
18+
Memory is scoped per **bank** — use one bank per project so context from one codebase doesn't leak into another.
19+
20+
## Setup
21+
22+
```bash
23+
pip install hindsight-continue
24+
```
25+
26+
Run the adapter, pointing it at your Hindsight instance and bank:
27+
28+
```bash
29+
export HINDSIGHT_API_KEY=hsk_...
30+
export HINDSIGHT_CONTINUE_BANK_ID=my-project
31+
hindsight-continue # serves on 127.0.0.1:8123
32+
```
33+
34+
Then register it in Continue's `config.yaml`:
35+
36+
```yaml
37+
context:
38+
- provider: http
39+
params:
40+
url: "http://127.0.0.1:8123/"
41+
title: hindsight
42+
displayTitle: Hindsight
43+
description: Recall long-term memory from Hindsight
44+
```
45+
46+
Use a [Hindsight Cloud](https://hindsight.vectorize.io) key, or point at a self-hosted server with `HINDSIGHT_API_URL=http://localhost:8888`.
47+
48+
## Automatic recall (optional)
49+
50+
For hands-off recall and retain in agent mode, wire the Hindsight MCP server into Continue and add a "recall first" rule. See the [`examples/.continue/`](https://github.com/vectorize-io/hindsight/tree/main/hindsight-integrations/continue/examples/.continue) assets in the integration directory.
51+
52+
## Limitation
53+
54+
Continue has no pre-prompt hook, so memory cannot be injected fully passively on every message. The `@hindsight` provider gives precise, query-time recall on demand; the MCP + rules setup gives automatic recall in agent mode, subject to the agent following the rule.

hindsight-docs/src/data/integrations.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@
150150
"link": "/sdks/integrations/codex",
151151
"icon": "/img/icons/codex.svg"
152152
},
153+
{
154+
"id": "continue",
155+
"name": "Continue",
156+
"description": "Long-term memory for the Continue.dev coding assistant. Recall relevant project memory into chat with @hindsight, plus optional automatic recall/retain via the Hindsight MCP server.",
157+
"type": "official",
158+
"by": "hindsight",
159+
"category": "tool",
160+
"link": "/sdks/integrations/continue",
161+
"icon": "/img/icons/continue.png"
162+
},
153163
{
154164
"id": "cursor",
155165
"name": "Cursor",
3.74 KB
Loading

hindsight-integrations/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Each integration lives in its own subdirectory with its own README, configuratio
1212
| [**OpenCode**](./opencode) | TypeScript plugin with retain/recall/reflect tools, auto-retain on idle, memory injection on session start, compaction preservation. | Add `@vectorize-io/opencode-hindsight` to `opencode.json` |
1313
| [**Codex CLI**](./codex) | Python hook scripts for OpenAI's Codex CLI. Auto-recall on `UserPromptSubmit`, auto-retain on `Stop`. | `curl -fsSL https://hindsight.vectorize.io/get-codex \| bash` |
1414
| [**Cursor CLI**](./cursor-cli) | Python hook scripts for Cursor CLI. Auto-recall on `beforeSubmitPrompt`, auto-retain on `stop`, final flush on `sessionEnd`. | `./scripts/install.sh` |
15+
| [**Continue.dev**](./continue) | HTTP context provider for precise `@hindsight` recall in chat, plus optional MCP-server + rules for automatic recall/retain in agent mode. | `pip install hindsight-continue` |
1516
| [**Roo Code**](./roo-code) | Persistent memory for Roo Code VS Code extension. | See README |
1617
| [**Hermes (OpenAI Agents SDK)**](./hermes) | Memory layer for OpenAI Agents SDK. | See README |
1718
| [**Grok Build**](./grok-build) | Hooks for Grok Build (xAI). | See README |
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# hindsight-continue
2+
3+
[Continue.dev](https://continue.dev) integration for [Hindsight](https://github.com/vectorize-io/hindsight) — persistent long-term memory for your coding assistant.
4+
5+
Continue has no plugin hook that runs before a message is sent, but it does
6+
support two native extension points that this integration uses:
7+
8+
1. **HTTP context provider** — type `@hindsight <query>` (or a bare `@hindsight`)
9+
in chat and relevant memory is recalled and injected into the model's context
10+
**at query time**. This package ships a tiny adapter server that implements
11+
Continue's HTTP context-provider contract on top of Hindsight recall.
12+
2. **MCP server + rules** (optional) — wire the Hindsight MCP server into
13+
Continue's agent mode for `retain`/`recall`/`reflect` tools, with a rules file
14+
that tells the agent to recall automatically.
15+
16+
## Prerequisites
17+
18+
- A running Hindsight instance ([self-hosted via Docker](https://github.com/vectorize-io/hindsight#quick-start) or [Hindsight Cloud](https://ui.hindsight.vectorize.io/signup))
19+
- Continue (VS Code or JetBrains extension)
20+
- Python 3.10+
21+
22+
## Installation
23+
24+
```bash
25+
pip install hindsight-continue
26+
```
27+
28+
## Quick start (HTTP context provider)
29+
30+
**1. Run the adapter**, pointing it at your Hindsight instance and bank:
31+
32+
```bash
33+
export HINDSIGHT_API_KEY=hsk_... # omit for a local self-hosted server
34+
export HINDSIGHT_API_URL=http://localhost:8888 # defaults to Hindsight Cloud
35+
export HINDSIGHT_CONTINUE_BANK_ID=my-project
36+
37+
hindsight-continue # serves on 127.0.0.1:8123
38+
```
39+
40+
**2. Register it** in Continue's `config.yaml` (`~/.continue/config.yaml` or a
41+
workspace `.continue` block):
42+
43+
```yaml
44+
context:
45+
- provider: http
46+
params:
47+
url: "http://127.0.0.1:8123/"
48+
title: hindsight
49+
displayTitle: Hindsight
50+
description: Recall long-term memory from Hindsight
51+
```
52+
53+
**3. Use it.** In Continue chat, type `@hindsight` (optionally followed by what
54+
you want to recall) and the matching memories are added to the model's context.
55+
56+
The adapter receives Continue's request (`{query, fullInput, options, workspacePath}`),
57+
recalls from Hindsight, and returns context items shaped `{name, description, content}` —
58+
exactly what Continue expects.
59+
60+
### Per-request bank override
61+
62+
The configured `HINDSIGHT_CONTINUE_BANK_ID` is the default. A request may target
63+
a different bank by sending `options.bankId`:
64+
65+
```yaml
66+
context:
67+
- provider: http
68+
params:
69+
url: "http://127.0.0.1:8123/"
70+
options:
71+
bankId: another-bank
72+
```
73+
74+
## Optional: automatic recall via MCP + rules
75+
76+
For hands-off recall/retain in **agent mode**, point Continue at the Hindsight
77+
MCP server and add a rule telling the agent to call it. Example assets are in
78+
[`examples/.continue/`](./examples/.continue):
79+
80+
- [`examples/.continue/mcpServers/hindsight.yaml`](./examples/.continue/mcpServers/hindsight.yaml) — the MCP server block
81+
- [`examples/.continue/rules/hindsight.md`](./examples/.continue/rules/hindsight.md) — "always recall first" rule
82+
83+
## Configuration
84+
85+
| Env var | Description | Default |
86+
| --- | --- | --- |
87+
| `HINDSIGHT_API_KEY` | Hindsight API key | _(none; required for Cloud)_ |
88+
| `HINDSIGHT_API_URL` | Hindsight API URL | `https://api.hindsight.vectorize.io` |
89+
| `HINDSIGHT_CONTINUE_BANK_ID` | Default memory bank to recall against | _(none)_ |
90+
| `HINDSIGHT_CONTINUE_HOST` | Adapter bind host | `127.0.0.1` |
91+
| `HINDSIGHT_CONTINUE_PORT` | Adapter listen port | `8123` |
92+
93+
These can also be set programmatically via `configure(...)`. See `hindsight-continue --help`
94+
for CLI flags.
95+
96+
## Development
97+
98+
```bash
99+
uv sync
100+
uv run pytest tests -v -m 'not requires_real_llm' # deterministic suite
101+
uv run pytest tests -v -m requires_real_llm # gated live E2E (needs a Hindsight server)
102+
```
103+
104+
## License
105+
106+
MIT
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Hindsight
2+
version: 0.0.1
3+
schema: v1
4+
mcpServers:
5+
# Hindsight Cloud (remote HTTP MCP). The bank is the last path segment;
6+
# change `my-project` to your bank, and replace the token with your API key.
7+
- name: Hindsight
8+
type: streamable-http
9+
url: https://api.hindsight.vectorize.io/mcp/my-project/
10+
requestOptions:
11+
headers:
12+
Authorization: "Bearer YOUR_HINDSIGHT_API_KEY"
13+
14+
# Self-hosted / local alternative. Start a local Hindsight first:
15+
# HINDSIGHT_API_LLM_API_KEY=sk-... uvx --from hindsight-api hindsight-local-mcp
16+
# then point Continue at its open MCP endpoint (no auth needed by default):
17+
# - name: Hindsight (local)
18+
# type: streamable-http
19+
# url: http://localhost:8888/mcp/my-project/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Hindsight memory
3+
alwaysApply: true
4+
---
5+
6+
You have a persistent long-term memory through the Hindsight MCP server.
7+
8+
- At the start of every task, call the `recall` tool with the user's request to
9+
retrieve relevant past decisions, preferences, and project context before you
10+
answer. Use what's relevant and ignore the rest.
11+
- When you learn a durable fact — an architectural decision, a user preference,
12+
a convention, or something worth remembering across sessions — call the
13+
`retain` tool to store it.
14+
- Do not mention these memory operations unless the user asks about them.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Hindsight-Continue: persistent memory for Continue.dev.
2+
3+
Exposes Hindsight memory to Continue through its native ``http`` context
4+
provider. Run the adapter server and point Continue at it; typing
5+
``@hindsight <query>`` (or a bare ``@hindsight``) recalls relevant long-term
6+
memory and injects it into the model's context at query time.
7+
8+
Basic usage::
9+
10+
from hindsight_continue import configure, run
11+
12+
configure(bank_id="my-project", api_key="hsk_...")
13+
run() # serves the context-provider endpoint on 127.0.0.1:8123
14+
15+
See the README for the matching Continue ``config.yaml`` snippet, plus the
16+
optional MCP-server + rules setup for automatic recall/retain in agent mode.
17+
"""
18+
19+
from .config import (
20+
HindsightContinueConfig,
21+
configure,
22+
get_config,
23+
reset_config,
24+
)
25+
from .errors import HindsightError
26+
from .provider import ContextItem, build_context_items, serialize
27+
from .server import build_server, make_handler, run
28+
29+
__version__ = "0.1.0"
30+
31+
__all__ = [
32+
"configure",
33+
"get_config",
34+
"reset_config",
35+
"HindsightContinueConfig",
36+
"HindsightError",
37+
"ContextItem",
38+
"build_context_items",
39+
"serialize",
40+
"build_server",
41+
"make_handler",
42+
"run",
43+
]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""Shared Hindsight client resolution logic."""
2+
3+
from __future__ import annotations
4+
5+
import os
6+
from importlib import metadata
7+
from typing import Any
8+
9+
from hindsight_client import Hindsight
10+
11+
from .config import DEFAULT_HINDSIGHT_API_URL, HINDSIGHT_API_KEY_ENV, get_config
12+
13+
try:
14+
_VERSION = metadata.version("hindsight-continue")
15+
except metadata.PackageNotFoundError:
16+
_VERSION = "0.0.0"
17+
_USER_AGENT = f"hindsight-continue/{_VERSION}"
18+
19+
20+
def resolve_client(
21+
client: Hindsight | None = None,
22+
hindsight_api_url: str | None = None,
23+
api_key: str | None = None,
24+
) -> Hindsight:
25+
"""Resolve a Hindsight client from explicit args or global config.
26+
27+
Falls back to the configured/default API URL and the ``HINDSIGHT_API_KEY``
28+
env var so the adapter works with nothing but the env var set. The API key
29+
is optional at construction time — a missing key only fails when a recall
30+
is actually made.
31+
"""
32+
if client is not None:
33+
return client
34+
35+
config = get_config()
36+
url = hindsight_api_url or config.hindsight_api_url or DEFAULT_HINDSIGHT_API_URL
37+
key = api_key or config.api_key or os.environ.get(HINDSIGHT_API_KEY_ENV)
38+
39+
kwargs: dict[str, Any] = {"base_url": url, "timeout": 30.0, "user_agent": _USER_AGENT}
40+
if key:
41+
kwargs["api_key"] = key
42+
return Hindsight(**kwargs)

0 commit comments

Comments
 (0)