contract

A command for coordinating frontend and backend work through one shared interface agreement called CONTRACT.md.

In plain words
What is it for?
It is for defining or changing interfaces, coordinating work in one session or across separate terminals, and checking both sides against the agreed contract.
Why use it?
It gives separate parts of a multi-service project one source of truth, reducing disagreements about field names, types, and allowed values during integration.

Command

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 commands/seekers2001/docs-governance/contract
Clone the repo
git clone --depth 1 https://github.com/Seekers2001/docs-governance
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 699 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 $0.00053 $0.00699
Opus 5 $0.00026 $0.00349
Sonnet 5 $0.00011 $0.00140
Haiku 4.5 $0.00005 $0.00070

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

Security

Grade A, and why

contract 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 2d 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.

commands/contract.md · 30 lines

What it actually says

调用 contract-director 子 agent,以契约优先的方式协调当前项目的前后端开发。

用户参数:$ARGUMENTS(描述这次要做的功能,或要改的接口)

方法论以 contract-first skill 为准。执行规则:

  1. 先判模式,别默认派活。 开头先确认这次是哪种协作模式(不确定就问用户一句):

    • A 单会话多 agent:在本会话里由主任派出 frontend-dev / backend-dev 并行干活、统一对账。
    • B 多终端异步:前端、后端在各自终端独立跑,没有在线派活——主任只做"定/改契约 + 集成对账",各端通过 CONTRACT.md 文件异步协调,要改接口就提"契约变更请求"。 选 B 时跳过下面的"派活"
  2. 先定契约。 主任按"消费方(前端)需求先行"把本次涉及的接口写进/更新 CONTRACT.md(不存在就用 templates/CONTRACT.example.md 起一份)。逐字段写清类型、含义、坑点、错误码。

  3. (仅模式 A)派活。 把任务拆给 frontend-devbackend-dev,各自只读 CONTRACT.md 对应接口段照着开发:

    • 前端:照契约写界面 + 调接口,后端没好就按契约造 mock。需要契约外字段 → 提契约变更请求,不自己造。
    • 后端:照契约写实现,并写"返回必须符合契约"的校验测试。想改接口 → 提契约变更请求,不偷偷偏离。
    • 模式 B 跳过本步:各端在自己终端按上面同样的纪律开发,主任不派活。
  4. 集成对账。 主任逐字段核对:后端返回 vs 契约、前端用到的字段 vs 契约、字段名大小写/枚举值是否一致。对不上就指出哪边偏离、让其修正。

  5. 记账。 契约有变更 → 往 PROJECT_LOG.md 追加一条 contract 记录。

  6. 报告。 列出:定了/改了哪些接口、(模式 A)派了哪些活、对账结果、怎么验收。不要谎报"集成通过"除非真做了对账。

适用前提:项目确实分前端 + 后端(或多服务)两层以上。只有单层时退化用 /governance(docs-governor),别硬套主任机制。

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 · 30 lines · 53 tokens per session scan A ccb9529b88cd

Subscribe to this mod's changes

contract is a command published in the GitHub repository Seekers2001/docs-governance (10 stars, last pushed 19d ago), licensed MIT. It adds 53 tokens to every session and 699 once invoked, about $0.0003 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.