/instrument-agent
Integrate DashClaw SDK into any agent using the 4-step governance loop
Claude Code
$ npx -y skills add ucsandman/DashClaw --skill instrument-agent --agent claude-code
Codex
$ npx skills add ucsandman/DashClaw --skill instrument-agent -a codex -y
Cursor
$ npx skills add ucsandman/DashClaw --skill instrument-agent -a cursor -y
Gemini CLI
$ npx skills add ucsandman/DashClaw --skill instrument-agent -a gemini-cli -y
GitHub Copilot
$ npx skills add ucsandman/DashClaw --skill instrument-agent -a github-copilot -y
OpenCode
$ npx skills add ucsandman/DashClaw --skill instrument-agent -a opencode -y
Windsurf
$ npx skills add ucsandman/DashClaw --skill instrument-agent -a windsurf -y
SKILL.md
instrument-agent.SKILL.mdname: instrument-agent
description: Integrate DashClaw SDK into any agent using the 4-step governance loop
license: MIT
metadata:
author: ucsandman
version: "1.0.0"
category: integration
Instrument Your Agent with DashClaw
Help developers add DashClaw governance to any AI agent. Walk through the 4-step governance loop with working code.
The 4-Step Governance Loop
Every governed decision follows this deterministic flow:
1. Guard → "Can I do this?" (POST /api/guard)
2. Record → "I am doing this." (POST /api/actions)
3. Verify → "I believe this is true." (POST /api/assumptions)
4. Outcome → "This was the result." (PATCH /api/actions/:id)
Step 0: Install & Initialize
Node.js
npm install dashclaw
import { DashClaw } from 'dashclaw';
const claw = new DashClaw({
baseUrl: process.env.DASHCLAW_BASE_URL,
apiKey: process.env.DASHCLAW_API_KEY,
agentId: 'my-agent'
});Python
pip install dashclaw
from dashclaw import DashClaw
claw = DashClaw(
base_url=os.environ["DASHCLAW_BASE_URL"],
api_key=os.environ["DASHCLAW_API_KEY"],
agent_id="my-agent"
)Step 0.5: Session Lifecycle (Optional but Recommended)
Create a session to track the full lifecycle of your agent's work. Sessions enable monitoring, recovery, and continuity across restarts.
// Create a session at agent startup
const session = await fetch(`${baseUrl}/api/sessions`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ agent_id: 'my-agent', metadata: { task: 'deploy-pipeline' } })
}).then(r => r.json());
// Report status during execution
await fetch(`${baseUrl}/api/sessions/${session.id}`, {
method: 'PATCH',
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ status: 'running', checkpoint: { step: 'guard-check' } })
});Session lifecycle is optional — all governance loop steps work without it — but it provides visibility into long-running agent tasks and enables automatic recovery when sessions are interrupted.
Step 1: Guard — Check Policy Before Acting
const decision = await claw.guard({
action_type: 'deploy',
declared_goal: 'Deploy build #402 to production',
risk_score: 85,
systems_touched: ['production', 'database'],
reversible: false
});
// decision.decision: 'allow' | 'warn' | 'block' | 'require_approval'
if (decision.decision === 'block') {
console.log('Blocked:', decision.reason);
return;
}decision = claw.guard(
action_type="deploy",
declared_goal="Deploy build #402 to production",
risk_score=85,
systems_touched=["production", "database"],
reversible=False
)
if decision["decision"] == "block":
print(f"Blocked: {decision['reason']}")
return**Guard response shape:**
{
"decision": "require_approval",
"action_id": "act_gd_abc123",
"reason": "Risk score exceeds org threshold",
"signals": ["Production access", "High risk score"],
"risk_score": 75,
"agent_risk_score": 85,
"recovery_recipes": [
{ "action": "reduce_scope", "description": "Deploy to staging first" }
]
}Guard Policy Types to Handle
The guard may enforce these policy types — your agent should be prepared to respond to each:
- **`permission_escalation`** — The action requires a higher `permission_level` than currently granted. Re-request with elevated permissions or abort.
- **`green_contract`** — The action requires test verification before execution (e.g., tests must pass before deploying). Run tests and include evidence in the guard request.
- **`branch_freshness`** — The action targets a stale branch. Pull latest changes or rebase before retrying.
When the guard blocks an action, check the `recovery_recipes` array in the response for actionable remediation steps.
Step 2: Record — Log the Action
const action = await claw.createAction({
action_type: 'deploy',
declared_goal: 'Deploy build #402 to production',
risk_score: 85,
reversible: false,
systems_touched: ['production']
});
// action.action_id: 'ar_abc123'action = claw.create_action(
action_type="deploy",
declared_goal="Deploy build #402 to production",
risk_score=85,
reversible=False,
systems_touched=["production"]
)Step 3: Verify — Record Assumptions
await claw.recordAssumption({
action_id: action.action_id,
assumption: 'Staging tests passed successfully',
source: 'ci-pipeline'
});claw.record_assumption(
action_id=action["action_id"],
assumption="Staging tests passed successfully",
source="ci-pipeline"
)Step 4: Outcome — Record the Result
await claw.updateOutcome(action.action_id, {
status: 'completed', // or 'failed'
output_summary: 'Build #402 deployed successfully to production',
timestamp_end: new Date().toISOString(),
// Optional — populates Analytics cost/token charts. When tokens + model
// are supplied without an explicit cost_estimate, the server derives
// cost from the configured pricing table.
tokens_in: result.usage?.input_tokens,
tokens_out: result.usage?.output_tokens,
model: result.model,
});claw.update_outcome(action["action_id"],
status="completed",
output_summary="Build #402 deployed successfully to production",
# Optional — populates Analytics cost/token charts.
tokens_in=response.usage.input_tokens,
tokens_out=response.usage.output_tokens,
model=response.model,
)Complete Example
import { DashClaw } from 'dashclaw';
const claw = new DashClaw({
baseUrl: process.env.DASHCLAW_BASE_URL,
apiKey: process.env.DASHCLAW_API_KEY,
agentId: 'deploy-agent'
});
async function governedDeploy(buildId) {
// 1. Guard
const decision = await claw.guaRead more
name: instrument-agent description: Integrate DashClaw SDK into any agent using the 4-step governance loop license: MIT metadata: author: ucsandman version: "1.0.0" category: integration
Instrument Your Agent with DashClaw
Help developers add DashClaw governance to any AI agent. Walk through the 4-step governance loop with working code.
The 4-Step Governance Loop
Every governed decision follows this deterministic flow:
1. Guard → "Can I do this?" (POST /api/guard) 2. Record → "I am doing this." (POST /api/actions) 3. Verify → "I believe this is true." (POST /api/assumptions) 4. Outcome → "This was the result." (PATCH /api/actions/:id)
Step 0: Install & Initialize
Node.js
npm install dashclaw
import { DashClaw } from 'dashclaw';
const claw = new DashClaw({
baseUrl: process.env.DASHCLAW_BASE_URL,
apiKey: process.env.DASHCLAW_API_KEY,
agentId: 'my-agent'
});Python
pip install dashclaw
from dashclaw import DashClaw
claw = DashClaw(
base_url=os.environ["DASHCLAW_BASE_URL"],
api_key=os.environ["DASHCLAW_API_KEY"],
agent_id="my-agent"
)Step 0.5: Session Lifecycle (Optional but Recommended)
Create a session to track the full lifecycle of your agent's work. Sessions enable monitoring, recovery, and continuity across restarts.
// Create a session at agent startup
const session = await fetch(`${baseUrl}/api/sessions`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ agent_id: 'my-agent', metadata: { task: 'deploy-pipeline' } })
}).then(r => r.json());
// Report status during execution
await fetch(`${baseUrl}/api/sessions/${session.id}`, {
method: 'PATCH',
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ status: 'running', checkpoint: { step: 'guard-check' } })
});Session lifecycle is optional — all governance loop steps work without it — but it provides visibility into long-running agent tasks and enables automatic recovery when sessions are interrupted.
Step 1: Guard — Check Policy Before Acting
const decision = await claw.guard({
action_type: 'deploy',
declared_goal: 'Deploy build #402 to production',
risk_score: 85,
systems_touched: ['production', 'database'],
reversible: false
});
// decision.decision: 'allow' | 'warn' | 'block' | 'require_approval'
if (decision.decision === 'block') {
console.log('Blocked:', decision.reason);
return;
}decision = claw.guard(
action_type="deploy",
declared_goal="Deploy build #402 to production",
risk_score=85,
systems_touched=["production", "database"],
reversible=False
)
if decision["decision"] == "block":
print(f"Blocked: {decision['reason']}")
return**Guard response shape:**
{
"decision": "require_approval",
"action_id": "act_gd_abc123",
"reason": "Risk score exceeds org threshold",
"signals": ["Production access", "High risk score"],
"risk_score": 75,
"agent_risk_score": 85,
"recovery_recipes": [
{ "action": "reduce_scope", "description": "Deploy to staging first" }
]
}Guard Policy Types to Handle
The guard may enforce these policy types — your agent should be prepared to respond to each:
- **`permission_escalation`** — The action requires a higher `permission_level` than currently granted. Re-request with elevated permissions or abort.
- **`green_contract`** — The action requires test verification before execution (e.g., tests must pass before deploying). Run tests and include evidence in the guard request.
- **`branch_freshness`** — The action targets a stale branch. Pull latest changes or rebase before retrying.
When the guard blocks an action, check the `recovery_recipes` array in the response for actionable remediation steps.
Step 2: Record — Log the Action
const action = await claw.createAction({
action_type: 'deploy',
declared_goal: 'Deploy build #402 to production',
risk_score: 85,
reversible: false,
systems_touched: ['production']
});
// action.action_id: 'ar_abc123'action = claw.create_action(
action_type="deploy",
declared_goal="Deploy build #402 to production",
risk_score=85,
reversible=False,
systems_touched=["production"]
)Step 3: Verify — Record Assumptions
await claw.recordAssumption({
action_id: action.action_id,
assumption: 'Staging tests passed successfully',
source: 'ci-pipeline'
});claw.record_assumption(
action_id=action["action_id"],
assumption="Staging tests passed successfully",
source="ci-pipeline"
)Step 4: Outcome — Record the Result
await claw.updateOutcome(action.action_id, {
status: 'completed', // or 'failed'
output_summary: 'Build #402 deployed successfully to production',
timestamp_end: new Date().toISOString(),
// Optional — populates Analytics cost/token charts. When tokens + model
// are supplied without an explicit cost_estimate, the server derives
// cost from the configured pricing table.
tokens_in: result.usage?.input_tokens,
tokens_out: result.usage?.output_tokens,
model: result.model,
});claw.update_outcome(action["action_id"],
status="completed",
output_summary="Build #402 deployed successfully to production",
# Optional — populates Analytics cost/token charts.
tokens_in=response.usage.input_tokens,
tokens_out=response.usage.output_tokens,
model=response.model,
)Complete Example
import { DashClaw } from 'dashclaw';
const claw = new DashClaw({
baseUrl: process.env.DASHCLAW_BASE_URL,
apiKey: process.env.DASHCLAW_API_KEY,
agentId: 'deploy-agent'
});
async function governedDeploy(buildId) {
// 1. Guard
const decision = await claw.guaOther skills on dashclaw.
build-dashclaw
Contribute to the DashClaw codebase — architecture, scaffolding, tests, CI
compliance-drift-evals
Set up compliance exports, drift detection, evaluations, scoring, and learning analytics
manage-approvals
Human-in-the-loop approval workflows for governed agent actions
register-on-dashclaw
Register any agent (including this one) as a governed agent on a DashClaw instance
More skills from other plugins.
api-security
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
abusing-dpapi-for-cred…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
clean-user-facing-text
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…
Questions about instrument-agent.
- Which coding agents can use instrument-agent?
- instrument-agent installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

