agents/skills/injectable/outcome-determinism/SKILL.md
Protocol Type Trigger outcome_determinism - detected when EITHER of these code patterns are present - - Selection from finite depletable pool with fallback behavior (while(full)...
npx skillsauth add plamentsv/plamen outcome-determinismInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Protocol Type Trigger:
outcome_determinism- detected when EITHER of these code patterns are present:
- Selection from finite depletable pool with fallback behavior (
while(full) next,modulowith shrinking domain, category/slot/validator selection)- Time-gated actions with observable default/fallback outcomes (
deadline,claimPeriod,defaultSelection,expiry+ fallback path that computes from predictable state) Inject Into: Breadth agents, depth-edge-case Language: All (rational actor patterns are chain-agnostic) Finding prefix:[OD-N]Added in: v1.1NOTE: Callback selective revert (Section 1a of the original skill) and RNG consumption enumeration (Section 1b) are now ALWAYS-ON checks in the depth agent template - they do not require this injectable to trigger.
The always-on depth template already covers:
This injectable adds analysis that only applies when SPECIFIC structural patterns exist:
For every selection algorithm operating on a set that can shrink, grow, or be modified between selections:
| Selection Function | Pool Size | Depletion Mechanism | Fallback Behavior | Redistribution Fair? | |-------------------|-----------|--------------------|--------------------|---------------------|
Fairness test: When element X is removed from a pool of N:
index++, next slot) - adjacent element gets doubled probabilityCommon biased patterns across protocol types:
while (slot_full) { index++ } - next-in-line gets 2/N probability (NFT categories, validator slots, LP positions)if (depleted) skip - skipped element's share goes entirely to next check, not distributedmodulo(N) where N decreases - specific indices get boosted as N shrinksQuantify: At each depletion level (1-of-N, N/2-of-N, N-1-of-N), what is the maximum probability deviation from uniform? Is it exploitable (can the actor influence which elements deplete first)?
Tag: [VARIATION:pool N→N-K → element X probability 1/N→{new_prob} → bias={factor}x]
For bounded parameters (caps, limits, quotas) where the bound can be LOWERED below already-accumulated state and the bound is used by a selection/iteration algorithm:
| Parameter | Setter | Current Accumulated | Can Set Below Accumulated? | Selection Algorithm Affected | What Breaks? | |-----------|--------|--------------------|--------------------------|-------|--------------|
This extends Rule 14 (Setter Regression) specifically for selection/allocation algorithms: when a cap is lowered below the current count, does the selection algorithm's termination condition still hold? (e.g., while (count == max) becomes unreachable when count > max)
Core question: For each user-facing action, is the TIMING of the action exploitable by a rational self-interested actor?
For every time-gated action with a default or fallback:
| Action | Active Path | Default/Fallback Path | Default Predictable? | Default Sometimes Better? | Delay Cost | |--------|-----------|----------------------|---------------------|--------------------------|-----------|
A rational actor will delay when ALL THREE hold:
Cross-protocol examples:
Methodology:
Tag: [TRACE:action={fn} deadline={T} → default={fallback_fn} → computed_from={state_vars} → predictable={YES/NO} → default_better_when={condition}]
For every admin-settable parameter that affects pending or future user operations:
| Parameter | Setter | Timelock? | Event Emitted? | Affects Pending Operations? | Asymmetry Window | |-----------|--------|-----------|---------------|---------------------------|-----------------|
Applies universally - any onlyOwner/onlyAdmin setter that changes a parameter used in user-facing calculations creates a window where the admin knows the new value but users don't.
Severity factors:
For actions where the ORDER of multiple actors matters:
| Action | Same-Block Ordering Matters? | Cross-Block Ordering Matters? | First-Mover Advantage? | Last-Mover Advantage? | |--------|----------------------------|------------------------------|----------------------|---------------------|
Check: Can an actor observe others' pending actions (mempool) and position before/after them for profit?
| Section | Required | Completed? | Notes | |---------|----------|------------|-------| | 1a. Depletion Redistribution | IF selection from finite/depletable pool | | Quantify bias at each depletion level | | 1b. Parameter Regression on Selection | IF admin can lower cap below accumulated AND cap used by selection algo | | Extends Rule 14 | | 2a. Delay-vs-Act Rationality | IF time-gated action with default/fallback | | Check all three conditions | | 2b. Admin Information Asymmetry | IF admin setter affects pending user operations | | Check timelock AND event emission | | 2c. Sequence-Dependent Outcomes | IF multiple actors' ordering affects results | | Check same-block and cross-block |
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline