ai-engineering-loop 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,272 +0,0 @@
1
- # AI Engineering Loop
2
-
3
- <div align="center">
4
-
5
- [![NPM Version](https://img.shields.io/npm/v/ai-engineering-loop.svg?color=cb3837)](https://www.npmjs.com/package/ai-engineering-loop)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/egagofur/ai-engineering-loop/pulls)
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.0-purple.svg)](https://github.com/egagofur/ai-engineering-loop/releases)
10
-
11
- **A Reusable, Framework-Agnostic AI Engineering Operating System for Autonomous Coding Agents**
12
-
13
- *Featuring living project context, post-task impact assessment, contract-driven execution, deterministic machine verification, and independent adversarial review.*
14
-
15
- [Overview](#overview--philosophy) • [Living Project Context](#living-project-context) • [CLI Commands](#cli-interface--commands) • [Agent Integration](#antigravity-agent-integration) • [Lifecycle](#lifecycle-stages) • [Architecture](#architecture--5-layer-configuration) • [Project Profiles](#project-profiles) • [Repository Structure](#repository-structure) • [Reference Examples](#reference-examples) • [Contributing](#contributing)
16
-
17
- </div>
18
-
19
- ---
20
-
21
- ## Overview & Philosophy
22
-
23
- The AI Engineering Loop enforces a clean architectural separation between **Deterministic Living Context Bootstrap** and **Agent Intelligence**:
24
-
25
- > **"The CLI bootstraps, tracks, and validates living context. The AI Agent reasons over that context to execute the engineering lifecycle."**
26
-
27
- ```mermaid
28
- flowchart TD
29
- Start([User Task in Workspace]) --> PreCheck{Pre-Task Drift Check: metadata.json}
30
-
31
- PreCheck -->|Context Missing| AutoInit[Stage 0: Bootstrap .ai-engineering-loop/]
32
- PreCheck -->|Drift Detected| Reconcile[Stage 0: Reconcile Drifted Context]
33
- PreCheck -->|Context Fresh| GC[Stage 1: Goal Contract: Explicit Acceptance Criteria]
34
-
35
- AutoInit --> GC
36
- Reconcile --> GC
37
-
38
- subgraph CoreEngine [AI ENGINEERING OPERATING SYSTEM]
39
- GC --> RCA[Stage 2: Root Cause Analysis]
40
- RCA --> Plan[Stage 3: Implementation Plan]
41
- Plan --> MA[Stage 4: Maker Agent: Surgical Diff & Tests]
42
- MA --> DV{Stage 5: Deterministic Verification}
43
-
44
- DV -->|Fail| MA
45
- DV -->|Pass| DA[Stage 6: Devil's Advocate: Adversarial Review]
46
-
47
- DA --> JD[Stage 7: Judge Agent: Impartial Magistrate]
48
- end
49
-
50
- JD -->|PASS| ImpactEval{Post-Task Context Impact Assessment}
51
-
52
- ImpactEval -->|NONE: Typo, UI tweak| Adapter[Stage 8: Delivery Adapter: GitLab / GitHub]
53
- ImpactEval -->|TARGETED: Dep/route changed| PartialRefresh[Surgical Context Update] --> Adapter
54
- ImpactEval -->|MAJOR: Framework migration| FullRefresh[Full Context Reconciliation] --> Adapter
55
-
56
- Adapter --> TargetRepo[(Target Repository)]
57
- ```
58
-
59
- ---
60
-
61
- ## Living Project Context
62
-
63
- The `.ai-engineering-loop/` directory is **Living Context**, not a static wiki generated once.
64
-
65
- ### 1. Post-Task Context Impact Assessment
66
- A task reaching `PASS` does **not** blindly trigger a full project refresh. The agent evaluates the impact level:
67
- - **`NONE` (80–90% of tasks)**: Typo fixes, CSS tweaks, surgical bugfixes preserving architecture $\rightarrow$ Refresh SKIPPED.
68
- - **`TARGETED` (10–15% of tasks)**: Manifest script change (`verification.md`), new module (`architecture.md`), new CI config (`adapter.md`) $\rightarrow$ Surgically update affected files only.
69
- - **`MAJOR` (<5% of tasks)**: Framework migration, monorepo restructuring, auth overhaul $\rightarrow$ Full context reconciliation.
70
-
71
- ### 2. Context Baseline (`metadata.json`)
72
- Deterministic drift detection without a database:
73
- - Tracks `repositoryRevision` (git commit SHA), `manifestChecksums`, and `lastReconciliation`.
74
- - Enables instant **Level 0 (0ms)** drift verification on subsequent agent invocations.
75
-
76
- ### 3. Strict Context Isolation
77
- - **Project Context (`.ai-engineering-loop/`)**: Shared, living ground truth of engineering rules and architecture.
78
- - **Task Context**: Transient task contracts, acceptance criteria, and active diff scope.
79
- - **Loop State**: Ephemeral finding signatures, iteration counters, and retry attempts.
80
-
81
- ---
82
-
83
- ## CLI Interface & Commands
84
-
85
- The CLI package is published on NPM as [`ai-engineering-loop`](https://www.npmjs.com/package/ai-engineering-loop) and operates against the current working directory.
86
-
87
- ```bash
88
- # Bootstrap .ai-engineering-loop/ context from repository discovery
89
- npx ai-engineering-loop init
90
-
91
- # Check the validity, readiness, and baseline freshness of context
92
- npx ai-engineering-loop status
93
-
94
- # Reconcile drifted context against repository non-destructively
95
- npx ai-engineering-loop refresh
96
-
97
- # Verify context readiness and begin engineering loop
98
- npx ai-engineering-loop run
99
- ```
100
-
101
- ### Command Responsibilities:
102
-
103
- | Command | Purpose | Expected Writes | Mutates App Code? |
104
- |---|---|---|:---:|
105
- | **`init`** | Analyzes repository topology, manifests, and test scripts to generate `.ai-engineering-loop/`. | `.ai-engineering-loop/*` | **NO** |
106
- | **`status`** | Audits the completeness of context files and checks baseline drift (`CURRENT` / `STALE`). | None | **NO** |
107
- | **`refresh`** | Re-analyzes manifests and surgically updates drifted sections while preserving human notes. | `.ai-engineering-loop/*` | **NO** |
108
- | **`run`** | Loads verified context and triggers the AI Agent to execute task engineering. | Governed by Task Scope | By Agent |
109
-
110
- ---
111
-
112
- ## Antigravity Agent Integration
113
-
114
- When working inside the Antigravity IDE or compatible agentic platforms, you can invoke the loop via slash commands:
115
-
116
- - **`/ai-engineering-loop init`**: Initialize project context only (non-destructive bootstrap).
117
- - **`/ai-engineering-loop status`**: Check repository context health & baseline freshness.
118
- - **`/ai-engineering-loop refresh`**: Reconcile drifted context files non-destructively.
119
- - **`/ai-engineering-loop [task description]`**: Execute the full 8-stage engineering lifecycle with pre-task drift gate and post-task impact assessment.
120
-
121
- ---
122
-
123
- ## Lifecycle Stages
124
-
125
- 1. **Stage 0: Living Context & Drift Gate ([`core/project-initialization.md`](core/project-initialization.md), [`core/context-refresh-policy.md`](core/context-refresh-policy.md))**:
126
- - Check `metadata.json` baseline. If fresh $\rightarrow$ proceed. If missing or drifted $\rightarrow$ reconcile context.
127
- 2. **Stage 1: Goal Contract ([`core/goal-contract.md`](core/goal-contract.md))**: Formulate explicit, testable Acceptance Criteria.
128
- 3. **Stage 2: Root Cause Analysis**: End-to-end data tracing and git commit history examination.
129
- 4. **Stage 3: Implementation Plan**: Structured diff proposal and test plan.
130
- 5. **Stage 4: Maker Execution ([`agents/maker.md`](agents/maker.md))**: Surgical implementation and test engineering.
131
- 6. **Stage 5: Deterministic Verification ([`core/verification-loop.md`](core/verification-loop.md))**: 100% green pass on tests, typechecks, linters, and builds.
132
- 7. **Stage 6: Devil's Advocate Review ([`agents/devil-advocate.md`](agents/devil-advocate.md))**: Layered adversarial critique with concrete alternative diffs.
133
- 8. **Stage 7: Judge & Impact Assessment ([`agents/judge.md`](agents/judge.md), [`core/context-impact-assessment.md`](core/context-impact-assessment.md))**: Impartial verdict (`PASS`/`ITERATE`/`ESCALATE`) followed by Context Impact Assessment (`NONE`/`TARGETED`/`MAJOR`).
134
- 9. **Stage 8: Delivery Pipeline ([`adapters/`](adapters/))**: Automated PR/MR generation, multi-branch propagation, and notification dispatch.
135
-
136
- ---
137
-
138
- ## Architecture & 5-Layer Configuration
139
-
140
- The system dynamically resolves configuration and review rules through a cascading 5-layer hierarchy:
141
-
142
- $$\text{GLOBAL} \longrightarrow \text{ENGINEERING CORE} \longrightarrow \text{PROJECT TYPE PROFILE} \longrightarrow \text{PROJECT CONFIG (`.ai-engineering-loop/`)} \longrightarrow \text{TASK CONTRACT}$$
143
-
144
- 1. **GLOBAL**: Host execution safety limits and maximum iteration ceilings (`MAX_ITERATIONS <= 5`).
145
- 2. **ENGINEERING CORE**: Universal loop invariants ([Goal Contract](core/goal-contract.md), [Verification Loop](core/verification-loop.md), [Definition of Done](core/definition-of-done.md)).
146
- 3. **PROJECT TYPE PROFILE ([`profiles/`](profiles/README.md))**: Archetype defaults for web applications, backend APIs, mobile apps, libraries, or monorepos.
147
- 4. **PROJECT CONFIGURATION (`<repo>/.ai-engineering-loop/`)**: Target repository ground truth ([`verification.md`](templates/repo-config/verification.md), [`architecture.md`](templates/repo-config/architecture.md), [`conventions.md`](templates/repo-config/conventions.md)).
148
- 5. **TASK CONTRACT**: Active task-scoped acceptance criteria and diff constraints.
149
-
150
- ---
151
-
152
- ## Project Profiles
153
-
154
- Profiles define technology-specific characteristics and activate relevant review domains for the Devil's Advocate without modifying the core engine:
155
-
156
- | Profile | Specification | Target Tech Stack | Active Review Focus |
157
- |---|---|---|---|
158
- | **`web-app`** | [web-app.md](profiles/web-app.md) | Next.js, Remix, Vite, React, Vue | DOM rendering, responsiveness (320px–4k), accessibility (a11y/ARIA), client state, Core Web Vitals |
159
- | **`backend-api`** | [backend-api.md](profiles/backend-api.md) | Go, Node.js, Python, Java, PostgreSQL | Auth/IDOR, database transactions & ACID rollbacks, concurrency locks (`SELECT FOR UPDATE`), N+1 query loops |
160
- | **`mobile-app`** | [mobile-app.md](profiles/mobile-app.md) | Flutter, React Native, iOS (Swift), Android (Kotlin) | Offline sync queues, OS lifecycle termination & state loss, permission denials, battery/GPS hygiene |
161
- | **`library`** | [library.md](profiles/library.md) | npm/PyPI packages, SDKs, crates | SemVer public API stability, zero dependency bloat, cross-runtime compatibility, bundle tree-shaking |
162
- | **`monorepo`** | [monorepo.md](profiles/monorepo.md) | Turborepo, Nx, Cargo/pnpm workspaces | Cross-package boundaries, circular dependencies, affected scope testing, workspace cache invalidation |
163
-
164
- Profile index: [profiles/README.md](profiles/README.md).
165
-
166
- ---
167
-
168
- ## Repository Structure
169
-
170
- ```text
171
- ai-engineering-loop/
172
-
173
- ├── README.md # Operating system overview & architecture
174
- ├── LICENSE # MIT Open Source License
175
- ├── package.json # CLI package manifest
176
-
177
- ├── bin/ # CLI execution entrypoints
178
- │ └── ai-engineering-loop.js # npx executable CLI (init, status, refresh, run)
179
-
180
- ├── scripts/ # Shell installers
181
- │ └── init.sh # Convenience one-liner installer
182
-
183
- ├── core/ # Generic engineering loop specifications
184
- │ ├── project-initialization.md # Auto-discovery & initialization lifecycle
185
- │ ├── context-refresh-policy.md # Progressive drift hierarchy & living baseline
186
- │ ├── context-impact-assessment.md # Post-task impact assessment (NONE, TARGETED, MAJOR)
187
- │ ├── goal-contract.md # Task contract schema & acceptance criteria
188
- │ ├── verification-loop.md # Dual-layer verification lifecycle
189
- │ ├── definition-of-done.md # 5 pillars of Done & rejection triggers
190
- │ ├── iteration-policy.md # Bounded autonomous loop (MAX_ITERATIONS = 3)
191
- │ ├── escalation-policy.md # Deterministic human escalation triggers
192
- │ ├── judge-policy.md # Evaluation rules, triage audit, & verdicts
193
- │ ├── configuration-precedence.md # 5-layer precedence & conflict resolution
194
- │ └── repo-config-schema.md # Schema for target repo .ai-engineering-loop/
195
-
196
- ├── profiles/ # Project archetype profiles
197
- │ ├── README.md # Profile catalog & auto-detection rules
198
- │ ├── web-app.md # Frontend web applications
199
- │ ├── backend-api.md # Backend APIs & microservices
200
- │ ├── mobile-app.md # Native & cross-platform mobile apps
201
- │ ├── library.md # Reusable SDKs & shared packages
202
- │ └── monorepo.md # Multi-package monorepo workspaces
203
-
204
- ├── agents/ # Triad agent role specifications
205
- │ ├── maker.md # Maker agent: surgical diffs & unit tests
206
- │ ├── devil-advocate.md # Adversarial reviewer: layered review rules & concrete diffs
207
- │ └── judge.md # Judge agent: neutral magistrate & verdict computation
208
-
209
- ├── policies/ # Operational schemas & algorithms
210
- │ ├── discovery-safety-policy.md # Secret protection & non-destructive discovery rules
211
- │ ├── finding-policy.md # Standardized finding schema & severity matrix
212
- │ ├── evidence-policy.md # 5-level evidence hierarchy
213
- │ └── no-progress-policy.md # Finding signature hashing & stagnation detection
214
-
215
- ├── adapters/ # Pluggable delivery pipelines
216
- │ └── dot/ # DOT Indonesia delivery adapter
217
- │ ├── README.md # DOT adapter overview
218
- │ ├── gitlab.md # glab CLI, issue cards, & MR generation
219
- │ ├── multi-branch.md # main / staging / develop cherry-pick propagation
220
- │ ├── coreview.md # @coreview-bot external review triage (Valid vs Halu)
221
- │ └── mattermost.md # Channel mapping & MCP dispatch (from: "AI Agent")
222
-
223
- ├── templates/ # Starter templates for target repositories
224
- │ └── repo-config/ # Ready-to-copy .ai-engineering-loop/ files
225
- │ ├── config.md # Project identity & profile binding
226
- │ ├── architecture.md # Layers & boundary invariants
227
- │ ├── conventions.md # Code standards & forbidden patterns
228
- │ ├── verification.md # CLI test/lint/build commands
229
- │ └── adapter.md # Configured release pipeline
230
-
231
- ├── examples/ # End-to-end multi-archetype reference walkthroughs
232
- │ ├── initialization/ # Unconfigured Monorepo auto-discovery trace
233
- │ ├── dot/attendance-confirmation/ # Scenario A: DOT Web Application bugfix & multi-branch MRs
234
- │ ├── backend-api/payment-idempotency/# Scenario B: Go/PostgreSQL race condition & idempotency fix
235
- │ └── mobile-app/offline-sync-queue/ # Scenario C: Flutter/SQLite offline sync queue
236
-
237
- └── docs/ # Meta-documentation & integration guides
238
- ├── migration-plan.md # 8-phase legacy workflow mapping & rationale
239
- └── antigravity-feasibility.md # Antigravity runtime evaluation & subagent orchestration
240
- ```
241
-
242
- ---
243
-
244
- ## Reference Examples
245
-
246
- - **[Auto-Initialization Trace](examples/initialization/README.md)**: Demonstrates the step-by-step discovery of an unconfigured TypeScript/Go monorepo.
247
- - **[Scenario A: DOT Web Application](examples/dot/attendance-confirmation/README.md)**: Resolves an attendance status bug across `main`, `staging`, and `develop` with `@coreview-bot` triage and Mattermost dispatch.
248
- - **[Scenario B: Backend API Service](examples/backend-api/payment-idempotency/README.md)**: Eliminates double-spend race conditions in Go/PostgreSQL with `SELECT FOR UPDATE` and automated race test suites.
249
- - **[Scenario C: Mobile Application](examples/mobile-app/offline-sync-queue/README.md)**: Implements an offline SQLite mutation queue in Flutter with network flapping tolerance and state preservation.
250
-
251
- ---
252
-
253
- ## Contributing
254
-
255
- Contributions, feedback, and new adapter profiles are welcome.
256
-
257
- 1. Fork the repository (`https://github.com/egagofur/ai-engineering-loop/fork`).
258
- 2. Create your feature branch (`git checkout -b feature/new-adapter`).
259
- 3. Ensure all changes adhere to [core/definition-of-done.md](core/definition-of-done.md).
260
- 4. Open a Pull Request.
261
-
262
- ---
263
-
264
- ## License
265
-
266
- This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.
267
-
268
- ---
269
-
270
- <div align="center">
271
- Designed for software engineering teams and autonomous AI coding agents.
272
- </div>
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const { execSync } = require('child_process');
6
-
7
- const rootDir = path.resolve(__dirname, '..');
8
- const readmePath = path.join(rootDir, 'README.md');
9
- const readmeNpmPath = path.join(rootDir, 'README.npm.md');
10
- const backupPath = path.join(rootDir, '.README.github.bak.md');
11
-
12
- try {
13
- console.log('[publish-npm] 1. Backing up full GitHub README.md...');
14
- fs.copyFileSync(readmePath, backupPath);
15
-
16
- console.log('[publish-npm] 2. Replacing README.md with simplified README.npm.md...');
17
- fs.copyFileSync(readmeNpmPath, readmePath);
18
-
19
- console.log('[publish-npm] 3. Running npm publish --access public...');
20
- execSync('npm publish --access public', { cwd: rootDir, stdio: 'inherit' });
21
-
22
- console.log('[publish-npm] 4. Publishing completed successfully.');
23
- } catch (error) {
24
- console.error('[publish-npm] Publishing failed:', error.message);
25
- } finally {
26
- if (fs.existsSync(backupPath)) {
27
- console.log('[publish-npm] 5. Restoring full GitHub README.md...');
28
- fs.copyFileSync(backupPath, readmePath);
29
- fs.unlinkSync(backupPath);
30
- console.log('[publish-npm] Full GitHub README.md restored.');
31
- }
32
- }