agentleFS
christopherkaranichristopherkarani/rv/.claude/skills/swift-evaluate-parity/SKILL.md

swift-evaluate-parity

Skill8 starsChanged 6 days agoApache-2.0View on GitHub

Pinned 0.11.0 evaluate contract for rv. Use when changing RVEngine / RVDomain evaluate types, day-one pack JSON, CompiledPacks, normalize / quote-mask, quick-reject, walkers, corePacksUnavailable, or Tests/**/corpus/*. Not for hook or XPC Decision encoding (swift-hook-xpc). Also /swift-evaluate-parity.

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep evaluate pure. Clock, disk, and ProcessInfo stay out.

    line 40
  2. Distinctive:

    Add or update a corpus row that would fail if the change is wrong.

    line 42
  3. Very specific:

    Run tools/gate.sh (or the filters above) before claiming done.

    line 51
  4. Very specific:

    Do not restyle the signature to some.

    line 74
  5. Very specific:

    No boolean isDenied. Decision shape lives in Decision.swift.

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

swift-evaluate-parity

Internal. The T1 contract as a skill.

The scoreboard is docs/dev/PARITY.md + vendor/parity/PIN (same Decision + rule_id as the pinned 0.11.0 engine source). Marketing rows that disagree are quarantine, not the scoreboard. This file is not the scoreboard.

Spec: docs/factory/specs/phase-1-engine.md. PLAN wins conflicts. Landmines: references/landmines.md.

Load first

  1. docs/dev/PARITY.md and vendor/parity/PIN
  2. Sources/RVDomain/Decision.swift, Severity.swift, EvaluationResult.swift
  3. Sources/RVEngine/Evaluate.swift, Normalize.swift, QuickReject.swift, CompiledPacks.swift, PatternEngine.swift, ICUPatternEngine.swift
  4. Tests/RVEngineTests/Fixtures/corpus/ (deny.json, near-miss.json, quarantine.json, skill-table.json)
  5. docs/architecture/never-slip.md
  6. docs/architecture/residual-risk.md

Steps

  1. State the expected Decision + rule_id from the pin, not from a marketing table.
  2. Keep evaluate pure. Clock, disk, and ProcessInfo stay out.
  3. Preserve evaluation order. Do not “simplify” extracted regexes.
  4. Add or update a corpus row that would fail if the change is wrong.
  5. Prove on 6.3.3 (not /usr/bin/swift):

    tools/swift-6.3.3 --version   # expect Apple Swift version 6.3.3
    tools/gate.sh --quiet RVEngineTests RVCorpusTests
    tools/swift-6.3.3 test --filter packLoad
  6. Run tools/gate.sh (or the filters above) before claiming done.

Order (locked)

On the raw command, before normalize:

  • Empty / whitespace-only after trim → allow.
  • raw.utf8.count > 65_536 → indeterminate(.commandTooLarge), quickRejected == false.
  • Missing or empty core.git / core.filesystem snapshots → indeterminate(.corePacksUnavailable). Not a fake deny rule_id.

Then: normalize → quick-reject → per enabled pack, lex by PackID.rawValue safe then destructive (a safe hit skips that pack only) → default allow.

  • Budget exhausted → indeterminate(.budgetExhausted).
  • Critical / high match → deny + RuleMatch.
  • Medium / low match → allow + RuleMatch. Keep scanning for a blocker.
  • Unknown command (finished scan, no rule hit) → allow. That is not fail-closed on unknown. Missing core packs, oversize, and budget are indeterminate, not unknown. Hooks must not treat indeterminate as allow (swift-hook-xpc).
  • evaluate is generic over PatternEngine plus already-compiled packs. Do not restyle the signature to some. RVEngine does not import RVPacks. Packs are JSON data, not Swift files.

Severity.blocksByDefault is critical/high only (Sources/RVDomain/Severity.swift). No boolean isDenied. Decision shape lives in Decision.swift. Deny always carries RuleID + reason. RuleID.rawValue is pack:pattern (core.git:reset-hard). Display slash form is a T2 concern.

Multi-segment: split the matching view on top-level && || ; |. First deny / indeterminate wins. If every segment allows, evaluate the full string once.

PatternEngine

ICU first (NSRegularExpression). Compile at pack load, not in the hot loop. A compile miss quarantines that pattern name and its rows; the pack still loads. Never quarantine core.git:reset-hard or core.filesystem:fork-bomb.

Extract the 0.11.0 regex. Do not rewrite a walker to make a test green.

Corpus

FileRole
skill-table.jsonCommand rows from upstream skill tables. expected = pin Decision + rule_id. Never write a marketing Decision here.
deny.jsonExtra true-positives (wrappers, multi-segment, filesystem bypasses). Bare git reset --hard stays in skill-table.json. Do not empty this file down to that one command. Marketing “blocked” rows that the pin allows go to quarantine.json, never here.
near-miss.jsonMust allow on pack evaluate (see landmines). Shrinking this file is a fail. Those landmine ids are required; deleting a row to go green is a fail.
quarantine.jsonSKILL.md drift + ICU misses. Expected decision stays the pin.

RVCorpusTests runs each command row twice: pack evaluate (pin JSON expected) and evaluateWithSemantics (pack deny is the floor; RV-RR-02 quiet-work near-miss ids stay door allow; other pack allows may tighten only to builtin.action). Door-positive canaries (python -c os.system, bash -c $CMD, git push --force-with-lease origin feature) must fail if door is pack evaluate. Do not drop the pin run to “just use the door.” Do not rewrite JSON expected to a door tighten.

Day-one packs only: core.git + core.filesystem. T9 imports the rest default-off.

Preflight

Run tools/gate.sh --quiet RVEngineTests RVCorpusTests (and packLoad if needed). Gate runs tools/preflight.sh then filtered tests on 6.3.3. Then re-read the remaining list for semantic judgments.

  • Expected verdict matches PARITY.md, not a marketing row.
  • Raw gates still run before normalize; then per-pack lex safe → destructive.
  • Medium/low stays allow + match (git stash drop is the canary).
  • git stash drop is not a deny.json row. A marketing “blocked” line is quarantine.json with expected: allow.
  • Empty core packs / oversize / budget → indeterminate, not an invented deny.
  • No regex in the diff was “simplified.”
  • near-miss.json still contains the landmine rows.
  • reset-hard and fork-bomb are not in quarantine.json.
  • evaluate gained no I/O.
  • RVEngineTests + RVCorpusTests + packLoad green via tools/gate.sh / tools/swift-6.3.3.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.