Skip to main content

Cline integration for Hindsight - persistent long-term memory via Cline lifecycle hooks

Project description

hindsight-cline

Persistent long-term memory for Cline via Hindsightno 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 TaskStart and UserPromptSubmit hooks recall relevant memories from Hindsight and inject them as context.
  • When a task ends — the TaskComplete (and TaskCancel) 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

  1. Start Hindsight (hindsight-api or Hindsight Cloud) and run hindsight-cline install with your URL/key.
  2. Enable hooks in Cline (Settings → Features → Hooks).
  3. Start a task — recalled memories appear in context as a <hindsight_memories> block.
  4. Complete a task, then check the cline bank (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


Download files

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

Source Distribution

hindsight_cline-0.2.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

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

hindsight_cline-0.2.0-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

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

Hashes for hindsight_cline-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15338cc5f82efd460e7ac568b99f2220577ca0d8eb378cde6d3b7bf68ba6d6e3
MD5 106e3fda0bda134bf6b826fe154f84bb
BLAKE2b-256 4dd2ebbb3ec0a67222a17d99c201805effb3e2a3c6c66a7d5beb7edb733de9d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for hindsight_cline-0.2.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_cline-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hindsight_cline-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86ab0f1dd980e987b2bc520f98916a6511774f783dd9a623efa6107700605984
MD5 48d92f149a9103f64ac19d350cc43dd7
BLAKE2b-256 6a1b0592d1d314f35d3ccadc502fcf19093f10fede78d3095ee202767486da0c

See more details on using hashes here.

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

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