@clawdb/anthropic
v0.1.4
Published
Anthropic Claude integration for ClawDB memory, branching, sync, reflection, and transactional tools.
Readme
@clawdb/anthropic
Anthropic Claude integration for ClawDB memory, branching, sync, reflection, and transactional tools.
Install
npm install @clawdb/anthropic @clawdb/sdk @anthropic-ai/sdkExports
clawdbTools(client)returns the Anthropic tool definitions.handleClawDBToolCall(client, toolUse)executes a Claude tool call against ClawDB.withClawDBMemory(anthropic, client)injects recalled memory intomessages.create()calls.
Quick Start
import Anthropic from '@anthropic-ai/sdk';
import { ClawDB } from '@clawdb/sdk';
import { clawdbTools, handleClawDBToolCall, withClawDBMemory } from '@clawdb/anthropic';
const client = new ClawDB({ endpoint: 'http://localhost:50050', agentId: 'claude-agent' });
const anthropic = withClawDBMemory(new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY! }), client);
const response = await anthropic.messages.create({
model: 'claude-3-5-sonnet-latest',
max_tokens: 1024,
tools: clawdbTools(client),
messages: [{ role: 'user', content: 'Plan the release and remember the outcome.' }]
});
for (const block of response.content) {
if (block.type === 'tool_use') {
const result = await handleClawDBToolCall(client, block);
console.log(result);
}
}Tool Coverage
Memory tools:
clawdb_rememberclawdb_update_memoryclawdb_delete_memoryclawdb_list_memoriesclawdb_searchclawdb_recall
Branch tools:
clawdb_branch_forkclawdb_branch_listclawdb_branch_getclawdb_branch_trunkclawdb_branch_diffclawdb_branch_mergeclawdb_branch_discardclawdb_branch_archive
Sync tools:
clawdb_syncclawdb_sync_pushclawdb_sync_pullclawdb_sync_status
Reflection tools:
clawdb_reflectclawdb_reflect_factsclawdb_reflect_preferencesclawdb_reflect_contradictionsclawdb_reflect_resolve_contradiction
Transaction tools:
clawdb_tx_beginclawdb_tx_rememberclawdb_tx_commitclawdb_tx_rollback
Notes
withClawDBMemory()searches ClawDB using the latest user turn and appends the hits to the system prompt.- Use
rememberTyped()andtxRememberTyped()in your own code when you need stable memory typing and tags. - Set
CLAWDB_URL,CLAWDB_API_KEY, andCLAWDB_AGENT_IDto target a managed deployment.
