ThrindexAnthropic wrapper replaces your Anthropic instance. Every messages.create call automatically retrieves relevant memories and injects them into the system prompt before the call, then captures the conversation turn as a new memory after it.
Memory retrieval failures are always silent — if Thrindex is unreachable, the underlying Anthropic call proceeds unaffected.
Install
- Python
- TypeScript
Usage
Options
Same as the OpenAI integration — replaceopenai_client with anthropic_client in Python, and openai with anthropic in TypeScript.
| Parameter (Python) | Option (TypeScript) | Default | Description |
|---|---|---|---|
thrindex_client | thrindex | required | A configured Thrindex client |
anthropic_client | anthropic | required | Your Anthropic client instance |
agent_id | agentId | required | Agent identifier for memory scoping |
user_id | userId | required | User identifier for memory scoping |
inject_k | injectK | 5 | Number of memories to inject per call |
inject | inject | true | Whether to inject memories before the call |
capture | capture | true | Whether to store conversation turns after the call |
capture_assistant | captureAssistant | true | Capture both user message and assistant reply as a single turn |
format_memories | formatMemories | bullet list | Custom memory formatter |
Custom memory format (recommended for Claude)
Claude’s instruction-following is strongest with XML structure. Use this formatter for best retrieval quality:- Python
- TypeScript