Index of every page on this site: llms.txt
All skills
aomi-labs avatar

/aomi-build

@67226e1
by aomi labsaomi-labs/skills8 stars
4
Run it yourself

Scaffold new Aomi apps and plugins from API docs, OpenAPI/Swagger specs, or SDK references. aomi-build generates production-ready Rust SDK crates (lib.rs, client.rs, tool.rs) with tool schemas, preambles, host-interop flows, and validation — turning a vendor's API surface into AI-agent-callable tools. It covers the current `aomi-build` OpenAPI pipeline (`gen-specs` → `gen-client` → `gen-tool` → curate → compile/test) as well as greenfield apps. Use when the user wants to scaffold a new Aomi app from a spec, wrap a REST API as agent-callable tools, port an existing SDK, or extend an Aomi runtime with new integrations. Trigger with prompts about wrapping APIs, scaffolding Rust crates from specs, or adding protocol integrations that aomi-transact can drive. Output crates support progenitor-generated OpenAPI clients, curated tool layers, sync HTTP, async tools (DynAsyncSink), typed secrets, route plans (ToolReturn/RouteStep), EVM and SVM host handoffs, and multi-step quote→approval→swap flows. Same runtime that aomi-transact drives.

Use this Skill: https://skilld.dev/gh/aomi-labs/skills/aomi-build

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referenceshost-routes.md

≈2.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Host Routes

Read this when:

  • The app you're building must hand off to the host wallet (sign, submit, broadcast) at some point.
  • The app needs to chain multiple tool calls where a later step depends on an artifact produced by an earlier wallet callback (signature, transaction_hash).
  • You see ToolReturn or RouteStep in an existing app and want to know what the runtime does with them.

What this replaces

Older Aomi apps returned a SYSTEM_NEXT_ACTION field embedded inside a JSON payload, and the runtime parsed prose hints to figure out what to call next. That convention is gone. The current contract is structured: tools return ToolReturn::with_routes(value, [...]) envelopes, the runtime resolves the routes mechanically, and prose is never parsed.

If you see SYSTEM_NEXT_ACTION in older code or docs, treat it as outdated. Replace it with a RouteStep that names the next tool by its host::* marker.

The envelope

A tool returns either a bare Value (read-only) or a ToolReturn (with routes):

pub struct ToolReturn {
    pub value: Value,                 // the tool's structured payload
    pub routes: Vec<RouteStep>,       // ordered continuations
}

Tools opt into routes by overriding run_with_routes() instead of (or in addition to) run(). The default run_with_routes() impl wraps run() into ToolReturn::value(...) with empty routes — so non-routing tools need no changes.

impl DynAomiTool for BuildMyOrder {
    type App = MyApp;
    type Args = BuildMyOrderArgs;
    const NAME: &'static str = "build_my_order";
    const DESCRIPTION: &'static str = "Build an order and return the next signing step.";

    fn run_with_routes(
        _app: &Self::App,
        args: Self::Args,
        ctx: DynToolCallCtx,
    ) -> Result<ToolReturn, String> {
        // ... build typed_data, prepare submit_template ...
        Ok(ToolReturn::with_routes(
            json!({ "preview": preview, "wallet_request": typed_data.clone() }),
            [
                RouteStep::on_return("evm_commit_message", typed_data)
                    .bind_as("clob_l1_signature")
                    .prompt("Sign the typed data to authorize the order."),
                RouteStep::on_bound_event(
                    "submit_my_order",
                    submit_template,
                    "clob_l1_signature",
                )
                .prompt("Wallet signed — submit the order now."),
            ],
        ))
    }
}

RouteStep anatomy

pub struct RouteStep {
    pub tool: String,          // the next tool to call (host or app-local)
    pub args: Value,           // hinted args; aliases get spliced in
    pub trigger: RouteTrigger, // OnSyncReturn or OnBoundEvent { alias }
    pub bind_as: Option<String>, // publish this step's result under an alias
    pub prompt: Option<String>,  // override prompt text for this step
}

Triggers

  • RouteTrigger::OnSyncReturn (built via RouteStep::on_return(...)) — the route fires immediately when the current tool returns. Use this for "do the next thing right away" continuations.
  • RouteTrigger::OnBoundEvent { alias } (built via RouteStep::on_bound_event(..., alias)) — the route fires when the named alias resolves in the session's artifact store. Wallet callbacks publish artifacts (signature, transaction_hash) under aliases, so a step bound to "signature" fires only after the wallet signs.

Aliases (bind_as)

bind_as publishes the step's terminal result under the given alias in the session's artifact store. A later step with OnBoundEvent { alias: "<same-name>" } consumes that artifact. The runtime splices the artifact into hinted args automatically — you don't have to know the wallet callback shape, just bind the alias and reference it.

Wallet tools publish their callbacks under predictable aliases:

Host tool Callback artifact Typical alias
commit_txs transaction_hash / receipts "transaction_hash" (or domain-specific, e.g. "approve_tx_hash")
evm_commit_message signature "signature" (or domain-specific, e.g. "clob_l1_signature")
stage_tx pending_tx_id "pending_tx_id"

Pick descriptive aliases when you have multiple of the same kind in flight (e.g. "approve_signature" vs "swap_signature").

Typed targets

For host tools, prefer the typed RouteTarget markers in aomi_sdk::builder::host over raw string names:

use aomi_sdk::builder::host;

RouteStep::on_return_to::<host::EvmCommitMessage>(typed_data)
    .bind_as("signature")
    .prompt("Sign the typed data.");

RouteStep::on_bound_to::<host::CommitTxs>(submit_args, "pending_tx_id")
    .prompt("Broadcast the staged transaction.");

Available host::* markers (non-exhaustive — confirm against sdk/src/builder.rs and docs/host-interop.md): EncodeAndCall, StageTx, SimulateBatch, CommitTxs, EvmCommitMessage, plus SVM targets such as SvmStageIx, SvmStageTx, SvmCommitIx, and SvmCommitTx. Using the marker types means renames in the host contract show up as compile errors instead of silent string drift.

Fluent builder style

For multi-step routes with shared state, the RouteBuilder API is more readable than nested with_routes([...]) calls:

use aomi_sdk::{RouteBuilder, ToolReturn};
use aomi_sdk::builder::host;

let mut route = RouteBuilder::new(value);

route.next(|next| {
    next.add::<host::EncodeAndCall>(allowance_args)
        .note("preflight allowance check; surface failures before continuing");
    next.add::<host::EvmCommitMessage>(typed_data)
        .note("sign the typed data to authorize the order");
});

route.after(|after| {
    after.awaits("clob_l1_signature");
    after.next(|next| {
        next.add_named("submit_my_order", submit_template)
            .note("wallet signed — submit the order now");
    });
});

Ok(route.build())

add::<T>() resolves the tool name from a typed marker; add_named(name, args) is the escape hatch for app-local tools or markers you don't have a RouteTarget for. .note(...) sets the per-step prompt field.

What the runtime does with routes

The runtime treats each route as advisory routing, not blind execution:

  • OnSyncReturn steps render into the next system prompt the LLM sees. The model still chooses whether to call the suggested tool — routes are hints, not forced calls.
  • OnBoundEvent steps wait in a queue until the named alias resolves. Wallet callbacks, staged-transaction completions, and other out-of-band events flow through the runtime's RoutedEventBridge, which splices the callback artifact into hinted args (the signature field in your hinted submit template gets filled with the actual signature when the wallet signs) before the continuation prompt is injected.
  • bind_as aliases persist for the session's lifetime once published. A later step in a different tool call can still bind to them.

The runtime never parses prose. The route's structured fields — tool, args, trigger, bind_as — are the contract.

When NOT to use routes

  • Pure read-only tools (search, get, list). Return a bare Value from run(). Adding empty routes is noise.
  • Single-call writes that complete in-tool. If your tool calls an HTTP submit endpoint and gets back a confirmation, return the confirmation as a Value. No host handoff needed.
  • Direct-mode flows where the SDK handles signing internally. E.g. when the app is configured with a private key and submits through the upstream SDK's own sign-and-broadcast path. Use ToolReturn::value(...) with no routes and let the result speak for itself.

The rule of thumb: use routes when (a) the host wallet must take an action and (b) a follow-up tool needs the wallet's callback artifact. If neither applies, a bare Value is the right shape.

Worked examples in the repo

  • apps/khalani — quote → build → wallet sign → submit. Uses RouteBuilder with preflight checks injected via typed host targets. Demonstrates add_named for app-local continuations and the .after(...).awaits(...) pattern for wallet callbacks.
  • apps/polymarket — order preview → CLOB L1 signature → CLOB L2 signature → submit. Shows bind_as("clob_l1_signature") chaining and the wallet-mode vs direct-SDK-mode split.
  • apps/polymarket-rewards — LP-position mutation flows with multiple bound aliases.
  • apps/svm-transfer — Solana lane examples for svm_stage_ix, svm_stage_tx, svm_commit_ix, and svm_commit_tx.

For a tool that doesn't need routes at all, apps/binance and apps/oneinch (read paths) are the cleanest references — they return bare Values and let the model decide what to call next.

Testing routes

aomi_sdk::testing::run_tool returns the full ToolReturn, so route assertions are straightforward:

use aomi_sdk::testing::{TestCtxBuilder, run_tool};
use serde_json::json;

#[test]
fn build_order_emits_signature_route() {
    let ctx = TestCtxBuilder::new("build_my_order").build();
    let result = run_tool::<BuildMyOrder>(&MyApp, json!({"market_id": "..."}), ctx).unwrap();

    assert_eq!(result.routes.len(), 2);
    assert_eq!(result.routes[0].tool, "evm_commit_message");
    assert_eq!(result.routes[0].bind_as.as_deref(), Some("clob_l1_signature"));
    assert!(matches!(
        result.routes[1].trigger,
        RouteTrigger::OnBoundEvent { ref alias } if alias == "clob_l1_signature"
    ));
}

For async tools, run_async_tool returns (updates, terminal) — terminal is a ToolReturn with the same shape.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    Aomi Build is a developer-centric skill for scaffolding Rust crates for AI agent tools. It implements a strong security posture by restricting file-system operations to the local workspace, explicitly denying access to sensitive identity files and build scripts, and limiting shell execution to specific cargo and git commands. The skill operates entirely offline according to its manifest, and all external resources trace back to the verified vendor's infrastructure.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: MEDIUM · 1 issue

Signed by skilld at 67226e1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 4 months ago
What it can do
Runs commands Reads files Edits files
version
0.1.1
author
aomi-labs <hello@aomi.dev>
risk_tier
L1
All 6 allowed tools
Bash(cargo:*)Bash(git:*)ReadWriteEditGrep
Other metadata
tags
[
  "crypto",
  "web3",
  "evm",
  "rust",
  "sdk-scaffolding",
  "openapi",
  "swagger",
  "agent-tools",
  "defi",
  "builder-tools"
]
compatibility
Best when a local aomi-sdk checkout is available, often at ../aomi-sdk. Falls back to bundled references when the SDK repo is not present. Last verified against aomi-sdk v3.0.1 (Rust 2024 edition) and the aomi-build Rust CLI at that time; re-verification is recommended for newer SDK releases (current aomi-sdk: v3.0.3). Install the current CLI with cargo install --git https://github.com/aomi-labs/aomi-sdk --features cli aomi-sdk, or run from source with cargo run -p aomi-sdk --features cli --bin aomi-build -- <command>. Designed for claude-code; also works with Cursor, Codex CLI, Gemini, and any agent runtime that supports the Anthropic skill spec.
metadata
{
  "author": "aomi-labs <hello@aomi.dev>",
  "version": "0.1.1",
  "repository": "aomi-labs/skills",
  "homepage": "https://github.com/aomi-labs/skills/tree/main/aomi-build"
}
permissions
{
  "files": {
    "read": [
      "./",
      "../aomi-sdk/"
    ],
    "write": [
      "./apps/",
      "./Cargo.toml",
      "./Cargo.lock",
      "./target/",
      "../aomi-sdk/apps/",
      "../aomi-sdk/Cargo.toml",
      "../aomi-sdk/Cargo.lock",
      "../aomi-sdk/target/"
    ],
    "deny_write": [
      "SOUL.md",
      "MEMORY.md",
      "AGENTS.md",
      "build.rs"
    ]
  },
  "network": {
    "allow": [],
    "deny": "*"
  },
  "shell": [
    "cargo",
    "git"
  ],
  "tools": []
}
requires
{
  "binaries": [
    "cargo",
    "git"
  ]
}

README badge

README badge for aomi-labs/skills/aomi-build