[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AP4W7TGJMKQQGAR9GZW4FZ":3,"skill-same:01M7AP4W7TGJMKQQGAR9GZW4FZ":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M7AP4W7TGJMKQQGAR9GZW4FZ","hermes",null,"Optimise Solidity gas usage with an executable, fail-closed Foundry loop that measures savings, re-runs behaviour tests, checks storage layouts and method identifiers, and demands targeted differential or property evidence for state-sensitive unchecked arithmetic. Every candidate names a rule from a pinned corpus of 120 gas rules and 28 rejected ones, and the harness refuses a rule outside the target's compiler, fork or pipeline scope. Use for Solidity gas work, Forge snapshot reductions, gas-report reviews, storage packing, unchecked arithmetic, or any proposed EVM gas-saving change.","wildcat-finance\u002Fskills","wildcat-finance","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113041915?v=4","01M7AP0V1G8X0SWHP6C5V90RM5","The Wildcat Protocol","01M7AP0V24Y50BGVCQ4DV496VD",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: hermes\ndescription: Optimise Solidity gas usage with an executable, fail-closed Foundry loop that measures savings, re-runs behaviour tests, checks storage layouts and method identifiers, and demands targeted differential or property evidence for state-sensitive unchecked arithmetic. Every candidate names a rule from a pinned corpus of 120 gas rules and 28 rejected ones, and the harness refuses a rule outside the target's compiler, fork or pipeline scope. Use for Solidity gas work, Forge snapshot reductions, gas-report reviews, storage packing, unchecked arithmetic, or any proposed EVM gas-saving change.\nmetadata:\n  version: \"0.1.1\"\n---\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"..\u002F..\u002Fassets\u002Fcharacters\u002Fhermes.png\" width=\"1200\">\n\u003C\u002Fp>\n\n# hermes gas optimiser\n\n## Frontier\n\nHermes owns its own gas-optimisation evidence frontier, not Hexaemeron's delivery or\nSolidity frontier. Its version, held target, next job, and maturity\nstate live in [EVOLUTION.md](EVOLUTION.md). Do not recommend or run\nanother frontier pass after that ledger becomes mature.\n\n\u003C!-- marketplace-context:start -->\n## Where this sits\n\nHermes measures one named Solidity gas optimisation class at a time and rejects the candidate unless every Foundry, behaviour, layout, selector, and arithmetic gate clears.\n\n**Current frontier.** Hermes's twelve optimisation classes name 62 of the corpus's 120 rules, so 58 documented rules cannot be selected as candidates.\n\u003C!-- marketplace-context:end -->\n\nHermes alone owns Solidity gas optimisation. Metron handles measured\nperformance in every other unit. Pandects can supply economic laws a candidate\nmust preserve, Janus can constrain hook effects, and the Pashov suite can audit\nthe resulting contracts. None of them can replace Hermes's sealed baseline or\naccept a gas candidate on its behalf.\n\nA Synkrisis comparison may point a person towards a repeated run pattern, but\nit cannot replace Hermes's controlled before-and-after evidence. A Synkrisis\nfinding is an inferred relation between named events, never a measurement.\n\nThe ideas are cheap. The evidence is the job.\n\nUse `scripts\u002Fhermes.py` for every run. It owns the order, seals the baseline, writes the evidence, and exits non-zero at the first bad gate. Every candidate names a rule from [references\u002Fgas-rule-corpus.json](references\u002Fgas-rule-corpus.json), the pinned corpus of 120 rules, 28 rejected universal rules and 40 citations transcribed from one source document. Use [references\u002Foptimisation-catalogue.md](references\u002Foptimisation-catalogue.md) to read the twelve classes those rules map onto.\n\nCheck the corpus before a run and read what it holds:\n\n```bash\npython3 \"$HERMES_PY\" corpus --validate\npython3 \"$HERMES_PY\" corpus --validate --json\n```\n\n62 of the 120 rules name a class and can be selected. The other 58 constrain how a run is conducted, or they are architecture; the harness refuses them as candidates and says so rather than measuring something they do not describe.\n\n## Day to day\n\n**Developers.** A gas change shaves a few hundred units off a hot path and nobody can say whether behaviour moved with it. Run Hermes on that one optimisation class and the review arrives with the snapshot diff, both fuzz passes, the storage layout comparison and a `result.json`, rather than a number and an assurance.\n\n**Security and audit.** A gas change arrives from outside the team. Instead of reading it for intent, put it through Gate 5 to see whether any protected contract's storage layout or method identifiers moved, and Gate 6 for unchecked arithmetic that reaches persistent state.\n\n## Before touching source\n\n1. Work from the Foundry root. If the repository keeps `foundry.toml` under `build\u002F`, pass `build\u002F` as `--repo`.\n2. Read the repository instructions and satisfy its issue or branch rules before writing.\n3. Start from a clean Git tree. Finish unrelated work first.\n4. Pin one fuzz seed for the run. Keep any fork-test exclusions identical through Gates 1 to 4.\n5. Re-derive the layout set. Search for proxies, `delegatecall`, clones, factories, hooks, role providers, and contracts called by them. Treat doubt as frozen layout.\n6. Name the intended gas measurements before editing. Each `--gas-target` is a regular expression and must contain a measured saving.\n\nSet `HERMES_PY` to this skill's `scripts\u002Fhermes.py` path. Keep the run directory printed by Gate 1; every later command uses it.\n\n## Gate 1: seal a green baseline\n\nList every hook, role provider, proxied implementation, facet, factory-sensitive contract, and other frozen layout with `--protected-contract`. Use a qualified `path:Contract` identifier when names collide.\n\n```bash\npython3 \"$HERMES_PY\" baseline \\\n  --repo \"\u003Cfoundry-root>\" \\\n  --fuzz-seed 0x5EED \\\n  --no-match-path \"test\u002FFork.t.sol\" \\\n  --protected-contract \"Market=src\u002FMarket.sol:Market\" \\\n  --protected-contract \"Hooks=src\u002FHooks.sol:Hooks\"\n```\n\nRepeat `--no-match-path` and `--protected-contract` as needed. Omit exclusions that the repository does not need.\n\nIf no frozen contract is in scope, say so explicitly:\n\n```bash\npython3 \"$HERMES_PY\" baseline \\\n  --repo \"\u003Cfoundry-root>\" \\\n  --fuzz-seed 0x5EED \\\n  --assert-no-protected-contracts\n```\n\nAdd `--layout-contract \"Label=path:Contract\"` for a non-frozen contract whose layout still needs recording. This is useful for a deliberate packing change.\n\nGate 1 runs `forge snapshot` and then `forge test`, in that order. It records the snapshot, green test result, Forge version, canonical Foundry config, Git revision, Solidity sources, storage layouts, method identifiers, and the rule corpus with its digest. A corpus that fails its own schema ends the run here, so a candidate is never judged under advice nobody checked. A dirty tree, red suite, missing snapshot, failed inspect, or invalid JSON ends the run.\n\n## Gate 2: name a rule and make one class of change\n\nEvery `verify` names one corpus rule with `--rule`. The rule decides the class, so a declared\n`--optimisation-class` that disagrees with it is refused. Gate 2 refuses before Gate 3\nspends a Forge run, and `result.json` carries a `refusal` field naming which condition failed:\n\n- `corpus\u002Funknown-rule`: no rule of that id\n- `corpus\u002Fmyth-selected`: a rejected universal rule named as a candidate, answered with its correction\n- `corpus\u002Fmyth-cited`: a rationale or obligation answer citing a rejected rule as its justification\n- `corpus\u002Frule-names-no-class`: a rule that constrains the run or is architecture, so no candidate implements it\n- `corpus\u002Fclass-disagreement`: the declared class is not the rule's class\n- `corpus\u002Fout-of-scope`: the target's compiler, fork or pipeline is outside the rule's declared scope\n- `corpus\u002Fscope-unresolved`: the target pins no readable `solc`, or names a fork the corpus does not order\n- `corpus\u002Fobligation-unanswered`: an obligation the rule's own statement makes has no substantive answer\n- `corpus\u002Fobligation-malformed`: an `--obligation` argument is not `\u003Cn>=\u003Canswer>`, or names an index the rule lacks\n- `corpus\u002Fdigest-moved`: the corpus changed after the baseline sealed it\n- `corpus\u002Finvalid`: the corpus does not pass its own schema\n\nAnswer each of the rule's obligations with `--obligation \"\u003Cn>=\u003Canswer>\"`, one per obligation, indexed\nfrom one. Those answers are recorded judgement rather than measurement, and `result.json` marks them\nas such. The six gates below do not move because of them.\n\nThen choose that rule's class and make only that kind of source change. Do not mix cleanup, compiler settings, test edits, or a second gas idea into the candidate.\n\nReview `candidate.solidity.diff` before attesting. The harness rejects Solidity file additions or removals, test-source edits, an empty candidate, added `unchecked` outside `unchecked-arithmetic`, and added assembly outside `assembly`. The attestation remains a judgement: read the diff and confirm that every hunk belongs to the declared class.\n\nIf the required property test is absent, add it in a preparatory change, get green, and take a fresh baseline. The optimisation candidate uses the existing fuzz suite rather than changing its own oracle.\n\n## Gates 3 to 6: verify the candidate\n\nFor an ordinary candidate:\n\n```bash\npython3 \"$HERMES_PY\" verify \\\n  --run-dir \"\u003Crun-dir>\" \\\n  --rule STO-09 \\\n  --obligation \"1=The cache is loaded after the last write and every use sits inside one call frame.\" \\\n  --optimisation-class storage-load-caching \\\n  --attest-single-class \\\n  --gas-target 'LedgerTest:test_update' \\\n  --gas-target 'LedgerTest:test_batch' \\\n  --no-sensitive-unchecked\n```\n\nFor unchecked arithmetic outside state-sensitive code, add a real explanation:\n\n```bash\n  --no-sensitive-unchecked \\\n  --non-sensitive-rationale \"The loop counter is bounded by the in-memory array length and cannot affect persistent state, asset balances, external call parameters, or rounding.\"\n```\n\nFor unchecked arithmetic that can affect persistent state, asset accounting, external calls, permissions, or rounding, run the existing targeted differential or property test:\n\n```bash\npython3 \"$HERMES_PY\" verify \\\n  --run-dir \"\u003Crun-dir>\" \\\n  --rule CTL-05 \\\n  --obligation \"1=Every intermediate is bounded by the array length checked at the loop head.\" \\\n  --obligation \"2=The unchecked region is three lines and the bound is stated beside it.\" \\\n  --optimisation-class unchecked-arithmetic \\\n  --attest-single-class \\\n  --gas-target 'LedgerTest:test_update' \\\n  --sensitive-unchecked \\\n  --targeted-match-path 'test\u002FStateDifferential.t.sol' \\\n  --targeted-match-test 'testFuzz_diff_stateTransition' \\\n  --property-proof \"Compare the checked reference and candidate across the complete reachable input domain; assert equal state transitions and equal overflow reverts at the arithmetic boundaries.\"\n```\n\n### Gate 3: quantify the gas change\n\nRun `forge snapshot --diff \u003Cbaseline>` and capture a candidate snapshot. Reject a positive deterministic delta anywhere, a changed measurement set, a target with no match, or a target with no saving. Then run `forge test --gas-report`.\n\nHistorical Foundry snapshots also contain fuzz statistics whose sampled inputs can change when the compiled bytecode changes. Hermes records their baseline and candidate means and medians, but does not call those aggregates a gas regression or saving. It still rejects a changed fuzz-test set or run count. Foundry `invariant_callSummary()` rows are stricter: their test set, run count, call count, and revert count must stay identical.\n\n### Gate 4: prove behaviour is unchanged\n\nRun the full `forge test` suite with the pinned seed, followed by a full unpinned run. Any failure rejects the candidate.\n\n### Gate 5: preserve layouts and selectors\n\nRe-run `forge inspect \u003CC> storageLayout --json --force` and `methodIdentifiers` for every recorded contract. The layout comparison canonicalises solc's compilation-local AST IDs, while retaining raw inspector output in evidence; it hard-aborts on any structural protected-layout difference or method-selector difference. A declared layout change is allowed only for an unprotected contract under the rules below.\n\n### Gate 6: prove state-sensitive unchecked arithmetic\n\nWhen `--sensitive-unchecked` applies, run the named targeted differential or property test and record its oracle. Otherwise, record why the candidate does not introduce or rely on state-sensitive unchecked arithmetic.\n\n## Deliberate layout change outside the frozen set\n\nOnly `storage-packing` and `constants-immutables` may declare one. The contract must have been listed with `--layout-contract`, never `--protected-contract`.\n\n```bash\n  --allow-unprotected-layout-change \\\n  --layout-change-rationale \"No proxy, hook, role provider, delegate call, deployed factory instance, storage-reading test, or indexer consumes this layout.\"\n```\n\nHermes records the diff. It rejects an undeclared difference, a declared difference that never occurred, or any difference on the frozen set.\n\n## State-sensitive arithmetic property standard\n\nBefore accepting the Gate 6 result, inspect the named test and confirm all of the following:\n\n- Exercise the changed unchecked operation rather than a neighbouring helper.\n- Compare against the original checked implementation or enforce an equivalent property oracle.\n- Preserve checked overflow and underflow behaviour; a wrapped result cannot stand in for a reference revert.\n- Cover applicable `0`, `1`, maxima, time deltas, input bounds, balance bounds, rounding boundaries, plus the exact safe and unsafe arithmetic edges.\n- Avoid a `bound()` or assumption that removes the dangerous region.\n- Keep the existing fuzz or invariant configuration from the named test path, such as `test\u002FFuzz.t.sol`, with the baseline seed recorded in the command.\n\nA comment explaining why arithmetic looks safe is useful review context. It is not Gate 6 evidence.\n\n## Accept, reject, repeat\n\nExit `0` plus `result.json` status `accepted` is the acceptance signal. Exit codes identify the rejected gate: `10`, `20`, `30`, `40`, `50`, or `60`. `result.json`, the command logs, gas comparison, source diff, layouts, and method maps stay together in the run directory.\n\nStop after any rejection. Do not tweak tolerances, alter the target set after seeing the result, weaken a test, or add another optimisation to cover the loss. Remove only the candidate changes, return to the last green state, and begin again at Gate 1.\n\nAfter acceptance, promote the candidate snapshot deliberately:\n\n```bash\npython3 \"$HERMES_PY\" promote --run-dir \"\u003Crun-dir>\"\n```\n\nThat accepted state becomes the baseline for the next class. Never run two classes through one Hermes record.\n\n## Refuse shortcuts\n\n- If `forge` is unavailable, report that no gas result can be measured.\n- If the baseline is red or dirty, fix that in separate work.\n- If someone asks to skip the layout diff, keep the gate.\n- If someone asks to bundle changes, run them in sequence.\n- If the gas saving cannot be quantified, reject it.\n- If a state-sensitive unchecked change lacks the targeted proof, reject it whatever the gas number says.\n- If the candidate implements no corpus rule, add the rule to the corpus in separate work first. There is no flag that skips the requirement.\n\n## Promise Machine contract\n\n### hermes-sealed-baseline\n\n- Promise: A successful `baseline` seals a green, clean Foundry baseline with the named gas measurements, configuration, seed, source revision, protected layouts, method identifiers and the validated rule corpus with its digest.\n- Evidence: The run directory, baseline snapshot, full test log, Foundry version, canonical configuration, Git and source records, storage layouts and method maps.\n- Evidence classes: checked, measured, recorded\n- Boundary: The baseline describes one repository state and environment; it does not establish that a later candidate preserves behaviour or improves gas.\n- Authorises: Evaluation of one declared optimisation class against the sealed baseline and fixed measurement set.\n- Consequence: 1\n- Refuses: Beginning a candidate comparison from a dirty tree, red suite, missing snapshot, unresolved protected set, changed exclusions or a corpus that fails its own schema.\n- Recovery: Restore a clean green repository, re-derive the protected and measured sets and take a fresh baseline.\n- Exceptions: none\n\n### hermes-corpus-selection\n\n- Promise: A successful Gate 2 corpus selection establishes that the named rule exists in the corpus the baseline sealed, that it names the declared optimisation class, that the target's pinned compiler, fork and pipeline fall inside the rule's declared scope, and that every obligation the rule's own statement makes carries a recorded answer.\n- Evidence: The sealed corpus digest, the corpus schema result, the selected rule with its grade and automation level, the resolved compiler, fork and pipeline read from the sealed Foundry configuration, the paired obligation answers and the `refusal` field on any rejection.\n- Evidence classes: checked, recorded\n- Boundary: Selection establishes that the candidate is in scope for reviewed advice and that its obligations were answered; it does not establish that the answers are correct, that the optimisation saves gas, or that behaviour is preserved. Obligation answers are recorded judgement rather than measurement and the six gates do not move because of them.\n- Authorises: Measurement of that one candidate against the sealed baseline under the named rule, with the rule id and corpus digest carried into the accepted record.\n- Consequence: 1\n- Refuses: An unknown rule, a rejected universal rule named as a candidate or cited as a justification, a rule that names no class, a declared class the rule does not name, a compiler, fork or pipeline outside the declared scope, a scope that cannot be resolved from the sealed configuration, an unanswered or malformed obligation, a corpus that moved after the baseline, and a corpus that fails its own schema.\n- Recovery: Select the rule the candidate actually implements, answer each of its obligations, pin the target's `solc_version` and `evm_version` where the scope cannot be resolved, or add the missing rule to the corpus in separate work before starting a new run.\n- Exceptions: none\n\n### hermes-candidate-acceptance\n\n- Promise: A successful `verify` with `result.json` status `accepted` establishes measured savings for every named target, no deterministic regression, passing pinned and unpinned behaviour suites, preserved protected layouts and selectors, and the required unchecked-arithmetic evidence for one declared class, under one named corpus rule whose scope the target satisfies.\n- Evidence: The sealed baseline, candidate Solidity diff, gas snapshot comparison, gas report, both full test runs, layout and selector comparisons, targeted property result when required, the corpus digest with the selected rule and its answered obligations, and accepted `result.json`.\n- Evidence classes: checked, measured, recomputed, recorded\n- Boundary: Acceptance covers one candidate, repository state, toolchain, measurement set and optimisation class; it is not a general security proof or permission to combine another change.\n- Authorises: Retaining and reviewing that exact gas candidate as a repository mutation with its complete evidence directory.\n- Consequence: 2\n- Refuses: Acceptance after any gate fails, a target lacks a saving, the measurement set moves, a protected interface changes, sensitive unchecked arithmetic lacks its named property evidence, or the candidate names no corpus rule.\n- Recovery: Remove only the rejected candidate, return to the sealed green state, correct prerequisite tests separately and start a new Hermes run.\n- Exceptions: none\n\n### hermes-baseline-promotion\n\n- Promise: A successful `promote` advances the Hermes baseline only to the exact candidate already accepted by the same run record.\n- Evidence: The accepted `result.json`, matching run directory, candidate snapshot and promotion command result.\n- Evidence classes: checked, recorded\n- Boundary: Promotion changes the local measurement baseline; it does not publish code, accept another optimisation class or validate unrecorded edits.\n- Authorises: Using the promoted accepted snapshot as the baseline for the next separately declared optimisation class.\n- Consequence: 2\n- Refuses: Promotion of a rejected, changed, missing or differently scoped candidate record.\n- Recovery: Restore the accepted run directory or take a fresh baseline from the intended repository state.\n- Exceptions: none\n","\u003Cp align=\"center\">\n  \u003Cimg src=\"..\u002F..\u002Fassets\u002Fcharacters\u002Fhermes.png\" width=\"1200\">\n\u003C\u002Fp>\n\n# hermes gas optimiser\n\n## Frontier\n\nHermes owns its own gas-optimisation evidence frontier, not Hexaemeron's delivery or\nSolidity frontier. Its version, held target, next job, and maturity\nstate live in [EVOLUTION.md](EVOLUTION.md). Do not recommend or run\nanother frontier pass after that ledger becomes mature.\n\n\u003C!-- marketplace-context:start -->\n## Where this sits\n\nHermes measures one named Solidity gas optimisation class at a time and rejects the candidate unless every Foundry, behaviour, layout, selector, and arithmetic gate clears.\n\n**Current frontier.** Hermes's twelve optimisation classes name 62 of the corpus's 120 rules, so 58 documented rules cannot be selected as candidates.\n\u003C!-- marketplace-context:end -->\n\nHermes alone owns Solidity gas optimisation. Metron handles measured\nperformance in every other unit. Pandects can supply economic laws a candidate\nmust preserve, Janus can constrain hook effects, and the Pashov suite can audit\nthe resulting contracts. None of them can replace Hermes's sealed baseline or\naccept a gas candidate on its behalf.\n\nA Synkrisis comparison may point a person towards a repeated run pattern, but\nit cannot replace Hermes's controlled before-and-after evidence. A Synkrisis\nfinding is an inferred relation between named events, never a measurement.\n\nThe ideas are cheap. The evidence is the job.\n\nUse `scripts\u002Fhermes.py` for every run. It owns the order, seals the baseline, writes the evidence, and exits non-zero at the first bad gate. Every candidate names a rule from [references\u002Fgas-rule-corpus.json](references\u002Fgas-rule-corpus.json), the pinned corpus of 120 rules, 28 rejected universal rules and 40 citations transcribed from one source document. Use [references\u002Foptimisation-catalogue.md](references\u002Foptimisation-catalogue.md) to read the twelve classes those rules map onto.\n\nCheck the corpus before a run and read what it holds:\n\n```bash\npython3 \"$HERMES_PY\" corpus --validate\npython3 \"$HERMES_PY\" corpus --validate --json\n```\n\n62 of the 120 rules name a class and can be selected. The other 58 constrain how a run is conducted, or they are architecture; the harness refuses them as candidates and says so rather than measuring something they do not describe.\n\n## Day to day\n\n**Developers.** A gas change shaves a few hundred units off a hot path and nobody can say whether behaviour moved with it. Run Hermes on that one optimisation class and the review arrives with the snapshot diff, both fuzz passes, the storage layout comparison and a `result.json`, rather than a number and an assurance.\n\n**Security and audit.** A gas change arrives from outside the team. Instead of reading it for intent, put it through Gate 5 to see whether any protected contract's storage layout or method identifiers moved, and Gate 6 for unchecked arithmetic that reaches persistent state.\n\n## Before touching source\n\n1. Work from the Foundry root. If the repository keeps `foundry.toml` under `build\u002F`, pass `build\u002F` as `--repo`.\n2. Read the repository instructions and satisfy its issue or branch rules before writing.\n3. Start from a clean Git tree. Finish unrelated work first.\n4. Pin one fuzz seed for the run. Keep any fork-test exclusions identical through Gates 1 to 4.\n5. Re-derive the layout set. Search for proxies, `delegatecall`, clones, factories, hooks, role providers, and contracts called by them. Treat doubt as frozen layout.\n6. Name the intended gas measurements before editing. Each `--gas-target` is a regular expression and must contain a measured saving.\n\nSet `HERMES_PY` to this skill's `scripts\u002Fhermes.py` path. Keep the run directory printed by Gate 1; every later command uses it.\n\n## Gate 1: seal a green baseline\n\nList every hook, role provider, proxied implementation, facet, factory-sensitive contract, and other frozen layout with `--protected-contract`. Use a qualified `path:Contract` identifier when names collide.\n\n```bash\npython3 \"$HERMES_PY\" baseline \\\n  --repo \"\u003Cfoundry-root>\" \\\n  --fuzz-seed 0x5EED \\\n  --no-match-path \"test\u002FFork.t.sol\" \\\n  --protected-contract \"Market=src\u002FMarket.sol:Market\" \\\n  --protected-contract \"Hooks=src\u002FHooks.sol:Hooks\"\n```\n\nRepeat `--no-match-path` and `--protected-contract` as needed. Omit exclusions that the repository does not need.\n\nIf no frozen contract is in scope, say so explicitly:\n\n```bash\npython3 \"$HERMES_PY\" baseline \\\n  --repo \"\u003Cfoundry-root>\" \\\n  --fuzz-seed 0x5EED \\\n  --assert-no-protected-contracts\n```\n\nAdd `--layout-contract \"Label=path:Contract\"` for a non-frozen contract whose layout still needs recording. This is useful for a deliberate packing change.\n\nGate 1 runs `forge snapshot` and then `forge test`, in that order. It records the snapshot, green test result, Forge version, canonical Foundry config, Git revision, Solidity sources, storage layouts, method identifiers, and the rule corpus with its digest. A corpus that fails its own schema ends the run here, so a candidate is never judged under advice nobody checked. A dirty tree, red suite, missing snapshot, failed inspect, or invalid JSON ends the run.\n\n## Gate 2: name a rule and make one class of change\n\nEvery `verify` names one corpus rule with `--rule`. The rule decides the class, so a declared\n`--optimisation-class` that disagrees with it is refused. Gate 2 refuses before Gate 3\nspends a Forge run, and `result.json` carries a `refusal` field naming which condition failed:\n\n- `corpus\u002Funknown-rule`: no rule of that id\n- `corpus\u002Fmyth-selected`: a rejected universal rule named as a candidate, answered with its correction\n- `corpus\u002Fmyth-cited`: a rationale or obligation answer citing a rejected rule as its justification\n- `corpus\u002Frule-names-no-class`: a rule that constrains the run or is architecture, so no candidate implements it\n- `corpus\u002Fclass-disagreement`: the declared class is not the rule's class\n- `corpus\u002Fout-of-scope`: the target's compiler, fork or pipeline is outside the rule's declared scope\n- `corpus\u002Fscope-unresolved`: the target pins no readable `solc`, or names a fork the corpus does not order\n- `corpus\u002Fobligation-unanswered`: an obligation the rule's own statement makes has no substantive answer\n- `corpus\u002Fobligation-malformed`: an `--obligation` argument is not `\u003Cn>=\u003Canswer>`, or names an index the rule lacks\n- `corpus\u002Fdigest-moved`: the corpus changed after the baseline sealed it\n- `corpus\u002Finvalid`: the corpus does not pass its own schema\n\nAnswer each of the rule's obligations with `--obligation \"\u003Cn>=\u003Canswer>\"`, one per obligation, indexed\nfrom one. Those answers are recorded judgement rather than measurement, and `result.json` marks them\nas such. The six gates below do not move because of them.\n\nThen choose that rule's class and make only that kind of source change. Do not mix cleanup, compiler settings, test edits, or a second gas idea into the candidate.\n\nReview `candidate.solidity.diff` before attesting. The harness rejects Solidity file additions or removals, test-source edits, an empty candidate, added `unchecked` outside `unchecked-arithmetic`, and added assembly outside `assembly`. The attestation remains a judgement: read the diff and confirm that every hunk belongs to the declared class.\n\nIf the required property test is absent, add it in a preparatory change, get green, and take a fresh baseline. The optimisation candidate uses the existing fuzz suite rather than changing its own oracle.\n\n## Gates 3 to 6: verify the candidate\n\nFor an ordinary candidate:\n\n```bash\npython3 \"$HERMES_PY\" verify \\\n  --run-dir \"\u003Crun-dir>\" \\\n  --rule STO-09 \\\n  --obligation \"1=The cache is loaded after the last write and every use sits inside one call frame.\" \\\n  --optimisation-class storage-load-caching \\\n  --attest-single-class \\\n  --gas-target 'LedgerTest:test_update' \\\n  --gas-target 'LedgerTest:test_batch' \\\n  --no-sensitive-unchecked\n```\n\nFor unchecked arithmetic outside state-sensitive code, add a real explanation:\n\n```bash\n  --no-sensitive-unchecked \\\n  --non-sensitive-rationale \"The loop counter is bounded by the in-memory array length and cannot affect persistent state, asset balances, external call parameters, or rounding.\"\n```\n\nFor unchecked arithmetic that can affect persistent state, asset accounting, external calls, permissions, or rounding, run the existing targeted differential or property test:\n\n```bash\npython3 \"$HERMES_PY\" verify \\\n  --run-dir \"\u003Crun-dir>\" \\\n  --rule CTL-05 \\\n  --obligation \"1=Every intermediate is bounded by the array length checked at the loop head.\" \\\n  --obligation \"2=The unchecked region is three lines and the bound is stated beside it.\" \\\n  --optimisation-class unchecked-arithmetic \\\n  --attest-single-class \\\n  --gas-target 'LedgerTest:test_update' \\\n  --sensitive-unchecked \\\n  --targeted-match-path 'test\u002FStateDifferential.t.sol' \\\n  --targeted-match-test 'testFuzz_diff_stateTransition' \\\n  --property-proof \"Compare the checked reference and candidate across the complete reachable input domain; assert equal state transitions and equal overflow reverts at the arithmetic boundaries.\"\n```\n\n### Gate 3: quantify the gas change\n\nRun `forge snapshot --diff \u003Cbaseline>` and capture a candidate snapshot. Reject a positive deterministic delta anywhere, a changed measurement set, a target with no match, or a target with no saving. Then run `forge test --gas-report`.\n\nHistorical Foundry snapshots also contain fuzz statistics whose sampled inputs can change when the compiled bytecode changes. Hermes records their baseline and candidate means and medians, but does not call those aggregates a gas regression or saving. It still rejects a changed fuzz-test set or run count. Foundry `invariant_callSummary()` rows are stricter: their test set, run count, call count, and revert count must stay identical.\n\n### Gate 4: prove behaviour is unchanged\n\nRun the full `forge test` suite with the pinned seed, followed by a full unpinned run. Any failure rejects the candidate.\n\n### Gate 5: preserve layouts and selectors\n\nRe-run `forge inspect \u003CC> storageLayout --json --force` and `methodIdentifiers` for every recorded contract. The layout comparison canonicalises solc's compilation-local AST IDs, while retaining raw inspector output in evidence; it hard-aborts on any structural protected-layout difference or method-selector difference. A declared layout change is allowed only for an unprotected contract under the rules below.\n\n### Gate 6: prove state-sensitive unchecked arithmetic\n\nWhen `--sensitive-unchecked` applies, run the named targeted differential or property test and record its oracle. Otherwise, record why the candidate does not introduce or rely on state-sensitive unchecked arithmetic.\n\n## Deliberate layout change outside the frozen set\n\nOnly `storage-packing` and `constants-immutables` may declare one. The contract must have been listed with `--layout-contract`, never `--protected-contract`.\n\n```bash\n  --allow-unprotected-layout-change \\\n  --layout-change-rationale \"No proxy, hook, role provider, delegate call, deployed factory instance, storage-reading test, or indexer consumes this layout.\"\n```\n\nHermes records the diff. It rejects an undeclared difference, a declared difference that never occurred, or any difference on the frozen set.\n\n## State-sensitive arithmetic property standard\n\nBefore accepting the Gate 6 result, inspect the named test and confirm all of the following:\n\n- Exercise the changed unchecked operation rather than a neighbouring helper.\n- Compare against the original checked implementation or enforce an equivalent property oracle.\n- Preserve checked overflow and underflow behaviour; a wrapped result cannot stand in for a reference revert.\n- Cover applicable `0`, `1`, maxima, time deltas, input bounds, balance bounds, rounding boundaries, plus the exact safe and unsafe arithmetic edges.\n- Avoid a `bound()` or assumption that removes the dangerous region.\n- Keep the existing fuzz or invariant configuration from the named test path, such as `test\u002FFuzz.t.sol`, with the baseline seed recorded in the command.\n\nA comment explaining why arithmetic looks safe is useful review context. It is not Gate 6 evidence.\n\n## Accept, reject, repeat\n\nExit `0` plus `result.json` status `accepted` is the acceptance signal. Exit codes identify the rejected gate: `10`, `20`, `30`, `40`, `50`, or `60`. `result.json`, the command logs, gas comparison, source diff, layouts, and method maps stay together in the run directory.\n\nStop after any rejection. Do not tweak tolerances, alter the target set after seeing the result, weaken a test, or add another optimisation to cover the loss. Remove only the candidate changes, return to the last green state, and begin again at Gate 1.\n\nAfter acceptance, promote the candidate snapshot deliberately:\n\n```bash\npython3 \"$HERMES_PY\" promote --run-dir \"\u003Crun-dir>\"\n```\n\nThat accepted state becomes the baseline for the next class. Never run two classes through one Hermes record.\n\n## Refuse shortcuts\n\n- If `forge` is unavailable, report that no gas result can be measured.\n- If the baseline is red or dirty, fix that in separate work.\n- If someone asks to skip the layout diff, keep the gate.\n- If someone asks to bundle changes, run them in sequence.\n- If the gas saving cannot be quantified, reject it.\n- If a state-sensitive unchecked change lacks the targeted proof, reject it whatever the gas number says.\n- If the candidate implements no corpus rule, add the rule to the corpus in separate work first. There is no flag that skips the requirement.\n\n## Promise Machine contract\n\n### hermes-sealed-baseline\n\n- Promise: A successful `baseline` seals a green, clean Foundry baseline with the named gas measurements, configuration, seed, source revision, protected layouts, method identifiers and the validated rule corpus with its digest.\n- Evidence: The run directory, baseline snapshot, full test log, Foundry version, canonical configuration, Git and source records, storage layouts and method maps.\n- Evidence classes: checked, measured, recorded\n- Boundary: The baseline describes one repository state and environment; it does not establish that a later candidate preserves behaviour or improves gas.\n- Authorises: Evaluation of one declared optimisation class against the sealed baseline and fixed measurement set.\n- Consequence: 1\n- Refuses: Beginning a candidate comparison from a dirty tree, red suite, missing snapshot, unresolved protected set, changed exclusions or a corpus that fails its own schema.\n- Recovery: Restore a clean green repository, re-derive the protected and measured sets and take a fresh baseline.\n- Exceptions: none\n\n### hermes-corpus-selection\n\n- Promise: A successful Gate 2 corpus selection establishes that the named rule exists in the corpus the baseline sealed, that it names the declared optimisation class, that the target's pinned compiler, fork and pipeline fall inside the rule's declared scope, and that every obligation the rule's own statement makes carries a recorded answer.\n- Evidence: The sealed corpus digest, the corpus schema result, the selected rule with its grade and automation level, the resolved compiler, fork and pipeline read from the sealed Foundry configuration, the paired obligation answers and the `refusal` field on any rejection.\n- Evidence classes: checked, recorded\n- Boundary: Selection establishes that the candidate is in scope for reviewed advice and that its obligations were answered; it does not establish that the answers are correct, that the optimisation saves gas, or that behaviour is preserved. Obligation answers are recorded judgement rather than measurement and the six gates do not move because of them.\n- Authorises: Measurement of that one candidate against the sealed baseline under the named rule, with the rule id and corpus digest carried into the accepted record.\n- Consequence: 1\n- Refuses: An unknown rule, a rejected universal rule named as a candidate or cited as a justification, a rule that names no class, a declared class the rule does not name, a compiler, fork or pipeline outside the declared scope, a scope that cannot be resolved from the sealed configuration, an unanswered or malformed obligation, a corpus that moved after the baseline, and a corpus that fails its own schema.\n- Recovery: Select the rule the candidate actually implements, answer each of its obligations, pin the target's `solc_version` and `evm_version` where the scope cannot be resolved, or add the missing rule to the corpus in separate work before starting a new run.\n- Exceptions: none\n\n### hermes-candidate-acceptance\n\n- Promise: A successful `verify` with `result.json` status `accepted` establishes measured savings for every named target, no deterministic regression, passing pinned and unpinned behaviour suites, preserved protected layouts and selectors, and the required unchecked-arithmetic evidence for one declared class, under one named corpus rule whose scope the target satisfies.\n- Evidence: The sealed baseline, candidate Solidity diff, gas snapshot comparison, gas report, both full test runs, layout and selector comparisons, targeted property result when required, the corpus digest with the selected rule and its answered obligations, and accepted `result.json`.\n- Evidence classes: checked, measured, recomputed, recorded\n- Boundary: Acceptance covers one candidate, repository state, toolchain, measurement set and optimisation class; it is not a general security proof or permission to combine another change.\n- Authorises: Retaining and reviewing that exact gas candidate as a repository mutation with its complete evidence directory.\n- Consequence: 2\n- Refuses: Acceptance after any gate fails, a target lacks a saving, the measurement set moves, a protected interface changes, sensitive unchecked arithmetic lacks its named property evidence, or the candidate names no corpus rule.\n- Recovery: Remove only the rejected candidate, return to the sealed green state, correct prerequisite tests separately and start a new Hermes run.\n- Exceptions: none\n\n### hermes-baseline-promotion\n\n- Promise: A successful `promote` advances the Hermes baseline only to the exact candidate already accepted by the same run record.\n- Evidence: The accepted `result.json`, matching run directory, candidate snapshot and promotion command result.\n- Evidence classes: checked, recorded\n- Boundary: Promotion changes the local measurement baseline; it does not publish code, accept another optimisation class or validate unrecorded edits.\n- Authorises: Using the promoted accepted snapshot as the baseline for the next separately declared optimisation class.\n- Consequence: 2\n- Refuses: Promotion of a rejected, changed, missing or differently scoped candidate record.\n- Recovery: Restore the accepted run directory or take a fresh baseline from the intended repository state.\n- Exceptions: none\n",{"name":5,"metadata":24,"description":7},{"version":25},"0.1.1","main","6b6406ecd922c4127bc688e0b5122bbe395be0eb","plugins\u002Fhermes\u002Fskills\u002Fhermes",6,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills","https:\u002F\u002Fgithub.com\u002Fwildcat-finance","https:\u002F\u002Fwildcat.finance","Banking, But Worse","2026-11-07 17:14:07",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add wildcat-finance\u002Fskills --skill hermes",{"tool":41,"command":42},"bunx","bunx skills add wildcat-finance\u002Fskills --skill hermes",{"tool":44,"command":45},"pnpm","pnpm dlx skills add wildcat-finance\u002Fskills --skill hermes","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002FSKILL.md",true,[49,55,59,63,67,71,75,81],{"path":50,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":53,"sourceHtmlUrl":54},"agents\u002Fopenai.yaml","REFERENCE","参考文档",267,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002Fagents\u002Fopenai.yaml",{"path":56,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":57,"sourceHtmlUrl":58},"DEMONSTRATION.md",2290,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002FDEMONSTRATION.md",{"path":60,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":61,"sourceHtmlUrl":62},"EVOLUTION.md",2015,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002FEVOLUTION.md",{"path":64,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fgas-rule-corpus.json",177562,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002Freferences\u002Fgas-rule-corpus.json",{"path":68,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fgas-rule-corpus.schema.json",3779,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002Freferences\u002Fgas-rule-corpus.schema.json",{"path":72,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Foptimisation-catalogue.md",6176,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002Freferences\u002Foptimisation-catalogue.md",{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"scripts\u002Fhermes.py","SCRIPT","脚本",70012,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002Fscripts\u002Fhermes.py",{"path":82,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":83,"sourceHtmlUrl":84},"scripts\u002Ftest_hermes.py",51169,"https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fhermes\u002Fskills\u002Fhermes\u002Fscripts\u002Ftest_hermes.py",[86,93,99,106,112,118],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7APAWXHFSKVQEJBAHKASH25","example","A deliberately unsupported evidence class fixture.","https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fpromise-machine\u002Funsupported-evidence-class\u002Fplugins\u002Fexample\u002Fskills\u002Fexample\u002FSKILL.md",[],[],{"skillNo":94,"name":88,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7APATBK93107VF5NMPA3RJH","A router fixture target.","https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fpromise-machine\u002Funresolved-router\u002Fplugins\u002Fexample\u002Fskills\u002Fexample\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M7APARV9C0MQB8WTB0GGAAMG","promise-machine","A deliberately unresolved router.","https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fpromise-machine\u002Funresolved-router\u002F.agents\u002Fskills\u002Fpromise-machine\u002FSKILL.md",[],[],{"skillNo":107,"name":88,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":19},"01M7APAQMDG4977HXGSKMB29KV","A deliberately unclassified skill fixture.","https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fpromise-machine\u002Funclassified-skill\u002Fplugins\u002Fexample\u002Fskills\u002Fexample\u002FSKILL.md",[],[],{"skillNo":113,"name":88,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M7APAPE6DE05A24J4BYPK6WY","A deliberately unattributed exception fixture.","https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fpromise-machine\u002Funattributed-exception\u002Fplugins\u002Fexample\u002Fskills\u002Fexample\u002FSKILL.md",[],[],{"skillNo":119,"name":88,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":19},"01M7APAKYXRTABBSN7Q637CC6M","A deliberately conflated version fixture.","https:\u002F\u002Fgithub.com\u002Fwildcat-finance\u002Fskills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fpromise-machine\u002Fpackage-as-skill-version\u002Fplugins\u002Fexample\u002Fskills\u002Fexample\u002FSKILL.md",[],[]]