aios-core 4.0.2 → 4.1.0

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 (111) hide show
  1. package/.aios-core/cli/commands/migrate/analyze.js +6 -6
  2. package/.aios-core/cli/commands/migrate/backup.js +2 -2
  3. package/.aios-core/cli/commands/migrate/execute.js +4 -4
  4. package/.aios-core/cli/commands/migrate/index.js +5 -5
  5. package/.aios-core/cli/commands/migrate/rollback.js +6 -6
  6. package/.aios-core/cli/commands/migrate/update-imports.js +2 -2
  7. package/.aios-core/cli/commands/migrate/validate.js +2 -2
  8. package/.aios-core/cli/commands/pro/index.js +52 -0
  9. package/.aios-core/cli/index.js +1 -1
  10. package/.aios-core/core/ids/registry-updater.js +29 -3
  11. package/.aios-core/core/migration/migration-config.yaml +2 -2
  12. package/.aios-core/core/migration/module-mapping.yaml +2 -2
  13. package/.aios-core/core/registry/README.md +2 -2
  14. package/.aios-core/core/synapse/context/context-builder.js +34 -0
  15. package/.aios-core/core/synapse/diagnostics/collectors/consistency-collector.js +168 -0
  16. package/.aios-core/core/synapse/diagnostics/collectors/hook-collector.js +129 -0
  17. package/.aios-core/core/synapse/diagnostics/collectors/manifest-collector.js +82 -0
  18. package/.aios-core/core/synapse/diagnostics/collectors/output-analyzer.js +134 -0
  19. package/.aios-core/core/synapse/diagnostics/collectors/pipeline-collector.js +75 -0
  20. package/.aios-core/core/synapse/diagnostics/collectors/quality-collector.js +252 -0
  21. package/.aios-core/core/synapse/diagnostics/collectors/relevance-matrix.js +174 -0
  22. package/.aios-core/core/synapse/diagnostics/collectors/safe-read-json.js +31 -0
  23. package/.aios-core/core/synapse/diagnostics/collectors/session-collector.js +102 -0
  24. package/.aios-core/core/synapse/diagnostics/collectors/timing-collector.js +126 -0
  25. package/.aios-core/core/synapse/diagnostics/collectors/uap-collector.js +83 -0
  26. package/.aios-core/core/synapse/diagnostics/report-formatter.js +484 -0
  27. package/.aios-core/core/synapse/diagnostics/synapse-diagnostics.js +95 -0
  28. package/.aios-core/core/synapse/engine.js +73 -20
  29. package/.aios-core/core/synapse/runtime/hook-runtime.js +60 -0
  30. package/.aios-core/core-config.yaml +6 -0
  31. package/.aios-core/data/agent-config-requirements.yaml +2 -2
  32. package/.aios-core/data/aios-kb.md +4 -4
  33. package/.aios-core/data/entity-registry.yaml +5 -5
  34. package/.aios-core/development/agents/architect.md +10 -10
  35. package/.aios-core/development/agents/devops.md +93 -50
  36. package/.aios-core/development/agents/qa.md +94 -40
  37. package/.aios-core/development/agents/ux-design-expert.md +25 -25
  38. package/.aios-core/development/scripts/activation-runtime.js +63 -0
  39. package/.aios-core/development/scripts/generate-greeting.js +9 -8
  40. package/.aios-core/development/scripts/unified-activation-pipeline.js +102 -2
  41. package/.aios-core/development/tasks/{db-expansion-pack-integration.md → db-squad-integration.md} +5 -5
  42. package/.aios-core/development/tasks/{integrate-expansion-pack.md → integrate-squad.md} +2 -2
  43. package/.aios-core/development/tasks/next.md +3 -3
  44. package/.aios-core/development/tasks/pr-automation.md +2 -2
  45. package/.aios-core/development/tasks/publish-npm.md +257 -0
  46. package/.aios-core/development/tasks/release-management.md +4 -4
  47. package/.aios-core/development/tasks/setup-github.md +1 -1
  48. package/.aios-core/development/tasks/squad-creator-migrate.md +1 -1
  49. package/.aios-core/development/tasks/squad-creator-sync-ide-command.md +14 -14
  50. package/.aios-core/development/tasks/update-aios.md +1 -1
  51. package/.aios-core/docs/standards/AIOS-COLOR-PALETTE-QUICK-REFERENCE.md +1 -1
  52. package/.aios-core/docs/standards/AIOS-COLOR-PALETTE-V2.1.md +5 -5
  53. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1-COMPLETE.md +21 -21
  54. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.2-SUMMARY.md +25 -25
  55. package/.aios-core/docs/standards/OPEN-SOURCE-VS-SERVICE-DIFFERENCES.md +4 -4
  56. package/.aios-core/docs/standards/QUALITY-GATES-SPECIFICATION.md +3 -3
  57. package/.aios-core/docs/standards/STANDARDS-INDEX.md +13 -13
  58. package/.aios-core/docs/standards/STORY-TEMPLATE-V2-SPECIFICATION.md +1 -1
  59. package/.aios-core/framework-config.yaml +4 -0
  60. package/.aios-core/infrastructure/scripts/codex-skills-sync/index.js +182 -0
  61. package/.aios-core/infrastructure/scripts/codex-skills-sync/validate.js +172 -0
  62. package/.aios-core/infrastructure/scripts/ide-sync/README.md +14 -0
  63. package/.aios-core/infrastructure/scripts/ide-sync/index.js +6 -0
  64. package/.aios-core/infrastructure/scripts/tool-resolver.js +4 -4
  65. package/.aios-core/infrastructure/scripts/validate-paths.js +142 -0
  66. package/.aios-core/infrastructure/templates/aios-sync.yaml.template +11 -11
  67. package/.aios-core/infrastructure/templates/github-workflows/README.md +1 -1
  68. package/.aios-core/install-manifest.yaml +190 -106
  69. package/.aios-core/local-config.yaml.template +2 -0
  70. package/.aios-core/product/README.md +2 -2
  71. package/.aios-core/product/data/integration-patterns.md +1 -1
  72. package/.aios-core/product/templates/ide-rules/cline-rules.md +1 -1
  73. package/.aios-core/product/templates/ide-rules/codex-rules.md +65 -0
  74. package/.aios-core/product/templates/ide-rules/copilot-rules.md +1 -1
  75. package/.aios-core/product/templates/ide-rules/roo-rules.md +1 -1
  76. package/.aios-core/user-guide.md +15 -14
  77. package/.aios-core/workflow-intelligence/engine/output-formatter.js +1 -1
  78. package/.claude/hooks/enforce-architecture-first.py +196 -0
  79. package/.claude/hooks/install-hooks.sh +41 -0
  80. package/.claude/hooks/mind-clone-governance.py +192 -0
  81. package/.claude/hooks/pre-commit-mmos-guard.sh +99 -0
  82. package/.claude/hooks/pre-commit-version-check.sh +156 -0
  83. package/.claude/hooks/read-protection.py +151 -0
  84. package/.claude/hooks/slug-validation.py +176 -0
  85. package/.claude/hooks/sql-governance.py +182 -0
  86. package/.claude/hooks/synapse-engine.js +9 -20
  87. package/.claude/hooks/write-path-validation.py +194 -0
  88. package/README.md +44 -14
  89. package/bin/aios-init.js +255 -184
  90. package/bin/aios-minimal.js +2 -2
  91. package/bin/aios.js +19 -19
  92. package/package.json +7 -4
  93. package/packages/aios-pro-cli/bin/aios-pro.js +75 -2
  94. package/packages/aios-pro-cli/package.json +5 -1
  95. package/packages/aios-pro-cli/src/recover.js +100 -0
  96. package/packages/installer/src/__tests__/performance-benchmark.js +382 -0
  97. package/packages/installer/src/config/ide-configs.js +12 -1
  98. package/packages/installer/src/config/templates/core-config-template.js +2 -2
  99. package/packages/installer/src/installer/aios-core-installer.js +2 -2
  100. package/packages/installer/src/installer/file-hasher.js +97 -0
  101. package/packages/installer/src/installer/post-install-validator.js +41 -1
  102. package/packages/installer/src/pro/pro-scaffolder.js +335 -0
  103. package/packages/installer/src/utils/aios-colors.js +2 -2
  104. package/packages/installer/src/wizard/feedback.js +1 -1
  105. package/packages/installer/src/wizard/ide-config-generator.js +2 -2
  106. package/packages/installer/src/wizard/index.js +58 -19
  107. package/packages/installer/src/wizard/pro-setup.js +547 -0
  108. package/packages/installer/src/wizard/questions.js +20 -14
  109. package/packages/installer/src/wizard/validators.js +1 -1
  110. package/scripts/package-synapse.js +323 -0
  111. package/scripts/validate-package-completeness.js +317 -0
@@ -94,46 +94,100 @@ story-file-permissions:
94
94
  - CRITICAL: Your updates must be limited to appending your review results in the QA Results section only
95
95
  # All commands require * prefix when used (e.g., *help)
96
96
  commands:
97
- # Code Review & Analysis
98
- - help: Show all available commands with descriptions
99
- - 'code-review {scope}': 'Run automated review (scope: uncommitted or committed)'
100
- - 'review {story}': Comprehensive story review with gate decision
101
- - 'review-build {story}': '10-phase structured QA review (Epic 6) - outputs qa_report.md'
102
-
103
- # Quality Gates
104
- - 'gate {story}': Create quality gate decision
105
- - 'nfr-assess {story}': Validate non-functional requirements
106
- - 'risk-profile {story}': Generate risk assessment matrix
107
-
108
- # Fix Requests (Epic 6 - QA Loop)
109
- - 'create-fix-request {story}': Generate QA_FIX_REQUEST.md for @dev with issues to fix
110
-
111
- # Enhanced Validation (Absorbed from Auto-Claude)
112
- - 'validate-libraries {story}': Validate third-party library usage via Context7
113
- - 'security-check {story}': Run 8-point security vulnerability scan
114
- - 'validate-migrations {story}': Validate database migrations for schema changes
115
- - 'evidence-check {story}': Verify evidence-based QA requirements
116
- - 'false-positive-check {story}': Critical thinking verification for bug fixes
117
- - 'console-check {story}': Browser console error detection
118
-
119
- # Test Strategy
120
- - 'test-design {story}': Create comprehensive test scenarios
121
- - 'trace {story}': 'Map requirements to tests (Given-When-Then)'
122
- - 'create-suite {story}': 'Create test suite for story (Authority: QA owns test suites)'
123
-
124
- # Spec Pipeline (Epic 3 - ADE)
125
- - 'critique-spec {story}': Review and critique specification for completeness and clarity
126
-
127
- # Backlog Management
128
- - 'backlog-add {story} {type} {priority} {title}': Add item to story backlog
129
- - 'backlog-update {item_id} {status}': Update backlog item status
130
- - backlog-review: Generate backlog review for sprint planning
131
-
132
- # Utilities
133
- - session-info: Show current session details (agent history, commands)
134
- - guide: Show comprehensive usage guide for this agent
135
- - yolo: 'Toggle permission mode (cycle: ask > auto > explore)'
136
- - exit: Exit QA mode
97
+ - name: help
98
+ visibility: [full, quick, key]
99
+ description: 'Show all available commands with descriptions'
100
+ - name: code-review
101
+ visibility: [full, quick]
102
+ args: '{scope}'
103
+ description: 'Run automated review (scope: uncommitted or committed)'
104
+ - name: review
105
+ visibility: [full, quick, key]
106
+ args: '{story}'
107
+ description: 'Comprehensive story review with gate decision'
108
+ - name: review-build
109
+ visibility: [full]
110
+ args: '{story}'
111
+ description: '10-phase structured QA review (Epic 6) - outputs qa_report.md'
112
+ - name: gate
113
+ visibility: [full, quick]
114
+ args: '{story}'
115
+ description: 'Create quality gate decision'
116
+ - name: nfr-assess
117
+ visibility: [full, quick]
118
+ args: '{story}'
119
+ description: 'Validate non-functional requirements'
120
+ - name: risk-profile
121
+ visibility: [full, quick]
122
+ args: '{story}'
123
+ description: 'Generate risk assessment matrix'
124
+ - name: create-fix-request
125
+ visibility: [full]
126
+ args: '{story}'
127
+ description: 'Generate QA_FIX_REQUEST.md for @dev with issues to fix'
128
+ - name: validate-libraries
129
+ visibility: [full]
130
+ args: '{story}'
131
+ description: 'Validate third-party library usage via Context7'
132
+ - name: security-check
133
+ visibility: [full, quick]
134
+ args: '{story}'
135
+ description: 'Run 8-point security vulnerability scan'
136
+ - name: validate-migrations
137
+ visibility: [full]
138
+ args: '{story}'
139
+ description: 'Validate database migrations for schema changes'
140
+ - name: evidence-check
141
+ visibility: [full]
142
+ args: '{story}'
143
+ description: 'Verify evidence-based QA requirements'
144
+ - name: false-positive-check
145
+ visibility: [full]
146
+ args: '{story}'
147
+ description: 'Critical thinking verification for bug fixes'
148
+ - name: console-check
149
+ visibility: [full]
150
+ args: '{story}'
151
+ description: 'Browser console error detection'
152
+ - name: test-design
153
+ visibility: [full, quick]
154
+ args: '{story}'
155
+ description: 'Create comprehensive test scenarios'
156
+ - name: trace
157
+ visibility: [full, quick]
158
+ args: '{story}'
159
+ description: 'Map requirements to tests (Given-When-Then)'
160
+ - name: create-suite
161
+ visibility: [full]
162
+ args: '{story}'
163
+ description: 'Create test suite for story (Authority: QA owns test suites)'
164
+ - name: critique-spec
165
+ visibility: [full]
166
+ args: '{story}'
167
+ description: 'Review and critique specification for completeness and clarity'
168
+ - name: backlog-add
169
+ visibility: [full]
170
+ args: '{story} {type} {priority} {title}'
171
+ description: 'Add item to story backlog'
172
+ - name: backlog-update
173
+ visibility: [full]
174
+ args: '{item_id} {status}'
175
+ description: 'Update backlog item status'
176
+ - name: backlog-review
177
+ visibility: [full, quick]
178
+ description: 'Generate backlog review for sprint planning'
179
+ - name: session-info
180
+ visibility: [full, quick]
181
+ description: 'Show current session details (agent history, commands)'
182
+ - name: guide
183
+ visibility: [full, quick, key]
184
+ description: 'Show comprehensive usage guide for this agent'
185
+ - name: yolo
186
+ visibility: [full, quick, key]
187
+ description: 'Toggle permission mode (cycle: ask > auto > explore)'
188
+ - name: exit
189
+ visibility: [full, quick, key]
190
+ description: 'Exit QA mode'
137
191
  dependencies:
138
192
  data:
139
193
  - technical-preferences.md
@@ -9,9 +9,9 @@ CRITICAL: Read the full YAML BLOCK that FOLLOWS IN THIS FILE to understand your
9
9
  ```yaml
10
10
  IDE-FILE-RESOLUTION:
11
11
  - FOR LATER USE ONLY - NOT FOR ACTIVATION, when executing commands that reference dependencies
12
- - Dependencies map to aios-core/{type}/{name}
12
+ - Dependencies map to .aios-core/development/{type}/{name}
13
13
  - type=folder (tasks|templates|checklists|data|workflows|etc...), name=file-name
14
- - Example: audit-codebase.md → aios-core/tasks/audit-codebase.md
14
+ - Example: audit-codebase.md → .aios-core/development/tasks/audit-codebase.md
15
15
  - IMPORTANT: Only load these files when user requests specific command execution
16
16
 
17
17
  REQUEST-RESOLUTION:
@@ -85,38 +85,38 @@ agent:
85
85
  Use DIRECT Read() with exact paths. NO Search/Grep.
86
86
 
87
87
  Phase 1 Commands:
88
- *research → Read("aios-core/tasks/ux-user-research.md")
89
- *wireframe → Read("aios-core/tasks/ux-create-wireframe.md")
90
- *generate-ui-prompt → Read("aios-core/tasks/generate-ai-frontend-prompt.md")
91
- *create-front-end-spec → Read("aios-core/tasks/create-doc.md") + template
88
+ *research → Read(".aios-core/development/tasks/ux-user-research.md")
89
+ *wireframe → Read(".aios-core/development/tasks/ux-create-wireframe.md")
90
+ *generate-ui-prompt → Read(".aios-core/development/tasks/generate-ai-frontend-prompt.md")
91
+ *create-front-end-spec → Read(".aios-core/development/tasks/create-doc.md") + template
92
92
 
93
93
  Phase 2 Commands:
94
- *audit → Read("aios-core/tasks/audit-codebase.md")
95
- *consolidate → Read("aios-core/tasks/consolidate-patterns.md")
96
- *shock-report → Read("aios-core/tasks/generate-shock-report.md")
94
+ *audit → Read(".aios-core/development/tasks/audit-codebase.md")
95
+ *consolidate → Read(".aios-core/development/tasks/consolidate-patterns.md")
96
+ *shock-report → Read(".aios-core/development/tasks/generate-shock-report.md")
97
97
 
98
98
  Phase 3 Commands:
99
- *tokenize → Read("aios-core/tasks/extract-tokens.md")
100
- *setup → Read("aios-core/tasks/setup-design-system.md")
101
- *migrate → Read("aios-core/tasks/generate-migration-strategy.md")
102
- *upgrade-tailwind → Read("aios-core/tasks/tailwind-upgrade.md")
103
- *audit-tailwind-config → Read("aios-core/tasks/audit-tailwind-config.md")
104
- *export-dtcg → Read("aios-core/tasks/export-design-tokens-dtcg.md")
105
- *bootstrap-shadcn → Read("aios-core/tasks/bootstrap-shadcn-library.md")
99
+ *tokenize → Read(".aios-core/development/tasks/extract-tokens.md")
100
+ *setup → Read(".aios-core/development/tasks/setup-design-system.md")
101
+ *migrate → Read(".aios-core/development/tasks/generate-migration-strategy.md")
102
+ *upgrade-tailwind → Read(".aios-core/development/tasks/tailwind-upgrade.md")
103
+ *audit-tailwind-config → Read(".aios-core/development/tasks/audit-tailwind-config.md")
104
+ *export-dtcg → Read(".aios-core/development/tasks/export-design-tokens-dtcg.md")
105
+ *bootstrap-shadcn → Read(".aios-core/development/tasks/bootstrap-shadcn-library.md")
106
106
 
107
107
  Phase 4 Commands:
108
- *build → Read("aios-core/tasks/build-component.md")
109
- *compose → Read("aios-core/tasks/compose-molecule.md")
110
- *extend → Read("aios-core/tasks/extend-pattern.md")
108
+ *build → Read(".aios-core/development/tasks/build-component.md")
109
+ *compose → Read(".aios-core/development/tasks/compose-molecule.md")
110
+ *extend → Read(".aios-core/development/tasks/extend-pattern.md")
111
111
 
112
112
  Phase 5 Commands:
113
- *document → Read("aios-core/tasks/generate-documentation.md")
114
- *a11y-check → Read("aios-core/checklists/accessibility-wcag-checklist.md")
115
- *calculate-roi → Read("aios-core/tasks/calculate-roi.md")
113
+ *document → Read(".aios-core/development/tasks/generate-documentation.md")
114
+ *a11y-check → Read(".aios-core/development/checklists/accessibility-wcag-checklist.md")
115
+ *calculate-roi → Read(".aios-core/development/tasks/calculate-roi.md")
116
116
 
117
117
  Universal Commands:
118
- *scan → Read("aios-core/tasks/ux-ds-scan-artifact.md")
119
- *integrate → Read("aios-core/tasks/integrate-Squad.md")
118
+ *scan → Read(".aios-core/development/tasks/ux-ds-scan-artifact.md")
119
+ *integrate → Read(".aios-core/development/tasks/integrate-Squad.md")
120
120
 
121
121
  persona_profile:
122
122
  archetype: Empathizer
@@ -196,7 +196,7 @@ commands:
196
196
 
197
197
  # === UNIVERSAL COMMANDS ===
198
198
  scan {path|url}: 'Analyze HTML/React artifact for patterns'
199
- integrate {pack}: 'Connect with expansion pack'
199
+ integrate {pack}: 'Connect with squad'
200
200
  help: 'Show all commands organized by phase'
201
201
  status: 'Show current workflow phase'
202
202
  guide: 'Show comprehensive usage guide for this agent'
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ const { UnifiedActivationPipeline } = require('./unified-activation-pipeline');
4
+
5
+ /**
6
+ * Canonical activation runtime for AIOS agents.
7
+ *
8
+ * This wrapper centralizes agent activation calls so IDE-specific entry points
9
+ * (Codex, Claude Code, scripts) can depend on one stable API.
10
+ */
11
+ class ActivationRuntime {
12
+ /**
13
+ * @param {Object} [options]
14
+ * @param {string} [options.projectRoot]
15
+ * @param {UnifiedActivationPipeline} [options.pipeline]
16
+ */
17
+ constructor(options = {}) {
18
+ this.pipeline = options.pipeline || new UnifiedActivationPipeline({
19
+ projectRoot: options.projectRoot,
20
+ });
21
+ }
22
+
23
+ /**
24
+ * Activate agent and return the full activation result.
25
+ * @param {string} agentId
26
+ * @param {Object} [options]
27
+ * @returns {Promise<{greeting: string, context: Object, duration: number, quality: string, metrics: Object}>}
28
+ */
29
+ async activate(agentId, options = {}) {
30
+ return this.pipeline.activate(agentId, options);
31
+ }
32
+
33
+ /**
34
+ * Activate agent and return only greeting text.
35
+ * @param {string} agentId
36
+ * @param {Object} [options]
37
+ * @returns {Promise<string>}
38
+ */
39
+ async activateGreeting(agentId, options = {}) {
40
+ try {
41
+ const result = await this.activate(agentId, options);
42
+ return result && typeof result.greeting === 'string' ? result.greeting : '';
43
+ } catch (error) {
44
+ throw new Error(`ActivationRuntime.activateGreeting failed for "${agentId}": ${error.message}`);
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Convenience helper for one-shot activation.
51
+ * @param {string} agentId
52
+ * @param {Object} [options]
53
+ * @returns {Promise<{greeting: string, context: Object, duration: number, quality: string, metrics: Object}>}
54
+ */
55
+ function activateAgent(agentId, options = {}) {
56
+ const runtime = new ActivationRuntime(options);
57
+ return runtime.activate(agentId, options);
58
+ }
59
+
60
+ module.exports = {
61
+ ActivationRuntime,
62
+ activateAgent,
63
+ };
@@ -2,11 +2,11 @@
2
2
  /**
3
3
  * Unified Greeting Generator - CLI Wrapper
4
4
  *
5
- * Story ACT-6: Refactored as thin wrapper around UnifiedActivationPipeline.
5
+ * Story ACT-6: Refactored as thin wrapper around ActivationRuntime.
6
6
  *
7
7
  * ARCHITECTURE NOTE:
8
8
  * This file is now a thin CLI wrapper that delegates to the
9
- * UnifiedActivationPipeline for all context loading and greeting generation.
9
+ * ActivationRuntime for all context loading and greeting generation.
10
10
  * Previously, this file orchestrated its own parallel loading of
11
11
  * AgentConfigLoader, SessionContextLoader, and ProjectStatusLoader.
12
12
  * Now ALL agents (not just 3) can use the same unified pipeline.
@@ -19,9 +19,10 @@
19
19
  * Usage: node generate-greeting.js <agent-id>
20
20
  *
21
21
  * Used by: @devops, @data-engineer, @ux-design-expert (CLI invocation pattern)
22
- * Note: All 12 agents now use UnifiedActivationPipeline internally.
22
+ * Note: All 12 agents now activate through ActivationRuntime.
23
23
  *
24
- * @see unified-activation-pipeline.js for the actual pipeline logic
24
+ * @see activation-runtime.js for the runtime entrypoint
25
+ * @see unified-activation-pipeline.js for pipeline internals
25
26
  * @see greeting-builder.js for core greeting logic
26
27
  *
27
28
  * Part of Story 6.1.4: Unified Greeting System Integration
@@ -30,12 +31,12 @@
30
31
 
31
32
  'use strict';
32
33
 
33
- const { UnifiedActivationPipeline } = require('./unified-activation-pipeline');
34
+ const { ActivationRuntime } = require('./activation-runtime');
34
35
 
35
36
  /**
36
37
  * Generate unified greeting for agent activation.
37
38
  *
38
- * Delegates to UnifiedActivationPipeline.activate() which handles:
39
+ * Delegates to ActivationRuntime.activate() which handles:
39
40
  * - Parallel loading of config, session, project status, git, permissions
40
41
  * - Sequential context detection and workflow state
41
42
  * - Greeting generation via GreetingBuilder
@@ -49,8 +50,8 @@ const { UnifiedActivationPipeline } = require('./unified-activation-pipeline');
49
50
  */
50
51
  async function generateGreeting(agentId) {
51
52
  try {
52
- const pipeline = new UnifiedActivationPipeline();
53
- const result = await pipeline.activate(agentId);
53
+ const runtime = new ActivationRuntime();
54
+ const result = await runtime.activate(agentId);
54
55
 
55
56
  if (result.duration > 100) {
56
57
  console.warn(`[generate-greeting] Slow generation: ${result.duration}ms`);
@@ -1,3 +1,6 @@
1
+ // SYN-14: Boot time captured before ANY require — measures cold start
2
+ const _BOOT_TIME = process.hrtime.bigint();
3
+
1
4
  /**
2
5
  * Unified Activation Pipeline - Single Entry Point for All 12 Agents
3
6
  *
@@ -38,6 +41,7 @@
38
41
 
39
42
  const path = require('path');
40
43
  const fs = require('fs').promises;
44
+ const fsSync = require('fs');
41
45
  const yaml = require('js-yaml');
42
46
 
43
47
  const GreetingBuilder = require('./greeting-builder');
@@ -158,7 +162,7 @@ class UnifiedActivationPipeline {
158
162
  // Race: full pipeline vs timeout (clear timer to prevent leak)
159
163
  const { promise: timeoutPromise, timerId } = this._timeoutFallback(agentId, pipelineTimeout);
160
164
  const result = await Promise.race([
161
- this._runPipeline(agentId, options, coreConfig),
165
+ this._runPipeline(agentId, options, coreConfig, startTime),
162
166
  timeoutPromise,
163
167
  ]);
164
168
  clearTimeout(timerId);
@@ -198,7 +202,7 @@ class UnifiedActivationPipeline {
198
202
  * @param {Object} coreConfig - Pre-loaded core config (shared, not read again)
199
203
  * @returns {Promise<{greeting: string, context: Object, quality: string, metrics: Object}>}
200
204
  */
201
- async _runPipeline(agentId, options = {}, coreConfig = {}) {
205
+ async _runPipeline(agentId, options = {}, coreConfig = {}, startTime = Date.now()) {
202
206
  const pipelineStart = Date.now();
203
207
  const metrics = { loaders: {} };
204
208
 
@@ -329,6 +333,12 @@ class UnifiedActivationPipeline {
329
333
  // ACT-11: Determine quality level based on what loaded successfully
330
334
  const quality = this._determineQuality(metrics);
331
335
 
336
+ // SYN-13: Write active agent to SYNAPSE session (fire-and-forget, 20ms budget)
337
+ this._writeSynapseSession(agentId, quality, metrics);
338
+
339
+ // SYN-14: Persist UAP metrics for diagnostics (fire-and-forget)
340
+ this._persistUapMetrics(agentId, quality, metrics, Date.now() - startTime);
341
+
332
342
  return {
333
343
  greeting,
334
344
  context: enrichedContext,
@@ -665,6 +675,96 @@ class UnifiedActivationPipeline {
665
675
  };
666
676
  }
667
677
 
678
+ /**
679
+ * SYN-13: Write active agent to SYNAPSE session bridge file.
680
+ *
681
+ * Writes `.synapse/sessions/_active-agent.json` as a singleton file.
682
+ * Uses fs.writeFileSync directly (not updateSession) to avoid prompt_count
683
+ * side effects. Fire-and-forget with try/catch — never blocks activation.
684
+ *
685
+ * @private
686
+ * @param {string} agentId - Agent ID being activated
687
+ * @param {string} quality - Activation quality ('full'|'partial'|'fallback')
688
+ * @param {Object} metrics - Metrics object for profiling
689
+ */
690
+ _writeSynapseSession(agentId, quality, metrics) {
691
+ const start = Date.now();
692
+ try {
693
+ const sessionsDir = path.join(this.projectRoot, '.synapse', 'sessions');
694
+ if (!fsSync.existsSync(path.join(this.projectRoot, '.synapse'))) {
695
+ // .synapse/ does not exist — project may not have SYNAPSE installed
696
+ const duration = Date.now() - start;
697
+ metrics.loaders.synapseSession = { duration, status: 'skipped', start, end: start + duration };
698
+ return;
699
+ }
700
+
701
+ if (!fsSync.existsSync(sessionsDir)) {
702
+ fsSync.mkdirSync(sessionsDir, { recursive: true });
703
+ }
704
+
705
+ const bridgeData = {
706
+ id: agentId,
707
+ activated_at: new Date().toISOString(),
708
+ activation_quality: quality,
709
+ source: 'uap',
710
+ };
711
+
712
+ const bridgePath = path.join(sessionsDir, '_active-agent.json');
713
+ fsSync.writeFileSync(bridgePath, JSON.stringify(bridgeData, null, 2), 'utf8');
714
+
715
+ const duration = Date.now() - start;
716
+ metrics.loaders.synapseSession = { duration, status: 'ok', start, end: start + duration };
717
+ } catch (error) {
718
+ const duration = Date.now() - start;
719
+ metrics.loaders.synapseSession = { duration, status: 'error', start, end: start + duration, error: error.message };
720
+ console.warn(`[UnifiedActivationPipeline] SYNAPSE session write failed: ${error.message}`);
721
+ }
722
+ }
723
+
724
+ /**
725
+ * SYN-14: Persist UAP metrics to .synapse/metrics/uap-metrics.json.
726
+ * Fire-and-forget — never blocks activation pipeline.
727
+ *
728
+ * @private
729
+ * @param {string} agentId - Agent ID
730
+ * @param {string} quality - Activation quality ('full'|'partial'|'fallback')
731
+ * @param {Object} metrics - Metrics object with loader timings
732
+ * @param {number} totalDuration - Total activation duration in ms
733
+ */
734
+ _persistUapMetrics(agentId, quality, metrics, totalDuration) {
735
+ try {
736
+ const synapsePath = path.join(this.projectRoot, '.synapse');
737
+ if (!fsSync.existsSync(synapsePath)) return;
738
+ const metricsDir = path.join(synapsePath, 'metrics');
739
+ if (!fsSync.existsSync(metricsDir)) {
740
+ fsSync.mkdirSync(metricsDir, { recursive: true });
741
+ }
742
+ const requireChainMs = typeof _BOOT_TIME !== 'undefined'
743
+ ? Number(process.hrtime.bigint() - _BOOT_TIME) / 1e6
744
+ : 0;
745
+ const data = {
746
+ agentId,
747
+ quality,
748
+ totalDuration,
749
+ requireChainMs,
750
+ loaders: {},
751
+ timestamp: new Date().toISOString(),
752
+ };
753
+ for (const [name, info] of Object.entries(metrics.loaders || {})) {
754
+ data.loaders[name] = {
755
+ duration: info.duration || 0,
756
+ status: info.status || 'unknown',
757
+ };
758
+ }
759
+ fsSync.writeFileSync(
760
+ path.join(metricsDir, 'uap-metrics.json'),
761
+ JSON.stringify(data, null, 2), 'utf8',
762
+ );
763
+ } catch {
764
+ // Fire-and-forget: never block the activation pipeline
765
+ }
766
+ }
767
+
668
768
  /**
669
769
  * Get list of all supported agent IDs.
670
770
  * @returns {string[]} Array of agent IDs
@@ -208,11 +208,11 @@ updated_at: 2025-11-17
208
208
 
209
209
  ## Description
210
210
 
211
- Analyze an expansion pack's data requirements and design database integration strategy. Maps pack inputs/outputs/state to database schema, proposes tables/relationships, and generates migration plan.
211
+ Analyze an squad's data requirements and design database integration strategy. Maps pack inputs/outputs/state to database schema, proposes tables/relationships, and generates migration plan.
212
212
 
213
213
  ## Prerequisites
214
214
 
215
- - Expansion pack installed and accessible
215
+ - Squad installed and accessible
216
216
  - Database connection configured (*env-check passed)
217
217
  - Current schema documented or accessible
218
218
 
@@ -221,8 +221,8 @@ Analyze an expansion pack's data requirements and design database integration st
221
221
  ### Step 1: Identify Target Expansion Pack
222
222
 
223
223
  **Elicit from user:**
224
- - Which expansion pack? (mmos, creator-os, innerlens, etc.)
225
- - Path to expansion pack directory
224
+ - Which squad? (mmos, creator-os, innerlens, etc.)
225
+ - Path to squad directory
226
226
 
227
227
  **Actions:**
228
228
  - Verify pack exists and has config.yaml
@@ -578,7 +578,7 @@ next_steps:
578
578
 
579
579
  ## Success Criteria
580
580
 
581
- - [ ] Expansion pack data flows fully documented
581
+ - [ ] Squad data flows fully documented
582
582
  - [ ] Current schema analyzed
583
583
  - [ ] Integration schema designed (follows patterns, has RLS)
584
584
  - [ ] KISS Gate validation passed (database is actually needed)
@@ -208,13 +208,13 @@ updated_at: 2025-11-17
208
208
 
209
209
  ## Description
210
210
 
211
- Connect design system with MMOS, CreatorOS, or InnerLens expansion packs. Generates pack-specific patterns, token variations, and integration documentation.
211
+ Connect design system with MMOS, CreatorOS, or InnerLens squads. Generates pack-specific patterns, token variations, and integration documentation.
212
212
 
213
213
  ## Prerequisites
214
214
 
215
215
  - Design system setup complete
216
216
  - Components built
217
- - Target expansion pack installed
217
+ - Target squad installed
218
218
 
219
219
  ## Workflow
220
220
 
@@ -130,7 +130,7 @@ Options:
130
130
 
131
131
  Examples:
132
132
  *next # Auto-detect context
133
- *next --story docs/stories/v2.1/sprint-10/story-wis-3.md
133
+ *next --story docs/stories/v4.0.4/sprint-10/story-wis-3.md
134
134
  *next --all # Show all suggestions
135
135
 
136
136
  How it works:
@@ -156,7 +156,7 @@ Workflow detection uses:
156
156
  📍 State: in_development (confidence: 92%)
157
157
 
158
158
  Next steps:
159
- 1. `*review-qa docs/stories/v2.1/sprint-10/story-wis-3.md` - Run QA review
159
+ 1. `*review-qa docs/stories/v4.0.4/sprint-10/story-wis-3.md` - Run QA review
160
160
  2. `*run-tests` - Execute test suite manually
161
161
  3. `*pre-push-quality-gate` - Final quality checks
162
162
 
@@ -257,7 +257,7 @@ optimizations:
257
257
  Context:
258
258
  Agent: @dev
259
259
  Last Command: *develop
260
- Story: docs/stories/v2.1/sprint-11/story-wis-3.md
260
+ Story: docs/stories/v4.0.4/sprint-11/story-wis-3.md
261
261
  Branch: feature/wis-3
262
262
 
263
263
  Workflow: story_development
@@ -21,7 +21,7 @@ To help users contribute to the AIOS open-source project (`@synkra/aios-core`) b
21
21
  **Target Repository**: `@synkra/aios-core` (open-source framework)
22
22
 
23
23
  **Contribution Types Supported**:
24
- - Expansion packs (new agents, tasks, workflows)
24
+ - Squads (new agents, tasks, workflows)
25
25
  - Agent improvements (enhanced prompts, new commands)
26
26
  - Task refinements (better checklists, templates)
27
27
  - Tool integrations (new MCP tools)
@@ -183,7 +183,7 @@ To help users contribute to the AIOS open-source project (`@synkra/aios-core`) b
183
183
  ```
184
184
  feat(Squad): add content-creator pack with Instagram agent
185
185
 
186
- Implements a complete content creation expansion pack with:
186
+ Implements a complete content creation squad with:
187
187
  - Instagram content specialist agent
188
188
  - 5 new tasks (create-post, schedule-content, analyze-performance, etc.)
189
189
  - Template library for posts, stories, reels