loop-contract

A skill that turns a loosely described, multi-step job into a structured plan and carries it out. It first checks whether an existing tool or skill already fits the job.

In plain words
What is it for?
Planning and executing extended tasks when no more specific capability is available.
Why use it?
It keeps long jobs tied to a clear objective, progress record, stopping conditions, and token budget.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/hdkhosravian/loop-contract-skill/loop-contract
Any agent
npx skills add hdkhosravian/loop-contract-skill --skill loop-contract
Clone the repo
git clone --depth 1 https://github.com/hdkhosravian/loop-contract-skill

Made for: Claude Code, Codex.

Per session 280 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,998 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00280 $0.08998
Opus 5 $0.00140 $0.04499
Sonnet 5 $0.00056 $0.01800
Haiku 4.5 $0.00028 $0.00900

Measured 2d ago against content hash 5ea424d095e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

loop-contract scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/extract_requirements.py, scripts/fold_ledger.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Subtle steeringmediumPrompt injection

Instructions that bias recommendations or shape behaviour without the user noticing.

**Never tell the user a job is complete without showing the gate's exit line.** Everything above is a

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat .claude/loops/INDEX.md 2>/dev/null || ls -d .claude/loops/*/ 2>/dev/null
skills/loop-contract/SKILL.md · 523 lines

How it starts

The opening of the file, as written. The whole thing — 523 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Loop Contract

What this skill produces

Given a raw need, this skill has two responses, one front-door. It first triages (step 0): when an existing skill/plugin/agent already fits, it routes — names that capability and offers to run it. Only when nothing fits does it design, and for a long autonomous job the design is a contract — which, for a DONE job, it then executes rather than handing back as a document. Routing lives in references/triage-routing.md; the rest of this document is the contract — the harder, higher-stakes response.

A contract is the spine of a run — the mission, oracle, phases and budget, written down before the work so the run is disciplined instead of improvised.

In both modes you write it and then execute it yourself (§5) — the document guides the work, it does not replace it. The one exception is an explicit request for a contract to run elsewhere. Either way it must be precise enough that an agent with no memory of this conversation can execute it correctly and stop at the right moment.

When the response is a KNOWN contract, never start doing the described job. If the request is "audit PR #128", you do not audit PR #128 while writing the contract — you write the contract that makes auditing it reliable. If you catch yourself opening the repo to "check something first", stop; you are doing the job instead of designing it.

The prohibition is temporal, not modal. It means: do not start the job while the contract is still unwritten. Once the file exists, execute it — in either mode (§5). Forgetting this is the other failure, and the more common one in practice:

  • routing may invoke a fitting capability, after the user confirms;
  • contract execution, KNOWN or DONE — you write the contract and then carry it out, until the named DELIVERABLE exists. Refusing to act there is not discipline, it is the "handed back a document" bug.

This rule binds the designer's hands, not the contract's voice. You abstain from the work; the contract you hand off must compel the executor to do it. For a DONE job (implement, fix, migrate, produce an artifact) the contract commands the executor to change the world and defines completion as that change existing and passing its oracle — never as a report describing it. What comes back from that session is the job's deliverable, not a description of it: working code for an implementation job, every issue fixed and verified for a remediation job, the finished artifact for a plan or design, a verdict + evidence only for an audit. The contract is the run's spec; it is never the run's output.

Read the full file on GitHub · 523 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 523 lines · 280 tokens per session scan C 5ea424d095e3

Subscribe to this mod's changes

loop-contract is a skill published in the GitHub repository hdkhosravian/loop-contract-skill (3 stars, last pushed 20d ago), licensed MIT. It adds 280 tokens to every session and 8,998 once invoked, about $0.0014 per session on Opus 5. A static security scan graded it C with 2 findings (subtle steering, reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

karpathy-guidelines

Behavioral guardrails for LLM-assisted coding. Use when writing, reviewing, or refactoring code in any project to avoid overcomplication, keep changes surgical, surface assumptions early, and execute against verifiable success criteria.

alirezarezvani/ClaudeForge · 50 tokens

claude-md-dependency-rescan

Re-detect this project's tech stack from package.json / requirements.txt / pyproject.toml / go.mod / Cargo.toml and diff it against the Tech Stack section of every CLAUDE.md. Read-only — returns added / removed / renamed dependencies, never edits.

alirezarezvani/ClaudeForge · 62 tokens

claude-md-drift-audit

Audit every CLAUDE.md in this project for drift against the last week of git history. Flags sections that reference deleted files, renamed paths, or removed dependencies. Read-only — returns a punch list, never edits.

alirezarezvani/ClaudeForge · 52 tokens

claude-md-link-check

Verify every @path chain import and every markdown link inside every CLAUDE.md in this project resolves to an existing file. Read-only — returns broken links with file:line refs, never edits.

alirezarezvani/ClaudeForge · 46 tokens

premortem

Лёгкий советник «раздвигающий шторки» — premortem-сессия которая находит дыры в плане с разных углов, предлагает варианты решений по каждой и помогает юзеру быстро принять осознанные решения. История запусков сохраняется в ./docs/premortem/. Use when user types «премортем», «premortem», «найди дыры в плане», «посмотри…

AndyShaman/premortem · 138 tokens

ai-engineering-workflow

Use this skill for complex coding, coursework, data analysis, notebook, research, or multi-file projects that need structured issue creation, context analysis, task breakdown, atomic execution, verification, status tracking, and final closure.

Jared13PG/ai-engineering-workflow · 50 tokens