Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

add-traces

БесплатноБез исполняемых скриптовНе проверен

Make every run of a @statelyai/agent or XState machine leave a replayable, stamped trace — an event log thread plus trace events — so evals and…

statelyaiот statelyai★ 86 звёзд на GitHub

Об этом скилле

Add traces to an agent machine

Targets @statelyai/agent 2.0 alpha, as on the next branch. APIs change between alphas: when a call here does not match the installed package, check node_modules/@statelyai/agent/CHANGELOG.md.

Every run should leave two records, both stamped with what produced it:

Record What it is Read by
Event log thread The external inputs the machine consumed, in order. The source of truth replay, getDecisionAttempts, getUsageFromEvents
Trace events Observations: transitions with from, decision requests with offered options foldTraces, OpenTelemetry, debugging
version the machines → pick a store → name threads → stamp → collect trace events → prove replay → hand back

This is step 2 of 4. Before: loop-to-machine. Next: add-evals, then improve-machine.

Hard rules

  • Traces never change behavior. Recording is an observer. No branch reads a trace. An onTrace or onTransition handler that throws is reported with console.error and skipped. The store is different: it is write-ahead, so a failed write stops the run with cause: "journal". Ask the user whether a run should fail when its log cannot be written (the store) or carry on unrecorded (record from onEvent instead).
  • A trace must name what produced it. A run with no machine version or policy version cannot be used to compare versions, so it is useless to the improver.
  • Replay is the test. A log that does not replay to the run's final state with zero model calls is not a trace yet.
  • No secrets or personal data in metadata or thread ids. Use ids, not names or emails. The log itself holds the machine's input and every event verbatim (a ticket's text, a customer's reply), and trace snapshots hold the context: in production, redact or encrypt them per your data rules, and ask the user which applies.

1. Version the machines

Declare version on every machine whose runs you record: the environment and, if there is one, the policy machine.

export const deskMachine = deskSetup.createMachine({ id: "refund-desk", version: "1", ... });

Also name the decider version: whatever produces the model's answers. It is the policy machine's version when there is one. Otherwise it is a label for the model, its settings, and its prompts (gpt-6-luna.xhigh.p<hash of the prompts>); this holds for a machine with only text requests too. When the prompts are private to another module (a route file), export a prompt version from that module rather than guessing; a release or commit id is the fallback. In tests it is the stand-in model's name (careful). Runs by different deciders must never share a label.

No decider. A machine with no model decisions (a scheduler, a tool runner whose model only picks tools inside one text request) still stamps a decider version: whatever decides what runs. That is the version of the policy engine or approval rules the guards read (rules.v4, a hash of the persisted rules file), plus the request config version when a text request picks tools. Stamp both in metadata (rulesVersion, requestVersion). Thread ids keep the formats below; a non-empty thread resumes with its original stamp, so a run under a changed rule set or request config never resumes an old thread: start a new one (prod:<domain id>:<rulesVersion>:<requestVersion>). A version bridge (docs/persistence.md) applies only when the machine version changes, with the old events and a snapshot; a changed rule set or request config alone never bridges. A changed rule set must never share a label with the old one. getDecisionAttempts is always empty here; record approval verdicts as events so they reach the log.

  • Every log entry carries machineVersion. Without a declared version it falls back to a structural hash that skips functions, and in XState v6 the guards and targets live in transition functions. Changing a guard would not change the hash.
  • Bump version on every behavior change. Adding recording is not one: it only observes. improve-machine bumps the policy's on promotion.
  • A test-only variant built from the same factory (a loosened guard) gets its own version ("1-loose"), so its runs are never mistaken for the real machine's.

2. Pick a store

  • Tests and local runs: createInMemoryEventLogStore() from @statelyai/agent/log, or write each thread's result.events to a JSON file after the run.
  • Production: implement AgentEventLogStore against your database and check it with `assertEventLogStoreCo
Полный SKILL.md на GitHub

Установить add-traces в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл add-traces?

Make every run of a @statelyai/agent or XState machine leave a replayable, stamped trace — an event log thread plus trace events — so evals and self-improvement can read what happened and what produced it. Use when asked to "add tracing", "add logging", "persist runs", "stamp traces", "record what the agent did", or "set up observability" for an agent machine, or before writing evals or improving a policy from traces.

Как установить скилл add-traces?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл add-traces запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить add-traces с