v2/docs/validation/verification-integration.md
The verification system provides real-time validation of agent work and task execution. It integrates with swarm commands, non-interactive mode, and the training system.
Before any task executes, the system checks:
After task completion, it verifies:
If verification fails and rollback is enabled:
# Enable verification for swarm execution
export VERIFICATION_MODE=strict
export VERIFICATION_ROLLBACK=true
# Run swarm with verification hooks
claude-flow swarm "Build REST API" --verify
# The swarm will:
# 1. Run pre-task verification
# 2. Execute the objective
# 3. Run post-task verification
# 4. Rollback if verification fails
# Non-interactive with verification
claude-flow swarm "Build feature" \
-p \
--output-format stream-json \
--verify \
--threshold 0.95
# Verification results appear in JSON output
# Pre-task check
node src/cli/simple-commands/verification-hooks.js pre task-123 coder
# Post-task check
node src/cli/simple-commands/verification-hooks.js post task-123 coder
# Feed to training
node src/cli/simple-commands/verification-hooks.js train task-123 coder
# Check status
node src/cli/simple-commands/verification-hooks.js status
Verification results automatically feed into the training system:
# View training data
cat .claude-flow/training/verification-data.jsonl
# Sample output:
{"taskId":"task-123","agentType":"coder","preScore":1,"postScore":0.75,"success":false,"timestamp":"2025-01-12T15:00:00Z"}
| Agent Type | Checks Performed | Threshold |
|---|---|---|
| coder | typecheck, tests, lint | 0.85 |
| researcher | output completeness | 0.85 |
| tester | coverage threshold | 0.85 |
| architect | documentation exists | 0.85 |
# Set verification mode (strict/moderate/development)
export VERIFICATION_MODE=strict
# Enable automatic rollback on failure
export VERIFICATION_ROLLBACK=true
# Custom threshold (0.0-1.0)
export VERIFICATION_THRESHOLD=0.95
# 1. Initialize verification
./claude-flow verify init strict
# 2. Run a coder task with verification
./claude-flow swarm "Implement user authentication" --verify
# Output:
š Pre-task verification: swarm-123 (coder)
ā
git-status: 1.00
ā
npm-deps: 1.00
ā
Pre-task verification passed (1.00)
[... task execution ...]
š Post-task verification: swarm-123 (coder)
ā
typecheck: 1.00
ā tests: 0.40
ā
lint: 0.80
ā Post-task verification failed (0.73 < 0.95)
š Attempting rollback...
ā
Rollback completed
Verification results are stored in .swarm/verification-memory.json:
{
"history": [
{
"taskId": "swarm-123",
"phase": "post",
"passed": false,
"score": 0.73,
"checks": [
{"name": "typecheck", "passed": true, "score": 1.0},
{"name": "tests", "passed": false, "score": 0.4},
{"name": "lint", "passed": true, "score": 0.8}
],
"agentType": "coder",
"timestamp": "2025-01-12T15:30:00Z"
}
],
"tasks": {
"swarm-123": {
"pre": {"passed": true, "score": 1.0},
"post": {"passed": false, "score": 0.73}
}
}
}
While not fully integrated, you can use verification today by:
--verify flag with swarm commands (when implemented)truth commandThe verification system provides the foundation for ensuring quality in AI-generated code, even if it's not yet fully automated.