agentleFS
KohulanKohulan/orthonym-skills/skills/spy-site/SKILL.md

spy-site

Skill2 starsChanged 47 days agoMITView on GitHub

Proves that a code site named as the place to fix actually runs for the target inputs, by counting its calls with a spy validated on at least two known positives, before any edit lands there. Use when a fix names a function, method, or module as "the place to change", and when a plan, roadmap, audit doc, or review points at a central decision point. Triggers on "the fix goes in X", "X is where this is decided", and any code site inherited from a document rather than from a measurement. Not for judging whether a defect class is real (use check-target) or whether an input case is reachable (use enumerate-first).

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    3. Validate the spy against ≥2 known positives: Not one. A trivially simple input (e.g.

    line 41
  2. Distinctive:

    If the harness did not run, return to Step 2.

    line 50

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Spy the site before you code

A documented "central decision point" is often off the execution path until a spy says otherwise. In one project's history this was 5-for-5: every site named in a plan as the place to fix was called zero times for the outputs it was meant to fix:

SiteNamed inReality
should_skip_locant() (a formatting helper)a roadmap phase plan0 calls
_assemble_fragments()a hand-off doc0 calls
_build_output_string() + its sibling helpera task brief0 calls — the live join was a third inline copy
ranking/candidate_pool.py scoring cascadea code reviewhundreds of selections, pool size 1 every time, the tie-break function 0 calls

The cost of skipping this is a whole task spent editing code that never runs.

The procedure

1. Name the site and the target rows. A spy without a target row set proves nothing — "is it called at all" is a different question from "is it called for the molecules I am trying to fix".

2. Monkeypatch a counter. In a worker subprocess so the production import path is unchanged, and in a fresh process per target row (or with caches cleared), because a warm cache can answer a repeated input without reaching the site and record a false zero:

import yourpkg.ranking.candidate_pool as cp
calls = {'n': 0}
_orig = cp.CandidatePool.best
def spy(self, *a, **k):
    calls['n'] += 1
    return _orig(self, *a, **k)
cp.CandidatePool.best = spy

3. Validate the spy against ≥2 known positives. Not one. A trivially simple input (e.g. the smallest molecule your pipeline handles) can record zero calls to a helper meant to be universal, so a single positive can be silently wrong — you cannot tell "the site is off the path" from "my spy is broken" with one data point. If either positive records zero, the spy or that positive is wrong: fix it and return to Step 2. Believe no zero until both register.

4. Assert the counter is non-zero before believing any number derived from it. A probe calling a non-existent method "succeeds" by never running — verify your harness actually ran before trusting its zero. A -k selector matching no test exits 5 and looks like a pass. If the harness did not run, return to Step 2.

5. Run over the target rows and record the count.

Refusal conditions

Report REFUTED and stop editing that site if:

  • the site records 0 calls for the target rows — the fix cannot land there
  • the site is reached but the value it computes is discarded downstream (check what the caller does with the return, not just that the call happened)

On REFUTED, record the refutation in the task brief or your project's eval log, then locate the real site by measurement. A refutation ends work on that site, not the task.

Finding the real site after a refutation

The live code is often an inline copy rather than the named helper. Grep for the string pattern the output has, not for the function you expected to produce it. In one real case the live join was a third inline copy of a loop duplicated inside an unrelated formatting function.

Related

  • check-target — validates that the defect class is real, before you spy its site.
  • Your project's fix-methodology / engineering-log doc, if it has standing invariants for spy-before-code, verify-your-harness-ran, and never-size-a-defect-from-static-inspection.

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.