agui-dotnet-shared-state

agui-dotnet-shared-state is a skill for Claude Code from ag-ui-protocol/ag-ui. It costs 215 tokens per session (1,375 once invoked), scanned A, original, MIT.

A guide for keeping a structured object, such as a form, document, plan, or recipe, synchronized between an AG-UI .NET agent and its client. The client sends the starting state, and the agent sends updates back while the chat runs.

In plain words
What is it for?
Use it when a .NET AG-UI app needs an agent to read and update shared forms, documents, plans, recipes, or similar structured data.
Why use it?
It removes the need to build your own way to send changing application data alongside chat messages. Both sides can work from the latest state as it changes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the ag-ui-dotnet plugin — 9 skills shipped together

Good fit Use it when a .NET AG-UI app needs an agent to read and update shared forms, documents, plans, recipes, or similar structured data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ag-ui-protocol/ag-ui/agui-dotnet-shared-state
About the project

AG-UI is an event-based protocol that lets AI agent backends communicate with user-facing applications. It standardizes agent events and inputs while supporting transports such as server-sent events, WebSockets, and webhooks. The catalogue add-ons help developers build integrations and applications around the protocol.

ag-ui-protocol/ag-ui · 15,752 stars · on GitHub · ag-ui.com

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 ag-ui-protocol/ag-ui --skill agui-dotnet-shared-state
Clone the repo
git clone --depth 1 https://github.com/ag-ui-protocol/ag-ui

Made for: Claude Code.

Or install ag-ui-dotnet, the plugin that ships this one along with the rest of its 9 skills.

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 agui-dotnet-shared-state

README.md
[![agentmods](https://agentmods.dev/badge/skills/ag-ui-protocol/ag-ui/agui-dotnet-shared-state.svg)](https://agentmods.dev/skills/ag-ui-protocol/ag-ui/agui-dotnet-shared-state)
Your own site
<a href="https://agentmods.dev/skills/ag-ui-protocol/ag-ui/agui-dotnet-shared-state"><img src="https://agentmods.dev/badge/skills/ag-ui-protocol/ag-ui/agui-dotnet-shared-state.svg" alt="Measured on agentmods" height="20"></a>
Per session 215 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,375 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00215 $0.01375
Opus 5 $0.00108 $0.00687
Sonnet 5 $0.00043 $0.00275
Haiku 4.5 $0.00021 $0.00137

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

Security

Grade A, and why

agui-dotnet-shared-state 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 8d 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.

sdks/dotnet/plugins/ag-ui-dotnet/skills/agui-dotnet-shared-state/SKILL.md · 118 lines

How it starts

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

AG-UI .NET — shared state

Goal: keep a structured object (a form, a document, a plan, a recipe) in sync between the client and the agent — the client provides the current state, the agent updates it, and the new state streams back next to the assistant's text.

State travels on the wire inside RunAgentInput.State (inbound) and as StateSnapshotEvent / StateDeltaEvent (outbound). In Microsoft.Extensions.AI terms, inbound state rides on the request's raw representation and outbound state rides on a ChatResponseUpdate's raw representation.

Client: seed the state and read it back

Send the starting state with the request, and watch for snapshots in the response:

using System.Text.Json;
using AGUI.Abstractions;
using Microsoft.Extensions.AI;

var initialState = JsonSerializer.SerializeToElement(new
{
    recipe = new { title = "", ingredients = Array.Empty<string>(), steps = Array.Empty<string>() }
});

var options = new ChatOptions
{
    RawRepresentationFactory = _ => new RunAgentInput { State = initialState },
};

var messages = new List<ChatMessage> { new(ChatRole.User, "Suggest an Italian pasta recipe") };

JsonElement? latestState = null;
await foreach (var update in client.GetStreamingResponseAsync(messages, options))
{
    if (update.RawRepresentation is StateSnapshotEvent snapshot)
    {
        latestState = snapshot.Snapshot;   // the full updated state object
    }
    Console.Write(update.Text);            // the assistant's summary streams as usual
}

State updates are content-less — they arrive on update.RawRepresentation, not as update.Text.

Server: read inbound state and emit the new state

Add a DelegatingChatClient to the pipeline that reads RunAgentInput.State, produces the new state, and yields it as a StateSnapshotEvent:

using System.Runtime.CompilerServices;
using System.Text.Json;
using AGUI.Abstractions;
using AGUI.Server;
using Microsoft.Extensions.AI;

internal sealed class RecipeStateChatClient(IChatClient inner, JsonSerializerOptions jso)
    : DelegatingChatClient(inner)
{
    public override async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(
        IEnumerable<ChatMessage> messages,
        ChatOptions? options = null,
        [EnumeratorCancellation] CancellationToken ct = default)
    {
        if (options?.TryGetRunAgentInput(out var input) is true
            && input!.State is { ValueKind: JsonValueKind.Object } incoming)
        {
            var newState = await BuildStateAsync(messages, incoming, ct);   // your logic / an LLM call

            yield return new ChatResponseUpdate
            {
                RawRepresentation = new StateSnapshotEvent
                {
                    Snapshot = JsonSerializer.SerializeToElement(newState, jso.GetTypeInfo(typeof(AgentState))),
                },
            };
        }

        await foreach (var update in base.GetStreamingResponseAsync(messages, options, ct))
        {
            yield return update;   // the assistant's text summary
        }
    }
}

Read the full file on GitHub · 118 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. 8d ago First seen · 118 lines · 215 tokens per session scan A f356a7554de6

Subscribe to this mod's changes

agui-dotnet-shared-state is a skill published in the GitHub repository ag-ui-protocol/ag-ui (15,752 stars, last pushed today), licensed MIT. It adds 215 tokens to every session and 1,375 once invoked, about $0.0011 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-30.