agent-enderun 1.0.4 β†’ 1.0.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 (43) hide show
  1. package/.enderun/ENDERUN.md +15 -8
  2. package/.enderun/agents/analyst.md +6 -0
  3. package/.enderun/agents/backend.md +6 -0
  4. package/.enderun/agents/database.md +6 -0
  5. package/.enderun/agents/devops.md +6 -0
  6. package/.enderun/agents/explorer.md +6 -0
  7. package/.enderun/agents/frontend.md +6 -0
  8. package/.enderun/agents/git.md +6 -0
  9. package/.enderun/agents/manager.md +14 -13
  10. package/.enderun/agents/mobile.md +6 -0
  11. package/.enderun/agents/native.md +6 -0
  12. package/.enderun/agents/quality.md +6 -0
  13. package/.enderun/agents/security.md +6 -0
  14. package/.enderun/cli-commands.json +8 -6
  15. package/.enderun/knowledge/evaluation_engine.md +15 -0
  16. package/.enderun/knowledge/router_logic.md +29 -0
  17. package/.enderun/logs/manager.json +34 -6
  18. package/.enderun/memory/BUSINESS_CONTEXT.md +17 -0
  19. package/.enderun/memory/DECISIONS.md +24 -0
  20. package/.enderun/memory/LESSONS_LEARNED.md +12 -0
  21. package/.enderun/memory/PATTERNS.md +17 -0
  22. package/.enderun/memory/PROJECT_MEMORY.md +34 -0
  23. package/.enderun/observability/AUDIT_LOG.md +9 -0
  24. package/.enderun/observability/METRICS.md +10 -0
  25. package/.enderun/observability/TRACE_LOG.md +10 -0
  26. package/.enderun/registry/agents.yaml +69 -0
  27. package/GEMINI.md +20 -0
  28. package/GROK.md +20 -0
  29. package/README.md +49 -8
  30. package/bin/validate-agent-army.js +111 -36
  31. package/docs/getting-started.md +9 -0
  32. package/framework-mcp/package.json +1 -1
  33. package/package.json +2 -2
  34. package/src/cli/adapters.ts +22 -3
  35. package/src/cli/commands/check.ts +25 -5
  36. package/src/cli/commands/init.ts +211 -114
  37. package/src/cli/commands/orchestrate.ts +16 -4
  38. package/src/cli/index.ts +19 -7
  39. package/src/cli/utils/memory.ts +10 -2
  40. package/.enderun/PROJECT_MEMORY.md +0 -23
  41. package/claude.md +0 -25
  42. package/gemini.md +0 -31
  43. package/grok.md +0 -25
@@ -70,6 +70,10 @@ function buildDirsToCreate(adapter: AdapterConfig): string[] {
70
70
  dirs.push(`${adapter.frameworkDir}/${nested}`);
71
71
  }
72
72
  }
73
+ // Add logic for shimFile directory if it's nested (like .cursor/rules/)
74
+ if (adapter.shimFile.includes("/")) {
75
+ dirs.push(path.dirname(adapter.shimFile));
76
+ }
73
77
  return [...new Set(dirs)];
74
78
  }
75
79
 
@@ -262,7 +266,7 @@ export async function initCommand(adapterInput?: string, dryRun = false) {
262
266
 
263
267
  updateGitIgnore(path.join(targetDir, ".gitignore"), frameworkDir, dryRun);
264
268
 
265
- const finalMemoryPath = path.join(targetFrameworkDir, "PROJECT_MEMORY.md");
269
+ const finalMemoryPath = path.join(targetFrameworkDir, "memory/PROJECT_MEMORY.md");
266
270
  initializeMemory(finalMemoryPath, frameworkDir, dryRun);
267
271
 
268
272
  if (!dryRun) {
@@ -287,6 +291,45 @@ describe("Initial Setup", () => {
287
291
  );
288
292
  }
289
293
 
294
+ const cursorRulesPath = path.join(targetDir, ".cursorrules");
295
+ if (!fs.existsSync(cursorRulesPath)) {
296
+ writeTextFile(
297
+ cursorRulesPath,
298
+ `# Agent Enderun β€” Cursor IDE Rules
299
+
300
+ This is the primary entry point when using Agent Enderun within the Cursor IDE (Chat & Composer).
301
+
302
+ The framework operates under a unified governance structure located in the ${frameworkDir}/ directory.
303
+
304
+ ### Primary Constitution
305
+ All governance rules, agent checklists, and project memory live here:
306
+
307
+ πŸ‘‰ **[${frameworkDir}/ENDERUN.md](${frameworkDir}/ENDERUN.md)**
308
+
309
+ ### πŸ€– Agent Directive
310
+ You are operating under the Agent Enderun governance framework.
311
+
312
+ At the **start of every session**, before any work:
313
+ 1. **Restore Memory:** Read ${frameworkDir}/PROJECT_MEMORY.md to restore state, active Trace ID, and history.
314
+ 2. **Load Identity:** Read the relevant agent definition under ${frameworkDir}/agents/{agent}.md (default to @manager).
315
+ 3. **Internalize Knowledge:** Reference the ${frameworkDir}/knowledge/ base for architectural and coding standards.
316
+
317
+ ### πŸ’Ύ Memory Tiers
318
+ - **Project Memory (Shared):** ${frameworkDir}/PROJECT_MEMORY.md is the source of truth for task history, Trace IDs, and architectural decisions. **Update this at the end of every turn.**
319
+ - **Private Memory (User-Specific):** Use the local .gitignored memory directory (e.g. ${frameworkDir}/memory/) for personal workflows or user-specific notes that should not be committed to Git. Never use the system's /tmp directory.
320
+ - **Project Instructions:** This .cursorrules file contains the "Supreme Law" and coding standards.
321
+
322
+ ### πŸ›‘οΈ Core Mandates
323
+ - **Surgical Edits:** Use replace_text or patch_file via MCP for precise changes.
324
+ - **Traceability:** Every action must inherit the active Trace ID from memory.
325
+ - **Contract First:** No implementation without verified types.
326
+ - **NEVER FORGET:** @manager MUST update ${frameworkDir}/PROJECT_MEMORY.md at the end of EVERY session without exception. This is a non-negotiable process integrity rule.
327
+
328
+ All paths and references inside the project must comply with the Supreme Constitution located at ${frameworkDir}/ENDERUN.md`.trim() + "\n",
329
+ dryRun,
330
+ );
331
+ }
332
+
290
333
  if (!fs.existsSync(path.join(targetDir, ".git"))) {
291
334
  try {
292
335
  if (dryRun) {
@@ -308,131 +351,175 @@ describe("Initial Setup", () => {
308
351
  }
309
352
 
310
353
  // Always scaffold Antigravity (.agents/) workspace directory for cross-compatibility with agy CLI
311
- if (adapter.id === "antigravity" || adapter.id === "antigravity-cli") {
354
+ if (adapter.id === "antigravity" || adapter.id === "antigravity-cli" || adapter.id === "gemini") {
312
355
  const agentsFrameworkDir = path.join(targetDir, ".agents");
313
356
  if (!dryRun) {
314
357
  try {
315
358
  fs.mkdirSync(agentsFrameworkDir, { recursive: true });
316
359
  const agentsSubdir = path.join(agentsFrameworkDir, "agents");
317
360
  fs.mkdirSync(agentsSubdir, { recursive: true });
318
-
319
- // Write the 12 agent folders and agent.json files
320
- const allAgents = [
321
- {
322
- name: "manager",
323
- displayName: "Orchestration & Governance (Team-Lead)",
324
- description: "CTO, Lead Architect, and Orchestrator for Agent Enderun.",
325
- instructions: "You are the manager agent. Orchestrate workspace tasks, manage DAG dependency graphs, handle phase transitions, and enforce architectural standards.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Single Point of Authority: You are the sole entry point. No specialist acts without your briefing.\n- Traceability: Every action MUST inherit the active Trace ID.\n- Memory Discipline: MUST update PROJECT_MEMORY.md and log actions at the end of EVERY turn."
326
- },
327
- {
328
- name: "backend",
329
- displayName: "Domain Logic & Databases Specialist",
330
- description: "Responsible for core business logic, database migrations, security standards, API contracts, and server architecture.",
331
- instructions: "You are the backend agent. Build secure, high-performance, and consistent server architecture.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- No UI: Never implement UI or frontend logic.\n- Contract-First: Define shared contracts/branded types BEFORE any consumer code.\n- Branded Types Law: ALL IDs must use branded types (e.g., UserID). Plain strings are forbidden.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Surgical Edits: Use replace_text for all code changes."
332
- },
333
- {
334
- name: "frontend",
335
- displayName: "Fluid Responsive UI Specialist",
336
- description: "Builds responsive fluid user interfaces, manages styling tokens with Panda CSS, and implements state machines.",
337
- instructions: "You are the frontend agent. Build original, high-performance, and responsive user interfaces.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Responsive-First: Mobile-First (320px) is mandatory. Fixed-width is forbidden.\n- Zero UI Library Policy: No shadcn/ui, MUI, etc. Build everything with Panda CSS.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Contract-First: Use branded types from apps/backend/src/types.\n- No Native Alerts: Use integrated Toaster/Modal components."
338
- },
339
- {
340
- name: "quality",
341
- displayName: "Automated Testing & Quality Specialist",
342
- description: "Verifies test coverage, audits compliance with the constitution, conducts AST scanning, and verifies CI/CD status.",
343
- instructions: "You are the quality agent. Ensure no code is merged or deployed without meeting standards.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Final Gate: No code merges or deploys proceed without quality sign-off.\n- Verification-First: Audit lint, typecheck, contract drift, and branded types before sign-off.\n- Never Implement: Audit and assess only. Never write application features.\n- Zero Mock Policy: Integration tests must use real/service-compatible backends.\n- Coverage Gate: Reject approvals if coverage falls below >80% threshold in core."
344
- },
345
- {
346
- name: "database",
347
- displayName: "Database Migrations & Tuning Specialist",
348
- description: "Designs SQL schemas, manages migration scripts via Kysely, optimizes queries, indexes, and seeding logic.",
349
- instructions: "You are the database agent. Build secure, optimized, and scalable data layers.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Self-Contained DB: Every backend application MUST manage its own schema/migrations/seeds in its own src/database/ directory.\n- Contract-First: All schemas MUST be derived from branded types.\n- Kysely Standard: Use Kysely for application queries. Raw SQL is forbidden.\n- Zero Mock Policy: Realistic, contract-aware seed data only.\n- Surgical Edits: Use replace_text for all schema/migration changes."
350
- },
351
- {
352
- name: "devops",
353
- displayName: "Infrastructure & CI/CD Specialist",
354
- description: "Handles deployment pipelines, environment variables, system containerization, logging & telemetry integrations.",
355
- instructions: "You are the devops agent. Ensure reliable execution in every environment with strict quality gates.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Gate Approvals: NEVER deploy to production without quality gate approval.\n- No Docker Policy: Prefer native Node.js unless explicitly overridden by manager.\n- Environment Parity: Identical configs across dev/staging/prod (except secrets).\n- Secrets Security: NEVER hardcode secrets. Use environment variables.\n- Rollback First: Deployment is BLOCKED if no documented rollback plan exists."
356
- },
357
- {
358
- name: "explorer",
359
- displayName: "Codebase Discovery Specialist",
360
- description: "Maps code dependencies, performs project scans, identifies architectural gaps, and supports legacy onboarding.",
361
- instructions: "You are the explorer agent. Map project structure and provide deep context to other agents.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Read-Only: Never write production code. Only discover, map, and report.\n- Search-First: Always use search_codebase before reading large files.\n- Surgical Discovery: Focus on entry points and core domain logic.\n- Zero Mock Policy: Analyze real system state only.\n- Traceability: All findings must be linked to a Trace ID."
362
- },
363
- {
364
- name: "git",
365
- displayName: "Version Control Specialist",
366
- description: "Manages commit histories, branches, Trace ID alignment, semantic tagging, and merge conflicts.",
367
- instructions: "You are the git agent. Ensure a clean, atomic, and traceable repository history.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Trace ID Tagging: EVERY commit must include the active Trace ID in the message.\n- Atomic Integrity: Every commit must represent exactly one logical change.\n- Health-First: Never commit code that fails build or basic tests.\n- No Push: Do not run git push without explicit USER approval.\n- No Force: Never use git push --force on public branches."
368
- },
369
- {
370
- name: "mobile",
371
- displayName: "Mobile App Specialist",
372
- description: "Develops cross-platform mobile apps using React Native and Expo with clean component states.",
373
- instructions: "You are the mobile agent. Build high-performance, responsive mobile apps (React Native/Expo).\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Zero UI Library: Same discipline as web. Build UI from scratch.\n- Contract-First: Use shared types from apps/backend/src/types.\n- Responsive-First: Mobile-First approach is mandatory.\n- Safe Area: Handle iOS/Android safe area insets on every screen.\n- Performance: Target 60 FPS."
374
- },
375
- {
376
- name: "native",
377
- displayName: "Native OS Integration Specialist",
378
- description: "Builds lightweight desktop wrappers and system integrations using Tauri or Electron.",
379
- instructions: "You are the native agent. Build secure, efficient desktop apps (Tauri/Electron).\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Security-First: No remote code execution. Mandatory sandboxing and strict CSP.\n- Secure Storage: Use Keychain/Credential Manager for sensitive data.\n- IPC Contract: All communication between frontend and native MUST be typed.\n- Contract-First: Define IPC and data contracts before implementation.\n- Surgical Edits: Use replace_text for all code changes."
380
- },
381
- {
382
- name: "security",
383
- displayName: "Security & Cryptography Specialist",
384
- description: "Enforces authentication flows, CSP policies, credential rotation, RLS constraints, and cryptographic safety.",
385
- instructions: "You are the security agent. Ensure all endpoints, database connections, and authentication flows satisfy strict enterprise compliance policies.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Sandboxed Security First: Enforce Row Level Security (RLS) on all database tables.\n- Credential Rotation Policy: Credentials, keys, and tokens must never be hardcoded. Use vault/env variables.\n- CSP & CORS Strictness: Never open wildcards (*) for CORS or CSP policies.\n- Surgical Edits: Use replace_text for all security patches."
386
- },
387
- {
388
- name: "analyst",
389
- displayName: "Contract Verification & Business Analyst",
390
- description: "Validates business specifications, tests database contract integrity, and audits constitutional compliance.",
391
- instructions: "You are the analyst agent. Independently verify compliance with contracts and specifications between frontend, backend, and the constitution.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Independent Stance: Act as an objective verification gate.\n- Contract-First Law: Ensure contract.version.json perfectly matches types.\n- Escalation Priority: Report all contract drift to manager immediately.\n- Surgical Edits: Use replace_text for all document updates."
392
- }
393
- ];
394
361
 
395
- for (const ag of allAgents) {
396
- const agentDir = path.join(agentsSubdir, ag.name);
397
- fs.mkdirSync(agentDir, { recursive: true });
398
-
399
- const payload = {
400
- name: ag.name,
401
- displayName: ag.displayName,
402
- description: ag.description,
403
- hidden: false,
404
- customAgentSpec: {
405
- customAgent: {
406
- systemPromptSections: [
407
- {
408
- title: "Instructions",
409
- content: ag.instructions
410
- }
411
- ],
412
- toolNames: [
413
- "view_file",
414
- "replace_file_content",
415
- "write_to_file",
416
- "run_command",
417
- "grep_search",
418
- "list_dir"
419
- ]
362
+ // Create other standard Antigravity directories for custom workspace customizations
363
+ fs.mkdirSync(path.join(agentsFrameworkDir, "skills"), { recursive: true });
364
+ fs.mkdirSync(path.join(agentsFrameworkDir, "rules"), { recursive: true });
365
+ fs.mkdirSync(path.join(agentsFrameworkDir, "workflows"), { recursive: true });
366
+
367
+ // Write workspace-specific MCP config
368
+ const mcpBlock = {
369
+ mcpServers: {
370
+ "agent-enderun": {
371
+ command: "node",
372
+ args: [path.join(targetDir, "framework-mcp/dist/index.js")],
373
+ env: {
374
+ "ENDERUN_PROJECT_ROOT": targetDir
375
+ }
420
376
  }
421
377
  }
422
378
  };
423
-
424
379
  fs.writeFileSync(
425
- path.join(agentDir, "agent.json"),
426
- JSON.stringify(payload, null, 2),
380
+ path.join(agentsFrameworkDir, "mcp_config.json"),
381
+ JSON.stringify(mcpBlock, null, 2),
427
382
  "utf8"
428
383
  );
429
- }
430
- console.warn(`βœ… Scaffolding ${allAgents.length} Antigravity agents under .agents/agents/...`);
431
- } catch (e) {
384
+
385
+ // Write AGENTS.md at the project root for prepended global rules
386
+ const agentsMdPath = path.join(targetDir, "AGENTS.md");
387
+ if (!fs.existsSync(agentsMdPath)) {
388
+ fs.writeFileSync(
389
+ agentsMdPath,
390
+ `# Agent Enderun Workspace Instructions
391
+
392
+ You are operating under the Agent Enderun AI governance and orchestration framework.
393
+
394
+ ### πŸ›‘οΈ Critical Guidelines
395
+ 1. **Traceability First:** Every action or execution MUST inherit the active Trace ID from \`${frameworkDir}/PROJECT_MEMORY.md\`.
396
+ 2. **Surgical Operations:** Use precise file replacements or patches. NEVER rewrite entire source files unnecessarily.
397
+ 3. **Contract-First Design:** Backend models and type contracts must be locked and verified before frontend components are created.
398
+ 4. **Memory Synchronization:** All agent runs must update the project memory logs before concluding the session.
399
+
400
+ All rules and constraints defined in \`${frameworkDir}/ENDERUN.md\` are strictly binding.
401
+ `.trim() + "\n",
402
+ "utf8"
403
+ );
404
+ }
405
+
406
+ // Write the 12 agent folders and agent.json files
407
+ const allAgents = [
408
+ {
409
+ name: "manager",
410
+ displayName: "Orchestration & Governance (Team-Lead)",
411
+ description: "CTO, Lead Architect, and Orchestrator for Agent Enderun.",
412
+ instructions: "You are the manager agent. Orchestrate workspace tasks, manage DAG dependency graphs, handle phase transitions, and enforce architectural standards.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Single Point of Authority: You are the sole entry point. No specialist acts without your briefing.\n- Traceability: Every action MUST inherit the active Trace ID.\n- Memory Discipline: MUST update PROJECT_MEMORY.md and log actions at the end of EVERY turn."
413
+ },
414
+ {
415
+ name: "backend",
416
+ displayName: "Domain Logic & Databases Specialist",
417
+ description: "Responsible for core business logic, database migrations, security standards, API contracts, and server architecture.",
418
+ instructions: "You are the backend agent. Build secure, high-performance, and consistent server architecture.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- No UI: Never implement UI or frontend logic.\n- Contract-First: Define shared contracts/branded types BEFORE any consumer code.\n- Branded Types Law: ALL IDs must use branded types (e.g., UserID). Plain strings are forbidden.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Surgical Edits: Use replace_text for all code changes."
419
+ },
420
+ {
421
+ name: "frontend",
422
+ displayName: "Fluid Responsive UI Specialist",
423
+ description: "Builds responsive fluid user interfaces, manages styling tokens with Panda CSS, and implements state machines.",
424
+ instructions: "You are the frontend agent. Build original, high-performance, and responsive user interfaces.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Responsive-First: Mobile-First (320px) is mandatory. Fixed-width is forbidden.\n- Zero UI Library Policy: No shadcn/ui, MUI, etc. Build everything with Panda CSS.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Contract-First: Use branded types from apps/backend/src/types.\n- No Native Alerts: Use integrated Toaster/Modal components."
425
+ },
426
+ {
427
+ name: "quality",
428
+ displayName: "Automated Testing & Quality Specialist",
429
+ description: "Verifies test coverage, audits compliance with the constitution, conducts AST scanning, and verifies CI/CD status.",
430
+ instructions: "You are the quality agent. Ensure no code is merged or deployed without meeting standards.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Final Gate: No code merges or deploys proceed without quality sign-off.\n- Verification-First: Audit lint, typecheck, contract drift, and branded types before sign-off.\n- Never Implement: Audit and assess only. Never write application features.\n- Zero Mock Policy: Integration tests must use real/service-compatible backends.\n- Coverage Gate: Reject approvals if coverage falls below >80% threshold in core."
431
+ },
432
+ {
433
+ name: "database",
434
+ displayName: "Database Migrations & Tuning Specialist",
435
+ description: "Designs SQL schemas, manages migration scripts via Kysely, optimizes queries, indexes, and seeding logic.",
436
+ instructions: "You are the database agent. Build secure, optimized, and scalable data layers.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Self-Contained DB: Every backend application MUST manage its own schema/migrations/seeds in its own src/database/ directory.\n- Contract-First: All schemas MUST be derived from branded types.\n- Kysely Standard: Use Kysely for application queries. Raw SQL is forbidden.\n- Zero Mock Policy: Realistic, contract-aware seed data only.\n- Surgical Edits: Use replace_text for all schema/migration changes."
437
+ },
438
+ {
439
+ name: "devops",
440
+ displayName: "Infrastructure & CI/CD Specialist",
441
+ description: "Handles deployment pipelines, environment variables, system containerization, logging & telemetry integrations.",
442
+ instructions: "You are the devops agent. Ensure reliable execution in every environment with strict quality gates.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Gate Approvals: NEVER deploy to production without quality gate approval.\n- No Docker Policy: Prefer native Node.js unless explicitly overridden by manager.\n- Environment Parity: Identical configs across dev/staging/prod (except secrets).\n- Secrets Security: NEVER hardcode secrets. Use environment variables.\n- Rollback First: Deployment is BLOCKED if no documented rollback plan exists."
443
+ },
444
+ {
445
+ name: "explorer",
446
+ displayName: "Codebase Discovery Specialist",
447
+ description: "Maps code dependencies, performs project scans, identifies architectural gaps, and supports legacy onboarding.",
448
+ instructions: "You are the explorer agent. Map project structure and provide deep context to other agents.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Read-Only: Never write production code. Only discover, map, and report.\n- Search-First: Always use search_codebase before reading large files.\n- Surgical Discovery: Focus on entry points and core domain logic.\n- Zero Mock Policy: Analyze real system state only.\n- Traceability: All findings must be linked to a Trace ID."
449
+ },
450
+ {
451
+ name: "git",
452
+ displayName: "Version Control Specialist",
453
+ description: "Manages commit histories, branches, Trace ID alignment, semantic tagging, and merge conflicts.",
454
+ instructions: "You are the git agent. Ensure a clean, atomic, and traceable repository history.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Trace ID Tagging: EVERY commit must include the active Trace ID in the message.\n- Atomic Integrity: Every commit must represent exactly one logical change.\n- Health-First: Never commit code that fails build or basic tests.\n- No Push: Do not run git push without explicit USER approval.\n- No Force: Never use git push --force on public branches."
455
+ },
456
+ {
457
+ name: "mobile",
458
+ displayName: "Mobile App Specialist",
459
+ description: "Develops cross-platform mobile apps using React Native and Expo with clean component states.",
460
+ instructions: "You are the mobile agent. Build high-performance, responsive mobile apps (React Native/Expo).\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Zero UI Library: Same discipline as web. Build UI from scratch.\n- Contract-First: Use shared types from apps/backend/src/types.\n- Responsive-First: Mobile-First approach is mandatory.\n- Safe Area: Handle iOS/Android safe area insets on every screen.\n- Performance: Target 60 FPS."
461
+ },
462
+ {
463
+ name: "native",
464
+ displayName: "Native OS Integration Specialist",
465
+ description: "Builds lightweight desktop wrappers and system integrations using Tauri or Electron.",
466
+ instructions: "You are the native agent. Build secure, efficient desktop apps (Tauri/Electron).\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Security-First: No remote code execution. Mandatory sandboxing and strict CSP.\n- Secure Storage: Use Keychain/Credential Manager for sensitive data.\n- IPC Contract: All communication between frontend and native MUST be typed.\n- Contract-First: Define IPC and data contracts before implementation.\n- Surgical Edits: Use replace_text for all code changes."
467
+ },
468
+ {
469
+ name: "security",
470
+ displayName: "Security & Cryptography Specialist",
471
+ description: "Enforces authentication flows, CSP policies, credential rotation, RLS constraints, and cryptographic safety.",
472
+ instructions: "You are the security agent. Ensure all endpoints, database connections, and authentication flows satisfy strict enterprise compliance policies.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Sandboxed Security First: Enforce Row Level Security (RLS) on all database tables.\n- Credential Rotation Policy: Credentials, keys, and tokens must never be hardcoded. Use vault/env variables.\n- CSP & CORS Strictness: Never open wildcards (*) for CORS or CSP policies.\n- Surgical Edits: Use replace_text for all security patches."
473
+ },
474
+ {
475
+ name: "analyst",
476
+ displayName: "Contract Verification & Business Analyst",
477
+ description: "Validates business specifications, tests database contract integrity, and audits constitutional compliance.",
478
+ instructions: "You are the analyst agent. Independently verify compliance with contracts and specifications between frontend, backend, and the constitution.\n\nπŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Independent Stance: Act as an objective verification gate.\n- Contract-First Law: Ensure contract.version.json perfectly matches types.\n- Escalation Priority: Report all contract drift to manager immediately.\n- Surgical Edits: Use replace_text for all document updates."
479
+ }
480
+ ];
481
+
482
+ for (const ag of allAgents) {
483
+ const agentDir = path.join(agentsSubdir, ag.name);
484
+ fs.mkdirSync(agentDir, { recursive: true });
485
+
486
+ const payload = {
487
+ name: ag.name,
488
+ displayName: ag.displayName,
489
+ description: ag.description,
490
+ hidden: false,
491
+ customAgentSpec: {
492
+ customAgent: {
493
+ systemPromptSections: [
494
+ {
495
+ title: "Instructions",
496
+ content: ag.instructions
497
+ }
498
+ ],
499
+ toolNames: [
500
+ "view_file",
501
+ "replace_file_content",
502
+ "write_to_file",
503
+ "run_command",
504
+ "grep_search",
505
+ "list_dir"
506
+ ]
507
+ }
508
+ }
509
+ };
510
+
511
+ fs.writeFileSync(
512
+ path.join(agentDir, "agent.json"),
513
+ JSON.stringify(payload, null, 2),
514
+ "utf8"
515
+ );
516
+ }
517
+ console.warn(`βœ… Scaffolding ${allAgents.length} Antigravity agents under .agents/agents/...`);
518
+ } catch {
432
519
  // fallback
520
+ }
433
521
  }
434
522
  }
435
- }
436
523
 
437
524
  console.warn(`\nβ™Š ${adapter.id.toUpperCase()}: Setup complete.`);
438
525
  console.warn(` β€’ Framework runtime: ${frameworkDir}/`);
@@ -446,6 +533,8 @@ describe("Initial Setup", () => {
446
533
  const buildCmd = pkgMgr === "npm" ? "npm run enderun:build" : `${pkgMgr} run enderun:build`;
447
534
 
448
535
  console.warn(`\n✨ Framework scaffolded! (v${FRAMEWORK_VERSION})`);
536
+ console.warn("\nπŸ›‘οΈ AL (Agent Lifecycle) Note: Your init is now configured for full army compliance.");
537
+ console.warn(" Run `agent-enderun check` (or the validate script) to confirm all agents have proper stateMachine + tags.");
449
538
 
450
539
  if (dryRun || process.env.ENDERUN_SKIP_INSTALL === "1") {
451
540
  console.warn(`\n⏭️ Skipping install steps (${dryRun ? "Dry-Run" : "ENDERUN_SKIP_INSTALL=1"}).`);
@@ -453,11 +542,19 @@ describe("Initial Setup", () => {
453
542
  }
454
543
 
455
544
  try {
456
- execSync(installCmd, { stdio: "inherit" });
457
- console.warn(`\nπŸ—οΈ Step 2/3: Running '${buildCmd}'...`);
458
- execSync(buildCmd, { stdio: "inherit" });
459
- console.warn("\nπŸ” Step 3/3: Running 'agent-enderun check'...");
545
+ console.warn("\nπŸ” Step 3/3: Running 'agent-enderun check' (includes AL validation)...");
460
546
  checkCommand();
547
+
548
+ // Automatic dedicated AL (Agent Lifecycle) check after init
549
+ console.warn("\nπŸ›‘οΈ Automatic post-init AL Army Validation (validate-agent-army)...");
550
+ try {
551
+ execSync("node bin/validate-agent-army.js", { stdio: "inherit" });
552
+ console.warn("βœ… Automatic AL validation PASSED - all agents are lifecycle compliant (stateMachine + tags)!");
553
+ } catch (alErr) {
554
+ console.warn("⚠️ Automatic AL validation reported issues (see above in check output).");
555
+ console.warn(" You can re-run manually: node bin/validate-agent-army.js or agent-enderun check");
556
+ }
557
+
461
558
  console.warn("\nπŸš€ Agent Enderun is fully installed and verified!");
462
559
  } catch (e: unknown) {
463
560
  const message = e instanceof Error ? e.message : String(e);
@@ -51,23 +51,35 @@ export async function orchestrateCommand() {
51
51
  console.log(`πŸ“‘ ${pendingMessages.length} adet bekleyen gΓΆrev bulundu. İşleniyor...\n`);
52
52
 
53
53
  for (const msg of pendingMessages) {
54
- const { to, content, traceId } = msg;
54
+ const { to, content, traceId, category } = msg;
55
55
 
56
56
  console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
57
57
  console.log(`πŸ”Ή HEDEF: ${to}`);
58
58
  console.log(`πŸ”Ή TRACE: ${traceId}`);
59
+ console.log(`πŸ”Ή KATEGORΔ°: ${category}`);
59
60
  console.log(`πŸ”Ή GΓ–REV: ${content}`);
60
61
 
61
62
  // Determine agent folder based on adapter (detection or default)
62
63
  let agentFolder = "agents";
63
- if (frameworkDir === ".agent") {
64
+ if (frameworkDir === ".agents") {
64
65
  agentFolder = "skills";
65
66
  } else if (frameworkDir === ".grok") {
66
67
  agentFolder = "plugins";
67
68
  }
68
69
 
69
- // 1. Transition the target agent state to EXECUTING in STATUS.md
70
- transitionAgentState(to, "EXECUTING", content);
70
+ // Determine target state based on category
71
+ let targetState = "EXECUTING";
72
+ if (category === "DELEGATION") targetState = "BRIEFED";
73
+ if (category === "ALERT" || category === "FAILED") targetState = "BLOCKED";
74
+
75
+ // 1. Transition the target agent state in STATUS.md
76
+ transitionAgentState(to, targetState, content);
77
+
78
+ if (targetState === "BRIEFED") {
79
+ console.log(`\nπŸ“ ${to} agent'Δ± bilgilendirildi (BRIEFED). HazΔ±rlΔ±k bekleniyor...`);
80
+ // Auto-transition to EXECUTING for CLI flow if no blockers
81
+ transitionAgentState(to, "EXECUTING", content);
82
+ }
71
83
 
72
84
  console.log("\nπŸ€– GΓΆrev Devredildi!");
73
85
  console.log(`πŸ‘‰ LΓΌtfen ${to} agent talimatlarΔ±nΔ± (${frameworkDir}/${agentFolder}/${to.replace("@", "")}.md) okuyun ve gΓΆrevi yerine getirin.`);
package/src/cli/index.ts CHANGED
@@ -57,16 +57,27 @@ async function main() {
57
57
  break;
58
58
 
59
59
  case "orchestrate":
60
- case "loop":
61
- orchestrateCommand();
60
+ case "update-contract":
61
+ updateApiContractCommand();
62
62
  break;
63
63
 
64
- case "verify-contract":
65
- verifyApiContractCommand();
64
+ case "validate":
65
+ case "validate-army":
66
+ case "check:al": {
67
+ // Dedicated AL (Agent Lifecycle) army validation - can be run independently after init
68
+ const { execSync } = await import("child_process");
69
+ try {
70
+ execSync("node bin/validate-agent-army.js", { stdio: "inherit" });
71
+ } catch (e) {
72
+ // validation script itself handles exit codes and messaging
73
+ }
66
74
  break;
75
+ }
67
76
 
68
- case "update-contract":
69
- updateApiContractCommand();
77
+ case "version":
78
+ case "-v":
79
+ case "--version":
80
+ console.log(`v${getPackageVersion()}`);
70
81
  break;
71
82
 
72
83
  case "version":
@@ -87,7 +98,8 @@ Usage:
87
98
 
88
99
  Commands:
89
100
  init [adapter] Initialize Agent Enderun framework (gemini, claude, grok, etc.)
90
- check Perform an enterprise-grade system health check
101
+ check Perform an enterprise-grade system health check (includes automatic AL validation)
102
+ validate Run dedicated Agent Lifecycle (AL) army validation (validate-agent-army)
91
103
  status Show active phase, trace ID, and agent statuses
92
104
  trace:new <desc> Start a new task chain with a unique Trace ID
93
105
  create-app <idea> Generate a new full-stack app from natural language
@@ -27,10 +27,15 @@ export function getFrameworkDir(): string {
27
27
  for (const dir of FRAMEWORK_DIR_CANDIDATES) {
28
28
  const dirPath = path.join(targetDir, dir);
29
29
  if (!fs.existsSync(dirPath)) continue;
30
- const hasMemory = fs.existsSync(path.join(dirPath, "PROJECT_MEMORY.md"));
30
+
31
+ // Support both legacy flat memory and current memory/ subdir layout (AL/cross-adapter fix)
32
+ const hasMemory = fs.existsSync(path.join(dirPath, "PROJECT_MEMORY.md")) ||
33
+ fs.existsSync(path.join(dirPath, "memory", "PROJECT_MEMORY.md"));
34
+
31
35
  const hasAgents = fs.existsSync(path.join(dirPath, "agents")) ||
32
36
  fs.existsSync(path.join(dirPath, "skills")) ||
33
37
  fs.existsSync(path.join(dirPath, "plugins"));
38
+
34
39
  if (hasMemory || hasAgents) {
35
40
  return dir;
36
41
  }
@@ -44,7 +49,10 @@ export function getFrameworkDir(): string {
44
49
  }
45
50
 
46
51
  export function getMemoryPath() {
47
- return path.join(targetDir, getFrameworkDir(), "PROJECT_MEMORY.md");
52
+ const frameworkDir = getFrameworkDir();
53
+ const subPath = path.join(targetDir, frameworkDir, "memory/PROJECT_MEMORY.md");
54
+ if (fs.existsSync(subPath)) return subPath;
55
+ return path.join(targetDir, frameworkDir, "PROJECT_MEMORY.md");
48
56
  }
49
57
 
50
58
  export function getConfiguredPaths(): { backend: string; frontend: string; docs: string; tests: string } {
@@ -1,23 +0,0 @@
1
- ## CURRENT STATUS
2
-
3
- - Phase: PHASE_0 (Genesis)
4
- - Trace ID: 01HGT8J5E2N0W0W0W0W0W0W0W5
5
- - @manager state: ENTERPRISE_FULL_PROFILE_ACTIVE
6
-
7
- ## ACTIVE TASKS
8
-
9
- | Trace ID | Task | Agent | Priority | Status |
10
- | :--- | :--- | :--- | :--- | :--- |
11
-
12
- ## CRITICAL DECISIONS
13
-
14
- - **Tech Stack:** Node.js/Fastify, React/Vite, PostgreSQL, Kysely.
15
- - **Surgical Standard:** replace_text/patch_file is mandatory for all edits.
16
- - **Contract First:** All developments must start with type definitions.
17
- - **Memory Standard:** Auto-pruning active (max 10 entries).
18
- - **Sovereign Backend Structure:** Every backend service MUST maintain its own database logic (schema, migrations, seeds) within `src/database/` to ensure full isolation.
19
-
20
- ## HISTORY
21
-
22
- - **Framework Scaffolding:** Initialized using Agent Enderun templates.
23
- - **Stable Release v1.0.3:** Promoted and mΓΌhΓΌrlendi with Unified Brain Architecture, conditional clean scaffolds, Grok army resolution, and 100% passing integration tests.
package/claude.md DELETED
@@ -1,25 +0,0 @@
1
- # Agent Enderun β€” Claude Code Adapter
2
-
3
- This is the primary entry point when using Agent Enderun within the Claude Code (CLI & Desktop) ecosystem.
4
-
5
- The framework operates under a unified governance structure located in the .enderun/ directory.
6
-
7
- ### Primary Constitution
8
- All governance rules, agent checklists, and project memory live here:
9
-
10
- πŸ‘‰ **[.enderun/ENDERUN.md](.enderun/ENDERUN.md)**
11
-
12
- ### πŸ€– Agent Directive
13
- You are operating under the Agent Enderun governance framework.
14
-
15
- At the **start of every session**, before any work:
16
- 1. **Restore Memory:** Read `.enderun/PROJECT_MEMORY.md` to restore state, active Trace ID, and history.
17
- 2. **Load Identity:** Read the relevant agent definition under `.enderun/agents/{agent}.md` (default to `@manager`).
18
- 3. **Internalize Knowledge:** Reference the `.enderun/knowledge/` base for architectural and coding standards.
19
-
20
- ### πŸ›‘οΈ Core Mandates
21
- - **Surgical Edits:** Use `replace_text` or `patch_file` via MCP for precise changes.
22
- - **Traceability:** Every action must inherit the active Trace ID from memory.
23
- - **Contract First:** No implementation without verified types.
24
-
25
- All paths and references inside the project must comply with the Supreme Constitution located at `.enderun/ENDERUN.md`.
package/gemini.md DELETED
@@ -1,31 +0,0 @@
1
- # Agent Enderun β€” Gemini CLI Adapter
2
-
3
- This is the primary entry point when using Agent Enderun within the Gemini CLI ecosystem.
4
-
5
- The framework operates under a unified governance structure located in the .enderun/ directory.
6
-
7
- ### Primary Constitution
8
- All governance rules, agent checklists, and project memory live here:
9
-
10
- πŸ‘‰ **[.enderun/ENDERUN.md](.enderun/ENDERUN.md)**
11
-
12
- ### πŸ€– Agent Directive
13
- You are operating under the Agent Enderun governance framework.
14
-
15
- At the **start of every session**, before any work:
16
- 1. **Restore Memory:** Read `.enderun/PROJECT_MEMORY.md` to restore state, active Trace ID, and history.
17
- 2. **Load Identity:** Read the relevant agent definition under `.enderun/agents/{agent}.md` (default to `@manager`).
18
- 3. **Internalize Knowledge:** Reference the `.enderun/knowledge/` base for architectural and coding standards.
19
-
20
- ### πŸ’Ύ Memory Tiers
21
- - **Project Memory (Shared):** `.enderun/PROJECT_MEMORY.md` is the source of truth for task history, Trace IDs, and architectural decisions. **Update this at the end of every turn.**
22
- - **Private Memory (User-Specific):** Use the local `.gitignored` memory directory (e.g. `.enderun/memory/`) for personal workflows or user-specific notes that should not be committed to Git. Never use the system's `/tmp` directory.
23
- - **Project Instructions:** This `gemini.md` file contains the "Supreme Law" and coding standards.
24
-
25
- ### πŸ›‘οΈ Core Mandates
26
- - **Surgical Edits:** Use `replace_text` or `patch_file` via MCP for precise changes.
27
- - **Traceability:** Every action must inherit the active Trace ID from memory.
28
- - **Contract First:** No implementation without verified types.
29
- - **NEVER FORGET:** @manager MUST update `.enderun/PROJECT_MEMORY.md` at the end of EVERY session without exception. This is a non-negotiable process integrity rule.
30
-
31
- All paths and references inside the project must comply with the Supreme Constitution located at `.enderun/ENDERUN.md`.
package/grok.md DELETED
@@ -1,25 +0,0 @@
1
- # Agent Enderun β€” Grok / X.ai Adapter
2
-
3
- This is the primary entry point when using Agent Enderun within the Grok / X.ai ecosystem.
4
-
5
- The framework operates under a unified governance structure located in the .enderun/ directory.
6
-
7
- ### Primary Constitution
8
- All governance rules, agent checklists, and project memory live here:
9
-
10
- πŸ‘‰ **[.enderun/ENDERUN.md](.enderun/ENDERUN.md)**
11
-
12
- ### πŸ€– Agent Directive
13
- You are operating under the Agent Enderun governance framework.
14
-
15
- At the **start of every session**, before any work:
16
- 1. **Restore Memory:** Read `.enderun/PROJECT_MEMORY.md` to restore state, active Trace ID, and history.
17
- 2. **Load Identity:** Read the relevant agent definition under `.enderun/agents/{agent}.md` (default to `@manager`).
18
- 3. **Internalize Knowledge:** Reference the `.enderun/knowledge/` base for architectural and coding standards.
19
-
20
- ### πŸ›‘οΈ Core Mandates
21
- - **Surgical Edits:** Use `replace_text` or `patch_file` via MCP for precise changes.
22
- - **Traceability:** Every action must inherit the active Trace ID from memory.
23
- - **Contract First:** No implementation without verified types.
24
-
25
- All paths and references inside the project must comply with the Supreme Constitution located at `.enderun/ENDERUN.md`.