ai-engineering-loop 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,123 +1,70 @@
1
- # Judge Policy Specification
1
+ # Judge Agent & Evaluation Policy
2
2
 
3
- ## 1. Overview & Role Definition
3
+ ## 1. Overview & Core Mission
4
4
 
5
- The **Judge Agent** is the impartial arbiter of the AI Engineering Loop. In traditional workflows, either the author approves its own code (optimistic bias) or a reviewer blocks changes arbitrarily (nitpicking/hallucination).
6
-
7
- The Judge Agent evaluates the complete matrix of:
8
- 1. The original [Goal Contract](file:///Users/egagofur/Development/work/ai-engineering-loop/core/goal-contract.md).
9
- 2. The surgical code implementation & diff.
10
- 3. The raw [Deterministic Verification](file:///Users/egagofur/Development/work/ai-engineering-loop/core/verification-loop.md) outputs (tests, typecheck, lint, build).
11
- 4. The [Devil's Advocate Review Findings](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md) and Author's evidence/triage.
12
- 5. The [Iteration & No-Progress State](file:///Users/egagofur/Development/work/ai-engineering-loop/core/iteration-policy.md).
5
+ The **Judge Agent** is the impartial magistrate of the AI Engineering Loop. It does not write application code and does not guess at intent. It evaluates objective evidence to render one of three verdicts: **`PASS`**, **`ITERATE`**, or **`ESCALATE`**.
13
6
 
14
7
  ```mermaid
15
8
  flowchart TD
16
- GC[Goal Contract] --> Judge[Judge Agent]
17
- Diff[Implementation Diff] --> Judge
18
- DV[Deterministic Logs] --> Judge
19
- DA[Devil's Advocate Findings] --> Judge
9
+ Start([Evaluation Input]) --> Gate1{Verification Evidence Contract<br>Exit Code 0 & Complete Logs?}
10
+
11
+ Gate1 -->|Failed / Vague| IterateVerif[Verdict: ITERATE<br>Reason: Incomplete Verification Evidence]
12
+ Gate1 -->|Passed| Gate2{Evaluate Finding Ledger<br>Validity + Severity}
13
+
14
+ Gate2 -->|VALID + BLOCKER / HIGH| IterateFindings[Verdict: ITERATE<br>Reason: Blocking Substantive Issues]
15
+ Gate2 -->|INVALID Findings| Dismiss[DISMISS Invalid Findings<br>Record Signatures]
16
+ Gate2 -->|VALID + MEDIUM / LOW| Accept[ACCEPT & Document Tradeoffs in MR]
20
17
 
21
- Judge --> Decision{Evaluate Rules}
18
+ Dismiss --> FinalCheck{0 Blocking Findings & 100% ACs Verified?}
19
+ Accept --> FinalCheck
22
20
 
23
- Decision -->|All ACs Met, Tests Green, Findings Resolved| PASS[Verdict: PASS]
24
- Decision -->|Valid Blocking Findings & Iterations Remaining| ITERATE[Verdict: ITERATE]
25
- Decision -->|Stalled / Max Iterations / High Risk| ESCALATE[Verdict: ESCALATE]
21
+ FinalCheck -->|Yes: PASS| PassVerdict([Verdict: PASS<br>Proceed to Impact Assessment & Delivery])
22
+ FinalCheck -->|No| IterateFindings
23
+
24
+ IterateFindings --> IterCheck{Active Iterations >= MAX_ITERATIONS?}
25
+ IterCheck -->|Yes: Escalate| EscalateVerdict([Verdict: ESCALATE<br>Human Escalation Report])
26
+ IterCheck -->|No| MakerFix([Maker Applies Fix & Adds Tests])
26
27
  ```
27
28
 
28
29
  ---
29
30
 
30
- ## 2. Evidence Evaluation Rules
31
-
32
- The Judge does NOT blindly accept claims from either the Maker or the Devil's Advocate. Every statement is scrutinized according to the following evidentiary rules:
31
+ ## 2. Evidence-Based Decision Matrix
33
32
 
34
- ### Rule 1: Deterministic Precedence
35
- If any deterministic check (unit tests, TypeScript compilation, linter, build) failed or was not executed, the Judge **CANNOT** issue a `PASS` verdict.
33
+ The Judge renders decisions based strictly on **Validity + Severity**. The reviewer's subjective disposition (`STRONG`, `ACCEPTABLE`, `WEAK`) **never overrides factual evidence**:
36
34
 
37
- ### Rule 2: Rejection of Unsubstantiated Nitpicks
38
- A Devil's Advocate finding that:
39
- - Relies on personal aesthetic preference (e.g. *"variable names could be shorter"*),
40
- - Suggests speculative future-proofing abstractions not requested in the Goal Contract, or
41
- - Misunderstands existing repository conventions,
42
- must be declared **`INVALID`** by the Judge and discarded from blocking the build.
43
-
44
- ### Rule 3: Strict Severity Thresholds
45
- - **SEV-1 (Critical)** and **SEV-2 (High)** findings: Must be resolved in code with passing tests before a `PASS` verdict can be granted.
46
- - **SEV-3 (Medium)** and **SEV-4 (Low)** findings: May be accepted into an action items backlog if they do not violate any Acceptance Criteria in the Goal Contract.
47
-
48
- ### Rule 4: Verification of Author Triage
49
- If the Maker Agent claims a finding is `INVALID` (e.g. *"The suggested API does not exist"*), the Judge verifies this claim against the repository before accepting the dismissal.
35
+ | Finding Validity | Finding Severity | Disposition | Judge Action | Impact on Final Verdict |
36
+ |---|---|---|---|---|
37
+ | **`VALID`** | **`BLOCKER`** | Any | **UPHELD (Blocking)** | **`ITERATE`** Maker must apply alternative diff & tests. |
38
+ | **`VALID`** | **`HIGH`** | Any | **UPHELD (Blocking)** | **`ITERATE`** — Maker must apply alternative diff & tests. |
39
+ | **`VALID`** | **`MEDIUM`** | `ACCEPTABLE` | **UPHELD (Tradeoff)** | **`PASS`** (if ACs met) — Logged as known tradeoff in MR. |
40
+ | **`VALID`** | **`LOW`** | `ACCEPTABLE` | **UPHELD (Tradeoff)** | **`PASS`** (if ACs met) — Logged as known tradeoff in MR. |
41
+ | **`INVALID`** | Any | `WEAK` | **DISMISSED (Hallucination)** | **`PASS`** (if ACs met) — Discarded with evidence proof. |
50
42
 
51
43
  ---
52
44
 
53
- ## 3. Verdict Computation Logic
54
-
55
- ```text
56
- FUNCTION ComputeVerdict(Contract, Diff, DeterministicLogs, Findings, IterationState):
57
- IF DeterministicLogs.HasFailures() THEN
58
- RETURN ITERATE(reason="Deterministic verification gates failed")
59
- END IF
45
+ ## 3. The 3 Verdict Rules
60
46
 
61
- IF IterationState.IsStalled() OR IterationState.CurrentIteration >= IterationState.MaxIterations THEN
62
- IF Findings.HasUnresolvedBlocking() THEN
63
- RETURN ESCALATE(reason="Max iterations reached with unresolved blocking findings")
64
- END IF
65
- END IF
66
-
67
- IF Contract.ViolatesConstraints(Diff) THEN
68
- RETURN ESCALATE(reason="Implementation violated technical constraints or modified out-of-scope files")
69
- END IF
70
-
71
- UnresolvedBlocking = Findings.GetUnresolved(severity IN [SEV_1, SEV_2])
72
-
73
- IF UnresolvedBlocking.Count == 0 THEN
74
- IF Contract.AllAcceptanceCriteriaVerified(DeterministicLogs) THEN
75
- RETURN PASS(summary="All criteria satisfied and verified with proof")
76
- ELSE
77
- RETURN ITERATE(reason="Missing deterministic proof for specific Acceptance Criteria")
78
- END IF
79
- ELSE
80
- RETURN ITERATE(reason="Unresolved blocking findings exist", findings=UnresolvedBlocking)
81
- END IF
82
- ```
47
+ ### Verdict 1: `PASS`
48
+ - **Conditions**:
49
+ 1. 100% of Goal Contract Acceptance Criteria (AC-1..N) proven via deterministic verification.
50
+ 2. Verification Evidence Contract 100% satisfied (exit code 0, complete logs, assertion proof).
51
+ 3. Zero open `VALID + BLOCKER` or `VALID + HIGH` findings.
52
+ 4. Any `INVALID` findings are formally dismissed with counter-evidence.
53
+ 5. Any `VALID + MEDIUM/LOW` findings are documented as tradeoffs.
83
54
 
84
55
  ---
85
56
 
86
- ## 4. Standardized Judge Verdict Report
87
-
88
- Every evaluation concludes with a formal **Judge Verdict Artifact**:
89
-
90
- ```markdown
91
- # ⚖️ Judge Evaluation Report
92
-
93
- ## 1. Executive Verdict
94
- - **Verdict**: `[PASS | ITERATE | ESCALATE]`
95
- - **Iteration**: `[K of N]`
96
- - **Confidence**: `[HIGH | MEDIUM | LOW]`
57
+ ### Verdict 2: `ITERATE`
58
+ - **Conditions**:
59
+ 1. One or more `VALID + BLOCKER` or `VALID + HIGH` findings exist.
60
+ 2. Active iteration count $< \text{MAX\_ITERATIONS}$ (default 3).
61
+ - **Maker Directive**: The Maker must adopt the concrete alternative diff or provide an equivalent verified architectural resolution, authoring regression unit tests.
97
62
 
98
- ## 2. Deterministic Verification Audit
99
- | Gate | Command | Result | Status |
100
- |---|---|---|:---:|
101
- | Unit Tests | `npx jest --testPathIgnorePatterns="integration"` | 14 passed, 0 failed | ✅ PASS |
102
- | Static Types | `npx tsc --noEmit` | Exit code 0 | ✅ PASS |
103
- | Linter | `npx eslint --fix <files>` | 0 errors, 0 warnings | ✅ PASS |
104
- | Build | `npm run build` | Exit code 0 | ✅ PASS |
105
-
106
- ## 3. Goal Contract Compliance Audit
107
- | Acceptance Criterion | Verification Method | Status |
108
- |---|---|:---:|
109
- | AC-1: Correct attendance status calculation | `resolve-display-status.test.ts` | ✅ PASS |
110
- | AC-2: Weekend & non-normal hours edge cases | `resolve-display-status.test.ts:L45` | ✅ PASS |
111
- | AC-3: Backward compatibility preserved | Integration test suite | ✅ PASS |
112
-
113
- ## 4. Finding Triage & Resolution Matrix
114
- | ID | Severity | Category | Reviewer Finding | Triage Status | Resolution Proof |
115
- |---|---|---|---|:---:|---|
116
- | COR-001 | HIGH | Correctness | Missing null check on overtimeNote | `VALID` | Fixed in `service.ts:L32`; tested in `service.test.ts` |
117
- | SEC-001 | LOW | Security | Suggest sanitizing display status | `INVALID` | Display status is an enum internally generated, not user input |
63
+ ---
118
64
 
119
- ## 5. Directives for Next Step
120
- [If PASS: Hand off to Delivery Adapter.]
121
- [If ITERATE: Explicit, numbered instructions for the Maker Agent.]
122
- [If ESCALATE: Actionable human decision points.]
123
- ```
65
+ ### Verdict 3: `ESCALATE`
66
+ - **Conditions**:
67
+ 1. Active iteration count $\ge \text{MAX\_ITERATIONS}$ (3).
68
+ 2. Stagnation detected (identical finding signatures repeated across 2 iterations).
69
+ 3. Contradictory architectural invariants that cannot be resolved within task scope.
70
+ - **Action**: Halt the loop immediately and generate an actionable Human Escalation Report.
@@ -0,0 +1,87 @@
1
+ # Runtime Capability Registry & Execution-Mode Selection Specification
2
+
3
+ ## 1. Overview & Foundational Laws
4
+
5
+ The AI Engineering Loop enforces strict honesty and evidence-based rigor regarding agent execution:
6
+
7
+ > **Core Law**:
8
+ > AI Engineering Loop must **NEVER** claim independent agent execution without runtime evidence of an actual separate LLM execution.
9
+
10
+ ### The 3-Stage Capability Lifecycle:
11
+ The architecture explicitly distinguishes three separate stages:
12
+ 1. **`CONFIGURATION_SUPPORTED`**: The platform understands subagent configuration (e.g. `.agents/plugins/.../AGENT.md` with `subagent: true`, `mainAgent: false` is discoverable).
13
+ 2. **`INVOCATION_AVAILABLE`**: An invocation tool (e.g. `invoke_subagent`) or authenticated agent CLI is actively exposed and callable in the current runtime.
14
+ 3. **`EXECUTION_PROVEN`**: An actual separate child session was created, captured a separate execution identity, produced a real child model response, and operated with independent context.
15
+
16
+ ```text
17
+ ┌───────────────────────────┐ ┌───────────────────────────┐ ┌───────────────────────────┐
18
+ │ CONFIGURATION_SUPPORTED │ ──> │ INVOCATION_AVAILABLE │ ──> │ EXECUTION_PROVEN │
19
+ │ (Config is recognized) │ │ (Callable tool is active) │ │ (Child LLM response seen) │
20
+ └───────────────────────────┘ └───────────────────────────┘ └───────────────────────────┘
21
+ ```
22
+
23
+ > [!IMPORTANT]
24
+ > **Semantic Invariant**:
25
+ > If `CONFIGURATION_SUPPORTED = true`, `INVOCATION_AVAILABLE = false`, and `EXECUTION_PROVEN = false`, the engine **must select `CONTEXT_ISOLATION_ONLY`**.
26
+ > Configuration discovery is **never** conflated with execution capability.
27
+
28
+ ---
29
+
30
+ ## 2. Non-Negotiable Invariants: What is NOT Execution Proof
31
+
32
+ The system categorically rejects the following as proof of independent LLM execution:
33
+ 1. **Configuration files**: `AGENT.md`, `subagent: true`, `mainAgent: false`.
34
+ 2. **Documentation & plugin manifests**: Markdown descriptions or plugin registration.
35
+ 3. **IPC existence**: The existence of `agentapi` on disk or `ANTIGRAVITY_AGENTAPI_EXE`.
36
+ 4. **IPC message dispatch**: Successful `agentapi send-message` is classified strictly as `IPC_MESSAGE_DISPATCH`, **NOT** an agent execution capability.
37
+ 5. **Metadata fields**: Presence of `subagentSpec: null` or conversation metadata in `get-conversation-metadata`.
38
+ 6. **Browser automation tools**: `browser_subagent` is Playwright browser DOM/navigation automation and must **NEVER** be classified as an LLM subagent.
39
+ 7. **Persona simulation**: Role-playing as a reviewer in the same session is self-review, not an agent.
40
+
41
+ ---
42
+
43
+ ## 3. Standard 5 Execution Modes (Deterministic Priority)
44
+
45
+ | Priority | Mode Name | Requires Independent LLM Execution? | Condition for Selection |
46
+ |:---:|---|:---:|---|
47
+ | **1** | **`TRUE_INDEPENDENT_AGENT`** | **YES** | Separate child conversation/process exists **AND** actual LLM model response is produced **AND** conversational history is not inherited. |
48
+ | **2** | **`ISOLATED_AGENT_INSTANCE`** | **YES** | Separate conversation/agent instance exists with verified independent model execution. |
49
+ | **3** | **`FRESH_PROCESS_AGENT`** | **YES** | A separate OS process successfully executes an LLM agent with fresh context and returns a verified model response. |
50
+ | **4** | **`CONTEXT_ISOLATION_ONLY`** | **NO** | Clean-Slate Artifact Isolation Barrier in same session. Strips 100% of prompt history on disk. Guaranteed fallback. |
51
+ | **5** | **`UNAVAILABLE`** | **NO** | No review execution mechanism is available. |
52
+
53
+ ---
54
+
55
+ ## 4. Antigravity Environment Empirical Discovery Record
56
+
57
+ | Investigated Surface | Tested Command / API | Classification | Status & Result |
58
+ |---|---|---|---|
59
+ | **Custom Agent Config** | `.agents/plugins/.../AGENT.md` | `CONFIGURATION_SUPPORTED` | **Supported**: Antigravity recognizes plugin/agent schemas. |
60
+ | **In-Chat Subagent Tool** | Toolset declarations | `INVOCATION_UNAVAILABLE` | `browser_subagent` present (DOM only); no general code subagent tool. |
61
+ | **Python SDK** | `import google.antigravity` | `UNAVAILABLE` | `ModuleNotFoundError: No module named 'google.antigravity'`. |
62
+ | **External Agent CLI** | `/Users/.../.local/bin/claude -p` | `UNAVAILABLE` | Unauthenticated: `Not logged in · Please run /login`. |
63
+ | **Antigravity `new-conversation`** | `agentapi new-conversation` | `UNAVAILABLE` | Blocked by Language Server `project_id` authorization. |
64
+ | **Antigravity `send-message`** | `agentapi send-message` | `IPC_MESSAGE_DISPATCH` | Succeeded (IPC message dispatch works, but is not an agent). |
65
+ | **Artifact Barrier** | `buildReviewContextBarrier()` | `CONTEXT_ISOLATION_ONLY` | **Available & Verified**: 0% prompt bleed on disk. |
66
+
67
+ ### Architectural Conclusion:
68
+ > *"Antigravity custom subagent configuration is supported/discoverable, but native subagent invocation is not exposed or executable from the current standalone agent runtime."*
69
+
70
+ ---
71
+
72
+ ## 5. Truthful Reporting Output
73
+
74
+ When `CONTEXT_ISOLATION_ONLY` is selected, the report generator strictly produces:
75
+
76
+ ```text
77
+ Execution Mode: CONTEXT_ISOLATION_ONLY
78
+ Independent LLM Execution: NOT PROVEN
79
+ Native Subagent Invocation: UNAVAILABLE
80
+ Review Method: Clean-Slate Artifact Isolation Barrier
81
+ ```
82
+
83
+ ### Strictly Forbidden Phrases during `CONTEXT_ISOLATION_ONLY`:
84
+ - *"independent agent review"*
85
+ - *"subagent"*
86
+ - *"multi-agent review"*
87
+ - *"independent reviewer"*
@@ -1,97 +1,61 @@
1
- # Verification Loop Specification
1
+ # Deterministic Verification Loop & Evidence Contract
2
2
 
3
- ## 1. Overview
3
+ ## 1. Overview & Core Laws
4
4
 
5
- The **Verification Loop** is the dual-layer validation engine of the AI Engineering Loop. It guarantees that code is not merely claimed to be functional by its author, but is rigorously tested via **machine-checkable deterministic gates** and scrutinized by **independent adversarial inspection**.
5
+ The Verification Loop is the deterministic machine gate of the AI Engineering Loop:
6
6
 
7
- ```mermaid
8
- flowchart TD
9
- Start([Implementation Diff]) --> D1[Deterministic Gate 1: Unit & Integration Tests]
10
- D1 -->|Fail| MakerFix[Return to Maker: Fix Logic]
11
- D1 -->|Pass| D2[Deterministic Gate 2: Typecheck & Compiler]
12
-
13
- D2 -->|Fail| MakerFix
14
- D2 -->|Pass| D3[Deterministic Gate 3: Linter & Format]
15
-
16
- D3 -->|Fail| MakerFix
17
- D3 -->|Pass| D4[Deterministic Gate 4: Build / Packaging]
18
-
19
- D4 -->|Fail| MakerFix
20
- D4 -->|Pass| Adversarial[Adversarial Gate: Devil's Advocate Layered Review]
21
-
22
- Adversarial --> JudgeEval[Judge Agent: Evidence Evaluation]
23
- JudgeEval -->|ITERATE| MakerFix
24
- JudgeEval -->|ESCALATE| Escalate([Human Escalation])
25
- JudgeEval -->|PASS| Done([Definition of Done Satisfied])
26
- ```
27
-
28
- ---
29
-
30
- ## 2. Dynamic Command Discovery
31
-
32
- The exact commands executed for each deterministic gate are resolved dynamically according to [Configuration Precedence](file:///Users/egagofur/Development/work/ai-engineering-loop/core/configuration-precedence.md):
33
-
34
- 1. Read `.ai-engineering-loop/verification.md` from the target repository if present.
35
- 2. If missing, fall back to the defaults of the bound [Project Profile](file:///Users/egagofur/Development/work/ai-engineering-loop/profiles/README.md) (`web-app`, `backend-api`, `mobile-app`, `library`, `monorepo`).
36
- 3. If profile is unspecified, infer commands from repository manifests (`package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`).
7
+ > **"Code cannot enter Devil's Advocate review until it achieves 100% green machine verification backed by explicit, verifiable execution evidence."**
37
8
 
38
9
  ---
39
10
 
40
- ## 3. Layer 1: Deterministic Verification
41
-
42
- Deterministic verification consists of machine-executed commands producing binary (`PASS` / `FAIL`) or structured outputs.
43
-
44
- An agent is **strictly prohibited** from proceeding to adversarial review if any deterministic gate fails.
45
-
46
- ### The 4 Deterministic Gates
47
-
48
- #### Gate 1: Unit & Regression Tests
49
- - **Objective**: Prove correctness of new logic and ensure zero regressions.
50
- - **Criteria**: 100% exit code `0`, zero test failures, zero unexpected skipped tests.
51
- - **Rules**:
52
- - Tests must cover happy paths, null/undefined safety, empty inputs, boundary conditions, and error branches.
53
- - Test assertions must be strict (e.g. checking specific return values, error types, and state mutations, not merely `toBeDefined()`).
54
-
55
- #### Gate 2: Static Typing & Compilation
56
- - **Objective**: Prove mathematical type safety and schema conformance.
57
- - **Criteria**: Zero compiler / typechecker errors across the codebase or affected workspaces (e.g. `tsc --noEmit`, `mypy`, `cargo check`).
58
-
59
- #### Gate 3: Code Standards & Linting
60
- - **Objective**: Guarantee zero static analysis rule violations and formatting hygiene.
61
- - **Criteria**: Zero linter errors on touched files (e.g. `eslint`, `ruff`, `golangci-lint`, `dart analyze`).
62
-
63
- #### Gate 4: Build & Packaging
64
- - **Objective**: Ensure the project compiles, bundles, or packages without missing assets or circular dependencies.
65
- - **Criteria**: Build command completes with exit code `0`.
11
+ ## 2. Verification Evidence Contract
12
+
13
+ A verification `PASS` is **strictly invalid** without concrete execution evidence. The system categorically rejects vague statements such as *"command was launched"* or *"test appears to have passed"*.
14
+
15
+ ### Required Evidence Properties:
16
+ 1. **`command`**: Exact shell string executed (e.g. `npm test -- --runInBand`).
17
+ 2. **`executionIdentity`**: Process ID (PID), execution hash, or system execution identifier.
18
+ 3. **`startTime` & `endTime`**: ISO timestamps documenting execution duration.
19
+ 4. **`exitCode`**: Must be `0`. Any non-zero exit code immediately halts the gate.
20
+ 5. **`stdout` & `stderr`**: Raw machine logs captured from execution.
21
+ 6. **`timeoutStatus`**: Must be `"COMPLETED"` (not timed out or backgrounded without completion).
22
+ 7. **`testCounts`**: Explicit counts of passed, failed, and skipped tests.
23
+ 8. **`assertionEvidence`**: Specific assertion proof matching the active Goal Contract's Acceptance Criteria.
24
+
25
+ ```json
26
+ {
27
+ "command": "npm test",
28
+ "executionIdentity": "exec-d4f1a2",
29
+ "startTime": "2026-08-25T10:00:00.000Z",
30
+ "endTime": "2026-08-25T10:00:04.500Z",
31
+ "exitCode": 0,
32
+ "stdout": "PASS src/services/payment.test.ts (14 tests passed, 0 failed)",
33
+ "stderr": "",
34
+ "timeoutStatus": "COMPLETED",
35
+ "testCounts": {
36
+ "passed": 14,
37
+ "failed": 0,
38
+ "skipped": 0
39
+ },
40
+ "assertionEvidence": "AC-1: Lock payment row before update verified in test_concurrent_payment_locking"
41
+ }
42
+ ```
66
43
 
67
44
  ---
68
45
 
69
- ## 4. Layer 2: Adversarial Verification (Devil's Advocate)
70
-
71
- Once all deterministic gates pass, the code diff is submitted to the **Devil's Advocate Agent**.
46
+ ## 3. The 4 Verification Gates
72
47
 
73
- ### Purpose
74
- Deterministic tests only test what the author *thought* to test. The Devil's Advocate exists to discover what the author *forgot*, *assumed*, or *misunderstood*.
75
-
76
- ### Scope of Review
77
- The Devil's Advocate reviews strictly the git diff against the target base branch:
78
- ```bash
79
- git diff <base-branch>...HEAD
80
- ```
81
-
82
- ### Layered Review Rules
83
- Review domains are dynamically assembled based on the active **Project Profile** and **Repository Invariants** (see [Devil's Advocate Specification](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md)), ensuring only substantive, relevant topics are evaluated.
48
+ 1. **Gate 1: Unit & Integration Tests**: All unit and edge-case tests must pass with 0 failures.
49
+ 2. **Gate 2: Static Type Analysis**: `tsc --noEmit` or compiler type checking must exit with code `0` (zero type errors).
50
+ 3. **Gate 3: Linter Analysis**: Linter rules must pass cleanly with 0 errors on modified files.
51
+ 4. **Gate 4: Production Build**: The build command (`npm run build`, `go build`, `cargo build`) must produce a clean compile.
84
52
 
85
53
  ---
86
54
 
87
- ## 5. Verification Evidence Protocol
88
-
89
- All claims of verification must be accompanied by **reproducible evidence**:
90
-
91
- 1. **Command Executed**: Full CLI command line string.
92
- 2. **Exit Code**: Exact status code returned.
93
- 3. **Execution Output**: Raw relevant output snippet showing test pass counts, typecheck logs, or lint results.
94
- 4. **Acceptance Criteria Mapping**: Explicit mapping showing which test corresponds to which AC from the [Goal Contract](file:///Users/egagofur/Development/work/ai-engineering-loop/core/goal-contract.md).
55
+ ## 4. Rejection Triggers
95
56
 
96
- > [!CAUTION]
97
- > Statements such as *"I have manually verified that this works"* or *"The tests should pass"* without command outputs are invalid and will be rejected by the Judge Agent.
57
+ The Verification Gate immediately halts and returns to the Maker if:
58
+ - Any test suite fails or times out.
59
+ - Exit code is non-zero.
60
+ - The command was sent to the background and not verified to completion.
61
+ - Test logs contain zero passing assertions for new acceptance criteria.