Documentation

Integrate CSC-lite into any agent in minutes.

Quick Start

Get governance running in under 60 seconds.

Install
# Clone and install
git clone https://github.com/dgp-standard/csc-kernel.git
cd csc-kernel
npm install

REST API

Authenticate with your API key and call POST /api/v1/evaluate.

Evaluate an Intent
curl -X POST \
  https://csclite.dev/api/v1/evaluate \
  -H "Authorization: Bearer csc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"intent": "Delete all user data"}'
Response
{
  "decision": {
    "id": "a3f2c8d1-...",
    "verdict": "DENY",
    "riskScore": 25,
    "requiresFounder": false,
    "allowActions": [],
    "denyActions": ["DATA_WRITE", "DATA_DELETE"],
    "pipelineTrace": [
      { "stage": "MCM", "summary": "...", "durationMs": 2 },
      { "stage": "RFE", "summary": "...", "durationMs": 1 },
      // ... SPS, SEG, FOP
    ]
  },
  "policyHash": "sha256-...",
  "meta": { "latencyMs": 12, "tier": "pro", "usage": 42, "limit": 50000 }
}

Request Body

FieldTypeDescription
intent*stringRequired. Natural language description of the agent action.
risk"LOW" | "MEDIUM" | "HIGH"Optional risk tier hint.
actionsstring[]Optional action types the agent wants to perform.
command{ program, args? }Optional command execution context.

Verdicts

APPROVE

Action is safe. Proceed.

DENY

Action blocked by policy.

DELAY

Needs more information or cooling period.

ESCALATE_FOUNDER

Requires human (founder) approval.

API Keys & Scopes

Create scoped API keys with fine-grained permissions. Manage keys in the Guardian dashboard under API Keys.

Key Types
# Master key — full access (created on signup)
csc_live_a1b2c3d4...

# Scoped key — limited permissions (created in dashboard)
csc_key_e5f6a7b8...

# Agent key — per-agent identity
csc_agent_x9y0z1w2...

Available Scopes

ScopeGrants Access To
evaluatePOST /api/v1/evaluate
evaluate:batchPOST /api/v1/evaluate/batch
rules:readGET /api/v1/rules
decisions:readGET /api/v1/decisions
decisions:streamGET /api/v1/decisions/stream (SSE)
Using a Scoped Key
# Scoped keys work exactly like master keys
curl -X POST \
  https://csclite.dev/api/v1/evaluate \
  -H "Authorization: Bearer csc_key_YOUR_SCOPED_KEY" \
  -H "Content-Type: application/json" \
  -d '{"intent": "Read user profile"}'

# Empty scopes = full access
# Keys can be revoked instantly from the dashboard

Webhooks

Get notified when founders approve or deny escalated decisions. Signed with HMAC-SHA256 and retried automatically.

Webhook Payload
# POST to your webhook URL on approve/deny
{
  "event": "decision.approved",
  "decisionId": "a3f2c8d1-...",
  "actor": "agent-1",
  "action": "Deploy to production",
  "verdict": "APPROVE",
  "riskScore": 72,
  "timestamp": "2026-02-22T12:00:00Z"
}
Verify Webhook Signature
import { createHmac } from "node:crypto";

function verifyWebhook(body: string, sig: string, secret: string) {
  const expected = createHmac("sha256", secret)
    .update(body).digest("hex");
  return sig === `sha256=${expected}`;
}

// Check the X-CSC-Signature header
const sig = req.headers["x-csc-signature"];
if (!verifyWebhook(rawBody, sig, process.env.WEBHOOK_SECRET!)) {
  return new Response("Invalid signature", { status: 401 });
}

Delivery Guarantees

Retries

3 attempts with exponential backoff (1s, 5s, 25s).

Circuit Breaker

Auto-disables after 5 consecutive failures. Recovers via half-open probe.

HMAC Signing

SHA-256 signature on every payload via X-CSC-Signature header.

Streaming & Audit

Real-time decision streams, audit export, and data retention policies.

SSE Decision Stream

Server-Sent Events
# Stream governance decisions in real time
curl -N \
  https://csclite.dev/api/v1/decisions/stream \
  -H "Authorization: Bearer csc_live_YOUR_KEY"

# Events arrive as SSE:
# data: {"id":"...","verdict":"DENY","riskScore":25,...}
# data: {"id":"...","verdict":"APPROVE","riskScore":92,...}

Audit Query & Export

Query with Filters
# Query audit log with filters
curl "https://csclite.dev/api/v1/audit?verdict=DENY&from=2026-01-01&limit=50" \
  -H "Authorization: Bearer csc_live_YOUR_KEY"

# Export as CSV or JSONL (up to 50,000 records)
curl "https://csclite.dev/api/v1/audit/export?format=csv" \
  -H "Authorization: Bearer csc_live_YOUR_KEY" \
  -o audit.csv

Audit Filters

ParamDescription
verdictAPPROVE | DENY | ESCALATE_FOUNDER
actorFilter by agent ID or actor name
typeEvent type: decision | system | module
kindAction kind: shell_exec, fs_write, etc.
from / toISO 8601 date range (inclusive)
limitMax records (default 100, max 1000)
offsetPagination offset
formatExport only: csv or jsonl

Retention Policies

Per-Tenant Retention
# Set 90-day retention for a tenant
curl -X POST \
  https://csclite.dev/api/v1/retention \
  -H "Authorization: Bearer csc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tenantId": "acme-corp", "maxAgeDays": 90}'

# Trigger manual prune
curl -X POST https://csclite.dev/api/v1/retention/prune \
  -H "Authorization: Bearer csc_live_YOUR_KEY"

# Multi-tenant: scope any request with X-CSC-Tenant-Id
curl https://csclite.dev/api/v1/audit \
  -H "Authorization: Bearer csc_live_YOUR_KEY" \
  -H "X-CSC-Tenant-Id: acme-corp"

MCP Server

Connect CSC-lite to Claude Desktop, Cursor, or any MCP-compatible client. Agents get governance tools natively.

Install
npm install -g @csc-lite/mcp-server
Claude Desktop Config
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "csc-lite": {
      "command": "csc-lite-mcp",
      "env": {
        "CSC_API_KEY": "csc_live_YOUR_KEY"
      }
    }
  }
}

Available MCP Tools

evaluate

Evaluate an agent intent through the governance pipeline.

evaluate_batch

Evaluate multiple intents in a single call.

list_rules

List all active governance rules.

list_decisions

Query recent governance decisions.

TypeScript SDK

Use the kernel directly for maximum control.

Evaluate an Intent
import { CSCKernel } from "csc-lite";

const kernel = new CSCKernel();
const { decision } = await kernel.evaluate(
  "Read the config file"
);

console.log(decision.verdict);   // "APPROVE"
console.log(decision.riskScore); // 95
OpenClaw Governance Boundary
import { GovernanceWrapper, GovernedToolRegistry, EXEC_TOOL }
  from "csc-lite/openclaw";

const registry = new GovernedToolRegistry();
registry.register(EXEC_TOOL);

const wrapper = new GovernanceWrapper(registry);

const result = await wrapper.propose({
  toolName: "exec",
  args: { command: "node --version" },
});

console.log(result.status);       // "APPROVED"
console.log(result.decisionHash); // "a3f2..."
Verify an Audit Chain
import { FileAuditSink } from "csc-lite/audit";

const audit = new FileAuditSink("./csc-audit.jsonl");
const { valid, total } = await audit.verifyChain();

console.log(valid); // true
console.log(total); // 47
Run Tests
npm test     # 49 tests, 0 failures
npm run demo # 5-scene confrontation demo

Python SDK

Governance for Python agents. Supports both sync and async clients.

Install
pip install csc-lite
Sync Client
from csc_lite import CSCClient

csc = CSCClient(api_key="csc_live_...")

result = csc.evaluate("Delete all user data")
print(result.decision.verdict)     # "DENY"
print(result.decision.risk_score)  # 85
Async Client
from csc_lite import CSCAsyncClient

async with CSCAsyncClient(api_key="csc_live_...") as csc:
    result = await csc.evaluate("Send payment")
    if result.decision.verdict == "APPROVE":
        print("Safe to proceed")
Guard (Raises on Deny)
try:
    csc.guard("DROP TABLE users")
except CSCApiError:
    print("Action blocked by governance")

CLI Tool

Evaluate intents, list rules, and query decisions from your terminal.

Install
npm install -g @csc-lite/cli
Commands
# Set your API key
export CSC_API_KEY=csc_live_your_key

# Evaluate a single intent
csc-lite evaluate "Delete all user data"

# Evaluate with risk hint
csc-lite evaluate "Send payment" --risk HIGH

# Batch evaluate multiple intents
csc-lite batch "Read config" "Delete database" "Send email"

# List active governance rules
csc-lite rules

# Show recent decisions
csc-lite decisions --limit 10

# Guard mode — exit non-zero if denied
csc-lite guard "Deploy to production" || echo "BLOCKED"

# JSON output for scripting
csc-lite evaluate "Read user profile" --json
CI/CD Integration
# In your deployment script or GitHub Action
csc-lite guard "Deploy $SERVICE to production" --risk HIGH
if [ $? -eq 0 ]; then
  echo "Governance approved — deploying..."
  kubectl apply -f deploy.yaml
else
  echo "Deployment blocked by governance policy"
  exit 1
fi

Integration Examples

Add governance to popular AI agent frameworks in minutes.

LangChain

Governed Tool Wrapper
from csc_lite import CSCClient

csc = CSCClient(api_key=os.environ["CSC_API_KEY"])

def governed_tool_call(tool_name: str, tool_input: str):
    result = csc.evaluate(
        f"{tool_name}: {tool_input}",
        actions=[tool_name],
    )
    if result.decision.verdict == "APPROVE":
        return "approved"  # proceed with tool
    return "denied"      # block the tool call

CrewAI

Governed Agent Class
class GovernedAgent:
    def __init__(self, name, role):
        self.name = name
        self.role = role

    def execute(self, task):
        result = csc.evaluate(
            f"[{self.role}] {task}",
            actions=[self.role.lower().replace(" ", "_")],
        )
        return {  # use verdict to gate execution
            "verdict": result.decision.verdict,
            "risk": result.decision.risk_score,
        }

# Usage with CrewAI callback
agent = GovernedAgent("analyst", "Research Analyst")
result = agent.execute("Analyze user behavior data")

OpenAI Function Calling

Governed Function Executor
import { CSCClient } from "@csc-lite/sdk";

const csc = new CSCClient({ apiKey: process.env.CSC_API_KEY! });

async function executeFunction(name: string, args: object) {
  const result = await csc.evaluate({
    intent: `{name}: {JSON.stringify(args)}`,
    actions: [name],
  });

  if (result.decision.verdict !== "APPROVE") {
    throw new Error(`Blocked: {result.decision.verdict}`);
  }
  // safe to call the actual function
}

Full examples on GitHub

LangChain, CrewAI, OpenAI, and more in the packages/examples/ directory.

View Examples

Pipeline Architecture

Agentpropose()MCMRFESPSSEGFOPVerdictExecutorAudit
MCMMission Control Module

Initial classification and intent parsing

RFERisk Factor Engine

Multi-dimensional risk scoring (0-100)

SPSSafety Policy Shield

Sovereign policy enforcement and action filtering

SEGSemantic Governance

NLP-level intent analysis and anomaly detection

FOPFounder Override Protocol

Escalation path for high-risk decisions

Zero runtime dependencies. TypeScript. MIT License.

View on GitHub