CONTRACT_TEMPLATE

CONTRACT_TEMPLATE is an agent for coding agents from ai-analyst-lab/ai-analyst. It costs 0 tokens per session (2,190 once invoked), scanned C, original, MIT.

A required metadata block for each analysis agent, written as YAML inside an invisible HTML comment. It describes the agent's inputs, outputs, dependencies, pipeline step, and knowledge files.

In plain words
What is it for?
Use it at the start of every agent Markdown file to declare its interface. Define input sources and types, output paths and formats, upstream agents, the pipeline step, and relevant knowledge context.
Why use it?
It lets the pipeline automatically understand how agents connect and what files they produce. This supports dependency resolution and execution planning without relying only on prose documentation.

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/ai-analyst-lab/ai-analyst/contract_template
Clone the repo
git clone --depth 1 https://github.com/ai-analyst-lab/ai-analyst

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 CONTRACT_TEMPLATE

README.md
[![agentmods](https://agentmods.dev/badge/agents/ai-analyst-lab/ai-analyst/contract_template.svg)](https://agentmods.dev/agents/ai-analyst-lab/ai-analyst/contract_template)
Your own site
<a href="https://agentmods.dev/agents/ai-analyst-lab/ai-analyst/contract_template"><img src="https://agentmods.dev/badge/agents/ai-analyst-lab/ai-analyst/contract_template.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,190 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00000 $0.02190
Opus 5 $0.00000 $0.01095
Sonnet 5 $0.00000 $0.00438
Haiku 4.5 $0.00000 $0.00219

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

Security

Grade C, and why

CONTRACT_TEMPLATE scanned grade C with 1 finding 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 4d 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.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- CONTRACT_START name: agent-name description: One-sentence description of what this agent does. inputs: - name: INPUT_NAME type: str | file | query_result source: user | system | agent:other-agent-name required: true
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

agents/CONTRACT_TEMPLATE.md · 205 lines

How it starts

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

CONTRACT Block Template (OR-1.5)

Purpose

Every agent .md file MUST begin with a CONTRACT block -- a YAML declaration inside an HTML comment that describes the agent's interface. The OR-3 DAG walker reads these contracts to build the execution graph.

The CONTRACT block is invisible to the agent at runtime (it is an HTML comment), but it is machine-readable for pipeline orchestration, dependency resolution, and documentation generation.

Format

<!-- CONTRACT_START
name: agent-name
description: One-sentence description of what this agent does.
inputs:
  - name: INPUT_NAME
    type: str | file | query_result
    source: user | system | agent:other-agent-name
    required: true | false
  - name: ANOTHER_INPUT
    type: file
    source: agent:upstream-agent
    required: true
outputs:
  - path: working/output_{{VARIABLE}}.md
    type: markdown | csv | json | image
  - path: outputs/final_{{DATE}}.md
    type: markdown
depends_on:
  - upstream-agent-name
pipeline_step: 5
knowledge_context:
  - .knowledge/datasets/{active}/schema.md
  - .knowledge/datasets/{active}/quirks.md
CONTRACT_END -->

Live Examples

Minimal contract (no dependencies)

From agents/question-framing.md:

<!-- CONTRACT_START
name: question-framing
description: Generate prioritized analytical questions from a business problem, producing a structured question brief with hypotheses and data requirements.
inputs:
  - name: BUSINESS_CONTEXT
    type: str
    source: user
    required: true
  - name: PRODUCT_DESCRIPTION
    type: str
    source: user
    required: true
  - name: AVAILABLE_DATA
    type: str
    source: user
    required: true
outputs:
  - path: outputs/question_brief_{{DATE}}.md
    type: markdown
depends_on: []
knowledge_context: []
pipeline_step: 1
CONTRACT_END -->

Contract with upstream dependency and knowledge context

From agents/data-explorer.md:

<!-- CONTRACT_START
name: data-explorer
description: Discover what data exists in a source, profile its quality and completeness, identify tracking gaps, and recommend supported analyses.
inputs:
  - name: DATA_SOURCE
    type: str
    source: user
    required: true
  - name: ANALYSIS_GOALS
    type: str
    source: user
    required: false
outputs:
  - path: outputs/data_inventory_{{DATE}}.md
    type: markdown
  - path: working/data_inventory_raw.md
    type: markdown
depends_on: []
knowledge_context:
  - .knowledge/datasets/{active}/schema.md
  - .knowledge/datasets/{active}/quirks.md
pipeline_step: 4
CONTRACT_END -->

Read the full file on GitHub · 205 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. 4d ago First seen · 205 lines · 0 tokens per session scan C 36c5d7099708

Subscribe to this mod's changes

CONTRACT_TEMPLATE is an agent published in the GitHub repository ai-analyst-lab/ai-analyst (297 stars, last pushed 7d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,190 tokens. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.