reloadable-state

reloadable-state is a skill for Claude Code, Codex from fold-run/fold. It costs 60 tokens per session (834 once invoked), scanned A, original, Apache-2.0.

A checklist for adding configuration or runtime state that must remain correct when the gateway reloads without restarting. It covers where state belongs, configuration validation, discovery updates, and tests.

In plain words
What is it for?
Use it when adding configuration fields, per-upstream settings, request-time state, or shared state across gateway instances.
Why use it?
It prevents new settings from being lost, merged incorrectly, or behaving inconsistently during reloads and changes to upstream services.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/fold-run/fold/reloadable-state
Any agent
npx skills add fold-run/fold --skill reloadable-state
Clone the repo
git clone --depth 1 https://github.com/fold-run/fold

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 reloadable-state

README.md
[![agentmods](https://agentmods.dev/badge/skills/fold-run/fold/reloadable-state.svg)](https://agentmods.dev/skills/fold-run/fold/reloadable-state)
Your own site
<a href="https://agentmods.dev/skills/fold-run/fold/reloadable-state"><img src="https://agentmods.dev/badge/skills/fold-run/fold/reloadable-state.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 834 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00060 $0.00834
Opus 5 $0.00030 $0.00417
Sonnet 5 $0.00012 $0.00167
Haiku 4.5 $0.00006 $0.00083

Measured 4d ago against content hash 5d1d14237b99, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

reloadable-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 4d 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.

.claude/skills/reloadable-state/SKILL.md · 71 lines

How it starts

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

Adding reloadable state to fold

fold's reloadable state is one atomic snapshot (routes in gateway/gateway.go). Every request loads the snapshot once and routes against it. Getting a new field wrong here breaks hot reload, discovery merges, or fleet consistency in ways unit tests won't catch — follow the checklist.

1. Decide where the state lives

  • Read per-request, changeable at runtime → a field on the routes snapshot, populated at snapshot build. Never a fresh field on Gateway.
  • Shared across a gateway fleet (windows, breakers, caches) → behind state.Provider (internal/state), with both providers implemented: in-memory and Redis. Redis operations fail open with the 500 ms bound.
  • Construction-only (auth, server, routing, audit, tracing sections) → wire at gateway.New and make sure Reload still rejects changes to it. If your field is in one of these sections, that's the whole point: verify the rejection path has a test.

2. Config plumbing (lockstep, enforced by tests)

  • Add the field to config/config.go with validation in the same place neighboring fields validate.
  • Mirror it in config/fold.config.schema.json — the schema drift test fails otherwise.
  • It falls under the v1 compatibility contract (README "API stability"): new fields must be optional with a safe default.
  • Document: docs/configuration.md (state the default and unit — Ms suffix convention), docs/defaults.md, and fold.config.example.json if it's mainstream. A whole new top-level section also needs a row in the README's config summary table.
  • If the field is construction-wired, say so in its docs/configuration.md row and check README "Configuration hot-reloads", which enumerates the non-reloadable sections — the two must agree.

3. Reload semantics

  • Snapshot build must read the field from the merged document: base config + discovery-sourced upstreams. Base reloads and discovery syncs each preserve the other's contribution — if your field can come from either side, test both directions.
  • Validation runs on the whole merged document before any swap — a bad value must reject the reload, leaving the old snapshot serving.
  • Upstream identity: if your field is part of upstream config, changing it must retire-and-drain that upstream on reload; leaving it identical must reuse the upstream (sessions survive). Check the config-comparison logic includes your field.

Read the full file on GitHub · 71 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. 4d ago First seen · 71 lines · 60 tokens per session scan A 5d1d14237b99

Subscribe to this mod's changes

reloadable-state is a skill published in the GitHub repository fold-run/fold (1 stars, last pushed 3d ago), licensed Apache-2.0. It adds 60 tokens to every session and 834 once invoked, about $0.0003 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.