Orchestrata Ultimate / Specs / 035-verification
035-verification: Verification Agent (U:Vfy)
The Verification Agent (U:Vfy) is a Prolog-guided constraint verification system. It validates whether agent solutions satisfy requirements through a multi-tier architecture involving Execution Agents, Supervisor Agents, and the Verification Agent, with Prolog serving as the immutable source of truth.
At a glance
| Item | Value |
|---|---|
| Spec directory | specs/035-verification/ |
| Status line in the spec | Complete |
| Requirement IDs defined | 230 |
With a @traces citation in src/ |
188 (81.7%) |
With a @traces citation in tests/ |
8 (3.5%) |
| Tracked files | 10 |
| RTM page | 035-verification |
Reading this spec
The Verification Agent (U:Vfy) is a Prolog-guided constraint verification system. It validates whether agent solutions satisfy requirements through three tiers: Execution Agents implement and iterate, Supervisor Agents generate proofs and audit, and the Verification Agent validates reasoning and edge cases. Prolog is the final arbiter, returning SATISFIED or NOT_MET.
The scope is eleven user stories: requirements capture, execution agent implementation, supervisor oversight, verification agent validation, Prolog verification, the verification loop and security and safety constraints (critical), failure handling and escalation, integration with the Intent Broker and performance constraints (high), and session state management (medium). Requirement IDs use the REQ-035- prefix.
The spec states seven key principles. Prolog is the source of truth and its decisions cannot be overridden. Constraints are immutable: the agent adapts its solution to the constraints, not the reverse. Verification follows a TDD approach, beginning with failing tests and iterating until satisfied. The retry limit is immutable: after 5 failed attempts the case goes to human review. U:Vfy runs concurrently with the Execution Agent. A mathematical proof is required when a constraint is claimed unsatisfiable. The hierarchy is Execution, then Supervisor, then U:Vfy.
In the code, the largest tracers are orchestrata_ultimate/verification/types, orchestrata_ultimate/orchestrator/verification_gate, orchestrata_ultimate/verification/session/verification_session, orchestrata_ultimate/verification/requirements/requirements_parser and orchestrata_ultimate/verification/proofs/verifier. The per-requirement view is on the RTM page.
The spec's status line reads Complete. It tracks 10 files and defines 230 requirement IDs. The full text follows below.
Measured coverage is 188 of 230 requirements cited by at least one @traces in src/ (81.7%), spread over 33 modules; the module citing the most of them is orchestrata_ultimate/orchestrator/verification_gate (25 requirements). In tests/, 8 requirements are cited by a test-side @traces.
Coverage gaps: 42 requirements have no citing symbol. The largest untraced groups are REQ-035-US-011 (15), REQ-035-US-010 (14), REQ-035-US-003 (4). Untraced means no @traces names the ID; the behaviour may still exist in code that was never annotated. Test-side citations are thinner than code-side ones (8 against 188).
Requirements
Checkbox is the state recorded in the requirements checklist; Traced by is the count of src/ symbols whose @traces names the ID.
| ID | Done | Requirement | Traced by |
|---|---|---|---|
REQ-035-US-001-001 |
yes | Parse simple requirement statements ("create a file named test.py") | 14 |
REQ-035-US-001-002 |
yes | Parse compound requirements ("read config.yaml and update database") | 1 |
REQ-035-US-001-003 |
yes | Extract action verbs (create, read, update, delete, execute) | 1 |
REQ-035-US-001-004 |
yes | Extract target nouns (file, database, api, system) | 1 |
REQ-035-US-001-005 |
yes | Identify constraints (permissions, limits, conditions) | 2 |
REQ-035-US-001-006 |
yes | Handle ambiguous requirements with clarification questions | 1 |
REQ-035-US-001-007 |
yes | Support multi-language input (English primary) | none |
REQ-035-US-001-008 |
yes | Generate valid Prolog predicates from requirements | 2 |
REQ-035-US-001-009 |
yes | Validate generated Prolog syntax | 2 |
REQ-035-US-001-010 |
yes | Store constraints for session persistence | 7 |
REQ-035-US-001-011 |
yes | Create RequirementsParser class |
1 |
REQ-035-US-001-012 |
yes | Implement NLP parsing for requirements | 1 |
REQ-035-US-001-013 |
yes | Create action verb dictionary (CREATE, READ, UPDATE, DELETE, EXECUTE, VALIDATE) | 1 |
REQ-035-US-001-014 |
yes | Create target noun dictionary (FILE, DATABASE, API, SYSTEM, SERVICE) | 1 |
REQ-035-US-001-015 |
yes | Implement constraint extraction using pattern matching | 4 |
REQ-035-US-001-016 |
yes | Create Prolog predicate generator | 1 |
REQ-035-US-001-017 |
yes | Implement Prolog syntax validator | 2 |
REQ-035-US-001-018 |
yes | Create constraint storage backend (Redis) | 2 |
REQ-035-US-001-019 |
yes | Add requirement session management | none |
REQ-035-US-001-020 |
yes | Implement requirement versioning | none |
REQ-035-US-001-021 |
yes | Unit test: Parse "create file test.py" → constraint(file_exists, ['test.py']) | 1 |
REQ-035-US-001-022 |
yes | Unit test: Parse "API must respond in 200ms" → constraint(response_time_max, [200]) | 1 |
REQ-035-US-001-023 |
yes | Integration test: Parse complex requirement generates valid Prolog | 3 |
REQ-035-US-001-024 |
yes | Performance test: Parse 100 requirements in <500ms average | 1 |
REQ-035-US-002-001 |
yes | Define functional constraints (file exists, API responds) | 3 |
REQ-035-US-002-002 |
yes | Define quality constraints (test coverage, documentation) | 2 |
REQ-035-US-002-003 |
yes | Define performance constraints (response time, throughput) | 2 |
REQ-035-US-002-004 |
yes | Define security constraints (no vulnerabilities, authentication) | 2 |
REQ-035-US-002-005 |
yes | Support constraint priorities (required vs. optional) | 2 |
REQ-035-US-002-006 |
yes | Support constraint dependencies (A must satisfy before B) | 2 |
REQ-035-US-002-007 |
yes | Support constraint groups (AND/OR logic) | 1 |
REQ-035-US-002-008 |
yes | Validate constraint syntax before activation | 3 |
REQ-035-US-002-009 |
yes | Persist constraint definitions | 2 |
REQ-035-US-002-010 |
yes | Create constraint definition schema | 2 |
REQ-035-US-002-011 |
yes | Implement constraint parser (YAML/JSON → Prolog) | 2 |
REQ-035-US-002-012 |
yes | Create constraint priority system | 1 |
REQ-035-US-002-013 |
yes | Implement constraint dependency resolution | 2 |
REQ-035-US-002-014 |
yes | Create constraint validation rules | 3 |
REQ-035-US-002-015 |
yes | Implement constraint persistence | 2 |
REQ-035-US-002-016 |
yes | Add constraint versioning | none |
REQ-035-US-002-017 |
yes | Create constraint import/export | 6 |
REQ-035-US-002-018 |
yes | Unit test: Constraint with all fields validates | 1 |
REQ-035-US-002-019 |
yes | Unit test: Invalid constraint syntax rejected | 2 |
REQ-035-US-002-020 |
yes | Unit test: Priority ordering works correctly | 1 |
REQ-035-US-002-021 |
yes | Integration test: Constraint dependencies resolve correctly | 2 |
REQ-035-US-002-022 |
yes | Integration test: Constraint persistence works | 2 |
REQ-035-US-003-001 |
yes | Evaluate single constraint satisfaction | 11 |
REQ-035-US-003-002 |
yes | Evaluate all constraints (AND logic) | 2 |
REQ-035-US-003-003 |
yes | Evaluate constraint groups (OR logic) | none |
REQ-035-US-003-004 |
yes | Handle constraint dependencies correctly | 2 |
REQ-035-US-003-005 |
yes | Return specific failure reasons | 7 |
REQ-035-US-003-006 |
yes | Cache evaluation results | 1 |
REQ-035-US-003-007 |
yes | Support partial satisfaction | 2 |
REQ-035-US-003-008 |
yes | Handle constraint timeouts | none |
REQ-035-US-003-009 |
yes | Log evaluation results | 2 |
REQ-035-US-003-010 |
yes | Support evaluation replay | 1 |
REQ-035-US-003-011 |
yes | Create constraint evaluator | 2 |
REQ-035-US-003-012 |
yes | Implement evaluation result aggregation | 1 |
REQ-035-US-003-013 |
yes | Add result caching (Redis) | 2 |
REQ-035-US-003-014 |
yes | Create failure reason generator | 3 |
REQ-035-US-003-015 |
yes | Implement timeout handling | none |
REQ-035-US-003-016 |
yes | Add evaluation logging | 2 |
REQ-035-US-003-017 |
yes | Create evaluation replay mechanism | 1 |
REQ-035-US-003-018 |
yes | Unit test: Satisfied constraint returns SATISFIED | 1 |
REQ-035-US-003-019 |
yes | Unit test: Failed constraint returns NOT_MET with reason | 2 |
REQ-035-US-003-020 |
yes | Unit test: Multiple constraints aggregate correctly | 1 |
REQ-035-US-003-021 |
yes | Integration test: Evaluation with timeouts works | none |
REQ-035-US-003-022 |
yes | Integration test: Caching improves performance | 1 |
REQ-035-US-004-001 |
yes | Define 5 standard checkpoints (implementation, tests, integration, docs, final) | 3 |
REQ-035-US-004-002 |
yes | Verify at each checkpoint | 6 |
REQ-035-US-004-003 |
yes | Support custom checkpoint definitions | 2 |
REQ-035-US-004-004 |
yes | Track checkpoint progress | 4 |
REQ-035-US-004-005 |
yes | Allow checkpoint skipping (with approval) | 1 |
REQ-035-US-004-006 |
yes | Provide checkpoint-specific feedback | 4 |
REQ-035-US-004-007 |
yes | Support checkpoint rollback | 2 |
REQ-035-US-004-008 |
yes | Maintain checkpoint history | 2 |
REQ-035-US-004-009 |
yes | Allow concurrent verification at checkpoints | 3 |
REQ-035-US-004-010 |
yes | Create checkpoint definitions | 2 |
REQ-035-US-004-011 |
yes | Implement checkpoint verification logic | 4 |
REQ-035-US-004-012 |
yes | Create checkpoint progress tracker | 2 |
REQ-035-US-004-013 |
yes | Add checkpoint history storage | none |
REQ-035-US-004-014 |
yes | Implement concurrent verification | 2 |
REQ-035-US-004-015 |
yes | Create custom checkpoint API | 1 |
REQ-035-US-004-016 |
yes | Add checkpoint rollback support | 2 |
REQ-035-US-004-017 |
yes | Unit test: Checkpoint criteria evaluate correctly | 2 |
REQ-035-US-004-018 |
yes | Unit test: Checkpoint progress tracking works | 2 |
REQ-035-US-004-019 |
yes | Integration test: Full checkpoint sequence passes | 2 |
REQ-035-US-004-020 |
yes | Integration test: Concurrent verification works | 4 |
REQ-035-US-004-021 |
yes | Performance test: 5 checkpoints in <5 seconds | 3 |
REQ-035-US-005-001 |
yes | Support Claude Opus 4 for verification | 6 |
REQ-035-US-005-002 |
yes | Support Deepseek R1 for verification | 5 |
REQ-035-US-005-003 |
yes | Support Qwen Max for verification | 5 |
REQ-035-US-005-004 |
yes | Support Grok4 MiniMax for verification | 5 |
REQ-035-US-005-005 |
yes | Select appropriate model based on task | 6 |
REQ-035-US-005-006 |
yes | Handle model unavailability gracefully | 6 |
REQ-035-US-005-007 |
yes | Maintain verification consistency across models | 4 |
REQ-035-US-005-008 |
yes | Track model usage for metrics | 1 |
REQ-035-US-005-009 |
yes | Support model fallback chain | 6 |
REQ-035-US-005-010 |
yes | Create model abstraction layer | 2 |
REQ-035-US-005-011 |
yes | Implement Opus integration | 6 |
REQ-035-US-005-012 |
yes | Implement Deepseek R1 integration | 5 |
REQ-035-US-005-013 |
yes | Implement Qwen Max integration | 5 |
REQ-035-US-005-014 |
yes | Implement Grok4 MiniMax integration | 5 |
REQ-035-US-005-015 |
yes | Create model selection logic | 2 |
REQ-035-US-005-016 |
yes | Add fallback handling | 5 |
REQ-035-US-005-017 |
yes | Implement usage tracking | 1 |
REQ-035-US-005-018 |
yes | Create cost optimization | 1 |
REQ-035-US-005-019 |
yes | Unit test: Model abstraction works | 2 |
REQ-035-US-005-020 |
yes | Unit test: Fallback triggers correctly | 3 |
REQ-035-US-005-021 |
yes | Integration test: All models respond correctly | 8 |
REQ-035-US-005-022 |
yes | Integration test: Verification consistent across models | 3 |
REQ-035-US-005-023 |
yes | Performance test: Model response times acceptable | 4 |
REQ-035-US-006-001 |
yes | Identify common edge cases for task type | 3 |
REQ-035-US-006-002 |
yes | Verify edge cases are tested | 2 |
REQ-035-US-006-003 |
yes | Suggest edge cases to test | 1 |
REQ-035-US-006-004 |
yes | Detect untested edge cases | 1 |
REQ-035-US-006-005 |
yes | Categorize edge cases by severity | 3 |
REQ-035-US-006-006 |
yes | Track edge case coverage | 5 |
REQ-035-US-006-007 |
yes | Provide edge case examples | 3 |
REQ-035-US-006-008 |
yes | Support custom edge case definitions | 4 |
REQ-035-US-006-009 |
yes | Create edge case database | 2 |
REQ-035-US-006-010 |
yes | Implement edge case detection | 5 |
REQ-035-US-006-011 |
yes | Create edge case suggestion engine | none |
REQ-035-US-006-012 |
yes | Add edge case coverage tracking | 3 |
REQ-035-US-006-013 |
yes | Implement edge case severity scoring | 1 |
REQ-035-US-006-014 |
yes | Create edge case reporting | 7 |
REQ-035-US-006-015 |
yes | Unit test: Edge cases identified for task | none |
REQ-035-US-006-016 |
yes | Unit test: Edge case coverage calculated | 1 |
REQ-035-US-006-017 |
yes | Integration test: Edge case suggestions improve coverage | none |
REQ-035-US-006-018 |
yes | Integration test: Edge case tracking works | 1 |
REQ-035-US-007-001 |
yes | Accept exhaustive search proofs | 1 |
REQ-035-US-007-002 |
yes | Accept logical deduction proofs | 1 |
REQ-035-US-007-003 |
yes | Accept mathematical proofs | 1 |
REQ-035-US-007-004 |
yes | Accept practical explanations | 1 |
REQ-035-US-007-005 |
yes | Verify proof completeness | 1 |
REQ-035-US-007-006 |
yes | Verify proof soundness | 1 |
REQ-035-US-007-007 |
yes | Verify alternatives exhausted | 1 |
REQ-035-US-007-008 |
yes | Reject invalid proofs | 2 |
REQ-035-US-007-009 |
yes | Request additional proof if needed | 10 |
REQ-035-US-007-010 |
yes | Create proof type handlers | 1 |
REQ-035-US-007-011 |
yes | Implement exhaustive search verification | 1 |
REQ-035-US-007-012 |
yes | Implement logical deduction verification | 2 |
REQ-035-US-007-013 |
yes | Implement mathematical proof verification | 2 |
REQ-035-US-007-014 |
yes | Implement practical explanation verification | 2 |
REQ-035-US-007-015 |
yes | Create proof evaluation criteria | 1 |
REQ-035-US-007-016 |
yes | Add proof rejection handling | 2 |
REQ-035-US-007-017 |
yes | Implement proof appeal process | 4 |
REQ-035-US-007-018 |
yes | Unit test: Valid exhaustive proof accepted | 1 |
REQ-035-US-007-019 |
yes | Unit test: Invalid proof rejected | 1 |
REQ-035-US-007-020 |
yes | Integration test: Full proof workflow works | 5 |
REQ-035-US-007-021 |
yes | Integration test: Proof appeal process works | 2 |
REQ-035-US-008-001 |
yes | Track verification attempts | 3 |
REQ-035-US-008-002 |
yes | Enforce max attempts (5) | 3 |
REQ-035-US-008-003 |
yes | Provide feedback after each attempt | 4 |
REQ-035-US-008-004 |
yes | Support automatic retry | 4 |
REQ-035-US-008-005 |
yes | Support manual intervention | 6 |
REQ-035-US-008-006 |
yes | Escalate after max attempts | 4 |
REQ-035-US-008-007 |
yes | Track attempt history | 1 |
REQ-035-US-008-008 |
yes | Support attempt reset | 1 |
REQ-035-US-008-009 |
yes | Log all attempts | 2 |
REQ-035-US-008-010 |
yes | Create attempt tracking system | 1 |
REQ-035-US-008-011 |
yes | Implement max attempt enforcement | 2 |
REQ-035-US-008-012 |
yes | Create feedback generation | 3 |
REQ-035-US-008-013 |
yes | Add automatic retry support | 2 |
REQ-035-US-008-014 |
yes | Implement escalation handler | 2 |
REQ-035-US-008-015 |
yes | Create attempt history storage | none |
REQ-035-US-008-016 |
yes | Add attempt reset functionality | 1 |
REQ-035-US-008-017 |
yes | Implement attempt logging | 2 |
REQ-035-US-008-018 |
yes | Unit test: Max attempts enforced | 1 |
REQ-035-US-008-019 |
yes | Unit test: Feedback generated correctly | 2 |
REQ-035-US-008-020 |
yes | Integration test: Full retry loop works | 2 |
REQ-035-US-008-021 |
yes | Integration test: Escalation triggers correctly | 2 |
REQ-035-US-009-001 |
yes | Receive intents from Intent Broker | 5 |
REQ-035-US-009-002 |
yes | Extract constraints from intents | 5 |
REQ-035-US-009-003 |
yes | Generate verification requirements from intents | 4 |
REQ-035-US-009-004 |
yes | Return verification results to Intent Broker | 14 |
REQ-035-US-009-005 |
yes | Support intent lifecycle integration | 3 |
REQ-035-US-009-006 |
yes | Track verification history per intent | 2 |
REQ-035-US-009-007 |
yes | Support intent replay with verification | 2 |
REQ-035-US-009-008 |
yes | Coordinate with Prolog validation | 2 |
REQ-035-US-009-009 |
yes | Create Intent Broker integration API | 2 |
REQ-035-US-009-010 |
yes | Implement intent constraint extraction | 5 |
REQ-035-US-009-011 |
yes | Create result forwarding | 4 |
REQ-035-US-009-012 |
yes | Add lifecycle coordination | 2 |
REQ-035-US-009-013 |
yes | Implement history tracking | 2 |
REQ-035-US-009-014 |
yes | Create replay support | 2 |
REQ-035-US-009-015 |
yes | Unit test: Intent parsing works | 2 |
REQ-035-US-009-016 |
yes | Unit test: Constraint extraction works | 2 |
REQ-035-US-009-017 |
yes | Integration test: Full integration with Intent Broker | 1 |
REQ-035-US-009-018 |
yes | Integration test: Intent replay works | 2 |
REQ-035-US-010-001 |
yes | Detect hardcoded secrets | none |
REQ-035-US-010-002 |
yes | Detect SQL injection vulnerabilities | none |
REQ-035-US-010-003 |
yes | Detect XSS vulnerabilities | none |
REQ-035-US-010-004 |
yes | Verify authentication implementation | 2 |
REQ-035-US-010-005 |
yes | Verify authorization implementation | 2 |
REQ-035-US-010-006 |
yes | Check dependency vulnerabilities | none |
REQ-035-US-010-007 |
yes | Verify encryption usage | none |
REQ-035-US-010-008 |
yes | Check compliance requirements | 1 |
REQ-035-US-010-009 |
yes | Support custom security rules | 2 |
REQ-035-US-010-010 |
yes | Create security constraint library | 2 |
REQ-035-US-010-011 |
yes | Implement secret detection | none |
REQ-035-US-010-012 |
yes | Implement vulnerability scanning | none |
REQ-035-US-010-013 |
yes | Create authentication verifier | none |
REQ-035-US-010-014 |
yes | Create authorization verifier | none |
REQ-035-US-010-015 |
yes | Add dependency auditing | none |
REQ-035-US-010-016 |
yes | Implement compliance checking | none |
REQ-035-US-010-017 |
yes | Create custom rule support | 1 |
REQ-035-US-010-018 |
yes | Unit test: Secret detection works | none |
REQ-035-US-010-019 |
yes | Unit test: Vulnerability detection works | none |
REQ-035-US-010-020 |
yes | Integration test: Security scan completes | none |
REQ-035-US-010-021 |
yes | Integration test: Custom rules work | 1 |
REQ-035-US-011-001 |
yes | Measure response time | none |
REQ-035-US-011-002 |
yes | Measure throughput | none |
REQ-035-US-011-003 |
yes | Measure memory usage | none |
REQ-035-US-011-004 |
yes | Measure cold start time | none |
REQ-035-US-011-005 |
yes | Support benchmark execution | none |
REQ-035-US-011-006 |
yes | Support performance profiling | none |
REQ-035-US-011-007 |
yes | Handle performance variability | none |
REQ-035-US-011-008 |
yes | Support percentile requirements | none |
REQ-035-US-011-009 |
yes | Generate performance reports | 2 |
REQ-035-US-011-010 |
yes | Create performance constraint library | 2 |
REQ-035-US-011-011 |
yes | Implement benchmarking | none |
REQ-035-US-011-012 |
yes | Create profiling support | none |
REQ-035-US-011-013 |
yes | Add statistical analysis | none |
REQ-035-US-011-014 |
yes | Implement variability handling | none |
REQ-035-US-011-015 |
yes | Create report generation | 2 |
REQ-035-US-011-016 |
yes | Unit test: Response time measurement works | none |
REQ-035-US-011-017 |
yes | Unit test: Throughput measurement works | none |
REQ-035-US-011-018 |
yes | Integration test: Performance report generated | 2 |
REQ-035-US-011-019 |
yes | Performance test: Measurements accurate | none |
Code that traces this spec
Checklists
checklists/implementation.md
Verification System Implementation Checklist
Spec: 035-verification
Component: U:Vfy (Verification Agent)
Status: Implementation Phase
Overview
This checklist tracks implementation tasks for the Verification System. Tasks are organized by component and include dependencies and estimated effort.
Phase 1: Core Infrastructure (Days 1-5)
Task Group 1.1: Project Setup
- [x] Create project structure under
implementation/src/verification/ - [x] Create
__init__.pyfiles - [x] Set up
pyproject.tomlwith dependencies - [x] Configure pytest with asyncio support
- [ ] Set up pre-commit hooks
- [ ] Configure black formatting
- [ ] Configure mypy type checking
- [x] Create conftest.py with shared fixtures
Task Group 1.2: Core Data Models
- [x] Create
verification_models.pywith:- [x]
VerificationSessiondataclass - [x]
Constraintdataclass - [x]
Checkpointdataclass - [x]
VerificationResultdataclass - [x]
Proofdataclass - [x]
Feedbackdataclass
- [x]
Task Group 1.3: Session Management
- [x] Create
verification_session.py - [x] Implement session creation
- [x] Implement session state management
- [x] Implement session persistence (Redis)
- [ ] Implement session cleanup
- [ ] Add session metrics
Task Group 1.4: Configuration
- [x] Create
verification_config.py - [x] Define default configuration
- [ ] Support YAML config files
- [ ] Support environment variables
- [ ] Support command-line overrides
Phase 2: Requirements Capture (Days 6-10)
Task Group 2.1: Requirements Parser
- [x] Create
requirements_parser.py - [x] Implement natural language parsing
- [ ] Create action verb dictionary
- [ ] Create target noun dictionary
- [x] Implement constraint extraction patterns
- [ ] Add ambiguity detection
- [ ] Create clarification question generator
Task Group 2.2: Prolog Generator
- [x] Create
prolog_generator.py - [x] Implement predicate generation
- [x] Create constraint serializer
- [x] Implement Prolog syntax validation
- [ ] Add dependency resolution
- [ ] Create constraint versioning
Task Group 2.3: Constraint Definition
- [x] Create
constraint_definitions.py - [x] Define functional constraint templates
- [x] Define quality constraint templates
- [x] Define performance constraint templates
- [x] Define security constraint templates
- [x] Add custom constraint support
Phase 3: Prolog Integration (Days 11-15)
Task Group 3.1: Prolog Rules
- [x] Create
implementation/prolog/verification/directory - [x] Create
core_constraints.pl - [x] Create
quality_constraints.pl - [x] Create
performance_constraints.pl - [x] Create
security_constraints.pl - [x] Create
proof_verification.pl - [x] Create
checkpoint_rules.pl
Task Group 3.2: Prolog Bridge Integration
- [x] Extend existing PrologBridge
- [x] Add constraint loading methods
- [x] Add constraint evaluation methods
- [x] Add proof verification methods
- [ ] Implement caching for Prolog queries
- [ ] Add timeout handling
Task Group 3.3: Constraint Evaluation
- [x] Create
constraint_evaluator.py - [x] Implement single constraint evaluation
- [x] Implement batch evaluation
- [x] Add result aggregation
- [x] Create failure reason generator
- [ ] Implement caching layer
Phase 4: Checkpoint System (Days 16-20)
Task Group 4.1: Checkpoint Definitions
- [x] Create
checkpoints/definitions.py - [x] Define core_implementation checkpoint
- [x] Define unit_tests checkpoint
- [x] Define integration_tests checkpoint
- [x] Define documentation checkpoint
- [x] Define final_verification checkpoint
Task Group 4.2: Checkpoint Verification
- [x] Create
checkpoints/verifier.py - [x] Implement checkpoint criteria evaluation
- [x] Add partial success handling
- [x] Create checkpoint progress tracking
- [ ] Implement checkpoint history
Task Group 4.3: Concurrent Verification
- [x] Create
checkpoints/concurrent.py - [x] Implement async verification
- [x] Add model pooling
- [x] Implement result aggregation
- [ ] Add timeout handling
Phase 5: Verification Agent (Days 21-25)
Task Group 5.1: Model Abstraction
- [x] Create
models/__init__.py - [x] Create
base_model.pyabstract class - [x] Implement Opus model client
- [x] Implement Deepseek R1 model client
- [x] Implement Qwen Max model client
- [x] Implement Grok4 MiniMax model client
Task Group 5.2: Verification Logic
- [x] Create
verification_engine.py - [x] Implement edge case detection
- [ ] Add reasoning soundness checking
- [x] Create proof verification dispatcher
- [x] Implement feedback generation
- [x] Add confidence scoring
Task Group 5.3: Verification API
- [ ] Create
verification_api.py - [ ] Implement verification request handling
- [ ] Add result caching
- [ ] Implement rate limiting
- [ ] Create metrics endpoint
Phase 6: Agent Protocols (Days 26-30)
Task Group 6.1: CXP Integration
- [x] Create
protocols/verification_cxp.py - [x] Implement constraint definition messages
- [x] Implement verification request messages
- [x] Implement result messages
- [x] Implement escalation messages
Task Group 6.2: Agent Communication
- [x] Create
agents/execution_agent.py - [x] Create
agents/supervisor_agent.py - [x] Create
agents/verification_agent.py - [ ] Implement state machines
- [x] Implement retry logic
- [x] Add error handling
Task Group 6.3: Orchestration
- [x] Create
orchestration/coordinator.py - [x] Implement verification workflow
- [x] Add checkpoint coordination
- [x] Implement escalation handling
- [ ] Create monitoring integration
Phase 7: Edge Cases and Proofs (Days 31-35)
Task Group 7.1: Edge Case System
- [x] Create
edge_cases/database.py - [x] Implement edge case detection
- [x] Create suggestion engine
- [ ] Add coverage tracking
- [x] Implement severity scoring
Task Group 7.2: Proof Verification
- [x] Create
proofs/verifier.py - [x] Implement exhaustive search verifier
- [x] Implement logical deduction verifier
- [x] Implement mathematical proof verifier
- [x] Implement practical explanation verifier
- [ ] Add proof appeal handling
Task Group 7.3: Impossibility Handling
- [x] Create
impossibility_handler.py - [x] Implement proof request
- [x] Add proof evaluation
- [x] Create escalation workflow
- [ ] Implement human handoff
Phase 8: Integration (Days 36-40)
Task Group 8.1: Intent Broker Integration
- [x] Create
integrations/intent_broker.py - [x] Implement intent parsing
- [x] Add constraint extraction
- [ ] Create result forwarding
- [ ] Implement lifecycle integration
Task Group 8.2: Redis Integration
- [x] Create
integrations/redis_manager.py - [x] Implement session storage
- [ ] Add constraint caching
- [ ] Implement metrics storage
- [ ] Create pub/sub for events
Task Group 8.3: Testing Infrastructure
- [x] Create integration test fixtures
- [x] Set up test Prolog instance
- [x] Set up test Redis instance
- [ ] Create test data generators
- [ ] Implement test helpers
Phase 9: Documentation (Days 41-42)
Task Group 9.1: Code Documentation
- [x] Add docstrings to all public classes
- [x] Add docstrings to all public methods
- [ ] Create API documentation
- [ ] Add usage examples
- [ ] Create configuration guide
Task Group 9.2: User Documentation
- [ ] Create quick start guide
- [ ] Create configuration reference
- [ ] Create API reference
- [ ] Create troubleshooting guide
- [ ] Create architecture guide
Phase 10: Testing (Days 43-45)
Task Group 10.1: Unit Tests
- [x] Test data models (50 tests)
- [x] Test requirements parser (40 tests)
- [x] Test constraint evaluation (40 tests)
- [x] Test checkpoint system (40 tests)
- [x] Test verification agent (50 tests)
- [x] Test proof verification (30 tests)
- [x] Test agent protocols (30 tests)
Task Group 10.2: Integration Tests
- [x] Test Prolog integration (20 tests)
- [x] Test Redis integration (20 tests)
- [x] Test Intent Broker integration (20 tests)
- [x] Test full workflow (20 tests)
Task Group 10.3: Performance Tests
- [ ] Test constraint evaluation speed
- [ ] Test checkpoint verification speed
- [x] Test concurrent verification
- [ ] Test under load
Implementation Files Structure
implementation/src/verification/
├── __init__.py
├── config/
│ ├── __init__.py
│ └── verification_config.py
├── models/
│ ├── __init__.py
│ └── verification_models.py
├── session/
│ ├── __init__.py
│ └── verification_session.py
├── requirements/
│ ├── __init__.py
│ ├── requirements_parser.py
│ ├── prolog_generator.py
│ └── constraint_definitions.py
├── constraints/
│ ├── __init__.py
│ ├── evaluator.py
│ ├── definitions.py
│ └── templates/
├── checkpoints/
│ ├── __init__.py
│ ├── definitions.py
│ ├── verifier.py
│ └── concurrent.py
├── models/
│ ├── __init__.py
│ ├── base_model.py
│ ├── opus.py
│ ├── deepseek_r1.py
│ ├── qwen_max.py
│ └── grok4_minimax.py
├── verification/
│ ├── __init__.py
│ ├── engine.py
│ └── feedback.py
├── edge_cases/
│ ├── __init__.py
│ ├── database.py
│ └── detector.py
├── proofs/
│ ├── __init__.py
│ └── verifier.py
├── impossibility/
│ ├── __init__.py
│ └── handler.py
├── agents/
│ ├── __init__.py
│ ├── execution_agent.py
│ ├── supervisor_agent.py
│ └── verification_agent.py
├── protocols/
│ ├── __init__.py
│ └── verification_cxp.py
├── orchestration/
│ ├── __init__.py
│ └── coordinator.py
├── integrations/
│ ├── __init__.py
│ ├── intent_broker.py
│ └── redis_manager.py
└── main.py
implementation/prolog/verification/
├── __init__.py
├── core_constraints.pl
├── quality_constraints.pl
├── performance_constraints.pl
├── security_constraints.pl
├── proof_verification.pl
└── checkpoint_rules.pl
implementation/tests/verification/
├── unit/
│ ├── test_models.py
│ ├── test_requirements.py
│ ├── test_constraints.py
│ ├── test_checkpoints.py
│ ├── test_verification.py
│ ├── test_proofs.py
│ └── test_agents.py
├── integration/
│ ├── test_prolog_integration.py
│ ├── test_redis_integration.py
│ ├── test_intent_broker_integration.py
│ └── test_full_workflow.py
└── conftest.py
Dependency Graph
Phase 1 (Core Infrastructure)
│
├── Task Group 1.1: Project Setup
├── Task Group 1.2: Core Data Models
│ │
│ └── Required by: All other tasks
│
├── Task Group 1.3: Session Management
│ └── Requires: 1.2
│
└── Task Group 1.4: Configuration
└── Required by: All other tasks
Phase 2 (Requirements Capture) requires Phase 1
│
├── Task Group 2.1: Requirements Parser
├── Task Group 2.2: Prolog Generator
│ └── Requires: 2.1
│
└── Task Group 2.3: Constraint Definition
└── Requires: 2.2
Phase 3 (Prolog Integration) requires Phase 2
│
├── Task Group 3.1: Prolog Rules
├── Task Group 3.2: Prolog Bridge Integration
│ └── Requires: 3.1
│
└── Task Group 3.3: Constraint Evaluation
└── Requires: 3.2
Phase 4 (Checkpoint System) requires Phase 3
│
├── Task Group 4.1: Checkpoint Definitions
├── Task Group 4.2: Checkpoint Verification
│ └── Requires: 4.1
│
└── Task Group 4.3: Concurrent Verification
└── Requires: 4.2
Phase 5 (Verification Agent) can run in parallel with Phase 4
│
├── Task Group 5.1: Model Abstraction
├── Task Group 5.2: Verification Logic
│ └── Requires: 5.1
│
└── Task Group 5.3: Verification API
└── Requires: 5.2
Phase 6 (Agent Protocols) requires Phase 5
│
├── Task Group 6.1: CXP Integration
├── Task Group 6.2: Agent Communication
│ └── Requires: 6.1
│
└── Task Group 6.3: Orchestration
└── Requires: 6.2
Phase 7 (Edge Cases and Proofs) requires Phase 6
│
├── Task Group 7.1: Edge Case System
├── Task Group 7.2: Proof Verification
│ └── Requires: 5.1
│
└── Task Group 7.3: Impossibility Handling
└── Requires: 7.2
Phase 8 (Integration) requires Phase 7
│
├── Task Group 8.1: Intent Broker Integration
├── Task Group 8.2: Redis Integration
│ └── Requires: 1.3
│
└── Task Group 8.3: Testing Infrastructure
Phase 9 (Documentation) can run in parallel
Phase 10 (Testing) requires Phase 8
Effort Estimation
| Phase | Tasks | Estimated Days |
|---|---|---|
| Phase 1: Core Infrastructure | 4 groups | 5 days |
| Phase 2: Requirements Capture | 3 groups | 5 days |
| Phase 3: Prolog Integration | 3 groups | 5 days |
| Phase 4: Checkpoint System | 3 groups | 5 days |
| Phase 5: Verification Agent | 3 groups | 5 days |
| Phase 6: Agent Protocols | 3 groups | 5 days |
| Phase 7: Edge Cases and Proofs | 3 groups | 5 days |
| Phase 8: Integration | 3 groups | 5 days |
| Phase 9: Documentation | 2 groups | 2 days |
| Phase 10: Testing | 3 groups | 3 days |
| Total | 30 groups | 45 days |
Success Criteria
- [ ] All 10 phases completed
- [ ] 95% code coverage
- [ ] All tests passing
- [ ] Integration tests with Intent Broker pass
- [ ] Integration tests with Prolog pass
- [ ] Performance targets met (<5s for 5 checkpoints)
- [ ] Documentation complete
- [ ] No critical bugs
checklists/requirements.md
The requirement list above comes from this file; 230 of 230 checkbox items are ticked.
checklists/testing.md
Verification System Testing Checklist
Spec: 035-verification
Component: U:Vfy (Verification Agent)
Status: Testing Phase
Overview
This checklist defines comprehensive testing requirements for the Verification System. All tests follow the no-mocking policy and use real implementations where possible.
Total Test Cases: 200+
Unit Tests (100+ tests)
Requirements Parser Tests (20 tests)
File: tests/unit/test_requirements_parser.py
Basic Parsing Tests
- [x] Test parse simple requirement ("create file test.py")
- [x] Test parse compound requirement ("read config and update database")
- [x] Test extract action verb from requirement
- [x] Test extract target noun from requirement
- [x] Test extract parameter from requirement
Constraint Extraction Tests
- [x] Test extract file existence constraint
- [x] Test extract test coverage constraint
- [x] Test extract performance constraint
- [x] Test extract security constraint
- [x] Test extract multiple constraints
Prolog Generation Tests
- [x] Test generate valid Prolog predicate
- [x] Test generate constraint with arguments
- [x] Test generate priority value
- [x] Test generate constraint dependency
- [x] Test validate generated Prolog syntax
Ambiguity Handling Tests
- [x] Test detect ambiguous requirement
- [x] Test generate clarification questions
- [x] Test handle incomplete requirement
- [x] Test handle contradictory requirements
- [x] Test ask for missing information
Constraint Evaluation Tests (20 tests)
File: tests/unit/test_constraint_evaluation.py
Single Constraint Tests
- [x] Test satisfied file_exists constraint
- [x] Test not_met file_exists constraint
- [x] Test satisfied test_coverage constraint
- [x] Test not_met test_coverage constraint
- [x] Test satisfied response_time constraint
- [x] Test not_met response_time constraint
Multiple Constraint Tests
- [x] Test all constraints satisfied
- [x] Test some constraints not met
- [x] Test constraint with AND logic
- [x] Test constraint with OR logic
- [x] Test constraint dependency ordering
Result Generation Tests
- [x] Test failure reason generation
- [x] Test satisfaction summary generation
- [x] Test cache key generation
- [x] Test result serialization
- [x] Test result caching
Checkpoint Tests (20 tests)
File: tests/unit/test_checkpoints.py
Checkpoint Definition Tests
- [x] Test core_implementation criteria
- [x] Test unit_tests criteria
- [x] Test integration_tests criteria
- [x] Test documentation criteria
- [x] Test final_verification criteria
Checkpoint Progression Tests
- [x] Test checkpoint sequence ordering
- [x] Test checkpoint progress tracking
- [x] Test checkpoint skipping (with approval)
- [x] Test checkpoint rollback
- [x] Test checkpoint history
Partial Success Tests
- [x] Test partial satisfaction with warnings
- [x] Test can_proceed flag on partial
- [x] Test feedback generation on partial
- [x] Test retry guidance on partial
- [x] Test escalation on repeated partial
Verification Agent Tests (20 tests)
File: tests/unit/test_verification_agent.py
Model Integration Tests
- [x] Test model abstraction layer
- [x] Test Opus model call
- [x] Test Deepseek R1 model call
- [x] Test Qwen Max model call
- [x] Test Grok4 MiniMax model call
- [x] Test fallback on model unavailable
Edge Case Detection Tests
- [x] Test edge case identification
- [x] Test edge case coverage calculation
- [x] Test edge case severity scoring
- [x] Test edge case suggestions
- [x] Test edge case tracking
Reasoning Verification Tests
- [x] Test reasoning soundness check
- [x] Test assumption detection
- [x] Test alternative consideration check
- [x] Test logical consistency check
- [x] Test confidence scoring
Proof Verification Tests (20 tests)
File: tests/unit/test_proof_verification.py
Proof Type Tests
- [x] Test exhaustive search proof validation
- [x] Test logical deduction proof validation
- [x] Test mathematical proof validation
- [x] Test practical explanation validation
- [x] Test mixed proof types
Proof Quality Tests
- [x] Test proof completeness check
- [x] Test proof soundness check
- [x] Test alternatives exhaustion check
- [x] Test edge case coverage in proof
- [x] Test mathematical rigor
Proof Rejection Tests
- [x] Test invalid proof rejection
- [x] Test incomplete proof rejection
- [x] Test unsound proof rejection
- [x] Test proof appeal handling
- [x] Test appeal resolution
Integration Tests (60+ tests)
Prolog Integration Tests (20 tests)
File: tests/integration/test_prolog_verification.py
Constraint Evaluation Integration
- [x] Test constraint evaluation with real Prolog
- [x] Test multiple constraint evaluation
- [x] Test constraint with timeouts
- [x] Test Prolog rule hot-reload
- [x] Test Prolog error handling
Proof Verification Integration
- [x] Test proof verification with Prolog
- [x] Test mathematical proof evaluation
- [x] Test logical deduction evaluation
- [x] Test Prolog query optimization
- [x] Test Prolog caching
Redis Integration Tests (15 tests)
File: tests/integration/test_redis_verification.py
Session Management Integration
- [x] Test session creation in Redis
- [x] Test session state updates
- [x] Test session retrieval
- [x] Test session cleanup
- [x] Test session expiration
Caching Integration
- [x] Test constraint evaluation caching
- [x] Test verification result caching
- [x] Test cache invalidation
- [x] Test cache TTL
- [x] Test cache performance
Intent Broker Integration Tests (15 tests)
File: tests/integration/test_intent_broker_verification.py
Intent Processing Integration
- [x] Test intent constraint extraction
- [x] Test intent verification triggering
- [x] Test result forwarding to Intent Broker
- [x] Test lifecycle integration
- [x] Test history tracking
Replay Integration
- [x] Test intent replay with verification
- [x] Test replay constraint re-evaluation
- [x] Test replay caching
- [x] Test replay history
- [x] Test replay metrics
Full Workflow Tests (10 tests)
File: tests/integration/test_full_workflow.py
Complete Verification Workflow
- [x] Test requirements capture to verification complete
- [x] Test TDD workflow (tests fail first)
- [x] Test constraint satisfaction loop
- [x] Test max attempts escalation
- [x] Test proof submission and verification
- [x] Test checkpoint progression
- [x] Test concurrent verification
- [x] Test error recovery
- [x] Test performance under load
- [x] Test end-to-end success
Contract Tests (20 tests)
Message Format Tests (10 tests)
File: tests/contract/test_message_formats.py
CXP Message Tests
- [x] Test constraint definition message format
- [x] Test verification request message format
- [x] Test verification result message format
- [x] Test escalation message format
- [x] Test proof submission message format
Response Format Tests
- [x] Test satisfied response format
- [x] Test not_met response format
- [x] Test partial response format
- [x] Test feedback message format
- [x] Test error message format
Schema Validation Tests (10 tests)
File: tests/contract/test_schemas.py
Constraint Schema Tests
- [ ] Test functional constraint schema
- [ ] Test quality constraint schema
- [ ] Test performance constraint schema
- [ ] Test security constraint schema
- [ ] Test custom constraint schema
Result Schema Tests
- [ ] Test verification result schema
- [ ] Test proof verification schema
- [ ] Test feedback schema
- [ ] Test metrics schema
- [ ] Test history schema
Performance Tests (20 tests)
Latency Tests (10 tests)
File: tests/performance/test_verification_latency.py
Constraint Evaluation Latency
- [ ] Test single constraint <10ms p50
- [ ] Test single constraint <50ms p95
- [ ] Test batch constraints <100ms p50
- [ ] Test batch constraints <200ms p95
- [ ] Test Prolog query <50ms
Checkpoint Verification Latency
- [ ] Test checkpoint verification <500ms
- [ ] Test full checkpoint sequence <2s
- [ ] Test concurrent verification <1s
- [ ] Test model response <3s
- [ ] Test proof verification <2s
Throughput Tests (10 tests)
File: tests/performance/test_verification_throughput.py
Processing Throughput
- [ ] Test 100 constraints/sec
- [ ] Test 50 verifications/min
- [ ] Test 10 concurrent verifications
- [ ] Test throughput with caching
- [ ] Test throughput degradation threshold
Model Throughput
- [ ] Test Opus throughput
- [ ] Test Deepseek R1 throughput
- [ ] Test Qwen Max throughput
- [ ] Test Grok4 MiniMax throughput
- [ ] Test model fallback overhead
Security Tests (10 tests)
File: tests/security/test_verification_security.py
Input Validation Tests
- [ ] Test constraint injection prevention
- [ ] Test Prolog injection prevention
- [ ] Test message tampering detection
- [ ] Test unauthorized access prevention
- [ ] Test rate limiting enforcement
Proof Security Tests
- [ ] Test proof tampering detection
- [ ] Test proof forgery prevention
- [ ] Test fake proof detection
- [ ] Test verification manipulation prevention
- [ ] Test audit trail integrity
Edge Case Tests (20 tests)
File: tests/edge_cases/test_verification_edge_cases.py
Constraint Edge Cases
- [x] Test empty constraint list
- [x] Test constraint with null values
- [x] Test constraint with special characters
- [x] Test constraint with very long values
- [x] Test constraint with circular dependencies
Verification Edge Cases
- [ ] Test verification with no artifacts
- [ ] Test verification with corrupted artifacts
- [ ] Test verification with missing files
- [ ] Test verification timeout handling
- [ ] Test verification with network issues
Agent Edge Cases
- [ ] Test agent with max retries
- [ ] Test agent with conflicting constraints
- [ ] Test agent with impossible requirements
- [ ] Test agent with proof exhaustion
- [ ] Test agent with resource exhaustion
Test Infrastructure
Required Test Dependencies
- [x] pytest with asyncio plugin
- [x] Real Prolog instance (SWI-Prolog)
- [x] Real Redis instance
- [ ] Test data generators
- [x] Performance monitoring tools
- [ ] Security scanning tools
- [x] Coverage reporting tools
Test Fixtures
- [x]
prolog_instancefixture (session scope) - [x]
redis_instancefixture (session scope) - [x]
verification_brokerfixture (function scope) - [x]
sample_constraintsfixture - [x]
sample_workflowfixture - [x]
test_requesterfixture - [x]
test_configfixture
CI/CD Integration
- [x] All tests run in CI/CD pipeline
- [x] Tests run on every commit
- [x] Tests run on every PR
- [ ] Performance tests run nightly
- [x] Security tests run weekly
- [ ] Coverage reports published
- [x] Test results archived
- [x] Flaky tests quarantined
Test Summary
| Test Category | Test Count | Priority |
|---|---|---|
| Unit Tests | 100 | P0 |
| Integration Tests | 60 | P0 |
| Contract Tests | 20 | P1 |
| Performance Tests | 20 | P1 |
| Security Tests | 10 | P0 |
| Edge Case Tests | 20 | P1 |
Test Coverage Target: 95% line coverage, 90% branch coverage
Test Execution Time Target: <10 minutes for full suite
Test Stability Target: <1% flakiness rate
Running Tests
# Run all tests
uv run pytest tests/
# Run unit tests only
uv run pytest tests/unit/
# Run integration tests only
uv run pytest tests/integration/
# Run performance tests
uv run pytest tests/performance/ -v
# Run security tests
uv run pytest tests/security/ -v
# Run with coverage
uv run pytest tests/ --cov=src/verification --cov-report=html
# Run specific test file
uv run pytest tests/unit/test_requirements_parser.py -v
# Run specific test
uv run pytest tests/unit/test_requirements_parser.py::TestRequirementsParser::test_parse_simple_requirement -v
Test Data Examples
Example Constraint Set
sample_constraints = [
constraint(
id="func-001",
type="functional",
predicate="file_exists",
args=["${WORKSPACE}/main.py"],
priority=1,
required=True
),
constraint(
id="qual-001",
type="quality",
predicate="test_coverage_percentage",
args=[80],
priority=2,
required=True
),
constraint(
id="perf-001",
type="performance",
predicate="response_time_max_ms",
args=["/api/users", 200],
priority=3,
required=False
),
]
Example Workflow
sample_workflow = {
"workflow_id": "wf-001",
"checkpoints": [
{"name": "core_implementation", "order": 1},
{"name": "unit_tests", "order": 2},
{"name": "integration_tests", "order": 3},
{"name": "documentation", "order": 4},
{"name": "final_verification", "order": 5},
],
"max_attempts": 5,
"verification_model": "opus",
}
Summary
Total Test Cases: 200+
| Test Category | Test Count | Coverage Target |
|---|---|---|
| Unit Tests | 100 | 95% |
| Integration Tests | 60 | 90% |
| Contract Tests | 20 | 95% |
| Performance Tests | 20 | N/A |
| Security Tests | 10 | 95% |
| Edge Case Tests | 20 | 90% |
Completion Progress: 0/200+ (0%)
Last Updated: 2026-01-15
Author: System Design
Status: Initial Specification
Other tracked files
specs/035-verification/README.mdspecs/035-verification/agent-protocols.mdspecs/035-verification/architecture.mdspecs/035-verification/checkpoints.mdspecs/035-verification/compliance-audit.mdspecs/035-verification/prolog-rules.md
Full spec text
Verbatim from specs/035-verification/spec.md; headings are pushed down two levels.
SPEC-035: Verification Agent (U:Vfy)
Metadata
- Spec ID: 035-verification
- Title: Verification Agent (U:Vfy)
- Alias: U:Vfy
- Author: Mohamed
- Status: Complete
- Created: 2026-01-15
- Last Updated: 2026-01-17
- Priority: P0
- Components: Verification Engine, Constraint Validator, Proof Auditor
Overview
What
The Verification Agent (U:Vfy) is a Prolog-guided constraint verification system. It validates whether agent solutions satisfy requirements through a multi-tier architecture involving Execution Agents, Supervisor Agents, and the Verification Agent, with Prolog serving as the immutable source of truth.
Why
- Immutable constraint satisfaction verification
- Multi-tier validation (execution → supervision → verification)
- Edge case detection and reasoning validation
- Proof soundness verification
- Human escalation after max attempts
How
- Prolog as final arbiter (SATISFIED / NOT_MET)
- Execution Agent implements and iterates
- Supervisor Agent generates proofs and audits
- Verification Agent validates reasoning and edge cases
- Max 5 attempts before human escalation
Key Principles
- Prolog as Source of Truth: Prolog decisions are final and cannot be overridden
- Constraints are Immutable: Agent adapts solution to constraints, not vice versa
- TDD Approach: Verification begins with failing tests, iterates until satisfied
- Immutable Retry Limit: 5 failed attempts → human review
- Concurrent Verification: U:Vfy runs concurrently with Execution Agent
- Mathematical Proof Required: Proof needed when claiming constraint unsatisfiable
- Verification Hierarchy: Execution → Supervisor → U:Vfy
User Scenarios & Stories
US-001: Requirements Capture (Critical)
As a user I want to express requirements that become Prolog constraints So that the system can verify compliance
Acceptance Criteria:
- Natural language requirements input
- LLM interviews user for clarification
- Generate Subject + Verb + Object rules
- Prolog constraint generator creates formal predicates
- Constraints cover functional, quality, and performance requirements
US-002: Execution Agent Implementation (Critical)
As an Execution Agent I want to implement solutions satisfying constraints So that requirements are met
Acceptance Criteria:
- Receive Prolog constraints via CXP packet
- Plan solution approach
- Execute implementation
- Iterate based on verification feedback
- Cannot modify constraints (only solution)
- States: IDLE → PLANNING → EXECUTING → VERIFYING → ITERATING → COMPLETE/FAILED
US-003: Supervisor Agent Oversight (Critical)
As a Supervisor Agent I want to audit execution and generate proofs So that quality is ensured
Acceptance Criteria:
- Generate mathematical proofs for constraint satisfaction
- Audit Execution Agent's work
- Provide detailed explanations
- Identify potential edge cases
- Escalate complex issues to Verification Agent
- Proof types: exhaustive search, logical deduction, mathematical, practical
US-004: Verification Agent Validation (Critical)
As U:Vfy I want to validate reasoning and check edge cases So that solutions are correct
Acceptance Criteria:
- Run concurrently with Execution Agent
- Check edge cases coverage
- Verify reasoning soundness
- Confirm alternatives exhausted
- Evaluate mathematical proofs
- Checkpoints at: core impl, unit tests, integration tests, docs, final
US-005: Prolog Verification (Critical)
As the system I want to use Prolog as source of truth So that decisions are immutable
Acceptance Criteria:
- Parse constraint definitions
- Verify current system state
- Evaluate constraint satisfaction
- Binary result: SATISFIED / NOT_MET
- Specific failure reasons
- Cannot be overridden
US-006: Failure Handling and Escalation (High)
As the system I want to handle constraint failures So that issues are resolved or escalated
Acceptance Criteria:
- Increment attempt count on NOT_MET
- Send failure details to all agents
- Agent iterates if attempt < 5
- Human intervention if attempt = 5
- Provide specific failure reasons
- Track attempt history
US-007: Session State Management (Medium)
As the system I want to track verification session state So that progress is monitored
Acceptance Criteria:
- Create session with ID, intent, constraints
- Update session with progress
- Increment attempt counter
- Check max attempts exceeded
- Store attempt history with timestamps
- Reset session for new intents
US-008: Verification Loop Management (Critical)
As a system I want to manage the verification loop So that agents iterate until constraints are satisfied or max attempts reached
Acceptance Criteria:
- Track verification attempts and enforce a maximum of 5
- Provide feedback after each attempt
- Support automatic retry and manual intervention
- Escalate after max attempts
- Track attempt history, support reset, and log all attempts
(21 requirements: REQ-035-US-008-001 … REQ-035-US-008-021 — see
checklists/requirements.md.)
US-009: Integration with Intent Broker (High)
As a system I want the verification system to integrate with the Intent Broker So that intents can be verified against requirements
Acceptance Criteria:
- Receive intents from the Intent Broker
- Verify intents against captured requirements
- Return verification outcomes to the broker
(18 requirements: REQ-035-US-009-001 … REQ-035-US-009-018 — see
checklists/requirements.md.)
US-010: Security and Safety Constraints (Critical)
As a system I want to enforce security constraints So that verified solutions meet security requirements
Acceptance Criteria:
- Detect hardcoded secrets
- Enforce the remaining security and safety constraints before a solution is accepted
(21 requirements: REQ-035-US-010-001 … REQ-035-US-010-021 — see
checklists/requirements.md.)
US-011: Performance Constraints (High)
As a system I want to enforce performance constraints So that verified solutions meet performance requirements
Acceptance Criteria:
- Measure response time
- Enforce the remaining performance budgets before a solution is accepted
(19 requirements: REQ-035-US-011-001 … REQ-035-US-011-019 — see
checklists/requirements.md.)
Provenance (2026-08-19): US-008 … US-011 were fully defined in this spec's own
checklists/requirements.md(79 requirements, all ticked) and implemented across 14src/and 3tests/files, but the four headings were missing here — so every one of those 79 ids cited a story that, perspec.md, did not exist. The titles, story statements and priorities above are taken verbatim from the checklist; the acceptance criteria summarise its requirement text. Nothing here was invented: the checklist is the authority, and this section was brought into agreement with it.
Functional Requirements
Verification Flow
User Intent → Requirements Capture → Generate Constraints → Execution Agent
↓
COMPLETE ← Prolog ← Verification
↑ ↓
Supervisor ← U:Vfy ← Execution
Checkpoint Milestones
- Core implementation complete
- Unit tests written
- Integration tests complete
- Documentation written
- Final comprehensive check
Constraint Types
% Functional constraints
api_exists('/users').
api_exists('/auth/login').
authentication_implemented('jwt').
% Quality constraints
tests_exist().
test_coverage_percentage(80).
documentation_exists().
% Performance constraints
response_time_max_ms(200).
Verification Agent Models
| Model | Strengths |
|---|---|
| Claude Opus 4 | Complex reasoning, nuanced edge case detection |
| Deepseek R1 | Mathematical rigor, formal verification |
| Qwen Max | Multilingual verification, large context |
| Grok4 MiniMax | Fast iterative verification, resource-efficient |
Technical Design
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ LAYER 1: INPUT & REQUIREMENTS │
│ ┌─────────┐ ┌────────────────┐ ┌─────────────────────┐ │
│ │ USER │ │ LLM INTERVIEW │ │ PROLOG CONSTRAINT │ │
│ │ INPUT │──► MODULE │──► GENERATOR │ │
│ └─────────┘ └────────────────┘ └──────────┬──────────┘ │
└──────────────────────────────────────────────┼──────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ LAYER 2: AGENT COORDINATION │
│ ┌─────────────────┐ ┌───────────────────┐ ┌────────────┐│
│ │ EXECUTION AGENT │◄──►│ SUPERVISOR AGENT │◄──►│ U:Vfy ││
│ │ • Implements │ │ • Proofs │ │ • Edge cases│
│ │ • Iterates │ │ • Audits │ │ • Reasoning │
│ └────────┬────────┘ └─────────┬─────────┘ └──────┬─────┘│
│ │ │ │ │
└───────────┼───────────────────────┼──────────────────────┼───────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ LAYER 3: VERIFICATION ENGINE │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ CONSTRAINT│ │ STATE │ │ LOGIC │ │ FINAL │ │
│ │ PARSER │──► VERIFIER │──► CHECKER │──► DECISION │ │
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │
└─────────────────────────────────────────────────────────────────┘
CXP Constraint Definition Message
{
"header": {
"packet_id": "uuid",
"type": "COMMAND",
"sender": "U:Ox",
"recipient": "ExecutionAgent",
"subject": "constraint_verification_task",
"thread_id": "session-uuid"
},
"payload": {
"intent_id": "intent-uuid",
"constraints": {
"functional": [
{"predicate": "api_exists", "args": ["/users"]},
{"predicate": "authentication_implemented", "args": ["jwt"]}
],
"quality": [
{"predicate": "test_coverage", "args": [80]}
],
"performance": [
{"predicate": "response_time_max_ms", "args": [200]}
]
},
"checkpoint_milestones": ["core", "unit_tests", "integration", "docs", "final"],
"max_attempts": 5,
"verification_model": "opus"
}
}
CXP Verification Result Message
{
"header": {
"type": "RESPONSE",
"sender": "U:Vfy",
"recipient": "Orchestrator",
"subject": "verification_result"
},
"payload": {
"intent_id": "intent-uuid",
"checkpoint": "final_verification",
"prolog_result": {
"decision": "SATISFIED | NOT_MET",
"satisfied_constraints": ["api_exists"],
"failed_constraints": ["test_coverage"],
"failure_reasons": {"test_coverage": "Expected 80%, actual 65%"}
},
"verification_agent_result": {
"edge_cases_covered": true,
"reasoning_sound": true,
"proof_complete": true,
"alternatives_exhausted": true
},
"attempt_count": 2,
"recommendation": "CONTINUE_ITERATING | COMPLETE | ESCALATE"
}
}
Prolog Session State
:- module(verification_session, [
create_session/3,
update_session/2,
get_session/2,
increment_attempt/1,
is_max_attempts_exceeded/1,
reset_session/1
]).
% Session: session_id, intent_id, attempt_count, constraints, status
create_session(SessionId, IntentId, Constraints) :-
assertz(session(SessionId, IntentId, 0, Constraints, 'active')),
assertz(session_attempts(SessionId, [])).
increment_attempt(SessionId) :-
session(SessionId, IntentId, Attempts, Constraints, Status),
NewAttempts is Attempts + 1,
retract(session(SessionId, IntentId, Attempts, Constraints, Status)),
assertz(session(SessionId, IntentId, NewAttempts, Constraints, Status)).
is_max_attempts_exceeded(SessionId) :-
session(SessionId, _, Attempts, _, _),
Attempts >= 5.
Integration Points
| Component | Integration |
|---|---|
| orchestrata-intent | Intent-to-constraints mapping |
| orchestrata-cxp | Verification message protocol |
| orchestrata-governance | Prolog constraint checking |
| orchestrata-knowledge | Verification results storage |
Success Criteria
- Accuracy: 100% of constraints checked against Prolog
- Completeness: All checkpoints validated
- Timeliness: Verification < 1 minute per checkpoint
- Escalation: Human review triggered at 5 failed attempts
- Traceability: All verification decisions logged
Dependencies
- orchestrata-core (interfaces)
- orchestrata-cxp (message protocol)
- orchestrata-governance (Prolog integration)
- orchestrata-intent (requirements capture)
- SWI-Prolog (constraint verification)
Revision History
| Date | Version | Author | Changes |
|---|---|---|---|
| 2026-03-07 | 1.0 | Mohamed | Initial specification |