openthink / home · think stamp ui-leaf audit @openthink/think · MIT
v0.0.0 think · MIT
[M]AIN
v0.0.0 · open source · MIT

continuous alignment
for agentic systems.

Before an agent acts, it thinks about your system. It recalls what's been decided, done, and learned across every session and machine you run. The think cli allows you to log retrospectives for codebase footguns and gotchas so your agents quit falling for them. Alignment at runtime is a context problem — and think provides injectable context through intelligent vector recall.

$npm install -g @openthink/think
requires Node 22.5+ · works with Claude Code out of the box

// one mind, many workers

your laptop — ship a feature, log it
$ think cortex setup --fs ~/Dropbox/think-cortex
Cortex folder: ~/Dropbox/think-cortex
$ think sync "rewrote auth middleware — AES-256-GCM for all session tokens"
[personal] 2026-07-04 17:41 stored memory
$ think sync "fixed race condition in token refresh — concurrent 401s resolved"
[personal] 2026-07-04 18:02 stored memory
your workstation — same folder, synced by Dropbox
$ think recall "auth"
── memories (2) ──
2026-07-04 Auth middleware rewritten — AES-256-GCM encryption for all
session tokens.
2026-07-04 Race condition in token refresh fixed — concurrent 401s
resolved by serializing rotation.
your agent on the workstation picks up where you left off
> Refactor the session middleware
 
! Before I refactor, I should note: I rewrote the auth middleware
on my laptop yesterday with AES-256-GCM and fixed a token refresh
race condition. Let me build on that rather than duplicate it.

// alignment, in practice

you say what you mean, not the whole procedure
> Merge the PR
the agent recalls how merges actually work here — and does what you meant
$ think recall "merge process"
── retros (1) ──
2026-05-25 Never plain-merge to main — merges here are stamp-gated:
stamp review → stamp status → stamp merge. An unsigned merge
commit breaks verification on the next PR.
 
! This repo gates merges through stamp — running the review flow
instead of a plain git merge.
$ stamp review --diff main..feature

"Merge the PR" meant stamp-gated merge — and the agent knew, because another session already learned it. An aligned agent does what you meant, not just what you typed: it doesn't contradict settled decisions, doesn't repeat a mistake another agent already made, and never needs the same correction twice.

// get started

Jump to install to set it up in 2 minutes, or read the concepts to understand the full pipeline.

// concepts

Memories are written when meaningful pieces of work are completed.
Retros capture what the agent would do different next time.
Cortex is a workspace that those memories and retros live in.
Recall injects memories and retros into a fresh agent.

[01]

memories

The primary write. Every think sync stores a memory directly to a local file. A background LLM folds each new entry into a single self-contained summary (write-time compaction), so every memory stands on its own and reads stay fast.

$ think sync "shipped auth refactor"
[personal] 2026-07-04 17:41 stored memory
[02]

retros

What an agent would do different next time, recorded where the next agent will find it. think retro captures a footgun, gotcha, or convention scoped to a codebase; think brief surfaces them at task start for whoever works there next — you, or an agent that has never run there before.

$ think retro "merges here are stamp-gated — never plain git merge to main"
[personal] (context: openthink-web) stored retro
[03]

cortex

The workspace your memories and retros live in. Each cortex is a named scope — personal, work — with its own local database and its own folder of JSONL files that propagates memories between your machines. You can have several and switch between them; the active cortex is where new writes land.

$ think cortex create personal
Created cortex: personal
$ think cortex switch work
Active cortex: work
[04]

recall

The read path. think recall pulls the memories and retros relevant to the task at hand — and agents don't have to ask: a UserPromptSubmit hook injects context at prompt-submit, and an MCP server gives any agent mid-turn recall. Reads are pure local lookups: sub-100 ms, offline, no model call.

$ think recall "token expiry edge case"
── memories (1) ──
2026-07-04 Auth refactor: AES-256-GCM for session tokens...
[05]

vector embedding

Why recall finds the right thing. Every entry is embedded with a local bge-small-en-v1.5 model and searched by semantic similarity, fused with BM25 keyword matching — the right memories come back even when the query shares no vocabulary with the stored text. A resident daemon keeps the model warm, and embeddings never leave your machine.

$ think daemon status
status=running · model loaded
socket=~/.think/daemon.sock
[06]

cloud

How one mind spans machines. Point your cortex at any folder you already sync (iCloud, Dropbox, Syncthing) and memories propagate on their own — or sync through a hub: self-host one against the open wire protocol, or use think cloud, the managed hub (coming soon). Local is the source of truth either way.

$ think cortex setup --fs ~/Dropbox/think-cortex
Cortex folder: ~/Dropbox/think-cortex

// architecture

Three stages, each with a clear job. Writes go through the daemon and get compacted. The local store answers every read. The cortex folder carries memories to your other machines.

+- write ------------------+      +- local store ------------+      +- propagation ------------+
|                          |      |                          |      |                          |
|  think sync              | ───>|  memories + events +     | ───>|  memories as .jsonl      |
|   → daemon (socket)     |      |  vector index, all in    |      |  in your cortex folder,  |
|   → compaction (LLM)    |      |  one SQLite file          |      |  synced via iCloud /     |
|                          |      |                          |      |  Dropbox / Syncthing /   |
|                          |      |  ~/.think/index/         |      |  Drive / any folder      |
|                          |      |     <cortex>.db          |      |                          |
+--------------------------+      +--------------------------+      +--------------------------+

Local-first by design. All reads and writes go to local SQLite. Pending events never leave the machine — only memories land in the cortex folder and propagate across machines. No server, no relay; the folder is the propagation layer.

// install

Two minutes from zero to persistent agent memory.

  1. Install & initialize

    $npm install -g @openthink/think
    $think init

    Requires Node 22.5+. think init writes auto-logging instructions into your project's CLAUDE.md — your agents start logging work immediately. The curator and summary features use the Claude Agent SDK and require a Claude subscription.

    Upgrading from v2? v3 reads v2 storage. First launch reindexes existing memories into the vector store automatically — no manual migration step.

  2. Point cortex at a folder

    $think cortex setup --fs ~/Dropbox/think-cortex
    $think cortex create personal

    A cortex is your AI's memory workspace. Pass --fs a path inside any sync tool you already use (iCloud, Dropbox, Google Drive, Syncthing) and the same memories will land on every machine you own. The folder is created if it doesn't exist. Skip --fs for offline-only.

    Already on a git-backed setup? think cortex setup <git-remote-url> is still supported and existing setups keep working unchanged — --fs is just the recommended path for new ones.

  3. You're done

    $think sync "shipped the feature"
    $think recall "what did I ship?"

    Agents log work with think sync — each entry is stored as a memory immediately, no curation step needed. Recall pulls it back next session. think cortex sync writes memories out to the folder so your other machines can pick them up.

// docs

Reference, source, and where to find help.

// all commands

think sync <message>           Record a memory (-e <key> to tag an episode)
think recall <query>           Search memories (semantic + keyword)
think memory                   Show memories (--history for timeline)
think list                     List entries (--week, --since, --category)
think summary                  AI summary (--raw for plain text)
think delete                   Soft-delete entries

think cortex setup [--fs <path> | <repo>]   Configure backend (or no args for offline)
think cortex create <name>     Create a cortex
think cortex list              Show all cortexes
think cortex switch <name>     Set active cortex
think cortex current           Show active cortex
think cortex push              Push local memories to the folder
think cortex pull              Pull memories from the folder
think cortex sync              Push + pull
think cortex status            Show sync state

think retro <content>          Record a durable repo-scoped lesson
think brief [query]            Task-start brief: context + repo retros
think event <message>          Record a long-term event (deploy, decision, milestone)
think long-term                Manage long-term memory events
think dashboard                Status dashboard with an AI prompt box
think pull <cortex>            Read memories from another cortex

think daemon                   Manage the resident daemon (start/stop/status)
think reindex [cortex]         Rebuild the vector index from the raw log
think hook                     Manage the Claude Code hook (install/uninstall)
think mcp                      Manage the MCP server (install/uninstall)

think curate                   Promote pending events into memories (--dry-run)
think curate --episode <key>   Curate an episode into a narrative memory
think curate --consolidate     Compress older memories into a summary
think monitor                  Show what got promoted vs dropped
think curator edit / show      Personal curator guidance

think pause / resume           Suppress / re-enable writes
think init                     Set up CLAUDE.md for auto-logging
think migrate-data             One-time import of git memories into SQLite
think log <message>            Log a pending event (deprecated — use sync)
think serve                    Boot the proxy for external event sources
think subscribe                Manage external-source subscriptions
think export / import          Sync bundles between devices
think audit                    Show sync audit log
think config show / set        View or update configuration
think update                   Update to latest version

// where things live

think · ready
↑↓nav select ggithub iinstall ?help