resonate-saga-pattern-rust

resonate-saga-pattern-rust is a skill for Claude Code, Codex from resonatehq/resonate-skills. It costs 74 tokens per session (1,463 once invoked), scanned A, original, Apache-2.0.

A Rust implementation of the saga pattern for Resonate workflows. It splits a distributed transaction into steps and defines an undo action for each step if a later step fails.

In plain words
What is it for?
Use it for multi-step Rust workflows such as reserving inventory, charging payment, and arranging shipment. It shows how to track completed steps and run their compensating actions.
Why use it?
It helps keep systems consistent when one operation spans several services and cannot be completed as one database transaction. Completed work can be undone in reverse order after a failure.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for multi-step Rust workflows such as reserving inventory, charging payment, and arranging shipment. It shows how to track completed steps and run their compensating actions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/resonatehq/resonate-skills/resonate-saga-pattern-rust
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add resonatehq/resonate-skills --skill resonate-saga-pattern-rust
Clone the repo
git clone --depth 1 https://github.com/resonatehq/resonate-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for resonate-saga-pattern-rust

README.md
[![agentmods](https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-saga-pattern-rust/github.svg)](https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-saga-pattern-rust)
Your own site
<a href="https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-saga-pattern-rust"><img src="https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-saga-pattern-rust/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for resonate-saga-pattern-rust

Your own site · 80×15
<a href="https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-saga-pattern-rust"><img src="https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-saga-pattern-rust.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,463 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.01463
Opus 5 $0.00037 $0.00732
Sonnet 5 $0.00015 $0.00293
Haiku 4.5 $0.00007 $0.00146

Measured 11d ago against content hash 233decae57e6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

resonate-saga-pattern-rust scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

resonate-saga-pattern-rust/SKILL.md · 167 lines

How it starts

The opening of the file, as written. The whole thing — 167 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Resonate Saga Pattern — Rust

SDK note (0.6.0). The Rust SDK is in active development. The saga pattern below uses only documented surface (ctx.run, Result<T>, ? propagation). Verify against the current SDK source before shipping.

Overview

A saga is a long-running transaction split into smaller steps, each with a compensating action. Forward steps run top-to-bottom; on failure, compensations run bottom-to-top. Rust expresses this naturally via Result<T> + ? for forward propagation and a tracked "completed" list for compensation dispatch.

For the language-agnostic mental model, see resonate-saga-pattern-typescript.

When to use

  • Multi-step workflow where intermediate state is visible to other systems
  • Each step is idempotent or inexpensive to retry individually
  • Compensation logic exists for every committed step
  • You need "all or nothing" consistency without a distributed transaction

Basic shape

use resonate::prelude::*;
use serde::{Serialize, Deserialize};

#[derive(Clone, Serialize, Deserialize)]
enum Step { Inventory, Payment, Shipment }

#[derive(Clone, Serialize, Deserialize)]
struct SagaResult {
    status: String,
    order_id: String,
    compensated: Vec<String>,
}

#[resonate::function]
async fn place_order(ctx: &Context, order_id: String) -> Result<SagaResult> {
    let mut completed: Vec<Step> = Vec::new();

    // attempt the forward path
    let result = try_forward(ctx, &order_id, &mut completed).await;

    match result {
        Ok(()) => Ok(SagaResult {
            status: "success".into(),
            order_id,
            compensated: vec![],
        }),
        Err(_err) => {
            // compensate in reverse order
            let mut comp_names = Vec::new();
            for step in completed.iter().rev() {
                ctx.run(compensate, (step.clone(), order_id.clone()))
                    .await?;
                comp_names.push(format!("{:?}", step));
            }
            Ok(SagaResult {
                status: "failed".into(),
                order_id,
                compensated: comp_names,
            })
        }
    }
}

async fn try_forward(
    ctx: &Context,
    order_id: &str,
    completed: &mut Vec<Step>,
) -> Result<()> {
    ctx.run(reserve_inventory, order_id.to_string()).await?;
    completed.push(Step::Inventory);

    ctx.run(charge_payment, order_id.to_string()).await?;
    completed.push(Step::Payment);

    ctx.run(create_shipment, order_id.to_string()).await?;
    completed.push(Step::Shipment);

    Ok(())
}

#[resonate::function]
async fn compensate((step, order_id): (Step, String)) -> Result<()> {
    match step {
        Step::Shipment => { /* cancel_shipment(&order_id) */ Ok(()) }
        Step::Payment => { /* refund_payment(&order_id) */ Ok(()) }
        Step::Inventory => { /* release_inventory(&order_id) */ Ok(()) }
    }
}

#[resonate::function]
async fn reserve_inventory(order_id: String) -> Result<()> { Ok(()) }

#[resonate::function]
async fn charge_payment(order_id: String) -> Result<()> { Ok(()) }

#[resonate::function]
async fn create_shipment(order_id: String) -> Result<()> { Ok(()) }

Read the full file on GitHub · 167 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 167 lines · 74 tokens per session scan A 233decae57e6

Subscribe to this mod's changes

resonate-saga-pattern-rust is a skill published in the GitHub repository resonatehq/resonate-skills (6 stars, last pushed 20d ago), licensed Apache-2.0. It adds 74 tokens to every session and 1,463 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

golem-make-http-request-rust

Making outgoing HTTP requests from a Rust Golem agent. Use when the user asks to call an external API, make HTTP requests, use an HTTP client, or send HTTP requests from agent code.

golemcloud/golem · 48 tokens

golem-add-http-endpoint-rust

Exposing a Rust Golem agent over HTTP. Use when the user asks to add HTTP endpoints, mount an agent to a URL path, or expose agent methods as a REST API.

golemcloud/golem · 46 tokens

golem-add-webhook-rust

Using webhooks in a Rust Golem agent. Use when the user asks to create webhooks, receive webhook callbacks, integrate with webhook-driven external APIs, or generate temporary callback URLs for external services.

golemcloud/golem · 48 tokens

golem-add-transactions-rust

Adding saga-pattern transactions with compensation to a Rust Golem agent. Use when the user asks about transactions, sagas, compensation, rollback, or multi-step operations that need undo logic.

golemcloud/golem · 45 tokens

azure-eventhub-rust

Azure Event Hubs library for Rust. Send and receive events for streaming data ingestion and batch processing. Triggers: "event hubs rust", "ProducerClient rust", "ConsumerClient rust", "send event rust", "streaming rust", "eventhub rust".

microsoft/skills · 58 tokens

rust-engineer

Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions. Implements ownership patterns, manages lifetimes, designs trait hierarchies, builds async applications with tokio, and structures error handling with Result/Option. Use when building Rust applications, solving ownership or…

Jeffallan/claude-skills · 120 tokens