Skip to main content

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:

  1. Copies the hook scripts to ~/.cursor/hooks/cursor-cli/
  2. Writes ~/.cursor/hooks.json (merged with any existing entries) with absolute paths to the scripts
  3. Seeds ~/.hindsight/cursor-cli.json if it doesn't exist (drop your hindsightApiToken here 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hindsight_cursor_cli-0.3.0.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hindsight_cursor_cli-0.3.0-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

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

Hashes for hindsight_cursor_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5f5cc7eb4bb23a9ba80fea6b1e955c5eb7506b96e6124e0eeed438b5fa60ffc3
MD5 cc224a3f6f7ec2bf59cd79122064b34d
BLAKE2b-256 ad283c6c03fbd7476d5d51c4247793f4f134a7065a013e5a821cfbb253767fcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for hindsight_cursor_cli-0.3.0.tar.gz:

Publisher: release-integration.yml on vectorize-io/hindsight

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hindsight_cursor_cli-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hindsight_cursor_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6175133f74ae24fd37597caea598c7a3e7874c6ea7e1fe4d242bdae0ed2b23aa
MD5 a0f708a415c370f5a833073477f4c2a9
BLAKE2b-256 a9cca52cbcd486d9bc6bfdad3e53520f95ba281a00fc90645d6f30c3310868bd

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page