loop-contract-from-docs

loop-contract-from-docs is a skill for Claude Code, Codex from FirenzeClaw/kimi-session-orchestrator. It costs 35 tokens per session (1,663 once invoked), scanned A, original, MIT.

A conversion process that creates a Loop Contract in YAML from existing project documents such as a specification, product requirements document, plan, task list, or design document. The contract defines how an automated work-and-check loop must run.

In plain words
What is it for?
Use it to turn existing project documentation into an execution contract, after checking that the required documents are available and the contract meets the project's quality rules.
Why use it?
It prevents the project manager from silently adding requirements or skipping verification steps when preparing work for a loop orchestrator. It also checks for safeguards such as multiple cycles, repeated passes, time limits, and allowed tools and paths.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

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/firenzeclaw/kimi-session-orchestrator/loop-contract-from-docs
Any agent
npx skills add FirenzeClaw/kimi-session-orchestrator --skill loop-contract-from-docs
Clone the repo
git clone --depth 1 https://github.com/FirenzeClaw/kimi-session-orchestrator

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for loop-contract-from-docs

README.md
[![agentmods](https://agentmods.dev/badge/skills/firenzeclaw/kimi-session-orchestrator/loop-contract-from-docs.svg)](https://agentmods.dev/skills/firenzeclaw/kimi-session-orchestrator/loop-contract-from-docs)
Your own site
<a href="https://agentmods.dev/skills/firenzeclaw/kimi-session-orchestrator/loop-contract-from-docs"><img src="https://agentmods.dev/badge/skills/firenzeclaw/kimi-session-orchestrator/loop-contract-from-docs.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,663 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.1 $0.00035 $0.01663
Opus 5 $0.00017 $0.00831
Sonnet 5 $0.00007 $0.00333
Haiku 4.5 $0.00003 $0.00166

Measured 5d ago against content hash 5f0f8afd6e26, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

loop-contract-from-docs scanned grade A with 0 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 5d ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/loop-contract-from-docs/SKILL.md · 128 lines

How it starts

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

Loop Contract From Docs

概述

从已存在的项目文档生成严格循环编排用的 loop-contract.yaml。文档是事实来源;PM 不补写需求、不降低循环深度、不跳过生成后审计。

触发

  • 用户调用 /loop-contract
  • PM 指定项目路径和文档集,要求从 SPEC/PRD/PLAN/TASK/设计文档生成 Loop Contract
  • cron、复盘或验收流程需要把已有文档转换为 loop-orchestrator 的执行契约

先决条件

条件 门控
已给出项目路径或当前工作目录可作为项目根 否则先定位项目根
至少一份 SPEC/PRD/PLAN/TASK/设计文档可读 否则停止并要求补充文档
需要输出 Contract,而不是直接执行 loop-orchestrator 否则切换到 loop-orchestrator

硬门

硬门 处理
输出前必须 Read guide-contract-qa.md 并逐项审计 不通过则拒绝输出,修正后重新生成
loop_config.min_cycles >= 2 发现为 1 或缺失时立即修正
loop_config.degradation_detection: true 缺失或 false 时立即修正
loop_config.verify.cross_model 必须不同于 PM session 当前模型 相同或未知时标记为需 PM 替换,不得伪造已验证
Contract 格式必须与 templates/loop-contract.yaml 保持一致 字段缺失时回到 Phase 4
operational_brakes 必须包含 no-progress、wall-time、context 阈值 缺失时回到 Phase 4
harness 必须声明 required_tools、allowed_paths、forbidden_paths、state_namespace、kill_switch 缺失时回到 Phase 4

循环保障说明

Contract 必须内建以下保障,防止 Loop 退化为浅层执行:

  • min_cycles >= 2:至少完成两轮执行/验证循环,不能一轮就交付。
  • consecutive_pass_required >= 2:修复后需要连续通过,不能单次 pass 即收尾。
  • degradation_detection: true:每轮检测范围缩减、验证跳过、AC 省略等降级倾向。
  • direction_baseline:每轮对照范围边界和不做事项,防止方向漂移。
  • verify.cross_model:使用不同于 PM session 模型的交叉验证,降低同模型自我确认风险。
  • operational_brakes:记录 no-progress、wall-time 和 context 阈值,触发后必须暂停处置。
  • harness:声明工具、允许/禁止路径、状态命名空间和 kill switch,防止执行边界只靠自然语言。

Phase 1 — 文档侦察

Read guide-doc-analysis.md

  1. 读取全部指定文档,记录文档类型和路径。
  2. SPEC 接口定义 ↔ PLAN 实现步骤 ↔ TASK 粒度 做交叉对照。
  3. 输出一致性报告:已覆盖、遗漏、矛盾点。

完成标准:已覆盖/遗漏/矛盾点三列均有结论;无文档时停止,不生成 Contract。

Phase 2 — 基准提取

  1. 提取 acceptance criteria,优先级为 SPEC AC章节 > PRD 验收条件 > PLAN 成功标准
  2. 提取方向约束:范围边界、不做事项、接口契约、兼容性要求。
  3. Read guide-complexity.md,按复杂度矩阵计算 level 和 factors。

完成标准:goal.acceptance_criteriagoal.direction_baselinecomplexity.levelcomplexity.factors 均可填入模板。

Phase 3 — 循环深度判定

guide-complexity.md 的映射写入循环参数:

complexity.level loop_config
low min_cycles: 2, consecutive_pass_required: 2, max_cycles: 4
medium min_cycles: 3, consecutive_pass_required: 2, max_cycles: 5
high min_cycles: 4, consecutive_pass_required: 3, max_cycles: 6

Read the full file on GitHub · 128 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 5d ago First seen · 128 lines · 35 tokens per session scan A 5f0f8afd6e26

Subscribe to this mod's changes

loop-contract-from-docs is a skill published in the GitHub repository FirenzeClaw/kimi-session-orchestrator (0 stars, last pushed 9d ago), licensed MIT. It adds 35 tokens to every session and 1,663 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. 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

workflow

Creates durable, resumable workflows using Vercel's Workflow SDK. Use when building workflows that need to survive restarts, pause for external events, retry on failure, or coordinate multi-step operations over time. Triggers on mentions of "workflow", "durable functions", "resumable", "workflow sdk", "queue"…

vercel/workflow · 84 tokens

migrating-workflow-v4-to-v5

Upgrades an app from Workflow SDK 4.x to 5.0. Use when bumping the workflow / @workflow/ dependencies to v5, or when hitting removed v4 APIs — runStep, stepEntrypoint, workflow/internal/private, @workflow/core/private, writeToStream / closeStream / readFromStream on a World, world.steps.get without a runId…

vercel/workflow · 161 tokens

migrating-world-v4-to-v5

Upgrades a custom Workflow SDK World implementation from the v4 spec to v5. Use when a package implements the World interface from @workflow/world and is moving to 5.x — event IDs that are ULIDs rather than slot positions, Event id is not slot-numbered at replay time, a specVersion the runtime refuses, writeToStream /…

vercel/workflow · 166 tokens

migrating-to-workflow-sdk

Migrates Temporal, Inngest, Trigger.dev, and AWS Step Functions workflows to the Workflow SDK. Use when porting Activities, Workers, Signals, step.run(), step.waitForEvent(), Trigger.dev tasks / wait.forToken / triggerAndWait, ASL JSON state machines, Task/Choice/Wait/Parallel states, task tokens, or child workflows.

vercel/workflow · 81 tokens

streamsql

当需要创建实时数据聚合/窗口统计、流式过滤转换、变化检测(CDC)、生命周期累计、元数据富化(流-表 JOIN)、CEP 模式识别(MATCHRECOGNIZE)等规则链时使用,或当使用 x/streamAggregator 和 x/streamTransform 组件时使用。包含 SQL 语法、窗口、分析函数、JOIN、CEP 和配置示例.

rulego/rulego · 90 tokens

workflow-init

Install and configure Vercel Workflow SDK before it exists in nodemodules. Use when the user asks to "install workflow", "set up workflow", "add durable workflows", "configure workflow sdk", or "init workflow" for Next.js, Express, Hono, Fastify, NestJS, Nitro, Nuxt, Astro, SvelteKit, or Vite.

vercel/workflow · 78 tokens