Cline integration for Hindsight - persistent long-term memory via Cline lifecycle hooks
Project description
hindsight-cline
Persistent long-term memory for Cline via Hindsight — no MCP required.
Cline's lifecycle hooks run small scripts at key moments. This integration installs hooks that automatically recall relevant memories before Cline works and retain what happened when a task ends. Memory persists across sessions, so Cline builds on past context instead of starting cold.
What It Does
- Before a task / each message — the
TaskStartandUserPromptSubmithooks recall relevant memories from Hindsight and inject them as context. - When a task ends — the
TaskComplete(andTaskCancel) hook retains the task's prompts and summary for future sessions. - Deterministic — because it runs on hooks, memory happens automatically; it doesn't depend on the model deciding to call a tool (no MCP).
Prerequisites
✨ Recommended: Hindsight Cloud — sign up free, get an API key, and skip self-hosting.
Self-hosting alternative:
pip install hindsight-all
export HINDSIGHT_API_LLM_API_KEY=your-openai-key
hindsight-api # starts on http://localhost:8888
Platform: Cline hooks run on macOS and Linux only (no Windows). Hooks need Python 3.
Installation
pip install hindsight-cline
Then, from your project directory:
hindsight-cline install --api-url https://api.hindsight.vectorize.io --api-token YOUR_KEY
Install globally (applies to all projects):
hindsight-cline install --global --api-url https://api.hindsight.vectorize.io --api-token YOUR_KEY
To remove it later: hindsight-cline uninstall (add --global if you installed globally).
This copies four hook scripts (TaskStart, UserPromptSubmit, TaskComplete, TaskCancel) plus their lib/ and settings.json into:
.clinerules/hooks/(project install — commit it to share with your team), or~/Documents/Cline/Rules/Hooks/(global install).
Final step — enable hooks in Cline: Settings → Features → Hooks.
How It Works
Task starts ─ TaskStart ─────────► recall(task description) → inject memories
You send a message ─ UserPromptSubmit ─► recall(prompt) → inject memories
(and append the prompt to the task transcript)
Task completes ─ TaskComplete ──► retain(accumulated transcript + summary)
Task cancelled ─ TaskCancel ────► retain(partial transcript)
Cline doesn't hand hooks a conversation transcript, so the integration accumulates each task's prompts in ~/.hindsight/cline/state/ and retains them at task end. Memories land in a single bank (cline by default).
Configuration
Defaults live in the installed settings.json; put personal overrides in ~/.hindsight/cline.json (stable across reinstalls). Common keys:
| Setting | Default | Description |
|---|---|---|
hindsightApiUrl |
(empty) | Hindsight server URL. Empty → use a local server on apiPort. |
hindsightApiToken |
null |
API key for Hindsight Cloud. |
bankId |
cline |
Memory bank for this integration. |
autoRecall |
true |
Inject memories before tasks/prompts. |
autoRetain |
true |
Retain the task transcript when it ends. |
recallBudget |
mid |
Recall depth: low / mid / high. |
recallTypes |
["world","experience"] |
Memory types to recall. |
dynamicBankId |
false |
Separate bank per project/session (see dynamicBankGranularity). |
debug |
false |
Log to stderr. |
Every key can also be set via HINDSIGHT_* environment variables (e.g. HINDSIGHT_BANK_ID, HINDSIGHT_AUTO_RECALL=false).
Verifying Setup
- Start Hindsight (
hindsight-apior Hindsight Cloud) and runhindsight-cline installwith your URL/key. - Enable hooks in Cline (Settings → Features → Hooks).
- Start a task — recalled memories appear in context as a
<hindsight_memories>block. - Complete a task, then check the
clinebank (via the API or dashboard) — a memory should appear.
You can smoke-test a hook without Cline:
echo '{"hookName":"UserPromptSubmit","prompt":"how do we authenticate?","taskId":"t1","workspaceRoots":["/tmp/x"]}' \
| .clinerules/hooks/UserPromptSubmit
# → {"cancel": false, "contextModification": "<hindsight_memories>…", "errorMessage": ""}
Development
uv sync
uv run pytest tests/ -v
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_cline-0.2.0.tar.gz.
File metadata
- Download URL: hindsight_cline-0.2.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15338cc5f82efd460e7ac568b99f2220577ca0d8eb378cde6d3b7bf68ba6d6e3
|
|
| MD5 |
106e3fda0bda134bf6b826fe154f84bb
|
|
| BLAKE2b-256 |
4dd2ebbb3ec0a67222a17d99c201805effb3e2a3c6c66a7d5beb7edb733de9d5
|
Provenance
The following attestation bundles were made for hindsight_cline-0.2.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_cline-0.2.0.tar.gz -
Subject digest:
15338cc5f82efd460e7ac568b99f2220577ca0d8eb378cde6d3b7bf68ba6d6e3 - Sigstore transparency entry: 1768617594
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@4cb78173ba8da96471769e03309b2c1641dc1279 -
Branch / Tag:
refs/tags/integrations/cline/v0.2.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@4cb78173ba8da96471769e03309b2c1641dc1279 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hindsight_cline-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hindsight_cline-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.6 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 |
86ab0f1dd980e987b2bc520f98916a6511774f783dd9a623efa6107700605984
|
|
| MD5 |
48d92f149a9103f64ac19d350cc43dd7
|
|
| BLAKE2b-256 |
6a1b0592d1d314f35d3ccadc502fcf19093f10fede78d3095ee202767486da0c
|
Provenance
The following attestation bundles were made for hindsight_cline-0.2.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_cline-0.2.0-py3-none-any.whl -
Subject digest:
86ab0f1dd980e987b2bc520f98916a6511774f783dd9a623efa6107700605984 - Sigstore transparency entry: 1768617953
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@4cb78173ba8da96471769e03309b2c1641dc1279 -
Branch / Tag:
refs/tags/integrations/cline/v0.2.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@4cb78173ba8da96471769e03309b2c1641dc1279 -
Trigger Event:
push
-
Statement type: