Full reference for the DashClaw SDK. 177+ methods across 29 categories to govern your AI agents with action recording, evaluation framework, scoring profiles, learning analytics, prompt management, feedback loops, behavioral drift, compliance exports, and more.
Install from npm, or copy the single-file SDK directly.
npm install dashclaw
import { DashClaw } from 'dashclaw';
const claw = new DashClaw({
baseUrl: 'http://localhost:3000', // or https://your-app.vercel.app
apiKey: process.env.DASHCLAW_API_KEY,
agentId: 'my-agent',
agentName: 'My Agent',
});// Create an action before doing work
const { action_id } = await claw.createAction({
action_type: 'deploy',
declared_goal: 'Deploy authentication service',
risk_score: 60,
});
// ... do the work ...
// Update when done
await claw.updateOutcome(action_id, {
status: 'completed',
output_summary: 'Auth service deployed to prod',
});Or use track() to wrap it in a single call that auto-records success/failure.
Prefer to let your coding agent do setup and coverage automatically?
Create a DashClaw instance. Requires Node 18+ (native fetch).
const claw = new DashClaw({ baseUrl, apiKey, agentId, agentName, swarmId, guardMode, guardCallback });| Parameter | Type | Required | Description |
|---|---|---|---|
| baseUrl | string | Yes | DashClaw dashboard URL (e.g. "http://localhost:3000" or "https://your-app.vercel.app") |
| apiKey | string | Yes | API key for authentication (determines which org's data you access) |
| agentId | string | Yes | Unique identifier for this agent |
| agentName | string | No | Human-readable agent name |
| swarmId | string | No | Swarm/group identifier if part of a multi-agent system |
| guardMode | string | No | Auto guard check before createAction/track: "off" (default), "warn" (log + proceed), "enforce" (throw on block) |
| guardCallback | Function | No | Called with guard decision object when guardMode is active |
When guardMode is set, every call to createAction() and track() automatically checks guard policies before proceeding.
import { DashClaw, GuardBlockedError } from 'dashclaw';
const claw = new DashClaw({
baseUrl: 'http://localhost:3000',
apiKey: process.env.DASHCLAW_API_KEY,
agentId: 'my-agent',
guardMode: 'enforce', // throws GuardBlockedError on block/require_approval
guardCallback: (decision) => console.log('Guard:', decision.decision),
});
try {
await claw.createAction({ action_type: 'deploy', declared_goal: 'Ship v2' });
} catch (err) {
if (err instanceof GuardBlockedError) {
console.log(err.decision); // 'block' or 'require_approval'
console.log(err.reasons); // ['Risk score 90 >= threshold 80']
}
}Subscribe to server-sent events for instant push notifications. Eliminates polling for approvals, policy changes, and task assignments.
Strategic fleet overview with real-time health pulses, decision timelines, and a live terminal-style swarm log.
Guard decisions and risk signals stream instantly to the dashboard, allowing human operators to react the moment a policy is triggered.
Open a persistent SSE connection. Returns a chainable handle with .on(event, callback) and .close(). Supported events: action.created, action.updated, loop.created, loop.updated, goal.created, goal.updated, decision.created, guard.decision.created, signal.detected, token.usage, message.created, policy.updated, task.assigned, task.completed.
Returns: { on(eventType, callback): this, close(): void }
const stream = dc.events();
stream
.on('action.created', (data) => console.log('New action:', data.action_id))
.on('action.updated', (data) => {
if (data.status === 'running') console.log('Approved:', data.action_id);
})
.on('loop.created', (data) => console.log('New dependency:', data.description))
.on('loop.updated', (data) => console.log('Loop status changed:', data.status))
.on('goal.created', (data) => console.log('New goal:', data.title))
.on('goal.updated', (data) => console.log('Goal progress:', data.progress + '%'))
.on('decision.created', (data) => console.log('Agent decided:', data.decision))
.on('guard.decision.created', (data) => console.log('Guard:', data.decision))
.on('signal.detected', (data) => console.log('Alert:', data.label))
.on('token.usage', (data) => console.log('Burn:', data.estimated_cost))
.on('policy.updated', (data) => console.log('Policy changed:', data.change_type))
.on('task.assigned', (data) => console.log('Task routed:', data.task?.title))
.on('task.completed', (data) => console.log('Task done:', data.task?.task_id))
.on('error', (err) => console.error('Stream error:', err));
// When done:
stream.close();Create, update, and query action records. Every agent action gets a full audit trail.
Create a new action record. The agent's agentId, agentName, and swarmId are automatically attached.
| Parameter | Type | Required | Description |
|---|---|---|---|
| action_type | string | Yes | One of: build, deploy, post, apply, security, message, api, calendar, research, review, fix, refactor, test, config, monitor, alert, cleanup, sync, migrate, other |
| declared_goal | string | Yes | What this action aims to accomplish |
| action_id | string | No | Custom action ID (auto-generated act_ UUID if omitted) |
| reasoning | string | No | Why the agent decided to take this action |
| authorization_scope | string | No | What permissions were granted |
| trigger | string | No | What triggered this action |
| systems_touched | string[] | No | Systems this action interacts with |
| input_summary | string | No | Summary of input data |
| parent_action_id | string | No | Parent action if this is a sub-action |
| reversible | boolean | No | Whether this action can be undone (default: true) |
| risk_score | number | No | Risk score 0-100 (default: 0) |
| confidence | number | No | Confidence level 0-100 (default: 50) |
Returns: Promise<{ action: Object, action_id: string }>
const { action_id } = await claw.createAction({
action_type: 'deploy',
declared_goal: 'Deploy auth service to production',
risk_score: 70,
systems_touched: ['kubernetes', 'auth-service'],
reasoning: 'Scheduled release after QA approval',
});Poll for human approval when an action enters pending_approval status. Useful with hitlMode='off' when you want explicit control over blocking behavior.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actionId | string | Yes | The pending action_id to poll |
| options.timeout | number | No | Maximum wait in ms (default: 300000) |
| options.interval | number | No | Polling interval in ms (default: 5000) |
Returns: Promise<{ action: Object, action_id: string }>
const { action_id } = await claw.createAction({
action_type: 'deploy',
declared_goal: 'Ship release candidate',
});
const approval = await claw.waitForApproval(action_id, {
timeout: 180000,
interval: 3000,
});
console.log('Approved status:', approval.action.status);Update the outcome of an existing action. Automatically sets timestamp_end if not provided.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actionId | string | Yes | The action_id to update |
| status | string | No | New status: completed, failed, cancelled |
| output_summary | string | No | What happened |
| side_effects | string[] | No | Unintended consequences |
| artifacts_created | string[] | No | Files, records, etc. created |
| error_message | string | No | Error details if failed |
| duration_ms | number | No | How long it took in milliseconds |
| cost_estimate | number | No | Estimated cost in USD |
Returns: Promise<{ action: Object }>
await claw.updateOutcome(action_id, {
status: 'completed',
output_summary: 'Auth service deployed successfully',
artifacts_created: ['deploy-log-2024-01.txt'],
duration_ms: 45000,
});Helper that creates an action, runs your async function, and auto-updates the outcome. If fn throws, the action is marked as failed with the error message.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actionDef | Object | Yes | Action definition (same params as createAction) |
| fn | Function | Yes | Async function to execute. Receives { action_id } as argument. |
Returns: Promise<*> (the return value of fn)
const result = await claw.track(
{ action_type: 'build', declared_goal: 'Compile project' },
async ({ action_id }) => {
// Your logic here. If this throws, the action is marked failed.
await runBuild();
return 'Build succeeded';
}
);Get a list of actions with optional filters. Returns paginated results with stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| agent_id | string | No | Filter by agent |
| swarm_id | string | No | Filter by swarm |
| status | string | No | Filter by status (running, completed, failed, cancelled) |
| action_type | string | No | Filter by type |
| risk_min | number | No | Minimum risk score |
| limit | number | No | Max results (default: 50) |
| offset | number | No | Pagination offset (default: 0) |
Returns: Promise<{ actions: Object[], total: number, stats: Object }>
const { actions, total } = await claw.getActions({
status: 'failed',
risk_min: 50,
limit: 20,
});Get a single action with its associated open loops and assumptions.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actionId | string | Yes | The action_id to retrieve |
Returns: Promise<{ action: Object, open_loops: Object[], assumptions: Object[] }>
const { action, open_loops, assumptions } = await claw.getAction('act_abc123');Get root-cause trace for an action, including its assumptions, open loops, parent chain, and related actions.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actionId | string | Yes | The action_id to trace |
Returns: Promise<{ action: Object, trace: Object }>
const { trace } = await claw.getActionTrace('act_abc123');
// trace includes: assumptions, open_loops, parent_chain, related_actionsTrack output quality automatically with 5 built-in scorer types. No LLM required for most scorers.
Create a new evaluation scorer.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Scorer name |
| scorerType | string | Yes | regex, keywords, numeric_range, custom_function, or llm_judge |
| config | object | Yes | Configuration for the scorer |
| description | string | No | Purpose of this scorer |
Returns: Promise<Object>
await claw.createScorer({
name: 'JSON Validator',
scorerType: 'regex',
config: { pattern: '^\{.*\}$' },
});List all available scorers.
Returns: Promise<{ scorers: Object[], llm_available: boolean }>
List evaluation runs with status and result summaries.
| Parameter | Type | Required | Description |
|---|---|---|---|
| status | string | No | running, completed, failed |
| limit | number | No | Max results |
Returns: Promise<{ runs: Object[] }>
Get aggregate evaluation statistics across scorers and agents.
| Parameter | Type | Required | Description |
|---|---|---|---|
| agent_id | string | No | Filter by agent |
| scorer_name | string | No | Filter by scorer |
| days | number | No | Lookback period |
Returns: Promise<Object>
Version-controlled prompt templates with mustache variable rendering.
Create a new prompt template.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Template name |
| content | string | Yes | Template content with {{variables}} |
| category | string | No | Optional grouping category |
Returns: Promise<Object>
Get a template by ID, including its current active version.
Returns: Promise<Object>
Render a template with variables on the server. Optionally link to an action for usage tracking.
| Parameter | Type | Required | Description |
|---|---|---|---|
| template_id | string | Yes | Template ID |
| variables | object | Yes | Mustache variables |
| action_id | string | No | Link to an action |
Returns: Promise<{ rendered: string }>
List all versions of a prompt template.
Returns: Promise<Object[]>
Set a specific version as the active one for a template.
Returns: Promise<Object>
Collect and analyze human feedback on agent actions.
Submit feedback for a specific action.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actionId | string | Yes | Action ID |
| rating | number | Yes | Rating 1-5 |
| comment | string | No | Optional text feedback |
Returns: Promise<Object>
Retrieve a single feedback entry.
Returns: Promise<Object>
Get feedback statistics, including average rating and sentiment trends.
Returns: Promise<Object>
Monitor agent behavior deviations from statistical baselines using z-scores.
Establish statistical baselines for an agent's behavior metrics.
Returns: Promise<Object>
Run drift detection against the established baselines.
Returns: Promise<Object>
List behavioral drift alerts with severity and status.
Returns: Promise<Object[]>
Generate evidence packages for SOC 2, NIST AI RMF, EU AI Act, and ISO 42001.
Generate a compliance export bundle.
Returns: Promise<Object>
Get the status and details of a compliance export.
Returns: Promise<Object>
List recent compliance exports.
Returns: Promise<Object[]>
Track agent improvement velocity, maturity levels, and learning curves per skill.
Get agent improvement rate over time.
Returns: Promise<Object>
Get the 6-level maturity model distribution for the agent.
Returns: Promise<Object>
Get performance improvement curves for a specific skill/action type.
Returns: Promise<Object>
User-defined weighted quality scoring with 3 composite methods, 8 data sources, risk templates, and auto-calibration. Zero LLM required.
Create a scoring profile with optional inline dimensions.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Profile name |
| description | string | No | Profile description |
| action_type | string | No | Filter to specific action type (null = all) |
| composite_method | string | No | weighted_average (default), minimum, or geometric_mean |
| dimensions | array | No | Inline dimension definitions (name, data_source, weight, scale) |
Returns: Promise<Object>
const profile = await dc.createScoringProfile({
name: 'deploy-quality',
action_type: 'deploy',
composite_method: 'weighted_average',
dimensions: [
{ name: 'Speed', data_source: 'duration_ms', weight: 0.3,
scale: [
{ label: 'excellent', operator: 'lt', value: 30000, score: 100 },
{ label: 'good', operator: 'lt', value: 60000, score: 75 },
{ label: 'poor', operator: 'gte', value: 60000, score: 20 },
]},
{ name: 'Reliability', data_source: 'confidence', weight: 0.7,
scale: [
{ label: 'excellent', operator: 'gte', value: 0.9, score: 100 },
{ label: 'poor', operator: 'lt', value: 0.7, score: 25 },
]},
],
});List all scoring profiles for the organization.
Returns: Promise<Object[]>
Get a single scoring profile with its dimensions.
Returns: Promise<Object>
Update a scoring profile's metadata.
Returns: Promise<Object>
Delete a scoring profile and all its scores.
Returns: Promise<Object>
Add a new weighted dimension to a profile.
Returns: Promise<Object>
Update an existing dimension's weight or scale.
Returns: Promise<Object>
Remove a dimension from a profile.
Returns: Promise<Object>
Score a single action against a profile. Returns composite score + per-dimension breakdown.
| Parameter | Type | Required | Description |
|---|---|---|---|
| profile_id | string | Yes | Profile to score against |
| action | object | Yes | Action data object |
Returns: Promise<Object>
const result = await dc.scoreWithProfile('sp_abc123', {
duration_ms: 25000, confidence: 0.95, cost_estimate: 0.008,
});
// result.composite_score = 92.5
// result.dimensions = [{ dimension_name: 'Speed', score: 100, label: 'excellent' }, ...]Score multiple actions at once. Returns per-action results + summary.
| Parameter | Type | Required | Description |
|---|---|---|---|
| profile_id | string | Yes | Profile to score against |
| actions | array | Yes | Array of action data objects |
Returns: Promise<Object>
const batch = await dc.batchScoreWithProfile('sp_abc123', [
{ duration_ms: 500, confidence: 0.98 },
{ duration_ms: 10000, confidence: 0.5 },
]);
// batch.summary = { total: 2, scored: 2, avg_score: 72.3 }List historical scores generated for a profile.
Returns: Promise<Object[]>
Get aggregate statistics for a profile's scores.
| Parameter | Type | Required | Description |
|---|---|---|---|
| profile_id | string | Yes | Profile ID |
Returns: Promise<Object>
const stats = await dc.getProfileScoreStats('sp_abc123');
// { total_scores: 142, avg_score: 78.3, min_score: 23, max_score: 99, stddev_score: 12.5 }Create a rule-based risk template. Replaces hardcoded agent risk numbers.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Template name |
| base_risk | number | No | Starting risk score (0-100) |
| rules | array | No | Array of { condition, add } rules |
Returns: Promise<Object>
const template = await dc.createRiskTemplate({
name: 'Production Safety',
base_risk: 20,
rules: [
{ condition: "metadata.environment == 'production'", add: 25 },
{ condition: "metadata.modifies_data == true", add: 15 },
{ condition: "metadata.irreversible == true", add: 30 },
],
});List all risk templates for the organization.
Returns: Promise<Object[]>
Update a risk template's rules or base risk.
Returns: Promise<Object>
Delete a risk template.
Returns: Promise<Object>
Analyze historical action data to suggest scoring thresholds from percentile distribution.
| Parameter | Type | Required | Description |
|---|---|---|---|
| action_type | string | No | Filter to action type (null = all) |
| lookback_days | number | No | Days to analyze (default: 30) |
Returns: Promise<Object>
const cal = await dc.autoCalibrate({ lookback_days: 30, action_type: 'deploy' });
// cal.suggestions[0] = { metric: 'duration_ms', sample_size: 480,
// distribution: { p25: 3000, p50: 8000, p75: 20000 },
// suggested_scale: [...] }Track unresolved dependencies and log what your agents assume. Catch drift before it causes failures.
Register an open loop (unresolved dependency, pending approval, etc.) for an action.
| Parameter | Type | Required | Description |
|---|---|---|---|
| action_id | string | Yes | Parent action ID |
| loop_type | string | Yes | One of: followup, question, dependency, approval, review, handoff, other |
| description | string | Yes | What needs to be resolved |
| priority | string | No | One of: low, medium, high, critical (default: medium) |
| owner | string | No | Who is responsible for resolving this |
Returns: Promise<{ loop: Object, loop_id: string }>
const { loop_id } = await claw.registerOpenLoop({
action_id: 'act_abc123',
loop_type: 'approval',
description: 'Needs manager approval for prod deploy',
priority: 'high',
owner: 'ops-team',
});Resolve or cancel an open loop.
| Parameter | Type | Required | Description |
|---|---|---|---|
| loopId | string | Yes | The loop_id to resolve |
| status | string | Yes | "resolved" or "cancelled" |
| resolution | string | No | Resolution description (required when resolving) |
Returns: Promise<{ loop: Object }>
await claw.resolveOpenLoop('loop_xyz789', 'resolved', 'Manager approved via Slack');Register an assumption made during an action. Track what your agent assumes so you can validate or invalidate later.
| Parameter | Type | Required | Description |
|---|---|---|---|
| action_id | string | Yes | Parent action ID |
| assumption | string | Yes | The assumption being made |
| basis | string | No | Evidence or reasoning for the assumption |
| validated | boolean | No | Whether this has been validated (default: false) |
Returns: Promise<{ assumption: Object, assumption_id: string }>
const { assumption_id } = await claw.registerAssumption({
action_id: 'act_abc123',
assumption: 'Database schema is unchanged since last deploy',
basis: 'No migration files found in latest commits',
});Get a single assumption by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
| assumptionId | string | Yes | The assumption_id to retrieve |
Returns: Promise<{ assumption: Object }>
const { assumption } = await claw.getAssumption('asm_abc123');Validate or invalidate an assumption. When invalidating, a reason is required.
| Parameter | Type | Required | Description |
|---|---|---|---|
| assumptionId | string | Yes | The assumption_id to update |
| validated | boolean | Yes | true to validate, false to invalidate |
| invalidated_reason | string | No | Required when invalidating (validated = false) |
Returns: Promise<{ assumption: Object }>
// Validate
await claw.validateAssumption('asm_abc123', true);
// Invalidate
await claw.validateAssumption('asm_abc123', false, 'Schema was altered by migration #47');Get open loops with optional filters. Returns paginated results with stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| status | string | No | Filter by status: open, resolved, cancelled |
| loop_type | string | No | Filter by loop type |
| priority | string | No | Filter by priority |
| limit | number | No | Max results (default: 50) |
Returns: Promise<{ loops: Object[], total: number, stats: Object }>
const { loops } = await claw.getOpenLoops({
status: 'open',
priority: 'critical',
});Get drift report for assumptions with risk scoring. Shows which assumptions are stale, unvalidated, or contradicted by outcomes.
| Parameter | Type | Required | Description |
|---|---|---|---|
| action_id | string | No | Filter by action |
| limit | number | No | Max results (default: 50) |
Returns: Promise<{ assumptions: Object[], drift_summary: Object }>
const { assumptions, drift_summary } = await claw.getDriftReport();
console.log(drift_summary);
// { total, validated, invalidated, unvalidated, drift_score }Automatic detection of problematic agent behavior. Seven signal types fire based on action patterns. No configuration required.
Get current risk signals across all agents. Returns 7 signal types: autonomy_spike, high_impact_low_oversight, repeated_failures, stale_loop, assumption_drift, stale_assumption, and stale_running_action.
Returns: Promise<{ signals: Object[], counts: { red: number, amber: number, total: number } }>
const { signals, counts } = await claw.getSignals();
console.log(`${counts.red} red, ${counts.amber} amber signals`);
for (const signal of signals) {
console.log(`[${signal.severity}] ${signal.signal_type}: ${signal.help}`);
}autonomy_spikeAgent taking too many actions without human checkpointshigh_impact_low_oversightCritical actions without sufficient reviewrepeated_failuresSame action type failing multiple timesstale_loopOpen loops unresolved past their expected timelineassumption_driftAssumptions becoming stale or contradicted by outcomesstale_assumptionAssumptions not validated within expected timeframestale_running_actionActions stuck in running state for over 4 hoursVisualize multi-agent communication and operational drift in real-time. The Swarm dashboard maps your entire fleet as a neural web, highlighting high-risk nodes and message flows.
High-performance canvas rendering supports 50+ agents. Nodes are color-coded by risk, and live "packets" visualize inter-agent messaging as it happens.
Use the Expand button to trigger a physical pulse that temporarily spreads agents apart, instantly decluttering complex webs for better visibility.
Use the swarmId constructor parameter to group related agents together in the neural web.
const claw = new DashClaw({
agentId: 'researcher-1',
swarmId: 'research-fleet-alpha', // Group agents together visually
// ...
});Check org-level policies before executing risky actions. Returns allow, warn, block, or require_approval based on configured guard policies.
Evaluate guard policies for a proposed action. Call this before risky operations to get a go/no-go decision. The agent_id is auto-attached from the SDK constructor.
| Parameter | Type | Required | Description |
|---|---|---|---|
| context.action_type | string | Yes | The type of action being proposed |
| context.risk_score | number | No | Risk score 0-100 |
| context.systems_touched | string[] | No | Systems this action will affect |
| context.reversible | boolean | No | Whether the action can be undone |
| context.declared_goal | string | No | What the action accomplishes |
| options.includeSignals | boolean | No | Also check live risk signals (adds latency) |
Returns: Promise<{ decision: string, reasons: string[], warnings: string[], matched_policies: string[], evaluated_at: string }>
const result = await claw.guard({
action_type: 'deploy',
risk_score: 85,
systems_touched: ['production-api'],
reversible: false,
declared_goal: 'Deploy auth service v2',
});
if (result.decision === 'block') {
console.log('Blocked:', result.reasons);
return; // abort the action
}
if (result.decision === 'warn') {
console.log('Warnings:', result.warnings);
}
// proceed with the action
await claw.createAction({ action_type: 'deploy', ... });Retrieve recent guard evaluation decisions for audit and review.
| Parameter | Type | Required | Description |
|---|---|---|---|
| filters.decision | string | No | Filter by decision: allow, warn, block, require_approval |
| filters.limit | number | No | Max results (default 20, max 100) |
| filters.offset | number | No | Pagination offset |
Returns: Promise<{ decisions: Object[], total: number, stats: { total_24h, blocks_24h, warns_24h, approvals_24h } }>
const { decisions, stats } = await claw.getGuardDecisions({
decision: 'block',
limit: 10,
});
console.log(`${stats.blocks_24h} blocks in last 24h`);risk_thresholdBlock or warn when an action's risk score exceeds a configured thresholdrequire_approvalRequire human approval for specific action types (e.g., deploy, security)block_action_typeUnconditionally block specific action types from executingrate_limitWarn or block when an agent exceeds a configured action frequencywebhook_checkCall an external HTTPS endpoint for custom decision logic (can only escalate severity, never downgrade)Policies are configured per-org via the Policies page in the dashboard. The guard endpoint evaluates all active policies and returns the strictest applicable decision.
Push data from your agent directly to the DashClaw dashboard. All methods auto-attach the agent's agentId.
Report token and model-usage snapshots for cost/burn-rate analytics. API remains available even when token widgets are disabled in certain dashboard modes.
| Parameter | Type | Required | Description |
|---|---|---|---|
| tokens_in | number | Yes | Input tokens consumed |
| tokens_out | number | Yes | Output tokens generated |
| context_used | number | No | Context window tokens used |
| context_max | number | No | Maximum context window size |
| model | string | No | Model identifier (e.g., gpt-4o-mini) |
Returns: Promise<{ snapshot: Object }>
await claw.reportTokenUsage({
tokens_in: 1234,
tokens_out: 980,
context_used: 2214,
context_max: 128000,
model: 'gpt-4o',
});Wrap an Anthropic or OpenAI client to auto-report token usage after every call. Returns the same client instance. Streaming calls are safely ignored.
| Parameter | Type | Required | Description |
|---|---|---|---|
| llmClient | Object | Yes | An Anthropic or OpenAI SDK client instance |
| options.provider | string | No | Force 'anthropic' or 'openai' if auto-detect fails |
Returns: Object (the wrapped client)
import Anthropic from '@anthropic-ai/sdk';
const anthropic = claw.wrapClient(new Anthropic());
const msg = await anthropic.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello' }],
});
// Token usage auto-reported to DashClawRecord a decision for the learning database. Track what your agent decides and why.
| Parameter | Type | Required | Description |
|---|---|---|---|
| decision | string | Yes | What was decided |
| context | string | No | Context around the decision |
| reasoning | string | No | Why this decision was made |
| outcome | string | No | "success", "failure", or "pending" |
| confidence | number | No | Confidence level 0-100 |
Returns: Promise<{ decision: Object }>
await claw.recordDecision({
decision: 'Use Redis for session caching',
reasoning: 'Lower latency than Postgres for read-heavy access pattern',
confidence: 85,
});Create a goal in the goals tracker.
| Parameter | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | Goal title |
| category | string | No | Goal category |
| description | string | No | Detailed description |
| target_date | string | No | Target completion date (ISO string) |
| progress | number | No | Progress 0-100 |
| status | string | No | "active", "completed", or "paused" |
Returns: Promise<{ goal: Object }>
await claw.createGoal({
title: 'Complete API migration',
category: 'engineering',
target_date: '2025-03-01T00:00:00.000Z',
progress: 30,
});Record content creation (articles, posts, documents).
| Parameter | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | Content title |
| platform | string | No | Platform (e.g., "linkedin", "twitter") |
| status | string | No | "draft" or "published" |
| url | string | No | Published URL |
Returns: Promise<{ content: Object }>
await claw.recordContent({
title: 'How We Migrated to Edge Functions',
platform: 'linkedin',
status: 'published',
url: 'https://linkedin.com/posts/...',
});Record a relationship interaction (message, meeting, email).
| Parameter | Type | Required | Description |
|---|---|---|---|
| summary | string | Yes | What happened |
| contact_name | string | No | Contact name (auto-resolves to contact_id) |
| contact_id | string | No | Direct contact ID |
| direction | string | No | "inbound" or "outbound" |
| type | string | No | Interaction type (e.g., "message", "meeting", "email") |
| platform | string | No | Platform used |
Returns: Promise<{ interaction: Object }>
await claw.recordInteraction({
contact_name: 'Jane Smith',
summary: 'Discussed Q1 roadmap and timeline',
type: 'meeting',
direction: 'outbound',
});Report active connections/integrations for this agent. Call at agent startup to register what services the agent is connected to.
| Parameter | Type | Required | Description |
|---|---|---|---|
| connections | Object[] | Yes | Array of connection objects |
| connections[].provider | string | Yes | Service name (e.g., "anthropic", "github") |
| connections[].authType | string | No | Auth method: api_key, subscription, oauth, pre_configured, environment |
| connections[].planName | string | No | Plan name (e.g., "Pro Max") |
| connections[].status | string | No | Connection status: active, inactive, error |
| connections[].metadata | Object|string | No | Optional metadata (e.g., { cost: "$100/mo" }) |
Returns: Promise<{ connections: Object[], created: number }>
await claw.reportConnections([
{ provider: 'anthropic', authType: 'subscription', planName: 'Pro Max', status: 'active' },
{ provider: 'github', authType: 'oauth', status: 'active' },
{ provider: 'slack', authType: 'api_key', status: 'active', metadata: { workspace: 'eng-team' } },
]);Create a calendar event.
| Parameter | Type | Required | Description |
|---|---|---|---|
| summary | string | Yes | Event title/summary |
| start_time | string | Yes | Start time (ISO string) |
| end_time | string | No | End time (ISO string) |
| location | string | No | Event location |
| description | string | No | Event description |
Returns: Promise<{ event: Object }>
await claw.createCalendarEvent({
summary: 'Deploy review',
start_time: '2025-02-10T14:00:00.000Z',
end_time: '2025-02-10T14:30:00.000Z',
description: 'Review prod deploy results',
});Record an idea or inspiration for later review.
| Parameter | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | Idea title |
| description | string | No | Detailed description |
| category | string | No | Category (e.g., "feature", "optimization", "content") |
| score | number | No | Priority/quality score 0-100 (default: 50) |
| status | string | No | "pending", "in_progress", "shipped", "rejected" |
| source | string | No | Where this idea came from |
Returns: Promise<{ idea: Object }>
await claw.recordIdea({
title: 'Auto-summarize daily agent activity',
category: 'feature',
score: 75,
source: 'User feedback in Slack #agents',
});Report memory health snapshot with entities and topics. Call periodically (e.g., daily) to track memory system health over time.
| Parameter | Type | Required | Description |
|---|---|---|---|
| health | Object | Yes | Health metrics object |
| health.score | number | Yes | Health score 0-100 |
| health.total_files | number | No | Number of memory files |
| health.total_lines | number | No | Total lines across all files |
| health.total_size_kb | number | No | Total size in KB |
| health.duplicates | number | No | Potential duplicate facts |
| health.stale_count | number | No | Stale facts count |
| entities | Object[] | No | Key entities found in memory |
| topics | Object[] | No | Topics/themes found in memory |
Returns: Promise<{ snapshot: Object, entities_count: number, topics_count: number }>
await claw.reportMemoryHealth({
health: {
score: 82,
total_files: 15,
total_lines: 340,
duplicates: 3,
stale_count: 7,
},
entities: [
{ name: 'PostgreSQL', type: 'service', mentions: 12 },
{ name: 'auth-service', type: 'service', mentions: 8 },
],
topics: [
{ name: 'deployment', mentions: 15 },
{ name: 'authentication', mentions: 9 },
],
});Create structured session handoff documents for continuity between agent sessions.
Create a session handoff document summarizing work done, decisions made, and next priorities.
| Parameter | Type | Required | Description |
|---|---|---|---|
| summary | string | Yes | Session summary |
| session_date | string | No | Date string (defaults to today) |
| key_decisions | string[] | No | Key decisions made this session |
| open_tasks | string[] | No | Tasks still open |
| mood_notes | string | No | User mood/energy observations |
| next_priorities | string[] | No | What to focus on next |
Returns: Promise<{handoff: Object, handoff_id: string}>
await claw.createHandoff({
summary: 'Completed auth system overhaul',
key_decisions: ['JWT over sessions', 'Added refresh tokens'],
open_tasks: ['Write migration guide', 'Load test'],
next_priorities: ['Deploy to staging'],
});Get handoffs for this agent with optional date and limit filters.
| Parameter | Type | Required | Description |
|---|---|---|---|
| date | string | No | Filter by session_date |
| limit | number | No | Max results |
Returns: Promise<{handoffs: Object[], total: number}>
const { handoffs } = await claw.getHandoffs({ limit: 5 });Get the most recent handoff for this agent. Useful at session start to restore context.
Returns: Promise<{handoff: Object|null}>
const { handoff } = await claw.getLatestHandoff();
if (handoff) {
console.log('Last session:', handoff.summary);
console.log('Open tasks:', JSON.parse(handoff.open_tasks));
}Capture key points and organize context into threads for long-running topics.
Capture a key point from the current session for later recall.
| Parameter | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | The key point content |
| category | string | No | One of: decision, task, insight, question, general |
| importance | number | No | Importance 1-10 (default 5) |
| session_date | string | No | Date string (defaults to today) |
Returns: Promise<{point: Object, point_id: string}>
await claw.captureKeyPoint({
content: 'User wants dark mode as the default theme',
category: 'decision',
importance: 8,
});Get key points with optional category and date filters.
| Parameter | Type | Required | Description |
|---|---|---|---|
| category | string | No | Filter by category |
| session_date | string | No | Filter by date |
| limit | number | No | Max results |
Returns: Promise<{points: Object[], total: number}>
const { points } = await claw.getKeyPoints({ category: 'decision' });Create a context thread for tracking a topic across multiple entries.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Thread name (unique per agent per org) |
| summary | string | No | Initial summary |
Returns: Promise<{thread: Object, thread_id: string}>
const { thread_id } = await claw.createThread({ name: 'Auth System', summary: 'Tracking auth decisions' });Add an entry to an existing thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
| threadId | string | Yes | Thread ID |
| content | string | Yes | Entry content |
| entryType | string | No | Entry type (default: note) |
Returns: Promise<{entry: Object, entry_id: string}>
await claw.addThreadEntry(threadId, 'Decided on JWT strategy');
Close a thread with an optional final summary.
| Parameter | Type | Required | Description |
|---|---|---|---|
| threadId | string | Yes | Thread ID |
| summary | string | No | Final summary |
Returns: Promise<{thread: Object}>
await claw.closeThread(threadId, 'Auth complete: JWT + refresh tokens');
Get threads with optional status filter.
| Parameter | Type | Required | Description |
|---|---|---|---|
| status | string | No | Filter: active or closed |
| limit | number | No | Max results |
Returns: Promise<{threads: Object[], total: number}>
const { threads } = await claw.getThreads({ status: 'active' });Get a combined view of today's key points and active threads.
Returns: Promise<{points: Object[], threads: Object[]}>
const { points, threads } = await claw.getContextSummary();Save, search, and reuse code snippets across agent sessions.
Save or update a reusable code snippet. Upserts on name.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Snippet name (unique per org) |
| code | string | Yes | The snippet code |
| description | string | No | What this snippet does |
| language | string | No | Programming language |
| tags | string[] | No | Tags for categorization |
Returns: Promise<{snippet: Object, snippet_id: string}>
await claw.saveSnippet({
name: 'fetch-with-retry',
code: 'async function fetchRetry(url, n = 3) { ... }',
language: 'javascript',
tags: ['fetch', 'retry'],
});Search and list snippets.
| Parameter | Type | Required | Description |
|---|---|---|---|
| search | string | No | Search name/description |
| tag | string | No | Filter by tag |
| language | string | No | Filter by language |
| limit | number | No | Max results |
Returns: Promise<{snippets: Object[], total: number}>
const { snippets } = await claw.getSnippets({ language: 'javascript' });Fetch a single snippet by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
| snippetId | string | Yes | Snippet ID |
Returns: Promise<{snippet: Object}>
const { snippet } = await claw.getSnippet('sn_abc123');
console.log(snippet.name, snippet.language);Mark a snippet as used (increments use_count).
| Parameter | Type | Required | Description |
|---|---|---|---|
| snippetId | string | Yes | Snippet ID |
Returns: Promise<{snippet: Object}>
await claw.useSnippet('sn_abc123');Delete a snippet.
| Parameter | Type | Required | Description |
|---|---|---|---|
| snippetId | string | Yes | Snippet ID |
Returns: Promise<{deleted: boolean, id: string}>
await claw.deleteSnippet('sn_abc123');Track user observations, learned preferences, mood, and successful approaches.
Log something you noticed about the user.
| Parameter | Type | Required | Description |
|---|---|---|---|
| observation | string | Yes | The observation text |
| category | string | No | Category tag |
| importance | number | No | Importance 1-10 |
Returns: Promise<{observation: Object}>
await claw.logObservation({ observation: 'Prefers tabs over spaces', category: 'coding', importance: 6 });Record a learned user preference.
| Parameter | Type | Required | Description |
|---|---|---|---|
| preference | string | Yes | Preference description |
| category | string | No | Category tag |
| confidence | number | No | Confidence 0-100 |
Returns: Promise<{preference: Object}>
await claw.setPreference({ preference: 'Prefers concise responses', confidence: 90 });Log user mood and energy level.
| Parameter | Type | Required | Description |
|---|---|---|---|
| mood | string | Yes | Mood (e.g., focused, frustrated) |
| energy | string | No | Energy level (high, low) |
| notes | string | No | Additional notes |
Returns: Promise<{mood: Object}>
await claw.logMood({ mood: 'focused', energy: 'high' });Track an approach and whether it worked. Upserts on repeated calls, updating success/fail counts.
| Parameter | Type | Required | Description |
|---|---|---|---|
| approach | string | Yes | Approach description |
| context | string | No | When to use this |
| success | boolean | No | true = worked, false = failed |
Returns: Promise<{approach: Object}>
await claw.trackApproach({ approach: 'Show code before explanation', success: true });Get a summary of all user preference data for this agent.
Returns: Promise<{summary: Object}>
const { summary } = await claw.getPreferenceSummary();Get tracked approaches ranked by success count.
| Parameter | Type | Required | Description |
|---|---|---|---|
| limit | number | No | Max results |
Returns: Promise<{approaches: Object[], total: number}>
const { approaches } = await claw.getApproaches({ limit: 10 });Aggregated daily summary from all data sources. No new storage needed.
Get a daily activity digest aggregated from actions, decisions, lessons, content, ideas, interactions, and goals.
| Parameter | Type | Required | Description |
|---|---|---|---|
| date | string | No | YYYY-MM-DD (defaults to today) |
Returns: Promise<{date: string, digest: Object, summary: Object}>
const { digest, summary } = await claw.getDailyDigest();
console.log(`Today: ${summary.action_count} actions, ${summary.decision_count} decisions`);Scan text for sensitive data (API keys, tokens, PII) and prompt injection attacks before sending it externally. Content is never stored; only metadata is retained.
Scan text for sensitive data. Returns findings and redacted text. Does not store anything.
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to scan |
| destination | string | No | Where text is headed (context) |
Returns: Promise<{clean: boolean, findings_count: number, findings: Object[], redacted_text: string}>
const result = await claw.scanContent(messageText, 'slack');
if (!result.clean) {
console.warn(`Found ${result.findings_count} issues`);
messageText = result.redacted_text; // Use redacted version
}Same as scanContent but stores finding metadata (never the content) for audit trails.
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to scan |
| destination | string | No | Where text is headed |
Returns: Promise<{clean: boolean, findings_count: number, findings: Object[], redacted_text: string}>
await claw.reportSecurityFinding(outboundMessage, 'email');
Scan text for prompt injection attacks — role overrides, delimiter injection, instruction smuggling, data exfiltration attempts, and encoding evasion. Returns risk level and actionable recommendation (allow/warn/block).
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to scan for injection attacks |
| options.source | string | No | Where this text came from (e.g. user_input, tool_output, retrieval) |
Returns: Promise<{clean: boolean, risk_level: string, recommendation: string, findings_count: number, categories: string[], findings: Object[]}>
const result = await claw.scanPromptInjection(userMessage, { source: 'user_input' });
if (result.recommendation === 'block') {
console.error(`Blocked: ${result.findings_count} injection patterns detected`);
} else if (result.recommendation === 'warn') {
console.warn(`Warning: ${result.categories.join(', ')} detected`);
}Direct inter-agent messaging with inbox semantics, conversation threads, shared workspace documents, and broadcast capability.
Send a message to another agent. Omit 'to' to broadcast to all agents.
| Parameter | Type | Required | Description |
|---|---|---|---|
| to | string | No | Target agent ID (null = broadcast) |
| type | string | No | Message type: action|info|lesson|question|status (default: info) |
| subject | string | No | Subject line (max 200 chars) |
| body | string | Yes | Message body (max 2000 chars) |
| threadId | string | No | Thread ID to attach to |
| urgent | boolean | No | Mark as urgent |
| docRef | string | No | Reference to a shared doc ID |
Returns: Promise<{message: Object, message_id: string}>
await claw.sendMessage({
to: 'ops-agent',
type: 'question',
subject: 'Deploy approval needed',
body: 'Auth service ready for prod. Please review.',
urgent: true,
});Get inbox messages for this agent (direct + broadcasts, excluding archived).
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | No | Filter by message type |
| unread | boolean | No | Only unread messages |
| threadId | string | No | Filter by thread |
| limit | number | No | Max messages (default: 50) |
Returns: Promise<{messages: Object[], total: number, unread_count: number}>
const { messages, unread_count } = await claw.getInbox({ unread: true });
console.log(`${unread_count} unread messages`);Get messages sent by this agent.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | No | Filter by message type |
| threadId | string | No | Filter by thread |
| limit | number | No | Max messages (default: 50) |
Returns: Promise<{messages: Object[], total: number}>
const { messages } = await claw.getSentMessages({ type: 'action' });Flexible message query. direction: 'inbox' (default), 'sent', or 'all'.
| Parameter | Type | Required | Description |
|---|---|---|---|
| direction | string | No | 'inbox' (default), 'sent', or 'all' |
| type | string | No | Filter by message type |
| unread | boolean | No | Only unread messages (inbox direction only) |
| threadId | string | No | Filter by thread |
| limit | number | No | Max messages (default: 50) |
Returns: Promise<{messages: Object[], total: number, unread_count: number}>
const { messages } = await claw.getMessages({ direction: 'all', type: 'question' });Fetch a single message by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageId | string | Yes | Message ID |
Returns: Promise<{message: Object}>
const { message } = await claw.getMessage('msg_abc123');Mark one or more messages as read.
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageIds | string[] | Yes | Array of message IDs |
Returns: Promise<{updated: number}>
await claw.markRead(['msg_abc123', 'msg_def456']);
Archive messages (removes from inbox).
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageIds | string[] | Yes | Array of message IDs |
Returns: Promise<{updated: number}>
await claw.archiveMessages(['msg_abc123']);
Broadcast a message to all agents in the organization.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | No | Message type (default: info) |
| subject | string | No | Subject line |
| body | string | Yes | Message body |
| threadId | string | No | Thread ID |
Returns: Promise<{message: Object, message_id: string}>
await claw.broadcast({
type: 'status',
subject: 'Deployment complete',
body: 'Auth service v2.1 deployed to production.',
});Start a new conversation thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Thread name |
| participants | string[] | No | Agent IDs (null = open to all) |
Returns: Promise<{thread: Object, thread_id: string}>
const { thread_id } = await claw.createMessageThread({
name: 'Auth Service Migration',
participants: ['ops-agent', 'security-agent'],
});List message threads this agent participates in.
| Parameter | Type | Required | Description |
|---|---|---|---|
| status | string | No | Filter: open|resolved|archived |
| limit | number | No | Max threads (default: 20) |
Returns: Promise<{threads: Object[], total: number}>
const { threads } = await claw.getMessageThreads({ status: 'open' });Close a conversation thread with an optional summary.
| Parameter | Type | Required | Description |
|---|---|---|---|
| threadId | string | Yes | Thread ID |
| summary | string | No | Resolution summary |
Returns: Promise<{thread: Object}>
await claw.resolveMessageThread('mt_abc123', 'Migration completed successfully.');Get a URL to download an attachment.
| Parameter | Type | Required | Description |
|---|---|---|---|
| attachmentId | string | Yes | Attachment ID (att_*) |
Returns: string: URL to fetch the attachment binary
const url = claw.getAttachmentUrl('att_abc123');
console.log(url); // https://dashclaw.example.com/api/attachments/att_abc123Download an attachment as a Buffer.
| Parameter | Type | Required | Description |
|---|---|---|---|
| attachmentId | string | Yes | Attachment ID (att_*) |
Returns: Promise<{ data: Buffer, filename: string, mimeType: string }>
const { data, filename, mimeType } = await claw.getAttachment('att_abc123');
fs.writeFileSync(filename, data);Push multiple data categories in a single request. Ideal for bootstrapping agent state or periodic state snapshots. Every key is optional. Only provided categories are processed. Each category is independent; partial failures in one category don't block others.
Sync multiple data categories in a single request. Accepts connections, memory, goals, learning, content, inspiration, context_points, context_threads, handoffs, preferences, and snippets.
| Parameter | Type | Required | Description |
|---|---|---|---|
| state.connections | Object[] | No | Service connections (max 50) |
| state.memory | Object | No | { health, entities[], topics[] } |
| state.goals | Object[] | No | Goals (max 100) |
| state.learning | Object[] | No | Decisions/lessons (max 100) |
| state.context_points | Object[] | No | Key points (max 200) |
| state.context_threads | Object[] | No | Threads (max 50, upserts by name) |
| state.snippets | Object[] | No | Code snippets (max 50, upserts by name) |
| state.handoffs | Object[] | No | Session handoffs (max 50) |
| state.preferences | Object | No | { observations[], preferences[], moods[], approaches[] } |
| state.content | Object[] | No | Content items (max 100) |
| state.inspiration | Object[] | No | Ideas (max 100) |
Returns: Promise<{results: Object, total_synced: number, total_errors: number, duration_ms: number}>
const result = await claw.syncState({
connections: [
{ provider: 'github', auth_type: 'oauth', status: 'active' },
{ provider: 'neon', auth_type: 'api_key', status: 'active' },
],
goals: [
{ title: 'Deploy v2', status: 'active' },
],
learning: [
{ decision: 'Used JWT for Edge compat', reasoning: 'NextAuth on Vercel Edge' },
],
context_points: [
{ content: 'Dark-only theme', category: 'insight', importance: 7 },
],
});
console.log(`Synced ${result.total_synced} items in ${result.duration_ms}ms`);Run guardrails tests, generate compliance proof reports, and import policy packs.
Run guardrails tests against all active policies for the organization. Returns a summary of which policies passed and which failed.
Returns: Promise<{ success: boolean, totals: number, passed: number, failed: number }>
const result = await claw.testPolicies();
console.log(`${result.passed}/${result.totals} policies passed`);
if (!result.success) {
console.warn(`${result.failed} policies failed validation`);
}Generate a compliance proof report summarizing policy test results, guard decisions, and overall posture. Useful for audits and stakeholder reporting.
| Parameter | Type | Required | Description |
|---|---|---|---|
| options.format | string | No | Report format: "json" or "md" (default: "json") |
Returns: Promise<{ report: Object }>
// JSON format (default)
const { report } = await claw.getProofReport();
// Markdown format for sharing
const { report: mdReport } = await claw.getProofReport({ format: 'md' });Import a named policy pack or raw YAML policy definitions. Admin only. Existing policies with the same name are skipped.
| Parameter | Type | Required | Description |
|---|---|---|---|
| pack | string | No | Named policy pack to import (e.g., "enterprise-strict") |
| yaml | string | No | Raw YAML policy definitions to import |
Returns: Promise<{ imported: number, skipped: number, errors: string[] }>
// Import a named pack
const result = await claw.importPolicies({ pack: 'enterprise-strict' });
console.log(`Imported ${result.imported}, skipped ${result.skipped}`);
// Import raw YAML
const yaml = `
- name: block-high-risk
type: risk_threshold
threshold: 80
action: block
`;
await claw.importPolicies({ yaml });Map policies to compliance frameworks, run gap analysis, generate reports, and collect evidence.
Map your active policies to controls in a compliance framework. Shows which controls are covered and which are not.
| Parameter | Type | Required | Description |
|---|---|---|---|
| framework | string | Yes | Framework identifier (e.g., "nist-ai-rmf", "eu-ai-act", "iso-42001") |
Returns: Promise<{ compliance_map: Object }>
const { compliance_map } = await claw.mapCompliance('nist-ai-rmf');
console.log('Covered controls:', compliance_map.covered);
console.log('Uncovered controls:', compliance_map.uncovered);Run a gap analysis against a compliance framework. Returns identified gaps with severity ratings and a remediation plan.
| Parameter | Type | Required | Description |
|---|---|---|---|
| framework | string | Yes | Framework identifier |
Returns: Promise<{ gap_analysis: Object }>
const { gap_analysis } = await claw.analyzeGaps('eu-ai-act');
console.log('Gaps found:', gap_analysis.gaps.length);
for (const gap of gap_analysis.gaps) {
console.log(`[${gap.severity}] ${gap.control}: ${gap.remediation}`);
}Generate a full compliance report and snapshot for a framework. Combines policy mapping, gap analysis, and evidence into a single document.
| Parameter | Type | Required | Description |
|---|---|---|---|
| framework | string | Yes | Framework identifier |
| options.format | string | No | Report format: "json" or "md" (default: "json") |
Returns: Promise<{ report: Object }>
const { report } = await claw.getComplianceReport('iso-42001');
console.log('Overall score:', report.score);
console.log('Status:', report.status);List all available compliance frameworks that can be used for mapping, gap analysis, and reporting.
Returns: Promise<{ frameworks: Object[] }>
const { frameworks } = await claw.listFrameworks();
for (const fw of frameworks) {
console.log(`${fw.id}: ${fw.name} (${fw.controls_count} controls)`);
}Get live compliance evidence collected from guard decisions, policy tests, and agent activity within a time window.
| Parameter | Type | Required | Description |
|---|---|---|---|
| options.window | string | No | Time window for evidence collection (default: "30d") |
Returns: Promise<{ evidence: Object }>
const { evidence } = await claw.getComplianceEvidence({ window: '7d' });
console.log('Evidence items:', evidence.items.length);
console.log('Coverage:', evidence.coverage_pct + '%');Register agents with capabilities, submit tasks for intelligent routing, and track routing health and statistics.
List registered routing agents with optional status filter.
| Parameter | Type | Required | Description |
|---|---|---|---|
| filters.status | string | No | Filter by status: available, busy, offline |
Returns: Promise<{ agents: Object[] }>
const { agents } = await claw.listRoutingAgents({ status: 'available' });
console.log(`${agents.length} agents available for tasks`);Register an agent for task routing with its capabilities and concurrency limits.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Agent name |
| capabilities | string[] | No | List of skills/capabilities (e.g., ["code-review", "deploy"]) |
| maxConcurrent | number | No | Maximum concurrent tasks (default: 1) |
| endpoint | string | No | Webhook endpoint for task notifications |
Returns: Promise<{ agent: Object }>
const { agent } = await claw.registerRoutingAgent({
name: 'deploy-agent',
capabilities: ['deploy', 'rollback', 'health-check'],
maxConcurrent: 3,
endpoint: 'https://my-agent.example.com/tasks',
});Get a single routing agent by ID, including current metrics and task counts.
| Parameter | Type | Required | Description |
|---|---|---|---|
| agentId | string | Yes | Agent ID |
Returns: Promise<{ agent: Object }>
const { agent } = await claw.getRoutingAgent('ra_abc123');
console.log(agent.name, agent.status, agent.active_tasks);Update a routing agent's availability status.
| Parameter | Type | Required | Description |
|---|---|---|---|
| agentId | string | Yes | Agent ID |
| status | string | Yes | New status: available, busy, or offline |
Returns: Promise<{ agent: Object }>
await claw.updateRoutingAgentStatus('ra_abc123', 'busy');Delete a routing agent registration.
| Parameter | Type | Required | Description |
|---|---|---|---|
| agentId | string | Yes | Agent ID |
Returns: Promise<{ deleted: Object }>
await claw.deleteRoutingAgent('ra_abc123');List routing tasks with optional filters for status, assignee, and pagination.
| Parameter | Type | Required | Description |
|---|---|---|---|
| filters.status | string | No | Filter by status: pending, assigned, completed, failed, timed_out |
| filters.assignedTo | string | No | Filter by assigned agent ID |
| filters.limit | number | No | Max results (default: 50) |
Returns: Promise<{ tasks: Object[] }>
const { tasks } = await claw.listRoutingTasks({
status: 'pending',
limit: 10,
});Submit a task for intelligent routing. The system matches required skills to available agents and assigns automatically.
| Parameter | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | Task title |
| description | string | No | Task description |
| requiredSkills | string[] | No | Skills needed to complete this task |
| urgency | string | No | Urgency level: low, normal, high, critical (default: normal) |
| timeoutSeconds | number | No | Task timeout in seconds |
| maxRetries | number | No | Maximum retry attempts on failure |
| callbackUrl | string | No | Webhook URL for task completion notification |
Returns: Promise<{ task: Object, routing: Object }>
const { task, routing } = await claw.submitRoutingTask({
title: 'Deploy auth service v2',
description: 'Deploy the latest auth service build to production',
requiredSkills: ['deploy', 'kubernetes'],
urgency: 'high',
timeoutSeconds: 600,
callbackUrl: 'https://my-app.example.com/hooks/task-done',
});
console.log(`Task ${task.id} assigned to ${routing.assigned_to}`);Mark a routing task as completed with an optional result payload.
| Parameter | Type | Required | Description |
|---|---|---|---|
| taskId | string | Yes | Task ID |
| success | boolean | No | Whether the task succeeded (default: true) |
| result | Object | No | Result data from task execution |
| error | string | No | Error message if task failed |
Returns: Promise<{ task: Object, routing: Object }>
// Success
await claw.completeRoutingTask('rt_abc123', {
success: true,
result: { deployed_version: '2.1.0', pods: 3 },
});
// Failure
await claw.completeRoutingTask('rt_abc123', {
success: false,
error: 'Health check failed after deploy',
});Get aggregate routing statistics including agent counts, task counts, and routing performance metrics.
Returns: Promise<{ agents: Object, tasks: Object, routing: Object }>
const stats = await claw.getRoutingStats();
console.log(`Agents: ${stats.agents.total} (${stats.agents.available} available)`);
console.log(`Tasks: ${stats.tasks.total} (${stats.tasks.pending} pending)`);Get routing system health status, including agent availability and task queue depth.
Returns: Promise<{ status: string, agents: Object, tasks: Object }>
const health = await claw.getRoutingHealth();
console.log('Routing status:', health.status);
console.log('Available agents:', health.agents.available);
console.log('Queued tasks:', health.tasks.queued);Define recurring tasks and cron-based schedules for agents. Visible in the workspace overview.
List agent schedules, optionally filtered by agent.
| Parameter | Type | Required | Description |
|---|---|---|---|
| filters.agent_id | string | No | Filter by agent ID |
Returns: Promise<{ schedules: Object[] }>
const { schedules } = await claw.listAgentSchedules({ agent_id: 'forge' });
schedules.forEach(s => console.log(s.name, s.cron_expression));Create a new agent schedule entry.
| Parameter | Type | Required | Description |
|---|---|---|---|
| schedule.agent_id | string | Yes | Agent this schedule belongs to |
| schedule.name | string | Yes | Schedule name |
| schedule.cron_expression | string | Yes | Cron expression (e.g. 0 */6 * * *) |
| schedule.description | string | No | Human-readable description |
| schedule.enabled | boolean | No | Whether schedule is active (default: true) |
Returns: Promise<{ schedule: Object }>
const { schedule } = await claw.createAgentSchedule({
agent_id: 'forge',
name: 'Build projects',
cron_expression: '0 */6 * * *',
description: 'Check for pending builds every 6 hours'
});One-click agent enrollment. Agents request pairing with a public key, admins approve via a click link.
Create an agent pairing request. Returns a link the user can click to approve the agent.
| Parameter | Type | Required | Description |
|---|---|---|---|
| publicKeyPem | string | Yes | PEM public key (SPKI format) to register for this agent |
| algorithm | string | No | Signing algorithm (default: RSASSA-PKCS1-v1_5) |
| agentName | string | No | Agent display name |
Returns: Promise<{ pairing: Object, pairing_url: string }>
Fetch a pairing request by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
| pairingId | string | Yes | Pairing ID |
Returns: Promise<{ pairing: Object }>
Convenience method: derive a public PEM from a private JWK and create a pairing request in one step.
| Parameter | Type | Required | Description |
|---|---|---|---|
| privateJwk | Object | Yes | Private key in JWK format |
| options.agentName | string | No | Agent display name |
Returns: Promise<{ pairing: Object, pairing_url: string }>
Approve or deny a pending action as a human operator.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actionId | string | Yes | Action ID to approve or deny |
| decision | string | Yes | 'allow' or 'deny' |
| reasoning | string | No | Optional explanation for the decision |
Returns: Promise<{ action: Object }>
await claw.approveAction('act_abc123', 'allow', 'Reviewed and safe to proceed');Get all actions currently waiting for human approval.
| Parameter | Type | Required | Description |
|---|---|---|---|
| limit | number | No | Max results (default: 20) |
| offset | number | No | Pagination offset |
Returns: Promise<{ actions: Object[], total: number }>
const { actions } = await claw.getPendingApprovals({ limit: 10 });Poll a pairing request until it is approved or expires. Throws on timeout or expiration.
| Parameter | Type | Required | Description |
|---|---|---|---|
| pairingId | string | Yes | The pairing ID to poll |
| options.timeout | number | No | Max wait time in ms (default: 300000 / 5 min) |
| options.interval | number | No | Poll interval in ms (default: 2000) |
Returns: Promise<Object>
Register and manage agent public keys for cryptographic action verification. Requires admin API key.
Register or update an agent's public key for identity verification. Upserts on agent_id.
| Parameter | Type | Required | Description |
|---|---|---|---|
| agent_id | string | Yes | Agent ID to register |
| public_key | string | Yes | PEM public key (SPKI format) |
| algorithm | string | No | Signing algorithm (default: RSASSA-PKCS1-v1_5) |
Returns: Promise<{ identity: Object }>
List all registered agent identities for this organization.
Returns: Promise<{ identities: Object[] }>
Manage organizations and API keys. All methods require an admin-role API key.
Get the current organization's details.
Returns: Promise<{ organizations: Object[] }>
Create a new organization with an initial admin API key. The new org always starts on the free plan.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Organization name |
| slug | string | Yes | URL-safe slug (lowercase alphanumeric + hyphens, max 64 chars) |
Returns: Promise<{ organization: Object, api_key: Object }>
Get organization details by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
| orgId | string | Yes | Organization ID |
Returns: Promise<{ organization: Object }>
Update organization details (name, slug).
| Parameter | Type | Required | Description |
|---|---|---|---|
| orgId | string | Yes | Organization ID |
| updates | Object | Yes | Fields to update (name, slug) |
Returns: Promise<{ organization: Object }>
List API keys for an organization. Returns key metadata (prefix, role, label) but never the full key.
| Parameter | Type | Required | Description |
|---|---|---|---|
| orgId | string | Yes | Organization ID |
Returns: Promise<{ keys: Object[] }>
Query the organization-wide activity audit log.
Get activity/audit logs for the organization. Returns paginated results with stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| action | string | No | Filter by action type |
| actor_id | string | No | Filter by actor |
| resource_type | string | No | Filter by resource type |
| before | string | No | Before timestamp (ISO string) |
| after | string | No | After timestamp (ISO string) |
| limit | number | No | Max results (default: 50, max: 200) |
| offset | number | No | Pagination offset |
Returns: Promise<{ logs: Object[], stats: Object, pagination: Object }>
Manage webhook subscriptions for real-time event delivery to your endpoints.
List all webhooks for this organization.
Returns: Promise<{ webhooks: Object[] }>
Create a new webhook subscription.
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | Webhook endpoint URL (must be HTTPS in production) |
| events | string[] | No | Event types to subscribe to |
Returns: Promise<{ webhook: Object }>
Delete a webhook subscription.
| Parameter | Type | Required | Description |
|---|---|---|---|
| webhookId | string | Yes | Webhook ID |
Returns: Promise<{ deleted: boolean }>
Send a test event to a webhook endpoint to verify connectivity.
| Parameter | Type | Required | Description |
|---|---|---|---|
| webhookId | string | Yes | Webhook ID |
Returns: Promise<{ delivery: Object }>
Get delivery history for a webhook. Shows recent attempts, statuses, and response codes.
| Parameter | Type | Required | Description |
|---|---|---|---|
| webhookId | string | Yes | Webhook ID |
Returns: Promise<{ deliveries: Object[] }>
All SDK methods throw on non-2xx responses. Errors include status (HTTP code) and details (when available).
{
message: "Validation failed", // error.message
status: 400, // error.status (HTTP status code)
details: { ... } // error.details (optional)
}try {
const { action_id } = await claw.createAction({
action_type: 'deploy',
declared_goal: 'Deploy to production',
});
} catch (err) {
if (err.status === 401) {
console.error('Invalid API key');
} else if (err.status === 429) {
console.error('Rate limited. Slow down.');
} else {
console.error(`Action failed: ${err.message}`);
}
}The agent-tools/ directory contains Python CLI tools that run locally alongside your agent. They track learning, goals, context, memory health, security, and more in local SQLite databases. Each tool supports an optional --push flag to sync data to your DashClaw dashboard.
Run the installer for your platform, then configure dashboard sync (optional).
bash ./agent-tools/install-mac.sh
powershell -ExecutionPolicy Bypass -File .\agent-tools\install-windows.ps1
# Copy and edit the config file cp agent-tools/.env.example agent-tools/secrets/dashclaw.env # Set your dashboard URL, API key, and agent ID DASHCLAW_URL=http://localhost:3000 # or https://your-app.vercel.app DASHCLAW_API_KEY=oc_live_... DASHCLAW_AGENT_ID=my-agent
Python CLI tools push to the same API endpoints as the JavaScript SDK methods.
| Python Tool | Command | API Endpoint | JS SDK Method |
|---|---|---|---|
| learner.py | log --push | POST /api/learning | recordDecision() |
| goals.py | add --push | POST /api/goals | createGoal() |
| tracker.py | log --push | POST /api/relationships | recordInteraction() |
| scanner.py | scan --push | POST /api/memory | reportMemoryHealth() |
| context.py | capture --push | POST /api/context/points | captureKeyPoint() |
| context.py | thread --push | POST /api/context/threads | createThread() |
| handoff.py | create --push | POST /api/handoffs | createHandoff() |
| snippets.py | add --push | POST /api/snippets | saveSnippet() |
| user_context.py | note --push | POST /api/preferences | logObservation() |
| loops.py | add --push | POST /api/actions/loops | registerOpenLoop() |
| comms.py | log --push | POST /api/relationships | recordInteraction() |
| errors.py | log --push | POST /api/learning | recordDecision() |
| outbound_filter.py | scan --push | POST /api/security/scan | scanContent() |
# Preview what would sync python agent-tools/tools/sync_to_dashclaw.py --dry-run # Sync everything python agent-tools/tools/sync_to_dashclaw.py # Sync specific categories python agent-tools/tools/sync_to_dashclaw.py --categories learning,goals,context_points