agent-enderun 0.6.5 → 0.6.6

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 (56) hide show
  1. package/.enderun/BRAIN_DASHBOARD.md +12 -12
  2. package/.enderun/PROJECT_MEMORY.md +15 -123
  3. package/.enderun/STATUS.md +13 -13
  4. package/.enderun/agents/README.md +40 -0
  5. package/.enderun/agents/analyst.md +178 -58
  6. package/.enderun/agents/backend.md +224 -58
  7. package/.enderun/agents/explorer.md +123 -50
  8. package/.enderun/agents/frontend.md +216 -26
  9. package/.enderun/agents/git.md +146 -72
  10. package/.enderun/agents/manager.md +23 -3
  11. package/.enderun/agents/mobile.md +136 -66
  12. package/.enderun/agents/native.md +176 -63
  13. package/.enderun/blueprints/README.md +82 -0
  14. package/.enderun/docs/README.md +50 -0
  15. package/.enderun/docs/phase1-reference-app-execution-plan.md +177 -0
  16. package/.enderun/docs/structure-audit-2026-05-24.md +72 -0
  17. package/.enderun/knowledge/README.md +22 -0
  18. package/.enderun/knowledge/database_governance_guidelines.md +118 -0
  19. package/.enderun/knowledge/deployment_checklist.md +132 -6
  20. package/.enderun/knowledge/documentation_ownership.md +122 -0
  21. package/.enderun/knowledge/documentation_ownership_status.md +122 -0
  22. package/.enderun/knowledge/enterprise_capabilities_reference.md +149 -0
  23. package/.enderun/knowledge/enterprise_frontend_adaptation.md +232 -0
  24. package/.enderun/knowledge/enterprise_project_adaptation.md +168 -0
  25. package/.enderun/knowledge/frontend_professionalization_guidelines.md +20 -17
  26. package/.enderun/knowledge/frontend_real_battle_test_protocol.md +162 -0
  27. package/.enderun/knowledge/hermes_live_test_guidelines.md +5 -5
  28. package/.enderun/knowledge/manager_authority_audit_enforcement.md +8 -8
  29. package/.enderun/knowledge/project_scaffold_guidelines.md +4 -4
  30. package/.enderun/knowledge/reference_application_guidelines.md +6 -6
  31. package/ENDERUN.md +13 -6
  32. package/README.md +98 -183
  33. package/bin/hermes-sandbox.js +136 -0
  34. package/docs/action-plan-2026.md +119 -0
  35. package/docs/getting-started.md +12 -238
  36. package/docs/roadmap.md +15 -73
  37. package/framework-mcp/README.md +1 -1
  38. package/framework-mcp/dist/schemas.js +6 -0
  39. package/framework-mcp/dist/tools/database.js +7 -2
  40. package/framework-mcp/dist/tools/framework.js +4 -4
  41. package/framework-mcp/dist/tools/knowledge.js +1 -1
  42. package/framework-mcp/dist/tools/memory.js +2 -2
  43. package/framework-mcp/dist/tools/messages.js +71 -11
  44. package/framework-mcp/dist/utils.js +1 -1
  45. package/framework-mcp/package.json +1 -1
  46. package/framework-mcp/src/tools/database.ts +7 -2
  47. package/framework-mcp/src/tools/framework.ts +4 -4
  48. package/framework-mcp/src/tools/knowledge.ts +1 -1
  49. package/framework-mcp/src/tools/memory.ts +2 -2
  50. package/framework-mcp/src/tools/messages.ts +4 -4
  51. package/framework-mcp/src/utils.ts +18 -1
  52. package/framework-mcp/tsconfig.json +1 -1
  53. package/package.json +3 -3
  54. package/.enderun/messages/2026-05-23-backend-to-manager-auth-errors-reply.json +0 -23
  55. package/.enderun/messages/2026-05-23-manager-to-backend-auth-errors.json +0 -26
  56. /package/.enderun/blueprints/backend/errors/{blueprint.json → config/meta.json} +0 -0
@@ -6,20 +6,20 @@ This dashboard provides a high-level overview of the Academy's performance, qual
6
6
 
7
7
  ## 📊 Performance Metrics
8
8
 
9
- | Metric | Current Value | Status |
10
- | :--- | :--- | :--- |
11
- | **Global Success Rate** | 0% | ⏳ Initializing |
12
- | **Active Trace IDs** | 0 | ⚪ Idle |
13
- | **Agent Velocity** | 0 tasks/day | ⚪ Idle |
14
- | **Contract Integrity** | 100% | ✅ Valid |
9
+ | Metric | Current Value | Status |
10
+ | :---------------------- | :------------ | :----------- |
11
+ | **Global Success Rate** | 0% | ⏳ Initializing |
12
+ | **Active Trace IDs** | 0 | ⚪ Idle |
13
+ | **Agent Velocity** | 0 tasks/day | ⚪ Idle |
14
+ | **Contract Integrity** | 100% | ✅ Valid |
15
15
 
16
16
  ---
17
17
 
18
18
  ## 🛡️ Quality & Security
19
19
 
20
- - **Security Audit Status**: 🟢 Clean (Last scan: N/A)
21
- - **Constitution Compliance**: 🔵 100% (Last audit: N/A)
22
- - **Documentation Debt**: 🟠 Moderate (Missing JSDoc in some modules)
20
+ - **Security Audit Status**: 🟢 Clean
21
+ - **Constitution Compliance**: 🔵 100%
22
+ - **Documentation Debt**: 🟠 Low
23
23
 
24
24
  ---
25
25
 
@@ -33,9 +33,9 @@ This dashboard provides a high-level overview of the Academy's performance, qual
33
33
 
34
34
  ## 📜 Contract Change Log
35
35
 
36
- | Version | Date | Description | Hash |
37
- | :--- | :--- | :--- | :--- |
38
- | v0.2.0 | 2026-05-11 | Initial v0.2.0 Baseline | `sha256:current-baseline` |
36
+ | Version | Date | Description | Hash |
37
+ | :------ | :--------- | :------------------- | :--- |
38
+ | v0.6.6 | 2026-05-24 | v0.6.6 Release Baseline | |
39
39
 
40
40
  ---
41
41
 
@@ -2,61 +2,25 @@
2
2
 
3
3
  ## CURRENT STATUS
4
4
 
5
- | Active Phase | Profile | Last Update | Active Trace ID | Blockers |
6
- | :----------- | :------ | :---------- | :-------------- | :------- |
7
- | PHASE_0 | Lightweight | 2026-05-20 | — | NONE |
5
+ | Active Phase | Profile | Last Update | Active Trace ID | Blockers |
6
+ | :----------- | :----------- | :---------- | :-------------- | :------- |
7
+ | PHASE_0 | Lightweight | 2026-05-24 | — | NONE |
8
8
 
9
9
  ---
10
10
 
11
11
  ## CRITICAL DECISIONS
12
12
 
13
- | ID | Decision | Rationale | Impact | Date |
14
- | :--- | :--- | :--- | :--- | :--- |
15
- | D001 | Decentralized Architecture | Simplified dependency management and local type control | Stability | 2026-05-20 |
16
- | D002 | Dynamic Blueprints | Empower agents to evolve project-specific capabilities | Intelligence | 2026-05-20 |
13
+ | ID | Decision | Rationale | Impact | Date |
14
+ | :--- | :------------------------------------ | :------------------------------------------------------------------------ | :------------------ | :--------- |
15
+ | D001 | Decentralized Architecture | Simplified dependency management and local type control | Stability | 2026-05-20 |
16
+ | D002 | Dynamic Blueprints | Empower agents to evolve project-specific capabilities | Intelligence | 2026-05-20 |
17
+ | D004 | Agent Capability First | Focus on hardening agent intelligence so agents can adapt to any user's existing large corporate project structure instead of building hardcoded reference apps. | Enterprise Readiness | 2026-05-23 |
17
18
 
18
19
  ---
19
20
 
20
- ## STRATEGIC ROADMAP (2026-05-23)
21
-
22
- Based on the comprehensive strategic review (see `docs/strategic-review-2026-05.md`):
23
-
24
- ### Priority 1 — Enterprise Governance (Partially Completed)
25
- - ✅ **Kurumsal CRUD & Admin Governance** implemented across all agents (@manager as mandatory single point of entry, high-risk administrative actions require explicit approval + `managerApproval` object + full audit trail).
26
- - Next: Enforce this governance in any future reference implementation.
27
-
28
- ### Priority 2 — Reference Implementation (Highest Impact)
29
- - Create minimal but realistic `apps/backend` + `apps/web` boilerplate inside the monorepo.
30
- - Must demonstrate:
31
- - Contract-First + Branded Types
32
- - Normal CRUD + one High-Risk Admin operation (e.g. user role change)
33
- - Full compliance with the new Kurumsal CRUD Yönetişimi rules
34
- - This is the #1 missing piece to prove the framework's value.
35
-
36
- ### Priority 3 — Frontend Blueprints & Scaffolding
37
- - Develop reusable frontend patterns (useListPage, useDetailPage, admin action hooks) as first-class blueprints.
38
- - Align with existing backend strength.
39
-
40
- ### Priority 4 — Hermes Messaging Protocol
41
- - Make `send_agent_message` / `read_agent_messages` fully functional for autonomous agent-to-agent orchestration.
42
-
43
- ### Priority 5 — Claude Adapter Automation
44
- - Complete automatic patching of Claude global config (remove manual step).
45
-
46
- **Status:** Roadmap accepted. Will be broken into concrete ACTIVE TASKS in subsequent sessions.
47
-
48
- ### Risk Tracking Dashboard (23 Mayıs 2026 — Güncel)
21
+ ## STRATEGIC ROADMAP
49
22
 
50
- Şu anda odaklandığımız ve aktif olarak takip ettiğimiz kritik riskler:
51
-
52
- | Risk | Önceki Durum | Şu Anki Durum | İlerleme | Kalan İş |
53
- |-------------------------------|-----------------------|----------------------------|-----------------------------------------------|---------------------------------------|
54
- | Referans Uygulama Yokluğu | Kritik (boş) | Kritik (hâlâ boş) | Guidance + `project_scaffold_guidelines.md` added | Ready for execution |
55
- | @frontend Zayıflığı | Yüksek Risk | Yüksek Risk | Guidance + 6-8 week Professionalization Program documented | Ready for execution + Authority Audit support |
56
- | Hermes “Kağıt Üzerinde” | Yüksek | Orta | Guidance + Live Test Program documented (4 core scenarios defined) | Ready for execution + Authority Audit enforcement |
57
- | Claude Otomasyonu | Orta | Düşük-Orta | %60 (otomatik patch iyileştirildi) | Farklı versiyonlarda test |
58
- | Gerçek Kullanım Eksikliği | Kritik | Kritik | 0% | Referans uygulamaya bağlı |
59
- | Kurumsal Yönetişim | Orta | Çok İyi | %85 (tüm ajanlarda zorunlu hale getirildi) | Referans uygulamada kanıtlanmalı |
23
+ See `docs/roadmap.md` for the current Risk Tracking Dashboard and development priorities.
60
24
 
61
25
  ---
62
26
 
@@ -64,92 +28,20 @@ Based on the comprehensive strategic review (see `docs/strategic-review-2026-05.
64
28
 
65
29
  | Module | Status | Agent | Date |
66
30
  | :--- | :--- | :--- | :--- |
67
- | framework-mcp | COMPLETED | @manager | 2026-05-20 |
68
- | Antigravity Adapter | COMPLETED | @manager | 2026-05-23 |
69
- | Lint & Technical Debt Cleanup | COMPLETED | @manager | 2026-05-23 |
70
- | Getting Started Guide | COMPLETED | @manager | 2026-05-23 |
71
- | Strategic Review Report & Roadmap | COMPLETED | @manager | 2026-05-23 |
72
31
 
73
32
  ---
74
33
 
75
34
  ## ACTIVE TASKS
76
35
 
77
- | 01H7K9P2Q3R4S5T6U7V8W9X0Y1 | Translate all agent capability documents to professional English | @manager | P0 | COMPLETED |
78
- | 01H7K9P2Q3R4S5T6U7V8W9X0Y2 | Fix all lint errors in framework-mcp | @manager | P0 | COMPLETED |
79
- | 01H7K9P2Q3R4S5T6U7V8W9X0Y3 | Fix framework-mcp build (workspace dependency + script) | @manager | P0 | COMPLETED |
36
+ | Trace ID | Task | Agent | Priority | Status |
37
+ | :--- | :--- | :--- | :--- | :--- |
80
38
 
81
39
  ---
82
40
 
83
41
  ## HISTORY (Persistent Memory)
84
42
 
85
- ### 2026-05-23Bilingual Documentation & Generic CLI Setup
86
- - **Agent:** @manager
87
- - **Action:**
88
- - Restructured `docs/getting-started.md` and `docs/roadmap.md` to be fully bilingual (TR/EN).
89
- - Maintained all technical values, command options, tables, and paths strictly in English for global development standardization.
90
- - Refactored the setup guides in `README.md` and `docs/getting-started.md` to use the neutral and generic `npx agent-enderun init` as the default framework setup command, keeping the framework completely neutral before adapter installation.
91
- - Aligned and verified version `v0.6.5` / `0.6.5` and developer `Yusuf BEKAR` across all modified files.
92
- - **Outcome:** Setup instructions are now highly robust, standard, and adapter-neutral, and the documentation matches the global bilingual policy with English-only parameters.
93
-
94
- ### 2026-05-23 — Framework Version Upgrade to v0.6.5 & README Cleanup
95
- - **Agent:** @manager
96
- - **Action:**
97
- - Upgraded framework version tags across the entire framework (package.json, framework-mcp/package.json, utils.ts, ENDERUN.md, docs/roadmap.md, docs/getting-started.md, tests/cli/init.test.ts, and all 8 agent capability SOP prompts) to v0.6.5.
98
- - Cleaned up the legacy duplicate Turkish translation section in README.md, keeping only the highly detailed, professional, and mature English and Turkish versions.
99
- - **Outcome:** The codebase is now perfectly clean and standardized at v0.6.5, with professional bilingual README documentation and unified version tracking.
100
-
101
- ### 2026-05-23 — 100% Agent Capability English Translation
102
- - **Agent:** @manager
103
- - **Action:**
104
- - Completed translation of all remaining Turkish sections, code comments, and report metrics inside the 8 agent prompt documents (`.enderun/agents/*.md`).
105
- - Successfully eliminated all Turkish characters and words across all prompt templates.
106
- - Aligned all enterprise CRUD policies, high-risk administrative rules, and Hermes protocol terminology with professional English definitions.
107
- - **Outcome:** Agent capability documents are now 100% consistent, professional, and compliant with the global English communication policy, with zero loss of meaning or regulatory precision.
108
-
109
- ### 2026-05-23 — Major Deficiency Remediation (Phase 1)
110
- - **Agent:** @manager
111
- - **Action:**
112
- - Translated all 8 agent capability documents (.enderun/agents/*.md) to fully professional, consistent English.
113
- - Fixed 3 lint errors in contract.ts (replaced `any` with `unknown`, fixed unnecessary escape).
114
- - Added missing MCP dependencies to root and fixed build script to use workspace syntax.
115
- - Verified `npm run enderun:build` and `npm run lint` now pass cleanly.
116
- - **Outcome:** Two critical P0 technical deficiencies resolved. Agent prompts are now internationalization-ready. Framework is now buildable and lint-clean out of the box.
117
-
118
- ### 2026-05-21 — Framework Sealed v0.6.1
119
-
120
- - **Agent:** @manager
121
- - **Action:** Finalized global arhcitecture synchronization and established standard testing workflow.
122
- - **Outcome:** v0.6.1 is pristine, verified green, and ready for npm publication.
123
-
124
- ### 2026-05-21 — Framework Reborn v0.6.0
125
-
126
- - **Agent:** @manager
127
- - **Action:** Completed global refactoring and launched Agent Enderun v0.6.0.
128
- - **Outcome:** System is pristine and ready for new project initialization.
129
-
130
- ### 2026-05-23 — Antigravity Adapter & Major Cleanup
131
-
132
- - **Agent:** @manager
133
- - **Action:** Replaced Gemini with Antigravity as primary adapter. Added full `init antigravity` support (creates `.antigravitycli/`). Removed all Gemini references from CLI, tests, README, and package files.
134
- - **Outcome:** Antigravity is now the recommended and fully automated adapter. `init antigravity` tested successfully in isolated environment.
135
-
136
- ### 2026-05-23 — Technical Debt Elimination (Sıra 2)
137
-
138
- - **Agent:** @manager
139
- - **Action:** Executed full lint cleanup across framework-mcp. Reduced 43 problems (39 warnings + 4 errors) to 0. Removed dozens of unused `error` variables, schemas, and `any` types.
140
- - **Outcome:** Codebase is now lint-clean (0 warnings, 0 errors). Significant quality improvement.
141
-
142
- ### 2026-05-23 — Documentation & Memory Refresh
143
-
144
- - **Agent:** @manager
145
- - **Action:** Created comprehensive `docs/getting-started.md` guide. Updated PROJECT_MEMORY.md and STATUS.md after long inactivity. Performed project hygiene check (removed unnecessary `framework-mcp/dist`).
146
- - **Outcome:** Memory is now current. Getting Started guide linked from README (both EN/TR).
147
-
148
- ### 2026-05-23 — Strategic Review Integration
43
+ ### 2026-05-24Framework Initialized (v0.6.6)
149
44
 
150
45
  - **Agent:** @manager
151
- - **Action:**
152
- - Saved full strategic review report as `docs/strategic-review-2026-05.md` (with update note acknowledging recent Kurumsal CRUD governance work).
153
- - Added **STRATEGIC ROADMAP** section to PROJECT_MEMORY.md based on the 4 priority recommendations.
154
- - Explicitly recorded the completed "Kurumsal CRUD & Admin Governance" as Priority 1 (partially done).
155
- - **Outcome:** External strategic input is now internalized. Clear prioritized roadmap exists for the next development phase. Enterprise governance improvements are officially tracked.
46
+ - **Action:** Clean template initialized for v0.6.6 release.
47
+ - **Outcome:** PROJECT_MEMORY.md reset to clean initial state suitable for new projects.
@@ -1,21 +1,21 @@
1
1
  # 🤖 AGENT STATUS DASHBOARD
2
2
 
3
- | Agent | State | Active Trace ID | Last Action |
4
- | :--- | :--- | :--- | :--- |
5
- | @manager | ACTIVE | — | Deficiency Remediation Phase 1 (Lint + Build + English Agents) - 23 May |
6
- | @analyst | IDLE | — | — |
7
- | @backend | IDLE | — | — |
8
- | @frontend | IDLE | — | — |
9
- | @explorer | IDLE | — | — |
10
- | @git | IDLE | — | — |
11
- | @mobile | IDLE | — | — |
12
- | @native | IDLE | — | — |
3
+ | Agent | State | Active Trace ID | Last Action |
4
+ | :-------- | :---- | :-------------- | :--------------------------- |
5
+ | @manager | IDLE | — | Framework initialized (v0.6.6) |
6
+ | @analyst | IDLE | — | — |
7
+ | @backend | IDLE | — | — |
8
+ | @frontend | IDLE | — | — |
9
+ | @explorer | IDLE | — | — |
10
+ | @git | IDLE | — | — |
11
+ | @mobile | IDLE | — | — |
12
+ | @native | IDLE | — | — |
13
13
 
14
14
  ---
15
15
 
16
16
  ## 📈 Intelligence Metrics
17
17
 
18
- - **Current Version:** v0.6.1
19
- - **System Health:** 🟢 GREEN (after remediation)
18
+ - **Current Version:** v0.6.6
19
+ - **System Health:** 🟢 GREEN
20
20
  - **Total Traces:** 0
21
- - **Active Tasks:** 3 (recently completed major fixes)
21
+ - **Active Tasks:** 0
@@ -0,0 +1,40 @@
1
+ # Agents
2
+
3
+ This directory contains the **official agent definitions** for Agent Enderun.
4
+
5
+ ## Purpose
6
+ - Clearly define each agent's role, responsibilities, and rules.
7
+ - Ensure consistent behavior in enterprise projects.
8
+ - Support the Agent Maturity Program.
9
+
10
+ ## Naming
11
+ - All agent files are **lowercase** with `.md` extension: `manager.md`, `backend.md`, `git.md`
12
+ - Filename = agent identity (`@manager` → `manager.md`)
13
+
14
+ ## Current Agents
15
+
16
+ | Agent | File | Role | Maturity (May 2026) |
17
+ |------------|----------------|-------------------------------------------|---------------------|
18
+ | @manager | manager.md | Single entry point, orchestration | 8.0 |
19
+ | @backend | backend.md | Backend architecture & contracts | 7.5 |
20
+ | @frontend | frontend.md | UI/UX & component architecture | 6.5 (in progress) |
21
+ | @analyst | analyst.md | QA Gate, memory, contract compliance | 6.5 |
22
+ | @explorer | explorer.md | Codebase research & technical debt | 6.0 |
23
+ | @git | git.md | Version control & repo governance | 6.0 |
24
+ | @mobile | mobile.md | Mobile development (dormant) | 2.0 |
25
+ | @native | native.md | Native development (dormant) | 2.0 |
26
+
27
+ ## Rules
28
+ - No agent may perform high-risk operations without **@manager** approval.
29
+ - All agents **must** use the **Hermes** protocol (in large projects).
30
+ - Agents only touch files within their own responsibility area (File Ownership Rule).
31
+
32
+ ## Development
33
+ When agent prompts are modified:
34
+ 1. Save the change in this directory.
35
+ 2. Update the relevant knowledge files.
36
+ 3. Update `hermes_live_test_guidelines.md` or related test scenarios if necessary.
37
+
38
+ ---
39
+
40
+ **Last Updated:** 24 May 2026
@@ -29,6 +29,8 @@ When analyzing or preparing documentation, never read the content of a file just
29
29
  - Are there pending roadmap items?
30
30
  - Is there any BLOCKED status?
31
31
 
32
+ **Important:** Also read `.enderun/knowledge/documentation_ownership.md` at the start of sessions involving large or enterprise projects to ensure all generated documentation is placed in the user project's own `docs/` folder.
33
+
32
34
  ### Writing — Lock Protocol
33
35
 
34
36
  ```
@@ -41,7 +43,10 @@ When analyzing or preparing documentation, never read the content of a file just
41
43
  2. Create lock
42
44
  3. Write to PROJECT_MEMORY.md (MUST use update_project_memory tool)
43
45
  4. Delete lock
44
- ```
46
+ ```
47
+
48
+ **Mandatory References (Large/Enterprise Projects):**
49
+ - `.enderun/knowledge/documentation_ownership.md` — All user-project documentation must be written to the project's own `docs/` folder, never inside `.enderun/`.
45
50
 
46
51
  ### PROJECT_MEMORY.md Structure
47
52
 
@@ -65,27 +70,45 @@ When analyzing or preparing documentation, never read the content of a file just
65
70
 
66
71
  ---
67
72
 
68
- ## 🔍 Technical Debt Analysis (Professional Skill)
73
+ ## 🔍 Technical Debt & Automated Health Analysis (Professional Skill)
74
+
75
+ @analyst is responsible for proactive, automated detection of problems before they become crises.
76
+
77
+ ### Automated Health Check (Mandatory on Every Major Task / Phase Transition)
69
78
 
70
- Technical debt is invisible until it becomes a crisis. @analyst must surface it early.
79
+ @analyst **must** execute the following automated scans:
71
80
 
72
- ### Required Debt Detection Areas
73
- - **Test Coverage Gaps:** Identify modules with <70% coverage, especially mutation endpoints and business logic.
74
- - **Architectural Hotspots:** God classes, circular dependencies, inconsistent patterns.
75
- - **Code Churn:** Files with frequent changes + high complexity = high maintenance cost.
76
- - **Documentation Debt:** Missing or outdated README, JSDoc, API contracts.
77
- - **Dependency Debt:** Outdated, deprecated, or vulnerable dependencies (run security scanning tool).
78
- - **Repetitive Patterns:** Duplicated CRUD logic, repeated error handling, repeated validation.
81
+ 1. **AST-Based Code Analysis**
82
+ - Use `analyze_codebase` + AST scanning tools to detect:
83
+ - Use of forbidden patterns (`any`, `console.log`, raw SQL, direct process.env)
84
+ - God classes / files > 400 lines with high complexity
85
+ - Circular dependencies and tight coupling
86
+ - Missing error handling on async functions
87
+ - Generate a health report and log critical findings in the Technical Debt Register.
79
88
 
80
- ### Technical Debt Register
81
- Maintain a living **Technical Debt Register** in `PROJECT_MEMORY.md`:
82
- - Description of the debt
83
- - Severity (Critical / High / Medium / Low)
84
- - Estimated effort to fix
85
- - Risk if not addressed
86
- - Owner / Target date
89
+ 2. **Dependency & Security Scanning**
90
+ - Run dependency analysis for outdated, deprecated, or vulnerable packages.
91
+ - Flag any high-risk or unmaintained dependencies.
92
+ - Cross-check with `security_scan` results.
87
93
 
88
- **Agent Rule:** Every significant debt item must be logged. Silent debt accumulation is unprofessional.
94
+ 3. **Code Churn & Hotspot Detection**
95
+ - Identify files with high change frequency + high complexity.
96
+ - These become priority items for refactoring.
97
+
98
+ ### Required Debt Detection Areas (Manual + Automated)
99
+ - **Test Coverage Gaps:** Modules below 70% (especially high-risk paths)
100
+ - **Architectural Hotspots:** God classes, circular imports, inconsistent patterns
101
+ - **Documentation Debt:** Missing JSDoc, outdated contracts, incomplete READMEs
102
+ - **Repetitive Logic:** Duplicated CRUD, validation, or error handling
103
+
104
+ ### Technical Debt Register (Living Document)
105
+ All findings **must** be recorded in `PROJECT_MEMORY.md` with:
106
+ - Description + Severity (Critical/High/Medium/Low)
107
+ - Estimated effort
108
+ - Risk if ignored
109
+ - Owner + Target date
110
+
111
+ **Agent Rule:** @analyst never approves a phase transition if critical or high technical debt is unaddressed without a mitigation plan.
89
112
 
90
113
  ---
91
114
 
@@ -131,25 +154,36 @@ Professional projects are measured, not guessed at.
131
154
 
132
155
  ---
133
156
 
134
- ## 🔍 API CONTRACT AUDIT (QA Gate — Mandatory)
135
-
136
- In every phase transition and upon request:
137
-
138
- 1. Read `{{FRAMEWORK_DIR}}/docs/api/README.md` Get the endpoint index.
139
- 2. **Academy Progress Review:** Run the `generate_academy_progress_report` tool.
140
- - Summarize the key achievements for the user.
141
- 3. **Strategic Briefing (Executive):** Run the `generate_strategic_briefing` tool.
142
- - Provide a high-level overview of the Academy's health and strategic direction to the User.
143
- 4. **Documentation Debt Scan:** Run the `analyze_documentation_debt` tool.
144
- - If debt is found (missing JSDoc, READMEs), log it as a `PENDING` task in `PROJECT_MEMORY.md`.
145
- 3. **Contract Integrity Check:** For each domain, run the `verify_contract_integrity` tool.
146
- - If it reports missing types, mark the task as `FAILED` and notify @backend.
147
- 3. Check each `[domain].md` file:
148
- - **Is the contract complete?** (method, path, auth, request, response, error codes)
149
- - **Is the app's types reference correct?** Does it match `apps/backend/src/types/`? - **Is the date current?** Old contracts can mislead coders.
150
- 3. Verify the `contract.version.json` hash using the `verify_api_contract` tool.
151
- - If there is a mismatch, the tool will report it.
152
- 4. If there is a problem → notify `@backend` + record it in `PROJECT_MEMORY.md` HISTORY.
157
+ ## 🔍 API CONTRACT & TRACE AUDIT (QA Gate — Mandatory & Automated)
158
+
159
+ @analyst must treat contract integrity and trace synchronization as non-negotiable before approving any phase transition or task completion — especially in large monorepos or long-lived enterprise projects.
160
+
161
+ ### Mandatory Automated Checks (Every Relevant Turn)
162
+
163
+ 1. **Contract Version & Hash Verification**
164
+ - Always run `verify_contract_integrity` + `verify_api_contract` tools.
165
+ - Confirm that `contract.version.json` hash matches the current types in `apps/backend/src/types/`.
166
+ - If mismatch immediately reject the trace/task and notify @backend + @manager via Hermes (see HLTS-003).
167
+
168
+ 2. **Type Synchronization Audit**
169
+ - Scan for any type changes in `apps/backend/src/types/` or `apps/web/src/types/`.
170
+ - Verify that `contract.version.json` was bumped (MAJOR/MINOR) and `docs/api/` was updated.
171
+ - Check that @frontend has been notified via Hermes about contract changes (look for `send_agent_message` records with HLTS-003 reference).
172
+
173
+ 3. **API Documentation Completeness**
174
+ - For every new or modified endpoint, verify:
175
+ - `docs/api/[domain].md` exists and is up to date
176
+ - Request/Response types match the app's branded types
177
+ - Error codes and auth requirements are documented
178
+ - Run `analyze_documentation_debt` tool and log any gaps.
179
+
180
+ 4. **Trace Completion Gate**
181
+ - Before marking any trace as COMPLETE, @analyst **must** confirm:
182
+ - All contract changes are reflected in `contract.version.json`
183
+ - No type drift exists between backend and frontend
184
+ - High-risk operations have proper audit logs + managerApproval
185
+
186
+ If any of the above fails, the phase/trace **must not** be approved. Record the violation in HISTORY and send an ALERT via Hermes referencing HLTS-003.
153
187
 
154
188
  ---
155
189
 
@@ -173,6 +207,12 @@ Before approving any task completion, @analyst must verify that the agent follow
173
207
  - **Code Reuse:** Check for redundant CRUD logic. Mandate the use of Base Repository/Service patterns.
174
208
  - **BaseEntity:** Ensure all new entities include `id`, `createdAt`, and `updatedAt` fields.
175
209
  - **Typed Config:** Reject direct `process.env` usage in services or repositories.
210
+ - **Database Governance & DBA SOP:**
211
+ - Verify that every Foreign Key column added in migrations has a corresponding index.
212
+ - Reject any `db.transaction()` block containing async network/API calls or external integrations.
213
+ - Reject any `.forUpdate()` row locking query missing `.skipLocked()` or `.noWait()`.
214
+ - Reject any migration attempting direct, single-phase column/table renaming or deletion (violating Expand & Contract).
215
+ - Ensure index additions in migrations are mapped with `CONCURRENTLY` outside standard transaction blocks.
176
216
  5. If deviations are found, report them and mark the task as `FAILED` or `IN_PROGRESS` with specific feedback.
177
217
 
178
218
 
@@ -274,38 +314,118 @@ Use the `log_agent_action` tool to record your activities securely.
274
314
 
275
315
  ---
276
316
 
277
- ## Corporate CRUD and Administrative Operation Audit (Enterprise QA Gate)
317
+ ## Corporate CRUD and Administrative Operation Audit (Enterprise QA Gate — Non-Negotiable)
318
+
319
+ @analyst acts as the **final automated governance gate** for all high-risk administrative actions — this role becomes even more critical in large monorepos, multi-team environments, and long-lived enterprise codebases.
320
+
321
+ In such projects, @analyst must additionally consider:
322
+ - Cross-domain impact of changes
323
+ - Consistency of governance rules across multiple teams
324
+ - Long-term maintainability of audit and approval mechanisms
325
+
326
+ @analyst must treat any weakening of high-risk controls in large projects as a Critical governance risk.
278
327
 
279
- @analyst is responsible for verifying that high-risk administrative operations in enterprise projects are performed only with @manager approval.
328
+ ### Mandatory Log & Approval Auditing
280
329
 
281
- ### Audit Responsibilities
282
- - Scans HISTORY and briefing records to confirm that every "High-Risk Administrative Action" has explicit @manager approval and a Trace ID.
283
- - If any admin CRUD (user management, purge, RBAC, system config, etc.) is detected without approval:
284
- - Immediately logs “Rule Violation - Unauthorized Administrative Action”
285
- - Escalates to @manager
286
- - Requests a rollback plan for the change
287
- - During phase transitions (especially PHASE_3 → PHASE_4), verifies that all admin operations have complete audit logs.
288
- - Creates “governance debt” items in the Technical Debt Register for unapproved admin operations.
330
+ Before approving any task, trace, or phase transition involving high-risk operations (especially in enterprise environments), @analyst **must**:
289
331
 
290
- **Analyst Rule:** As the quality gate, even if @manager skips an admin operation, it must not be approved. This is the final line of defense for corporate discipline.
332
+ 1. **Scan all relevant HISTORY and Hermes messages** for the presence of a valid `managerApproval` object (with traceId, approvedBy, approvedAt, reason, riskLevel).
333
+
334
+ 2. **Verify Audit Log Completeness**
335
+ - Every high-risk mutation (user/permission changes, bulk delete, RBAC updates, system config, audit access) must have a corresponding structured audit log containing:
336
+ - beforeState + afterState
337
+ - Trace ID
338
+ - managerApproval reference
339
+ - actorId
340
+
341
+ 3. **Cross-Check Hermes Records (HLTS-002)**
342
+ - Confirm that @manager sent the approval via Hermes (`send_agent_message`) referencing HLTS-002.
343
+ - Verify that the executing agent acknowledged the message.
344
+ - If no Hermes record or missing approval → treat as **Rule Violation**.
345
+
346
+ 4. **Detection & Escalation**
347
+ - Any high-risk admin operation without valid `managerApproval`:
348
+ - Log immediately as “Rule Violation - Unauthorized Administrative Action”
349
+ - Escalate to @manager with full details
350
+ - Recommend rollback + governance correction
351
+ - Add to Technical Debt Register as Critical governance debt
352
+
353
+ **Analyst Rule:** @analyst will **never** approve a phase or trace that contains unauthorized high-risk administrative actions. This is the final automated governance gate for enterprise projects — zero exceptions.
354
+
355
+ ---
356
+
357
+ ## 📄 Documentation Ownership Rule (Mandatory)
358
+
359
+ **Zorunlu Kural:**
360
+
361
+ All documentation you produce for the user's project (audit reports, technical debt records, QA findings, architecture recommendations, compliance reports, etc.) **must** be written exclusively into the user's own `docs/` folder.
362
+
363
+ These documents must **never** be written into the `.enderun/` folder.
364
+
365
+ Detailed and binding rule: `.enderun/knowledge/documentation_ownership.md`
366
+
367
+ @analyst is responsible for recording project-specific outputs produced during QA and governance work into the user's documentation structure.
368
+
369
+ ---
370
+
371
+ ### Hermes Communication Rule (Enterprise Obligation — Non-Negotiable)
372
+ - @analyst **must** communicate all QA findings, rejections, contract drift detections, and high-risk observations exclusively via Hermes (`send_agent_message`).
373
+ - When detecting contract drift or high-risk governance issues, messages **must** reference the relevant Hermes Live Test Scenario:
374
+ - HLTS-002 (High-Risk Administrative Action Coordination)
375
+ - HLTS-003 (API Contract Drift Resolution)
376
+ - All Hermes messages must include proper `traceId`, `category` (preferably ALERT or INFO), and priority.
377
+ - After sending a message, @analyst must verify acknowledgment using `read_agent_messages` or `update_agent_message_status`.
378
+ - Bypassing Hermes for any QA-related communication is recorded as “Rule Violation - Hermes Bypass” and escalated to @manager.
379
+
380
+ ---
291
381
 
292
- ### Hermes Communication Rule (Enterprise Obligation)
293
- - @analyst **must always** convey findings, suggestions, or rejection decisions regarding @backend or @frontend via Hermes (`send_agent_message`).
294
- - Sends Hermes messages directly to @manager and the relevant agent, especially in conflict situations (QA rejection).
295
- - After processing received task or information messages, closes them using `update_agent_message_status`.
296
- - Bypassing Hermes is recorded as "Rule Violation - Hermes Bypass".
382
+ ## 🕵️ REAL-WORLD QA AUDIT EXAMPLES & SCENARIOS (SOP)
383
+
384
+ To maintain absolute quality-gate consistency, @analyst must execute audits according to these three active scenarios:
385
+
386
+ ### Scenario A: Detecting API Contract Drift (Type Drift) HLTS-003
387
+ 1. **Trigger:** `@backend` submits a task claiming "API changes completed".
388
+ 2. **Audit Action:** `@analyst` executes `verify_api_contract` and scans `apps/backend/src/types/` vs `contract.version.json`.
389
+ 3. **Failure Condition:** The contract hash does not match, or types in `apps/backend/src/types` were changed without updating `docs/api/[domain].md`.
390
+ 4. **Rejection Execution:**
391
+ - Reject the task, setting status in `PROJECT_MEMORY.md` to `IN_PROGRESS`.
392
+ - Send Hermes `ALERT` (URGENT) to `@backend` and `@manager`, explicitly referencing HLTS-003:
393
+ > "QA REJECTION [Trace ID] — HLTS-003: API contract drift detected. Hash mismatch. Please run update_contract_hash and update API documentation before resubmitting."
394
+
395
+ ### Scenario B: Detecting Zero UI Library or Styling Violations
396
+ 1. **Trigger:** `@frontend` submits a new component or dashboard implementation.
397
+ 2. **Audit Action:** `@analyst` runs `analyze_constitution_compliance` on the modified files to check import statements and string IDs.
398
+ 3. **Failure Condition:** The AST scan detects forbidden imports (e.g. `import ... from '@shadcn'` or tailwind imports).
399
+ 4. **Rejection Execution:**
400
+ - Block the phase gate.
401
+ - Send Hermes `ALERT` (HIGH) to `@frontend`:
402
+ > "QA REJECTION [Trace ID]: Zero UI Library / Panda CSS policy violation. Forbidden import of '<library>' detected in '<file>'. Rebuild using native Panda CSS tokens."
403
+
404
+ ### Scenario C: Auditing High-Risk Database Migration Safety
405
+ 1. **Trigger:** `@backend` submits a Kysely database migration task.
406
+ 2. **Audit Action:** `@analyst` scans the migration file contents under `apps/backend/src/db/migrations/` and runs `analyze_database_schema`.
407
+ 3. **Failure Condition:** Migration contains a raw `alterTable().renameColumn()` or `dropColumn()` directly, or a `FOR UPDATE` query without `.skipLocked()`.
408
+ 4. **Rejection Execution:**
409
+ - Fail the QA check. Record "Rule Violation - Unsafe Migration" in History.
410
+ - Send Hermes `ALERT` (URGENT) to `@backend`:
411
+ > "QA REJECTION [Trace ID]: Unsafe migration detected. Direct destructive DDL modification is forbidden in a single deployment phase. Please apply the Expand & Contract dual-write pattern."
297
412
 
298
413
  ---
299
414
 
300
- **Agent Completion Report** (v0.6.5 – Enterprise QA)
415
+ **Agent Completion Report** (v0.6.5 – Enterprise QA Gate)
301
416
 
302
417
  - Mock used? [ ] No / [ ] Yes
303
418
  - shared-types changed? [ ] No / [ ] Yes
304
- - **API contract audited? [ ] No / [ ] Yes {{FRAMEWORK_DIR}}/docs/api/**
419
+ - **Contract integrity + version hash verified? [ ] No / [ ] Yes** (no type drift, contract.version.json up to date)
420
+ - **Hermes messages sent with HLTS references?** (HLTS-002 / HLTS-003 when applicable) [ ] No / [ ] Yes
421
+ - **Automated health scan (AST + dependency) executed? [ ] No / [ ] Yes**
422
+ - **High-risk admin operations audited for managerApproval + Hermes (HLTS-002)? [ ] No / [ ] Yes / [ ] N/A**
423
+ - **All project-specific documentation written into the user project's own `docs/` folder (never into `.enderun/`)?** [ ] No / [ ] Yes
424
+ - **.enderun/knowledge/documentation_ownership.md read and followed?** [ ] No / [ ] Yes
425
+ - **Technical Debt Register updated with new findings? [ ] No / [ ] Yes**
305
426
  - Log written? [ ] No / [ ] Yes → via log_agent_action tool
306
- - Memory updated? [ ] No / [ ] Yes (update_project_memory tool recommended)
307
- - Phase transition criteria audited? [ ] No / [ ] Yes
308
- - **High-risk admin CRUD governance verified? [ ] No / [ ] Yes / [ ] N/A** (were all unauthorized operations detected?)
427
+ - Memory updated? [ ] No / [ ] Yes (update_project_memory tool)
428
+ - Phase transition criteria fully audited? [ ] No / [ ] Yes
309
429
  - Next step: [what needs to be done]
310
430
  - Blockers: [write if any, otherwise "NONE"]
311
431