ai-engineering-loop 1.0.10 → 1.0.12

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.
Files changed (49) hide show
  1. package/.agents/devil-advocate.md +18 -3
  2. package/.agents/judge.md +8 -4
  3. package/.agents/workflows/ai-engineering-loop.md +7 -7
  4. package/.claude/agents/devil-advocate.md +17 -2
  5. package/.claude/agents/judge.md +7 -3
  6. package/.claude/commands/ai-engineering-loop.md +1 -1
  7. package/.claude/skills/ai-engineering-loop/SKILL.md +6 -5
  8. package/.gemini/skills/ai-engineering-loop/SKILL.md +59 -0
  9. package/.grok/agents/devil-advocate.md +31 -32
  10. package/.grok/agents/judge.md +9 -5
  11. package/.grok/commands/ai-engineering-loop.md +1 -1
  12. package/.grok/skills/ai-engineering-loop/SKILL.md +9 -7
  13. package/README.md +31 -3
  14. package/README.npm.md +5 -2
  15. package/adapters/dot/README.md +27 -3
  16. package/adapters/dot/coreview.md +30 -11
  17. package/adapters/dot/mattermost.md +31 -19
  18. package/adapters/dot/skills/dot-dev-skill-router/SKILL.md +55 -0
  19. package/adapters/dot/skills/dot-dev-workflow/SKILL.md +118 -0
  20. package/agents/devil-advocate.md +3 -1
  21. package/agents/maker.md +13 -11
  22. package/agents/shared/devil-advocate.body.md +61 -0
  23. package/agents/shared/judge.body.md +38 -0
  24. package/bin/ai-engineering-loop.js +131 -22
  25. package/core/context-impact-assessment.md +2 -0
  26. package/core/definition-of-done.md +2 -0
  27. package/core/goal-contract.md +18 -4
  28. package/core/grill-policy.md +70 -0
  29. package/core/handoff-policy.md +44 -0
  30. package/core/judge-policy.md +4 -3
  31. package/core/project-initialization.md +2 -1
  32. package/core/repo-config-schema.md +15 -1
  33. package/core/root-cause-analysis.md +30 -0
  34. package/core/verification-loop.md +3 -1
  35. package/examples/initialization/discovery-trace.md +1 -1
  36. package/examples/initialization/generated-context.md +1 -1
  37. package/lib/orchestration.js +20 -2
  38. package/lib/sync-hosts.js +195 -0
  39. package/package.json +2 -1
  40. package/policies/finding-policy.md +7 -1
  41. package/policies/review-budget.md +8 -0
  42. package/policies/tdd-policy.md +32 -0
  43. package/scripts/init.sh +21 -0
  44. package/templates/repo-config/adr-readme.md +33 -0
  45. package/templates/repo-config/glossary.md +18 -0
  46. package/tests/living-context.test.js +46 -0
  47. package/tests/orchestration.test.js +80 -0
  48. package/tests/skill-host-compat.test.js +117 -0
  49. package/tests/sync-hosts.test.js +119 -0
@@ -5,21 +5,34 @@
5
5
  In the DOT ecosystem, `@coreview-bot` operates as an external, company-level automated code reviewer attached to GitLab Merge Requests (specifically MRs targeting `develop`).
6
6
 
7
7
  > [!IMPORTANT]
8
- > **We do not have access to `@coreview-bot`'s internal rules or heuristics.**
9
- > - Do not attempt to reverse-engineer or invent Coreview behavior.
10
- > - Treat Coreview strictly as an external reviewer providing asynchronous critique on GitLab MRs.
11
- > - Evaluate its comments objectively through the lens of the repository's ground truth.
8
+ > **GATE sebelum Phase 9 (Mattermost Dispatch)**:
9
+ > Dilarang mengirim Mattermost sebelum hasil `glab mr view --comments` **tercetak di pesan ke user**.
10
+ > Jika `comments: 0`, triage kosong tetap wajib dilaporkan sebagai bukti bahwa pengecekan bot telah dilakukan secara riil.
11
+ >
12
+ > Selalu cetak laporan triage dengan format:
13
+ > ```text
14
+ > Phase 8 Triage
15
+ > MR: !<id>
16
+ > Command: glab mr view <id> --comments
17
+ > Comments: <n>
18
+ > Valid: <list atau none>
19
+ > Halu: <list atau none>
20
+ > Action: <none | fix | reply>
21
+ > ```
12
22
 
13
23
  ---
14
24
 
15
25
  ## 2. Coreview Triage Workflow
16
26
 
27
+ Mengikuti panduan dari skill `gitlab-mr-feedback` dan `receiving-code-review` (verifikasi teknis menyeluruh sebelum implementasi, tanpa *performative agreement*).
28
+
17
29
  ```mermaid
18
30
  flowchart TD
19
31
  MRDev[MR Targeting develop Created] --> FetchBot[Fetch Comments via glab mr view --comments]
20
- FetchBot --> CheckComments{Bot Comments Found?}
32
+ FetchBot --> PrintTriage[Print Phase 8 Triage Report to User]
33
+ PrintTriage --> CheckComments{Bot Comments Found?}
21
34
 
22
- CheckComments -->|No| Done([Complete Triage])
35
+ CheckComments -->|No: comments: 0| Done([Complete Triage -> Gate Passed])
23
36
  CheckComments -->|Yes| Evaluate{Evaluate Each Comment}
24
37
 
25
38
  Evaluate -->|VALID: Real Defect| Fix[1. Surgical Code Fix<br>2. Run Tests & Linter<br>3. Commit & Cherry-pick to all branches<br>4. Reply with commit hash]
@@ -63,12 +76,15 @@ Every Coreview comment must be categorized into one of two paths:
63
76
  git push origin <branch-name>
64
77
  ```
65
78
  4. Cherry-pick the new fix commit to all other active environment branches (`main`, `staging`).
66
- 5. Post a resolution note on GitLab citing the commit hash:
79
+ 5. Post a resolution reply directly **inside the bot's discussion thread**:
67
80
  ```bash
68
- glab mr note <mr-id> --repo <repo> -m "Fixed in commit <commit-hash>: <technical explanation of the resolution>"
81
+ # Get discussion_id: glab api "projects/:fullpath/merge_requests/<mr-id>/discussions"
82
+ glab api "projects/:fullpath/merge_requests/<mr-id>/discussions/<discussion_id>/notes" \
83
+ -X POST \
84
+ -F "body=Fixed in commit <commit-hash>: <technical explanation of the resolution>"
69
85
  ```
70
86
 
71
- ### Case B: Feedback is HALU (False Positive / Hallucinated)
87
+ ### Case B: Feedback is HALU (False Positive / Intended Architecture)
72
88
  - **Criteria**:
73
89
  - The bot suggests calling an API, library method, or hook that does not exist in the codebase or standard library.
74
90
  - The bot flags intentional architecture or established framework patterns as "errors".
@@ -76,9 +92,12 @@ Every Coreview comment must be categorized into one of two paths:
76
92
  - The bot misinterprets domain-specific business logic already agreed in the Goal Contract.
77
93
  - **Action Plan**:
78
94
  1. **DO NOT modify any code.**
79
- 2. Post a polite, evidence-backed technical rebuttal on the GitLab note explaining why the suggestion is invalid:
95
+ 2. Post a polite, evidence-backed technical rebuttal directly **inside the bot's discussion thread**:
80
96
  ```bash
81
- glab mr note <mr-id> --repo <repo> -m "Feedback is invalid / false positive: <detailed technical explanation with file citations>."
97
+ # Get discussion_id: glab api "projects/:fullpath/merge_requests/<mr-id>/discussions"
98
+ glab api "projects/:fullpath/merge_requests/<mr-id>/discussions/<discussion_id>/notes" \
99
+ -X POST \
100
+ -F "body=Terima kasih atas masukannya @coreview-bot. <detailed technical explanation with file citations>."
82
101
  ```
83
102
 
84
103
  ---
@@ -63,40 +63,52 @@ flowchart TD
63
63
 
64
64
  ---
65
65
 
66
- ## 5. Standardized Mattermost Markdown Report Format
66
+ ## 5. Standardized Mattermost Markdown Report Format (No AI Slop + Human-Written + PIC at End)
67
67
 
68
- Render separate, ready-to-copy Markdown blocks for every generated Merge Request:
68
+ Render separate, ready-to-copy Markdown blocks for every generated Merge Request using a simple, clean, and punchy format:
69
69
 
70
70
  ```text
71
71
  [MR <ENV_TAG>] <MR_URL>
72
72
  Changes log
73
- - <Concise change point 1>
74
- - <Concise change point 2>
75
- - <Concise change point 3>
73
+ - <Poin 1: Apa yang diperbaiki / fitur apa yang aktif>
74
+ - <Poin 2: Perubahan mekanisme/perilaku sistem secara gamblang>
75
+ - <Poin 3: Proteksi regresi atau pengujian yang ditambahkan>
76
+
77
+ cc: <PIC>
76
78
  ```
77
79
 
80
+ ### Formatting & Writing Rules (Prinsip `no-ai-slop`):
81
+ - **DILARANG MENGGUNAKAN HEADING MARKDOWN (`#`, `##`, `###`, `####`)**: Gunakan teks polos agar font di Mattermost tidak membesar secara berlebihan.
82
+ - **Format Sederhana Tanpa Metadata Bertele-tele**: Jangan menyertakan tabel metadata yang panjang (seperti Branch, Repo, Status Verifikasi). Cukup link MR dan list `Changes log`.
83
+ - **Sertakan PIC di Akhir Pesan**: Ambil PIC dari file konfigurasi `mattermost-channel-mapping.json`. Jika belum ada, tanyakan kepada user dan simpan ke file mapping. Tambahkan `cc: <PIC>` di baris paling bawah.
84
+ - **Gunakan Bahasa Manusia yang Lugas & Konkret**:
85
+ - ✅ **Awali dengan kata kerja aktif**: *"Memperbaiki..."*, *"Memigrasikan..."*, *"Menjaga..."*, *"Menambahkan..."*, *"Mengubah..."*.
86
+ - ❌ **Dilarang kata-kata AI Slop / Puffery**: `secara komprehensif`, `memastikan keakuratan`, `memfasilitasi`, `menyelaraskan alur`, `mengoptimalkan proses`, `solusi yang kokoh/robust`, `meningkatkan efisiensi`, `telah berhasil diimplementasikan`.
87
+ - ❌ **Dilarang raw code / AST leakage**: Jangan menyebut nama variabel internal atau query mentah (misal `user.type.hasNormalHours`, `attendanceConfirmationPagination Prisma query`). Jelaskan dampak fungsionalnya.
88
+
78
89
  ### Environment Tags:
79
90
  - `[MR DEV]`: Merge Request targeting `develop`.
80
91
  - `[MR STAGING]`: Merge Request targeting `staging`.
81
92
  - `[MR MAIN]` (or `[MR PROD]`): Merge Request targeting `main` / `master`.
82
93
 
83
- ### Example Report:
94
+ ### Contoh Penerapan Nyata:
95
+
84
96
  ```text
85
- [MR DEV] https://gitlab.dot.co.id/dot-system/dotify-new/-/merge_requests/948
97
+ [MR DEV] https://gitlab.dot.co.id/playground/bikin-rindu-tools-v2/-/merge_requests/108
86
98
  Changes log
87
- - Include user.type.hasNormalHours and timeEntities.overtimeNote in attendanceConfirmationPagination Prisma query.
88
- - Create resolveAttendanceConfirmationDisplayStatus utility to properly evaluate hasPendingTimeEntities by checking overtimeNote, isWeekend, duration > 8, non-normal hours employees, and null statuses.
89
- - Add comprehensive unit tests in src/server/attendance-confirmations/utils/resolve-display-status.test.ts covering all status permutations.
99
+ - Memperbaiki crash halaman dashboard di Safari setelah login akibat QuotaExceededError pada localStorage.
100
+ - Memigrasikan penyimpanan cache browser ke IndexedDB (idb-keyval) sehingga kapasitas penyimpanan leluasa dan tidak memblokir main thread.
101
+ - Menjaga synchronous script di head untuk preferensi tema agar tidak terjadi kedipan tampilan (FOUC).
102
+ - Menambahkan auto-migration otomatis untuk memindahkan data lama dari localStorage ke IndexedDB sekaligus membebaskan kuota browser.
90
103
 
91
- [MR STAGING] https://gitlab.dot.co.id/dot-system/dotify-new/-/merge_requests/947
92
- Changes log
93
- - Include user.type.hasNormalHours and timeEntities.overtimeNote in attendanceConfirmationPagination Prisma query.
94
- - Create resolveAttendanceConfirmationDisplayStatus utility to properly evaluate hasPendingTimeEntities by checking overtimeNote, isWeekend, duration > 8, non-normal hours employees, and null statuses.
95
- - Add comprehensive unit tests in src/server/attendance-confirmations/utils/resolve-display-status.test.ts covering all status permutations.
104
+ cc: @hanaaaca
96
105
 
97
- [MR MAIN] https://gitlab.dot.co.id/dot-system/dotify-new/-/merge_requests/946
106
+ [MR DEV] https://gitlab.dot.co.id/dot-system/dotify-new/-/merge_requests/963
98
107
  Changes log
99
- - Include user.type.hasNormalHours and timeEntities.overtimeNote in attendanceConfirmationPagination Prisma query.
100
- - Create resolveAttendanceConfirmationDisplayStatus utility to properly evaluate hasPendingTimeEntities by checking overtimeNote, isWeekend, duration > 8, non-normal hours employees, and null statuses.
101
- - Add comprehensive unit tests in src/server/attendance-confirmations/utils/resolve-display-status.test.ts covering all status permutations.
108
+ - Mengubah status entitas yang tadinya APPROVED menjadi NEED APPROVAL otomatis saat project atau jam kerjanya diedit.
109
+ - Memperbaiki sinkronisasi worker agar periode absensi berjalan (UNCONFIRMED) tetap diproses saat admin mengedit data.
110
+ - Menjaga entitas lain yang sudah disetujui PM di periode yang sama agar status approval-nya tidak ter-reset.
111
+ - Menambahkan unit test untuk skenario lembur multi-entry harian.
112
+
113
+ cc: @ulfa.mufida
102
114
  ```
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: dot-dev-skill-router
3
+ description: Route DOT tasks. Commit-bound bugfix, feature, or refactor uses ai-engineering-loop for Stages 0-7, then dot-dev-workflow for Stage 8 delivery. Do not use dot-dev-workflow as a parallel engineering OS.
4
+ ---
5
+
6
+ # DOT Development Skill Router
7
+
8
+ Pick the smallest relevant skill. Do not load every skill. **AI Engineering Loop is the engineering OS on DOT repos.** `dot-dev-workflow` is Stage 8 delivery only (GitLab, cherry-pick, Coreview, Mattermost).
9
+
10
+ ## Core rules
11
+
12
+ 1. Read repository instructions and inspect the affected code before choosing a workflow.
13
+ 2. For DOT work that will be committed or opened as an MR, load `ai-engineering-loop`. Stage 1 grill includes `task-impact-inquiry` (four pillars). Stages 6-7 are AEL Devil's Advocate and Judge. Do not run the old 9-phase `dot-dev-workflow` as a second loop. Do not run `task-impact-inquiry` as a second interview after grill.
14
+ 3. After Judge `PASS`, load `dot-dev-workflow` for Stage 8 delivery only.
15
+ 4. Use `ponytail` when the smallest correct solution matters.
16
+ 5. Use `dot-verification` before claiming a change is fixed, complete, passing, or ready.
17
+ 6. Commits, push, GitLab issue/MR, Mattermost, deploys, database mutation, and deletion are explicit user-requested side effects. `auto-mr-issue` is never automatic.
18
+ 7. Do not invent APIs, test results, design tokens, or behavior. Report blockers as blockers.
19
+
20
+ ## Route by task
21
+
22
+ | Task | Load in order |
23
+ |---|---|
24
+ | DOT bugfix / feature / refactor that will be committed or opened as MR | `ai-engineering-loop` (grill includes `task-impact-inquiry`; DA + Judge before commit) → `dot-dev-workflow` Stage 8 after Judge PASS |
25
+ | Impact / blast-radius question only (no implementation) | `task-impact-inquiry` |
26
+ | New feature, product/UI behavior unclear | `brainstorming` → `product-contract-analysis` → then `ai-engineering-loop` if it will be built |
27
+ | Legacy FE + BE module documentation | `generate-module-fsd` |
28
+ | Raw `.fig` file to standalone HTML + Tailwind | `fig-to-tailwind-extractor`; add `figma-token-extractor` for token/visual-contract audit |
29
+ | New landing page or visual redesign | `frontend-design` + `design-taste-frontend`; add `ui-ux-pro-max` only for a targeted UI decision |
30
+ | UI/accessibility/design review | `web-design-guidelines`; add `ui-ux-pro-max` for focused UX, stack, typography, or interaction guidance |
31
+ | DOT API contract or OpenAPI change | `ai-engineering-loop` → `dot-openapi-contract` → `dot-verification` |
32
+ | DOT backend behavior/API regression coverage | `ai-engineering-loop` → `dot-api-test` → `dot-verification` |
33
+ | Backend architecture, clean code, naming, or query optimization | `ai-engineering-loop` → `backend-development` (during Maker) → `dot-verification` |
34
+ | Backend action, queue, worker, or entity status recalculation | `ai-engineering-loop` → `backend-development` + `backend-safety-guardrails` (during Maker) → `dot-verification` |
35
+ | Local web app repro, browser smoke, or UI regression | `webapp-testing` → `dot-verification` |
36
+ | Plan execution with review checkpoints | `executing-plans` → `ai-engineering-loop` |
37
+ | Pre-merge review after AEL already ran | AEL Judge verdict is the gate. Do not re-run skill `devils-advocate` unless Judge was skipped |
38
+ | Code review feedback reception | `receiving-code-review` |
39
+ | GitLab MR discussions / feedback resolution | `gitlab-mr-feedback` → `receiving-code-review` |
40
+ | Broad creative/product ideation | `creative-ideation`; use `brainstorming` when the next outcome must be an approved plan |
41
+ | Explicit post-commit GitLab issue/MR request | `auto-mr-issue` after the user explicitly asks for it |
42
+
43
+ ## Workflow gates
44
+
45
+ - Goal Contract (with seams and, on DOT, impact matrix) before production edits.
46
+ - Before `git commit` / `glab mr create`: AEL Judge `PASS`. Considering risks while coding is not that gate.
47
+ - Before Mattermost: `glab mr view --comments` printed to the user, even when comment count is 0.
48
+ - For final reports, separate verified, failed, blocked, and untested items.
49
+
50
+ ## Avoid
51
+
52
+ - Do not run `dot-dev-workflow` Phases 1-6 when `ai-engineering-loop` is available.
53
+ - Do not chain `task-impact-inquiry` then a full second engineering loop.
54
+ - Do not invoke `auto-mr-issue` merely because code was committed.
55
+ - Do not use the full delivery pipeline for a tiny local question unless the user asked to ship.
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: dot-dev-workflow
3
+ description: DOT Stage 8 delivery after AI Engineering Loop Judge PASS. GitLab issue/MR, multi-branch cherry-pick, Coreview triage, Mattermost. Not a substitute for ai-engineering-loop.
4
+ ---
5
+
6
+ # DOT Delivery Workflow (Stage 8)
7
+
8
+ This is **not** the engineering OS. On DOT repositories:
9
+
10
+ 1. Run **`ai-engineering-loop`** for Stages 0-7 (grill, RCA, Maker, verification, Devil's Advocate, Judge).
11
+ 2. Run **this skill only after Judge `PASS`** (or the user explicitly asked to ship).
12
+ 3. Stage 1 grill already includes `task-impact-inquiry`. Do not interview again.
13
+ 4. Stages 6-7 are AEL DA + Judge. Do not re-run skill `devils-advocate` as a second pre-commit OS.
14
+
15
+ If `ai-engineering-loop` is missing on this host, say so and stop. Do not silently run the old 9-phase loop.
16
+
17
+ ## Mapping (old phases → AEL)
18
+
19
+ | Old `dot-dev-workflow` | Now |
20
+ |---|---|
21
+ | Phase 1 RCA | AEL Stage 2 (`core/root-cause-analysis.md`) |
22
+ | Phase 2 impact inquiry | AEL Stage 1 grill + `task-impact-inquiry` |
23
+ | Phase 3-5 code / tests / tsc | AEL Stages 4-5 (`policies/tdd-policy.md`, `.ai-engineering-loop/verification.md`) |
24
+ | Phase 6 `devils-advocate` | AEL Stages 6-7 (Finding Ledger + Judge PASS/ITERATE/ESCALATE) |
25
+ | Phase 7-9 glab / Coreview / Mattermost | **This skill** (AEL Stage 8). Prefer `adapters/dot/` in the AEL package when present. |
26
+
27
+ `git commit`, `git push`, and `glab mr create` are forbidden until Judge `PASS`.
28
+
29
+ ## DOT Maker constraints (AEL Stage 4)
30
+
31
+ While AEL Maker runs, still enforce:
32
+
33
+ - `backend-development` for naming, queries, layering.
34
+ - `backend-safety-guardrails` on mutations, jobs, recalculation: never bypass BullMQ; scope by entity id not coarse date strings; never overwrite `APPROVED`/`REJECTED` without explicit force; BigInt as string across boundaries; container moves sync old and new parents.
35
+ - Tests: `npx jest --testPathIgnorePatterns="dotify-api"` unless `.ai-engineering-loop/verification.md` says otherwise.
36
+ - Branch from a clean target (`main`, `staging`, or `develop`), then `git checkout -b <type>/<descriptive-name>`.
37
+
38
+ Print these six invariants before commit (N/A allowed only with one sentence citing the diff):
39
+
40
+ - Queue: BullMQ not bypassed
41
+ - Granularity: entity id, not grouping strings
42
+ - BigInt: string in payloads, compare as BigInt
43
+ - Manual review: APPROVED/REJECTED not auto-reset
44
+ - Container move: old and new parents synced
45
+ - Hygiene: no unused locals or dead imports
46
+
47
+ ---
48
+
49
+ ## Stage 8a — Multi-branch MR and issue card (`glab`)
50
+
51
+ If the workspace has `adapters/dot/gitlab.md` and `adapters/dot/multi-branch.md`, follow those. Otherwise:
52
+
53
+ 1. Commit:
54
+
55
+ ```bash
56
+ git add <modified-files>
57
+ git commit -m "<type>(<scope>): <summary>"
58
+ ```
59
+
60
+ 2. Create a GitLab issue if none is linked (`glab issue create` with module title, scope checkboxes, testing steps, expectation table, label `Ready to Test`).
61
+
62
+ 3. Create the base MR (`glab mr create` onto the target branch, description links the issue).
63
+
64
+ 4. Propagate to `staging` and `develop`: fetch, branch from origin, cherry-pick the commit, re-run verification, push, open MR per environment.
65
+
66
+ ---
67
+
68
+ ## Stage 8b — Coreview and MR discussions
69
+
70
+ Follow `adapters/dot/coreview.md` when present, plus `gitlab-mr-feedback` and `receiving-code-review`.
71
+
72
+ Gate before Mattermost: run `glab mr view <id> --comments` and print the triage. `comments: 0` is a printed empty triage, not a skip.
73
+
74
+ ```text
75
+ Phase 8 Triage
76
+ MR: !<id>
77
+ Command: glab mr view <id> --comments
78
+ Comments: <n>
79
+ Valid: <list or none>
80
+ Halu: <list or none>
81
+ Action: <none | fix | reply>
82
+ ```
83
+
84
+ Reply **inside** the Coreview discussion thread (not a top-level note):
85
+
86
+ ```bash
87
+ glab api "projects/:fullpath/merge_requests/<mr-id>/discussions"
88
+ glab api "projects/:fullpath/merge_requests/<mr-id>/discussions/<discussion_id>/notes" -X POST -F "body=<text>"
89
+ ```
90
+
91
+ - VALID: fix surgically, re-verify, commit, propagate, reply with commit hash.
92
+ - HALU: do not change code; reply with file-cited technical pushback.
93
+
94
+ ---
95
+
96
+ ## Stage 8c — Mattermost (`no-ai-slop`)
97
+
98
+ Follow `adapters/dot/mattermost.md` when present.
99
+
100
+ 1. Resolve channel and PIC from `/Users/egagofur/.gemini/config/mattermost-channel-mapping.json`. If PIC is missing, ask the user and save it.
101
+ 2. Send via MCP `mattermost_send_message` with `from: "AI Agent"`. Use the Mattermost CLI only if MCP fails. Do not send twice.
102
+ 3. Put `cc: <PIC>` on the last line.
103
+
104
+ Format (plain text, no markdown headings):
105
+
106
+ ```text
107
+ [MR <ENV_TAG>] <MR_URL>
108
+ Changes log
109
+ - <active-voice change>
110
+ - <what the system now does>
111
+ - <regression protection>
112
+
113
+ cc: <PIC>
114
+ ```
115
+
116
+ ENV tags: `[MR DEV]` develop, `[MR STAGING]` staging, `[MR MAIN]` / `[MR PROD]` main.
117
+
118
+ Forbidden: puffery (`secara komprehensif`, `robust`, `mengoptimalkan proses`), raw code/AST in the report.
@@ -31,7 +31,7 @@ Canonical ids are listed first; skill aliases are in parentheses.
31
31
 
32
32
  The Devil's Advocate receives **only** the objective artifact package:
33
33
  - `Goal Contract` (AC-1..N, constraints, out of scope).
34
- - `Project Context` (`.ai-engineering-loop/`: `architecture.md`, `conventions.md`, `verification.md`).
34
+ - `Project Context` (`.ai-engineering-loop/`: `architecture.md`, `conventions.md`, `verification.md`, `glossary.md`).
35
35
  - `Pure Git Diff` (`git diff <base>...HEAD`).
36
36
  - `Deterministic Verification Logs` (exit code 0 proof).
37
37
  - `Prior Finding Signatures`.
@@ -52,6 +52,8 @@ The Devil's Advocate outputs a strictly structured Finding Ledger:
52
52
  "findings": [
53
53
  {
54
54
  "id": "DA-01",
55
+ "axis": "spec",
56
+ "hardConvention": false,
55
57
  "topic": "correctness",
56
58
  "validity": "VALID",
57
59
  "severity": "BLOCKER",
package/agents/maker.md CHANGED
@@ -7,10 +7,9 @@ The **Maker Agent** is the builder and execution engine of the AI Engineering Lo
7
7
  ```mermaid
8
8
  flowchart LR
9
9
  GoalContract[Goal Contract] --> Maker[Maker Agent]
10
- Maker --> DeepAnalysis[1. Root Cause & Data Flow Analysis]
11
- DeepAnalysis --> SurgicalCode[2. Surgical Code Implementation]
12
- SurgicalCode --> ComprehensiveTests[3. Boundary & Unit Tests]
13
- ComprehensiveTests --> DeterministicRun[4. Deterministic Verification]
10
+ Maker --> DeepAnalysis[1. Root Cause (core/root-cause-analysis.md)]
11
+ DeepAnalysis --> RedGreen[2. TDD at agreed seams]
12
+ RedGreen --> DeterministicRun[3. Deterministic Verification Evidence]
14
13
  ```
15
14
 
16
15
  ---
@@ -26,9 +25,10 @@ flowchart LR
26
25
  - Maintain strict adherence to existing codebase architecture, design system tokens, naming conventions, and file organization.
27
26
  - Avoid speculative abstractions, unsolicited refactoring, or touching out-of-scope files.
28
27
  - Leave zero dead code, zero stubs, zero empty catch blocks, and zero speculative TODOs.
29
- 3. **Comprehensive Test Engineering**:
30
- - Author automated unit, integration, or schema test suites alongside the modified code.
31
- - Cover normal positive execution, negative edge cases, null/undefined safety, empty payloads, boundary conditions, and business rule permutations.
28
+ 3. **Test-Driven Engineering** ([TDD Policy](file:///Users/egagofur/Development/work/ai-engineering-loop/policies/tdd-policy.md)):
29
+ - Red before green at the Goal Contract's named seams only.
30
+ - Tests observe public behavior, use glossary terms, and never assert implementation details.
31
+ - Cover the AC slice in play: happy path, negative edge, null/empty, boundary. Vertical slices, not all-tests-then-all-code.
32
32
  4. **Addressing Reviewer Findings**:
33
33
  - In subsequent iterations, ingest findings from the [Devil's Advocate](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md) and directives from the [Judge](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/judge.md).
34
34
  - Fix validated issues surgically.
@@ -48,13 +48,15 @@ flowchart LR
48
48
  ## 4. Execution Workflow
49
49
 
50
50
  ### Step 1: Pre-Code Analysis
51
+ - Follow [Root Cause Analysis](file:///Users/egagofur/Development/work/ai-engineering-loop/core/root-cause-analysis.md). For bugs: red repro before a production edit.
51
52
  - Map the data flow across layers.
53
+ - Confirm seams from the Goal Contract. Use `.ai-engineering-loop/glossary.md` for names.
52
54
  - Check git history for recent changes to the affected files.
53
- - Identify edge cases and boundary conditions before typing code.
54
55
 
55
- ### Step 2: Implementation & Tests
56
- - Implement the minimal fix or feature logic.
57
- - Write corresponding automated tests in accordance with project test frameworks.
56
+ ### Step 2: Red-Green at Seams
57
+ - One failing test at a named seam, then the smallest production change that passes it.
58
+ - Do not test private helpers. Do not write tautological assertions.
59
+ - Refactoring is out of this loop unless the Goal Contract listed it.
58
60
 
59
61
  ### Step 3: Run Deterministic Verification
60
62
  - Run test commands: `npx jest`, `pytest`, `cargo test`, `go test`, etc.
@@ -0,0 +1,61 @@
1
+ You are the Devil's Advocate for the AI Engineering Loop. You are read-only. You never modify application source and never commit.
2
+
3
+ ## Budget (hard stop)
4
+
5
+ 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.
6
+
7
+ ## Input barrier
8
+
9
+ Use only:
10
+
11
+ 1. The diff file path in the spawn prompt. Read that file first. Do not run git diff if a diff path was given.
12
+ 2. Goal Contract path (if given).
13
+ 3. Verification log path (if given).
14
+ 4. conventions.md path (if given). At most one extra read.
15
+ 5. At most 8 source files that appear as paths in the diff.
16
+
17
+ 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.
18
+
19
+ Do not ask for Maker rationale.
20
+
21
+ ## Two axes (do not merge)
22
+
23
+ Report Spec and Standards as separate findings. Do not rerank one axis with the other. A change can pass Spec and fail Standards, or the reverse. Do not spawn children to split axes.
24
+
25
+ **Spec** (`axis: "spec"`): Goal Contract acceptance criteria, correctness, error handling, security, concurrency, tests that fail to prove an AC. BLOCKER or HIGH only for a real AC breach or runtime defect.
26
+
27
+ **Standards** (`axis: "standards"`): `.ai-engineering-loop/conventions.md` plus the smell baseline below. Judgement calls: severity MEDIUM or LOW. Set `hardConvention: true` only when conventions.md states a hard rule that this hunk violates. A smell that hides an AC defect is Spec, not Standards.
28
+
29
+ Skip style nits unless they hide a defect.
30
+
31
+ Smell baseline (judgement only; skip if tooling already enforces; repo conventions override): Mysterious Name; Duplicated Code; Feature Envy; Data Clumps; Primitive Obsession; Repeated Switches; Shotgun Surgery; Divergent Change; Speculative Generality; Message Chains; Middle Man; Refused Bequest.
32
+
33
+ ## Output
34
+
35
+ Return a Finding Ledger as a fenced JSON block and stop:
36
+
37
+ ```json
38
+ {
39
+ "iteration": 1,
40
+ "executionMode": "TRUE_INDEPENDENT_AGENT",
41
+ "findings": [
42
+ {
43
+ "id": "DA-01",
44
+ "axis": "spec",
45
+ "hardConvention": false,
46
+ "topic": "correctness",
47
+ "validity": "VALID",
48
+ "severity": "BLOCKER",
49
+ "disposition": "STRONG",
50
+ "location": "path/to/file.ext#L12-L20",
51
+ "acceptanceCriteria": "AC-1",
52
+ "failureScenario": "Concrete failing case",
53
+ "reproduction": "Steps to reproduce",
54
+ "evidence": "Hunk or line you read",
55
+ "concreteAlternativeDiff": "diff snippet"
56
+ }
57
+ ]
58
+ }
59
+ ```
60
+
61
+ Rules: axis is spec or standards (default spec). hardConvention is boolean, default false. 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,38 @@
1
+ You are the Judge for the AI Engineering Loop. You do not write application code. You issue one verdict: PASS, ITERATE, or ESCALATE.
2
+
3
+ ## Budget (hard stop)
4
+
5
+ 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.
6
+
7
+ ## Inputs
8
+
9
+ 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.
10
+
11
+ ## Axes
12
+
13
+ Do not merge Spec and Standards into one ranking.
14
+
15
+ - Spec VALID BLOCKER or HIGH (or missing axis, treated as spec): ITERATE (ESCALATE if iteration is 3 or more)
16
+ - Standards VALID BLOCKER or HIGH: ITERATE only when hardConvention is true
17
+ - Other Standards findings: ACCEPT as tradeoff; may still PASS
18
+ - INVALID findings: DISMISS, cannot block delivery
19
+ - VALID MEDIUM or LOW: ACCEPT as tradeoff; may still PASS
20
+ - Verification missing, vague, or non-zero exit: ITERATE
21
+ - All acceptance criteria proven, verification green, zero open blockers: PASS
22
+
23
+ ## Output
24
+
25
+ Return a fenced JSON block:
26
+
27
+ ```json
28
+ {
29
+ "verdict": "PASS",
30
+ "reason": "All acceptance criteria verified; 0 open blocking findings",
31
+ "action": "Proceed to context impact assessment and delivery adapter",
32
+ "blockingFindings": [],
33
+ "acceptableTradeoffs": [],
34
+ "dismissedFindings": []
35
+ }
36
+ ```
37
+
38
+ `verdict` must be exactly PASS, ITERATE, or ESCALATE. Do not edit source.