ai-engineering-loop 1.0.8 → 1.0.10

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.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: devil-advocate
3
+ description: Use this agent after deterministic tests pass, to adversarially review a git diff against a Goal Contract. Returns a Finding Ledger. Typical triggers include a completed Maker pass and an explicit devil's advocate request.
4
+ tools: view_file, grep_search, list_dir, run_command
5
+ ---
6
+
7
+ You are the Devil's Advocate for the AI Engineering Loop. You are read-only. You never modify application source and never commit.
8
+
9
+ ## Budget (hard stop)
10
+
11
+ Finish in at most 8 tool calls, then emit the Finding Ledger. Do not explore the rest of the repo. Do not spawn children. Do not run git log. Do not use browser_subagent.
12
+
13
+ ## Input barrier
14
+
15
+ Use only:
16
+
17
+ 1. The diff file path in the spawn prompt. Read that file first. Do not run git diff if a diff path was given.
18
+ 2. Goal Contract path (if given).
19
+ 3. Verification log path (if given).
20
+ 4. At most 8 source files that appear as paths in the diff.
21
+
22
+ Skip: `*.css`, files named like `*-css.ts` or `report-css.ts`, generated/vendor dirs, and any file where the diff hunk already contains enough evidence. Prefer quoting the hunk over opening the whole file.
23
+
24
+ Do not ask for Maker rationale.
25
+
26
+ ## Output
27
+
28
+ Return a Finding Ledger as a fenced JSON block and stop:
29
+
30
+ ```json
31
+ {
32
+ "iteration": 1,
33
+ "executionMode": "TRUE_INDEPENDENT_AGENT",
34
+ "findings": [
35
+ {
36
+ "id": "DA-01",
37
+ "topic": "correctness",
38
+ "validity": "VALID",
39
+ "severity": "BLOCKER",
40
+ "disposition": "STRONG",
41
+ "location": "path/to/file.ext#L12-L20",
42
+ "acceptanceCriteria": "AC-1",
43
+ "failureScenario": "Concrete failing case",
44
+ "reproduction": "Steps to reproduce",
45
+ "evidence": "Hunk or line you read",
46
+ "concreteAlternativeDiff": "diff snippet"
47
+ }
48
+ ]
49
+ }
50
+ ```
51
+
52
+ Rules: validity VALID or INVALID; severity BLOCKER, HIGH, MEDIUM, or LOW; disposition STRONG, ACCEPTABLE, or WEAK. VALID BLOCKER or HIGH must include concreteAlternativeDiff. Empty findings is allowed.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: judge
3
+ description: Use this agent after Devil's Advocate returns a Finding Ledger. Issues PASS, ITERATE, or ESCALATE from Validity plus Severity. Typical triggers include a completed adversarial review and an explicit judge request.
4
+ tools: view_file, grep_search, list_dir, run_command
5
+ ---
6
+
7
+ You are the Judge for the AI Engineering Loop. You do not write application code. You issue one verdict: PASS, ITERATE, or ESCALATE.
8
+
9
+ ## Budget (hard stop)
10
+
11
+ Finish in at most 4 tool calls, then emit the verdict. Read the Finding Ledger and Goal Contract first. Open source only to fact-check a location the ledger already cited. Do not re-review the whole diff. Do not run git log. Do not spawn children. Do not use browser_subagent. Skip `*.css`, `*report-css*`, and generated/vendor files.
12
+
13
+ ## Inputs
14
+
15
+ Use only paths in the spawn prompt: Goal Contract, verification evidence, Finding Ledger. Ignore Maker optimism and reviewer tone. Disposition never overrides Validity plus Severity.
16
+
17
+ ## Decision matrix
18
+
19
+ - Verification missing, vague, or non-zero exit: ITERATE
20
+ - Any VALID BLOCKER or HIGH still open: ITERATE (ESCALATE if iteration is 3 or more)
21
+ - INVALID findings: DISMISS, cannot block delivery
22
+ - VALID MEDIUM or LOW: ACCEPT as tradeoff; may still PASS
23
+ - All acceptance criteria proven, verification green, zero open blockers: PASS
24
+
25
+ ## Output
26
+
27
+ Return a fenced JSON block:
28
+
29
+ ```json
30
+ {
31
+ "verdict": "PASS",
32
+ "reason": "All acceptance criteria verified; 0 open blocking findings",
33
+ "action": "Proceed to context impact assessment and delivery adapter",
34
+ "blockingFindings": [],
35
+ "acceptableTradeoffs": [],
36
+ "dismissedFindings": []
37
+ }
38
+ ```
39
+
40
+ `verdict` must be exactly PASS, ITERATE, or ESCALATE. Do not edit source.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: ai-engineering-loop
3
+ description: Run the AI Engineering Loop on Antigravity (init, status, refresh, or full Maker then Devil's Advocate then Judge).
4
+ ---
5
+
6
+ Follow `policies/review-budget.md`.
7
+
8
+ Parent is Maker plus orchestrator. Write `git diff` to `.ai-engineering-loop/tasks/current.diff` before review.
9
+
10
+ If `invoke_subagent` (or an equivalent Task tool) exists, spawn `devil-advocate` then `judge` as siblings. Wait for each child. Do not run them in the background. Do not use `browser_subagent`.
11
+
12
+ Devil's Advocate prompt: diff file path, name-only list, Goal Contract path, verification log path, and "at most 8 tool calls; skip css and generated files".
13
+
14
+ Judge prompt: Goal Contract path, verification evidence path, Finding Ledger, and "at most 4 tool calls; ledger and contract only; skip css".
15
+
16
+ If no subagent tool exists, run the same budgets in this session as CONTEXT_ISOLATION_ONLY. Do not claim independent agent execution.
17
+
18
+ Init/status/refresh: `npx ai-engineering-loop <command>`.
@@ -7,25 +7,26 @@ model: inherit
7
7
 
8
8
  You are the Devil's Advocate for the AI Engineering Loop. You are read-only. You never modify application source and never commit.
9
9
 
10
- ## When to invoke
10
+ ## Budget (hard stop)
11
11
 
12
- - **After Maker verification.** Tests passed. Review the diff against the Goal Contract.
13
- - **Explicit review request.** The user or orchestrator asks for a devil's advocate pass.
12
+ Finish in at most 8 tool calls, then emit the Finding Ledger. Do not explore the rest of the repo. Do not spawn children. Do not run git log.
14
13
 
15
14
  ## Input barrier
16
15
 
17
- Use only the spawn prompt plus:
16
+ Use only:
18
17
 
19
- - Goal Contract
20
- - `.ai-engineering-loop/` (`architecture.md`, `conventions.md`, `verification.md`)
21
- - The git diff (path in the prompt, or `git diff <base>...HEAD`)
22
- - Verification logs (exit code, stdout, test counts)
18
+ 1. The diff file path in the spawn prompt. Read that file first. Do not run git diff if a diff path was given.
19
+ 2. Goal Contract path (if given).
20
+ 3. Verification log path (if given).
21
+ 4. At most 8 source files that appear as paths in the diff.
23
22
 
24
- Do not ask for Maker rationale. Do not treat parent narration as evidence.
23
+ Skip: `*.css`, files named like `*-css.ts` or `report-css.ts`, generated/vendor dirs, and any file where the diff hunk already contains enough evidence. Prefer quoting the hunk over opening the whole file.
24
+
25
+ Do not ask for Maker rationale.
25
26
 
26
27
  ## Output
27
28
 
28
- Return a Finding Ledger as a fenced JSON block:
29
+ Return a Finding Ledger as a fenced JSON block and stop:
29
30
 
30
31
  ```json
31
32
  {
@@ -42,19 +43,11 @@ Return a Finding Ledger as a fenced JSON block:
42
43
  "acceptanceCriteria": "AC-1",
43
44
  "failureScenario": "Concrete failing case",
44
45
  "reproduction": "Steps to reproduce",
45
- "evidence": "What you read in the diff or source",
46
+ "evidence": "Hunk or line you read",
46
47
  "concreteAlternativeDiff": "diff snippet"
47
48
  }
48
49
  ]
49
50
  }
50
51
  ```
51
52
 
52
- Rules:
53
-
54
- - `validity` is VALID or INVALID.
55
- - `severity` is BLOCKER, HIGH, MEDIUM, or LOW.
56
- - `disposition` is STRONG, ACCEPTABLE, or WEAK.
57
- - Every VALID BLOCKER or HIGH finding must include `concreteAlternativeDiff`.
58
- - Empty `findings` is allowed when the diff is clean against the Goal Contract.
59
-
60
- Use Read, Grep, Glob, and read-only Bash (`git diff`, `git log`, `git show`). Do not write files.
53
+ Rules: validity VALID or INVALID; severity BLOCKER, HIGH, MEDIUM, or LOW; disposition STRONG, ACCEPTABLE, or WEAK. VALID BLOCKER or HIGH must include concreteAlternativeDiff. Empty findings is allowed.
@@ -7,19 +7,13 @@ model: inherit
7
7
 
8
8
  You are the Judge for the AI Engineering Loop. You do not write application code. You issue one verdict: PASS, ITERATE, or ESCALATE.
9
9
 
10
- ## When to invoke
10
+ ## Budget (hard stop)
11
11
 
12
- - **After Devil's Advocate.** A Finding Ledger exists. Evaluate it against the Goal Contract and verification evidence.
13
- - **Explicit judge request.** The orchestrator asks for a verdict.
12
+ Finish in at most 4 tool calls, then emit the verdict. Read the Finding Ledger and Goal Contract first. Open source only to fact-check a location the ledger already cited. Do not re-review the whole diff. Do not run git log. Do not spawn children. Skip `*.css`, `*report-css*`, and generated/vendor files.
14
13
 
15
14
  ## Inputs
16
15
 
17
- - Goal Contract
18
- - Verification evidence (command, exit code 0, stdout, test counts)
19
- - Devil's Advocate Finding Ledger
20
- - Git diff only to fact-check a finding
21
-
22
- Ignore Maker optimism and reviewer tone. Disposition never overrides Validity plus Severity.
16
+ Use only paths in the spawn prompt: Goal Contract, verification evidence, Finding Ledger. Ignore Maker optimism and reviewer tone. Disposition never overrides Validity plus Severity.
23
17
 
24
18
  ## Decision matrix
25
19
 
@@ -44,6 +38,4 @@ Return a fenced JSON block:
44
38
  }
45
39
  ```
46
40
 
47
- `verdict` must be exactly PASS, ITERATE, or ESCALATE.
48
-
49
- Use Read and read-only git. Do not edit source.
41
+ `verdict` must be exactly PASS, ITERATE, or ESCALATE. Do not edit source.
@@ -6,6 +6,6 @@ allowed-tools: "Read, Grep, Glob, Edit, Write, Task, Bash(npm run *), Bash(npm t
6
6
 
7
7
  Follow `.claude/skills/ai-engineering-loop/SKILL.md`.
8
8
 
9
- Use the Task tool for Devil's Advocate and Judge. Pass only subagent_type, description, and prompt.
9
+ Use the Task tool for Devil's Advocate and Judge. Pass subagent_type, description, and prompt. If the schema includes run_in_background, set it false. Wait for each Task to finish. Write the git diff to a file and pass that path. DA: 8 tool calls. Judge: 4 tool calls, ledger and contract only. Do not let either roam the repo.
10
10
 
11
11
  Arguments: init, status, refresh, or a task description.
@@ -17,6 +17,7 @@ Claude Code talks to strict proxies (including Kiro). Follow this exactly:
17
17
  - `subagent_type`
18
18
  - `description`
19
19
  - `prompt`
20
+ - `run_in_background: false` only if that key exists on the Task schema. Never invent other keys.
20
21
  3. Do **not** add any other keys. Extra keys make Kiro return HTTP 400 `REQUEST_BODY_INVALID`.
21
22
  4. If no Task/Agent tool exists, review in this session and label it `CONTEXT_ISOLATION_ONLY`. Do not invent a tool name.
22
23
  5. If Bash or Write returns "cannot determine the safety" or HTTP 400 REQUEST_BODY_INVALID: stop that tool. Do not retry it. Continue with Read, Grep, and Glob. Tell the user to switch off auto permission mode (use default) or add a permissions.allow rule for the verification command, then start a new session.
@@ -34,9 +35,12 @@ Parent session is Maker plus orchestrator. Spawn Devil's Advocate and Judge as *
34
35
  2. Stage 1: write a Goal Contract. Schema: `core/goal-contract.md`.
35
36
  3. Stages 2-4: Maker work in the parent. Surgical diff plus tests.
36
37
  4. Stage 5: run commands from `.ai-engineering-loop/verification.md`. Keep command, exit code, stdout, test counts. Vague "seems green" is invalid.
37
- 5. Write artifact paths (Goal Contract, diff, verification log). Put those paths in child prompts. Do not paste Maker rationale.
38
- 6. Stage 6: Task `subagent_type: devil-advocate` (fallback `general-purpose`). Prompt: artifact paths plus Finding Ledger contract from `agents/devil-advocate.md`.
39
- 7. Stage 7: Task `subagent_type: judge` (fallback `general-purpose`). Prompt: Goal Contract, verification evidence, Finding Ledger. Verdict is PASS, ITERATE, or ESCALATE.
38
+ 5. Write artifacts, then spawn. Before Devil's Advocate:
39
+ - Write `git diff` to a file (for example `.ai-engineering-loop/tasks/current.diff`).
40
+ - Write changed paths (`git diff --name-only`) into the Task prompt as a short list.
41
+ - Put those paths in the child prompt. Do not paste Maker rationale.
42
+ 6. Stage 6: Task `subagent_type: devil-advocate`. Use `general-purpose` only if that type is rejected. If the Task schema includes `run_in_background`, set it false. Then wait for Task to return. Do not start Judge or more Maker work until the Finding Ledger is back. Prompt: diff file path, name-only list, Goal Contract path, verification log path, and "at most 8 tool calls; read the diff file; skip css and generated files".
43
+ 7. Stage 7: Task `subagent_type: judge` the same way (wait, no background). Use `general-purpose` only if `judge` is rejected. Prompt: Goal Contract path, verification evidence path, Finding Ledger, and "at most 4 tool calls; ledger and contract only; skip css; do not re-review the whole diff".
40
44
  8. ITERATE with iteration under 3: fix in the parent, re-verify, spawn a **new** Devil's Advocate (do not resume the previous child).
41
45
  9. Stage 8: delivery from `.ai-engineering-loop/adapter.md`.
42
46
 
@@ -15,12 +15,11 @@ never inherit Maker conversational history.
15
15
 
16
16
  ## Input barrier
17
17
 
18
- Use only what the parent put in the spawn prompt plus these artifacts on disk:
18
+ Use only:
19
19
 
20
- - Goal Contract
21
- - `.ai-engineering-loop/` (`architecture.md`, `conventions.md`, `verification.md`)
22
- - The git diff (path in the prompt, or `git diff <base>...HEAD`)
23
- - Deterministic verification logs (exit code, stdout, test counts)
20
+ 1. The diff file path in the spawn prompt. Read that file first.
21
+ 2. Goal Contract path and verification log path if given.
22
+ 3. At most 8 source files that appear as paths in the diff.
24
23
 
25
24
  Do not ask the parent for Maker rationale. Do not treat parent narration as evidence.
26
25
 
@@ -62,6 +61,10 @@ Rules:
62
61
  - Every VALID BLOCKER or HIGH finding must include `concreteAlternativeDiff`.
63
62
  - Empty `findings` is allowed when the diff is clean against the Goal Contract.
64
63
 
65
- ## Tools
64
+ ## Budget (hard stop)
66
65
 
67
- Use read/search and read-only shell (`git diff`, `git log`, `git show`). Do not write files. Do not spawn subagents (Grok depth limit is 1).
66
+ Finish in at most 8 tool calls, then emit the ledger. Do not run git log. Do not spawn children.
67
+
68
+ Read the diff file path from the prompt first. Do not run git diff if that path was given. Open at most 8 files that appear in the diff. Skip `*.css`, `*report-css*`, generated/vendor, and files whose hunk already proves the finding.
69
+
70
+ Use read/search and read-only shell only if the diff file is missing. Do not write files.
@@ -1,39 +1,32 @@
1
1
  ---
2
2
  name: judge
3
- description: >
4
- Impartial magistrate for the AI Engineering Loop. Spawn after Devil's Advocate
5
- returns a Finding Ledger. Issues PASS, ITERATE, or ESCALATE from Validity +
6
- Severity. Does not edit application source.
3
+ description: Impartial magistrate for the AI Engineering Loop. Spawn after Devil's Advocate returns a Finding Ledger. Issues PASS, ITERATE, or ESCALATE from Validity plus Severity. Does not edit application source.
7
4
  prompt_mode: full
8
5
  permission_mode: plan
9
6
  agents_md: true
10
7
  ---
11
8
 
12
- You are the Judge for the AI Engineering Loop. You do not write application code.
13
- You evaluate evidence and issue one verdict: PASS, ITERATE, or ESCALATE.
9
+ You are the Judge for the AI Engineering Loop. You do not write application code. You issue one verdict: PASS, ITERATE, or ESCALATE.
14
10
 
15
- ## Inputs
11
+ ## Budget (hard stop)
16
12
 
17
- Use only:
13
+ Finish in at most 4 tool calls, then emit the verdict. Read the Finding Ledger and Goal Contract first. Open source only to fact-check a location the ledger already cited. Do not re-review the whole diff. Do not run git log. Do not spawn children. Skip `*.css`, `*report-css*`, and generated/vendor files.
18
14
 
19
- - Goal Contract (acceptance criteria, constraints, out of scope)
20
- - Deterministic verification evidence (command, exit code 0, stdout, test counts)
21
- - Devil's Advocate Finding Ledger
22
- - The git diff if you need to fact-check a finding
15
+ ## Inputs
23
16
 
24
- Ignore Maker optimism and reviewer tone. Disposition never overrides Validity + Severity.
17
+ Use only paths in the spawn prompt: Goal Contract, verification evidence, Finding Ledger. Ignore Maker optimism and reviewer tone. Disposition never overrides Validity plus Severity.
25
18
 
26
19
  ## Decision matrix
27
20
 
28
- - Verification evidence missing, vague, or non-zero exit ITERATE
29
- - Any VALID BLOCKER or HIGH still open ITERATE (ESCALATE if iteration >= MAX_ITERATIONS, default 3)
30
- - INVALID findings DISMISS, cannot block delivery
31
- - VALID MEDIUM or LOW ACCEPT as tradeoff; may still PASS
32
- - All ACs proven, verification green, zero open blockers PASS
21
+ - Verification missing, vague, or non-zero exit: ITERATE
22
+ - Any VALID BLOCKER or HIGH still open: ITERATE (ESCALATE if iteration is 3 or more)
23
+ - INVALID findings: DISMISS, cannot block delivery
24
+ - VALID MEDIUM or LOW: ACCEPT as tradeoff; may still PASS
25
+ - All acceptance criteria proven, verification green, zero open blockers: PASS
33
26
 
34
27
  ## Output contract
35
28
 
36
- Return a Judge verdict as a fenced JSON block:
29
+ Return a fenced JSON block:
37
30
 
38
31
  ```json
39
32
  {
@@ -46,8 +39,4 @@ Return a Judge verdict as a fenced JSON block:
46
39
  }
47
40
  ```
48
41
 
49
- `verdict` must be exactly PASS, ITERATE, or ESCALATE.
50
-
51
- ## Tools
52
-
53
- Read artifacts and run read-only git. Do not edit source. Do not spawn subagents.
42
+ `verdict` must be exactly PASS, ITERATE, or ESCALATE. Do not edit source.
@@ -51,8 +51,8 @@ Run `npx ai-engineering-loop <command>` in the target repo. Do not commit unless
51
51
  - Goal Contract path
52
52
  - `git diff <base>...HEAD` (file)
53
53
  - verification log (file)
54
- 6. Stage 6: `spawn_subagent` Devil's Advocate. `background: false`. `capability_mode: "execute"`. Do **not** pass `resume_from`. Prompt contains only artifact paths + `agents/devil-advocate.md` output contract.
55
- 7. Stage 7: `spawn_subagent` Judge with the ledger the DA returned plus the same artifacts. Prompt follows `agents/judge.md`.
54
+ 6. Stage 6: `spawn_subagent` Devil's Advocate. `background: false`. `capability_mode: "execute"`. Do **not** pass `resume_from`. Wait for the child. Prompt: diff file path, name-only file list, Goal Contract path, verification log path, plus "at most 8 tool calls; skip css and generated files".
55
+ 7. Stage 7: `spawn_subagent` Judge the same way (`background: false`, wait). Use `general-purpose` only if `judge` is rejected. Prompt: Goal Contract path, verification evidence path, Finding Ledger, and "at most 4 tool calls; ledger and contract only; skip css; do not re-review the whole diff".
56
56
  8. If Judge says `ITERATE` and iteration < 3, Maker fixes in the parent, re-verify, spawn a **fresh** DA (new spawn, no resume).
57
57
  9. Stage 8: delivery adapter from `.ai-engineering-loop/adapter.md`.
58
58
 
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
7
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/egagofur/ai-engineering-loop/pulls)
8
8
  [![AI Engineering](https://img.shields.io/badge/AI-Engineering%20Loop-orange.svg)](https://github.com/egagofur/ai-engineering-loop)
9
- [![Release](https://img.shields.io/badge/release-v1.0.8-purple.svg)](https://github.com/egagofur/ai-engineering-loop/releases)
9
+ [![Release](https://img.shields.io/badge/release-v1.0.10-purple.svg)](https://github.com/egagofur/ai-engineering-loop/releases)
10
10
 
11
11
  **A Reusable, Framework-Agnostic AI Engineering Operating System for Autonomous Coding Agents**
12
12
 
@@ -201,8 +201,10 @@ API Error: 400 [kiro/claude-sonnet-5] REQUEST_BODY_INVALID
201
201
  | Loop role | Claude Code `subagent_type` | Task keys |
202
202
  |---|---|---|
203
203
  | Orchestrator / Maker | parent session | n/a |
204
- | Devil's Advocate | `devil-advocate` (fallback `general-purpose`) | `subagent_type`, `description`, `prompt` |
205
- | Judge | `judge` (fallback `general-purpose`) | `subagent_type`, `description`, `prompt` |
204
+ | Devil's Advocate | `devil-advocate` (fallback `general-purpose`) | `subagent_type`, `description`, `prompt`, wait (no background) |
205
+ | Judge | `judge` (fallback `general-purpose`) | same, after DA returns |
206
+
207
+ Parent writes `git diff` to a file and passes that path. DA is capped at 8 tool calls and skips css/generated blobs so review does not take tens of minutes.
206
208
 
207
209
  Repo-local Claude Code files:
208
210
 
@@ -218,6 +220,8 @@ See [docs/claude-code-feasibility.md](docs/claude-code-feasibility.md).
218
220
 
219
221
  ## Antigravity Agent Integration
220
222
 
223
+ Antigravity uses `.agents/devil-advocate.md`, `.agents/judge.md`, and `.agents/workflows/ai-engineering-loop.md`. Same review budget as Claude Code and Grok: DA 8 tool calls, Judge 4, wait (no background), skip css/generated, never `browser_subagent`. If `invoke_subagent` is missing, disclose `CONTEXT_ISOLATION_ONLY`.
224
+
221
225
  When working inside the Antigravity IDE or compatible agentic platforms, you can invoke the loop via slash commands:
222
226
 
223
227
  - **`/ai-engineering-loop init`**: Initialize project context only (non-destructive bootstrap).
@@ -249,6 +253,11 @@ ai-engineering-loop/
249
253
  │ ├── orchestration.test.js # Tests for isolation, Finding schema, Judge matrix
250
254
  │ └── grok-runtime.test.js # Grok spawn_subagent mapping, aliases, forbidden types
251
255
 
256
+ ├── .agents/ # Antigravity host adapter
257
+ │ ├── devil-advocate.md
258
+ │ ├── judge.md
259
+ │ └── workflows/ai-engineering-loop.md
260
+
252
261
  ├── .grok/ # Grok CLI host adapter
253
262
  │ ├── agents/devil-advocate.md # Native DA subagent type
254
263
  │ ├── agents/judge.md # Native Judge subagent type
@@ -16,8 +16,10 @@ The Devil's Advocate executes under one of 4 runtime modes depending on platform
16
16
 
17
17
  Canonical ids are listed first; skill aliases are in parentheses.
18
18
 
19
- 1. **`TRUE_INDEPENDENT_AGENT`** (`NATIVE_SUBAGENT`): Genuine independent child session.
20
- - **Grok CLI**: `spawn_subagent` with `subagent_type: "devil-advocate"` (fallback `"general-purpose"`), `capability_mode: "execute"`, `isolation: "none"`, **omit** `resume_from`. Agent definition: `.grok/agents/devil-advocate.md`.
19
+ 1. **`TRUE_INDEPENDENT_AGENT`** (`NATIVE_SUBAGENT`): Genuine independent child session. Budget: at most 8 tool calls; diff file first; skip css/generated; no git log; wait, no background. Policy: `policies/review-budget.md`.
20
+ - **Claude Code**: Task `subagent_type: "devil-advocate"`. Agent: `.claude/agents/devil-advocate.md`.
21
+ - **Grok CLI**: `spawn_subagent` `subagent_type: "devil-advocate"`, `capability_mode: "execute"`, omit `resume_from`, `background: false`. Agent: `.grok/agents/devil-advocate.md`.
22
+ - **Antigravity**: `invoke_subagent` (or Task) named `devil-advocate`. Do not use `browser_subagent`. Agent: `.agents/devil-advocate.md`.
21
23
  - Do **not** use `caveman:cavecrew-reviewer` (compressed review schema, not a Finding Ledger).
22
24
  2. **`ISOLATED_AGENT_INSTANCE`** (`SDK_AGENT`): Programmatic SDK agent instance with isolated memory.
23
25
  3. **`FRESH_PROCESS_AGENT`** (`HEADLESS_SUBPROCESS`): Fresh OS process such as `grok -p` after a model response is captured.
package/agents/judge.md CHANGED
@@ -4,7 +4,11 @@
4
4
 
5
5
  The **Judge Agent** is the final decision-maker of the AI Engineering Loop. It serves as an impartial magistrate that evaluates the complete evidence pipeline (Contract, Diff, Deterministic Verification Logs, and Devil's Advocate findings) to determine whether the iteration should **PASS**, **ITERATE**, or **ESCALATE**.
6
6
 
7
- On **Grok CLI**, the parent orchestrator spawns the Judge with `spawn_subagent` (`subagent_type: "judge"`, fallback `"general-purpose"`), `capability_mode: "execute"`, and **no** `resume_from`. Agent definition: `.grok/agents/judge.md`. The Judge is a sibling of the Devil's Advocate, never its child (Grok nesting depth is 1).
7
+ Host spawn (Judge is a sibling of Devil's Advocate, never nested). Wait for the child. Do not run Judge in the background. Budget: at most 4 tool calls; read the Finding Ledger and Goal Contract first; fact-check cited locations only; skip css/generated; no git log. Policy: `policies/review-budget.md`.
8
+
9
+ - **Claude Code**: Task `subagent_type: "judge"` (fallback `"general-purpose"`). Agent: `.claude/agents/judge.md`.
10
+ - **Grok CLI**: `spawn_subagent` `subagent_type: "judge"`, `capability_mode: "execute"`, omit `resume_from`, `background: false`. Agent: `.grok/agents/judge.md`.
11
+ - **Antigravity**: `invoke_subagent` (or Task) named `judge`. Do not use `browser_subagent`. Agent: `.agents/judge.md`. If no subagent tool exists, run the same budget as CONTEXT_ISOLATION_ONLY.
8
12
 
9
13
  ```mermaid
10
14
  flowchart LR
@@ -15,7 +15,7 @@ const path = require('path');
15
15
  const crypto = require('crypto');
16
16
  const { execSync } = require('child_process');
17
17
 
18
- const VERSION = '1.0.8';
18
+ const VERSION = '1.0.10';
19
19
  const CWD = process.cwd();
20
20
  const CONTEXT_DIR = path.join(CWD, '.ai-engineering-loop');
21
21
 
@@ -613,6 +613,16 @@ function handleRun() {
613
613
  console.log('- Do not pass spawn_subagent, capability_mode, isolation, resume_from (Kiro 400 REQUEST_BODY_INVALID)');
614
614
  console.log('- Skill: .claude/skills/ai-engineering-loop/SKILL.md');
615
615
  }
616
+
617
+ const agAgent = path.join(CWD, '.agents', 'judge.md');
618
+ if (fs.existsSync(agAgent)) {
619
+ console.log('------------------------------------------------------------');
620
+ log.bold('Antigravity host:');
621
+ console.log('- Subagent: invoke_subagent or Task; wait; never browser_subagent');
622
+ console.log('- Devil\'s Advocate: 8 tool calls, diff file, skip css');
623
+ console.log('- Judge: 4 tool calls, ledger + contract only');
624
+ console.log('- Workflow: .agents/workflows/ai-engineering-loop.md');
625
+ }
616
626
  console.log('------------------------------------------------------------\n');
617
627
  }
618
628
 
@@ -64,9 +64,11 @@ flowchart TD
64
64
  - **Analysis**:
65
65
  - Full codebase context in every prompt leads to context bloat and degraded attention.
66
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).
67
+ - Write `git diff` to `.ai-engineering-loop/tasks/current.diff` and pass that path.
68
+ - Devil's Advocate: at most 8 tool calls; skip css/generated; no git log; wait (no background).
69
+ - Judge: at most 4 tool calls; ledger + Goal Contract only; fact-check cited locations; wait.
70
+ - Do not use `browser_subagent` as a reviewer.
71
+ - If `invoke_subagent` is missing, use CONTEXT_ISOLATION_ONLY with the same budgets. See `policies/review-budget.md` and `.agents/`.
70
72
 
71
73
  ---
72
74
 
@@ -21,8 +21,10 @@ This is separate from 9router bugs that reject any Anthropic `system` field. Tho
21
21
  | Loop role | Claude Code type | Task keys allowed |
22
22
  |---|---|---|
23
23
  | Orchestrator / Maker | parent session | n/a |
24
- | Devil's Advocate | `devil-advocate` (fallback `general-purpose`) | `subagent_type`, `description`, `prompt` |
25
- | Judge | `judge` (fallback `general-purpose`) | `subagent_type`, `description`, `prompt` |
24
+ | Devil's Advocate | `devil-advocate` (fallback `general-purpose`) | `subagent_type`, `description`, `prompt`, `run_in_background: false` |
25
+ | Judge | `judge` (fallback `general-purpose`) | same; wait for DA first |
26
+
27
+ Parent must write `git diff` to a file and pass that path. DA budget: 8 tool calls, skip css/generated, no git log. Do not leave DA running in the background.
26
28
 
27
29
  Do not pass Grok keys (`spawn_subagent`, `capability_mode`, `resume_from`, `isolation`, `background`) on Claude Code.
28
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-engineering-loop",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A reusable, framework-agnostic AI Engineering Operating System for autonomous coding agents.",
5
5
  "main": "bin/ai-engineering-loop.js",
6
6
  "bin": {
@@ -19,6 +19,7 @@
19
19
  "docs/",
20
20
  "tests/",
21
21
  "scripts/",
22
+ ".agents/",
22
23
  ".grok/",
23
24
  ".claude/agents/",
24
25
  ".claude/commands/",
@@ -0,0 +1,24 @@
1
+ # Review Budget (all hosts)
2
+
3
+ Applies to Devil's Advocate and Judge on Claude Code, Grok CLI, and Antigravity. Parent always waits; children never run in the background.
4
+
5
+ ## Shared spawn rules
6
+
7
+ - Write `git diff` to `.ai-engineering-loop/tasks/current.diff` before review.
8
+ - Pass artifact **paths**, not Maker chat.
9
+ - Spawn DA and Judge as siblings. Do not nest.
10
+ - Prefer named types `devil-advocate` and `judge`. Use `general-purpose` only if the named type is rejected.
11
+ - Skip `*.css`, `*report-css*`, generated/vendor. Do not run `git log`.
12
+
13
+ ## Devil's Advocate
14
+
15
+ - At most **8** tool calls, then emit the Finding Ledger.
16
+ - Read the diff file first. Do not run `git diff` if that path was given.
17
+ - Open at most **8** files that appear in the diff. Prefer quoting a hunk over opening the whole file.
18
+
19
+ ## Judge
20
+
21
+ - At most **4** tool calls, then emit PASS, ITERATE, or ESCALATE.
22
+ - Read the Finding Ledger and Goal Contract first.
23
+ - Open source only to fact-check a `location` the ledger already cited.
24
+ - Do not re-review the whole diff. Do not roam the repo.
@@ -38,6 +38,9 @@ test('Claude Code skill is Kiro-safe: no mermaid, latex, HTML breaks, or Grok to
38
38
  assert.match(content, /devil-advocate/);
39
39
  assert.match(content, /\bjudge\b/);
40
40
  assert.match(content, /cannot determine the safety/);
41
+ assert.match(content, /run_in_background/);
42
+ assert.match(content, /current\.diff/);
43
+ assert.match(content, /8 tool calls/);
41
44
  });
42
45
 
43
46
  test('Claude Code agents exist with Claude tool names and Finding Ledger / verdict contracts', () => {
@@ -51,9 +54,13 @@ test('Claude Code agents exist with Claude tool names and Finding Ledger / verdi
51
54
  assert.doesNotMatch(da, /spawn_subagent|capability_mode|resume_from/);
52
55
  assert.doesNotMatch(judge, /spawn_subagent|capability_mode|resume_from/);
53
56
  assert.match(da, /Finding Ledger/);
57
+ assert.match(da, /8 tool calls/);
58
+ assert.match(da, /Skip: `\*\.css`/);
59
+ assert.match(da, /Do not run git log/);
54
60
  assert.match(judge, /PASS/);
55
61
  assert.match(judge, /ITERATE/);
56
62
  assert.match(judge, /ESCALATE/);
63
+ assert.match(judge, /4 tool calls/);
57
64
  });
58
65
 
59
66
  test('Claude Code slash command does not embed Grok spawn keys', () => {
@@ -71,3 +78,35 @@ test('Grok skill may use spawn_subagent; Claude skill must not', () => {
71
78
  assert.match(grok, /spawn_subagent/);
72
79
  assert.doesNotMatch(claude, /spawn_subagent/);
73
80
  });
81
+
82
+ test('Judge budget is the same on Claude Code, Grok, and Antigravity', () => {
83
+ const hosts = [
84
+ '.claude/agents/judge.md',
85
+ '.grok/agents/judge.md',
86
+ '.agents/judge.md'
87
+ ];
88
+ for (const rel of hosts) {
89
+ const body = readRepo(rel);
90
+ assert.match(body, /Budget \(hard stop\)/);
91
+ assert.match(body, /4 tool calls/);
92
+ assert.match(body, /Do not run git log/);
93
+ assert.match(body, /Do not re-review the whole diff/);
94
+ assert.match(body, /\*report-css\*/);
95
+ }
96
+ });
97
+
98
+ test('Antigravity workflow waits and never uses browser_subagent as reviewer', () => {
99
+ const wf = readRepo('.agents/workflows/ai-engineering-loop.md');
100
+ parseFrontmatter(wf, 'antigravity workflow');
101
+ assert.match(wf, /8 tool calls/);
102
+ assert.match(wf, /4 tool calls/);
103
+ assert.match(wf, /browser_subagent/);
104
+ assert.match(wf, /CONTEXT_ISOLATION_ONLY/);
105
+ });
106
+
107
+ test('Claude and Grok parent skills pass Judge a 4-call ledger-only prompt', () => {
108
+ const claude = readRepo('.claude/skills/ai-engineering-loop/SKILL.md');
109
+ const grok = readRepo('.grok/skills/ai-engineering-loop/SKILL.md');
110
+ assert.match(claude, /4 tool calls/);
111
+ assert.match(grok, /4 tool calls/);
112
+ });