Cursor CLI integration for Hindsight - persistent long-term memory via Cursor CLI hooks
Project description
Hindsight for Cursor CLI
Long-term memory for Cursor CLI — remembers your projects, preferences, and past sessions across every conversation.
How it works
Four Cursor CLI hooks keep memory in sync automatically:
| Hook | Action |
|---|---|
sessionStart |
Confirms Hindsight is reachable and pre-warms the local daemon if needed |
beforeSubmitPrompt |
Recalls relevant memories and injects them as additional_context |
stop |
Retains the conversation to long-term memory every configured N turns |
sessionEnd |
Forces a final retain so short sessions are still stored |
Requirements
- Cursor CLI v0.45+ 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-cursor-cli
Then run the installer once:
# Hindsight Cloud
hindsight-cursor-cli install --api-url https://api.hindsight.vectorize.io --api-token your-api-key
# Local daemon (hindsight-embed) — omit the flags
hindsight-cursor-cli install
The installer:
- Copies the hook scripts to
~/.cursor/hooks/cursor-cli/ - Writes
~/.cursor/hooks.json(merged with any existing entries) with absolute paths to the scripts - Seeds
~/.hindsight/cursor-cli.jsonif it doesn't exist (drop yourhindsightApiTokenhere later)
Restart Cursor CLI to load the hooks. If memories are not recalled or retained, check that
~/.cursor/hooks.json exists and that python3 is on $PATH from your shell.
Uninstall
hindsight-cursor-cli uninstall
This removes the hook scripts and strips Hindsight's entries from ~/.cursor/hooks.json. Your
personal config at ~/.hindsight/cursor-cli.json is preserved.
Configuration
Default config lives in ~/.cursor/hooks/cursor-cli/settings.json. For personal overrides stable across updates, create ~/.hindsight/cursor-cli.json:
{
"hindsightApiUrl": "https://api.hindsight.vectorize.io",
"hindsightApiToken": "your-api-key",
"bankId": "my-cursor-memory"
}
Configuration options
| Key | Default | Description |
|---|---|---|
hindsightApiUrl |
"" |
External API URL (empty = local daemon) |
hindsightApiToken |
null |
API token for Hindsight Cloud |
bankId |
"cursor-cli" |
Memory bank identifier |
bankMission |
(set) | Guides what facts Hindsight retains |
autoRecall |
true |
Inject memories before each prompt |
autoRetain |
true |
Store conversations after each turn |
retainMode |
"full-session" |
"full-session" or "chunked" |
retainEveryNTurns |
10 |
Retain every N turns (1 = every turn) |
includeTools |
false |
Surface tool calls as [tool_use:name]/[tool_result] markers in the plain-text transcript (recall queries; retain when tool calls aren't already stored as blocks) |
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 — before each prompt, Hindsight searches your memory bank for facts relevant to what you're about to ask. Found memories are injected as additional_context so the agent has continuity across sessions.
Retain — after configured turns and again when the session ends, Cursor's conversation transcript is 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 cursor-cli::my-project automatically, using either CURSOR_PROJECT_DIR (Cursor's env var) or the first entry of workspace_roots from the hook's common input fields.
To share memory across all worktrees of the same repo, use gitProject instead of project:
{
"dynamicBankId": true,
"dynamicBankGranularity": ["agent", "gitProject"]
}
Troubleshooting
No "Hindsight is active" note on session start: run with "debug": true (or HINDSIGHT_DEBUG=true) and check stderr.
Memory not appearing: enable debug mode ("debug": true) and check that HINDSIGHT_API_URL points to a reachable server.
Hooks not firing: check that ~/.cursor/hooks.json is valid JSON and contains the four hook entries. Cursor CLI requires a session restart to pick up new hooks.
Development
cd hindsight-integrations/cursor-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 is required.
License
MIT
Project details
Release history Release notifications | RSS feed
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_cursor_cli-0.3.0.tar.gz.
File metadata
- Download URL: hindsight_cursor_cli-0.3.0.tar.gz
- Upload date:
- Size: 35.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f5cc7eb4bb23a9ba80fea6b1e955c5eb7506b96e6124e0eeed438b5fa60ffc3
|
|
| MD5 |
cc224a3f6f7ec2bf59cd79122064b34d
|
|
| BLAKE2b-256 |
ad283c6c03fbd7476d5d51c4247793f4f134a7065a013e5a821cfbb253767fcb
|
Provenance
The following attestation bundles were made for hindsight_cursor_cli-0.3.0.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_cursor_cli-0.3.0.tar.gz -
Subject digest:
5f5cc7eb4bb23a9ba80fea6b1e955c5eb7506b96e6124e0eeed438b5fa60ffc3 - Sigstore transparency entry: 2020134813
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@6e18858e3221294e1cebb808c7d9ccea74e98c61 -
Branch / Tag:
refs/tags/integrations/cursor-cli/v0.3.0 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@6e18858e3221294e1cebb808c7d9ccea74e98c61 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hindsight_cursor_cli-0.3.0-py3-none-any.whl.
File metadata
- Download URL: hindsight_cursor_cli-0.3.0-py3-none-any.whl
- Upload date:
- Size: 35.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6175133f74ae24fd37597caea598c7a3e7874c6ea7e1fe4d242bdae0ed2b23aa
|
|
| MD5 |
a0f708a415c370f5a833073477f4c2a9
|
|
| BLAKE2b-256 |
a9cca52cbcd486d9bc6bfdad3e53520f95ba281a00fc90645d6f30c3310868bd
|
Provenance
The following attestation bundles were made for hindsight_cursor_cli-0.3.0-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_cursor_cli-0.3.0-py3-none-any.whl -
Subject digest:
6175133f74ae24fd37597caea598c7a3e7874c6ea7e1fe4d242bdae0ed2b23aa - Sigstore transparency entry: 2020134960
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@6e18858e3221294e1cebb808c7d9ccea74e98c61 -
Branch / Tag:
refs/tags/integrations/cursor-cli/v0.3.0 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@6e18858e3221294e1cebb808c7d9ccea74e98c61 -
Trigger Event:
push
-
Statement type: