ai-engineering-loop 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +272 -0
- package/adapters/dot/README.md +55 -0
- package/adapters/dot/coreview.md +88 -0
- package/adapters/dot/gitlab.md +128 -0
- package/adapters/dot/mattermost.md +102 -0
- package/adapters/dot/multi-branch.md +89 -0
- package/agents/devil-advocate.md +111 -0
- package/agents/judge.md +69 -0
- package/agents/maker.md +66 -0
- package/bin/ai-engineering-loop.js +633 -0
- package/core/configuration-precedence.md +102 -0
- package/core/context-impact-assessment.md +127 -0
- package/core/context-refresh-policy.md +116 -0
- package/core/definition-of-done.md +79 -0
- package/core/escalation-policy.md +99 -0
- package/core/goal-contract.md +88 -0
- package/core/iteration-policy.md +108 -0
- package/core/judge-policy.md +123 -0
- package/core/project-initialization.md +97 -0
- package/core/repo-config-schema.md +72 -0
- package/core/verification-loop.md +97 -0
- package/docs/antigravity-feasibility.md +90 -0
- package/docs/migration-plan.md +70 -0
- package/examples/backend-api/payment-idempotency/README.md +33 -0
- package/examples/backend-api/payment-idempotency/goal-contract.md +33 -0
- package/examples/backend-api/payment-idempotency/judge-verdict.md +28 -0
- package/examples/backend-api/payment-idempotency/review-findings.md +50 -0
- package/examples/dot/attendance-confirmation/README.md +22 -0
- package/examples/dot/attendance-confirmation/delivery-report.md +51 -0
- package/examples/dot/attendance-confirmation/goal-contract.md +39 -0
- package/examples/dot/attendance-confirmation/judge-verdict.md +43 -0
- package/examples/dot/attendance-confirmation/review-findings.md +57 -0
- package/examples/initialization/README.md +19 -0
- package/examples/initialization/discovery-trace.md +63 -0
- package/examples/initialization/generated-context.md +110 -0
- package/examples/mobile-app/offline-sync-queue/README.md +33 -0
- package/examples/mobile-app/offline-sync-queue/goal-contract.md +32 -0
- package/examples/mobile-app/offline-sync-queue/judge-verdict.md +27 -0
- package/examples/mobile-app/offline-sync-queue/review-findings.md +30 -0
- package/package.json +31 -0
- package/policies/discovery-safety-policy.md +51 -0
- package/policies/evidence-policy.md +70 -0
- package/policies/finding-policy.md +102 -0
- package/policies/no-progress-policy.md +92 -0
- package/profiles/README.md +42 -0
- package/profiles/backend-api.md +64 -0
- package/profiles/library.md +51 -0
- package/profiles/mobile-app.md +59 -0
- package/profiles/monorepo.md +46 -0
- package/profiles/web-app.md +65 -0
- package/scripts/init.sh +85 -0
- package/templates/repo-config/adapter.md +11 -0
- package/templates/repo-config/architecture.md +15 -0
- package/templates/repo-config/config.md +11 -0
- package/templates/repo-config/conventions.md +16 -0
- package/templates/repo-config/verification.md +13 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Iteration Policy Specification
|
|
2
|
+
|
|
3
|
+
## 1. Overview & Objectives
|
|
4
|
+
|
|
5
|
+
The **Iteration Policy** governs autonomous retry loops within the AI Engineering Loop. When deterministic tests fail or the [Devil's Advocate](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md) identifies valid blocking findings, the system initiates an **autonomous iteration cycle**.
|
|
6
|
+
|
|
7
|
+
The objective of this policy is to enable **reliable self-correction** while strictly guarding against infinite loops, cognitive drift, and resource exhaustion.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 2. Iteration Limits & Configuration
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
DEFAULT_MAX_ITERATIONS = 3
|
|
15
|
+
MIN_ITERATIONS = 1
|
|
16
|
+
MAX_ALLOWED_CEILING = 5
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **Default Cap**: An engineering run is allotted a maximum of **3 iterations** by default.
|
|
20
|
+
- **Configurability**: Projects or workflows may configure `MAX_ITERATIONS` between 1 and 5 in their runtime configuration or Goal Contract.
|
|
21
|
+
- **Hard Ceiling**: Under no circumstances may an agent loop beyond 5 iterations without human re-authorization.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 3. The Autonomous Iteration Lifecycle
|
|
26
|
+
|
|
27
|
+
```mermaid
|
|
28
|
+
stateDiagram-v2
|
|
29
|
+
[*] --> GoalContract: Initialize
|
|
30
|
+
GoalContract --> MakerExecute: Iteration = 1
|
|
31
|
+
|
|
32
|
+
state "Iteration Loop" as Loop {
|
|
33
|
+
MakerExecute --> DeterministicChecks
|
|
34
|
+
DeterministicChecks --> MakerFix: Deterministic Fail
|
|
35
|
+
MakerFix --> DeterministicChecks
|
|
36
|
+
|
|
37
|
+
DeterministicChecks --> DevilsAdvocate: Deterministic Pass
|
|
38
|
+
DevilsAdvocate --> JudgeEvaluation
|
|
39
|
+
|
|
40
|
+
JudgeEvaluation --> PassState: Verdict = PASS
|
|
41
|
+
JudgeEvaluation --> MakerIterate: Verdict = ITERATE\n(Iteration < MAX_ITERATIONS)
|
|
42
|
+
MakerIterate --> DeterministicChecks
|
|
43
|
+
|
|
44
|
+
JudgeEvaluation --> EscalateState: Verdict = ESCALATE\n(Iteration >= MAX_ITERATIONS or Stalled)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
PassState --> [*]: Hand off to Adapter
|
|
48
|
+
EscalateState --> [*]: Pause for Human
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Iteration State Machine Steps
|
|
52
|
+
|
|
53
|
+
1. **Cycle Start (Iteration $K$)**:
|
|
54
|
+
- Increments iteration counter $K \leftarrow K + 1$.
|
|
55
|
+
- Verifies $K \le \text{MAX\_ITERATIONS}$. If $K > \text{MAX\_ITERATIONS}$, immediately triggers `ESCALATE`.
|
|
56
|
+
2. **Maker Refinement**:
|
|
57
|
+
- The [Maker Agent](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/maker.md) receives the prior iteration's triaged findings and Judge directives.
|
|
58
|
+
- Maker applies targeted code fixes and updates test suites.
|
|
59
|
+
3. **Deterministic Re-verification**:
|
|
60
|
+
- All tests, typecheck, lint, and build checks are re-executed from scratch.
|
|
61
|
+
4. **Adversarial Differential Review**:
|
|
62
|
+
- The [Devil's Advocate](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md) evaluates the updated diff against previously raised findings and checks for new regressions.
|
|
63
|
+
5. **Judge Evaluation & Progression**:
|
|
64
|
+
- The [Judge Agent](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/judge.md) compares findings from Iteration $K$ with Iteration $K-1$.
|
|
65
|
+
- If progress is verified and all criteria met $\rightarrow$ `PASS`.
|
|
66
|
+
- If new valid findings emerge but progress is demonstrated $\rightarrow$ `ITERATE` (if $K < \text{MAX\_ITERATIONS}$).
|
|
67
|
+
- If repeated findings or no progress detected $\rightarrow$ `ESCALATE`.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 4. Finding State Transitions
|
|
72
|
+
|
|
73
|
+
Every finding generated during iteration must progress through an explicit state lifecycle:
|
|
74
|
+
|
|
75
|
+
```mermaid
|
|
76
|
+
stateDiagram-v2
|
|
77
|
+
[*] --> NEW: Discovered by Reviewer
|
|
78
|
+
NEW --> TRIAGED_VALID: Verified with evidence
|
|
79
|
+
NEW --> TRIAGED_INVALID: Disproved with evidence
|
|
80
|
+
NEW --> TRIAGED_UNCERTAIN: Ambiguous requirement
|
|
81
|
+
|
|
82
|
+
TRIAGED_VALID --> RESOLVED: Fixed by Maker
|
|
83
|
+
RESOLVED --> VERIFIED: Re-tested & confirmed by DA/Judge
|
|
84
|
+
|
|
85
|
+
TRIAGED_INVALID --> CLOSED: Retained in log as false positive
|
|
86
|
+
TRIAGED_UNCERTAIN --> ESCALATED: Requires human clarification
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| State | Definition | Next Permissible Action |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `NEW` | Discovered by Devil's Advocate in current iteration | Judge / Maker triages against repository facts |
|
|
92
|
+
| `TRIAGED_VALID` | Confirmed real technical or contractual defect | Maker must apply code/test fix |
|
|
93
|
+
| `TRIAGED_INVALID` | Confirmed false positive / non-applicable suggestion | Closed; documented with explanation |
|
|
94
|
+
| `TRIAGED_UNCERTAIN` | Unclear business rule or contradictory requirement | Escalated to human user |
|
|
95
|
+
| `RESOLVED` | Maker has applied code fix and passing test | Re-evaluated by Devil's Advocate & Judge |
|
|
96
|
+
| `VERIFIED` | Confirmed completely resolved by Judge | Marked complete |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 5. Iteration State Preservation
|
|
101
|
+
|
|
102
|
+
To maintain continuity across sub-agent calls or tool invocations, each iteration MUST update a standardized state record containing:
|
|
103
|
+
|
|
104
|
+
1. **Current Iteration Number** ($K / N$).
|
|
105
|
+
2. **Active Finding Ledger**: Complete list of all findings with their current state.
|
|
106
|
+
3. **Cumulative Code Diff**: Total changes relative to base branch.
|
|
107
|
+
4. **Deterministic Run Results**: Exit codes and timestamped test outcomes.
|
|
108
|
+
5. **No-Progress Hash**: Signatures of active findings for stagnation detection.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Judge Policy Specification
|
|
2
|
+
|
|
3
|
+
## 1. Overview & Role Definition
|
|
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).
|
|
13
|
+
|
|
14
|
+
```mermaid
|
|
15
|
+
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
|
|
20
|
+
|
|
21
|
+
Judge --> Decision{Evaluate Rules}
|
|
22
|
+
|
|
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]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
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:
|
|
33
|
+
|
|
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.
|
|
36
|
+
|
|
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.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
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
|
|
60
|
+
|
|
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
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
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]`
|
|
97
|
+
|
|
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 |
|
|
118
|
+
|
|
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
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Project Initialization & Context Discovery Specification
|
|
2
|
+
|
|
3
|
+
## 1. Overview & Core Philosophy
|
|
4
|
+
|
|
5
|
+
The AI Engineering Loop enforces a clean architectural separation between **Deterministic Context Bootstrap** and **Agent Intelligence**:
|
|
6
|
+
|
|
7
|
+
> **"The CLI bootstraps and validates repository context. The AI Agent reasons over that context to execute the engineering lifecycle."**
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
flowchart TD
|
|
11
|
+
subgraph CLI [DETERMINISTIC CLI BOOTSTRAP: init / status / refresh]
|
|
12
|
+
Discover[Repository Discovery Engine] --> ContextGen[Generate .ai-engineering-loop/]
|
|
13
|
+
ContextGen --> Validate[Context Validation Engine]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Validate --> ContextDir[(.ai-engineering-loop/ Ground Truth)]
|
|
17
|
+
|
|
18
|
+
subgraph Agent [AI AGENT INTELLIGENCE: run]
|
|
19
|
+
ContextDir --> GoalContract[Stage 1: Goal Contract]
|
|
20
|
+
GoalContract --> RCA[Stage 2: Root Cause Analysis]
|
|
21
|
+
RCA --> Plan[Stage 3: Implementation Plan]
|
|
22
|
+
Plan --> Maker[Stage 4: Maker Agent: Code & Tests]
|
|
23
|
+
Maker --> Verify{Stage 5: Deterministic Verification}
|
|
24
|
+
Verify -->|Pass| DA[Stage 6: Devil's Advocate Review]
|
|
25
|
+
DA --> Judge[Stage 7: Judge Evaluation]
|
|
26
|
+
Judge -->|PASS| Adapter[Stage 8: Delivery Pipeline]
|
|
27
|
+
end
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. Operation Separation: `init` vs `run`
|
|
33
|
+
|
|
34
|
+
### The `init` Operation
|
|
35
|
+
- **Purpose**: Discovers repository characteristics, extracts manifest scripts, binds archetype profiles, and generates `.ai-engineering-loop/`.
|
|
36
|
+
- **Command**: `npx ai-engineering-loop init` (or `/ai-engineering-loop init`).
|
|
37
|
+
- **Boundaries**:
|
|
38
|
+
- `init` **MUST NOT** edit application code, write business logic, author unit tests, or run adversarial reviews.
|
|
39
|
+
- `init` **MUST NOT** commit to git, change branches, push to remotes, or open PRs.
|
|
40
|
+
- The only permitted file writes are within `<workspace-root>/.ai-engineering-loop/`.
|
|
41
|
+
- **Idempotency**: Running `init` repeatedly is safe. If context is already complete and valid, `init` is a non-destructive no-op.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### The `run` Operation
|
|
46
|
+
- **Purpose**: Consumes the ground truth in `.ai-engineering-loop/` to solve a specific user task.
|
|
47
|
+
- **Command**: `npx ai-engineering-loop run` (or `/ai-engineering-loop [task]`).
|
|
48
|
+
- **Boundaries**:
|
|
49
|
+
- The Agent reads `.ai-engineering-loop/` (triggering auto-init if missing).
|
|
50
|
+
- Formulates the [Goal Contract](file:///Users/egagofur/Development/work/ai-engineering-loop/core/goal-contract.md).
|
|
51
|
+
- Performs Root Cause Analysis (RCA) and Implementation Planning.
|
|
52
|
+
- Executes surgical diffs, runs deterministic test suites, conducts independent adversarial review via the [Devil's Advocate](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md), and obtains certification from the [Judge Agent](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/judge.md).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. Dual-State Initialization Flow
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
State A (Context Exists):
|
|
60
|
+
Inspect Health ──▶ Detect Drift ──▶ Selectively Refresh Stale Sections ──▶ Load
|
|
61
|
+
|
|
62
|
+
State B (Context Missing):
|
|
63
|
+
Inspect Topology ──▶ Manifests/Commands ──▶ Inferred Profile ──▶ Generate .ai-engineering-loop/ ──▶ Validate
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 4. The 5-Pass Discovery Engine
|
|
69
|
+
|
|
70
|
+
1. **Pass 1 (Topology & Profile)**:
|
|
71
|
+
- Identifies if Monorepo (`pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `Cargo.toml [workspace]`, `go.work`) or Single Application.
|
|
72
|
+
- Binds archetype profile: `web-app` | `backend-api` | `mobile-app` | `library` | `monorepo`.
|
|
73
|
+
2. **Pass 2 (Manifests & Verification Commands)**:
|
|
74
|
+
- Reads `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `pubspec.yaml`.
|
|
75
|
+
- Extracts exact CLI scripts: `test_unit`, `test_all`, `typecheck`, `lint`, `build`, `e2e`.
|
|
76
|
+
3. **Pass 3 (Architecture & Invariants)**:
|
|
77
|
+
- Maps ingress (controllers/routers/views), domain services, and database layers.
|
|
78
|
+
- Sets boundary invariant rules.
|
|
79
|
+
4. **Pass 4 (Conventions & Documentation)**:
|
|
80
|
+
- Identifies observed naming conventions, test file placement, error patterns.
|
|
81
|
+
- Cross-checks existing docs (`README.md`, `CONTRIBUTING.md`, `CLAUDE.md`, `AGENTS.md`) without blindly trusting contradictions.
|
|
82
|
+
5. **Pass 5 (Safety Audit & File Generation)**:
|
|
83
|
+
- Strictly ignores private credentials (`.env`, `.env.local`, `.pem`, tokens, API keys).
|
|
84
|
+
- Generates `.ai-engineering-loop/` (`config.md`, `architecture.md`, `conventions.md`, `verification.md`, `adapter.md`).
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 5. Version Control Recommendation
|
|
89
|
+
|
|
90
|
+
Because `.ai-engineering-loop/` represents the shared ground truth of a repository's engineering conventions, it is **strongly recommended to commit `.ai-engineering-loop/` to version control**:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
git add .ai-engineering-loop
|
|
94
|
+
git commit -m "chore: initialize AI Engineering Loop context"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This allows all team members and future AI agent sessions to share identical context without redundant discovery cycles.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Repository Configuration Schema (`.ai-engineering-loop/`)
|
|
2
|
+
|
|
3
|
+
## 1. Overview & Purpose
|
|
4
|
+
|
|
5
|
+
The `.ai-engineering-loop/` directory serves as the **Living Project Context** for autonomous agents working in a repository:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
<target-repository>/
|
|
9
|
+
└── .ai-engineering-loop/
|
|
10
|
+
├── metadata.json # Baseline tracking, git revisions, & manifest hashes
|
|
11
|
+
├── config.md # Basic project metadata, type, and stack
|
|
12
|
+
├── architecture.md # System architecture, layers, & boundaries
|
|
13
|
+
├── conventions.md # Code standards, patterns, & forbidden practices
|
|
14
|
+
├── verification.md # Exact CLI verification commands
|
|
15
|
+
└── adapter.md # Configured delivery pipeline & CI/CD tools
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. File Specifications
|
|
21
|
+
|
|
22
|
+
### 1. `metadata.json` — Context Baseline & Drift Tracking
|
|
23
|
+
Maintains lightweight state for instant drift detection:
|
|
24
|
+
- `contextVersion`: Schema version (e.g. `"1.0.0"`).
|
|
25
|
+
- `generatedAt`: ISO timestamp of initial generation.
|
|
26
|
+
- `repositoryRevision`: Full git commit SHA corresponding to this context baseline.
|
|
27
|
+
- `projectProfile`: Active archetype profile (`web-app`, `backend-api`, `mobile-app`, `library`, `monorepo`).
|
|
28
|
+
- `manifestChecksums`: Hash map of manifest files (`package.json`, `go.mod`, `Cargo.toml`).
|
|
29
|
+
- `lastReconciliation`: Timestamp, trigger, and impact of the last update.
|
|
30
|
+
|
|
31
|
+
### 2. `config.md` — Project Identity & Metadata
|
|
32
|
+
- `project_name`: Name of the repository / service.
|
|
33
|
+
- `project_profile`: Bound profile archetype.
|
|
34
|
+
- `languages`: Primary languages and versions.
|
|
35
|
+
- `frameworks`: Core runtime frameworks.
|
|
36
|
+
- `package_manager`: Detected package manager (`pnpm`, `npm`, `yarn`, `bun`, `cargo`, `go`, `poetry`).
|
|
37
|
+
- `default_base_branch`: Primary target branch (`main`, `master`, `develop`).
|
|
38
|
+
- `observed_evidence`: File paths used to infer project identity.
|
|
39
|
+
|
|
40
|
+
### 3. `architecture.md` — System Design & Boundaries
|
|
41
|
+
- **Presentation / Ingress**: UI components, API routers, controllers.
|
|
42
|
+
- **Application / Domain**: Services, business logic actions, use cases.
|
|
43
|
+
- **Data Access**: Repositories, ORMs, query builders, cache stores.
|
|
44
|
+
- **Infrastructure / Integrations**: External third-party APIs, message brokers, queues.
|
|
45
|
+
- **Critical Boundaries**: Rules regarding circular dependencies and forbidden layer leaps.
|
|
46
|
+
- **Evidence & Confidence**: Observed directories and confidence rating (`HIGH`, `MEDIUM`, `LOW`).
|
|
47
|
+
|
|
48
|
+
### 4. `conventions.md` — Engineering Standards & Invariants
|
|
49
|
+
- **Design System / UI Tokens**: Approved token sets, component libraries.
|
|
50
|
+
- **Naming Conventions**: File naming (`kebab-case`, `PascalCase`), interface naming, test file suffixes.
|
|
51
|
+
- **Error Handling Patterns**: Standard error classes, result types, domain exceptions.
|
|
52
|
+
- **Forbidden Anti-Patterns**: Explicit list of banned practices.
|
|
53
|
+
|
|
54
|
+
### 5. `verification.md` — Deterministic Commands
|
|
55
|
+
- `test_unit`: Command for focused unit testing.
|
|
56
|
+
- `test_all`: Command for full regression suite.
|
|
57
|
+
- `typecheck`: Command for static typechecking (`tsc --noEmit`, `mypy`).
|
|
58
|
+
- `lint`: Command for linting with auto-fix.
|
|
59
|
+
- `build`: Command for production bundle / binary compilation.
|
|
60
|
+
- `e2e`: (Optional) End-to-end / browser test command.
|
|
61
|
+
|
|
62
|
+
### 6. `adapter.md` — Delivery Pipeline Configuration
|
|
63
|
+
- `adapter_type`: Configured adapter (`dot`, `github`, `gitlab`, `standard`).
|
|
64
|
+
- `remote_repository`: Git remote repository slug.
|
|
65
|
+
- `default_target_branch`: Base target branch.
|
|
66
|
+
- `ci_provider`: Detected CI engine (GitHub Actions, GitLab CI).
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 3. Version Control Recommendation
|
|
71
|
+
|
|
72
|
+
It is strongly recommended to **commit the `.ai-engineering-loop/` directory (including `metadata.json`) to git**. This ensures all developers and AI agent sessions share consistent, up-to-date repository context without repeated re-discovery overhead.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Verification Loop Specification
|
|
2
|
+
|
|
3
|
+
## 1. Overview
|
|
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**.
|
|
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`).
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
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`.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
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**.
|
|
72
|
+
|
|
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.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
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).
|
|
95
|
+
|
|
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.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Antigravity Sub-Agent Feasibility & Execution Strategy
|
|
2
|
+
|
|
3
|
+
## 1. Executive Summary
|
|
4
|
+
|
|
5
|
+
This document evaluates the practical feasibility of executing the **AI Engineering Loop** (Maker, Devil's Advocate, Judge) inside the **Google Antigravity IDE / Agentic Platform**, addressing runtime capabilities, context segregation, token economics, and persistence.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 2. Analysis of the 8 Core Questions
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
flowchart TD
|
|
13
|
+
Main[Antigravity Primary Agent / Planner] -->|Spawn / Invoke| SubDA[Sub-Agent / Persona: Devil's Advocate]
|
|
14
|
+
Main -->|Spawn / Invoke| SubJD[Sub-Agent / Persona: Judge]
|
|
15
|
+
|
|
16
|
+
SubDA -->|Reads Same Workspace & Git Diff| Repo[(Workspace Files & Git)]
|
|
17
|
+
SubDA -->|Returns Finding Ledger| Main
|
|
18
|
+
|
|
19
|
+
Main -->|Evaluates with Judge Policy| SubJD
|
|
20
|
+
SubJD -->|Returns PASS / ITERATE / ESCALATE| Main
|
|
21
|
+
|
|
22
|
+
Main -->|Persists State Artifacts| BrainDir[(brain/<conversation_id>/)]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 1. Can Antigravity summon independent sub-agents?
|
|
26
|
+
- **Status**: **YES**.
|
|
27
|
+
- **Mechanism**: Antigravity natively supports agentic delegation through sub-agents (e.g. `invoke_subagent` / `browser_subagent` / background tasks). Sub-agents execute with their own independent message loops, instructions, and tool sets.
|
|
28
|
+
- **Alternative / Fallback**: If subagent spawning is constrained in a single-agent CLI mode, Antigravity agents can execute **Context-Switched Multi-Turn Personas** by clearing operational context, adopting strict role instructions, and evaluating the isolated `git diff`.
|
|
29
|
+
|
|
30
|
+
### 2. Can the main agent pass context to a sub-agent?
|
|
31
|
+
- **Status**: **YES**.
|
|
32
|
+
- **Mechanism**: The spawning task payload allows passing:
|
|
33
|
+
- The [Goal Contract](file:///Users/egagofur/Development/work/ai-engineering-loop/core/goal-contract.md).
|
|
34
|
+
- Target base branch name (`main`, `develop`).
|
|
35
|
+
- Active iteration index and finding ledger history.
|
|
36
|
+
|
|
37
|
+
### 3. Can the sub-agent inspect the same repository?
|
|
38
|
+
- **Status**: **YES**.
|
|
39
|
+
- **Mechanism**: Sub-agents share the active workspace root (`/Users/.../ai-engineering-loop`). They have access to `view_file`, `grep_search`, `list_dir`, and `run_command` (`git diff`, `git log`, `npx jest`, etc.).
|
|
40
|
+
|
|
41
|
+
### 4. Can the sub-agent return structured findings?
|
|
42
|
+
- **Status**: **YES**.
|
|
43
|
+
- **Mechanism**: The sub-agent is instructed to output strictly formatted YAML/Markdown compliant with the [Finding Policy](file:///Users/egagofur/Development/work/ai-engineering-loop/policies/finding-policy.md). Upon task completion, the structured output is delivered directly back into the primary agent's context.
|
|
44
|
+
|
|
45
|
+
### 5. Can the main agent consume those findings?
|
|
46
|
+
- **Status**: **YES**.
|
|
47
|
+
- **Mechanism**: The primary agent parses the returned Finding Ledger, updates the iteration state artifact, and feeds the findings into the [Judge Agent](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/judge.md).
|
|
48
|
+
|
|
49
|
+
### 6. Can the loop be repeated automatically?
|
|
50
|
+
- **Status**: **YES**.
|
|
51
|
+
- **Mechanism**: Antigravity's autonomous loop executes sequentially until the Judge outputs `PASS` or triggers `ESCALATE`. The loop does not require human intervention between iterations unless an escalation trigger is activated.
|
|
52
|
+
|
|
53
|
+
### 7. Can iteration state be persisted?
|
|
54
|
+
- **Status**: **YES**.
|
|
55
|
+
- **Mechanism**: Antigravity provides a dedicated per-conversation artifact directory:
|
|
56
|
+
`<appDataDir>/brain/<conversation-id>/`
|
|
57
|
+
The loop persists:
|
|
58
|
+
- `goal_contract.md`
|
|
59
|
+
- `iteration_ledger.json` (finding signatures, iteration index, diff hashes)
|
|
60
|
+
- `verification_logs.txt`
|
|
61
|
+
- `judge_verdict.md`
|
|
62
|
+
|
|
63
|
+
### 8. What are the practical token/context limitations?
|
|
64
|
+
- **Analysis**:
|
|
65
|
+
- Full codebase context in every prompt leads to context bloat and degraded attention.
|
|
66
|
+
- **Optimization Strategy**:
|
|
67
|
+
- Pass only the `Goal Contract` + `git diff <base>...HEAD` to the Devil's Advocate, not the entire conversation history.
|
|
68
|
+
- Retain finding signatures and summaries rather than full raw chat transcripts.
|
|
69
|
+
- Run deterministic checks with summarized test output (failing tests in detail, passing suites as totals).
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 3. Recommended Execution Modes in Antigravity
|
|
74
|
+
|
|
75
|
+
| Dimension | Mode A: Native Sub-Agents (Recommended) | Mode B: Persona Context Switching |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| **Context Isolation** | 100% Isolated context window | Sequential turns within single context |
|
|
78
|
+
| **Cognitive Bias** | Zero author bias (clean slate) | Low bias if context is scoped to diff |
|
|
79
|
+
| **Token Overhead** | Minimal (sub-agent starts fresh) | Moderate (context grows across turns) |
|
|
80
|
+
| **Implementation Complexity** | Requires subagent invocation tool | Works natively in standard chat turn |
|
|
81
|
+
| **Antigravity Fit** | Ideal for complex multi-file features | Ideal for quick, surgical fixes |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 4. Implementation Roadmap for Antigravity Skill
|
|
86
|
+
|
|
87
|
+
To deploy this workflow as an Antigravity Custom Skill (e.g. `skills/ai-engineering-loop/SKILL.md`):
|
|
88
|
+
1. Package the core loop into an executable skill definition with YAML frontmatter.
|
|
89
|
+
2. Provide slash command shortcuts (e.g. `/loop:start`, `/loop:review`).
|
|
90
|
+
3. Bind the DOT Adapter as an opt-in release plugin when working inside DOT repositories.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Migration Plan: Legacy 8-Phase Workflow to AI Engineering Loop
|
|
2
|
+
|
|
3
|
+
## 1. Overview & Migration Objectives
|
|
4
|
+
|
|
5
|
+
The legacy `dot-dev-workflow` established a strong 8-phase engineering foundation across DOT codebases. However, it tightly coupled generic engineering principles (root cause analysis, surgical diffs, unit testing, static typing) with company-specific delivery tooling (GitLab, `glab`, `@coreview-bot`, Mattermost).
|
|
6
|
+
|
|
7
|
+
This migration plan maps every single phase of the legacy workflow into the new modular architecture, ensuring that **zero engineering rigor is lost** while achieving complete platform independence.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 2. Comprehensive Phase-by-Phase Mapping
|
|
12
|
+
|
|
13
|
+
```mermaid
|
|
14
|
+
flowchart TD
|
|
15
|
+
subgraph LegacyWorkflow [Legacy 8-Phase Workflow]
|
|
16
|
+
L1[Phase 1: Root Cause Analysis]
|
|
17
|
+
L2[Phase 2: Collaborative Alignment]
|
|
18
|
+
L3[Phase 3: Surgical Code Fix]
|
|
19
|
+
L4[Phase 4: Unit Testing]
|
|
20
|
+
L5[Phase 5: Typecheck & Build]
|
|
21
|
+
L6[Phase 6: Multi-Branch glab MRs]
|
|
22
|
+
L7[Phase 7: @coreview-bot Triage]
|
|
23
|
+
L8[Phase 8: Mattermost Report]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
subgraph NewArchitecture [AI Engineering Loop + DOT Adapter]
|
|
27
|
+
GC[core/goal-contract.md]
|
|
28
|
+
MA[agents/maker.md]
|
|
29
|
+
VL[core/verification-loop.md]
|
|
30
|
+
DA[agents/devil-advocate.md]
|
|
31
|
+
JD[agents/judge.md]
|
|
32
|
+
AD_GL[adapters/dot/gitlab.md]
|
|
33
|
+
AD_MB[adapters/dot/multi-branch.md]
|
|
34
|
+
AD_CV[adapters/dot/coreview.md]
|
|
35
|
+
AD_MM[adapters/dot/mattermost.md]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
L1 --> MA
|
|
39
|
+
L2 --> GC
|
|
40
|
+
L3 --> MA
|
|
41
|
+
L4 --> VL
|
|
42
|
+
L5 --> VL
|
|
43
|
+
L6 --> AD_GL & AD_MB
|
|
44
|
+
L7 --> DA & AD_CV
|
|
45
|
+
L8 --> AD_MM
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 3. Detailed Mapping Matrix
|
|
51
|
+
|
|
52
|
+
| Legacy Phase | New Architecture Placement | Action (`Keep / Modify / Move / Remove`) | Detailed Rationale |
|
|
53
|
+
|---|---|:---:|---|
|
|
54
|
+
| **Phase 1: Comprehensive Code & Root Cause Analysis** | `agents/maker.md` & `core/goal-contract.md` | **MODIFY & KEEP** | End-to-end data tracing, git history examination (`git log -n 5 -p`), and blind spot identification are preserved in the Maker Agent. The output feeds directly into formalizing the Goal Contract. |
|
|
55
|
+
| **Phase 2: Collaborative Alignment & Brainstorming** | `core/goal-contract.md` | **MODIFY & KEEP** | Upgraded from informal conversational alignment to a binding, machine-verifiable [Goal Contract](file:///Users/egagofur/Development/work/ai-engineering-loop/core/goal-contract.md) containing explicit Acceptance Criteria, constraints, and out-of-scope declarations. |
|
|
56
|
+
| **Phase 3: Surgical & Clean Code Fixing** | `agents/maker.md` & `core/definition-of-done.md` | **KEEP** | Preserves core quality rules: smallest coherent diff, zero dead code, zero speculative abstractions, adhering to existing architectural conventions and design tokens. |
|
|
57
|
+
| **Phase 4: Unit Testing & Boundary Coverage** | `core/verification-loop.md` (Gate 1) & `agents/maker.md` | **KEEP** | Retains 100% test pass requirement, boundary condition testing, null/undefined safety, and edge-case permutations as Deterministic Gate 1. |
|
|
58
|
+
| **Phase 5: Build & Type Safety Verification** | `core/verification-loop.md` (Gates 2, 3, 4) | **KEEP** | Retains `tsc --noEmit` and `eslint --fix` as mandatory machine-checked gates that must pass prior to review. |
|
|
59
|
+
| **Phase 6: Multi-Branch MR & Issue Card via `glab` CLI** | `adapters/dot/gitlab.md` & `adapters/dot/multi-branch.md` | **MOVE TO ADAPTER** | Moved out of generic core into the DOT Adapter. The core loop remains platform-agnostic, while DOT adapter encapsulates `glab issue create`, `glab mr create`, and cherry-picking to `staging` and `develop`. |
|
|
60
|
+
| **Phase 7: Automated Bot Review Triage (`@coreview-bot`)** | `agents/devil-advocate.md` (Internal) + `adapters/dot/coreview.md` (External) | **SPLIT & MOVE** | The concept of adversarial review is promoted to the generic core as the internal [Devil's Advocate Agent](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md) (runs *before* opening MR). The external `@coreview-bot` triage (`VALID` vs `HALU`) is moved to `adapters/dot/coreview.md` (runs *after* opening MR). |
|
|
61
|
+
| **Phase 8: Mattermost Markdown Report & Auto-Send via MCP** | `adapters/dot/mattermost.md` | **MOVE TO ADAPTER** | Moved out of generic core into the DOT Adapter. Preserves channel mapping lookup (`mattermost-channel-mapping.json`), fallback prompt, and MCP `mattermost_send_message` dispatch with `from: "AI Agent"`. |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 4. Key Improvements over Legacy Workflow
|
|
66
|
+
|
|
67
|
+
1. **Elimination of Self-Certification**: In the legacy workflow, the same agent that wrote code decided it was done. In the new architecture, only the independent [Judge Agent](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/judge.md) can grant a `PASS` verdict.
|
|
68
|
+
2. **Pre-MR Adversarial Inspection**: Flaws are caught and fixed locally via the [Devil's Advocate](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md) *before* publishing PRs/MRs to remote repositories.
|
|
69
|
+
3. **No-Progress & Escalation Circuit Breakers**: Bounded iterations (`MAX_ITERATIONS = 3`) and [No-Progress Detection](file:///Users/egagofur/Development/work/ai-engineering-loop/policies/no-progress-policy.md) prevent runaway loops and thrashing.
|
|
70
|
+
4. **Pluggable Architecture**: The same generic core loop can now be used with GitHub, Bitbucket, Jira, Linear, or Slack simply by swapping adapters.
|