Skip to content

Commit 91bf328

Browse files
DK09876claude
andauthored
feat(github-copilot): add GitHub Copilot (VS Code) integration via MCP (#2299)
Adds hindsight-copilot: long-term memory for GitHub Copilot in VS Code, using Copilot agent mode's native MCP support (HTTP servers) — no bridge. `hindsight-copilot init`: - merges a Hindsight HTTP MCP server into .vscode/mcp.json (servers.hindsight), JSON-safe (prints a snippet if the file is JSONC), and - writes a recall/retain rule into .github/copilot-instructions.md, which Copilot applies to every chat in the workspace. Resolves the ask in #1588. Mirrors the Zed/OpenHands MCP-config pattern. - hindsight_copilot package: config, mcp_config (.vscode/mcp.json writer), instructions (copilot-instructions.md rule), cli (init/status/uninstall) - 25 deterministic tests (mcp.json merge incl. preserving servers/inputs + JSONC fallback, instructions rule block) + gated requires_real_llm MCP handshake E2E - CI job, release registration (VALID_INTEGRATIONS + changelog generator), docs page, registry entry, icon (octicons), README row Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e4afa5a commit 91bf328

22 files changed

Lines changed: 1197 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
integrations-claude-code: ${{ steps.filter.outputs.integrations-claude-code }}
3939
integrations-cline: ${{ steps.filter.outputs.integrations-cline }}
4040
integrations-codex: ${{ steps.filter.outputs.integrations-codex }}
41+
integrations-github-copilot: ${{ steps.filter.outputs.integrations-github-copilot }}
4142
integrations-continue: ${{ steps.filter.outputs.integrations-continue }}
4243
integrations-cursor-cli: ${{ steps.filter.outputs.integrations-cursor-cli }}
4344
integrations-crewai: ${{ steps.filter.outputs.integrations-crewai }}
@@ -143,6 +144,8 @@ jobs:
143144
- 'hindsight-integrations/cline/**'
144145
integrations-codex:
145146
- 'hindsight-integrations/codex/**'
147+
integrations-github-copilot:
148+
- 'hindsight-integrations/github-copilot/**'
146149
integrations-continue:
147150
- 'hindsight-integrations/continue/**'
148151
integrations-cursor-cli:
@@ -591,6 +594,45 @@ jobs:
591594
working-directory: ./hindsight-integrations/cline
592595
run: uv run pytest tests -v
593596

597+
test-github-copilot-integration:
598+
needs: [detect-changes]
599+
if: >-
600+
(github.event_name == 'workflow_dispatch' ||
601+
needs.detect-changes.outputs.integrations-github-copilot == 'true' ||
602+
needs.detect-changes.outputs.ci == 'true')
603+
runs-on: ubuntu-latest
604+
timeout-minutes: 30
605+
606+
steps:
607+
- uses: actions/checkout@v6
608+
with:
609+
ref: ${{ github.event.pull_request.head.sha || '' }}
610+
611+
- name: Install uv
612+
uses: astral-sh/setup-uv@v7
613+
with:
614+
enable-cache: true
615+
prune-cache: false
616+
617+
- name: Set up Python
618+
uses: actions/setup-python@v6
619+
with:
620+
python-version-file: ".python-version"
621+
622+
- name: Build github-copilot integration
623+
working-directory: ./hindsight-integrations/github-copilot
624+
run: uv build
625+
626+
- name: Install dependencies
627+
working-directory: ./hindsight-integrations/github-copilot
628+
run: uv sync --frozen
629+
630+
- name: Run tests
631+
working-directory: ./hindsight-integrations/github-copilot
632+
# PR CI runs only the deterministic bucket; the real-LLM E2E bucket
633+
# (requires_real_llm) needs a live Hindsight server and runs separately.
634+
run: uv run pytest tests -v -m "not requires_real_llm"
635+
594636
test-codex-integration:
595637
needs: [detect-changes]
596638
if: >-
@@ -4788,6 +4830,7 @@ jobs:
47884830
- test-claude-code-integration
47894831
- test-cursor-integration
47904832
- test-cline-integration
4833+
- test-github-copilot-integration
47914834
- test-codex-integration
47924835
- test-cursor-cli-integration
47934836
- build-ai-sdk-integration

hindsight-dev/hindsight_dev/generate_changelog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class IntegrationMeta:
5353
"claude-agent-sdk": IntegrationMeta("hindsight-claude-agent-sdk", "Claude Agent SDK"),
5454
"llamaindex": IntegrationMeta("hindsight-llamaindex", "LlamaIndex"),
5555
"codex": IntegrationMeta("hindsight-codex", "Codex"),
56+
"github-copilot": IntegrationMeta("hindsight-copilot", "GitHub Copilot"),
5657
"cline": IntegrationMeta("hindsight-cline", "Cline"),
5758
"cursor-cli": IntegrationMeta("hindsight-cursor-cli", "Cursor CLI"),
5859
"cursor": IntegrationMeta("hindsight-cursor", "Cursor"),
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
sidebar_position: 39
3+
title: "GitHub Copilot Persistent Memory with Hindsight | Integration"
4+
description: "Add long-term memory to GitHub Copilot in VS Code with Hindsight via MCP. One command wires up the Hindsight MCP server plus a recall/retain rule."
5+
---
6+
7+
# GitHub Copilot
8+
9+
Long-term memory for [GitHub Copilot](https://github.com/features/copilot) in VS Code, powered by [Hindsight](https://vectorize.io/hindsight). One command connects Copilot's agent mode to the Hindsight MCP server and adds a recall/retain rule — so Copilot recalls relevant memory at the start of a task and retains durable facts as it works.
10+
11+
## How It Works
12+
13+
VS Code Copilot supports two things this integration uses:
14+
15+
- **MCP servers** via `.vscode/mcp.json` (agent mode), including **HTTP servers** with headers — so the Hindsight MCP endpoint connects directly:
16+
17+
```json
18+
{
19+
"servers": {
20+
"hindsight": {
21+
"type": "http",
22+
"url": "https://api.hindsight.vectorize.io/mcp/my-project/",
23+
"headers": { "Authorization": "Bearer hsk_..." }
24+
}
25+
}
26+
}
27+
```
28+
29+
- **`.github/copilot-instructions.md`**, which Copilot applies to every chat in the workspace — that's where the recall/retain rule lives.
30+
31+
## Setup
32+
33+
```bash
34+
pip install hindsight-copilot
35+
cd your-project
36+
hindsight-copilot init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-project
37+
```
38+
39+
`init` merges the `servers` entry into `./.vscode/mcp.json` and writes the rule into `./.github/copilot-instructions.md`. Reload VS Code, open Copilot Chat in **agent mode**, and start the `hindsight` MCP server from the chat's tools menu.
40+
41+
Use a [Hindsight Cloud](https://hindsight.vectorize.io) key, or a self-hosted server with `--api-url http://localhost:8888` (no token needed for an open local server). If `mcp.json` has comments, `init` prints the snippet to paste instead — or run `hindsight-copilot init --print-only` anytime.
42+
43+
## Commands
44+
45+
| Command | Description |
46+
| --- | --- |
47+
| `hindsight-copilot init` | Add the MCP server + recall/retain rule |
48+
| `hindsight-copilot status` | Show whether the server + rule are configured |
49+
| `hindsight-copilot uninstall` | Remove the server + rule |
50+
51+
See the [package README](https://github.com/vectorize-io/hindsight/tree/main/hindsight-integrations/github-copilot) for full configuration options.

hindsight-docs/src/data/integrations.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@
170170
"link": "/sdks/integrations/codex",
171171
"icon": "/img/icons/codex.svg"
172172
},
173+
{
174+
"id": "github-copilot",
175+
"name": "GitHub Copilot",
176+
"description": "Long-term memory for GitHub Copilot in VS Code. One command wires the Hindsight MCP server into .vscode/mcp.json plus a recall/retain rule in .github/copilot-instructions.md.",
177+
"type": "official",
178+
"by": "hindsight",
179+
"category": "tool",
180+
"link": "/sdks/integrations/github-copilot",
181+
"icon": "/img/icons/github-copilot.svg"
182+
},
173183
{
174184
"id": "continue",
175185
"name": "Continue",
Lines changed: 1 addition & 0 deletions
Loading

hindsight-integrations/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Each integration lives in its own subdirectory with its own README, configuratio
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` |
1515
| [**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` |
16+
| [**GitHub Copilot**](./github-copilot) | MCP server config (`.vscode/mcp.json`) + a recall/retain rule for VS Code Copilot's agent mode. | `pip install hindsight-copilot` |
1617
| [**Roo Code**](./roo-code) | Persistent memory for Roo Code VS Code extension. | See README |
1718
| [**Hermes (OpenAI Agents SDK)**](./hermes) | Memory layer for OpenAI Agents SDK. | See README |
1819
| [**Grok Build**](./grok-build) | Hooks for Grok Build (xAI). | See README |
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# hindsight-copilot
2+
3+
Long-term memory for **GitHub Copilot** in VS Code, powered by [Hindsight](https://github.com/vectorize-io/hindsight).
4+
5+
`hindsight-copilot init` wires the Hindsight **MCP server** into VS Code's
6+
`.vscode/mcp.json` and adds a recall/retain rule to `.github/copilot-instructions.md`.
7+
Copilot's agent mode then has `recall` / `retain` / `reflect` tools and — guided
8+
by the rule — recalls relevant memory at the start of a task and retains durable
9+
facts as it works.
10+
11+
## How it works
12+
13+
VS Code Copilot supports two things this integration uses:
14+
15+
- **MCP servers** in `.vscode/mcp.json` (agent mode), including **HTTP servers**
16+
with headers — so the Hindsight MCP endpoint connects directly:
17+
18+
```json
19+
{
20+
"servers": {
21+
"hindsight": {
22+
"type": "http",
23+
"url": "https://api.hindsight.vectorize.io/mcp/my-project/",
24+
"headers": { "Authorization": "Bearer hsk_..." }
25+
}
26+
}
27+
}
28+
```
29+
30+
- **`.github/copilot-instructions.md`**, which Copilot applies to every chat in
31+
the workspace — that's where the recall/retain rule lives.
32+
33+
## Install
34+
35+
```bash
36+
pip install hindsight-copilot
37+
cd your-project
38+
hindsight-copilot init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-project
39+
```
40+
41+
`init` merges the `servers` entry into `./.vscode/mcp.json` and writes the rule
42+
into `./.github/copilot-instructions.md`. Reload VS Code, open Copilot Chat in
43+
**agent mode**, and start the `hindsight` MCP server from the chat's tools menu.
44+
45+
Use a [Hindsight Cloud](https://hindsight.vectorize.io) key, or a self-hosted
46+
server with `--api-url http://localhost:8888` (no token needed for an open local
47+
server). If `mcp.json` has comments, `init` prints the snippet to paste instead
48+
of touching the file — or run `hindsight-copilot init --print-only` anytime.
49+
50+
## Commands
51+
52+
| Command | Description |
53+
| --- | --- |
54+
| `hindsight-copilot init` | Add the MCP server + recall/retain rule |
55+
| `hindsight-copilot status` | Show whether the server + rule are configured |
56+
| `hindsight-copilot uninstall` | Remove the server + rule |
57+
58+
## Configuration
59+
60+
| Setting | Env var | Default |
61+
| --- | --- | --- |
62+
| API URL | `HINDSIGHT_API_URL` | `https://api.hindsight.vectorize.io` |
63+
| API token | `HINDSIGHT_API_TOKEN` | _(none; required for Cloud)_ |
64+
| Bank id | `HINDSIGHT_COPILOT_BANK_ID` | `copilot` |
65+
66+
## Development
67+
68+
```bash
69+
uv sync
70+
uv run pytest tests -v -m 'not requires_real_llm' # deterministic suite
71+
uv run pytest tests -v -m requires_real_llm # gated MCP-endpoint check
72+
```
73+
74+
## License
75+
76+
MIT
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Hindsight memory integration for GitHub Copilot (VS Code).
2+
3+
Wires the Hindsight MCP server into VS Code's ``.vscode/mcp.json`` and writes a
4+
recall/retain rule into ``.github/copilot-instructions.md``, so Copilot's agent
5+
mode has ``recall``/``retain``/``reflect`` tools and uses them automatically.
6+
7+
CLI::
8+
9+
hindsight-copilot init --api-token hsk_... --bank-id my-project
10+
"""
11+
12+
__version__ = "0.1.0"

0 commit comments

Comments
 (0)