On-chain safety rails for agentic commerce on Starknet.
Starkclaw is a mobile reference implementation of a simple idea:
Don't give an AI your wallet. Give it a session key with hard limits, and enforce those limits on-chain.
When you let an "agent" sign transactions, prompt-injection isn't a UX problem anymore. It's a custody problem. Starknet account abstraction gives us the primitives to put the rules where the money lives: inside the account contract.
This repo exists to make that concrete, fast: a working vertical slice you can run, fork, and build on.
Starkclaw follows the BYOA (Bring Your Own Agent) protocol: a decentralized coordination system where AI agents collaborate through GitHub issues, labels, and PRs without knowing each other.
Give your AI coding agent this single instruction:
Clone https://github.com/keep-starknet-strange/starkclaw, read BYOA.md, and execute the protocol. You are an OpenClaw agent.
That's it. The agent will self-identify, claim issues, open PRs, review other agents' work, and coordinate through GitHub.
No setup. No onboarding. No external tooling beyond gh.
Works with Claude Code, Codex, Cursor, or any agent that can run GitHub CLI workflows.
Current app mode: Demo (UI-only, fully mocked).
The mobile app currently runs in demo mode with premium UX:
- Onboarding flow (agent setup, account creation)
- Transfer/trading preview + confirmations with policy checks (mocked)
- Policy editor (caps, allowlists, emergency lockdown)
- Alerts + inbox + activity timeline
- Agent proposals (approve/reject) with clear context
No RPC calls, no wallets, no contract interaction yet. The UI is production-grade; backend wiring is in progress (#2).
The building blocks for live Starknet execution exist in apps/mobile/lib/ but are still being wired to full user flows:
- Starknet RPC client with retry/fallback
- Wallet lifecycle (deterministic address, secure storage, deploy flow)
- Session key policy management (create/register/revoke)
- Agent transfer execution with on-chain policy enforcement
- Activity logging with explorer links
Target MVP (when live mode is wired):
- Mobile wallet generates deterministic Starknet account address (fund-first, deploy-later)
- Deploy AA account from app (Sepolia)
- Create/register on-chain session key policies:
- Expiry window (
valid_after,valid_until) - Per-24h spend cap (
spending_token,spending_limit) - Allowed contract (v1: narrow scope for constrained transfers)
- Expiry window (
- Agent screen:
- Proposes transfers with deterministic preview
- Executes via session key signature enforced by account contract
- Demonstrates on-chain denial when over cap (not prompt-level rule)
- Activity log + explorer links
The point is not "the AI behaved". The point is "the AI couldn't misbehave outside the policy, even if it tried".
- Not audited
- Not wired end-to-end for live Starknet execution (demo-first)
- Not wired to a production LLM provider by default (agent UX currently deterministic/mocked)
- Not production-ready for mainnet funds
Starkclaw uses Starknet session-account lineage (canonical source: keep-starknet-strange/starknet-agentic/contracts/session-account) with a split key model:
- Owner key (master):
- Deploys the account
- Registers / revokes session keys
- Emergency revokes all session keys
- Session key (delegated):
- Signs transactions with a policy attached on-chain
- Is disposable, time-bounded, and revocable
On-chain enforcement (in __execute__) includes:
allowed_contract(v1): session key calls must target the allowed contract (or zero-address = any)spending_limit+ 24h window (v1): value-moving ERC-20 selectors are debited on-chain- Includes
transfer,approve,increase_allowancevariants to block approval-bypass patterns
- Includes
Signature convention:
- Owner tx signature:
[r, s] - Session key tx signature:
[session_key_pubkey, r, s, valid_until]
The policy is the source of truth. The "agent" UI is just a safer way to produce intents.
Starkclaw does not rely on one guardrail. It composes independent controls:
- On-chain authority boundaries (owner vs delegated key capabilities)
- On-chain policy enforcement (targets, windows, spending rules)
- Signature-level binding and strict malformed-response rejection
- Remote signer hardening in SISNA mode (authenticated requests, strict validation, TLS pinning)
- Integration integrity checks (session-account parity checks + deterministic CI gates)
Practical result:
- If a prompt is manipulated, execution is still bounded by contract policy
- If app-layer logic is buggy, on-chain checks still constrain spending behavior
- If delegated key path is compromised, scope + revocation limit blast radius
This is the core power of the stack: bounded, enforceable authority across layers, not trust in model behavior.
- Node.js + npm
- Expo Go (fastest iteration)
- Cairo tooling (for contracts):
- Scarb (
scarb) - Starknet Foundry (
snforge,sncast)
- Scarb (
npm ci --prefix apps/mobile./scripts/app/dev./scripts/check./scripts/contracts/testNote: The app currently runs in demo mode only. Live Starknet execution is being wired in #2.
Once live mode is available, the flow will be:
Canonical path (session-account lineage from starknet-agentic):
STARKNET_DEPLOYER_ADDRESS=0x... \
STARKNET_DEPLOYER_PRIVATE_KEY=0x... \
./scripts/contracts/declare-session-accountNotes:
STARKNET_RPC_URLis optional- You need a funded deployer account for fees
UPSTREAM_SESSION_ACCOUNT_PATHis optional to override source locationEXPECTED_SESSION_ACCOUNT_CLASS_HASHis pinned by default; declare fails on mismatch- Existing wallets without persisted class-hash metadata remain on legacy hash addressing (no silent remap)
Legacy fallback (migration/debug only, explicitly gated):
ALLOW_LEGACY_AGENT_ACCOUNT=1 ./scripts/contracts/declare-agent-account- Switch to Live mode in Settings
- Home:
Create Wallet - Home:
Faucet(fund the displayed address) - Home:
Refreshuntil ETH balance is non-zero - Home:
Deploy Account - Policies:
Create + Registera session key - Agent: Ask to send tokens and execute
- Denial test: Set a tiny cap, try to exceed it, confirm on-chain denial
See STATUS.md for current progress.
Starkclaw is part of a multi-repo system. Key integration surfaces:
-
keep-starknet-strange/starknet-agentic- Canonical
session-accountlineage source - Consumed through:
./scripts/contracts/check-session-account-parity.sh./scripts/contracts/declare-session-accountUPSTREAM_SESSION_ACCOUNT_PATH
- Canonical
-
- Remote signer boundary for session-key signing flows
- Consumed through:
apps/mobile/lib/signer/**keyring-proxy-signer.tsrequest auth + strict response checks- transport hardening (TLS pinning + runtime guards)
- Production key-custody note:
- SISNA currently requires explicit
KEYRING_ALLOW_INSECURE_IN_PROCESS_KEYS_IN_PRODUCTION=truewhen running with in-process keys in production. - This is a temporary explicit-risk guard until external KMS/HSM signer backend mode is available.
- SISNA currently requires explicit
Integration rule of thumb:
- Upstream contract/API changes must be reflected in parity checks, signer adapters, and mobile execution wiring before release.
apps/mobile/: Expo app (Expo Router)contracts/: Starknet account-contract tooling/docsscripts/: deterministic commands (CI calls these)spec.md: product specIMPLEMENTATION_PLAN.md: milestone planSTATUS.md: current state + verification stepsCLAUDE.md,agents.md,.claude/skills/**: agentic-native context and skills
This repository is structured so AI agents can work effectively without making the project unreviewable:
STATUS.mdis the single source of truth for what's next and how to verify./scripts/checkis the contract between local dev and CI- Changes should land as small vertical slices with frequent commits
- Secrets never belong in commits, logs, or prompts
If you want to contribute with AI assistance, start with BYOA.md, CLAUDE.md, and agents.md.
- Changelog:
CHANGELOG.md - Versioning policy:
VERSIONING.md
Until 1.0.0, releases are pre-1.0 semantic and include explicit security callouts in release notes.
If you're excited by "agents that can spend, but only within guardrails", we want you here.
High-leverage contributions:
- LLM provider adapter + streaming chat (keeping keys out of model context)
- Better policy UX (multi-target allowlists, selector allowlists)
- Devnet-first onboarding (lower friction than Sepolia declare/deploy)
- UI polish (premium "trustworthy wallet" feel)
- Security hardening + tests
Workflow:
- Pick an issue (or open one with a crisp problem statement)
- Keep PRs small and runnable
- Run
./scripts/checkbefore opening a PR - Update
STATUS.mdwhen you change the verification story
This is experimental software.
- Do not use mainnet funds
- Do not assume the contract or app is hardened against real adversaries
- The core security claim is bounded authority via on-chain policy, not "the agent is safe"
If you find a vulnerability, report it responsibly via SECURITY.md.
- Canonical AA safety-rails lineage:
keep-starknet-strange/starknet-agentic/contracts/session-account - Starknet.js for transaction building and signing
MIT. See LICENSE.
Validation: dependency-review live run check (2026-02-14).