Skip to main content
Hindsight is State-of-the-Art on Memory for AI Agents | Read the paper β†’
πŸ€–
Using a coding agent? Run this to install the Hindsight docs skill:
npx skills add https://github.com/vectorize-io/hindsight --skill hindsight-docs

OMO (oh-my-openagent)

View Changelog β†’

Persistent memory for oh-my-openagent (OMO) using Hindsight. Five lifecycle hooks automatically recall relevant context before each prompt and retain conversations after each turn β€” no changes to your OMO workflow required.

Quick Start​

Recommended: Hindsight Cloud

Sign up free for a Hindsight Cloud API key β€” no self-hosting, no local daemon to manage.

From the hindsight-integrations/omo/ directory:

# Hooks (global)
mkdir-p ~/.omo/hooks
cp hooks/hooks.json ~/.omo/hooks/hindsight-hooks.json

# Scripts + settings (global)
mkdir-p ~/.omo/plugins/hindsight/scripts
cp-r scripts/ ~/.omo/plugins/hindsight/scripts/
cp settings.json ~/.omo/plugins/hindsight/settings.json

# Rules (per-project β€” run from your project root)
mkdir-p .omo/rules
cp rules/hindsight-memory.md .omo/rules/hindsight-memory.md

Then set your API key:

exportHINDSIGHT_API_TOKEN=hsk_your_key_here

Add env vars to OMO's allowlist in ~/.config/opencode/oh-my-openagent.jsonc:

{
"mcp_env_allowlist": [
"HINDSIGHT_API_URL",
"HINDSIGHT_API_TOKEN",
"HINDSIGHT_BANK_ID"
]
}

Start a new OMO session β€” memory is live.

Features​

  • Auto-recall β€” on every user prompt, queries Hindsight for relevant memories and injects them as additionalContext (invisible to the transcript, visible to OMO)
  • Auto-retain β€” after each OMO response and sub-agent stop, stores the conversation transcript to Hindsight for future recall
  • Sub-agent capture β€” SubagentStop hook captures learnings from OMO's delegated sub-agents (Claude Code, Codex, OpenCode)
  • Dynamic bank IDs β€” supports per-project memory isolation based on the working directory
  • Session-level upsert β€” uses the session ID as the document ID so re-running the same session updates rather than duplicates stored content
  • Cloud-first β€” defaults to Hindsight Cloud with no local daemon to manage
  • Zero dependencies β€” pure Python stdlib, no pip install required

Architecture​

The plugin uses five OMO hook events:

HookEventPurpose
session_start.pySessionStartWarm up β€” verify Hindsight is reachable
recall.pyUserPromptSubmitAuto-recall β€” query memories, inject as additionalContext
retain.pyStopAuto-retain β€” extract transcript, POST to Hindsight (async)
retain.pySubagentStopSub-agent retain β€” capture delegated sub-agent learnings
session_end.pySessionEndForce final retain for short sessions

On UserPromptSubmit, the hook reads the prompt, queries Hindsight for the most relevant memories, and outputs a hookSpecificOutput.additionalContext block. OMO prepends this to the conversation before sending it to the model:

<hindsight_memories>
Relevant memories from past conversations...
Current time - 2026εΉ΄06月08ζ—₯ 14:30

- Project uses FastAPI with asyncpg β€” not SQLAlchemy [world] (2026εΉ΄06月07ζ—₯)
- Preferred testing framework: pytest with pytest-asyncio [experience] (2026εΉ΄06月07ζ—₯)
</hindsight_memories>

On Stop and SubagentStop, the hook reads the session transcript, strips previously injected memory tags (to prevent feedback loops), and POSTs the conversation to Hindsight asynchronously.

Connection Modes​

No setup beyond an API key:

{
"hindsightApiUrl":"https://api.hindsight.vectorize.io",
"hindsightApiToken":"hsk_your_token"
}

2. Self-Hosted​

Point at your own Hindsight instance:

exportHINDSIGHT_API_URL=http://localhost:8888

Or in ~/.hindsight/omo.json:

{
"hindsightApiUrl":"http://localhost:8888"
}

No API token is required for local instances.

Configuration​

Settings are loaded from three sources in order (later wins):

  1. Plugin settings.json (cloud URL pre-set)
  2. User config (~/.hindsight/omo.json)
  3. HINDSIGHT_* environment variables

Connection​

SettingEnv VarDefaultDescription
hindsightApiUrlHINDSIGHT_API_URLhttps://api.hindsight.vectorize.ioAPI endpoint.
hindsightApiTokenHINDSIGHT_API_TOKENβ€”API key for authentication. Required for Hindsight Cloud.

Memory Bank​

SettingEnv VarDefaultDescription
bankIdHINDSIGHT_BANK_ID"omo"The bank to read from and write to. All sessions share this bank unless dynamicBankId is enabled.
bankMissionHINDSIGHT_BANK_MISSIONOMO orchestrator promptDescribes the agent's purpose. Sent when creating or updating the bank.
retainMissionβ€”extraction promptInstructions for Hindsight's fact extraction.
dynamicBankIdHINDSIGHT_DYNAMIC_BANK_IDfalseWhen true, derives a unique bank ID from dynamicBankGranularity fields.
dynamicBankGranularityβ€”["agent", "project"]Fields to combine for dynamic bank IDs. "project" = working directory, "agent" = agent name.
bankIdPrefixβ€”""Prefix prepended to all bank IDs.

Auto-Recall​

SettingEnv VarDefaultDescription
autoRecallHINDSIGHT_AUTO_RECALLtrueMaster switch for auto-recall.
recallBudgetHINDSIGHT_RECALL_BUDGET"mid"Search depth: "low" (fast), "mid" (balanced), "high" (thorough).
recallMaxTokensHINDSIGHT_RECALL_MAX_TOKENS1024Max tokens in the recalled memory block.
recallTypesβ€”["world", "experience"]Memory types to retrieve.
recallContextTurnsHINDSIGHT_RECALL_CONTEXT_TURNS1Prior turns to include when building the recall query. 1 = latest prompt only.
recallMaxQueryCharsHINDSIGHT_RECALL_MAX_QUERY_CHARS800Max characters in the query sent to Hindsight.
recallRolesβ€”["user", "assistant"]Roles to include when building a multi-turn query.
recallPromptPreambleβ€”built-inText placed above the recalled memories in the injected context block.

Auto-Retain​

SettingEnv VarDefaultDescription
autoRetainHINDSIGHT_AUTO_RETAINtrueMaster switch for auto-retain.
retainModeHINDSIGHT_RETAIN_MODE"full-session""full-session" sends the full transcript per session. "chunked" sends sliding windows every N turns.
retainEveryNTurnsβ€”10Retain fires every N turns. 1 = every turn. Higher values reduce API calls.
retainOverlapTurnsβ€”2Extra turns included from the previous chunk (chunked mode only).
retainRolesβ€”["user", "assistant"]Roles to include in the retained transcript.
retainTagsβ€”["{session_id}"]Tags attached to the stored document. {session_id} is replaced at runtime.
retainMetadataβ€”{}Arbitrary key-value metadata attached to the stored document.
retainContextβ€”"omo"Label identifying the source integration.

Debug​

SettingEnv VarDefaultDescription
debugHINDSIGHT_DEBUGfalseEnable verbose logging to stderr. All log lines are prefixed with [Hindsight].

Per-Project Memory​

To give each project its own isolated memory bank, enable dynamic bank IDs:

{
"dynamicBankId":true,
"dynamicBankGranularity":["agent","project"]
}

With this config, running OMO in ~/projects/api and ~/projects/frontend stores and recalls memories separately. Bank IDs are derived from the working directory path (e.g. omo::api, omo::frontend).

Multi-Bank Recall​

Query additional banks alongside the primary one:

{
"recallAdditionalBanks":["shared-team-knowledge"]
}

Troubleshooting​

No memories recalled: Recall returns results only after something has been retained. Complete one OMO session first, then start a new one to see memories.

Memory not being stored: retainEveryNTurns defaults to 10 β€” retain only fires every 10 turns. While testing, add "retainEveryNTurns": 1 to ~/.hindsight/omo.json.

Cloud mode silently skipping: If hindsightApiUrl points to Hindsight Cloud but no hindsightApiToken is set, hooks silently skip. Set HINDSIGHT_API_TOKEN or add it to ~/.hindsight/omo.json.

Debug mode: Add "debug": true to ~/.hindsight/omo.json to see what Hindsight is doing on each turn:

[Hindsight] Recalling from bank 'omo', query length: 42
[Hindsight] Injecting 3 memories
[Hindsight] Retaining to bank 'omo', doc 'sess-abc123', 2 messages, 847 chars

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /