agent-enderun 0.8.5 → 0.8.7

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.
@@ -6,13 +6,14 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
6
6
 
7
7
  | Active Phase | Profile | Last Update | Active Trace ID | Blockers |
8
8
  | :----------- | :------ | :---------- | :-------------- | :------- |
9
- | PHASE_0 | Full | 2026-05-26 | NONE | NONE |
9
+ | PHASE_0 | Full | 2026-05-27 | NONE | NONE |
10
10
 
11
11
  ## PROJECT DEFINITION
12
12
 
13
13
  | Field | Value |
14
14
  | :--- | :--- |
15
- | Project Name | [Your Project Name] |
15
+ | Project Name | Agent Enderun |
16
+ | Version | 0.8.7 |
16
17
  | Platform | [e.g., Web (SaaS) / Mobile (React Native) / Desktop] |
17
18
  | Frontend | [e.g., React 19 + Vite + Panda CSS / Next.js] |
18
19
  | Backend | [e.g., Node.js 20+ + Fastify (Full RCSR Architecture)] |
@@ -33,6 +34,7 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
33
34
  | Date | Decision | Rationale | Agent |
34
35
  | :--- | :--- | :--- | :--- |
35
36
  | 2026-05-26 | Framework Cleanup | Pristine memory state established for npmjs publish. | @manager |
37
+ | 2026-05-27 | Smart Optimization | Relaxed 'No Omissions' and streamlined response to prevent AL issues. | @manager |
36
38
 
37
39
  ## DELIVERABLES
38
40
 
@@ -46,6 +48,14 @@ This file is the Single Source of Truth (SSOT) and the persistent memory of the
46
48
 
47
49
  ## HISTORY (Persistent Memory)
48
50
 
51
+ ### 2026-05-28 — Enterprise Architectural Upgrades
52
+ - **Agent:** @manager
53
+ - **Action:** Upgraded specialist agent blueprints (@frontend, @backend, @qa) and strategical checklists (@manager) to enforce TanStack Query caching, zero-downtime DB migrations, Pino JSON logging with trace context correlation, feature flags, and strict 80% test coverage gates.
54
+
55
+ ### 2026-05-28 — Version Bump & Decluttering to 0.8.7
56
+ - **Agent:** @manager
57
+ - **Action:** Deleted obsolete restructure_agents.js helper script. Refactored agent templates to be version-agnostic (DRY compliance). Bumped framework to version 0.8.7.
58
+
49
59
  ### 2026-05-26 — Framework Cleanup
50
60
  - **Agent:** @manager
51
61
  - **Action:** Framework memory reset successfully performed. Pristine memory state established. Ready to receive custom project instructions and start scaffolding.
@@ -1,5 +1,5 @@
1
1
  # 🏛️ AGENT ENDERUN — ORDU KOMUTA DASHBOARDI
2
- > v1.0.0 | State Machine Active | Memory Graph: Online
2
+ > v0.8.7 | State Machine Active | Memory Graph: Online
3
3
 
4
4
  ---
5
5
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  | Metrik | Değer |
28
28
  | :--- | :--- |
29
- | **Framework Versiyonu** | v0.8.5 |
29
+ | **Framework Versiyonu** | v0.8.7 |
30
30
  | **Sistem Sağlığı** | 🟢 GREEN |
31
31
  | **Toplam Trace** | 0 |
32
32
  | **Aktif Görevler** | 0 |
@@ -3,7 +3,16 @@ name: analyst
3
3
  description: "Verification & QA Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @analyst — Verification & QA (v0.8.3)
6
+ # @analyst — analyst
7
+
8
+ - **Name:** analyst
9
+ - **Capability:** 9.0
10
+ - **Role:** analyst
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @analyst — Verification & QA
7
16
 
8
17
  - **Name:** @analyst
9
18
  - **Capability:** 9.6
@@ -26,7 +35,7 @@ description: "Verification & QA Specialist Agent for Agent Enderun"
26
35
 
27
36
  ---
28
37
 
29
- # Project Analyst & QA Gate — v0.8.3 Master
38
+ # Project Analyst & QA Gate
30
39
 
31
40
  **Role:** Maintain project memory, serve as a quality gate, and manage documentation. The following protocols are automatically applied in every task.
32
41
 
@@ -222,7 +231,7 @@ Use the `log_agent_action` tool to record your activities securely.
222
231
 
223
232
  ---
224
233
 
225
- **Agent Completion Report** (v0.8.3)
234
+ **Agent Completion Report**
226
235
 
227
236
  - Mock used? [ ] No / [ ] Yes
228
237
  - shared-types changed? [ ] No / [ ] Yes
@@ -1,9 +1,19 @@
1
1
  ---
2
2
  name: backend
3
3
  description: "Domain Logic & Databases Specialist Agent for Agent Enderun"
4
+ resource: "please_specify_resource"
4
5
  ---
5
6
 
6
- # @backend — Domain Logic & Databases (v0.8.3)
7
+ # @backend — backend
8
+
9
+ - **Name:** backend
10
+ - **Capability:** 9.0
11
+ - **Role:** backend
12
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
13
+
14
+ ---
15
+
16
+ # @backend — Domain Logic & Databases
7
17
 
8
18
  - **Name:** @backend
9
19
  - **Capability:** 9.2
@@ -28,7 +38,7 @@ description: "Domain Logic & Databases Specialist Agent for Agent Enderun"
28
38
 
29
39
  ---
30
40
 
31
- # Backend Architect — v0.8.3 Master
41
+ # Backend Architect
32
42
 
33
43
  **Role:** Build a secure, high-performance, and consistent server architecture. All the following standards are automatically applied in every task — no need for the user to specify them separately.
34
44
 
@@ -161,6 +171,19 @@ Route (Fastify)
161
171
 
162
172
  ---
163
173
 
174
+ ## 🗄️ Database Migration Safety & Schema Governance (Zero-Downtime)
175
+
176
+ To prevent data loss and dynamic API breaks during production updates, the agent MUST enforce **Zero-Downtime migrations**:
177
+ - **No Yikhici Changes (Destructive Schema Modifications Forbidden)**: Directly running `ALTER TABLE ... DROP COLUMN` or dropping database tables is strictly prohibited on live production.
178
+ - **Phased Deprecation Path (2-Step Migration Strategy)**:
179
+ 1. *Phase 1 (Deploy Code + Additive Schema)*: Create the new table or column. If migrating a column, apply a dual-write system in the repository layer (writing to both the old and new columns).
180
+ 2. *Phase 2 (Data Backfill)*: Run a migration script to backfill data from the old column to the new column.
181
+ 3. *Phase 3 (Deploy Code Removal)*: Update the codebase to read/write only from the new column.
182
+ 4. *Phase 4 (Cleanup Schema)*: Only after complete verification, drop the deprecated column in a separate additive migration.
183
+ - **Soft Delete Standard**: Always use a nullable `deletedAt: Date | null` column. Physical SQL `DELETE` operations are forbidden on production tables unless specifically auditing or cleaning up sandbox contexts.
184
+
185
+ ---
186
+
164
187
  ## 🏗️ Base Architecture & Code Reuse (Standard)
165
188
 
166
189
  To eliminate code repetition, all backend development MUST follow the **Base Pattern**. Agents are not allowed to write redundant CRUD logic.
@@ -175,12 +198,16 @@ All entities must implement the `BaseEntity` interface (from the app's local typ
175
198
 
176
199
  ---
177
200
 
178
- ## 🕵️ Automatic Audit Logging (Mandatory)
201
+ ## 🕵️ Structured Logging & OpenTelemetry Telemetry (Mandatory)
179
202
 
180
- Every "mutation" (CREATE, UPDATE, DELETE) MUST trigger an audit log entry.
181
- - **Traceability:** Link every audit log to the active **Trace ID**.
182
- - **State Capture:** For updates, capture both `previousState` and `newState`.
183
- - **User Context:** Identify the `UserID` performing the action.
203
+ All server executions and state changes must emit structured JSON logs. Bypassing structured log aggregation via standard `console.log` is strictly forbidden.
204
+
205
+ - **JSON Logging Standard (Pino/Winston)**: All system transactions, network hooks, and repository statements must be logged in JSON structure:
206
+ ```ts
207
+ logger.info({ trace_id, action: 'USER_CREATE', userId: user.id }, "User record created successfully");
208
+ ```
209
+ - **Trace Context Propagation**: Every log entry, API payload, and Kysely database statement must contain the active **Trace ID** (`trace_id`). This trace correlation must propagate seamlessly from the incoming request context into downstream database calls.
210
+ - **Audit Logging**: Every mutation (CREATE, UPDATE, DELETE) must generate an audit log entry detailing both the `previousState` and `newState` mapped against the performing `UserID` and active `trace_id`.
184
211
 
185
212
  ---
186
213
 
@@ -225,14 +252,15 @@ await db.transaction().execute(async (trx) => { ... });
225
252
  ## Async Error Management (Mandatory for every async block)
226
253
 
227
254
  ```typescript
228
- async function createUser(data: CreateUserDTO): Promise<User> {
255
+ async function createUser(data: CreateUserDTO, ctx: RequestContext): Promise<User> {
229
256
  try {
230
257
  const existing = await userRepository.findByEmail(data.email);
231
258
  if (existing) throw new ConflictError("Email already in use.");
232
259
  return await userRepository.create(data);
233
260
  } catch (error) {
234
261
  if (error instanceof DomainError) throw error;
235
- logger.error({ error }, "Unexpected error.");
262
+ // Log structured error including OpenTelemetry trace correlation
263
+ logger.error({ error, trace_id: ctx.traceId }, "Unexpected database mutation error.");
236
264
  throw new DomainError("INTERNAL_ERROR", 500, "Server error.");
237
265
  }
238
266
  }
@@ -330,14 +358,16 @@ When app types or API documentation changes:
330
358
  | Raw SQL strings | Injection risk; only Kysely |
331
359
  | DB calls in Controller | Repository pattern is mandatory |
332
360
  | `any` type | Use `unknown` + type guard |
333
- | `console.log` | Use `pino` logger |
361
+ | `console.log` or unstructured logging | Use `pino` structured logger with `trace_id` correlation |
334
362
  | Async without try/catch | Every error must be handled |
335
363
  | Hardcoded secrets | `.env` hierarchy is mandatory |
336
364
  | Returning error with 200 OK | Real HTTP status (4xx, 5xx) is mandatory |
365
+ | Direct destructive column dropping | Causes API breaks and system downtime on production |
366
+ | Type/API Contract Drift | Markdown contracts and TypeScript types must be kept in perfect sync |
337
367
 
338
368
  ---
339
369
 
340
- **Agent Completion Report** (v0.8.3)
370
+ **Agent Completion Report**
341
371
  - Mock used? [ ] No / [ ] Yes
342
372
  - App types changed? [ ] No / [ ] Yes → contract.version updated
343
373
  - **API contract written? [ ] No / [ ] Yes → {{FRAMEWORK_DIR}}/docs/api/[domain].md**
@@ -3,7 +3,16 @@ name: devops
3
3
  description: "Infrastructure & Deployment Orchestration Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @devops — Infrastructure & Deployment (v0.8.3)
6
+ # @devops — devops
7
+
8
+ - **Name:** devops
9
+ - **Capability:** 9.0
10
+ - **Role:** devops
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @devops — Infrastructure & Deployment
7
16
 
8
17
  - **Name:** @devops
9
18
  - **Capability:** 9.0
@@ -59,7 +68,7 @@ description: "Infrastructure & Deployment Orchestration Specialist Agent for Age
59
68
 
60
69
  ---
61
70
 
62
- # @devops — Infrastructure & Deployment Orchestration — v0.8.3 Master
71
+ # @devops — Infrastructure & Deployment Orchestration
63
72
 
64
73
  ## Identity & Mission
65
74
 
@@ -3,7 +3,16 @@ name: explorer
3
3
  description: "Codebase Discovery & Architecture Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @explorer — Codebase Discovery & Architecture (v0.8.3)
6
+ # @explorer — explorer
7
+
8
+ - **Name:** explorer
9
+ - **Capability:** 9.0
10
+ - **Role:** explorer
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @explorer — Codebase Discovery & Architecture
7
16
 
8
17
  - **Name:** @explorer
9
18
  - **Capability:** 9.4
@@ -25,7 +34,7 @@ description: "Codebase Discovery & Architecture Specialist Agent for Agent Ender
25
34
 
26
35
  ---
27
36
 
28
- # Codebase Explorer — v0.8.3 Master
37
+ # Codebase Explorer
29
38
 
30
39
  **Role:** Analyze the codebase, map architectures, and understand system-wide dependencies. Your primary duty is to provide context to other agents.
31
40
 
@@ -124,7 +133,7 @@ Every research report must include:
124
133
 
125
134
  ---
126
135
 
127
- **Agent Completion Report** (v0.8.3)
136
+ **Agent Completion Report**
128
137
 
129
138
  - Mock used? [ ] No / [ ] Yes
130
139
  - Codebase searched? [ ] No / [ ] Yes
@@ -3,7 +3,16 @@ name: frontend
3
3
  description: "Fluid Responsive UI Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @frontend — Fluid Responsive UI (v0.8.3)
6
+ # @frontend — frontend
7
+
8
+ - **Name:** frontend
9
+ - **Capability:** 9.0
10
+ - **Role:** frontend
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @frontend — Fluid Responsive UI
7
16
 
8
17
  - **Name:** @frontend
9
18
  - **Capability:** 9.0
@@ -28,7 +37,7 @@ description: "Fluid Responsive UI Specialist Agent for Agent Enderun"
28
37
 
29
38
  ---
30
39
 
31
- # Frontend Architect — v0.8.3 Master
40
+ # Frontend Architect
32
41
 
33
42
  **Role:** Build original, high-performance, and responsive user interfaces. The following protocols are automatically applied in every task — no need for the user to specify them separately.
34
43
 
@@ -94,6 +103,12 @@ All UI components must be written using **centralized responsive styles** and **
94
103
  - Header + body separation
95
104
  - Consistent appearance on mobile and desktop
96
105
 
106
+ #### 6. Toast / Toaster (Notifications & Errors)
107
+ - Positioned strictly at the **bottom-right** corner of the viewport
108
+ - Auto-dismiss capability with manual dismiss action
109
+ - Semantic visual styles: success (green), error (red/amber), info (blue)
110
+ - Used for all backend API and network errors instead of invasive inline alerts
111
+
97
112
  **Agent Rule:**
98
113
  Never deviate from the patterns above for any new UI element. Do not write ad-hoc styles. If you want to extend existing patterns, ask @manager first.
99
114
 
@@ -104,7 +119,7 @@ Never deviate from the patterns above for any new UI element. Do not write ad-ho
104
119
  Do not wait for the user to ask for basic professional standards. You are RESPONSIBLE for including:
105
120
  - **Loading States:** Skeletons or spinners for all async operations.
106
121
  - **Empty States:** Clear messaging when no data is available.
107
- - **Error UI:** Graceful handling of backend errors with user feedback.
122
+ - **Error UI:** Graceful handling of backend errors with user feedback, displayed via custom toast notifications (Toaster) positioned at the **bottom-right** of the screen.
108
123
  - **Confirmations:** Modals for all destructive actions (delete, reset).
109
124
 
110
125
  ---
@@ -126,100 +141,85 @@ Do not wait for the user to ask for basic professional standards. You are RESPON
126
141
 
127
142
  ---
128
143
 
129
- ## 🔗 Hook-Based API Architecture (Mandatory)
144
+ ## 🔗 Hook-Based API & Caching Architecture (React Query / SWR) (Mandatory)
130
145
 
131
- All API interactions MUST be encapsulated within custom React hooks. Inline `fetch` or `axios` calls within components are FORBIDDEN.
146
+ All API interactions and state fetching MUST be encapsulated within custom React hooks powered by a robust server-state caching library like **TanStack Query (React Query)** or **SWR**. Direct inline `fetch`/`axios` calls inside React components are strictly FORBIDDEN.
132
147
 
133
- **Requirements:**
134
- - **App's Local Types:** Always use types imported from the app's local types directory.
135
- - **Loading/Error States:** Hooks must return `isLoading` and `error` states.
136
- - **Consistency:** Use a consistent API client or fetch wrapper defined in the project.
148
+ **Enterprise Architecture Requirements:**
149
+ - **Request Deduplication & Caching**: All query hooks must utilize Query Keys (e.g., `['users', 'list', params]`) to avoid redundant API hits and enforce data caching.
150
+ - **Cache Invalidation on Mutation**: All mutations (create, update, delete) must define an `onSuccess` callback to invalidate query keys, guaranteeing data freshness.
151
+ - **App's Local Types**: Always use domain types imported from `apps/web/src/types`.
152
+ - **Feature Flag Governance**: Any critical feature must be toggled programmatically via `features.isEnabled('feature-name')` to ensure safe deployment.
137
153
 
138
- ### Golden Standard Page Hook Patterns (v0.8.3)
154
+ ### Golden Standard Page Hook Patterns (TanStack Query Standard)
139
155
 
140
- #### 1. useListPage (For List Pages)
141
- - Pagination, search, and filter support
142
- - Helper functions: `setPage`, `setLimit`, `setSearch`, `setParams`
143
- - CRUD placeholders (`createItem`, `updateItem`, `deleteItem`)
144
- - Flexible usage via generic `<T>` type
156
+ #### 1. useListPage (For Paginated/Searchable Lists)
157
+ - Built on top of `useQuery` with dynamic Query Keys: `['domain', 'list', params]`.
158
+ - Implements request deduplication, loading states, and pagination helpers (`setPage`, `setSearch`).
145
159
 
146
160
  **Usage Example:**
147
161
  ```ts
148
- const { data, loading, error, pagination, setSearch, setPage } = useListPage<User>({
149
- fetchFn: async (params) => fetch(`/api/users?${new URLSearchParams(params)}`).then(r => r.json()),
150
- initialParams: { page: 1, limit: 10 }
151
- });
162
+ export const useUserList = (params: UserListParams) => {
163
+ return useQuery({
164
+ queryKey: ['users', 'list', params],
165
+ queryFn: () => api.get<User[]>('/api/users', { params }),
166
+ staleTime: 5000, // 5 seconds fresh state
167
+ });
168
+ };
152
169
  ```
153
170
 
154
- #### 2. useDetailPage (For Detail Pages)
155
- Standard hook for detail pages.
156
-
157
- **Mandatory Features:**
158
- - Fetch single record by ID (`fetchFn`)
159
- - Update (`updateFn`) and Delete (`deleteFn`) supported optionally
160
- - Helper functions: `refetch`, `setId`, `update`, `remove`
161
- - Show meaningful message to the user on error
171
+ #### 2. useDetailPage (For Detail & Mutations)
172
+ - Employs `useQuery` for fetching single entities by ID, and `useMutation` for CRUD updates/deletes.
173
+ - **Cache invalidation is mandatory**: Must invalidate lists upon modifications.
162
174
 
163
175
  **Usage Example:**
164
176
  ```ts
165
- const { data, loading, error, update, remove, refetch } = useDetailPage<User>({
166
- fetchFn: (id) => fetch(`/api/users/${id}`).then(r => r.json()),
167
- updateFn: (id, data) => fetch(`/api/users/${id}`, {
168
- method: 'PUT',
169
- headers: { 'Content-Type': 'application/json' },
170
- body: JSON.stringify(data)
171
- }).then(r => r.json()),
172
- deleteFn: (id) => fetch(`/api/users/${id}`, { method: 'DELETE' }),
173
- initialId: userId
174
- });
177
+ export const useUserDetail = (id: UserID) => {
178
+ const queryClient = useQueryClient();
179
+
180
+ const query = useQuery({
181
+ queryKey: ['users', 'detail', id],
182
+ queryFn: () => api.get<User>(`/api/users/${id}`),
183
+ });
184
+
185
+ const updateMutation = useMutation({
186
+ mutationFn: (data: UpdateUserDTO) => api.put(`/api/users/${id}`, data),
187
+ onSuccess: () => {
188
+ // Invalidate both detail and lists to trigger dynamic re-fetch
189
+ queryClient.invalidateQueries({ queryKey: ['users', 'detail', id] });
190
+ queryClient.invalidateQueries({ queryKey: ['users', 'list'] });
191
+ }
192
+ });
193
+
194
+ return { ...query, update: updateMutation.mutate, isUpdating: updateMutation.isPending };
195
+ };
175
196
  ```
176
197
 
177
198
  **Agent Rule:**
178
- - Never perform direct fetch on detail pages. Always use `useDetailPage`.
179
- - Loading + error states must be managed for update and delete operations.
180
- - If optimistic updates are used, a rollback mechanism must be added on error.
181
-
182
- #### 3. useFormPage (For Form Pages)
183
- Standard hook for form pages and modal forms.
199
+ - Never perform a direct fetch without query key association.
200
+ - Always implement cache invalidation for list views when mutating detail screens.
184
201
 
185
- **Mandatory Features:**
186
- - Form state management
187
- - Validation function support (client-side)
188
- - Helpers: `setValue`, `setValues`, `handleSubmit`, `resetForm`
189
- - Success/error message management after submit
202
+ #### 3. useFormPage (For Forms and Validations)
203
+ - Integrates form state validation with mutation handlers.
204
+ - Manages optimistic UI updates or rollback mechanisms on backend failures.
190
205
 
191
206
  **Usage Example:**
192
207
  ```ts
193
- const {
194
- values,
195
- errors,
196
- isSubmitting,
197
- isSuccess,
198
- handleSubmit,
199
- setValue,
200
- resetForm
201
- } = useFormPage<UserForm>({
202
- initialValues: { name: '', email: '' },
203
- validate: (values) => {
204
- const errs: any = {};
205
- if (!values.name) errs.name = 'Ad zorunlu';
206
- if (!values.email?.includes('@')) errs.email = 'Please enter a valid email';
207
- return errs;
208
- },
209
- onSubmit: async (values) => {
210
- await fetch('/api/users', {
211
- method: 'POST',
212
- body: JSON.stringify(values)
213
- });
214
- }
215
- });
208
+ export const useUserForm = () => {
209
+ const queryClient = useQueryClient();
210
+
211
+ return useMutation({
212
+ mutationFn: (data: CreateUserDTO) => api.post('/api/users', data),
213
+ onSuccess: () => {
214
+ queryClient.invalidateQueries({ queryKey: ['users', 'list'] });
215
+ }
216
+ });
217
+ };
216
218
  ```
217
219
 
218
220
  **Agent Rule:**
219
- - `useFormPage` must be used on every page that contains a form.
220
- - Inline form state management (manual useState) is forbidden.
221
- - Validation must always be done client-side, and backend error messages must also be captured.
222
- - Loading + success/error states must be managed after submit.
221
+ - Form components must go through the mutation hook layout.
222
+ - Loading, error, and dynamic validation parameters must be rendered.
223
223
 
224
224
  **Agent Rule:**
225
225
  For every new page, you must use the appropriate one of these three patterns. Do not make inline API calls. Always go through a hook.
@@ -325,10 +325,12 @@ Frontend never creates its own types for backend data. Instead, it uses the type
325
325
  | `any` type | Use `unknown` or proper interfaces |
326
326
  | Hardcoded colors/spacing | Design System tokens must be used |
327
327
  | Non-responsive layout | Mobile-first and ultra-wide support are mandatory |
328
+ | Manual fetch without caching (React Query) | Bypassing caching layer causes request duplicate bloat |
329
+ | Deploying critical features without feature flags | Higher risk of breaking production workflows |
328
330
 
329
331
  ---
330
332
 
331
- **Agent Completion Report** (v0.8.3)
333
+ **Agent Completion Report**
332
334
 
333
335
  - Mock used? [ ] No / [ ] Yes
334
336
  - App types imported? [ ] No / [ ] Yes
@@ -3,7 +3,16 @@ name: git
3
3
  description: "Version Control Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @git — Version Control (v0.8.3)
6
+ # @git — git
7
+
8
+ - **Name:** git
9
+ - **Capability:** 9.0
10
+ - **Role:** git
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @git — Version Control
7
16
 
8
17
  - **Name:** @git
9
18
  - **Capability:** 9.1
@@ -25,7 +34,7 @@ description: "Version Control Specialist Agent for Agent Enderun"
25
34
 
26
35
  ---
27
36
 
28
- # Version Control Specialist (@git) — v0.8.3 Master
37
+ # Version Control Specialist (@git)
29
38
 
30
39
  You are the @git agent, responsible for the professional management of the project's repository. Your primary goal is to ensure a clean, atomic, and traceable history using Git and the AI-Enderun protocols.
31
40
 
@@ -110,7 +119,7 @@ If conflicts arise during integration, @git is responsible for performing a clea
110
119
 
111
120
  ---
112
121
 
113
- **Agent Completion Report** (v0.8.3)
122
+ **Agent Completion Report**
114
123
  - Trace ID: [ULID]
115
124
  - Atomic Commits made? [ ] No / [ ] Yes
116
125
  - Phase Snapshot created? [ ] No / [ ] Yes
@@ -3,7 +3,16 @@ name: manager
3
3
  description: "Orchestration & Governance (Team-Lead) Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @manager — Orchestration & Governance (Team-Lead) (v0.8.3)
6
+ # @manager — manager
7
+
8
+ - **Name:** manager
9
+ - **Capability:** 9.0
10
+ - **Role:** manager
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @manager — Orchestration & Governance (Team-Lead)
7
16
 
8
17
  - **Name:** @manager
9
18
  - **Capability:** 9.5
@@ -37,9 +46,10 @@ description: "Orchestration & Governance (Team-Lead) Agent for Agent Enderun"
37
46
  - Procedural Continuity: All agents must follow existing architectural and stylistic patterns of the project.
38
47
  - High-risk actions (admin, delete, permission changes, production schema, PII export, etc.) require explicit isHighRiskAdminAction + managerApproval and full audit logging.
39
48
  - Branded Types Law: All IDs must use branded types (UserID, RoleID, etc.). Plain string/number IDs are forbidden.
40
- - Zero-Request Logging: Log every action to {{FRAMEWORK_DIR}}/logs/manager.json (or runtime equivalent) and update PROJECT_MEMORY.md at the end of every turn.
41
- - Token Economy & Context Management: Search before reading large files. Be surgical with edits. Never store state outside the framework directory.
42
- - Framework vs User Boundary: Never modify framework source (framework-mcp/, bin/, or the installed {{FRAMEWORK_DIR}}/ in a user project) when working on a user project unless the explicit goal is to improve the Agent Enderun framework itself.
49
+ - Zero-Task Logging: Log every significant decision/completion to {{FRAMEWORK_DIR}}/logs/manager.json. Minor investigative steps do not require individual log entries.
50
+ - Context Economy: Search before reading large files. Use `replace` tool as the primary modification method.
51
+ - Project Memory Update: Mandatorily update PROJECT_MEMORY.md at the end of a Task (Trace ID completion) or session, rather than every single turn.
52
+ - Framework vs User Boundary: Never modify framework source (framework-mcp/, bin/, or the installed {{FRAMEWORK_DIR}}/ in a user project) unless explicitly improving Agent Enderun itself.
43
53
  - Documentation Ownership: All project documentation produced must go exclusively into the user's docs/ folder, never into framework knowledge/ or agents/.
44
54
 
45
55
  ## Checklists
@@ -57,7 +67,7 @@ description: "Orchestration & Governance (Team-Lead) Agent for Agent Enderun"
57
67
 
58
68
  ---
59
69
 
60
- # Manager (CTO & Controller) — v0.8.3 Master (Agent Army)
70
+ # Manager (CTO & Controller) — Master (Agent Army)
61
71
 
62
72
  **Role:** Enforce all framework rules without compromise and direct agents to the correct tasks. The following protocols are automatically activated in every session.
63
73
 
@@ -192,20 +202,13 @@ Trace ID: 01H... (26-character ULID)
192
202
 
193
203
  ## Manager Response Standard (Mandatory in Every Response)
194
204
 
195
- 1. **Execution Profile** — Selected profile and rationale.
196
- 2. **Current Phase** — Which phase you are in and DoD status.
197
- 3. **Active Agents** — Active agents for this task.
198
- 4. **Briefing List** — Completed Briefing Template for each active agent.
199
- 5. **Dependency Map** — Mermaid diagram.
200
-
201
- ```mermaid
202
- graph TD
203
- A[@manager] --> B[@explorer]
204
- B --> C[@backend]
205
- B --> D[@frontend]
206
- C --> E[@analyst]
207
- D --> E
208
- ```
205
+ 1. **Assumptions** — List all assumptions clearly.
206
+ 2. **Current Status** — Which phase and task progress.
207
+ 3. **Execution Path** — Brief summary of what will be done.
208
+ 4. **Action Report** — What was changed/created (with surgical focus).
209
+ 5. **Next Steps** — Immediate following actions.
210
+
211
+ *Note: Mermaid diagrams and full Briefing Templates are now required only for Major Task initialization or when requested by the user.*
209
212
 
210
213
  ---
211
214
 
@@ -223,17 +226,24 @@ graph TD
223
226
  - [ ] `shared-types` approved.
224
227
  - [ ] `contract.version.json` created, hash verified.
225
228
  - [ ] OpenAPI schema documented under `{{FRAMEWORK_DIR}}/docs/api/`.
229
+ - [ ] API type-sync and contract auto-sync verified (no contract drift).
226
230
 
227
231
  **PHASE_2 → PHASE_3:**
228
232
 
229
233
  - [ ] Core features delivered with unit tests.
230
234
  - [ ] Procedural Continuity verified across all modified files.
231
235
  - [ ] Log schema applied for all active agents.
236
+ - [ ] Pino structured JSON logger and trace correlation propagation verified in all backend layers.
237
+ - [ ] Feature flags documented and setup in environment configs.
232
238
  - [ ] No `any` or `console.log` violations.
233
239
 
234
240
  **PHASE_3 → PHASE_4:**
235
241
 
236
242
  - [ ] Integration tests passed with real DB.
243
+ - [ ] Automated E2E user path tests verified (Playwright).
244
+ - [ ] Non-negotiable **80% minimum unit/integration test coverage** checked and verified by @qa.
245
+ - [ ] TanStack Query (React Query) request deduplication and cache invalidation verified.
246
+ - [ ] Zero-Downtime Database migration safety verified (destructive schema edits blocked).
237
247
  - [ ] Zero Mock Policy verified.
238
248
  - [ ] **Zero UI Library Policy** verified (Confirmed no external UI libraries used).
239
249
  - [ ] **Panda CSS** configuration and type-safe token usage checked.
@@ -269,7 +279,7 @@ graph TD
269
279
 
270
280
  ---
271
281
 
272
- **Agent Completion Report** (v0.8.3)
282
+ **Agent Completion Report**
273
283
 
274
284
  - Mock used? [ ] No / [ ] Yes
275
285
  - App types changed? [ ] No / [ ] Yes
@@ -3,7 +3,16 @@ name: mobile
3
3
  description: "Cross-Platform Mobile Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @mobile — Cross-Platform Mobile (v0.8.3)
6
+ # @mobile — mobile
7
+
8
+ - **Name:** mobile
9
+ - **Capability:** 9.0
10
+ - **Role:** mobile
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @mobile — Cross-Platform Mobile
7
16
 
8
17
  - **Name:** @mobile
9
18
  - **Capability:** 8.8
@@ -24,7 +33,7 @@ description: "Cross-Platform Mobile Specialist Agent for Agent Enderun"
24
33
 
25
34
  ---
26
35
 
27
- # Mobile Architect — v0.8.3 Master
36
+ # Mobile Architect
28
37
 
29
38
  **Role:** Build high-performance mobile applications using React Native. Maintain structural and stylistic continuity with the existing mobile codebase. All the following standards are automatically applied in every task.
30
39
 
@@ -84,7 +93,7 @@ Never start coding before understanding the current state of the components and
84
93
  - **Responsive & Safe Area:** SafeAreaView + Platform.OS check is mandatory on every screen.
85
94
  - **Accessibility:** Font scaling, contrast, and screen reader support must be considered in every component.
86
95
 
87
- ## 📱 Mobile Agent Completion Report (v0.8.3 - Zorunlu)
96
+ ## 📱 Mobile Agent Completion Report (Zorunlu)
88
97
 
89
98
  - [ ] Mock used? [ ] No / [ ] Yes
90
99
  - [ ] App types imported? [ ] No / [ ] Yes
@@ -3,7 +3,16 @@ name: native
3
3
  description: "Native Platform Desktop Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @native — Native Capabilities (v0.8.3)
6
+ # @native — native
7
+
8
+ - **Name:** native
9
+ - **Capability:** 9.0
10
+ - **Role:** native
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @native — Native Capabilities
7
16
 
8
17
  - **Name:** @native
9
18
  - **Capability:** 8.9
@@ -24,7 +33,7 @@ description: "Native Platform Desktop Specialist Agent for Agent Enderun"
24
33
 
25
34
  ---
26
35
 
27
- # Native Desktop Architect — v0.8.3 Master
36
+ # Native Desktop Architect
28
37
 
29
38
  **Role:** Build secure and efficient desktop applications using Tauri or Electron. Ensure procedural continuity across the native codebase.
30
39
 
@@ -81,7 +90,7 @@ Always research the existing codebase and native bridge implementations before a
81
90
  - **Auto Update:** Tauri updater or electron-updater should be considered for automatic updates.
82
91
  - **Window & Menu:** Native menu, tray icon, and window state management should be standardized.
83
92
 
84
- ## 🖥️ Native Agent Completion Report (v0.8.3 - Zorunlu)
93
+ ## 🖥️ Native Agent Completion Report (Zorunlu)
85
94
 
86
95
  - [ ] Mock used? [ ] No / [ ] Yes
87
96
  - [ ] App types imported? [ ] No / [ ] Yes
@@ -3,7 +3,16 @@ name: orchestrator
3
3
  description: "Task Queue & Parallel Execution Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @orchestrator — Task Queue & Parallel Execution (v0.8.3)
6
+ # @orchestrator — orchestrator
7
+
8
+ - **Name:** orchestrator
9
+ - **Capability:** 9.0
10
+ - **Role:** orchestrator
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @orchestrator — Task Queue & Parallel Execution
7
16
 
8
17
  - **Name:** @orchestrator
9
18
  - **Capability:** 9.8
@@ -51,7 +60,7 @@ description: "Task Queue & Parallel Execution Specialist Agent for Agent Enderun
51
60
 
52
61
  ---
53
62
 
54
- # @orchestrator — Task Queue & Parallel Execution Engine — v0.8.3 Master
63
+ # @orchestrator — Task Queue & Parallel Execution Engine
55
64
 
56
65
  ## Identity & Mission
57
66
 
@@ -3,7 +3,16 @@ name: qa
3
3
  description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @qa — Quality Assurance & Test (v0.8.3)
6
+ # @qa — qa
7
+
8
+ - **Name:** qa
9
+ - **Capability:** 9.0
10
+ - **Role:** qa
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @qa — Quality Assurance & Test
7
16
 
8
17
  - **Name:** @qa
9
18
  - **Capability:** 9.1
@@ -29,7 +38,7 @@ description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
29
38
  - NEVER write production application code. Your scope is exclusively test code and quality reports.
30
39
  - Zero Mock Test Policy: Integration tests must use real database or service-compatible test backends. Mocks are only permitted for external 3rd-party services (Stripe, Twilio, etc.).
31
40
  - QA Gate is non-negotiable: No deploy proceeds without @qa sign-off. Not even @manager can override this gate.
32
- - Coverage thresholds are project-defined and must be read from the project's vitest/jest config never self-imposed.
41
+ - **Strict Coverage Quality Gate**: The non-negotiable coverage threshold for all core domain logic, repositories, and critical user paths is **at least 80%** (measured via Vitest/Jest). Deployments are strictly blocked if this target is not satisfied.
33
42
  - Every failing test must have a Trace ID and be logged to {{FRAMEWORK_DIR}}/logs/qa.json.
34
43
  - Regression tests must be run after every @backend contract change (Phase Rollback triggers automatic QA re-run).
35
44
  - Test plans must be written before implementation starts (TDD-first mindset when requested).
@@ -38,13 +47,14 @@ description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
38
47
  ## Checklists
39
48
  ### beforeWritingTests
40
49
  - Read API contract (apps/backend/contract.version.json) to understand current type surface
41
- - Identify which functions/endpoints need unit vs integration tests
50
+ - Identify which functions/endpoints need unit vs integration vs E2E tests
42
51
  - Confirm test database or service mock availability
43
52
  - Check existing test coverage to avoid duplication
44
53
  ### deployGate
45
54
  - All unit tests pass (vitest/jest)
46
55
  - Integration tests pass against real test DB
47
- - Coverage meets configured threshold
56
+ - Automated E2E user path tests pass (Playwright)
57
+ - Code coverage meets the **minimum 80% threshold** on modified and core domain paths
48
58
  - No skipped tests without documented reason
49
59
  - Sign off to @devops and @manager
50
60
  ### afterEveryTestRun
@@ -55,7 +65,7 @@ description: "Quality Assurance & Test Specialist Agent for Agent Enderun"
55
65
 
56
66
  ---
57
67
 
58
- # @qa — Quality Assurance & Test Engineering — v0.8.3 Master
68
+ # @qa — Quality Assurance & Test Engineering
59
69
 
60
70
  ## Identity & Mission
61
71
 
@@ -116,6 +126,8 @@ Design the right test type for the right situation:
116
126
  - ❌ Writing production application code
117
127
  - ❌ Deleting or permanently skipping tests without @manager approval
118
128
  - ❌ Using mocks for database persistence in integration tests
119
- - ❌ Overriding coverage thresholds without @manager written approval
129
+ - ❌ Overriding coverage thresholds or bypassing the **80% quality gate** without @manager written approval
120
130
  - ❌ Allowing a deploy to proceed when the gate is failed — even under pressure
131
+ - ❌ Skipping regression tests on hotfixes or production releases
132
+ - ❌ Deploying to production without automated Playwright E2E verification on critical user flows
121
133
  ---
@@ -3,7 +3,16 @@ name: security
3
3
  description: "Security & Compliance Specialist Agent for Agent Enderun"
4
4
  ---
5
5
 
6
- # @security — Security & Compliance (v0.8.3)
6
+ # @security — security
7
+
8
+ - **Name:** security
9
+ - **Capability:** 9.0
10
+ - **Role:** security
11
+ - **State Machine:** `../schema/agent-lifecycle-schema.json`
12
+
13
+ ---
14
+
15
+ # @security — Security & Compliance
7
16
 
8
17
  - **Name:** @security
9
18
  - **Capability:** 9.3
@@ -52,7 +61,7 @@ description: "Security & Compliance Specialist Agent for Agent Enderun"
52
61
 
53
62
  ---
54
63
 
55
- # @security — Security Auditor & Compliance Officer — v0.8.3 Master
64
+ # @security — Security Auditor & Compliance Officer
56
65
 
57
66
  ## Identity & Mission
58
67
 
@@ -47,6 +47,6 @@
47
47
  { "agent": "@native", "capability": 8.9, "primaryDomain": "native" },
48
48
  { "agent": "@mobile", "capability": 8.8, "primaryDomain": "mobile" }
49
49
  ],
50
- "frameworkVersion": "0.8.5",
50
+ "frameworkVersion": "0.8.7",
51
51
  "constitutionFile": "ENDERUN.md"
52
52
  }
package/ENDERUN.md CHANGED
@@ -1,13 +1,13 @@
1
- # Agent Enderun (v0.8.4)
1
+ # Agent Enderun (v0.8.7)
2
2
  # Place in project root. This file is the single source of truth for Base Project AI Extensions.
3
3
 
4
4
  ## 🎖️ AGENT CHECKLIST (MANDATORY BEFORE RESPONSE)
5
5
  > Check this list at the end of every response:
6
- > - [ ] **Zero Mock:** Did you use fake data or placeholders? (Strictly Forbidden)
7
- > - [ ] **Contract First:** Are the app's types and apps/backend/contract.version.json up to date?
8
- > - [ ] **Audit Log:** Did you log this action in `{{FRAMEWORK_DIR}}/logs/[agent].json`?
9
- > - [ ] **CLI Orchestration:** Does the action comply with `{{ADAPTER}} cli` rules?
10
- > - [ ] **No "..." allowed:** Did you write the code completely without omitting parts?
6
+ - [ ] **Surgical Quality:** Did you use the `replace` tool for targeted changes? For files >100 lines, focus on changed blocks and use `...` for untouched sections to preserve token limit. (Quality over Volume)
7
+ - [ ] **Contract First:** Are the app's types and apps/backend/contract.version.json up to date?
8
+ - [ ] **Audit Log:** Did you log this action in `{{FRAMEWORK_DIR}}/logs/[agent].json`?
9
+ - [ ] **CLI Orchestration:** Does the action comply with `{{ADAPTER}} cli` rules?
10
+ - [ ] **Complete Context:** Ensure all changed logic is fully written. Placeholder `...` is only for *unchanged* surrounding code.
11
11
 
12
12
  ---
13
13
 
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # 🏛️ Agent Enderun (v0.8.5) — The Supreme AI Governance & Orchestration Framework
1
+ # 🏛️ Agent Enderun (v0.8.7) — The Supreme AI Governance & Orchestration Framework
2
2
 
3
3
  **The Supreme AI Governance & Orchestration Framework for Enterprise Development**
4
4
 
5
5
  **Author:** Yusuf BEKAR
6
- **Version:** 0.8.5
6
+ **Version:** 0.8.7
7
7
  **License:** MIT
8
8
 
9
9
  [English](#english) | [Türkçe](#türkçe)
@@ -86,6 +86,19 @@ The Agent Enderun framework organizes agent actions and runtime intelligence thr
86
86
 
87
87
  ---
88
88
 
89
+ ### 🏛️ Enterprise-Grade Architecture Standards (v0.8.7 Upgrades)
90
+
91
+ Agent Enderun is armored out-of-the-box with six advanced, high-scale engineering gates required by corporate and enterprise-level production platforms:
92
+
93
+ 1. **⚡ Server-State Caching (TanStack Query / SWR)**: Enforces Query-Key-based caching, request deduplication, and automatic invalidation on mutations natively inside `@frontend`.
94
+ 2. **🗄️ Zero-Downtime Database Migrations**: Strictly forbids destructive raw SQL changes on live production database environments. Mandates a 4-step dual-write soft deprecation pattern in `@backend` to prevent migration downtime.
95
+ 3. **📊 Telemetry & JSON Logging**: Mandates structured Pino JSON logs and automatic **OpenTelemetry trace context propagation** (`trace_id` correlation) from API requests down through downstream database layers in `@backend`.
96
+ 4. **🧪 Strict 80% Coverage Quality Gate**: Imposes a non-negotiable **80% minimum unit/integration test coverage gate** on core domain repositories and critical paths, verified by `@qa`.
97
+ 5. **🛡️ Playwright E2E Integration**: Standards for automated End-to-End user journey test runs are enforced before deploy approvals.
98
+ 6. **🔗 Feature Flag Toggles & Type-Sync**: Enforces feature toggles (`features.isEnabled(...)`) to gate complex developments, and automates OpenAPI-to-TypeScript type sync to prevent API contract drift.
99
+
100
+ ---
101
+
89
102
  ## ⚡ Quick Start & Workflow
90
103
 
91
104
  ### 1. Installation
@@ -219,7 +232,7 @@ Enderun Ordusu'ndaki her ajan, kendilerine ait kuralları, izin verilen dizinler
219
232
 
220
233
  ---
221
234
 
222
- ## 🏛️ Agent Enderun: Detaylı Kod Tabanı Denetim Raporu (v0.8.5)
235
+ ## 🏛️ Agent Enderun: Detaylı Kod Tabanı Denetim Raporu (v0.8.7)
223
236
 
224
237
  Çerçevenin (framework) çekirdek kod yapısı, operasyonel işleyişi, alt-üst ajan hiyerarşisi ve temizlenmiş mükerrer alanları en ince ayrıntısına kadar denetlenmiş ve belgelenmiştir:
225
238
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-enderun-mcp",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "Enterprise-grade MCP Server for AI Agent Framework",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "MIT",
@@ -83,12 +83,27 @@ export const memoryHandlers = {
83
83
  const lockPath = memoryPath + ".lock";
84
84
  const lockOwner = `lock-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
85
85
  try {
86
- if (fs.existsSync(lockPath)) {
87
- const stats = fs.statSync(lockPath);
88
- if (Date.now() - stats.mtimeMs > 120000) fs.unlinkSync(lockPath);
89
- else return { content: [{ type: "text", text: "Memory is locked. Try again later." }] };
86
+ try {
87
+ // Atomic write using 'wx' flag to prevent TOCTOU race conditions
88
+ fs.writeFileSync(lockPath, JSON.stringify({ owner: lockOwner, createdAt: new Date().toISOString() }), { flag: "wx" });
89
+ } catch (error: any) {
90
+ if (error.code === "EEXIST") {
91
+ const stats = fs.statSync(lockPath);
92
+ if (Date.now() - stats.mtimeMs > 120000) {
93
+ try {
94
+ fs.unlinkSync(lockPath);
95
+ // Retry atomic write once after unlinking stale lock
96
+ fs.writeFileSync(lockPath, JSON.stringify({ owner: lockOwner, createdAt: new Date().toISOString() }), { flag: "wx" });
97
+ } catch {
98
+ return { content: [{ type: "text", text: "Memory is locked. Try again later." }] };
99
+ }
100
+ } else {
101
+ return { content: [{ type: "text", text: "Memory is locked. Try again later." }] };
102
+ }
103
+ } else {
104
+ throw error;
105
+ }
90
106
  }
91
- fs.writeFileSync(lockPath, JSON.stringify({ owner: lockOwner, createdAt: new Date().toISOString() }));
92
107
  let memoryContent = fs.readFileSync(memoryPath, "utf-8");
93
108
  if (section === "HISTORY") {
94
109
  let updated = false;
@@ -113,7 +113,7 @@ export const monitoringHandlers: Record<
113
113
  }
114
114
 
115
115
  // Read queue depths
116
- const queueBase = path.join(projectRoot, ".enderun", "queue");
116
+ const queueBase = path.join(projectRoot, getFrameworkDir(projectRoot), "queue");
117
117
  for (const subdir of ["pending", "processing", "completed", "failed"] as const) {
118
118
  try {
119
119
  const files = await fs.readdir(path.join(queueBase, subdir));
@@ -124,7 +124,7 @@ export const monitoringHandlers: Record<
124
124
  }
125
125
 
126
126
  // Read orchestrator log for recent blockages and broadcasts
127
- const logPath = path.join(projectRoot, ".enderun", "logs", "orchestrator.json");
127
+ const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
128
128
  try {
129
129
  const logContent = await fs.readFile(logPath, "utf-8");
130
130
  const log = JSON.parse(logContent) as {
@@ -152,7 +152,7 @@ export const monitoringHandlers: Record<
152
152
  const { agentName, lastN } = args as { agentName: string; lastN?: number };
153
153
  const n = lastN ?? 20;
154
154
  const logName = agentName.replace("@", "") + ".json";
155
- const logPath = path.join(projectRoot, ".enderun", "logs", logName);
155
+ const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", logName);
156
156
 
157
157
  try {
158
158
  const content = await fs.readFile(logPath, "utf-8");
@@ -206,7 +206,7 @@ export const monitoringHandlers: Record<
206
206
  const { thresholdMinutes } = args as { thresholdMinutes?: number };
207
207
  const threshold = thresholdMinutes ?? 30;
208
208
 
209
- const statusPath = path.join(projectRoot, ".enderun", "STATUS.md");
209
+ const statusPath = path.join(projectRoot, getFrameworkDir(projectRoot), "STATUS.md");
210
210
  const bottlenecks: Array<{ agent: string; reason: string; state: string; severity: string }> = [];
211
211
 
212
212
  try {
@@ -308,7 +308,7 @@ export const monitoringHandlers: Record<
308
308
  }
309
309
 
310
310
  // Queue snapshot
311
- const queueBase = path.join(projectRoot, ".enderun", "queue");
311
+ const queueBase = path.join(projectRoot, getFrameworkDir(projectRoot), "queue");
312
312
  const snapshot: Record<string, number> = {};
313
313
  for (const dir of ["pending", "processing", "completed", "failed"]) {
314
314
  try {
@@ -321,7 +321,7 @@ export const monitoringHandlers: Record<
321
321
  report.queueSnapshot = snapshot;
322
322
 
323
323
  // Recent blockages
324
- const logPath = path.join(projectRoot, ".enderun", "logs", "orchestrator.json");
324
+ const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
325
325
  try {
326
326
  const logContent = await fs.readFile(logPath, "utf-8");
327
327
  const log = JSON.parse(logContent) as { blockages?: unknown[] };
@@ -1,6 +1,7 @@
1
1
  import { Tool } from "@modelcontextprotocol/sdk/types.js";
2
2
  import { promises as fs } from "fs";
3
3
  import path from "path";
4
+ import { getFrameworkDir } from "../utils.js";
4
5
 
5
6
  // ─── Tool Definitions ─────────────────────────────────────────────────────────
6
7
 
@@ -208,7 +209,7 @@ export const orchestrationHandlers: Record<
208
209
  };
209
210
 
210
211
  // Persist to queue
211
- const queueDir = path.join(projectRoot, ".enderun", "queue", "pending");
212
+ const queueDir = path.join(projectRoot, getFrameworkDir(projectRoot), "queue", "pending");
212
213
  await fs.mkdir(queueDir, { recursive: true });
213
214
  await fs.writeFile(
214
215
  path.join(queueDir, `${traceId}-dag.json`),
@@ -230,7 +231,7 @@ export const orchestrationHandlers: Record<
230
231
  // Try to load capability roster from shared-facts.json (dynamic — fixes KRITIK-3)
231
232
  let agentCapabilityRoster: Array<{ agent: string; primaryDomain: string; capability: number }> = [];
232
233
  try {
233
- const sharedFactsPath = path.join(projectRoot, ".enderun", "memory-graph", "shared-facts.json");
234
+ const sharedFactsPath = path.join(projectRoot, getFrameworkDir(projectRoot), "memory-graph", "shared-facts.json");
234
235
  const content = await fs.readFile(sharedFactsPath, "utf-8");
235
236
  const facts = JSON.parse(content) as { agentCapabilityRoster?: typeof agentCapabilityRoster };
236
237
  agentCapabilityRoster = facts.agentCapabilityRoster ?? [];
@@ -294,7 +295,7 @@ export const orchestrationHandlers: Record<
294
295
  };
295
296
 
296
297
  // Write assignment log
297
- const logPath = path.join(projectRoot, ".enderun", "logs", "orchestrator.json");
298
+ const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
298
299
  let log: { assignments: unknown[] } = { assignments: [] };
299
300
  try {
300
301
  const existing = await fs.readFile(logPath, "utf-8");
@@ -310,7 +311,7 @@ export const orchestrationHandlers: Record<
310
311
  },
311
312
 
312
313
  async get_agent_workload(_args, projectRoot) {
313
- const statusPath = path.join(projectRoot, ".enderun", "STATUS.md");
314
+ const statusPath = path.join(projectRoot, getFrameworkDir(projectRoot), "STATUS.md");
314
315
  let statusContent: string;
315
316
  try {
316
317
  statusContent = await fs.readFile(statusPath, "utf-8");
@@ -356,7 +357,7 @@ export const orchestrationHandlers: Record<
356
357
  };
357
358
 
358
359
  // Log blockage
359
- const logPath = path.join(projectRoot, ".enderun", "logs", "orchestrator.json");
360
+ const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
360
361
  let log: { assignments: unknown[]; blockages: unknown[] } = { assignments: [], blockages: [] };
361
362
  try {
362
363
  const existing = await fs.readFile(logPath, "utf-8");
@@ -370,7 +371,7 @@ export const orchestrationHandlers: Record<
370
371
  await fs.writeFile(logPath, JSON.stringify(log, null, 2), "utf-8");
371
372
 
372
373
  // Write a message to @manager's inbox via messages folder
373
- const messagesDir = path.join(projectRoot, ".enderun", "messages");
374
+ const messagesDir = path.join(projectRoot, getFrameworkDir(projectRoot), "messages");
374
375
  await fs.mkdir(messagesDir, { recursive: true });
375
376
  const messageFile = path.join(messagesDir, `BLOCKAGE-${traceId}-${Date.now()}.json`);
376
377
  await fs.writeFile(
@@ -409,7 +410,7 @@ export const orchestrationHandlers: Record<
409
410
  };
410
411
 
411
412
  // Write to messages folder for all agents
412
- const messagesDir = path.join(projectRoot, ".enderun", "messages");
413
+ const messagesDir = path.join(projectRoot, getFrameworkDir(projectRoot), "messages");
413
414
  await fs.mkdir(messagesDir, { recursive: true });
414
415
  await fs.writeFile(
415
416
  path.join(messagesDir, `${broadcast.id}.json`),
@@ -418,7 +419,7 @@ export const orchestrationHandlers: Record<
418
419
  );
419
420
 
420
421
  // Log broadcast
421
- const logPath = path.join(projectRoot, ".enderun", "logs", "orchestrator.json");
422
+ const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
422
423
  let log: { assignments: unknown[]; blockages: unknown[]; broadcasts: unknown[] } = {
423
424
  assignments: [],
424
425
  blockages: [],
@@ -10,12 +10,12 @@ const getPackageVersion = (): string => {
10
10
  const pkgPath = path.join(__dirname, "../package.json");
11
11
  if (fs.existsSync(pkgPath)) {
12
12
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
13
- return pkg.version || "0.8.5";
13
+ return pkg.version || "0.8.7";
14
14
  }
15
15
  } catch {
16
16
  // fallback
17
17
  }
18
- return "0.8.5";
18
+ return "0.8.7";
19
19
  };
20
20
 
21
21
  export const FRAMEWORK_VERSION = getPackageVersion();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-enderun",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "The Supreme AI Governance & Orchestration Framework for Enterprise Development",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "MIT",
package/src/cli/index.ts CHANGED
@@ -998,16 +998,44 @@ function complianceCheckCommand(targetPath) {
998
998
  console.warn(`📜 Checking Constitution Compliance: ${targetPath}...`);
999
999
  const violations = [];
1000
1000
  const forbidden = ["@shadcn", "mui", "@chakra-ui", "tailwindcss"];
1001
+
1002
+ // 1. package.json scan (Blind Spot 5)
1003
+ const pkgJsonPath = path.join(targetDir, "package.json");
1004
+ if (fs.existsSync(pkgJsonPath)) {
1005
+ try {
1006
+ const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
1007
+ const allDeps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
1008
+ forbidden.forEach(lib => {
1009
+ if (allDeps[lib] || Object.keys(allDeps).some(d => d.toLowerCase().includes(lib.toLowerCase()))) {
1010
+ violations.push(`package.json: Forbidden library dependency '${lib}' found in package.json.`);
1011
+ }
1012
+ });
1013
+ } catch {
1014
+ // ignore
1015
+ }
1016
+ }
1017
+
1018
+ // 2. Source files scan
1001
1019
  const files = collectFiles(path.join(targetDir, targetPath), [".ts", ".tsx", ".js", ".jsx", ".md"]);
1002
1020
  files.forEach(f => {
1021
+ const isTypesFile = f.includes("brands.ts") || f.includes("brands.js") || f.includes("brands.tsx") || f.includes("src/types/brands");
1022
+
1003
1023
  const content = fs.readFileSync(f, "utf8");
1004
1024
  forbidden.forEach(lib => {
1005
1025
  if (content.includes(lib)) violations.push(`${path.relative(targetDir, f)}: Forbidden library '${lib}' found.`);
1006
1026
  });
1007
- if (f.endsWith(".ts") && content.includes("interface") && content.match(/ID\s*:\s*string/)) {
1008
- violations.push(`${path.relative(targetDir, f)}: Potential Branded Types violation (ID typed as string).`);
1027
+
1028
+ // Robust Branded Types validation (Blind Spot 4)
1029
+ if ((f.endsWith(".ts") || f.endsWith(".tsx")) && !isTypesFile && content.includes("interface")) {
1030
+ const plainIdMatches = content.match(/\b\w*(?:id|Id|ID)\??\s*:\s*(?:string|number)\b/g);
1031
+ if (plainIdMatches) {
1032
+ plainIdMatches.forEach(match => {
1033
+ violations.push(`${path.relative(targetDir, f)}: Potential Branded Types violation (plain identifier '${match.trim()}' found inside interface).`);
1034
+ });
1035
+ }
1009
1036
  }
1010
1037
  });
1038
+
1011
1039
  if (violations.length === 0) {
1012
1040
  console.warn("✅ All systems compliant with ENDERUN.md.");
1013
1041
  } else {