Hindsight for GitHub Copilot CLI
Long-term memory for GitHub Copilot CLI — remembers your projects, preferences, and past sessions across every conversation, and gives subagents (explore, task, research, code-review, rubber-duck, security-review, custom agents) baseline project memory too.
How it works
Four Copilot CLI hooks keep memory in sync automatically:
| Hook | Action |
|---|---|
sessionStart |
Recalls relevant memories (using the queued prompt, or a project-derived fallback query) and injects them as additionalContext |
subagentStart |
Recalls memories for a spawned subagent (using the same fallback query — the payload never carries the subagent's specific task) and injects them as additionalContext |
agentStop |
Retains the conversation to long-term memory every configured N turns |
sessionEnd |
Forces a final retain (using the transcript path cached from the last agentStop) so short sessions are still stored |
Limitations
Copilot CLI's userPromptSubmitted and preToolUse hooks do not support injecting additionalContext — only sessionStart, subagentStart, postToolUse, and notification can. That means recall happens once per session start (and once per subagent spawn), not before every prompt. If your session runs long, memories recalled at the start may go stale; a postToolUse-based per-turn refresh is a documented possible follow-up, not implemented here.
The built-in general-purpose subagent does not emit subagentStart/subagentStop — it never receives injected memory from this integration.
subagentStop (retaining each subagent's own transcript) is intentionally not implemented in v1 — it risks duplicating content already captured by the parent session's agentStop, and adds noisy memories for short-lived exploratory subagents.
Requirements
- GitHub Copilot CLI with hooks support
- Python 3.9+ (for hook scripts; stdlib only — no pip install required)
- Hindsight: Hindsight Cloud or local
hindsight-embed
Installation
Sign up free at ui.hindsight.vectorize.io for a Hindsight Cloud API key — or run a local server.
pip install hindsight-copilot-cli
Then run the installer once:
# Hindsight Cloud
hindsight-copilot-cli install --api-url https://api.hindsight.vectorize.io --api-token your-api-key
# Local daemon (hindsight-embed) — omit the flags
hindsight-copilot-cli install
The installer:
- Copies the hook scripts to
~/.copilot/hindsight-copilot-cli/scripts/(or$COPILOT_HOME/hindsight-copilot-cli/scripts/ifCOPILOT_HOMEis set) - Writes a standalone
~/.copilot/hooks/hindsight-copilot-cli.jsonwith absolute paths to the scripts — Copilot CLI loads every*.jsonfile in its hooks directory, so this never needs to merge with other tools' hook files - Seeds
~/.hindsight/copilot-cli.jsonif it doesn't exist (drop yourhindsightApiTokenhere later)
Restart Copilot CLI to load the hooks. If memories are not recalled or retained, check that
~/.copilot/hooks/hindsight-copilot-cli.json exists and that python3 is on $PATH from your shell.
Repo-scope install (shared team hooks)
To register the hooks at the repository level instead (.github/hooks/hindsight-copilot-cli.json, so a team can check in shared hook config):
hindsight-copilot-cli install --scope repo
The hook scripts are still installed once per machine under ~/.copilot; only the registration
pointer is written to .github/hooks/hindsight-copilot-cli.json. Since that path is absolute and per-machine,
every teammate needs to run the installer locally too. Never commit an API token — set
HINDSIGHT_API_TOKEN in each environment instead.
Uninstall
hindsight-copilot-cli uninstall
# or, for a repo-scope install:
hindsight-copilot-cli uninstall --scope repo
This removes the hook scripts and the hindsight-copilot-cli.json registration file for the given scope. Your
personal config at ~/.hindsight/copilot-cli.json is preserved.
Configuration
Default config lives in ~/.copilot/hindsight-copilot-cli/settings.json. For personal overrides stable across updates, create ~/.hindsight/copilot-cli.json:
{
"hindsightApiUrl": "https://api.hindsight.vectorize.io",
"hindsightApiToken": "your-api-key",
"bankId": "my-copilot-memory"
}
Configuration options
| Key | Default | Description |
|---|---|---|
hindsightApiUrl |
"" |
External API URL (empty = local daemon) |
hindsightApiToken |
null |
API token for Hindsight Cloud |
bankId |
"copilot-cli" |
Memory bank identifier |
bankMission |
(set) | Guides what facts Hindsight retains |
autoRecall |
true |
Recall memories on sessionStart and subagentStart |
autoRetain |
true |
Store conversations after each turn |
retainMode |
"full-session" |
"full-session" or "chunked" |
retainEveryNTurns |
10 |
Retain every N turns (1 = every turn) |
retainToolCalls |
true |
Preserve tool calls/results as structured blocks when retaining |
recallFallbackQueryTemplate |
(set) | Query used when there's no specific prompt to recall against (interactive sessionStart with no queued prompt, or any subagentStart). {project} is replaced with the cwd basename |
recallBudget |
"mid" |
Recall depth: "low", "mid", "high" |
recallMaxTokens |
1024 |
Max tokens for injected memories |
recallTimeout |
10 |
Timeout in seconds for recall API calls |
dynamicBankId |
false |
Separate bank per project |
dynamicBankGranularity |
["agent", "project"] |
Fields for dynamic bank ID |
debug |
false |
Log debug info to stderr |
Environment variable overrides
All settings can also be set via environment variables:
export HINDSIGHT_API_URL=https://api.hindsight.vectorize.io
export HINDSIGHT_API_TOKEN=your-api-key
export HINDSIGHT_BANK_ID=my-project
export HINDSIGHT_RECALL_TIMEOUT=30
export HINDSIGHT_DEBUG=true
How memory works
Recall — on sessionStart, Hindsight searches your memory bank for facts relevant to the queued prompt (or a generic project-context query when there isn't one) and injects them as additionalContext. The same happens on subagentStart for every subagent spawned during the session, since subagents otherwise run in a fully isolated context with no access to the parent session's memory.
Retain — after configured turns (agentStop) and again when the session ends (sessionEnd), the session transcript is read from Copilot CLI's transcriptPath and stored to Hindsight. The memory engine extracts facts, relationships, and experiences — so you don't need to re-explain your stack, preferences, or past decisions.
Dynamic bank IDs
To keep separate memory per project:
{
"dynamicBankId": true,
"dynamicBankGranularity": ["agent", "project"]
}
This creates banks like copilot-cli::my-project automatically, deriving the project name from the cwd field every Copilot CLI hook payload carries.
Troubleshooting
Memory not appearing: enable debug mode ("debug": true) and check that HINDSIGHT_API_URL points to a reachable server. Logs go to ~/.hindsight/copilot-cli/state/*.log when debug is on and stderr is redirected — otherwise check the hook's stderr directly via Copilot CLI's own debug output.
Hooks not firing: check that ~/.copilot/hooks/hindsight-copilot-cli.json (or .github/hooks/hindsight-copilot-cli.json for repo scope) is valid JSON. Copilot CLI loads hook configuration when it starts, so restart the CLI after installing or updating hooks.
Subagents not getting memory: the built-in general-purpose agent never emits subagentStart — this is a Copilot CLI limitation, not a bug in this integration. All other built-in agents (explore, task, code-review, rubber-duck, research, security-review) and custom agents do emit it.
Development
cd hindsight-integrations/copilot-cli
uv sync
uv run pytest tests/ -v
The tests mock the HTTP client, the stdin/stdout pipe, and the file-based state. No live Hindsight server or Copilot CLI installation is required.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hindsight_copilot_cli-0.1.1.tar.gz.
File metadata
- Download URL: hindsight_copilot_cli-0.1.1.tar.gz
- Upload date:
- Size: 40.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9662d9e36190de05d1cd893788e9777b53b66adbee0cefb7d1ebae1a0bad5f19
|
|
| MD5 |
4f528a5a2cd54af709df66965e8f981b
|
|
| BLAKE2b-256 |
f896fb29b721d737950dce9799d326642587e920d88d5648376cbcb34a4021d4
|
Provenance
The following attestation bundles were made for hindsight_copilot_cli-0.1.1.tar.gz:
Publisher:
release-integration.yml on vectorize-io/hindsight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hindsight_copilot_cli-0.1.1.tar.gz -
Subject digest:
9662d9e36190de05d1cd893788e9777b53b66adbee0cefb7d1ebae1a0bad5f19 - Sigstore transparency entry: 2292606921
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@53325898e6d816d3ac029f8b5818542712c8149f -
Branch / Tag:
refs/tags/integrations/copilot-cli/v0.1.1 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@53325898e6d816d3ac029f8b5818542712c8149f -
Trigger Event:
push
-
Statement type:
File details
Details for the file hindsight_copilot_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: hindsight_copilot_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 40.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab8860d2949dff9f0de7a06752e8a260a9861330baf9390673dca24ab9b37ea4
|
|
| MD5 |
6b75c70d82850aa992985aea4676d558
|
|
| BLAKE2b-256 |
6839de693786fbe126c3f2c2a555730de0e9c8e7a2ad6ba306311c09902ca2dc
|
Provenance
The following attestation bundles were made for hindsight_copilot_cli-0.1.1-py3-none-any.whl:
Publisher:
release-integration.yml on vectorize-io/hindsight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hindsight_copilot_cli-0.1.1-py3-none-any.whl -
Subject digest:
ab8860d2949dff9f0de7a06752e8a260a9861330baf9390673dca24ab9b37ea4 - Sigstore transparency entry: 2292607006
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@53325898e6d816d3ac029f8b5818542712c8149f -
Branch / Tag:
refs/tags/integrations/copilot-cli/v0.1.1 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@53325898e6d816d3ac029f8b5818542712c8149f -
Trigger Event:
push
-
Statement type: