aios-core 4.2.13 → 4.2.14

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 (97) hide show
  1. package/.aios-core/core/code-intel/helpers/dev-helper.js +206 -0
  2. package/.aios-core/core/registry/registry-schema.json +166 -166
  3. package/.aios-core/core/synapse/diagnostics/collectors/hook-collector.js +3 -3
  4. package/.aios-core/data/entity-registry.yaml +27 -0
  5. package/.aios-core/development/scripts/approval-workflow.js +642 -642
  6. package/.aios-core/development/scripts/backup-manager.js +606 -606
  7. package/.aios-core/development/scripts/branch-manager.js +389 -389
  8. package/.aios-core/development/scripts/code-quality-improver.js +1311 -1311
  9. package/.aios-core/development/scripts/commit-message-generator.js +849 -849
  10. package/.aios-core/development/scripts/conflict-resolver.js +674 -674
  11. package/.aios-core/development/scripts/dependency-analyzer.js +637 -637
  12. package/.aios-core/development/scripts/diff-generator.js +351 -351
  13. package/.aios-core/development/scripts/elicitation-engine.js +384 -384
  14. package/.aios-core/development/scripts/elicitation-session-manager.js +299 -299
  15. package/.aios-core/development/scripts/git-wrapper.js +461 -461
  16. package/.aios-core/development/scripts/manifest-preview.js +244 -244
  17. package/.aios-core/development/scripts/metrics-tracker.js +775 -775
  18. package/.aios-core/development/scripts/modification-validator.js +554 -554
  19. package/.aios-core/development/scripts/pattern-learner.js +1224 -1224
  20. package/.aios-core/development/scripts/performance-analyzer.js +757 -757
  21. package/.aios-core/development/scripts/refactoring-suggester.js +1138 -1138
  22. package/.aios-core/development/scripts/rollback-handler.js +530 -530
  23. package/.aios-core/development/scripts/security-checker.js +358 -358
  24. package/.aios-core/development/scripts/template-engine.js +239 -239
  25. package/.aios-core/development/scripts/template-validator.js +278 -278
  26. package/.aios-core/development/scripts/test-generator.js +843 -843
  27. package/.aios-core/development/scripts/transaction-manager.js +589 -589
  28. package/.aios-core/development/scripts/usage-tracker.js +673 -673
  29. package/.aios-core/development/scripts/validate-filenames.js +226 -226
  30. package/.aios-core/development/scripts/version-tracker.js +526 -526
  31. package/.aios-core/development/scripts/yaml-validator.js +396 -396
  32. package/.aios-core/development/tasks/build-autonomous.md +10 -4
  33. package/.aios-core/development/tasks/create-service.md +23 -0
  34. package/.aios-core/development/tasks/dev-develop-story.md +12 -6
  35. package/.aios-core/development/tasks/dev-suggest-refactoring.md +7 -1
  36. package/.aios-core/development/tasks/publish-npm.md +3 -3
  37. package/.aios-core/hooks/unified/README.md +1 -1
  38. package/.aios-core/install-manifest.yaml +65 -61
  39. package/.aios-core/manifests/schema/manifest-schema.json +190 -190
  40. package/.aios-core/product/templates/component-react-tmpl.tsx +98 -98
  41. package/.aios-core/product/templates/engine/schemas/adr.schema.json +102 -102
  42. package/.aios-core/product/templates/engine/schemas/dbdr.schema.json +205 -205
  43. package/.aios-core/product/templates/engine/schemas/epic.schema.json +175 -175
  44. package/.aios-core/product/templates/engine/schemas/pmdr.schema.json +175 -175
  45. package/.aios-core/product/templates/engine/schemas/prd-v2.schema.json +300 -300
  46. package/.aios-core/product/templates/engine/schemas/prd.schema.json +152 -152
  47. package/.aios-core/product/templates/engine/schemas/story.schema.json +222 -222
  48. package/.aios-core/product/templates/engine/schemas/task.schema.json +154 -154
  49. package/.aios-core/product/templates/eslintrc-security.json +32 -32
  50. package/.aios-core/product/templates/github-actions-cd.yml +212 -212
  51. package/.aios-core/product/templates/github-actions-ci.yml +172 -172
  52. package/.aios-core/product/templates/shock-report-tmpl.html +502 -502
  53. package/.aios-core/product/templates/token-exports-css-tmpl.css +240 -240
  54. package/.aios-core/quality/schemas/quality-metrics.schema.json +233 -233
  55. package/.aios-core/scripts/migrate-framework-docs.sh +300 -300
  56. package/README.en.md +747 -0
  57. package/README.md +4 -2
  58. package/bin/aios.js +7 -4
  59. package/package.json +1 -1
  60. package/packages/aios-pro-cli/src/recover.js +1 -1
  61. package/packages/installer/src/wizard/ide-config-generator.js +6 -6
  62. package/packages/installer/src/wizard/pro-setup.js +3 -3
  63. package/scripts/package-synapse.js +5 -5
  64. package/scripts/validate-package-completeness.js +3 -3
  65. package/.aios-core/.session/current-session.json +0 -14
  66. package/.aios-core/data/registry-update-log.jsonl +0 -191
  67. package/.aios-core/docs/SHARD-TRANSLATION-GUIDE.md +0 -335
  68. package/.aios-core/docs/component-creation-guide.md +0 -458
  69. package/.aios-core/docs/session-update-pattern.md +0 -307
  70. package/.aios-core/docs/standards/AIOS-FRAMEWORK-MASTER.md +0 -1963
  71. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1-SUMMARY.md +0 -1190
  72. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1.md +0 -439
  73. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO.md +0 -5398
  74. package/.aios-core/docs/standards/V3-ARCHITECTURAL-DECISIONS.md +0 -523
  75. package/.aios-core/docs/template-syntax.md +0 -267
  76. package/.aios-core/docs/troubleshooting-guide.md +0 -625
  77. package/.aios-core/infrastructure/tests/utilities-audit-results.json +0 -501
  78. package/.aios-core/manifests/agents.csv +0 -29
  79. package/.aios-core/manifests/tasks.csv +0 -198
  80. package/.aios-core/manifests/workers.csv +0 -204
  81. package/.claude/rules/agent-authority.md +0 -105
  82. package/.claude/rules/coderabbit-integration.md +0 -93
  83. package/.claude/rules/ids-principles.md +0 -112
  84. package/.claude/rules/story-lifecycle.md +0 -139
  85. package/.claude/rules/workflow-execution.md +0 -150
  86. package/pro/README.md +0 -66
  87. package/pro/license/degradation.js +0 -220
  88. package/pro/license/errors.js +0 -450
  89. package/pro/license/feature-gate.js +0 -354
  90. package/pro/license/index.js +0 -181
  91. package/pro/license/license-api.js +0 -651
  92. package/pro/license/license-cache.js +0 -523
  93. package/pro/license/license-crypto.js +0 -303
  94. package/scripts/glue/README.md +0 -355
  95. package/scripts/glue/compose-agent-prompt.cjs +0 -362
  96. /package/.claude/hooks/{precompact-session-digest.js → precompact-session-digest.cjs} +0 -0
  97. /package/.claude/hooks/{synapse-engine.js → synapse-engine.cjs} +0 -0
@@ -1,303 +0,0 @@
1
- /**
2
- * License Crypto Module
3
- *
4
- * Provides cryptographic utilities for license cache encryption:
5
- * - Machine ID generation (deterministic fingerprint)
6
- * - PBKDF2 key derivation
7
- * - AES-256-GCM encryption/decryption
8
- * - HMAC-SHA256 integrity verification
9
- *
10
- * @module pro/license/license-crypto
11
- * @see ADR-PRO-003 - Feature Gating & Licensing
12
- * @see Story PRO-6 - License Key & Feature Gating System
13
- */
14
-
15
- 'use strict';
16
-
17
- const crypto = require('crypto');
18
- const os = require('os');
19
-
20
- /**
21
- * Configuration constants for cryptographic operations.
22
- * These values follow security best practices per ADR-PRO-003.
23
- */
24
- const CONFIG = {
25
- // PBKDF2 settings
26
- PBKDF2_ITERATIONS: 100000, // Minimum per ADR-PRO-003
27
- PBKDF2_KEY_LENGTH: 32, // 256 bits for AES-256
28
- PBKDF2_DIGEST: 'sha256',
29
-
30
- // AES-256-GCM settings
31
- AES_ALGORITHM: 'aes-256-gcm',
32
- AES_IV_LENGTH: 12, // 96 bits recommended for GCM
33
- AES_TAG_LENGTH: 16, // 128 bits auth tag
34
-
35
- // HMAC settings
36
- HMAC_ALGORITHM: 'sha256',
37
-
38
- // Salt settings
39
- SALT_LENGTH: 16, // 128 bits
40
- };
41
-
42
- /**
43
- * Generate a deterministic machine identifier.
44
- *
45
- * Combines hostname + CPU model + first MAC address to create
46
- * a unique but reproducible identifier for this machine.
47
- *
48
- * @returns {string} SHA-256 hash of machine fingerprint components
49
- */
50
- function generateMachineId() {
51
- const components = [];
52
-
53
- // Hostname
54
- const hostname = os.hostname();
55
- components.push(hostname);
56
-
57
- // CPU model (first CPU)
58
- const cpus = os.cpus();
59
- if (cpus.length > 0) {
60
- components.push(cpus[0].model);
61
- }
62
-
63
- // First non-internal MAC address
64
- const networkInterfaces = os.networkInterfaces();
65
- for (const [, interfaces] of Object.entries(networkInterfaces)) {
66
- for (const iface of interfaces) {
67
- if (!iface.internal && iface.mac && iface.mac !== '00:00:00:00:00:00') {
68
- components.push(iface.mac);
69
- break;
70
- }
71
- }
72
- // Only use first valid MAC
73
- if (components.length > 2) {
74
- break;
75
- }
76
- }
77
-
78
- // Create deterministic hash
79
- const fingerprint = components.join('|');
80
- return crypto.createHash('sha256').update(fingerprint).digest('hex');
81
- }
82
-
83
- /**
84
- * Generate a cryptographically secure random salt.
85
- *
86
- * @param {number} [length=16] - Salt length in bytes
87
- * @returns {Buffer} Random salt buffer
88
- */
89
- function generateSalt(length = CONFIG.SALT_LENGTH) {
90
- return crypto.randomBytes(length);
91
- }
92
-
93
- /**
94
- * Derive an encryption key from machine ID using PBKDF2.
95
- *
96
- * Uses 100,000 iterations minimum per ADR-PRO-003 security requirements.
97
- *
98
- * @param {string} machineId - Machine identifier from generateMachineId()
99
- * @param {Buffer|string} salt - Random salt (Buffer or hex string)
100
- * @returns {Buffer} 256-bit derived key
101
- */
102
- function deriveCacheKey(machineId, salt) {
103
- const saltBuffer = Buffer.isBuffer(salt) ? salt : Buffer.from(salt, 'hex');
104
-
105
- return crypto.pbkdf2Sync(
106
- machineId,
107
- saltBuffer,
108
- CONFIG.PBKDF2_ITERATIONS,
109
- CONFIG.PBKDF2_KEY_LENGTH,
110
- CONFIG.PBKDF2_DIGEST,
111
- );
112
- }
113
-
114
- /**
115
- * Encrypt data using AES-256-GCM.
116
- *
117
- * Returns an object containing the encrypted ciphertext, initialization vector,
118
- * and authentication tag for integrity verification.
119
- *
120
- * @param {string|object} data - Data to encrypt (objects are JSON stringified)
121
- * @param {Buffer|string} key - 256-bit encryption key (Buffer or hex string)
122
- * @returns {{ ciphertext: string, iv: string, tag: string }} Encrypted data components (hex encoded)
123
- * @throws {Error} If encryption fails
124
- */
125
- function encrypt(data, key) {
126
- const keyBuffer = Buffer.isBuffer(key) ? key : Buffer.from(key, 'hex');
127
-
128
- if (keyBuffer.length !== 32) {
129
- throw new Error('Encryption key must be 256 bits (32 bytes)');
130
- }
131
-
132
- // Generate random IV
133
- const iv = crypto.randomBytes(CONFIG.AES_IV_LENGTH);
134
-
135
- // Stringify objects
136
- const plaintext = typeof data === 'object' ? JSON.stringify(data) : String(data);
137
-
138
- // Create cipher and encrypt
139
- const cipher = crypto.createCipheriv(CONFIG.AES_ALGORITHM, keyBuffer, iv, {
140
- authTagLength: CONFIG.AES_TAG_LENGTH,
141
- });
142
-
143
- let ciphertext = cipher.update(plaintext, 'utf8', 'hex');
144
- ciphertext += cipher.final('hex');
145
-
146
- // Get auth tag
147
- const tag = cipher.getAuthTag();
148
-
149
- return {
150
- ciphertext,
151
- iv: iv.toString('hex'),
152
- tag: tag.toString('hex'),
153
- };
154
- }
155
-
156
- /**
157
- * Decrypt data using AES-256-GCM.
158
- *
159
- * Verifies the authentication tag to ensure data integrity.
160
- *
161
- * @param {{ ciphertext: string, iv: string, tag: string }} encryptedData - Encrypted data object
162
- * @param {Buffer|string} key - 256-bit encryption key (Buffer or hex string)
163
- * @param {boolean} [parseJson=true] - Whether to parse result as JSON
164
- * @returns {string|object} Decrypted data
165
- * @throws {Error} If decryption fails or authentication fails
166
- */
167
- function decrypt(encryptedData, key, parseJson = true) {
168
- const { ciphertext, iv, tag } = encryptedData;
169
-
170
- const keyBuffer = Buffer.isBuffer(key) ? key : Buffer.from(key, 'hex');
171
-
172
- if (keyBuffer.length !== 32) {
173
- throw new Error('Decryption key must be 256 bits (32 bytes)');
174
- }
175
-
176
- const ivBuffer = Buffer.from(iv, 'hex');
177
- const tagBuffer = Buffer.from(tag, 'hex');
178
-
179
- // Create decipher
180
- const decipher = crypto.createDecipheriv(CONFIG.AES_ALGORITHM, keyBuffer, ivBuffer, {
181
- authTagLength: CONFIG.AES_TAG_LENGTH,
182
- });
183
-
184
- decipher.setAuthTag(tagBuffer);
185
-
186
- let plaintext = decipher.update(ciphertext, 'hex', 'utf8');
187
- plaintext += decipher.final('utf8');
188
-
189
- // Optionally parse as JSON
190
- if (parseJson) {
191
- try {
192
- return JSON.parse(plaintext);
193
- } catch {
194
- // Return as string if not valid JSON
195
- return plaintext;
196
- }
197
- }
198
-
199
- return plaintext;
200
- }
201
-
202
- /**
203
- * Compute HMAC-SHA256 for data integrity verification.
204
- *
205
- * @param {string|Buffer} data - Data to compute HMAC for
206
- * @param {Buffer|string} key - HMAC key (Buffer or hex string)
207
- * @returns {string} HMAC as hex string
208
- */
209
- function computeHMAC(data, key) {
210
- const keyBuffer = Buffer.isBuffer(key) ? key : Buffer.from(key, 'hex');
211
- const dataString = Buffer.isBuffer(data) ? data.toString('utf8') : String(data);
212
-
213
- return crypto.createHmac(CONFIG.HMAC_ALGORITHM, keyBuffer).update(dataString).digest('hex');
214
- }
215
-
216
- /**
217
- * Verify HMAC matches expected value.
218
- *
219
- * Uses timing-safe comparison to prevent timing attacks.
220
- *
221
- * @param {string|Buffer} data - Data to verify
222
- * @param {Buffer|string} key - HMAC key
223
- * @param {string} expectedHmac - Expected HMAC value (hex string)
224
- * @returns {boolean} true if HMAC matches
225
- */
226
- function verifyHMAC(data, key, expectedHmac) {
227
- const computedHmac = computeHMAC(data, key);
228
-
229
- // Use timing-safe comparison
230
- const computedBuffer = Buffer.from(computedHmac, 'hex');
231
- const expectedBuffer = Buffer.from(expectedHmac, 'hex');
232
-
233
- if (computedBuffer.length !== expectedBuffer.length) {
234
- return false;
235
- }
236
-
237
- return crypto.timingSafeEqual(computedBuffer, expectedBuffer);
238
- }
239
-
240
- /**
241
- * Mask a license key for display.
242
- *
243
- * Shows only first and last 4 characters: PRO-XXXX-****-****-XXXX
244
- * CRITICAL: Always use this function when logging or displaying keys.
245
- *
246
- * @param {string} key - Full license key
247
- * @returns {string} Masked key for display
248
- */
249
- function maskKey(key) {
250
- if (!key || typeof key !== 'string') {
251
- return '****-****-****-****';
252
- }
253
-
254
- // Handle PRO-XXXX-XXXX-XXXX-XXXX format
255
- const parts = key.split('-');
256
- if (parts.length !== 5 || parts[0] !== 'PRO') {
257
- // Non-standard format, mask all but first/last 4
258
- if (key.length <= 8) {
259
- return '****';
260
- }
261
- return `${key.slice(0, 4)}-****-****-${key.slice(-4)}`;
262
- }
263
-
264
- // Standard format: PRO-XXXX-XXXX-XXXX-XXXX
265
- return `${parts[0]}-${parts[1]}-****-****-${parts[4]}`;
266
- }
267
-
268
- /**
269
- * Validate license key format.
270
- *
271
- * Expected format: PRO-XXXX-XXXX-XXXX-XXXX
272
- * Where X is alphanumeric (A-Z0-9)
273
- *
274
- * @param {string} key - License key to validate
275
- * @returns {boolean} true if format is valid
276
- */
277
- function validateKeyFormat(key) {
278
- if (!key || typeof key !== 'string') {
279
- return false;
280
- }
281
-
282
- // Format: PRO-XXXX-XXXX-XXXX-XXXX (uppercase alphanumeric)
283
- const pattern = /^PRO-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/;
284
- return pattern.test(key);
285
- }
286
-
287
- module.exports = {
288
- // Core functions per ADR-PRO-003
289
- generateMachineId,
290
- deriveCacheKey,
291
- encrypt,
292
- decrypt,
293
- computeHMAC,
294
-
295
- // Additional utilities
296
- generateSalt,
297
- verifyHMAC,
298
- maskKey,
299
- validateKeyFormat,
300
-
301
- // Exported for testing
302
- _CONFIG: CONFIG,
303
- };
@@ -1,355 +0,0 @@
1
- # Glue Script: Compose Agent Prompt
2
-
3
- Deterministic prompt composition for autonomous AIOS agents.
4
-
5
- ## Overview
6
-
7
- The glue script (`compose-agent-prompt.cjs`) composes complete prompts for autonomous agents by combining:
8
-
9
- 1. **Agent Persona** - From `.aios-core/development/agents/{id}.md`
10
- 2. **Task Workflow** - From Mission Router → `.aios-core/development/tasks/{file}.md`
11
- 3. **Extra Resources** - Checklists, templates specified in Mission Router
12
- 4. **Context** - Story files, accumulated context, etc.
13
- 5. **Execution Directive** - Mission-specific instructions
14
-
15
- ## Architecture
16
-
17
- ```
18
- Skill (orchestrator) → Calls glue script
19
-
20
- Glue Script → Deterministic composition (~240 lines)
21
- ↓ outputs 1500-2000 lines
22
- Task(general-purpose) → Agent receives COMPLETE prompt
23
-
24
- Autonomous Execution → No additional Reads needed
25
- ```
26
-
27
- **Benefits:**
28
- - Lead doesn't burn context with Reads per spawn
29
- - Agent receives everything upfront (fresh context)
30
- - Deterministic: same inputs → same output
31
- - Validatable and testable
32
-
33
- ## Installation
34
-
35
- ```bash
36
- # Already included in project
37
- # No additional dependencies needed
38
- ```
39
-
40
- ## Usage
41
-
42
- ### Basic Usage
43
-
44
- ```bash
45
- # Develop a story
46
- node scripts/glue/compose-agent-prompt.cjs \
47
- --agent dev \
48
- --mission develop-story \
49
- --context path/to/story.md
50
-
51
- # Validate a story
52
- node scripts/glue/compose-agent-prompt.cjs \
53
- --agent po \
54
- --mission validate-story \
55
- --context path/to/expanded.md
56
-
57
- # Review implementation
58
- node scripts/glue/compose-agent-prompt.cjs \
59
- --agent qa \
60
- --mission gate \
61
- --context path/to/story.md \
62
- --context path/to/impl-log.md
63
- ```
64
-
65
- ### Options
66
-
67
- | Option | Description | Example |
68
- |--------|-------------|---------|
69
- | `--agent <id>` | Agent ID (dev, qa, po, db-sage, etc.) | `--agent dev` |
70
- | `--mission <keyword>` | Mission from Agent's Router | `--mission develop-story` |
71
- | `--context <path>` | Context file (repeatable) | `--context story.md` |
72
- | `--squad <name>` | Explicit squad name for agent resolution | `--squad design` |
73
- | `--extra-instruction` | Additional instruction | `--extra-instruction "Focus on tests"` |
74
- | `--verbose` | Show debug info to stderr | `--verbose` |
75
- | `--list-missions` | List available missions | `--list-missions` |
76
-
77
- ### Multiple Contexts
78
-
79
- ```bash
80
- # Story + accumulated context
81
- node scripts/glue/compose-agent-prompt.cjs \
82
- --agent po \
83
- --mission validate \
84
- --context story.md \
85
- --context accumulated-context.md
86
-
87
- # Story + implementation log
88
- node scripts/glue/compose-agent-prompt.cjs \
89
- --agent qa \
90
- --mission gate \
91
- --context expanded.md \
92
- --context impl-log.md
93
- ```
94
-
95
- ### Mission Aliases
96
-
97
- Common shortcuts for mission keywords:
98
-
99
- | Alias | Resolves To |
100
- |-------|-------------|
101
- | `review` | `gate` |
102
- | `validate` | `validate-story` |
103
- | `expand` | `create-story` |
104
- | `develop` | `develop-story` |
105
- | `implement` | `develop-story` |
106
- | `backlog` | `backlog-review` |
107
- | `draft` | `create-story` |
108
-
109
- ### List Available Missions
110
-
111
- ```bash
112
- # List missions for QA agent
113
- node scripts/glue/compose-agent-prompt.cjs --agent qa --list-missions
114
-
115
- # List missions for PO agent
116
- node scripts/glue/compose-agent-prompt.cjs --agent po --list-missions
117
- ```
118
-
119
- ## Integration with Task Tool
120
-
121
- ```javascript
122
- // 1. Compose the prompt
123
- const prompt = await Bash(
124
- `node scripts/glue/compose-agent-prompt.cjs \
125
- --agent dev \
126
- --mission develop-story \
127
- --context ${storyPath}`
128
- );
129
-
130
- // 2. Spawn agent with complete prompt
131
- Task({
132
- subagent_type: "general-purpose",
133
- model: "opus", // or "sonnet" for mechanical tasks
134
- mode: "bypassPermissions",
135
- prompt: prompt.stdout
136
- });
137
- ```
138
-
139
- ## Execute-Epic Pipeline
140
-
141
- The glue script supports the full execute-epic pipeline:
142
-
143
- ### Phase 1: Backlog Review (PO)
144
- ```bash
145
- node scripts/glue/compose-agent-prompt.cjs \
146
- --agent po \
147
- --mission backlog-review \
148
- --context path/to/epic.md
149
- ```
150
-
151
- ### Phase 2: Development Cycle
152
-
153
- **2.1 Expand Story (SM)**
154
- ```bash
155
- node scripts/glue/compose-agent-prompt.cjs \
156
- --agent sm \
157
- --mission expand \
158
- --context path/to/epic.md \
159
- --extra-instruction "Extract story X"
160
- ```
161
-
162
- **2.2 Validate Story (PO)**
163
- ```bash
164
- node scripts/glue/compose-agent-prompt.cjs \
165
- --agent po \
166
- --mission validate \
167
- --context path/to/expanded.md
168
- ```
169
-
170
- **2.3 Implement (Dev)**
171
- ```bash
172
- node scripts/glue/compose-agent-prompt.cjs \
173
- --agent dev \
174
- --mission develop \
175
- --context path/to/expanded.md \
176
- --context path/to/accumulated-context.md
177
- ```
178
-
179
- **2.4 Review (QA)**
180
- ```bash
181
- node scripts/glue/compose-agent-prompt.cjs \
182
- --agent qa \
183
- --mission review \
184
- --context path/to/expanded.md \
185
- --context path/to/impl-log.md
186
- ```
187
-
188
- ### Phase 3: Retrospective (PO)
189
- ```bash
190
- node scripts/glue/compose-agent-prompt.cjs \
191
- --agent po \
192
- --mission retrospective \
193
- --context path/to/accumulated-context.md
194
- ```
195
-
196
- ## Agent Reference
197
-
198
- ### Agent Resolution Priority
199
-
200
- The glue script resolves agents in this order:
201
-
202
- 1. `.claude/agents/aios-{id}.md` (AIOS core agents)
203
- 2. `.claude/agents/{id}.md` (standalone agents like db-sage)
204
- 3. `squads/{squad}/agents/{id}.md` (squad-specific agents)
205
-
206
- ### AIOS Core Agents
207
-
208
- | Agent ID | Role | Common Missions |
209
- |----------|------|-----------------|
210
- | `dev` | Developer | `develop-story`, `apply-qa-fixes` |
211
- | `qa` | Quality Assurance | `gate`, `review-story`, `security-scan` |
212
- | `po` | Product Owner | `validate-story`, `backlog-review` |
213
- | `sm` | Scrum Master | `create-story`, `expand` |
214
- | `architect` | Architect | `analyze-impact`, `create-fullstack-arch` |
215
- | `devops` | DevOps | `commit`, `pre-push`, `create-pr` |
216
- | `analyst` | Analyst | `market-research`, `competitor-analysis` |
217
- | `data-engineer` | Data Engineer | `develop-story`, `migration`, `schema-audit` |
218
- | `ux` | UX Designer | `wireframe`, `audit`, `develop-story` |
219
- | `pm` | Product Manager | `create-prd`, `create-epic` |
220
-
221
- ### Specialized Squad Agents
222
-
223
- | Agent ID | Squad | Replaces | Common Missions |
224
- |----------|-------|----------|-----------------|
225
- | `db-sage` | db-sage | data-engineer (for DB) | `kiss`, `kiss-schema-check`, `setup` |
226
- | `brad-frost` | design | — | Uses internal `*command` system |
227
- | `design-chief` | design | — | Squad orchestration |
228
- | `cyber-chief` | cybersecurity | — | Security audits |
229
-
230
- **Note:** Squad agents may use different mission systems. Use `--list-missions` to check available missions for each agent.
231
-
232
- ### Squad Agent Usage
233
-
234
- ```bash
235
- # db-sage uses Mission Router
236
- node scripts/glue/compose-agent-prompt.cjs --agent db-sage --mission kiss
237
-
238
- # brad-frost uses internal command system (load persona only)
239
- node scripts/glue/compose-agent-prompt.cjs --agent brad-frost --mission audit \
240
- --extra-instruction "Execute *audit command from your configuration"
241
-
242
- # Explicit squad specification
243
- node scripts/glue/compose-agent-prompt.cjs --agent my-agent --squad my-squad --mission task
244
- ```
245
-
246
- ## Prompt Structure
247
-
248
- The output prompt has the following structure:
249
-
250
- ```markdown
251
- ## Agent Persona
252
-
253
- [Full agent definition from .aios-core/development/agents/{id}.md]
254
-
255
- ---
256
-
257
- ## Task Workflow: {mission}
258
-
259
- [Task workflow from .aios-core/development/tasks/{file}.md]
260
-
261
- ---
262
-
263
- ## Checklist: {resource}.md
264
-
265
- [Checklists specified in Mission Router]
266
-
267
- ---
268
-
269
- ## Context
270
-
271
- ### Context 1: {filename}
272
-
273
- [File content]
274
-
275
- ### Context 2: {filename}
276
-
277
- [File content]
278
-
279
- ---
280
-
281
- ## Execution Directive
282
-
283
- Execute the mission "{mission}" following the task workflow above.
284
- - Follow ALL steps in the task workflow exactly
285
- - Use Self-Critique checkpoints if defined in the workflow
286
- - Output artifacts as specified in the workflow
287
- - Mark success/failure clearly at the end
288
-
289
- **Additional Instruction:** {extra-instruction if provided}
290
- ```
291
-
292
- ## Verbose Mode
293
-
294
- Use `--verbose` to see debug information:
295
-
296
- ```bash
297
- node scripts/glue/compose-agent-prompt.cjs \
298
- --agent dev \
299
- --mission develop \
300
- --context story.md \
301
- --verbose
302
- ```
303
-
304
- Output (to stderr):
305
- ```
306
- [glue] Agent: dev, Mission: develop, Resolved: develop-story
307
- [glue] Task file: dev-develop-story.md
308
- [glue] Extra resources: story-dod-checklist.md, self-critique-checklist.md
309
- [glue] Loading context: story.md
310
-
311
- [glue] Prompt stats: 1773 lines, 60117 chars
312
- [glue] Sections: 6 (persona, task, 2 checklists, 1 contexts, directive)
313
- ```
314
-
315
- ## Troubleshooting
316
-
317
- ### Agent file not found
318
- ```
319
- Error: Agent file not found: .claude/agents/aios-foo.md
320
- ```
321
- Check that the agent ID is valid. Use one of: dev, qa, po, sm, architect, devops, analyst, data-engineer, ux, pm.
322
-
323
- ### Mission not found
324
- ```
325
- ## Mission: foo
326
- No router entry found. Execute mission based on agent expertise.
327
- ```
328
- Use `--list-missions` to see available missions for the agent.
329
-
330
- ### Context file not found
331
- ```
332
- ### Context 1
333
- File not found: /path/to/missing.md
334
- ```
335
- Verify the context file path is correct.
336
-
337
- ## Test Results
338
-
339
- Pipeline tested with MMOS epic stories:
340
-
341
- | Story | Phase | Agent | Duration | Result |
342
- |-------|-------|-------|----------|--------|
343
- | MMOS-001 | Develop | dev | 227s | ✅ COMPLETED (verified existing impl) |
344
- | MMOS-002 | Validate | po | 60s | ✅ APPROVED (impl exists) |
345
- | MMOS-002 | Review | qa | 345s | ✅ APPROVED (38/38 tests pass) |
346
-
347
- **Key Metrics:**
348
- - Prompt size: 1500-1850 lines per agent
349
- - Agent autonomy: 100% (no manual intervention)
350
- - Test pass rate: 100%
351
-
352
- ---
353
-
354
- *Created: 2026-02-06*
355
- *Version: 1.0.0*