Zing 论坛

正文

Forma:为AI编码代理生成结构化任务契约的开源框架

Forma是一个开源项目,通过将团队工程实践转化为具体的任务契约,让AI编码代理在执行前声明如何遵循规则,并提供可验证的执行追踪。

AI代理代码生成工作流任务契约CodexClaude Code工程规范开源工具
发布时间 2026/06/08 23:45最近活动 2026/06/08 23:52预计阅读 7 分钟
Forma:为AI编码代理生成结构化任务契约的开源框架
1

章节 01

Forma: Open-source Framework for Structured Task Contracts for AI Coding Agents (导读)

Forma is an open-source project that transforms team engineering practices into concrete task contracts, enabling AI coding agents (like Codex, Claude Code) to declare compliance with rules before execution and provide verifiable execution traces. It introduces the Plan-First paradigm to address the pain point of AI agents not truly following team rules (lack of verifiability/traceability). Key benefits include improved traceability, constraint, reviewability, and team knowledge沉淀.

2

章节 02

Project Background & Motivation

With AI coding agents widely used in software development, a core issue arises: how to make AI not just "read" but "follow" team rules? Traditional documentation only gives vague promises (e.g., "I will follow rules") without verifiability or traceability. Forma was created to solve this by proposing the Plan-First workflow: converting team engineering principles into specific task contracts so AI agents explicitly state their work approach before execution and provide a reviewable evidence chain during execution.

3

章节 03

Core Concepts & Architecture

Task Contract: Transforms abstract team rules into concrete commitments for specific tasks, answering key questions like evidence basis, modification boundaries, verification steps, evidence records, and stop conditions. Three-layer Architecture: 1. Profile (YAML file storing team engineering principles like coding standards, review processes); 2. Harness (toolkit generated from Profile, including skills like forma-plan, forma-ground, forma-lock, forma-execute, forma-showhand);3. Task Contract (per-task commitment stored in plans/issue-/ directory with execution plan and verification requirements).

4

章节 04

Workflow Details

The workflow includes four steps: 1. Generate Toolkit: Use forma create-bundle to generate a skill package for AI agents (e.g., Codex) from the team's Profile, then verify with forma verify. 2. Plan Phase: Start with forma-plan to clarify task goals, scope, constraints without executing work.3. Evidence Collection & Lock: Use forma-ground to collect relevant evidence (code, docs, tests), then forma-lock to materialize the plan into plan.md and tasks.md (lock the contract).4. Execute & Verify: Use forma-execute to run tasks with verification and record evidence; use forma-showhand to continue multiple tasks within the locked plan until blocked or needing human input.

5

章节 05

Technical Advantages & Value

  1. Traceability: Breaks workflow into clear phases (plan, evidence, lock, execute, verify) with explicit inputs/outputs and records, reducing "black box" issues.2. Constraint: Profile-defined rules control AI's behavior (e.g.,禁止修改 core config files, mandatory review for DB changes).3. Reviewability: Materialized contracts (plan.md, tasks.md) enable pre-execution plan review and post-execution result verification.4. Knowledge Precipitation: Profile evolves with the project, helping new members understand team practices and AI agents adapt to latest rules.
6

章节 06

Current Status & Roadmap

Forma is in early stages. Limitation: It provides a control interface but can't guarantee AI agents follow the generated skills (depends on underlying models and host environment). Future directions: Simplify Plan-First workflow installation; lower Profile writing threshold; improve toolkit verification; add real process examples. Note: Forma uses Plan-First for its own development (dogfooding), with its source code Profile in profiles/forma-self/.

7

章节 07

Application Scenarios

Forma is suitable for:1. Large Team Collaboration: Unified Profile ensures consistent engineering standards across AI agents.2. Critical System Development: Boundary control and verification provide extra security for core code.3. Compliance Requirements: Evidence collection and records meet detailed development process documentation needs.4. Knowledge Transfer: Encoding senior engineers' experience into Profile helps new members get started quickly.

8

章节 08

Summary & Outlook

Forma represents a new AI-aided development paradigm: from "AI free play" to "AI working under clear constraints". This isn't limiting AI's capabilities but making them more reliable via contracts and verification. As AI coding agents become more prevalent, control frameworks like Forma will grow in importance—it's both a technical tool and an engineering mindset (balancing efficiency with quality/control). It's a recommended solution for tech leads looking to integrate AI coding agents into team workflows.