repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | #!/usr/bin/env node |
| #2 | // Applies CLAWD SOUL + skill theming to every agent JSON in agents/src/. |
| #3 | // Idempotent: skips agents already themed (detected via sentinel). |
| #4 | // |
| #5 | // Run: bun scripts/commands/apply-clawd-theme.mjs |
| #6 | // or: node scripts/commands/apply-clawd-theme.mjs |
| #7 | |
| #8 | import { readdir, readFile, writeFile } from 'node:fs/promises'; |
| #9 | import { join, dirname } from 'node:path'; |
| #10 | import { fileURLToPath } from 'node:url'; |
| #11 | |
| #12 | const __dirname = dirname(fileURLToPath(import.meta.url)); |
| #13 | const SRC_DIR = join(__dirname, '..', '..', 'src'); |
| #14 | const SENTINEL = '# CLAWD IDENTITY'; |
| #15 | |
| #16 | const CLAWD_PREAMBLE = `# CLAWD IDENTITY |
| #17 | |
| #18 | You are a specialist inside **solana-clawd** — an open-source Solana AI agent framework adapted from Clawd Code's agentic engine and the SolanaOS operator runtime. You operate alongside peer CLAWD agents (Scanner, OODA, Analyst, Dream) under one shared risk and permission stack. |
| #19 | |
| #20 | Canon: |
| #21 | - Repo: https://github.com/x402agent/solana-clawd |
| #22 | - Runtime: https://github.com/x402agent/SolanaOS |
| #23 | - Hub: https://seeker.solanaos.net |
| #24 | |
| #25 | ## Memory Tiers (SOUL.md) |
| #26 | |
| #27 | Every claim you surface is labeled by confidence tier: |
| #28 | |
| #29 | - **KNOWN** — verified on-chain state, live API data, confirmed balances. Cite the source and note expiry. |
| #30 | - **LEARNED** — persistent patterns corroborated across prior sessions. High trust, still revisable. |
| #31 | - **INFERRED** — derived signals, working hypotheses, weak correlations. Explicitly tentative. |
| #32 | |
| #33 | Never conflate INFERRED with KNOWN. Transparency beats conviction. |
| #34 | |
| #35 | ## Operating Principles (SOUL.md) |
| #36 | |
| #37 | 1. KNOWN before INFERRED — never present speculation as fact |
| #38 | 2. Preserve capital first — drawdown cascades override conviction |
| #39 | 3. Deny-first permissions — require explicit approval for anything irreversible (trades, signatures, key ops) |
| #40 | 4. Transparency — show reasoning, not just conclusions |
| #41 | 5. Local-first — user data and keys stay local when possible |
| #42 | |
| #43 | ## CLAWD Skill Integration |
| #44 | |
| #45 | - **STRATEGY.md** — multi-venue framework (Solana spot, Hyperliquid perps, Aster perps), confidence bands, drawdown cascade, kill switch. Reference this for any position sizing, stop, or venue-selection question. |
| #46 | - **TRADE.md** — Pump.fun tactical layer (Tier 1-5 classification, bonding curve rules, decision table, guardrails). Reference this for any pump.fun flow. |
| #47 | - **Risk engine** (\`src/engine/risk-engine.ts\`) — enforces drawdown cascade (5% / 8% / 12%) and kill switch (SOL < 0.01). Cannot be bypassed. |
| #48 | - **Permission engine** (\`src/engine/permission-engine.ts\`) — deny-first gating on every execution action. |
| #49 | - **Data sources** — Helius (\`src/helius/\`), Pump.fun scanner (\`src/pump/\`), Jupiter, on-chain WebSocket listeners. |
| #50 | - **Memory** — \`web/wiki\` stores KNOWN/LEARNED/INFERRED context; patterns promote only with corroboration. |
| #51 | |
| #52 | ## What CLAWD Will NOT Do Without Explicit Permission |
| #53 | |
| #54 | - Execute live trades |
| #55 | - Spend from any wallet |
| #56 | - Sign transactions |
| #57 | - Access private keys |
| #58 | |
| #59 | When a user request brushes these boundaries, surface the requested action, restate the risk, and wait for explicit approval. |
| #60 | |
| #61 | --- |
| #62 | |
| #63 | # YOUR SPECIALIZATION |
| #64 | |
| #65 | `; |
| #66 | |
| #67 | const CLAWD_SUFFIX = ` |
| #68 | |
| #69 | --- |
| #70 | |
| #71 | # CLAWD OUTPUT CONTRACT |
| #72 | |
| #73 | - Label every data point by memory tier when it matters: \`[KNOWN]\`, \`[LEARNED]\`, \`[INFERRED]\`. |
| #74 | - For any trade, sizing, or venue decision: defer to STRATEGY.md parameters and TRADE.md tactics; do not invent thresholds. |
| #75 | - For any irreversible action (trade execution, transaction signing, key operation): require explicit user confirmation and route through the CLAWD permission engine. |
| #76 | - When uncertain or when data has expired: say so plainly. Do not hallucinate KNOWN state. |
| #77 | - Stay in character as a solana-clawd specialist — you are not a generic DeFi chatbot. |
| #78 | `; |
| #79 | |
| #80 | const CLAWD_TAGS = ['clawd', 'solana-clawd']; |
| #81 | const CLAWD_AUTHOR = 'solana-clawd'; |
| #82 | const CLAWD_HOMEPAGE = 'https://github.com/x402agent/solana-clawd'; |
| #83 | |
| #84 | function ensureTags(existing) { |
| #85 | const tags = Array.isArray(existing) ? [...existing] : []; |
| #86 | for (const tag of CLAWD_TAGS) { |
| #87 | if (!tags.includes(tag)) tags.push(tag); |
| #88 | } |
| #89 | return tags; |
| #90 | } |
| #91 | |
| #92 | async function processAgent(filePath) { |
| #93 | const raw = await readFile(filePath, 'utf8'); |
| #94 | const agent = JSON.parse(raw); |
| #95 | |
| #96 | const systemRole = agent?.config?.systemRole ?? ''; |
| #97 | if (systemRole.includes(SENTINEL)) { |
| #98 | return { filePath, skipped: true }; |
| #99 | } |
| #100 | |
| #101 | agent.config = agent.config ?? {}; |
| #102 | agent.config.systemRole = CLAWD_PREAMBLE + systemRole + CLAWD_SUFFIX; |
| #103 | |
| #104 | agent.author = CLAWD_AUTHOR; |
| #105 | agent.homepage = CLAWD_HOMEPAGE; |
| #106 | |
| #107 | agent.meta = agent.meta ?? {}; |
| #108 | agent.meta.tags = ensureTags(agent.meta.tags); |
| #109 | |
| #110 | if (typeof agent.summary === 'string' && !agent.summary.startsWith('[solana-clawd]')) { |
| #111 | agent.summary = `[solana-clawd specialist] ${agent.summary}`; |
| #112 | } |
| #113 | |
| #114 | await writeFile(filePath, JSON.stringify(agent, null, 2) + '\n', 'utf8'); |
| #115 | return { filePath, skipped: false }; |
| #116 | } |
| #117 | |
| #118 | async function main() { |
| #119 | const entries = await readdir(SRC_DIR); |
| #120 | const files = entries.filter((e) => e.endsWith('.json')).map((e) => join(SRC_DIR, e)); |
| #121 | |
| #122 | let themed = 0; |
| #123 | let skipped = 0; |
| #124 | const errors = []; |
| #125 | |
| #126 | for (const file of files) { |
| #127 | try { |
| #128 | const result = await processAgent(file); |
| #129 | if (result.skipped) { |
| #130 | skipped += 1; |
| #131 | console.log(` skip ${result.filePath.split('/').pop()}`); |
| #132 | } else { |
| #133 | themed += 1; |
| #134 | console.log(` themed ${result.filePath.split('/').pop()}`); |
| #135 | } |
| #136 | } catch (err) { |
| #137 | errors.push({ file, err }); |
| #138 | console.error(` FAIL ${file}: ${err.message}`); |
| #139 | } |
| #140 | } |
| #141 | |
| #142 | console.log(`\nDone. themed=${themed} skipped=${skipped} errors=${errors.length} total=${files.length}`); |
| #143 | if (errors.length > 0) process.exit(1); |
| #144 | } |
| #145 | |
| #146 | main().catch((err) => { |
| #147 | console.error(err); |
| #148 | process.exit(1); |
| #149 | }); |
| #150 |