AI-native BDD/spec verification CLI that enforces structured quality gates for AI Agent task execution via Task Contract DSL.
agent-spec is a Rust-based AI-native BDD tool built around the principle of "contract-driven development" — humans define structured task contracts, AI Agents implement against them, and machines verify code compliance.
Specification Language: The project defines a Task Contract DSL composed of four core parts — Intent, Decisions, Boundaries, and Completion Criteria (BDD-based Given/When/Then scenarios). The DSL natively supports both English and Chinese, using .spec or .spec.md file formats.
Full Lifecycle: From init for template creation, lint for spec quality analysis (vague verbs, coverage gaps), verify for code validation, to lifecycle as a composite quality gate and guard for repository-level enforcement — covering the entire development workflow. explain generates Markdown PR review summaries, and stamp produces Git Trailers for traceability.
Change-Set Awareness: Verification supports change discovery across Git staged, worktree, and Jujutsu VCS. Path constraints are mechanically enforced, suitable for pre-commit and CI scenarios.
AI Verification Layer: A pluggable AiBackend architecture is provided, currently in skeleton state (stub/caller modes). Uncovered scenarios yield indeterminate results; real model integration is planned but not yet implemented.
AI Coding Tool Integration: Built-in Claude Code Skills (tool-first, authoring, estimate), Codex AGENTS.md, and Cursor .cursorrules configs enable direct collaboration with mainstream AI coding assistants. The project is self-bootstrapped, using its own specs to govern its own development.
Installation:
# One-click install (CLI + Claude Code Skills)
./install-skills.sh
# Or CLI only
cargo install agent-spec
Quick Start:
agent-spec init --level task --lang en --name "User Registration API"
agent-spec contract specs/my-task.spec
agent-spec plan specs/my-task.spec --code .
agent-spec lifecycle specs/my-task.spec --code . --format json
Current version 0.2.7, MIT licensed, maintained by ZhangHanDong.