Skip to content

Repository files navigation

NoCodeClarity AI 🤖⚡

StackssBTCLicenseOpenClawAIBTCDonate Crypto

Your AI manages Bitcoin yield on Stacks so you don't have to.

NoCodeClarity AI is the most comprehensive AI agent platform for Stacks. It autonomously manages sBTC yield, PoX stacking, DEX swaps across several protocols, lending, liquid stacking, and contract security analysis. Non-custodial. Risk-gated. Kill switch always one click away.

Tell it what you want in plain English. Three AI agents handle the rest.


Why NoCodeClarity?

ProblemSolution
DeFi on Stacks is beautiful, yet complex. 7 protocols, PoX cycles, sBTC peg monitoringAI agents handle the complexity for you
One bad transaction can drain your walletRisk Gate blocks anything above your threshold
You have to watch the market 24/7Chain triggers react to sBTC peg drops, balances, PoX cycles
No way to automate recurring DeFi tasksScheduler runs goals on intervals (15m to 30 days)
Can't verify if a contract is safe before depositingClarity Analyzer reads contract source and audits it with LLM
Tools exist for devs, not for everyone elseSolo Mode — no Docker needed. Clone, install, run

Who Is This For?

  • 🧑‍💻 Power users — Full API, SSE streams, chain triggers, custom strategies, recurring tasks
  • 🎨 No-code users — Connect wallet (Leather or Xverse) → pick a risk template → done
  • 🤖 AI agent builders — Drop-in OpenClaw skill for any agent framework

What It Does for Stacks

12 Transaction Builders

Every builder produces unsigned transactions with Stacks-enforced post-conditions. If the on-chain result doesn't match what was approved, the transaction reverts — enforced by the protocol.

BuilderProtocolActionPost-Conditions
buildSTXTransferStacksSend STXExact spend
buildSBTCTransfersBTCSend sBTCExact FT transfer
buildALEXSwapALEXAMM swap (any pair)Exact spend + min receive
buildVelarSwapVelarDEX swapExact spend + min receive
buildBitflowSwapBitflowDEX swapExact spend + min receive
buildBitflowStakeBitflowSTX → stSTX liquid stackingExact STX deposit
buildArkadikoSwapArkadikoswap-x-for-yExact spend + min receive
buildZestDepositZestLending pool depositExact FT deposit
buildStackSTXPoX-4Stack STX (1–12 cycles)PoX lock
buildDelegateSTXPoX-4Delegate to stacking poolPoX delegation
signAndBroadcastCoreSign + broadcast to chainHash check vs. gate
waitForConfirmationCorePoll for tx confirmation

10+ Read Tools

ToolData SourceWhat It Returns
getAccountBalancesHiro APISTX, sBTC, all SIP-010 token balances
getNetworkInfoHiro APIBlock height, congestion, tip hash
getsBTCPegHealthHiro APIPeg ratio, finality depth, health score
getPoxInfoHiro APICurrent cycle, reward phase, stacking minimum
getRecentTxHistoryHiro APILast N transactions for a wallet
getProtocolTVLHiro APITVL for ALEX, Arkadiko, Velar, Bitflow, Zest
captureChainSnapshotAll aboveFull snapshot: wallet + network + peg + pools
getContractSourceHiro APIClarity source code + ABI for any contract
analyzeContractHiro + ClaudeLLM security audit of Clarity contracts
getSignerHealthHiro APINakamoto signer count, PoX cycle timing

3 AI Agents

AgentRoleHow It Works
AnalystChain analysisTakes a ChainSnapshot → uses Claude to identify risks, opportunities, and context
Risk GateRisk scoringRule-based scoring against your RiskConfig → returns PROCEED, NEEDS_HUMAN, HOLD, or REJECT
ExecutorSign + broadcastVerifies transaction hash matches gate approval → signs → broadcasts → confirms

6 Chain Trigger Conditions

ConditionExample
peg_health_below"If sBTC peg drops below 85, swap to STX"
peg_health_above"If peg recovers above 95, buy sBTC"
stx_balance_above"If balance exceeds 10,000 STX, stake it"
stx_balance_below"If balance drops below 100 STX, alert me"
pox_cycle_ending_in"If PoX cycle ends in 200 blocks, re-delegate"
congestion_level"If congestion is low, execute batch swaps"

Recurring Task Intervals

15m · 1h · 6h · 12h · 24h · 7d · 14d · 30d

Example: "compound my Zest yield every 24 hours"


Supported Protocols

ProtocolReadWriteActions
STXTransfer, PoX stacking (1–12 cycles), delegation
sBTCTransfer, peg health monitoring, finality depth
ALEXAMM swaps (any token pair), slippage protection
VelarDEX swaps, pool state, TVL tracking
BitflowstSTX liquid stacking, DEX swaps
ArkadikoToken swaps, vault monitoring, liquidation alerts
ZestLending pool deposits for yield

Total: 7 protocols, 12 builders, 10+ read tools, 3 agents, 6 trigger types, 8 intervals


Quick Start

Prerequisites

Solo Mode (30 seconds, no Docker)

git clone https://github.com/NoCodeClarity/NoCodeClarityAI.git
cd NoCodeClarityAI && bun install
cp .env.example .env
# Fill in: ANTHROPIC_API_KEY, WALLET_MNEMONIC# Add: SOLO_MODE=true
bun run swarm:dev # Orchestrator on :3001

Full Mode (PostgreSQL + vector search)

git clone https://github.com/NoCodeClarity/NoCodeClarityAI.git
cd NoCodeClarityAI && bun install
cp .env.example .env
# Fill in: ANTHROPIC_API_KEY, WALLET_MNEMONIC, DATABASE_URL
docker compose up db -d
cd packages/orchestrator && bun run db:generate && bun run db:migrate &&cd ../..
bun run swarm:dev # Orchestrator on :3001cd packages/frontend && npm run dev # Frontend on :5173

Open http://localhost:5173 → connect Leather or Xverse → pick a strategy → submit your first goal.


Architecture

nocodeclarity-ai/
├── packages/frontend/ → React + Vite + Tailwind CSS v4
│ ├── Console → 3-panel: portfolio + execution feed + commands
│ ├── Activity → Task history with Hiro Explorer links
│ ├── Vault → STX/sBTC balance cards + yield positions
│ ├── Stacking → PoX dashboard: solo stack (1-12 cycles) + pool delegation
│ ├── Triggers → Chain trigger manager (6 condition types)
│ ├── Strategies → Marketplace: browse/import/share strategies
│ ├── OnboardingFlow → Stacks Connect (Leather/Xverse) → strategy selection
│ ├── SBTCPanel → sBTC deposit/withdraw with peg health monitoring
│ ├── NetworkToggle → Mainnet/testnet switch (persisted)
│ ├── ErrorBoundary → Graceful error handling on all pages
│ └── WalletProvider → @stacks/connect + network state + cleanup
│
├── packages/tools/ → Protocol interactions
│ ├── read/hiro.ts → 10 read tools (Hiro API)
│ ├── read/clarity.ts → Clarity contract analyzer (Hiro + Claude)
│ ├── read/signers.ts → Nakamoto signer health monitor
│ └── write/builders.ts → 12 transaction builders (all protocols)
│
├── packages/agents/ → AI pipeline (direct fetch, no SDK)
│ ├── Analyst → LLM-powered chain analysis
│ ├── Risk Gate → Rule-based risk scoring
│ └── Executor → Sign + broadcast with hash check
│
├── packages/orchestrator/ → Core engine
│ ├── index.ts (StacksSwarm) → Pipeline coordinator + DB + memory embeddings
│ ├── server.ts → Hono HTTP + SSE + API + rate limiter + SPA
│ ├── scheduler.ts → Recurring task scheduler
│ ├── triggers.ts → Chainhook-style event trigger engine
│ ├── embeddings.ts → Agent memory (pgvector + OpenAI embeddings)
│ ├── sharing.ts → Strategy export/import/URL sharing
│ └── db/ → Drizzle schema + pgvector + dual-mode client
│
├── Dockerfile → Railway deployment (Bun runtime)
├── docker-compose.yml → Local dev: PostgreSQL + pgvector
└── .github/workflows/ci.yml → CI: typecheck + tests + build

Security Model

LayerProtection
Post-conditionsEvery transaction has Stacks-enforced post-conditions. Mismatch → revert.
Hash checkSigned transaction must match the hash the Risk Gate approved.
Risk GateRule-based scoring with configurable thresholds. Defaults to REJECT on uncertainty.
Kill switchPOST /pause — no auth required, halts ALL active tasks instantly.
Goal sanitization500-char limit, control character stripping, prompt injection defense.
API authAll mutating endpoints require ORCHESTRATOR_SECRET.
Rate limiting30 req/min/IP on /api/*, max 20 recurring tasks, max 10 triggers, min 60s cooldown.
Input validationUUID format on task IDs, hex-only + 10KB limit on broadcast payloads, regex on contracts.
Non-custodialYour keys never leave your server. No cloud custody.
Trigger whitelistOnly 6 validated condition types accepted — no arbitrary code execution.

Security Audit: Audited by Jubilee Labs. 9 findings, all Critical/High remediated. Report available on request.


Deployment

Production (Railway + Netlify)

  1. Backend — Deploy to Railway from this repo. It auto-detects the Dockerfile. Add a PostgreSQL service and set your env vars (WALLET_MNEMONIC, ANTHROPIC_API_KEY, DATABASE_URL).

  2. Frontend — Connect to Netlify from this repo:

    • Base directory: packages/frontend
    • Build command: npm run build
    • Publish directory: packages/frontend/dist
    • Update packages/frontend/public/_redirects with your Railway URL for API proxy.
  3. Wallet Connect — Users connect via Leather or Xverse browser wallet. No seed phrase required — signing happens in the wallet popup via @stacks/connect.

Self-Hosted (Docker)

docker compose up -d # Starts PostgreSQL + orchestrator

The orchestrator auto-serves the frontend from packages/frontend/dist/ when built.


Strategy Templates

TemplateProtocolsRiskAuto-Execute Limit
ConservativeZest lending only🛡️ Low0.001 BTC
ModerateZest + ALEX + Velar swaps⚖️ Medium0.01 BTC
AggressiveAll 7 protocols🔥 High0.05 BTC
PoX StackingSTX → pool delegation🛡️ Low0.1 BTC

Auto-execute limit = transactions below this value proceed automatically. Above it → NEEDS_HUMAN → you approve in the UI.

Strategies can be exported, shared via URL, and imported by other users.


Full API Reference

Core Endpoints

MethodPathAuthDescription
GET/healthNoHealth check
GET/streamNoSSE event stream (real-time)
POST/pauseNoKill switch — halt all tasks

Tasks

MethodPathAuthDescription
GET/tasksYesList recent tasks (last 50)
GET/tasks/:idYesGet single task
POST/tasksYesSubmit a new goal
POST/tasks/:id/approveYesApprove NEEDS_HUMAN task
POST/tasks/:id/rejectYesReject a task

Strategies

MethodPathAuthDescription
GET/strategiesYesList strategies
POST/strategiesYesCreate strategy
GET/strategies/:id/exportYesExport as shareable JSON
POST/strategies/importYesImport from JSON or share code

Recurring Tasks

MethodPathAuthDescription
GET/recurringYesList scheduled tasks
POST/recurringYesSchedule a recurring goal
DELETE/recurring/:idYesCancel a recurring task

Chain Triggers

MethodPathAuthDescription
GET/triggersYesList triggers
POST/triggersYesRegister a trigger
DELETE/triggers/:idYesRemove a trigger

Analysis & Monitoring

MethodPathAuthDescription
GET/analyze/:contractIdYesClarity contract security audit
GET/signersNoStacks signer health + PoX cycle

Examples

# Submit a goal
curl -X POST http://localhost:3001/tasks \
-H "Content-Type: application/json" \
-H "x-orchestrator-secret: $ORCHESTRATOR_SECRET" \
-d '{ "goal": "swap 100 STX for sBTC on ALEX", "strategyId": "abc-123" }'# Schedule recurring compounding
curl -X POST http://localhost:3001/recurring \
-H "Content-Type: application/json" \
-H "x-orchestrator-secret: $ORCHESTRATOR_SECRET" \
-d '{ "goal": "compound my Zest yield", "strategyId": "abc", "interval": "24h" }'# Set a trigger for sBTC peg drop
curl -X POST http://localhost:3001/triggers \
-H "Content-Type: application/json" \
-H "x-orchestrator-secret: $ORCHESTRATOR_SECRET" \
-d '{ "name": "Hedge on peg drop", "condition": { "type": "peg_health_below", "threshold": 85 }, "goal": "swap my sBTC to STX for safety", "strategyId": "abc" }'# Analyze a contract before depositing
curl http://localhost:3001/analyze/SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR.alex-vault \
-H "x-orchestrator-secret: $ORCHESTRATOR_SECRET"# Check signer health
curl http://localhost:3001/signers
# Watch the live event stream
curl -N http://localhost:3001/stream
# Events: task:created, task:step, task:needs_human, task:executing, task:complete, task:failed

Environment Variables

VariableRequiredDescription
ANTHROPIC_API_KEYClaude API key (Haiku) for agent reasoning
WALLET_MNEMONIC12-word Stacks wallet seed phrase
DATABASE_URLProductionPostgreSQL + pgvector connection string
ORCHESTRATOR_SECRETRecommendedAPI authentication secret
HIRO_API_KEYOptionalHiro API key for higher rate limits
STACKS_NETWORKOptionalmainnet or testnet (default: testnet)
SOLO_MODEOptionaltrue for zero-config mode (no database)
ORCHESTRATOR_PORTOptionalServer port (default: 3001)
AIBTC_REGISTEROptionaltrue to register with the AIBTC network
AIBTC_OPERATOR_X_HANDLEOptionalYour X handle for AIBTC registry

OpenClaw Integration

NoCodeClarity AI works as an OpenClaw skill — any AI agent that can run shell commands can use it:

# Chain snapshot (no orchestrator needed)
npm run stacks-snapshot ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
# Submit a goal via the orchestrator
npm run stacks-swarm goal "swap 10 STX for sBTC on ALEX"<strategy_id># Monitor + approve
npm run stacks-swarm tasks
npm run stacks-swarm approve <task_id># Kill switch
npm run stacks-swarm pause

Works with Claude Code, Cursor, Windsurf, Dexter, or any agent that reads SKILL.md.


Tech Stack

LayerTechnology
FrontendNext.js 14, React, Tailwind CSS
WalletsLeather + Xverse (Stacks Connect)
BackendHono (HTTP + SSE), Bun runtime
DatabasePostgreSQL + pgvector (Drizzle ORM) or in-memory
AIClaude Haiku (goal classification + chain analysis + contract audits)
BlockchainStacks.js, Hiro API, PoX-4, Chainhook-style triggers
ProtocolsALEX, Velar, Bitflow, Arkadiko, Zest, sBTC, PoX
Agent InfraOpenClaw compatible, AIBTC Network registered
BuildTurborepo monorepo

Contributing

See CONTRIBUTING.md for development setup, security rules, and code style.

License

MIT — see LICENSE.

Built By

NoCodeClarity — Making Bitcoin DeFi accessible to everyone.


"The best DeFi experience is the one you don't have to manage."

About

AI manages Bitcoin yield on Stacks so you don't have to. BTC meets AI.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages