agentleFS
nicolasaprnicolasapr/contract-tree/skills/check-drift/SKILL.md

check-drift

Skill1 starsChanged 4 months agoMITView on GitHub

Use when auditing whether a contract tree still matches the code — e.g. after a large merge or when a `CONTRACT.md` is suspected stale. Checks that entrypoints still exist, signatures match declared I/O, and declared upstreams match real imports; reports suspected-stale contracts and code modules missing a contract. Report-only, never auto-fixes.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. kunalsuri/ai-fication-kit★ 3same 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 repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    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:

    Read .contract-tree/tree.md, then for each CONTRACT.md:

    line 19

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

Check Drift

Audit a contract tree against the real code. Contracts that drift out of sync become lies the other flows trust — this skill finds them.

Hard rule: this skill is report-only. It lists suspected problems and suggests fixes. It does not edit contracts or code. Fixing is a separate, deliberate step (usually via change-with-contracts or map-modules).

The canonical format is ../map-modules/references/contract-format.md.

What to check

Read .contract-tree/tree.md, then for each CONTRACT.md:

  1. Entrypoints exist — every file:symbol in entrypoints resolves to a real file and a real exported symbol. A missing one is the strongest staleness signal (the boundary moved or was renamed).
  2. Signatures match declared I/O — the entrypoint's actual parameter and return types are consistent with io.input (precondition) / io.output (postcondition). Flag mismatches (e.g. contract says output alt in meters but the type/comment now says feet). A downstream module's declared consumption is effectively a consumer contract on this output; a mismatch that would violate what a downstream relies on is high severity — the provider silently stopped satisfying a consumer.
  3. Upstream matches real imports — the module's actual cross-module imports match its declared upstream. Flag both directions: a declared upstream that isn't imported anymore, and a real cross-module import that isn't declared.
  4. Invariants still plausible — where cheaply checkable, note invariants the code visibly contradicts. (Deep verification isn't expected; flag the obvious.)

Tree-level checks

  • Contract-less modules (tree holes) — directories that look like modules (cohesive code behind a public surface, imported by others) but have no CONTRACT.md. Report them as gaps to map.
  • Index vs contracts — tree.md edges that no longer match the contracts' inverted upstream. Since the index is regenerable, the fix is to regenerate; report the divergence.

Output

Produce a report grouped by severity:

  • Stale (high): entrypoint missing, or I/O clearly contradicted.
  • Suspect (medium): upstream/import mismatch, index/contract divergence.
  • Gaps: code modules without a contract.

For each item: the module id, what looks wrong, and the suggested corrective flow (change-with-contracts to fix a moved boundary, map-modules to fill a gap or regenerate the index). Do not apply the fixes — hand the report to the user.

Scope caveat

This audit sees only declared static dependencies. It cannot detect implicit coupling — shared formats, global state, a shared database, event ordering, duplicated constants — which drifts invisibly because no upstream edge records it. When a contract's I/O carries strong connascence (a unit/meaning, a wire format, a magic value), say so in the report: the real drift surface may be wider than the graph. See ../contract-tree/references/principles.md.

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.