agent-enderun 0.8.6 → 0.8.8

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 (46) hide show
  1. package/.enderun/BRAIN_DASHBOARD.md +4 -4
  2. package/.enderun/PROJECT_MEMORY.md +7 -7
  3. package/.enderun/STATUS.md +3 -5
  4. package/.enderun/agents/agent_army_schema.json +1 -1
  5. package/.enderun/agents/analyst.md +11 -18
  6. package/.enderun/agents/backend.md +42 -31
  7. package/.enderun/agents/devops.md +9 -18
  8. package/.enderun/agents/explorer.md +7 -16
  9. package/.enderun/agents/frontend.md +75 -91
  10. package/.enderun/agents/git.md +7 -16
  11. package/.enderun/agents/manager.md +38 -25
  12. package/.enderun/agents/mobile.md +7 -16
  13. package/.enderun/agents/orchestrator.md +16 -25
  14. package/.enderun/agents/qa.md +16 -22
  15. package/.enderun/agents/security.md +9 -18
  16. package/.enderun/cli-commands.json +0 -4
  17. package/.enderun/config.json +2 -2
  18. package/.enderun/knowledge/manager_authority_audit_enforcement.md +2 -2
  19. package/.enderun/knowledge/token_economy_and_memory.md +129 -0
  20. package/.enderun/memory-graph/agent-contexts/manager.json +1 -1
  21. package/.enderun/memory-graph/graph.json +1 -2
  22. package/.enderun/memory-graph/shared-facts.json +1 -2
  23. package/ENDERUN.md +1 -1
  24. package/README.md +379 -244
  25. package/docs/roadmap.md +1 -1
  26. package/framework-mcp/dist/schemas.js +0 -34
  27. package/framework-mcp/dist/tools/framework.js +40 -11
  28. package/framework-mcp/dist/tools/governance.js +1 -1
  29. package/framework-mcp/dist/tools/memory.js +24 -7
  30. package/framework-mcp/dist/tools/monitoring.js +6 -6
  31. package/framework-mcp/dist/tools/orchestration.js +9 -8
  32. package/framework-mcp/dist/utils.js +2 -2
  33. package/framework-mcp/package.json +1 -1
  34. package/framework-mcp/src/tools/framework.ts +39 -8
  35. package/framework-mcp/src/tools/memory.ts +20 -5
  36. package/framework-mcp/src/tools/monitoring.ts +6 -6
  37. package/framework-mcp/src/tools/orchestration.ts +9 -8
  38. package/framework-mcp/src/utils.ts +2 -2
  39. package/mcp.json +2 -2
  40. package/package.json +1 -1
  41. package/src/cli/index.ts +30 -2
  42. package/.enderun/agents/native.md +0 -115
  43. package/.enderun/claude.md +0 -19
  44. package/.enderun/cursor.md +0 -19
  45. package/.enderun/gemini.md +0 -19
  46. package/.enderun/memory-graph/agent-contexts/native.json +0 -1
package/README.md CHANGED
@@ -1,332 +1,467 @@
1
- # 🏛️ Agent Enderun (v0.8.6) The Supreme AI Governance & Orchestration Framework
1
+ # 🏛️ Agent Enderun — Supreme Enterprise AI Governance & Orchestration Framework
2
2
 
3
- **The Supreme AI Governance & Orchestration Framework for Enterprise Development**
3
+ **Agent Enderun** is a production-grade, highly-disciplined AI orchestration and process governance framework designed for building secure, scalable, and audit-ready enterprise software. It enforces contract-first development, zero-mock safety, static security scanning, and strict multi-agent coordination under a single source of truth.
4
4
 
5
- **Author:** Yusuf BEKAR
6
- **Version:** 0.8.6
7
- **License:** MIT
8
-
9
- [English](#english) | [Türkçe](#türkçe)
5
+ **Current Version:** `0.8.8`
6
+ **Author:** Yusuf BEKAR
7
+ **License:** MIT
10
8
 
11
9
  ---
12
10
 
13
- # English
14
-
15
- ## Executive Summary
16
-
17
- **Agent Enderun** is a production-grade constitutional governance and multi-agent orchestration framework designed for engineering teams that need to use AI assistants at scale while maintaining control, traceability, auditability, and professional discipline.
18
-
19
- Most AI coding tools optimize for speed and generation volume. Agent Enderun optimizes for **risk-aware, auditable, and continuously improving software development processes**. It converts chaotic AI output into structured, enterprise-ready work through mandatory rules, specialized agents, persistent memory, and a living risk management system.
20
-
21
- > [!NOTE]
22
- > **v0.7.0 Strategic Consolidation:**
23
- > The active runtime folder in user projects is `.enderun/`. The framework ships its templates from `.enderun/`. All specialist agent configurations live as strongly-typed `agent.json` under `.enderun/agents/{agent_name}.md`. Duplicate or staging structures have been retired.
11
+ [English](#english) | [Türkçe](#türkçe)
24
12
 
25
13
  ---
26
14
 
27
- ## 🎯 Core Philosophy & Key Concepts
28
-
29
- Agent Enderun is built on a set of non-negotiable principles enforced by its core components.
30
-
31
- ### 1. The Constitution (`ENDERUN.md`)
32
- This is the supreme law of the framework, dictating mandatory rules and protocols for all agents. Key principles include:
33
- - **Single Point of Authority:** In enterprise projects, `@manager` is the only authorized entry point. No specialist agent may act without a formal briefing.
34
- - **Contract-First Development:** The `@backend` agent MUST define and document API contracts and types before the `@frontend` agent begins implementation.
35
- - **Zero UI Library & Zero Mock Policy:** The `@frontend` agent MUST build components from scratch using the project's design system (Panda CSS) and MUST NOT use mock data. This ensures originality and quality.
36
- - **Procedural Continuity:** All agents MUST adhere to the existing architectural and stylistic patterns of the project.
37
-
38
- ### 2. Project Memory (`PROJECT_MEMORY.md`)
39
- This file, located in `.enderun/`, is the **Single Source of Truth (SSOT)** for the project's state. It is a human-readable Markdown file that all agents read at the start of a session and update at the end. Its key sections are:
40
- - **`CURRENT STATUS`:** Tracks the active phase, Trace ID, and any blockers.
41
- - **`CRITICAL DECISIONS`:** A log of important architectural choices to ensure consistency.
42
- - **`ACTIVE TASKS`:** A table of all ongoing tasks, their status, priority, and assigned agent.
43
- - **`HISTORY`:** A persistent log of all actions taken by agents.
15
+ # English
44
16
 
45
- ### 3. Traceability (Trace ID)
46
- Every task or logical unit of work is assigned a unique **Trace ID** (a 26-character ULID). This ID is used in commit messages, logs, and task tables, providing an unbroken chain of traceability from the initial request to the final code.
17
+ ## Table of Contents
18
+ - [1. Introduction & Core Philosophy](#1-introduction--core-philosophy)
19
+ - [2. Installation & Quickstart](#2-installation--quickstart)
20
+ - [Prerequisites](#prerequisites)
21
+ - [Step-by-Step Installation](#step-by-step-installation)
22
+ - [Verification & Health Check](#verification--health-check)
23
+ - [3. Adapters & Use Cases](#3-adapters--use-cases)
24
+ - [Gemini Adapter (Standard & Recommended)](#gemini-adapter-standard--recommended)
25
+ - [Claude & Cursor Adapters](#claude--cursor-adapters)
26
+ - [Integrating with Claude Code / Claude Desktop](#integrating-with-claude-code--claude-desktop)
27
+ - [4. Project Development Workflow & Best Practices](#4-project-development-workflow--best-practices)
28
+ - [A. Phase-Based Lifecycle](#a-phase-based-lifecycle)
29
+ - [B. Trace ID Protocol](#b-trace-id-protocol)
30
+ - [C. Contract-First & Branded Types](#c-contract-first--branded-types)
31
+ - [D. Zero Mock & Zero UI-Library Policy](#d-zero-mock--zero-ui-library-policy)
32
+ - [E. Security & Compliance Scanning](#e-security--compliance-scanning)
33
+ - [F. Hermes Messaging & Task Queues](#f-hermes-messaging--task-queues)
34
+ - [5. CLI Reference Manual](#5-cli-reference-manual)
35
+ - [6. Project Layout Directory Structure](#6-project-layout-directory-structure)
47
36
 
48
37
  ---
49
38
 
50
- ## 🤖 The Agent Army & Core Folders
51
-
52
- Each agent in the Enderun Army is governed by a strongly-typed `agent.json` definition that defines their precise rules, permitted directories, and capability ratings.
39
+ ## 1. Introduction & Core Philosophy
53
40
 
54
- ### Workspace Agent Path:
55
- 👉 `[project-root]/.enderun/agents/{agent_name}.md`
41
+ AI assistance in software development often introduces technical debt, code drift, and unstructured modifications. **Agent Enderun** solves this by establishing a **Structured Governance Framework**. Rather than acting as a loose code generator, AI assistants within this framework are treated as disciplined engineers under a unified command structure led by the `@manager` (Team-Lead) agent.
56
42
 
57
- ### Agent Army Overview (v1.0 - 12 Specialists):
58
-
59
- | Tier | Agent | Capability | Role & Domain | Primary Specialization |
60
- | :--- | :--- | :--- | :--- | :--- |
61
- | **Core** | **@orchestrator** | **9.8/10** | Task Pipeline Engine | Parallel execution, stateful queue controls, DAG execution. |
62
- | **Core** | **@manager** | **9.5/10** | Orchestration & Governance | Intent analysis, high-risk dynamic approval signing, escalation. |
63
- | **Analysis** | **@analyst** | **9.6/10** | Verification & QA Gate | Vitest/Cypress verification, API contract drift checking, Zero-UI enforcer. |
64
- | **Analysis** | **@explorer** | **9.4/10** | Research & Discovery | Pattern mapping, dependency graph discovery, onboarding analysis. |
65
- | **Engineering** | **@backend** | **9.2/10** | Domain Logic & Databases | Fastify, Kysely queries, branded types, DomainError hierarchy. |
66
- | **Engineering** | **@frontend** | **9.0/10** | Fluid Responsive UI | React 19, Panda CSS styling tokens, Zero-UI, WCAG 2.2 accessibility. |
67
- | **Engineering** | **@native** | **8.9/10** | Native Capabilities | Tauri/Electron shell guards, Rust bridges, secure IPC contracts. |
68
- | **Engineering** | **@mobile** | **8.8/10** | Cross-Platform Mobile | React Native/Expo fluid viewports, offline cache sync, safe areas. |
69
- | **Operations** | **@security** | **9.3/10** | Security & Compliance | OWASP threat detection, AST scans for secrets, CSP rules auditor. |
70
- | **Operations** | **@qa** | **9.1/10** | Quality Gate Enforcer | Unit/integration testing gates, coverage metrics check. |
71
- | **Operations** | **@git** | **9.1/10** | Version Control | Semantic commits formatting, atomic commit segregation, phase snapshots. |
72
- | **Operations** | **@devops** | **9.0/10** | Infrastructure | Deployment pipelines, container setups, environment variable validation. |
43
+ ### The Five Pillars of Enderun
44
+ 1. **Absolute Traceability:** Every action, commit, and state change is stamped with a unique ULID-based **Trace ID**.
45
+ 2. **Katalyst Contracts:** Zero code is written until API contracts and **Branded Types** are defined and verified.
46
+ 3. **Pristine Sandboxing:** Complete separation between the **User's Project** and the **Framework Internals**.
47
+ 4. **Permanent Memory:** The AI's context and status live persistently inside your project, not in transient chat logs or the OS `/tmp` directory.
48
+ 5. **Zero Mock Policy:** All analytical and operational screens must interact with actual, validated schemas and live endpoints.
73
49
 
74
50
  ---
75
51
 
76
- ### 📂 Core Directories Analysis & Operational Purposes
77
-
78
- The Agent Enderun framework organizes agent actions and runtime intelligence through highly structured directories remapped to `.enderun/` (or `.claude/` / `.cursor/`) inside user workspaces:
52
+ ## 2. Installation & Quickstart
79
53
 
80
- * **`skills/` (Dynamic Executables):** Serves as a folder for model-specific executable scripts and custom tools. Developers can inject project-specific helpers here, allowing agents to load and execute them dynamically on-demand during active briefs.
81
- * **`benchmarks/` (LLM Evaluation):** Dedicated folder for metrics, token consumption, and response accuracy logs comparing different LLM engines (e.g. Gemini 1.5 Pro vs Claude 3.5 Sonnet vs Codex). Helps evaluate the coding intelligence of the active army.
82
- * **`knowledge/` (Intelligence Database):** central knowledge hub of the framework containing 43 robust guidelines enforcing strict laws on Panda CSS coding, Fastify RCSR, Kysely schema creation, dynamic signature validations, and domain error hierarchies.
83
- * **`logs/` (Auditable Trails):** Active audit log repository. Every action performed by any agent is traceably logged in JSON format (`logs/{agent_name}.json`) with a specific timestamp and a unique 26-character Trace ID (ULID), satisfying enterprise compliance audits.
84
- * **`monitoring/` (Operational Telemetry):** Telemetry directory integrated with monitoring tools (`get_army_health_dashboard`, `calculate_agent_performance_score`) to analyze agent bottleneck states and QA rejection cycles.
85
- * **`queue/` (Asynchronous Task Engine):** File-based stateful task queue split into `pending/`, `processing/`, `completed/`, `failed/`, and `pipelines/` subdirectories. Feeds Orchestration MCP tools to schedule complex multi-agent assignments in parallel with complete rollback recovery.
54
+ ### Prerequisites
55
+ - **Node.js** v20.0.0 or higher (LTS recommended).
56
+ - **npm** v9+ or **pnpm** v8+ or **yarn** v3+.
57
+ - **Git** initialized in the project directory.
86
58
 
87
- ---
88
-
89
- ## ⚡ Quick Start & Workflow
90
-
91
- ### 1. Installation
59
+ ### Step-by-Step Installation
92
60
 
93
- Install the package and initialize the framework inside your project folder:
61
+ #### Step 1: Initialize Git in your directory
62
+ ```bash
63
+ mkdir my-enterprise-app
64
+ cd my-enterprise-app
65
+ git init
66
+ ```
94
67
 
68
+ #### Step 2: Run the Framework Initializer
69
+ To scaffold the entire governance structure, run the command below. By default, it will detect your package manager and environment.
95
70
  ```bash
96
- # 1. Initialize the framework for Gemini CLI
97
71
  npx agent-enderun init gemini
72
+ ```
73
+ *Note: If you do not specify an adapter, it will default to `gemini` and build the runtime within the `.enderun/` directory.*
98
74
 
99
- # 2. Install dependencies (as prompted)
75
+ #### Step 3: Install Workspace Dependencies & Compile the MCP Server
76
+ ```bash
100
77
  npm install
101
-
102
- # 3. Build the framework's internal tools (as prompted)
103
78
  npm run enderun:build
104
-
105
- # 4. Verify installation and project health
106
- npx agent-enderun check
107
79
  ```
108
80
 
109
- ### 2. Example Workflow: Adding a New Feature
110
-
111
- Here’s how to use Agent Enderun to develop a new feature:
112
-
113
- **Step 1: Define the Task**
114
- Create a new file in your project's `docs/` folder (e.g., `docs/new-feature-request.md`) describing the feature you want.
81
+ ---
115
82
 
116
- **Step 2: Create a New Trace**
117
- Use the CLI to create a new task in `PROJECT_MEMORY.md`. This generates a unique Trace ID.
83
+ ### Verification & Health Check
118
84
 
85
+ Always run the built-in health diagnostic after installation or after making major project transitions:
119
86
  ```bash
120
- npx agent-enderun trace:new "Implement user profile page based on docs/new-feature-request.md" @manager P1
87
+ npx agent-enderun check
121
88
  ```
122
89
 
123
- **Step 3: Agent Orchestration (Automatic)**
124
- The `@manager` agent (the default AI persona) will:
125
- 1. Read `PROJECT_MEMORY.md` and see the new task.
126
- 2. Analyze the request from `docs/new-feature-request.md`.
127
- 3. Create a plan and issue formal "briefings" to specialist agents like `@explorer`, `@backend`, and `@frontend`.
128
-
129
- **Step 4: Development & Verification (Automatic)**
130
- - The specialist agents execute their tasks according to the constitutional rules (e.g., `@backend` creates the API and types, then `@frontend` builds the UI).
131
- - `@analyst` automatically verifies the work against project standards.
132
- - `@git` creates atomic commits tagged with the Trace ID.
133
-
134
- **Step 5: Monitor Progress**
135
- You can check the progress at any time with the `status` command:
136
-
137
- ```bash
138
- npx agent-enderun status
139
- ```
140
- This will show the active phase, blockers, and the status of all active tasks.
90
+ #### What does the Health Check validate?
91
+ - **Constitution Integrity:** Verifies the existence and checksum of `ENDERUN.md`.
92
+ - **Memory Connectivity:** Checks if `PROJECT_MEMORY.md` is active and writeable.
93
+ - **Contract Parity:** Ensures `apps/backend/contract.version.json` exists.
94
+ - **MCP compilation:** Confirms `framework-mcp/dist/index.js` is fully compiled and ready.
95
+ - **Documentation Portals:** Ensures technical stack details are filled inside `docs/tech-stack.md`.
141
96
 
142
97
  ---
143
98
 
144
- ## 🛠️ CLI Commands
145
-
146
- Agent Enderun comes with a powerful set of CLI tools for managing the project.
99
+ ## 3. Adapters & Use Cases
147
100
 
148
- | Command | Description |
149
- | :--- | :--- |
150
- | `npx agent-enderun init [adapter]` | Initializes the framework in the current project. `gemini` is the default and recommended adapter. |
151
- | `npx agent-enderun check` | Runs a health check on the project to ensure all required files and configurations are present. |
152
- | `npx agent-enderun status` | Displays the current project status, active tasks, and blockers from `PROJECT_MEMORY.md`. |
153
- | `npx agent-enderun trace:new "<desc>" [agent] [priority]` | Creates a new task with a unique Trace ID and adds it to the `PROJECT_MEMORY.md`. |
154
- | `npx agent-enderun create-app "<desc>"` | (Aliases: `new`, `start`) Scaffolds a new full-stack application (backend + web) from a natural language description. |
155
- | `npx agent-enderun verify-contract` | Verifies the integrity of the shared backend types by comparing the current code against the stored hash in `contract.version.json`. |
156
-
157
- ---
158
-
159
- # Türkçe
101
+ Agent Enderun is designed to support the specific AI adapter that matches your IDE or CLI environment.
160
102
 
161
- ## Yönetici Özeti
162
-
163
- **Agent Enderun**, AI asistanlarını yüksek ölçekte kullanırken kontrolü, izlenebilirliği, denetlenebilirliği ve profesyonel disiplini korumak isteyen mühendislik ekipleri için tasarlanmış, **Anayasal Yönetişim** ve **Çoklu Ajan Orkestrasyonu** odaklı kurumsal düzeyde bir framework’tür.
103
+ ```text
104
+ ┌───────────────────────┐
105
+ │ agent-enderun │
106
+ └───────────┬───────────┘
107
+
108
+ ┌─────────────────┼─────────────────┐
109
+ ▼ ▼ ▼
110
+ .enderun/ .claude/ .cursor/
111
+ (Gemini Adapter) (Claude Code) (Cursor IDE)
112
+ ```
164
113
 
165
- Çoğu yapay zeka kodlama aracı hız ve üretim hacmine odaklanırken, Agent Enderun **risk farkındalıklı, denetlenebilir ve sürekli iyileştirilen yazılım geliştirme süreçlerine** odaklanır. Kaotik yapay zeka çıktılarını; zorunlu kurallar, özel ajanlar, kalıcı bellek ve yaşayan bir risk yönetim sistemi aracılığıyla yapılandırılmış kurumsal standartlara dönüştürür.
114
+ ### Gemini Adapter (Standard & Recommended)
115
+ - **Folder:** `.enderun/`
116
+ - **Target Use:** Gemini CLI, Google Vertex AI, and direct Gemini API environments.
117
+ - **Shim File:** `gemini.md` (placed at the project root as the initial context instructions).
118
+ - **Benefit:** Full Model Context Protocol (MCP) server hooks natively tuned for Gemini's large-context window.
119
+
120
+ ### Claude & Cursor Adapters
121
+ - **Claude Adapter (`init claude`):** Creates the `.claude/` directory and shims. Configures automated MCP access for **Claude Code CLI** and **Claude Desktop**.
122
+ - **Cursor Adapter (`init cursor`):** Creates `.cursor/` directory containing `.cursorrules` to immediately guide the Cursor IDE agent with Enderun's strict coding boundaries.
123
+
124
+ ### Integrating with Claude Code / Claude Desktop
125
+
126
+ Agent Enderun provides a fully-functional **Model Context Protocol (MCP)** server. To connect it to your Claude environment, append the following block to your `claude_desktop_config.json` or global Claude CLI configuration:
127
+
128
+ ```json
129
+ {
130
+ "mcpServers": {
131
+ "agent-enderun-mcp": {
132
+ "command": "node",
133
+ "args": ["/absolute/path/to/your/project/framework-mcp/dist/index.js"]
134
+ }
135
+ }
136
+ }
137
+ ```
166
138
 
167
- > [!NOTE]
168
- > **v0.7.0 Stratejik Konsolidasyon:**
169
- > Çalışma zamanı klasörü kullanıcı projelerinde `.enderun/` olarak oluşturulur. Ajan yapılandırmaları `.enderun/agents/{agent_name}.md` altında yer alır. Eski veya mükerrer yapılar tamamen kaldırılmıştır.
139
+ Once connected, your AI assistant will gain access to tools such as:
140
+ - `search_codebase` (Surgical context parsing)
141
+ - `read_project_memory` & `update_project_memory` (State machine updates)
142
+ - `verify_api_contract` (TypeScript type validation)
143
+ - `send_agent_message` (Hermes protocol queues)
170
144
 
171
145
  ---
172
146
 
173
- ## 🎯 Temel Felsefe ve Anahtar Kavramlar
174
-
175
- Agent Enderun, temel bileşenleri tarafından uygulanan, tavizsiz ilkeler üzerine kurulmuştur.
176
-
177
- ### 1. Anayasa (`ENDERUN.md`)
178
- Bu, tüm ajanlar için zorunlu kuralları ve protokolleri dikte eden, çerçevenin en üst yasasıdır. Temel ilkeler şunları içerir:
179
- - **Tek Yetki Noktası:** Kurumsal projelerde `@manager` tek yetkili giriş noktasıdır. Hiçbir uzman ajan, resmi bir brifing almadan kendi başına işlem yapamaz.
180
- - **Önce Sözleşme (Contract-First) ile Geliştirme:** `@backend` ajanı, `@frontend` ajanı uygulamaya başlamadan ÖNCE API sözleşmelerini ve tiplerini tanımlamak ve belgelemek ZORUNDADIR.
181
- - **Sıfır UI Kütüphanesi ve Sıfır Mock Veri Politikası:** `@frontend` ajanı, bileşenleri projenin tasarım sistemini (Panda CSS) kullanarak sıfırdan oluşturmalı ve mock (sahte) veri KULLANMAMALIDIR. Bu, özgünlüğü ve kaliteyi garanti eder.
182
- - **Prosedürel Devamlılık:** Tüm ajanlar, projenin mevcut mimari ve stilistik kalıplarına uymak ZORUNDADIR.
183
-
184
- ### 2. Proje Hafızası (`PROJECT_MEMORY.md`)
185
- `.enderun/` içinde bulunan bu dosya, projenin durumu için **Tek Doğruluk Kaynağıdır (SSOT)**. Tüm ajanların bir oturumun başında okuduğu ve sonunda güncellediği, insan tarafından okunabilir bir Markdown dosyasıdır. Ana bölümleri şunlardır:
186
- - **`CURRENT STATUS`:** Aktif aşamayı, Trace ID'yi ve varsa engelleyicileri izler.
187
- - **`CRITICAL DECISIONS`:** Tutarlılığı sağlamak için önemli mimari seçimlerin bir kaydı.
188
- - **`ACTIVE TASKS`:** Devam eden tüm görevlerin, durumlarının, önceliklerinin ve atanan ajanın bir tablosu.
189
- - **`HISTORY`:** Ajanlar tarafından gerçekleştirilen tüm eylemlerin kalıcı bir kaydı.
190
-
191
- ### 3. İzlenebilirlik (Trace ID)
192
- Her göreve veya mantıksal iş birimine benzersiz bir **Trace ID** (26 karakterlik bir ULID) atanır. Bu kimlik, commit mesajlarında, loglarda ve görev tablolarında kullanılarak ilk talepten nihai koda kadar kesintisiz bir izlenebilirlik zinciri sağlar.
147
+ ## 4. Project Development Workflow & Best Practices
148
+
149
+ To successfully develop a project within the Agent Enderun framework, follow this rigid workflow.
150
+
151
+ ### A. Phase-Based Lifecycle
152
+ Development progresses sequentially through five states. Do not skip phases:
153
+ 1. **`PHASE_0` - Discovery & Setup:** Fill out `docs/tech-stack.md` and select the execution profile (Lightweight MVP vs. Full Enterprise).
154
+ 2. **`PHASE_1` - Architecture & Contracts:** Create your models and API definitions first. Establish contract hashes.
155
+ 3. **`PHASE_2` - Core Development:** Develop features inside `apps/backend/` and `apps/web/` in parallel.
156
+ 4. **`PHASE_3` - Integration & Testing:** Run end-to-end integration and reach the mandatory **80% test coverage gate** via `@qa`.
157
+ 5. **`PHASE_4` - Optimization & Deployment:** Perform a final performance audit and deploy.
158
+
159
+ ### B. Trace ID Protocol
160
+ Never write code or commit files without an active task ULID.
161
+ 1. Create a new task tracking chain:
162
+ ```bash
163
+ npx agent-enderun trace:new "Implement JWT Authentication" backend P1
164
+ ```
165
+ 2. This generates a ULID (e.g., `01H7G8K5TJ5S6MF9Z7H8N4C2P`) and appends it to the `ACTIVE TASKS` table in `PROJECT_MEMORY.md`.
166
+ 3. Use the Trace ID prefix in your git commit messages:
167
+ ```bash
168
+ git commit -m "[01H7G8K5TJ5S6MF9Z7H8N4C2P] feat(auth): add JWT fastify plugins"
169
+ ```
170
+
171
+ ### C. Contract-First & Branded Types
172
+ Under Agent Enderun, all ID types must use strict **Branded Types** to avoid type confusion:
173
+ ```typescript
174
+ // apps/backend/src/types/brands.ts
175
+ export type Brand<T, K extends string> = T & { __brand: K };
176
+
177
+ export type UserID = Brand<string, "UserID">;
178
+ export type ProjectID = Brand<string, "ProjectID">;
179
+ ```
180
+ Ensure `@backend` compiles all types into a shared folder BEFORE `@frontend` starts any page implementation. Update the contract version in `apps/backend/contract.version.json`.
181
+
182
+ ### D. Zero Mock & Zero UI-Library Policy
183
+ - **No Mocking:** All developed user interfaces must pull data from actual verified backend endpoints or Kysely repositories (with exceptions only for 3rd-party platforms like Stripe or Twilio).
184
+ - **Panda CSS & Custom UI:** External pre-styled components (e.g. TailwindCSS, MUI, Shadcn/UI) are forbidden in core workspaces unless explicitly authorized by `@manager`. Rely entirely on the type-safe token system of **Panda CSS** to construct custom, responsive interfaces.
185
+
186
+ ### E. Security & Compliance Scanning
187
+ Run static scanning checks locally on your codebase:
188
+ * **Security Audit:** Searches for unsafe database strings, hardcoded keys, innerHTML assignments, and `any` types.
189
+ ```bash
190
+ npx agent-enderun check:security
191
+ ```
192
+ * **Constitution Compliance:** Inspects files for forbidden libraries, unbranded ID types, and missing error-handling parameters.
193
+ ```bash
194
+ npx agent-enderun check:compliance
195
+ ```
196
+
197
+ ### F. Hermes Messaging & Task Queues
198
+ If working with multiple sub-agents in parallel, agents communicate via `messages/` under the Hermes Protocol. The files are locked via `.lock` tokens to ensure thread safety, and execution routes asynchronously through `.enderun/queue/`.
193
199
 
194
200
  ---
195
201
 
196
- ## 🤖 Ajan Ordusu
197
-
198
- Enderun Ordusu'ndaki her ajan, kendilerine ait kuralları, izin verilen dizinleri ve yetenek derecelendirmelerini tanımlayan güçlü tipli bir `agent.json` dosyası tarafından yönetilir.
199
-
200
- ### Çalışma Alanı Ajan Yolu:
201
- 👉 `[proje-kök-dizini]/.enderun/agents/{agent_name}.md`
202
-
203
- ### Ajan Ordusuna Genel Bakış (v1.0 - 12 Uzman Ajan):
204
-
205
- | Katman | Ajan | Yetenek | Rol & Alan | Ana Uzmanlık Alanı |
206
- | :--- | :--- | :--- | :--- | :--- |
207
- | **Core** | **@orchestrator** | **9.8/10** | Görev Kuyruğu Motoru | Paralel yürütme, stateful kuyruk kontrolleri, DAG yönetimi. |
208
- | **Core** | **@manager** | **9.5/10** | Orkestrasyon & Yönetişim | Talep analizi, yüksek riskli dinamik imza kontrolü, onay mekanizması. |
209
- | **Analiz** | **@analyst** | **9.6/10** | Kalite & Sözleşme Kapısı | Vitest/Cypress test denetimi, API kontrat sapma kontrolü, Sıfır-UI denetçisi. |
210
- | **Analiz** | **@explorer** | **9.4/10** | Araştırma & Keşif | Kod yapısı desen eşleme, bağımlılık grafiği çıkarma, onboarding analizi. |
211
- | **Geliştirme** | **@backend** | **9.2/10** | Domain Mantığı & DB | Fastify, Kysely veri tabanı sorguları, branded tipler, DomainError hiyerarşisi. |
212
- | **Geliştirme** | **@frontend** | **9.0/10** | Akıcı Duyarlı Arayüz | React 19, Panda CSS stil token'ları, Sıfır-UI, WCAG 2.2 AA erişilebilirlik. |
213
- | **Geliştirme** | **@native** | **8.9/10** | Native Yetenekler | Tauri/Electron kabuk koruması, Rust köprüleri, güvenli IPC kontratları. |
214
- | **Geliştirme** | **@mobile** | **8.8/10** | Çoklu Platform Mobil | React Native/Expo akıcı görünümler, offline önbellek senkronizasyonu. |
215
- | **Operasyon** | **@security** | **9.3/10** | Güvenlik & Uyum | OWASP tehdit tespiti, AST tabanlı statik sır taraması, CSP denetimi. |
216
- | **Operasyon** | **@qa** | **9.1/10** | Kalite Güvence Kapısı | Birim/entegrasyon test kontrolü, kapsama metrikleri denetçisi. |
217
- | **Operasyon** | **@git** | **9.1/10** | Versiyon Kontrolü | Semantik commit formatlama, atomik commit ayırma, faz snapshot'ları. |
218
- | **Operasyon** | **@devops** | **9.0/10** | Altyapı & Deployment | Deployment boru hatları, konteyner kurulumları, ortam değişkenleri denetimi. |
202
+ ## 5. CLI Reference Manual
203
+
204
+ | Command | Arguments | Description |
205
+ | :--- | :--- | :--- |
206
+ | `init` | `[adapter]` | Initializes the framework. Supported adapters: `gemini` (creates `.enderun/`), `claude` (`.claude/`), `cursor` (`.cursor/`). |
207
+ | `check` | *None* | Performs full framework diagnostic and codebase health check. |
208
+ | `status` | *None* | Displays current active Phase, Trace IDs, agent states, and blockers. |
209
+ | `trace:new` | `<description> [agent] [priority]` | Generates a new ULID Trace ID and appends it to active tasks. |
210
+ | `create-app` | `<idea>` | Generates a full-stack monorepo application template from natural language. |
211
+ | `verify-contract` | *None* | Computes API hashes to verify type parity between backend and frontend. |
212
+ | `check:security` | `[path]` | Runs static scan for SQL injections, secrets, and illegal variables. |
213
+ | `check:compliance` | `[path]` | Audits compliance with Branded Types and forbidden UI libraries. |
214
+ | `explorer:graph` | `[path]` | Generates a visual Mermaid TD dependency diagram of the local files. |
215
+ | `explorer:audit` | `[path]` | Executes static analysis mapping files to corresponding agent owners. |
216
+ | `git:commit` | `<trace-id>` | Inspects staged files and suggests a perfect semantic git commit message. |
217
+ | `mcp` | *None* | Starts the Model Context Protocol stdio server. |
218
+ | `version` | *None* | Prints the current framework release version. |
219
219
 
220
220
  ---
221
221
 
222
- ## 🏛️ Agent Enderun: Detaylı Kod Tabanı Denetim Raporu (v0.8.6)
223
-
224
- Ç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
-
226
- ### 📂 1. Kapsamlı Klasör ve Dosya Yapısı Analizi
222
+ ## 6. Project Layout Directory Structure
223
+
224
+ A fully-governed monorepo structured under Agent Enderun looks as follows:
225
+
226
+ ```text
227
+ ├── .enderun/ <-- Framework Runtime & Memory (v0.8.8)
228
+ │ ├── agents/ <-- Specialist agent Blueprints & SOPs
229
+ │ ├── knowledge/ <-- Rigid architecture patterns & rules
230
+ │ ├── memory-graph/ <-- Global facts & private agent states
231
+ │ ├── logs/ <-- Structured JSON audit trail
232
+ │ ├── queue/ <-- Asynchronous task queues
233
+ │ ├── PROJECT_MEMORY.md <-- Unified state brain (SSOT)
234
+ │ └── STATUS.md <-- Agent army dashboard
235
+ ├── apps/
236
+ │ ├── backend/ <-- Fastify & Kysely backend workspace
237
+ │ │ └── contract.json <-- API contract registry & hash metadata
238
+ │ └── web/ <-- React & Panda CSS client workspace
239
+ ├── docs/ <-- User's technical stack & requirements
240
+ ├── framework-mcp/ <-- MCP Server source code & tools
241
+ ├── bin/ <-- Executable CLI entrypoint binaries
242
+ ├── ENDERUN.md <-- System Constitution (Supreme Law)
243
+ └── package.json <-- Monorepo workspaces & shared actions
244
+ ```
227
245
 
228
- * **🧠 Çekirdek Komuta Klasörü (`.enderun/`):**
229
- * Ajanların şablon kaynak dosyalarının yer aldığı ve hedef projede `.enderun/` (veya `.claude/` / `.cursor/`) olarak yeniden adlandırılan ana zeka merkezidir.
230
- * **`agents/` (Ajan Tanımları & SOP'lar)**: 12 uzman ajanın davranış kurallarını barındırır. Her ajanın altında bir `agent.json` ve prompt/SOP dosyaları (`prompt.md`) bulunur. Durum makinesi şeması `schema/agent-lifecycle-schema.json` ile yönetilir.
231
- * **`knowledge/` (Bilgi Bankası)**: Projenin anayasasını, sıfır UI kütüphanesi politikasını ve veri tabanı/kod standartlarını içeren 26 adet Markdown kılavuzunu barındırır. `corporate-governance/` alt klasöründe onay mekanizmaları, branded types hukuku ve audit loglama standartları gibi kurumsal düzeydeki 17 katı yönetişim kılavuzu yer alır.
232
- * **`memory-graph/` (Bellek Grafiği)**: Ajanların etkileşim ağını (`graph.json`), ortak paylaştıkları doğruları (`shared-facts.json`) ve her bir ajanın yerel bağlam belleklerini (`agent-contexts/`) saklar.
233
- * **`queue/` (Dosya Tabanlı Görev Kuyruğu)**: Asenkron ve paralel görevlerin yönetildiği dizindir. `pending/`, `processing/`, `completed/` ve `failed/` alt dizinleri sayesinde Trace ID üzerinden asenkron görev takibi yapılır.
234
- * **`logs/` (Aksiyon Günlükleri)**: Ajanların gerçekleştirdiği tüm mutasyonları Trace ID (ULID) ile damgalayarak JSON formatında saklar (Örn: `backend.json`, `analyst.json`).
246
+ ---
247
+ ---
235
248
 
236
- * **🔌 Model Context Protocol (MCP) Katmanı (`framework-mcp/`):**
237
- * Ajanların IDE (Gemini, Claude, Cursor) ile konuşmasını ve yerel sistemdeki dosyaları güvenle manipüle etmesini sağlayan ana entegrasyon paketidir.
238
- * **`src/tools/`**: 13 adet çekirdek MCP araç modülünü (kod tabanı aramaları, bellek kilit protokolleri, kontrat doğrulamaları, statik AST analizli güvenlik taramaları vb.) barındırır.
239
- * **`src/schemas.ts`**: MCP araçlarına gönderilen parametrelerin tip güvenliğini Zod şemalarıyla denetler (Gereksiz/pasif şemalar temizlenmiştir).
240
- * **`src/index.ts`**: MCP sunucusunun stdio üzerinden IDE ile bağlantısını kuran ana giriş kapısıdır.
249
+ # Türkçe
241
250
 
242
- * **🚀 Çalıştırılabilir Dizin & CLI (`bin/` ve `src/cli/`):**
243
- * **`bin/cli.js`**: `npx tsx src/cli/index.ts` komutunu sarmalayan çalıştırılabilir binary giriş noktasıdır.
244
- * **`src/cli/index.ts`**: Projeyi platformlara göre (`gemini`, `claude`, `cursor`) scaffold eden ve sağlık kontrollerini (`check`, `status`) koordine eden çekirdek CLI motorudur.
245
- * **`bin/hermes-sandbox.js`**: Ajanlar arası Yüksek Riskli İşlem ve dynamic onay (`managerApproval`) mesajlaşma akışını yerel olarak simüle eden test sandbox'ıdır.
251
+ ## İçindekiler
252
+ - [1. Giriş ve Temel Felsefe](#1-giriş-ve-temel-felsefe)
253
+ - [2. Kurulum ve Hızlı Başlangıç](#2-kurulum-ve-hızlı-başlangıç)
254
+ - [Ön Gereksinimler](#ön-gereksinimler)
255
+ - [Adım Adım Kurulum](#adım-adım-kurulum)
256
+ - [Sağlık ve Doğrulama Taraması](#sağlık-ve-doğrulama-taraması)
257
+ - [3. Adaptörler ve Kullanım Senaryoları](#3-adaptörler-ve-kullanım-senaryoları)
258
+ - [Gemini Adaptörü (Standart & Önerilen)](#gemini-adaptörü-standart--önerilen)
259
+ - [Claude & Cursor Adaptörleri](#claude--cursor-adaptörleri)
260
+ - [Claude Code / Claude Desktop Entegrasyonu](#claude-code--claude-desktop-entegrasyonu)
261
+ - [4. Proje Geliştirme Akışları ve En İyi Pratikler](#4-proje-geliştirme-akışları-ve-en-iyi-pratikler)
262
+ - [A. Aşama Tabanlı Yaşam Döngüsü](#a-aşama-tabanlı-yaşam-döngüsü)
263
+ - [B. Trace ID Protokolü](#b-trace-id-protokolü)
264
+ - [C. Kontrat Öncelikli Geliştirme & Branded Types](#c-kontrat-öncelikli-geliştirme--branded-types)
265
+ - [D. Sıfır Sahte Veri (Zero-Mock) & Sıfır UI Kütüphanesi Kanunu](#d-sıfır-sahte-veri-zero-mock--sıfır-ui-kütüphanesi-kanunu)
266
+ - [E. Güvenlik ve Uyumluluk Taramaları](#e-güvenlik-ve-uyumluluk-taramaları)
267
+ - [F. Hermes Mesajlaşması & Görev Kuyrukları](#f-hermes-mesajlaşması--görev-kuyrukları)
268
+ - [5. CLI Referans Klavuzu](#5-cli-referans-klavuzu)
269
+ - [6. Proje Klasör Dizilim Mimarisi](#6-proje-klasör-dizilim-mimarisi)
246
270
 
247
- ### 🧹 2. Gerçekleştirilen v1.0 Kritik Temizlik ve Düzenlemeler
271
+ ---
248
272
 
249
- * **Ajan Promptlarındaki Çöp Veriler Temizlendi:** `analyst`, `backend`, `mobile` ve `native` promptlarının sonundaki bozuk mükerrer satırlar ve generic raporlama blokları tamamen kaldırılmıştır.
250
- * **Ölü MCP Kodları / Araçları Ayıklandı:** `schemas.ts` içindeki 8 adet pasif/unimplemented araç şeması ayıklanmış ve promptlardaki ölü araç referansları temizlenmiştir.
251
- * **Olmayan Klasör Referansları Onarıldı:** Olmayan `.enderun/blueprints/` klasör referansları, `.enderun/knowledge/` altındaki aktif rehberlerle başarılı şekilde değiştirilmiştir.
252
- * **Çoklu Platform ve Kök Senkronizasyonu Sağlandı:** `gemini.md`, `claude.md` ve `cursor.md` dosyaları şablon ve kök dizinde senkronize edilerek CLI dağıtımına hazır hale getirilmiştir.
273
+ ## 1. Giriş ve Temel Felsefe
253
274
 
254
- ### 👑 3. Ajan Ordusu Hiyerarşisi ve Çalışma Akışı
275
+ Yazılım geliştirme süreçlerindeki yapay zeka yardımı genellikle plansız değişikliklere, teknik borç birikimine ve kontrolsüz kod sapmalarına neden olur. **Agent Enderun**, yapay zekayı basit bir kod üreteci olarak konumlandırmak yerine, onu `@manager` (Takım Lideri) ajanı komutasında çalışan, kurallara bağlı disiplinli bir mühendislik ordusu haline getiren **Kurumsal Yapay Zeka Yönetişim Framework'üdür**.
255
276
 
256
- * **Üst Ajan (Lead):** `@manager` her zaman varsayılan liderdir. Projedeki tüm alt görevler onun brifingi ile başlar.
257
- * **Alt Ajanlar (Specialists):** `@backend`, `@frontend`, `@security` vb. uzman ajanlar kendilerine atanan asenkron görevleri yapar.
258
- * **Kalite Kapısı:** `@analyst` ve `@security` yapılan geliştirmelerin anayasaya uygunluğunu denetlemeden hiçbir kod parçası staging/commit aşamasına geçemez.
277
+ ### Enderun’un Beş Ana Sütunu
278
+ 1. **Mutlak İzlenebilirlik:** Yapılan her işlem, commit ve durum değişikliği ULID tabanlı bir **Trace ID** ile damgalanır.
279
+ 2. **Önce Sözleşme (Contract-First):** API rotaları ve veri tipleri (**Branded Types**) tanımlanıp onaylanmadan tek satır kod yazılamaz.
280
+ 3. **Kalıcı Yerel Hafıza:** Yapay zekanın tüm bağlamı (context) ve projenin mevcut durumu, işletim sisteminin `/tmp` dizininde değil, doğrudan projenizin içinde saklanır.
281
+ 4. **Sınırların Korunması (Pristine Sandboxing):** Framework çekirdeği ile sizin uygulama kodunuz arasında aşılmaz sınırlar çizilir.
282
+ 5. **Gerçekçi Veri (Zero Mock Policy):** Tüm analiz ve operasyon ekranları sahte verilerle (mock) değil, onaylanmış canlı veritabanı şemalarıyla konuşur.
259
283
 
260
284
  ---
261
285
 
286
+ ## 2. Kurulum ve Hızlı Başlangıç
262
287
 
263
- ## Hızlı Başlangıç ve İş Akışı
288
+ ### Ön Gereksinimler
289
+ - **Node.js** v20.0.0 veya üzeri (LTS sürümü önerilir).
290
+ - **npm** v9+ veya **pnpm** v8+ veya **yarn** v3+.
291
+ - **Git** (proje dizininde başlatılmış olmalıdır).
264
292
 
265
- ### 1. Kurulum
293
+ ### Adım Adım Kurulum
266
294
 
267
- Framework'ü projenize kurmak ve başlatmak için aşağıdaki adımları takip edin:
295
+ #### Adım 1: Proje dizininizi oluşturun ve Git'i başlatın
296
+ ```bash
297
+ mkdir benim-kurumsal-uygulamam
298
+ cd benim-kurumsal-uygulamam
299
+ git init
300
+ ```
268
301
 
302
+ #### Adım 2: Framework'ü Başlatın
303
+ Aşağıdaki komut, projenizi analiz ederek uygun adaptörü kurar ve yönetişim yapısını hazırlar:
269
304
  ```bash
270
- # 1. Framework'ü Gemini CLI için başlatın
271
305
  npx agent-enderun init gemini
306
+ ```
307
+ *Not: Bir adaptör belirtilmezse standart olarak `gemini` kurulur ve framework çalışma ortamı `.enderun/` dizininde oluşturulur.*
272
308
 
273
- # 2. Bağımlılıkları yükleyin (istendiği gibi)
309
+ #### Adım 3: Bağımlılıkları Yükleyin ve MCP Sunucusunu Derleyin
310
+ ```bash
274
311
  npm install
275
-
276
- # 3. Framework'ün dahili araçlarını derleyin (istendiği gibi)
277
312
  npm run enderun:build
313
+ ```
314
+
315
+ ---
278
316
 
279
- # 4. Kurulumu ve proje sağlığını doğrulayın
317
+ ### Sağlık ve Doğrulama Taraması
318
+
319
+ Kurulum sonrasında veya büyük aşama geçişlerinde projenizin sağlık durumunu denetlemek için yerleşik tarayıcıyı çalıştırın:
320
+ ```bash
280
321
  npx agent-enderun check
281
322
  ```
282
323
 
283
- ### 2. Örnek İş Akışı: Yeni Bir Özellik Ekleme
324
+ #### Bu tarama neleri doğrular?
325
+ - **Anayasa Güvenliği:** `ENDERUN.md` dosyasının mevcudiyetini ve doğruluğunu kontrol eder.
326
+ - **Bellek Erişimi:** `.enderun/PROJECT_MEMORY.md` dosyasının etkin ve yazılabilir olduğunu denetler.
327
+ - **Sözleşme Bütünlüğü:** `apps/backend/contract.version.json` dosyasını denetler.
328
+ - **MCP Derlemesi:** `framework-mcp/dist/index.js` dosyasının derlendiğini doğrular.
329
+ - **Teknoloji Yığını:** Projenin mimari stack tanımının `docs/tech-stack.md` içine yazılıp yazılmadığını kontrol eder.
284
330
 
285
- Agent Enderun'u yeni bir özellik geliştirmek için nasıl kullanacağınız aşağıda açıklanmıştır:
331
+ ---
286
332
 
287
- **Adım 1: Görevi Tanımlayın**
288
- Projenizin `docs/` klasöründe yeni bir dosya oluşturun (örn. `docs/yeni-ozellik-isteği.md`) ve istediğiniz özelliği tanımlayın.
333
+ ## 3. Adaptörler ve Kullanım Senaryoları
289
334
 
290
- **Adım 2: Yeni Bir İz (Trace) Oluşturun**
291
- `PROJECT_MEMORY.md`'de yeni bir görev oluşturmak için CLI'yi kullanın. Bu, benzersiz bir Trace ID oluşturur.
335
+ Agent Enderun, kullandığınız editör veya yapay zeka aracına uygun adaptörü dinamik olarak etkinleştirir.
292
336
 
293
- ```bash
294
- npx agent-enderun trace:new "docs/yeni-ozellik-isteği.md'ye göre kullanıcı profili sayfasını uygula" @manager P1
295
- ```
337
+ ### Gemini Adaptörü (Standart & Önerilen)
338
+ - **Dizin:** `.enderun/`
339
+ - **Hedef:** Gemini CLI, Google Vertex AI ve doğrudan Gemini API ortamları.
340
+ - **Tetikleyici:** Proje kökündeki `gemini.md` dosyası (yapay zeka ilk bu dosyayı okuyarak anayasayı yükler).
341
+ - **Avantaj:** Gemini'ın devasa bağlam (context window) kapasitesine göre optimize edilmiş araç çağrıları.
296
342
 
297
- **Adım 3: Ajan Orkestrasyonu (Otomatik)**
298
- `@manager` ajanı (varsayılan AI kişiliği) şunları yapacaktır:
299
- 1. `PROJECT_MEMORY.md`'yi okuyacak ve yeni görevi görecektir.
300
- 2. `docs/yeni-ozellik-isteği.md`'deki talebi analiz edecektir.
301
- 3. Bir plan oluşturacak ve `@explorer`, `@backend` ve `@frontend` gibi uzman ajanlara resmi "brifingler" verecektir.
343
+ ### Claude & Cursor Adaptörleri
344
+ - **Claude Adaptörü (`init claude`):** `.claude/` çalışma dizinini hazırlar. **Claude Code CLI** ve **Claude Desktop** için otomatik MCP bağlantılarını yapılandırır.
345
+ - **Cursor Adaptörü (`init cursor`):** `.cursor/` klasörünü ve `.cursorrules` dosyasını oluşturarak Cursor IDE'nin kendi kod üretim sınırlarını Enderun kurallarına kilitler.
302
346
 
303
- **Adım 4: Geliştirme ve Doğrulama (Otomatik)**
304
- - Uzman ajanlar, anayasal kurallara göre görevlerini yerine getirir (örneğin, `@backend` API'yi ve tipleri oluşturur, ardından `@frontend` kullanıcı arayüzünü oluşturur).
305
- - `@analyst`, yapılan işi proje standartlarına göre otomatik olarak doğrular.
306
- - `@git`, Trace ID ile etiketlenmiş atomik `commit`'ler oluşturur.
347
+ ### Claude Code / Claude Desktop Entegrasyonu
307
348
 
308
- **Adım 5: İlerlemeyi İzleyin**
309
- `status` komutuyla ilerlemeyi istediğiniz zaman kontrol edebilirsiniz:
349
+ Agent Enderun, tam teşekküllü bir **Model Context Protocol (MCP)** sunucusu içerir. Bunu Claude ortamınıza bağlamak için `claude_desktop_config.json` dosyanıza veya global Claude CLI ayarlarınıza şu bloğu eklemeniz yeterlidir:
310
350
 
311
- ```bash
312
- npx agent-enderun status
351
+ ```json
352
+ {
353
+ "mcpServers": {
354
+ "agent-enderun-mcp": {
355
+ "command": "node",
356
+ "args": ["/absolute/path/to/your/project/framework-mcp/dist/index.js"]
357
+ }
358
+ }
359
+ }
313
360
  ```
314
- Bu, aktif aşamayı, engelleri ve tüm aktif görevlerin durumunu gösterecektir.
361
+
362
+ Bağlantı kurulduğunda, yapay zekanız şu araçları (tools) kullanma yeteneği kazanır:
363
+ - `search_codebase` (Cerrahi kod arama)
364
+ - `read_project_memory` & `update_project_memory` (Hafıza güncelleme)
365
+ - `verify_api_contract` (Tip uyumluluk kontrolü)
366
+ - `send_agent_message` (Ajanlar arası Hermes mesajlaşması)
315
367
 
316
368
  ---
317
369
 
318
- ## 🛠️ CLI Komutları
370
+ ## 4. Proje Geliştirme Akışları ve En İyi Pratikler
371
+
372
+ Agent Enderun framework'ü üzerinde başarılı bir geliştirme süreci yürütmek için aşağıdaki adımları takip etmeniz zorunludur:
373
+
374
+ ### A. Aşama Tabanlı Yaşam Döngüsü
375
+ Geliştirme süreci asla atlanamayacak 5 ardışık fazdan oluşur:
376
+ 1. **`PHASE_0` - Keşif ve Yapılandırma:** `docs/tech-stack.md` doldurulur ve Lightweight (MVP) veya Full (Kurumsal) yürütme profili seçilir.
377
+ 2. **`PHASE_1` - Mimari ve Sözleşmeler:** Veri modelleri, API rotaları ve tip sözleşmeleri kilitlenir.
378
+ 3. **`PHASE_2` - Çekirdek Geliştirme:** `apps/backend` ve `apps/web` paralel olarak kodlanır.
379
+ 4. **`PHASE_3` - Entegrasyon ve Test:** `@qa` ajanı denetiminde **en az %80 birim/entegrasyon test kapsamı** zorunlu kapı olarak geçilir.
380
+ 5. **`PHASE_4` - Optimizasyon ve Dağıtım:** Performans denetimleri tamamlanarak uygulama canlıya alınır.
381
+
382
+ ### B. Trace ID Protokolü
383
+ Aktif bir iş ULID'si olmadan kod yazmak veya commit atmak yasaktır.
384
+ 1. Yeni bir göreve başlarken terminalden yeni bir Trace oluşturun:
385
+ ```bash
386
+ npx agent-enderun trace:new "JWT Yetkilendirme Modülü" backend P1
387
+ ```
388
+ 2. Bu komut benzersiz bir ULID üretir (örn: `01H7G8K5TJ5S6MF9Z7H8N4C2P`) ve bunu `.enderun/PROJECT_MEMORY.md` içindeki aktif görevler tablosuna yazar.
389
+ 3. Tüm Git commit mesajlarınızda bu Trace ID'yi ön ek olarak kullanın:
390
+ ```bash
391
+ git commit -m "[01H7G8K5TJ5S6MF9Z7H8N4C2P] feat(auth): add JWT fastify plugins"
392
+ ```
393
+
394
+ ### C. Kontrat Öncelikli Geliştirme & Branded Types
395
+ Hatalı kimlik atamalarını ve tip belirsizliklerini önlemek için projedeki tüm benzersiz kimlikler (ID) **Branded Types** formatında markalanmalıdır:
396
+ ```typescript
397
+ // apps/backend/src/types/brands.ts
398
+ export type Brand<T, K extends string> = T & { __brand: K };
399
+
400
+ export type UserID = Brand<string, "UserID">;
401
+ export type ProjectID = Brand<string, "ProjectID">;
402
+ ```
403
+ `@backend` ajanı tüm bu tipleri ortak sözleşmeye yazıp `apps/backend/contract.version.json` dosyasını güncellemeden, `@frontend` ajanı kullanıcı arayüzü tasarlamaya başlayamaz.
404
+
405
+ ### D. Sıfır Sahte Veri (Zero-Mock) & Sıfır UI Kütüphanesi Kanunu
406
+ * **Sahte Veri Yasağı:** Arayüzler doğrudan doğrulanmış Fastify uç noktalarından ve Kysely veritabanı depolarından beslenmelidir (Stripe, Twilio gibi dış servis entegrasyonları hariç).
407
+ * **Panda CSS Kullanımı:** TailwindCSS, MUI veya Shadcn/UI gibi hazır stillendirilmiş kütüphaneler (aksine bir `@manager` izni yoksa) yasaktır. Tasarımlar tamamen tip-güvenli **Panda CSS** belirteçleri (tokens) ile el değerek oluşturulur.
408
+
409
+ ### E. Güvenlik ve Uyumluluk Taramaları
410
+ Kaynak kodunuzu yerel olarak statik analizlerden geçirin:
411
+ * **Güvenlik Denetimi:** Güvensiz veritabanı sorgularını, açık parola tanımlarını ve `any` veri tipi ihlallerini yakalar:
412
+ ```bash
413
+ npx agent-enderun check:security
414
+ ```
415
+ * **Anayasa Uyumluluğu:** Markalanmamış kimlik kullanımlarını ve yasaklı harici UI kütüphane bağımlılıklarını denetler:
416
+ ```bash
417
+ npx agent-enderun check:compliance
418
+ ```
419
+
420
+ ### F. Hermes Mesajlaşması & Görev Kuyrukları
421
+ Paralel çalışan alt ajanlar (sub-agents), birbirleriyle Hermes Protokolü (`messages/` klasörü) üzerinden asenkron olarak mesajlaşır. İşlemler `.lock` kilit dosyalarıyla güvenceye alınır ve asenkron kuyruklar `.enderun/queue/` altında güvenle sıraya konur.
422
+
423
+ ---
319
424
 
320
- Agent Enderun, projeyi yönetmek için güçlü bir komut satırı araç seti ile birlikte gelir.
425
+ ## 5. CLI Referans Klavuzu
426
+
427
+ | Komut | Parametreler | Açıklama |
428
+ | :--- | :--- | :--- |
429
+ | `init` | `[adapter]` | Framework'ü başlatır. Desteklenen adaptörler: `gemini` (`.enderun/`), `claude` (`.claude/`), `cursor` (`.cursor/`). |
430
+ | `check` | *Yok* | Projenin genel sağlık ve anayasal uyumluluk durumunu denetler. |
431
+ | `status` | *Yok* | Aktif aşamayı, Trace ID'lerini, aktif ajan durumlarını ve engelleri (blockers) gösterir. |
432
+ | `trace:new` | `<açıklama> [ajan] [öncelik]` | Yeni bir ULID Trace ID'si oluşturarak proje hafızasındaki aktif görevlere ekler. |
433
+ | `create-app` | `<fikir>` | Doğal dil ile girilen gereksinimlerden sıfırdan kurumsal monorepo uygulaması üretir. |
434
+ | `verify-contract` | *Yok* | Sözleşme karma değerlerini (hash) hesaplayarak backend-frontend tip uyumluluğunu doğrular. |
435
+ | `check:security` | `[yol]` | Ham SQL, açık anahtarlar, innerHTML ve `any` tipi için güvenlik taraması yapar. |
436
+ | `check:compliance` | `[yol]` | Branded Types uyumluluğunu ve yasaklı arayüz kütüphanelerini denetler. |
437
+ | `explorer:graph` | `[yol]` | Dosyalar arası bağımlılıkları analiz ederek görsel Mermaid TD şeması üretir. |
438
+ | `explorer:audit` | `[yol]` | Kod dosyalarının hangi uzman ajanın mülkiyetinde olduğunu listeleyen statik analiz yapar. |
439
+ | `git:commit` | `<trace-id>` | Commit aşamasındaki staged dosyaları inceleyerek Trace ID uyumlu semantik commit mesajı önerir. |
440
+ | `mcp` | *Yok* | Model Context Protocol stdio sunucusunu başlatır. |
441
+ | `version` | *Yok* | Framework'ün mevcut sürüm numarasını yazdırır. |
321
442
 
322
- | Komut | Açıklama |
323
- | :--- | :--- |
324
- | `npx agent-enderun init [adapter]` | Framework'ü mevcut projede başlatır. `gemini` varsayılan ve önerilen adaptördür. |
325
- | `npx agent-enderun check` | Gerekli tüm dosyaların ve yapılandırmaların mevcut olduğundan emin olmak için projede bir sağlık kontrolü çalıştırır. |
326
- | `npx agent-enderun status` | `PROJECT_MEMORY.md`'den mevcut proje durumunu, aktif görevleri ve engelleri gösterir. |
327
- | `npx agent-enderun trace:new "<açıklama>" [ajan] [öncelik]` | Benzersiz bir Trace ID ile yeni bir görev oluşturur ve bunu `PROJECT_MEMORY.md`'ye ekler. |
328
- | `npx agent-enderun create-app "<açıklama>"` | (Takma adlar: `new`, `start`) Doğal dil tanımından yeni bir tam yığın uygulama (backend + web) oluşturur. |
329
- | `npx agent-enderun verify-contract` | `contract.version.json`'da saklanan `hash` ile mevcut kodu karşılaştırarak paylaşılan backend tiplerinin bütünlüğünü doğrular. |
330
443
  ---
331
444
 
332
- **Agent Enderun is not just a tool. It is a complete operating system for professional, risk-aware, AI-assisted software development.**
445
+ ## 6. Proje Klasör Dizilim Mimarisi
446
+
447
+ Agent Enderun altında yönetilen örnek bir kurumsal monorepo yapısı:
448
+
449
+ ```text
450
+ ├── .enderun/ <-- Çalışma Zamanı & Hafıza Klasörü (v0.8.8)
451
+ │ ├── agents/ <-- Uzman Ajan Direktifleri ve SOP Belgeleri
452
+ │ ├── knowledge/ <-- Mimari Desenler ve Kodlama Kuralları
453
+ │ ├── memory-graph/ <-- Paylaşılan Gerçekler ve Ajan Durumları
454
+ │ ├── logs/ <-- Denetlenebilir Yapılandırılmış JSON Logları
455
+ │ ├── queue/ <-- Asenkron Görev Yönetim Kuyruğu
456
+ │ ├── PROJECT_MEMORY.md <-- Projenin Tek Güvenilir Ortak Beyni (SSOT)
457
+ │ └── STATUS.md <-- Ajan Ordusu Durum Gösterge Paneli
458
+ ├── apps/
459
+ │ ├── backend/ <-- Fastify ve Kysely tabanlı Backend Çalışma Alanı
460
+ │ │ └── contract.json <-- API Sözleşmeleri ve Doğrulama Özetleri
461
+ │ └── web/ <-- React ve Panda CSS tabanlı Client Çalışma Alanı
462
+ ├── docs/ <-- Kullanıcının Mimari İstekleri ve Stack Bilgileri
463
+ ├── framework-mcp/ <-- MCP Sunucu Kaynak Kodları ve Araçlar
464
+ ├── bin/ <-- Çalıştırılabilir CLI Giriş Noktası Binaries
465
+ ├── ENDERUN.md <-- Sistem Anayasası (Supreme Law)
466
+ └── package.json <-- Monorepo Çalışma Alanı Tanımları & Betikler
467
+ ```