Please give us a star if you're interested in seeing this project get fully built out. It will help me gauge interest. Thank you.
useable test release available Thursday Feb 26
TrenchClaw is an openclaw-like agentic ai runtime for the Solana blockchain. It's a personal solana assistant that executes modular on-chain actions, runs automated trading routines, and gives operators full visibility and control from the command line. This is very dangerous and will be a while before security is perfected.
While the TypeScript repo is a little heavier than minimalist alternatives, it is currently the best and most accurate agent orchestrator for this stack.
Built on @solana/kit and Bun from the ground up, with GUI/TUI/mobile surfaces planned for 1.0. Zero legacy dependencies (including legacy @solana/web3.js v1). Functional, composable, tree-shakeable. Designed for operators who care about what ships in their binary.
Full architecture: ARCHITECTURE.md
Quick links:
SUPPORT US: 7McYcR43aYiDttnY5vDw3SR6DpUxHG8GvLzhUsYFJSyA
The TypeScript repo is heavier than minimalist alternatives. It is currently the best and most accurate agent orchestrator for this stack. Here is why.
An "advanced" agent (beyond prompt-in / prompt-out) is mostly state + typed tool I/O + event streaming + orchestration:
That set of needs strongly selects for ecosystems that treat schemas as primary artifacts, JSON as the native interchange, streaming as a first-class API, and web deployment as the default.
Compile-time types + runtime schemas (the missing half in systems languages).
For agents, types alone are insufficient because the LLM must see the contract and your runtime must validate untrusted tool arguments. In the Vercel AI SDK tool model, a tool declares an inputSchema (Zod or JSON Schema) which is both consumed by the LLM (tool selection + argument shaping) and used by the runtime to validate the tool call before execute runs. TypeScript is where this shines:
In most systems-language stacks you end up with one of: great static typing but the schema shown to the model is hand-rolled/duplicated, or runtime validation that requires heavy codegen pipelines. Agent code is glue code. Glue code penalizes heavy codegen.
The Vercel AI SDK is TypeScript-first by design.
Vercel positions the AI SDK as "The AI Toolkit for TypeScript." Tool calling (generateText + tool(...)) is a core primitive. AI SDK strict mode behavior (tool schema compatibility, fail-fast semantics) is exactly the production detail you want in advanced agents. If your orchestration is centered on Vercel AI SDK primitives — tools, streams, UI streaming, provider adapters — the lowest-friction native language is TS.
Structural typing + JSON-native payloads + ergonomic transforms.
Agent payloads are structurally shaped objects: tool args, tool results, intermediate plans, traces. TS is effective because structural typing matches JSON shapes, transform pipelines are concise (map/filter/reduce, Zod transforms), and you can model event streams as discriminated unions and exhaustively switch on them (high leverage for agent traces). In systems languages you're constantly bridging between strongly typed structs and dynamic JSON, adding serialization boilerplate and versioning friction.
The JS/TS agent ecosystem is schema-driven by default.
Community patterns converge on "schema as first-class value," and lots of integrations assume Node/TS toolchain. Even if you don't use LangChain, this means schema-oriented integrations are plug-and-play rather than ports.
This isn't about raw capability — it's about where the complexity lives.
In this repo's environment (AI SDK orchestration + schema-first tools + Solana execution), the main risk is usually unsafe or ambiguous tool behavior, not raw compute throughput.
Systems languages still fit extremely well behind strict boundaries (signing, parsing, deterministic execution, high-throughput services). They are usually not the fastest path for the orchestrator that must remain tightly coupled to AI SDK tool contracts and streaming UI behavior.
The strongest architecture is usually:
TypeScript orchestrator (agent brain) + systems-language executors (muscle)
This preserves agentic flow (fast iteration, schema-first tooling, Vercel AI SDK integration) while still using systems languages where they actually dominate. Writing the agent orchestrator in a systems language usually means recreating a TS-shaped ecosystem from scratch — more engineering spent on plumbing, less on agent behavior and safety.
@solana/kit is not just a Solana SDK choice here; it improves the same agentic properties this TypeScript stack optimizes for:
bigint) keep model-selected tool args closer to executable reality.TS is effectively required when all are true:
Under these constraints, systems-language orchestrators often re-create TS-native schema + streaming + UI integration layers from scratch.
TrenchClaw does not use @solana/web3.js v1. It uses @solana/kit (formerly web3.js v2), the official ground-up rewrite from Anza.
The old @solana/web3.js is a monolithic, class-based SDK. Its Connection class bundles every RPC method into a single non-tree-shakeable object. Whether you call one method or fifty, your users download the entire library. It relies on third-party crypto polyfills, uses number where bigint belongs, and provides loose TypeScript types that let bugs slip to runtime.
Kit is the opposite. It is functional, composable, zero-dependency, and fully tree-shakeable. It uses the native Web Crypto API for Ed25519 signing instead of userspace polyfills. It uses bigint for lamport values. It catches missing blockhashes, missing signers, and wrong account types at compile time, not after your transaction fails on-chain.
@solana/web3.js v1 |
@solana/kit v6 |
|
|---|---|---|
| Architecture | Monolithic Connection class |
28 modular packages |
| Bundle (minified) | ~450 KB | ~100 KB compressed |
| Tree-shakeable | No | Yes |
| Dependencies | Multiple (bn.js, borsh, buffer, etc.) | Zero |
| Crypto | Userspace polyfills | Native Web Crypto API (Ed25519) |
| Large numbers | number (lossy above 2^53) |
bigint (safe for lamports) |
| Type safety | Loose | Strict (compile-time signer/blockhash/account checks) |
| Confirmation latency | Baseline | ~200ms faster in real-world testing |
| Maintenance | Security patches only | Active development by Anza |
Real-world impact: the Solana Explorer homepage dropped its bundle from 311 KB to 226 KB (a 26% reduction) after migrating to Kit.
No more Connection class. Kit replaces it with createSolanaRpc() and createSolanaRpcSubscriptions() — lightweight proxy objects that only bundle the methods you actually call. Whether your RPC supports 1 method or 100, the bundle size stays the same.
No more Keypair. Kit uses CryptoKeyPair from the Web Crypto API via generateKeyPairSigner(). Private keys never have to be exposed to the JavaScript environment. Signing happens through TransactionSigner objects that abstract the mechanism — hardware wallet, browser extension, CryptoKey, or noop signer for testing.
No more mutable transactions. Kit uses a functional pipe() pattern to build transaction messages. Each step returns a new immutable object with an updated TypeScript type, so the compiler tracks what your transaction has (fee payer, blockhash, instructions, signers) and what it's missing — before you ever hit the network.
import { pipe, createTransactionMessage, setTransactionMessageFeePayerSigner,
setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstructions,
signTransactionMessageWithSigners } from '@solana/kit';
const tx = pipe(
createTransactionMessage({ version: 0 }),
(tx) => setTransactionMessageFeePayerSigner(payer, tx),
(tx) => setTransactionMessageLifetimeUsingBlockhash(blockhash, tx),
(tx) => appendTransactionMessageInstructions([transferInstruction], tx),
);
const signed = await signTransactionMessageWithSigners(tx);
No more hand-rolled instruction builders. Program interactions use generated clients from Codama IDL files. Drop an IDL JSON in lib/client/idl/, run codegen, get typed instruction builders, account decoders, PDA helpers, and error enums. TrenchClaw imports from these generated clients — never constructs instructions manually.
Incremental migration path. Kit provides @solana/compat for converting between legacy and Kit types (fromLegacyPublicKey, fromVersionedTransaction, etc.), so existing code can be migrated progressively.
TrenchClaw imports from Kit sub-packages directly:
@solana/rpc — RPC client creation and request building@solana/signers — Transaction and message signing abstractions@solana/transactions — Transaction compilation and serialization@solana/addresses — Address creation and validation@solana/codecs — Composable serialization for account data@solana/accounts — Account fetching and decoding helpers@solana/errors — Typed error handlingThis means TrenchClaw only ships the Kit code it actually uses. No dead code. No bloat.
If you are evaluating Solana agent stacks today, the practical split is this: TrenchClaw is built directly on @solana/kit, while many existing agent ecosystems still rely on legacy @solana/web3.js integrations.
| TrenchClaw | ElizaOS (typical Solana plugin setups) | Agent Kit style starter stacks | |
|---|---|---|---|
| Primary Solana SDK | @solana/kit |
Commonly @solana/web3.js-based plugins/adapters |
Commonly @solana/web3.js wrappers |
| API style | Functional + composable | Framework/plugin driven | Framework/toolkit driven |
| Tree-shaking | Strong (modular Kit packages) | Often weaker due to Connection-style clients |
Often weaker due to broad utility bundles |
| Type guarantees around tx composition | Strong compile-time checks in Kit pipeline | Depends on plugin quality | Depends on toolkit layer |
| Runtime focus | Terminal-first operator runtime | Multi-platform agent framework | General AI-agent developer UX |
Why this matters:
@solana/web3.js v1 is in maintenance mode, while @solana/kit is the actively developed path forward from Anza.Bottom line: if you want a Solana-native operator runtime with modern SDK foundations, TrenchClaw is purpose-built for that. If you want a broad agent framework with Solana as one plugin among many, ElizaOS/Agent Kit can fit — but the Solana layer is frequently still tied to older web3.js assumptions.
| Framework/runtime | Throughput (req/s) |
|---|---|
| Rust + Axum | 21,030 |
| Bun + Fastify | 20,683 |
| ASP.NET Core | 14,707 |
| Go + Gin | 3,546 |
| Python + FastAPI (Uvicorn) | 1,185 |
TrenchClaw uses Bun's built-in SQLite (bun:sqlite) for runtime jobs, receipts, policy/decision traces, market/cache data, and chat persistence (conversations, chat_messages). It keeps state local, restart-safe, and dependency-light.
Schema is Zod-first and auto-synced on boot:
src/runtime/storage/sqlite-schema.tssrc/runtime/storage/sqlite-orm.tsRuntime log/data layout is split by purpose under src/ai/brain/db/:
runtime/: SQLite DB + runtime event filessessions/: session index + JSONL transcript streamsummaries/: compact per-session markdown summariessystem/: daily system/runtime logsmemory/: daily + long-term memory notesBun's SQLite docs show strong wins on many read/materialization workloads versus common JS drivers, but complex JOIN/aggregation workloads vary by query shape. So the rule is simple: use Bun SQLite by default, benchmark real production queries before making hard guarantees.
Solana Kit, Jupiter integration, and Codama-generated clients are all TypeScript-native in this repo. Bun gives fast startup, strong HTTP performance, and native TypeScript execution while keeping the codebase in one language.
src/ai/brain/, loaded by orchestration in src/ai/market_instruments, ohlcv_bars, market_snapshots, http_cache, conversations, chat_messages)system daily logs + session JSONL + session summaries)ultraQuoteSwap, ultraExecuteSwap, ultraSwap)generate + stream) wired into runtime bootstrapdev, start, headless, cli) + HTTP health/status routestests/tests/runtime/config/authority.test.ts (dangerous profile partial-override expectation)src/solana/routines/dca.tssrc/solana/triggers/timer.tssrc/solana/triggers/price.tssrc/solana/triggers/on-chain.tssrc/solana/actions/wallet-based/swap/rpc/quoteSwap.tssrc/solana/actions/wallet-based/swap/rpc/executeSwap.tssrc/solana/actions/wallet-based/token/mint/createToken.tssrc/solana/actions/data-fetch/rpc/getTokenPrice.tssrc/solana/actions/data-fetch/rpc/getMarketData.tssrc/solana/actions/data-fetch/rpc/getTokenMetadata.tssrc/solana/actions/wallet-based/read-only/checkSolBalance.tssrc/solana/actions/wallet-based/read-only/getWalletState.tscreateWallets + actionSequence only)observability.metrics and observability.tracing)src/apps/web-gui scaffold exists)TBD