agentsop-state-reducer
Tool skill for declaring reducers on LangGraph state keys so parallel writes merge instead of crashing. Activates whenever a coder agent designs a StateGraph with parallel branches, fan-out via Send, multi-agent topologies, or whenever a run raises `InvalidUpdateError: At key '<k>': Can receive only one value per step`. Encodes the rule "every state key is single-writer or has a reducer — nothing in between."
npx skills add agentsope/SkillAlchemy --skill agentsop-state-reducer --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# State Reducer · Tool Skill > Scope: a single decision — for each state key, declare a reducer or > guarantee single-writer. Out of scope: checkpointers, HITL, supervisor vs. > swarm — see `langgraph-sop` for those. --- ## 1. 何时激活 (Activation Rules) Activate when **any** trigger fires: - The task involves a LangGraph `StateGraph`, `TypedDict`/`BaseModel` schema, or `Annotated[..., <reducer>]` typing. - The graph has ≥1 of: parallel branches via static fan-out, `Send` API, multiple agents writing shared state, or a supervisor pattern where workers return concurrently. - The run raises `langgraph.errors.InvalidUpdateError` — message looks like `At key 'messages': Can receive only one value per step. Use an Annotated key to handle multiple values.` - The user pastes a state schema and asks "why does this crash on parallel?" or "do I need a reducer here?". - The user is migrating a linear chain to a fan-out / map-reduce shape. Do **not** activate if every key is written by exactly one node per superstep (see §6: over-reducing single-writer keys is an anti-pattern). --- ## 2. 核心心智模型 (Core Mental Model) **LangGraph state is either single-writer or has a reducer. Nothing in between.** Wh
- 1. 何时激活 (Activation Rules)
- 2. 核心心智模型 (Core Mental Model)
- 3. SOP 工作流 (Agentic Protocol)
- Step 1 · Enumerate writers per key
- Step 2 · Classify each key
- Step 3 · Pick the reducer
- Step 4 · Probe-test the parallel update
- Step 5 · Document the contract
- 4. 操作模型 (Operation Models)
- OP-1 · Declare addmessages for a chat history key
- OP-2 · Declare operator.add for an accumulating list
- OP-3 · Declare operator.add for a counter
- OP-4 · Single-writer key (no reducer)
- OP-5 · Custom reducer — keep latest by timestamp
What does the agentsop-state-reducer skill do?
Tool skill for declaring reducers on LangGraph state keys so parallel writes merge instead of crashing. Activates whenever a coder agent designs a StateGraph with parallel branches, fan-out via Send, multi-agent topologies, or whenever a run raises `InvalidUpdateError: At key '<k>': Can receive only one value per step`. Encodes the rule "every state key is single-writer or has a reducer — nothing in between."
How do I install it?
Run `npx skills add agentsope/SkillAlchemy --skill agentsop-state-reducer --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From agentsope/SkillAlchemy, a repository with 255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
