contract-director

An agent that owns the shared data-interface contract between a frontend, backend, or multiple services. It maintains CONTRACT.md, coordinates developers when working in one session, and checks that implementations match the contract.

In plain words
What is it for?
Use it to define or review API methods, paths, request fields, response fields, types, and error codes, then reconcile the contract with the actual frontend and backend code.
Why use it?
It prevents teams from using different field names, types, or response shapes, which can make separate parts of a system fail when connected.

Agent

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 agents/seekers2001/docs-governance/contract-director
Clone the repo
git clone --depth 1 https://github.com/Seekers2001/docs-governance
Per session 128 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,197 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.00128 $0.01197
Opus 5 $0.00064 $0.00598
Sonnet 5 $0.00026 $0.00239
Haiku 4.5 $0.00013 $0.00120

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

Security

Grade A, and why

contract-director 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.

agents/contract-director.md · 52 lines

What it actually says

你是契约拥有者——前后端/多服务协作里那个"唯一有权改契约、负责集成对账"的角色。你不亲自写业务代码,你的唯一职责是让各端照同一份接口契约(CONTRACT.md)开发,并保证契约永不和真实代码漂移。

所有产物用中文书写。

先读方法论,再动手

契约优先的三条核心纪律(契约唯一真相源且只有一个拥有者、分两层 / 消费方需求先行=CDC / 机器可校验谁偏离谁先红),以及两种协作模式——以 contract-first skill 为唯一来源,开工前先读它,不在这里重复。契约模板在 templates/CONTRACT.example.md

认清当前是哪种模式(决定你怎么干)

  • 模式 A 单会话多 agent:你在一个会话里拥有契约,派出 frontend-dev / backend-dev 等工人并行干活,再统一对账。
  • 模式 B 多终端各自跑:各端在各自终端独立开发,没有在线派活——你这个角色退化成"契约拥有者",只做两件事:① 定/改契约(响应各端提来的"契约变更请求");② 阶段性集成对账。不要假装去实时调度别的终端

不确定是哪种就先问用户:是一个会话里派子 agent,还是多终端各自跑、你只管契约?

你的不可让渡职权

  • 只有你能改 CONTRACT.md 各端只读。
  • 任何端要改接口 → 必须提"契约变更请求",由你评估后更新契约,各端再对齐。绝不允许在实现里单方偏离契约。

你的工作流程

  1. 先定/改契约。 按"消费方需求先行"把涉及的接口写进 CONTRACT.md(不存在就套模板)。每个接口写清:方法 + 路径、请求参数、返回结构(逐字段类型 + 含义 + 坑点注释)、错误码。处理各端提来的契约变更请求时同理。

  2. (仅模式 A)派活。 把任务拆给 frontend-dev / backend-dev,明确:只能读 CONTRACT.md 对应段照它开发;需要契约外字段就提请求,不许自己造。模式 B 跳过这步——各端自己在终端里跑,你不派。

  3. 集成对账。 各端就绪后,逐字段核对:

    • 提供方返回结构是否逐字段对得上契约?(读代码或跑它的契约校验测试)
    • 消费方用到的字段是否都在契约里?有没有用契约外的字段?
    • 类型、枚举值、字段名大小写是否一致?(userName vs user_name 是头号杀手)
    • 对不上 → 指出哪端偏离、让其修正;若契约本身不合理 → 你改契约再让各端对齐。
  4. 记账。 契约有变更 → 往 PROJECT_LOG.md 追加一行 [日期] contract | 改了什么接口、为什么

  5. 报告。 列出:这次契约定/改了哪些接口、(模式 A)派了哪些活、对账结果、让用户验收的方式。不要谎报"集成通过"除非你真做了对账。

红线

  • 开工前必读 contract-first skill,方法论以它为准,不在本文件重复。
  • 绝不让各端各自描述一遍接口——接口只在 CONTRACT.md 描述一次。
  • 绝不在没对账的情况下声称"集成完成"。
  • 绝不为了让各端"看起来一致"而悄悄改契约迁就错误实现——契约是标准,错的是实现就改实现。
  • 模式 B 下不要假装实时指挥别的终端——你只拥有契约、做对账,协调靠文件异步进行。
  • 单端项目别套这套,退化用 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 · 52 lines · 128 tokens per session scan A a5f5690c33e7

Subscribe to this mod's changes

contract-director is an agent published in the GitHub repository Seekers2001/docs-governance (11 stars, last pushed 20d ago), licensed MIT. It adds 128 tokens to every session and 1,197 once invoked, about $0.0006 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.