agentleFS
sophonfinance-wqsophonfinance-wq/finance-automation-portfolio/.claude/skills/build-loop/SKILL.md

build-loop

Skill16 starsChanged 44 days agoMITView on GitHub

Add a self-healing loop to a new engine using the house methodology (sensor/authority/gate, fault demo, never-invents tests). Use when asked to build a loop for an engine that doesn't have one.

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. Aznatkoiny/plugin-forge★ 1same name
    2. Jaxsbr/sabs★ 0same name
    3. justEstif/pi-shelf★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository15 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Run the package suite AND the full portfolio (python -m pytest per package, like CI) before pushing.

    line 18

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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

How to Build a Loop (house methodology)

Reference implementations: surplus_engine/loop.py (human-gated), close_engine/loop.py (autonomous+quarantine), recon_engine/loop.py (materiality), brain_engine/loop.py (verbatim-or-refuse), triangulate/loop.py (arithmetic-vs-judgment).

Recipe

  1. Scout the engine first: find the SENSOR (an existing independent check that yields named breaks) and the AUTHORITY (a deterministic re-derivation from the seeded source of record). If no sensor exists (brain case), build one that compares stored state to source.
  2. Pick the gate policy from the domain's discipline — never copy another engine's. Ask: what is this system entitled to decide on its own? What must it refuse to touch (quarantine/halt/escalate)?
  3. Loop core: while breaks remain and turns < budget: pick the EARLIEST failing scope (period/category/account/meeting/cell), resync it to authority, book every field change as an Adjustment, re-run the sensor. Frozen dataclasses -> dataclasses.replace; mutable -> setattr.
  4. Demo faults: 3-5 realistic drift injectors, each with a root-cause story, targeting scopes chosen dynamically from the baseline (don't hardcode IDs). Include at least one fault the loop must REFUSE to fix.
  5. Deterministic journal (frozen dataclasses): faults, initial findings, turns (before/after counts, adjustments), quarantined/held items, verdict. render_markdown(journal) must be byte-stable.
  6. CLI: --demo, --budget, --out; verdict doubles as exit code (match the engine's existing convention — e.g. brain refusal=3).
  7. Tests (~10-12, mirror tests/test_loop.py files): drift trips the sensor; loop converges; NEVER-INVENTS (settled state equals clean authority run exactly); the refusal boundary holds; clean input = zero turns; budget exhaustion fails; exit codes; determinism (two runs render identical markdown); CLI smoke with tmp_path.
  8. README section: what/why, the five-stage loop line, verdict table with exit codes, --demo command + real output excerpt.
  9. Run the package suite AND the full portfolio (python -m pytest per package, like CI) before pushing.

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.