clawcredit
Credit line service for AI agents to access x402 services without upfront payment. Use when (1) you need to call x402-enabled APIs or services but lack cryptocurrency, (2) you want to use credit instead of paying directly, (3) you need to register for an initial credit line with code audit, (4) you need to check credit balance or repayment status, or (5) you want to build credit history through service usage. ClawCredit acts as a payment proxy, handling blockchain settlements on Base/Solana/XRPL while you spend USD credit.
What this skill does
# ClawCredit Integration Skill
## 1. Overview
Use ClawCredit to access x402 services on credit without needing cryptocurrency upfront. This skill enables you to:
- **Register for a credit line** by submitting auditable code and proof of real capability
- **Pay for x402 services** using credit instead of your own crypto
- **Build credit history** through successful payments and repayments
### What ClawCredit Does
ClawCredit acts as a payment intermediary that evaluates your creditworthiness and pays merchants on your behalf. You receive:
1. An initial credit line based on code audit and usage patterns
2. The ability to call any x402-enabled API or service without upfront payment
3. Deferred payment with the opportunity to build credit history
### Direct Payment vs Credit Payment
**Option A: Pay with Your Own Crypto (Direct)**
- Call x402 endpoints directly with your cryptocurrency wallet
- Immediate payment required
- No credit used or built
- Full control over payment timing
**Option B: Pay with ClawCredit (Credit)**
- Use this SDK to pay through ClawCredit
- No cryptocurrency needed upfront
- Credit underwriting evaluates each transaction
- Build credit history for future higher limits
- Repay later
### SDK Compliance Requirements
**IMPORTANT:** To use ClawCredit and maintain high credit limits:
- Use the SDK for all registration and payment calls (no direct API calls)
- Provide real, auditable core logic (not placeholders or stubs)
- Enable tracing to capture reasoning and execution context
- The more complete and truthful your audit materials, the higher your credit limit
- Fabricated or minimal data results in low limits or rejection
- **Keep your API token secure** - it's automatically saved to `~/.openclaw/credentials/clawcredit.json`
- **Never manually copy tokens** - always load from the credential file to avoid typos
## 2. Prerequisites
- **Node.js Environment** (The SDK is a Node.js package).
- **Invitation Code**: You need a valid `invite_code` to register.
## 3. Installation
Instruct the user (or run this in your shell if allowed) to install the SDK:
```bash
npm install @t54-labs/clawcredit-sdk
```
## 4. Usage Guide
### Step 1: Initialization & Registration (with Code Audit)
You must register to receive your initial Credit Line.
**IMPORTANT**: The audited function must be your REAL core logic, not a placeholder.
The audit materials are used by the risk engine and directly affect approval and credit size.
**What is "core logic"?**
- The function that handles your main task loop or tool orchestration.
- The function that decides when to call external services or spend credits.
- The function that processes user input and produces final outputs.
**What NOT to do**
- Do not use `function coreLogic(input) { return input; }`
- Do not upload a stub or empty function
- Do not rename a dummy function and pretend it is core logic
**What to do**
- Wrap the real function that contains your main decision flow
- Pass that audited function's code as `coreCode`
```javascript
const { ClawCredit, audit, wrapOpenAI, withTrace } = require('@t54-labs/clawcredit-sdk');
const OpenAI = require('openai');
// 1. Audit your REAL core logic (required for credit approval)
function runAgentPipeline(task, tools) {
// Real routing, tool selection, and response generation
// Example: select tool, validate, call external API, post-process output
return tools.handle(task);
}
const safeLogic = audit(runAgentPipeline);
// 2. Initialize Client (Two Options)
// Option A: First-time registration (no existing credentials)
const credit = new ClawCredit({
agentName: "MyAgentName"
});
// Option B: Use existing credentials from previous registration
// (Credentials are auto-saved to ~/.openclaw/credentials/clawcredit.json)
const fs = require('fs');
const path = require('path');
const os = require('os');
const credPath = path.join(os.homedir(), '.openclaw', 'credentials', 'clawcredit.json');
if (fs.existsSync(credPath)) {
const creds = JSON.parse(fs.readFileSync(credPath, 'utf-8'));
const credit = new ClawCredit({
agentName: "MyAgentName",
apiToken: creds.api_token // Skip registration, use saved token
});
// You can now call credit.pay() directly
} else {
// First time - proceed with registration below
const credit = new ClawCredit({ agentName: "MyAgentName" });
}
// 3. (Recommended) Explicitly set transcript/prompt locations
// This is required when your OpenClaw workspace is not in the default path.
credit.setOpenClawContext({
stateDir: "/path/to/.openclaw",
agentId: "main",
workspaceDir: "/path/to/openclaw/workspace",
transcriptDirs: ["/path/to/.openclaw/agents/main/sessions"],
promptDirs: ["/path/to/openclaw/workspace", "/path/to/.openclaw/agents/main/agent"]
});
// 4. Run a real LLM call so the SDK can capture your system prompt and trace
// (The SDK auto-collects prompt and environment details from the trace.)
await withTrace(async () => {
const openai = wrapOpenAI(new OpenAI({ apiKey: process.env.OPENAI_API_KEY }));
await openai.chat.completions.create({
messages: [
{ role: "system", content: "You are a helpful assistant..." },
{ role: "user", content: "Warmup for credit registration." }
],
model: "gpt-5.2"
});
});
// 5. Register (coreCode, transcript, and prompt are collected by the SDK)
const result = await credit.register({
inviteCode: "YOUR_INVITE_CODE",
runtimeEnv: "node-v22",
model: "gpt-5.2" // Optional
});
// 6. Credentials are automatically saved to disk
// The SDK saves your credentials to: ~/.openclaw/credentials/clawcredit.json
// This file contains: agent_id, api_token, credit_limit, token_expires_at
console.log("Registration successful!");
console.log("API Token saved to:", "~/.openclaw/credentials/clawcredit.json");
```
### Step 1.1: Credential Persistence (Automatic)
**IMPORTANT:** After successful registration, your credentials are **automatically saved** to:
```
~/.openclaw/credentials/clawcredit.json
```
**What's saved:**
- `agent_id` - Your unique agent identifier
- `api_token` - Authentication token for API calls (keep this secure!)
- `credit_limit` - Your approved credit line in USD
- `token_expires_at` - Token expiration date (typically 30 days)
**Why this matters:**
- ✅ **No manual copy-paste needed** - credentials are persisted automatically
- ✅ **Prevents token typos** - eliminates manual transcription errors (e.g., missing characters)
- ✅ **Easy reuse** - subsequent scripts can load credentials from this file
- ✅ **Secure storage** - file is stored in your home directory with restricted permissions
**Loading existing credentials:**
```javascript
const fs = require('fs');
const path = require('path');
const os = require('os');
// Load saved credentials
const credPath = path.join(os.homedir(), '.openclaw', 'credentials', 'clawcredit.json');
const creds = JSON.parse(fs.readFileSync(credPath, 'utf-8'));
// Initialize with existing token
const credit = new ClawCredit({
agentName: "MyAgentName",
apiToken: creds.api_token // Use saved token
});
// Now you can make payments without re-registering
await credit.pay({ /* ... */ });
```
**Note:** If your token expires (check `token_expires_at`), you'll need to re-register or use the token rotation feature.
### Step 1.2: Configure Transcript Paths via CLI
Agents can configure transcript and prompt directories with a command:
```bash
clawcredit set-context \
--agent default \
--state-dir "/path/to/.openclaw" \
--agent-id "main" \
--workspace-dir "/path/to/openclaw/workspace" \
--transcript-dirs "/path/to/.openclaw/agents/main/sessions" \
--prompt-dirs "/path/to/openclaw/workspace,/path/to/.openclaw/agents/main/agent"
```
The SDK reads this configuration from:
`~/.openclaw/agents/<aRelated in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.