Api Reference
Core Packages
API reference for the goClaw / ClawRM package ecosystem.
goClaw is built as a pnpm monorepo. Each package is independently versioned and published to npm under the @clawrm scope.
Package overview
| Package | Version | Purpose |
|---|---|---|
@clawrm/core | 0.9.x | Agent orchestration, task scheduler, container runtime |
@clawrm/crm | 0.9.x | Contact management, threads, MCP tool integration |
@clawrm/channels | 0.9.x | Multi-channel messaging (pluggable interface) |
@clawrm/knowledge | 0.9.x | Knowledge base, research pipeline, curiosity queue |
@clawrm/admin | 0.9.x | Next.js admin dashboard |
@clawrm/cli | 0.9.x | Setup wizard and deployment CLI |
@clawrm/shared | 0.9.x | Shared types and utilities |
All packages are currently in pre-1.0 development. APIs may change between minor versions. Pin to a specific minor version in production.
@clawrm/core
The agent runtime package. Handles task scheduling, LLM invocation, MCP tool execution, and context assembly.
Installation
npm install @clawrm/core
Key exports
AgentRuntime
The main agent runtime class.
import { AgentRuntime } from "@clawrm/core";
const runtime = new AgentRuntime({
anthropic_api_key: process.env.ANTHROPIC_API_KEY,
config_path: "./config/agent.yaml",
data_dir: "./data",
});
await runtime.start();
registerTools(tools: ToolManifest)
Register custom MCP tools with the runtime.
import { registerTools } from "@clawrm/core";
registerTools({
my_custom_tool: {
description: "...",
input_schema: { type: "object", properties: { ... } },
handler: async (input) => { ... },
},
});
TaskScheduler
Direct access to the task scheduler.
import { TaskScheduler } from "@clawrm/core";
const scheduler = new TaskScheduler({ db_path: "./data/tasks.db" });
// Schedule a task
await scheduler.schedule({
type: "follow_up",
contact_id: "c_123",
run_at: Date.now() + 3 * 24 * 60 * 60 * 1000, // 3 days
context: { channel: "email", note: "Awaiting response to intro email" },
});
// Get pending tasks
const tasks = await scheduler.getPending({ limit: 20 });
webhooks
Register webhook handlers for external event triggers.
import { webhooks } from "@clawrm/core";
webhooks.on("new_lead", async (payload) => {
await runtime.run({ task: "outreach_new_prospect", contact: payload });
});
@clawrm/crm
Contact management with SQLite backend and MCP tool bindings.
Installation
npm install @clawrm/crm
Key exports
CRMClient
Direct access to the CRM database (for admin scripts and custom tooling).
import { CRMClient } from "@clawrm/crm";
const crm = new CRMClient({ db_path: "./data/crm.db" });
// Find contacts
const contacts = await crm.search({ query: "acme", limit: 10 });
// Get contact with threads
const contact = await crm.getContact("c_123", { include_threads: true });
// Create contact
const newContact = await crm.createContact({
email: "alex@startup.io",
name: "Alex Kim",
company: "Startup.io",
tags: ["prospect", "series-seed"],
});
// Add note
await crm.addNote("c_123", "Responded to follow-up. Interested in Q3.");
getMCPTools()
Get the CRM MCP tool definitions for registration with the agent runtime.
import { getMCPTools } from "@clawrm/crm";
registerTools(getMCPTools(crmClient));
MCP tools provided
| Tool | Input | Output |
|---|---|---|
crm_search | { query, limit?, group_id? } | Contact[] |
crm_get_contact | { contact_id, include_threads? } | Contact & { threads, notes } |
crm_create_contact | { email?, name, company?, tags? } | Contact |
crm_update_contact | { contact_id, ...fields } | Contact |
crm_add_note | { contact_id, body, tags? } | Note |
crm_get_threads | { contact_id, limit? } | Thread[] |
crm_schedule_followup | { contact_id, channel, delay_days, context } | Task |
@clawrm/channels
Multi-channel messaging with a pluggable interface.
Installation
npm install @clawrm/channels
Key exports
ChannelRegistry
import { ChannelRegistry } from "@clawrm/channels";
import { EmailChannel, SMSChannel } from "@clawrm/channels/providers";
// Register channels
ChannelRegistry.register(new EmailChannel(emailConfig));
ChannelRegistry.register(new SMSChannel(smsConfig));
// Send a message
await ChannelRegistry.send("email", "recipient@example.com", {
subject: "Hello",
body: "This is a test.",
});
Channel interface
interface Channel {
id: string;
name: string;
send(to: string, message: OutboundMessage, context: MessageContext): Promise<SendResult>;
listen(handler: MessageHandler): Promise<void>;
stop(): Promise<void>;
normalize(raw: unknown): NormalizedMessage;
}
@clawrm/knowledge
Knowledge base with SQLite FTS5 indexing, research pipeline, and curiosity queue.
Installation
npm install @clawrm/knowledge
Key exports
KnowledgeBase
import { KnowledgeBase } from "@clawrm/knowledge";
const kb = new KnowledgeBase({
knowledge_dir: "./knowledge",
db_path: "./data/knowledge.db",
});
// Search
const results = await kb.search("price objection handling", { limit: 5 });
// Get a file
const file = await kb.get("objections/price.md");
// Reindex
await kb.reindex();
ResearchPipeline
import { ResearchPipeline } from "@clawrm/knowledge";
const pipeline = new ResearchPipeline({
kb,
anthropic_api_key: process.env.ANTHROPIC_API_KEY,
openai_api_key: process.env.OPENAI_API_KEY,
batch_size: 20,
cascade_depth: 2,
});
// Run manually (also runs on schedule)
const results = await pipeline.run();
console.log(`Processed ${results.processed} items, created ${results.files_created} files`);
@clawrm/cli
Command-line interface for setup and management.
Installation
npm install -g @clawrm/cli
# or use npx without global install:
npx @clawrm/cli <command>
Commands
@clawrm/cli init [project-name] Scaffold a new goClaw project
@clawrm/cli knowledge import Import knowledge from URL or directory
@clawrm/cli knowledge reindex Rebuild the knowledge FTS5 index
@clawrm/cli deploy Deploy to EC2 or Docker
@clawrm/cli status Show agent status and recent activity
@clawrm/cli logs [--tail] View agent execution logs
@clawrm/cli export --format csv Export CRM data
@clawrm/shared
Shared TypeScript types used across all packages.
import type {
Contact,
Thread,
Message,
Note,
NormalizedMessage,
OutboundMessage,
Task,
CuriosityItem,
AgentConfig,
GroupConfig,
} from "@clawrm/shared";
All types are re-exported from each individual package — you typically don't need to import from @clawrm/shared directly.
