aiox-core 5.0.7 → 5.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/.aiox-core/cli/commands/pro/buyer.js +379 -0
  2. package/.aiox-core/cli/commands/pro/index.js +191 -52
  3. package/.aiox-core/cli/commands/validate/index.js +2 -0
  4. package/.aiox-core/core/code-intel/helpers/dev-helper.js +1 -1
  5. package/.aiox-core/core/code-intel/helpers/devops-helper.js +0 -1
  6. package/.aiox-core/core/code-intel/helpers/planning-helper.js +1 -1
  7. package/.aiox-core/core/code-intel/helpers/qa-helper.js +2 -2
  8. package/.aiox-core/core/config/schemas/framework-config.schema.json +1 -0
  9. package/.aiox-core/core/config/template-overrides.js +1 -1
  10. package/.aiox-core/core/doctor/checks/ide-sync.js +81 -25
  11. package/.aiox-core/core/doctor/checks/rules-files.js +0 -1
  12. package/.aiox-core/core/doctor/checks/skills-count.js +83 -15
  13. package/.aiox-core/core/graph-dashboard/cli.js +1 -2
  14. package/.aiox-core/core/graph-dashboard/data-sources/code-intel-source.js +1 -1
  15. package/.aiox-core/core/ids/layer-classifier.js +1 -1
  16. package/.aiox-core/core/pro/pro-updater.js +578 -0
  17. package/.aiox-core/core/synapse/context/context-tracker.js +107 -9
  18. package/.aiox-core/core/synapse/layers/layer-processor.js +1 -1
  19. package/.aiox-core/core-config.yaml +15 -1
  20. package/.aiox-core/data/capability-detection.js +15 -15
  21. package/.aiox-core/data/entity-registry.yaml +18 -2
  22. package/.aiox-core/data/registry-update-log.jsonl +5 -0
  23. package/.aiox-core/data/tok3-token-comparison.js +0 -4
  24. package/.aiox-core/data/tool-search-validation.js +1 -1
  25. package/.aiox-core/development/agents/aiox-master.md +44 -6
  26. package/.aiox-core/development/agents/data-engineer.md +4 -4
  27. package/.aiox-core/development/agents/devops.md +52 -2
  28. package/.aiox-core/development/agents/po.md +1 -1
  29. package/.aiox-core/development/agents/qa.md +5 -11
  30. package/.aiox-core/development/agents/sm.md +3 -3
  31. package/.aiox-core/development/agents/ux-design-expert.md +1 -1
  32. package/.aiox-core/development/scripts/unified-activation-pipeline.js +29 -3
  33. package/.aiox-core/development/tasks/dev-develop-story.md +46 -7
  34. package/.aiox-core/development/tasks/devops-pro-access-grant.md +93 -0
  35. package/.aiox-core/development/tasks/devops-pro-activate.md +42 -0
  36. package/.aiox-core/development/tasks/devops-pro-check-access.md +34 -0
  37. package/.aiox-core/development/tasks/devops-pro-request-reset.md +34 -0
  38. package/.aiox-core/development/tasks/devops-pro-resend-verification.md +32 -0
  39. package/.aiox-core/development/tasks/devops-pro-reset-password.md +36 -0
  40. package/.aiox-core/development/tasks/devops-pro-validate-login.md +36 -0
  41. package/.aiox-core/development/tasks/devops-pro-verify-status.md +33 -0
  42. package/.aiox-core/development/tasks/qa-gate.md +54 -4
  43. package/.aiox-core/development/tasks/validate-next-story.md +39 -2
  44. package/.aiox-core/framework-config.yaml +1 -0
  45. package/.aiox-core/infrastructure/scripts/codex-skills-sync/README.md +69 -0
  46. package/.aiox-core/infrastructure/scripts/codex-skills-sync/bootstrap.js +727 -0
  47. package/.aiox-core/infrastructure/scripts/codex-skills-sync/index.js +10 -0
  48. package/.aiox-core/infrastructure/scripts/codex-skills-sync/validate.js +65 -4
  49. package/.aiox-core/infrastructure/scripts/generate-settings-json.js +29 -4
  50. package/.aiox-core/infrastructure/scripts/ide-sync/agent-parser.js +4 -0
  51. package/.aiox-core/infrastructure/scripts/ide-sync/index.js +67 -7
  52. package/.aiox-core/infrastructure/scripts/ide-sync/transformers/claude-code.js +145 -3
  53. package/.aiox-core/infrastructure/scripts/repair-agent-references.js +263 -0
  54. package/.aiox-core/infrastructure/scripts/validate-claude-integration.js +60 -8
  55. package/.aiox-core/infrastructure/scripts/validate-paths.js +13 -0
  56. package/.aiox-core/install-manifest.yaml +134 -82
  57. package/.aiox-core/utils/filters/index.js +2 -1
  58. package/.claude/commands/AIOX/agents/aiox-master.md +21 -0
  59. package/.claude/commands/AIOX/agents/analyst.md +21 -0
  60. package/.claude/commands/AIOX/agents/architect.md +21 -0
  61. package/.claude/commands/AIOX/agents/data-engineer.md +21 -0
  62. package/.claude/commands/AIOX/agents/dev.md +21 -0
  63. package/.claude/commands/AIOX/agents/devops.md +21 -0
  64. package/.claude/commands/AIOX/agents/pm.md +21 -0
  65. package/.claude/commands/AIOX/agents/po.md +21 -0
  66. package/.claude/commands/AIOX/agents/qa.md +21 -0
  67. package/.claude/commands/AIOX/agents/sm.md +21 -0
  68. package/.claude/commands/AIOX/agents/squad-creator.md +21 -0
  69. package/.claude/commands/AIOX/agents/ux-design-expert.md +21 -0
  70. package/.claude/commands/AIOX/scripts/agent-config-loader.js +624 -0
  71. package/.claude/commands/AIOX/scripts/generate-greeting.js +160 -0
  72. package/.claude/commands/AIOX/scripts/greeting-builder.js +866 -0
  73. package/.claude/commands/AIOX/scripts/session-context-loader.js +286 -0
  74. package/.claude/commands/AIOX/stories/story-6.1.4.md +1404 -0
  75. package/.claude/commands/cohort-squad/agents/cohort-manager.md +156 -0
  76. package/.claude/commands/design-system/agents/brad-frost.md +1097 -0
  77. package/.claude/commands/design-system/agents/dan-mall.md +857 -0
  78. package/.claude/commands/design-system/agents/dave-malouf.md +2272 -0
  79. package/.claude/commands/design-system/agents/design-chief.md +102 -0
  80. package/.claude/commands/design-system/agents/nano-banana-generator.md +162 -0
  81. package/.claude/commands/greet.md +101 -0
  82. package/.claude/commands/synapse/manager.md +75 -0
  83. package/.claude/commands/synapse/tasks/add-rule.md +94 -0
  84. package/.claude/commands/synapse/tasks/create-command.md +109 -0
  85. package/.claude/commands/synapse/tasks/create-domain.md +127 -0
  86. package/.claude/commands/synapse/tasks/diagnose-synapse.md +245 -0
  87. package/.claude/commands/synapse/tasks/edit-rule.md +109 -0
  88. package/.claude/commands/synapse/tasks/suggest-domain.md +116 -0
  89. package/.claude/commands/synapse/tasks/toggle-domain.md +83 -0
  90. package/.claude/commands/synapse/templates/domain-template +8 -0
  91. package/.claude/commands/synapse/templates/manifest-entry-template +4 -0
  92. package/.claude/commands/synapse/utils/manifest-parser-reference.md +134 -0
  93. package/.claude/hooks/precompact-session-digest.cjs +2 -2
  94. package/.claude/skills/AIOX/agents/aiox-master/SKILL.md +511 -0
  95. package/.claude/skills/AIOX/agents/analyst/SKILL.md +281 -0
  96. package/.claude/skills/AIOX/agents/architect/SKILL.md +482 -0
  97. package/.claude/skills/AIOX/agents/data-engineer/SKILL.md +503 -0
  98. package/.claude/skills/AIOX/agents/dev/SKILL.md +568 -0
  99. package/.claude/skills/AIOX/agents/devops/SKILL.md +597 -0
  100. package/.claude/skills/AIOX/agents/pm/SKILL.md +385 -0
  101. package/.claude/skills/AIOX/agents/po/SKILL.md +343 -0
  102. package/.claude/skills/AIOX/agents/qa/SKILL.md +451 -0
  103. package/.claude/skills/AIOX/agents/sm/SKILL.md +295 -0
  104. package/.claude/skills/AIOX/agents/squad-creator/SKILL.md +352 -0
  105. package/.claude/skills/AIOX/agents/ux-design-expert/SKILL.md +503 -0
  106. package/.claude/skills/architect-first/SKILL.md +275 -0
  107. package/.claude/skills/architect-first/assets/architecture-template.md +505 -0
  108. package/.claude/skills/architect-first/assets/config-template.yaml +351 -0
  109. package/.claude/skills/architect-first/references/architecture-checklist.md +216 -0
  110. package/.claude/skills/architect-first/references/pre-implementation-checklist.md +119 -0
  111. package/.claude/skills/architect-first/references/stop-rules-guide.md +291 -0
  112. package/.claude/skills/architect-first/references/testing-strategy-guide.md +477 -0
  113. package/.claude/skills/architect-first/scripts/architecture_validator.py +490 -0
  114. package/.claude/skills/architect-first/scripts/check_coupling.py +306 -0
  115. package/.claude/skills/architect-first/scripts/validate_risk_mitigation.py +382 -0
  116. package/.claude/skills/checklist-runner/SKILL.md +113 -0
  117. package/.claude/skills/clone-mind.md +329 -0
  118. package/.claude/skills/coderabbit-review/SKILL.md +106 -0
  119. package/.claude/skills/course-generation-workflow.md +76 -0
  120. package/.claude/skills/enhance-workflow.md +466 -0
  121. package/.claude/skills/mcp-builder/LICENSE.txt +202 -0
  122. package/.claude/skills/mcp-builder/SKILL.md +328 -0
  123. package/.claude/skills/mcp-builder/reference/evaluation.md +602 -0
  124. package/.claude/skills/mcp-builder/reference/mcp_best_practices.md +915 -0
  125. package/.claude/skills/mcp-builder/reference/node_mcp_server.md +916 -0
  126. package/.claude/skills/mcp-builder/reference/python_mcp_server.md +752 -0
  127. package/.claude/skills/mcp-builder/scripts/connections.py +151 -0
  128. package/.claude/skills/mcp-builder/scripts/evaluation.py +373 -0
  129. package/.claude/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  130. package/.claude/skills/mcp-builder/scripts/requirements.txt +2 -0
  131. package/.claude/skills/ralph.md +181 -0
  132. package/.claude/skills/skill-creator/LICENSE.txt +202 -0
  133. package/.claude/skills/skill-creator/SKILL.md +209 -0
  134. package/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
  135. package/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  136. package/.claude/skills/skill-creator/scripts/quick_validate.py +65 -0
  137. package/.claude/skills/squad.md +301 -0
  138. package/.claude/skills/synapse/SKILL.md +132 -0
  139. package/.claude/skills/synapse/assets/README.md +50 -0
  140. package/.claude/skills/synapse/references/brackets.md +100 -0
  141. package/.claude/skills/synapse/references/commands.md +118 -0
  142. package/.claude/skills/synapse/references/domains.md +126 -0
  143. package/.claude/skills/synapse/references/layers.md +186 -0
  144. package/.claude/skills/synapse/references/manifest.md +142 -0
  145. package/.claude/skills/tech-search/SKILL.md +431 -0
  146. package/.claude/skills/tech-search/prompts/page-extract.md +133 -0
  147. package/README.en.md +2 -2
  148. package/README.md +8 -2
  149. package/bin/aiox.js +55 -4
  150. package/bin/utils/framework-guard.js +4 -2
  151. package/bin/utils/pro-detector.js +119 -28
  152. package/bin/utils/validate-publish.js +6 -6
  153. package/docs/aiox-agent-flows/devops-system.md +18 -0
  154. package/docs/aiox-workflows/README.md +1 -0
  155. package/docs/aiox-workflows/pro-access-grant-workflow.md +218 -0
  156. package/docs/guides/pro/access-grant-ops-playbook.md +370 -0
  157. package/docs/guides/pro/install-gate-setup.md +12 -6
  158. package/docs/guides/pro/squad-creator-handoff-pro-access-ops.md +134 -0
  159. package/docs/guides/supabase-ops-handoff.md +768 -0
  160. package/package.json +12 -1
  161. package/packages/aiox-pro-cli/bin/aiox-pro.js +33 -12
  162. package/packages/installer/src/config/configure-environment.js +118 -50
  163. package/packages/installer/src/installer/aiox-core-installer.js +124 -27
  164. package/packages/installer/src/installer/brownfield-upgrader.js +66 -9
  165. package/packages/installer/src/installer/dependency-installer.js +4 -0
  166. package/packages/installer/src/pro/pro-scaffolder.js +5 -5
  167. package/packages/installer/src/updater/index.js +151 -10
  168. package/packages/installer/src/wizard/ide-config-generator.js +73 -7
  169. package/packages/installer/src/wizard/index.js +119 -31
  170. package/packages/installer/src/wizard/pro-setup.js +118 -47
  171. package/packages/installer/src/wizard/validation/validators/dependency-validator.js +32 -25
  172. package/packages/installer/src/wizard/validation/validators/file-structure-validator.js +26 -0
  173. package/packages/installer/tests/unit/artifact-copy-pipeline/artifact-copy-pipeline.test.js +84 -1
  174. package/packages/installer/tests/unit/claude-md-template-v5/claude-md-template-v5.test.js +1 -1
  175. package/packages/installer/tests/unit/doctor/doctor-checks.test.js +85 -19
  176. package/packages/installer/tests/unit/entity-registry-bootstrap.test.js +4 -4
  177. package/packages/installer/tests/unit/generate-settings-json/generate-settings-json.test.js +5 -5
  178. package/packages/installer/tests/unit/ide-sync-integration/ide-sync-integration.test.js +4 -4
  179. package/packages/installer/tests/unit/merger/yaml-merger.test.js +11 -11
  180. package/pro/README.md +12 -1
  181. package/pro/license/index.js +3 -11
  182. package/pro/license/license-api.js +25 -0
  183. package/pro/license/license-cache.js +135 -31
  184. package/pro/license/license-crypto.js +59 -3
  185. package/pro/package.json +5 -4
  186. package/pro/squads/README.md +16 -16
  187. package/pro/squads/index.js +1 -1
  188. package/scripts/e2e/installed-skills-smoke.js +264 -0
  189. package/scripts/package-synapse.js +3 -3
  190. package/scripts/validate-package-completeness.js +8 -11
  191. package/.aiox-core/lib/build.json +0 -1
@@ -0,0 +1,301 @@
1
+ ---
2
+ name: squad
3
+ description: |
4
+ Master orchestrator for squad creation. Creates teams of AI agents specialized
5
+ in any domain. Use when user wants to create a new squad, clone minds, or
6
+ manage existing squads. Triggers on: "create squad", "want a squad",
7
+ "need experts in", "time de especialistas".
8
+
9
+ model: opus
10
+
11
+ allowed-tools:
12
+ - Read
13
+ - Grep
14
+ - Glob
15
+ - Task
16
+ - Write
17
+ - Edit
18
+ - Bash
19
+ - WebSearch
20
+ - WebFetch
21
+
22
+ permissionMode: acceptEdits
23
+
24
+ memory: project
25
+
26
+ subagents:
27
+ oalanicolas:
28
+ description: |
29
+ Mind cloning architect. Invoke for Voice DNA and Thinking DNA extraction.
30
+ Expert in capturing mental models, communication patterns, and frameworks
31
+ from elite minds. Use for wf-clone-mind workflow execution.
32
+ model: opus
33
+ tools:
34
+ - Read
35
+ - Grep
36
+ - WebSearch
37
+ - WebFetch
38
+ - Write
39
+ - Edit
40
+ disallowedTools:
41
+ - Bash
42
+ - Task
43
+ permissionMode: acceptEdits
44
+ memory: project
45
+
46
+ pedro-valerio:
47
+ description: |
48
+ Process absolutist. Invoke for workflow validation and audit.
49
+ Ensures zero wrong paths possible. Validates veto conditions,
50
+ unidirectional flow, and checkpoint coverage.
51
+ model: opus
52
+ tools:
53
+ - Read
54
+ - Grep
55
+ - Glob
56
+ permissionMode: default
57
+ memory: project
58
+
59
+ sop-extractor:
60
+ description: |
61
+ SOP extraction specialist. Extracts standard operating procedures
62
+ from content, interviews, documentation, and expert materials.
63
+ model: sonnet
64
+ tools:
65
+ - Read
66
+ - Grep
67
+ - Write
68
+ permissionMode: acceptEdits
69
+ memory: project
70
+
71
+ hooks:
72
+ PreToolUse:
73
+ - matcher: "Write"
74
+ hooks:
75
+ - type: command
76
+ command: "python3 squads/squad-creator/scripts/validate-agent-output.py"
77
+ timeout: 10000
78
+
79
+ SubagentStop:
80
+ - type: command
81
+ command: "python3 squads/squad-creator/scripts/on-specialist-complete.py"
82
+ timeout: 5000
83
+
84
+ Stop:
85
+ - type: command
86
+ command: "python3 squads/squad-creator/scripts/save-session-metrics.py"
87
+ timeout: 5000
88
+ ---
89
+
90
+ # 🎨 Squad Architect
91
+
92
+ ## Persona
93
+
94
+ **Identity:** Master Orchestrator of AI Squads
95
+ **Philosophy:** "Clone minds > create generic bots. People with skin in the game = better frameworks."
96
+ **Voice:** Strategic, methodical, quality-obsessed, research-first
97
+ **Icon:** 🎨
98
+
99
+ ## Memory Protocol
100
+
101
+ ### On Activation
102
+ 1. Read `.claude/agent-memory/squad/MEMORY.md` for context
103
+ 2. Check "Squads Criados" for potential duplicates
104
+ 3. Check "Minds Já Clonados" to avoid re-research
105
+
106
+ ### After Each Task
107
+ 1. Update MEMORY.md with learnings
108
+ 2. Log workflow executions
109
+ 3. If > 200 lines, curate old entries
110
+
111
+ ### Memory Structure
112
+ ```
113
+ .claude/agent-memory/squad/MEMORY.md
114
+ ├── Quick Stats
115
+ ├── Squads Criados
116
+ ├── Minds Já Clonados (cache)
117
+ ├── Patterns que Funcionam
118
+ ├── Decisões Arquiteturais
119
+ ├── Erros Comuns
120
+ └── Notas Recentes
121
+ ```
122
+
123
+ ## Core Principles
124
+
125
+ ### 1. MINDS FIRST
126
+ ALWAYS clone real elite minds, NEVER create generic bots.
127
+ People with skin in the game = consequences = better frameworks.
128
+
129
+ ### 2. RESEARCH BEFORE SUGGESTING
130
+ When user requests a squad:
131
+ 1. IMMEDIATELY start research (no questions first)
132
+ 2. Execute mind-research-loop
133
+ 3. Present curated list of REAL minds
134
+ 4. ONLY THEN ask clarifying questions
135
+
136
+ ### 3. DNA EXTRACTION MANDATORY
137
+ For every mind-based agent:
138
+ 1. Clone mind → extract Voice DNA + Thinking DNA
139
+ 2. Generate mind_dna_complete.yaml
140
+ 3. Create agent using DNA as base
141
+ 4. Validate against quality gates
142
+
143
+ ## Commands
144
+
145
+ | Command | Description |
146
+ |---------|-------------|
147
+ | `*create-squad {domain}` | Create complete squad from scratch |
148
+ | `*clone-mind {name}` | Clone single mind into agent |
149
+ | `*create-agent` | Create agent from DNA |
150
+ | `*validate-squad` | Run quality validation |
151
+ | `*resume` | Continue interrupted workflow |
152
+ | `*status` | Show current state |
153
+ | `*help` | Show all commands |
154
+
155
+ ## Workflow Execution
156
+
157
+ ### Reading Workflows
158
+ I read workflows from `squads/squad-creator/workflows/` as data:
159
+ - `wf-create-squad.yaml` - Master workflow (1300+ lines)
160
+ - `wf-clone-mind.yaml` - Mind cloning pipeline
161
+ - `wf-discover-tools.yaml` - Tool discovery
162
+
163
+ ### State Persistence
164
+ State persisted in `squads/squad-creator/.state.json`:
165
+ ```json
166
+ {
167
+ "workflow": "wf-create-squad",
168
+ "current_phase": "phase_3",
169
+ "inputs": { "domain": "copywriting" },
170
+ "phase_status": { "phase_0": "complete" },
171
+ "subagent_results": {}
172
+ }
173
+ ```
174
+
175
+ ### Checkpoint Handling
176
+ Each phase has checkpoints with:
177
+ - `blocking: true` - Must pass to continue
178
+ - `veto_conditions` - Auto-fail conditions
179
+ - `approval` - Human or auto based on mode
180
+
181
+ ## Specialist Invocation
182
+
183
+ When I need specialists, I invoke them as subagents:
184
+
185
+ ### Invoking @oalanicolas
186
+ ```
187
+ Task: Clone mind for Gary Halbert
188
+ Domain: copywriting
189
+ Sources: docs/research/gary-halbert/
190
+ Output: squads/copy/agents/gary-halbert.md
191
+ Signal: <promise>COMPLETE</promise>
192
+ ```
193
+
194
+ ### Invoking @pedro-valerio
195
+ ```
196
+ Task: Audit workflow wf-create-squad.yaml
197
+ Check: Veto conditions, unidirectional flow, checkpoint coverage
198
+ Output: Validation report
199
+ Signal: <promise>COMPLETE</promise>
200
+ ```
201
+
202
+ ### Completion Detection
203
+ - Subagent MUST end with `<promise>COMPLETE</promise>`
204
+ - SubagentStop hook validates output
205
+ - If missing → retry or escalate
206
+
207
+ ## Auto-Triggers
208
+
209
+ When user mentions squad creation, I:
210
+
211
+ 1. **IMMEDIATELY** start research (NO questions first)
212
+ 2. Execute `workflows/wf-mind-research-loop.yaml`
213
+ 3. Complete ALL 3-5 iterations
214
+ 4. Present curated list of REAL minds
215
+ 5. Ask: "Want me to create agents based on these minds?"
216
+ 6. If yes → Clone each mind → Create agents
217
+
218
+ ### Trigger Patterns
219
+ - "create squad", "create team"
220
+ - "want a squad", "need experts in"
221
+ - "squad de", "time de"
222
+ - "quero um squad", "especialistas em"
223
+
224
+ ### What I NEVER Do Before Research
225
+ - ❌ Ask clarifying questions
226
+ - ❌ Offer options (1, 2, 3)
227
+ - ❌ Propose agent architecture
228
+ - ❌ Suggest agent names
229
+ - ❌ Create any structure
230
+
231
+ ## Quality Gates
232
+
233
+ ### SC_AGT_001: Agent Structure
234
+ - Minimum 300 lines
235
+ - Voice DNA present
236
+ - Output examples included
237
+
238
+ ### SC_AGT_002: Content Completeness
239
+ - All persona levels present
240
+ - Commands documented
241
+ - Dependencies listed
242
+
243
+ ### SC_AGT_003: Depth
244
+ - Frameworks with theory (not just names)
245
+ - Thinking DNA extracted
246
+ - Decision heuristics documented
247
+
248
+ ## Error Handling
249
+
250
+ | Error | Action |
251
+ |-------|--------|
252
+ | Research fails | Retry with different queries |
253
+ | Agent creation fails | Supplement research, retry |
254
+ | Validation fails | Log, attempt fix, escalate if needed |
255
+ | Checkpoint fails (blocking) | Halt, report to human |
256
+ | Checkpoint fails (non-blocking) | Log warning, continue |
257
+
258
+ ## Related Specialists
259
+
260
+ | Specialist | Skill | When to Use |
261
+ |------------|-------|-------------|
262
+ | @oalanicolas | `/squad:oalanicolas` | Mind cloning, DNA extraction |
263
+ | @pedro-valerio | `/squad:pedro-valerio` | Process validation, workflow audit |
264
+ | @sop-extractor | `/squad:sop-extractor` | Extract SOPs from content |
265
+
266
+ ## Quick Start
267
+
268
+ ```
269
+ User: I want a legal squad
270
+
271
+ Squad Architect: I'll research the best legal minds. Starting iterative research...
272
+
273
+ [Executes wf-mind-research-loop.yaml]
274
+ [3-5 iterations with devil's advocate]
275
+
276
+ Squad Architect: Here are the 5 elite legal minds I found:
277
+
278
+ 1. **Ken Adams** - Contract drafting specialist
279
+ - Framework: "A Manual of Style for Contract Drafting"
280
+
281
+ 2. **Brad Feld** - VC/Startup legal
282
+ - Framework: "Term Sheet framework"
283
+
284
+ [...]
285
+
286
+ Want me to create agents based on these minds?
287
+
288
+ User: Yes
289
+
290
+ Squad Architect: Starting mind cloning for each expert...
291
+
292
+ [Invokes @oalanicolas for each mind]
293
+ [Creates agents with extracted DNA]
294
+ [Validates against quality gates]
295
+
296
+ Squad Architect: Legal squad created!
297
+ - Path: squads/legal/
298
+ - Agents: 5
299
+ - Quality Score: 8.5/10
300
+ - Activate with: /legal
301
+ ```
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: synapse
3
+ description: "This skill should be used when users want to understand the SYNAPSE context engine, manage domains, configure context rules, or troubleshoot rule injection. Use when asked about SYNAPSE architecture, domain management, star-commands, context brackets, or the 8-layer processing pipeline."
4
+ ---
5
+
6
+ # SYNAPSE Context Engine
7
+
8
+ ## Overview
9
+
10
+ SYNAPSE (Synkra Adaptive Processing & State Engine) is the unified context engine for AIOX. It injects contextual rules into every prompt via an 8-layer processing pipeline, adapting to context window usage through bracket-aware filtering.
11
+
12
+ **What it does:**
13
+ - Injects rules per-prompt via Claude Code's `UserPromptSubmit` hook
14
+ - Processes 8 layers (L0 Constitution through L7 Star-Commands) sequentially
15
+ - Adapts injection volume based on context brackets (FRESH/MODERATE/DEPLETED/CRITICAL)
16
+ - Integrates with agent state (active agent, workflow, task, squad)
17
+ - Outputs `<synapse-rules>` XML block appended to each prompt
18
+
19
+ **What it replaces:** SYNAPSE replaces the legacy CARL system with full feature parity plus 8 new capabilities including agent-scoped domains, workflow activation, and CRUD management commands.
20
+
21
+ **Architecture model:** Open Core — the 8-layer engine lives in `aiox-core` (open source), memory integration is feature-gated in `aiox-pro`.
22
+
23
+ ## Quick Start
24
+
25
+ ### Verify SYNAPSE is Active
26
+
27
+ SYNAPSE runs automatically via the Claude Code hook. To check status:
28
+
29
+ ```
30
+ *synapse status
31
+ ```
32
+
33
+ This shows: active domains, current bracket, session info, and loaded layers.
34
+
35
+ ### Basic Commands
36
+
37
+ | Command | What it does |
38
+ |---------|-------------|
39
+ | `*synapse status` | Show current engine state |
40
+ | `*synapse domains` | List all registered domains |
41
+ | `*synapse debug` | Show detailed debug info (manifest parse, load times, rule counts) |
42
+ | `*synapse help` | Show all available synapse commands |
43
+ | `*brief` | Switch to brief response mode |
44
+ | `*dev` | Switch to developer mode (code-focused) |
45
+ | `*review` | Switch to code review mode |
46
+
47
+ ### Create a Custom Domain
48
+
49
+ ```
50
+ *synapse create
51
+ ```
52
+
53
+ This walks you through creating a new domain file + manifest entry. See [references/domains.md](references/domains.md) for the full domain guide.
54
+
55
+ ## Architecture
56
+
57
+ SYNAPSE operates as a 4-layer architecture:
58
+
59
+ ```
60
+ .claude/hooks/synapse-engine.js # Layer 1: Hook Entry (~50 lines)
61
+ |
62
+ v imports
63
+ .aiox-core/core/synapse/ # Layer 2: Engine Modules
64
+ |-- engine.js # SynapseEngine class
65
+ |-- layers/ # 8 layer processors (L0-L7)
66
+ |-- session/session-manager.js # Session state (JSON v2.0)
67
+ |-- domain/domain-loader.js # Manifest + domain parser
68
+ |-- context/context-tracker.js # Bracket calculation
69
+ |-- memory/memory-bridge.js # Pro-gated MIS consumer
70
+ |-- output/formatter.js # <synapse-rules> XML
71
+ |
72
+ v reads/writes
73
+ .synapse/ # Layer 3: Runtime Data
74
+ |-- manifest # Central domain registry (KEY=VALUE)
75
+ |-- constitution, global, context # Core domains (L0, L1)
76
+ |-- agent-*, workflow-* # Scoped domains (L2, L3)
77
+ |-- commands # Star-command definitions (L7)
78
+ |-- sessions/, cache/ # Session state (gitignored)
79
+ |
80
+ v user-invoked
81
+ .claude/commands/synapse/ # Layer 4: CRUD Commands + Skill Docs
82
+ |-- manager.md # Router/dispatcher
83
+ |-- tasks/ (6 tasks) # create, add, edit, toggle, command, suggest
84
+ ```
85
+
86
+ **Key principle:** SYNAPSE is a **consumer** of existing systems (UAP for session state, MIS for memories). It never rewrites code from other epics.
87
+
88
+ ## References
89
+
90
+ ### Reference Guides
91
+
92
+ | Guide | Description |
93
+ |-------|-------------|
94
+ | [domains.md](references/domains.md) | Domain types (L0-L7), KEY=VALUE format, creation guide |
95
+ | [commands.md](references/commands.md) | Star-commands, *synapse sub-commands, CRUD operations |
96
+ | [manifest.md](references/manifest.md) | Manifest format specification, all valid keys |
97
+ | [brackets.md](references/brackets.md) | Context bracket system, token budgets, layer activation |
98
+ | [layers.md](references/layers.md) | 8-layer processor architecture, priority, conflict resolution |
99
+
100
+ ### Assets (Templates)
101
+
102
+ Templates for creating custom domains and manifest entries are maintained at:
103
+
104
+ - **Domain template:** `.claude/commands/synapse/templates/domain-template`
105
+ - **Manifest entry template:** `.claude/commands/synapse/templates/manifest-entry-template`
106
+
107
+ See [assets/README.md](assets/README.md) for details.
108
+
109
+ ### CRUD Commands
110
+
111
+ For domain management operations, use the SYNAPSE manager:
112
+
113
+ | Command | Purpose |
114
+ |---------|---------|
115
+ | `*synapse create` | Create new domain + manifest entry |
116
+ | `*synapse add` | Add rule to existing domain |
117
+ | `*synapse edit` | Edit or remove rule by index |
118
+ | `*synapse toggle` | Toggle domain active/inactive |
119
+ | `*synapse command` | Create new star-command |
120
+ | `*synapse suggest` | Suggest best domain for a rule |
121
+
122
+ Full details: [references/commands.md](references/commands.md)
123
+
124
+ ## Key Files
125
+
126
+ | File | Purpose |
127
+ |------|---------|
128
+ | `.claude/hooks/synapse-engine.js` | Hook entry point (UserPromptSubmit) |
129
+ | `.aiox-core/core/synapse/engine.js` | SynapseEngine orchestrator |
130
+ | `.synapse/manifest` | Domain registry (KEY=VALUE) |
131
+ | `.synapse/commands` | Star-command definitions |
132
+ | `.claude/commands/synapse/manager.md` | CRUD command router |
@@ -0,0 +1,50 @@
1
+ # SYNAPSE Assets
2
+
3
+ Templates for creating custom SYNAPSE domains and manifest entries.
4
+
5
+ ## Templates Location
6
+
7
+ Templates are maintained as the single source of truth in the CRUD commands directory:
8
+
9
+ | Template | Location |
10
+ |----------|----------|
11
+ | **Domain template** | `.claude/commands/synapse/templates/domain-template` |
12
+ | **Manifest entry template** | `.claude/commands/synapse/templates/manifest-entry-template` |
13
+
14
+ These templates are used by the `*synapse create` command to scaffold new domains.
15
+
16
+ ## Usage
17
+
18
+ To create a new domain using these templates, run:
19
+
20
+ ```
21
+ *synapse create
22
+ ```
23
+
24
+ Or reference the templates directly when creating domains manually.
25
+
26
+ ## Template Formats
27
+
28
+ ### Domain Template
29
+
30
+ ```
31
+ # ==========================================
32
+ # SYNAPSE Domain: {DOMAIN_NAME}
33
+ # Created: {CURRENT_DATE}
34
+ # Description: {DESCRIPTION}
35
+ # ==========================================
36
+
37
+ # Rules
38
+ {DOMAIN_KEY}_RULE_0={FIRST_RULE}
39
+ ```
40
+
41
+ ### Manifest Entry Template
42
+
43
+ ```
44
+ # Layer 6: {domain-name}
45
+ {DOMAIN_KEY}_STATE=active
46
+ {DOMAIN_KEY}_RECALL={KEYWORDS}
47
+ {DOMAIN_KEY}_EXCLUDE=
48
+ ```
49
+
50
+ For the complete KEY=VALUE format specification, see [../references/manifest.md](../references/manifest.md).
@@ -0,0 +1,100 @@
1
+ # SYNAPSE Context Brackets Reference
2
+
3
+ ## Overview
4
+
5
+ Context brackets control how much content SYNAPSE injects per prompt based on how much context window remains. As the conversation progresses and context fills up, SYNAPSE adapts by changing which layers are active and how many tokens it injects.
6
+
7
+ The bracket system is implemented in `.aiox-core/core/synapse/context/context-tracker.js`.
8
+
9
+ ## The 4 Brackets
10
+
11
+ | Bracket | Context Remaining | Token Budget | Behavior |
12
+ |---------|-------------------|-------------|----------|
13
+ | **FRESH** | 60-100% | ~800 tokens | Lean injection — essentials only |
14
+ | **MODERATE** | 40-60% | ~1500 tokens | Standard injection — all layers active |
15
+ | **DEPLETED** | 25-40% | ~2000 tokens | Reinforcement — reinforce critical rules, memory hints enabled |
16
+ | **CRITICAL** | <25% | ~2500 tokens | Handoff warning — recommend session handoff, document state |
17
+
18
+ ## How Brackets Are Calculated
19
+
20
+ The context tracker estimates remaining context using:
21
+
22
+ ```
23
+ contextPercent = 100 - ((promptCount * avgTokensPerPrompt) / maxContext * 100)
24
+ ```
25
+
26
+ **Default values:**
27
+ - `avgTokensPerPrompt`: 1500
28
+ - `maxContext`: 200000 (Claude's context window)
29
+
30
+ **Bracket assignment:**
31
+ - `contextPercent >= 60` → FRESH
32
+ - `contextPercent >= 40` → MODERATE
33
+ - `contextPercent >= 25` → DEPLETED
34
+ - `contextPercent < 25` → CRITICAL
35
+
36
+ Invalid or NaN input defaults to CRITICAL (fail-safe).
37
+
38
+ ## Layer Activation per Bracket
39
+
40
+ | Bracket | Active Layers | Memory Hints | Handoff Warning |
41
+ |---------|---------------|-------------|-----------------|
42
+ | **FRESH** | L0, L1, L2, L7 | No | No |
43
+ | **MODERATE** | L0-L7 (all) | No | No |
44
+ | **DEPLETED** | L0-L7 (all) | Yes | No |
45
+ | **CRITICAL** | L0-L7 (all) | Yes | Yes |
46
+
47
+ **Key behavior:**
48
+ - **FRESH**: Only core layers (Constitution, Global, Agent, Star-Commands) — saves tokens early
49
+ - **MODERATE**: Full layer stack activated — normal operation
50
+ - **DEPLETED**: Memory hints from MIS enabled (when pro available) to reinforce context
51
+ - **CRITICAL**: Handoff warning injected, recommending session continuation in new window
52
+
53
+ ## Bracket-Specific Rules
54
+
55
+ The `.synapse/context` domain file contains rules that vary by bracket:
56
+
57
+ ### FRESH Rules
58
+ - Minimize injected rules to essentials only
59
+ - Avoid redundant context — agent has full conversation history
60
+ - Full layer stack available but lean injection
61
+
62
+ ### MODERATE Rules
63
+ - All layers active at normal priority
64
+ - Monitor token usage — consider summarizing long outputs
65
+ - Prefer concise code examples over verbose explanations
66
+
67
+ ### DEPLETED Rules
68
+ - Reinforce critical rules and constraints
69
+ - Prefer concise responses to save tokens
70
+ - Skip optional layers (L6 keyword domains) to conserve
71
+ - Summarize progress before each action
72
+
73
+ ### CRITICAL Rules
74
+ - Recommend session handoff
75
+ - Summarize current state for new session continuation
76
+ - Only inject L0 Constitution and L1 Global rules — skip other layers
77
+ - Document incomplete work in story file
78
+
79
+ ## Token Budget Enforcement
80
+
81
+ The output formatter (`.aiox-core/core/synapse/output/formatter.js`) enforces token budgets:
82
+
83
+ 1. Each bracket has a max token budget (800 / 1500 / 2000 / 2500)
84
+ 2. Sections are rendered in priority order (CONSTITUTION first, SUMMARY last)
85
+ 3. When budget is exceeded, sections are truncated from the end (lowest priority first)
86
+
87
+ **Truncation order** (last removed first):
88
+ ```
89
+ SUMMARY → KEYWORD → SQUAD → TASK → WORKFLOW → AGENT → CONSTITUTION
90
+ ```
91
+
92
+ Constitution (L0) is never truncated.
93
+
94
+ ## Source Files
95
+
96
+ | File | Purpose |
97
+ |------|---------|
98
+ | `.aiox-core/core/synapse/context/context-tracker.js` | Bracket calculation, token budgets, layer configs |
99
+ | `.synapse/context` | Bracket-specific context rules (L1) |
100
+ | `.aiox-core/core/synapse/output/formatter.js` | Token budget enforcement + truncation |
@@ -0,0 +1,118 @@
1
+ # SYNAPSE Commands Reference
2
+
3
+ ## Overview
4
+
5
+ SYNAPSE provides three categories of commands:
6
+ 1. **Mode star-commands** — Switch response behavior (`*brief`, `*dev`, etc.)
7
+ 2. **`*synapse` sub-commands** — Query and manage engine state
8
+ 3. **CRUD operations** — Create, modify, and manage domains and rules
9
+
10
+ ## Mode Star-Commands (L7)
11
+
12
+ These commands switch the response mode for the current session. They are detected by L7 (Star-Command processor) and inject mode-specific rules.
13
+
14
+ | Command | Behavior |
15
+ |---------|----------|
16
+ | `*brief` | Bullet points only, max 5 items, no code blocks unless requested, skip preamble |
17
+ | `*dev` | Code over explanation, minimal changes, follow existing patterns, skip docs unless needed |
18
+ | `*review` | Check code quality and patterns, identify bugs/security issues, suggest improvements with rationale |
19
+ | `*plan` | Outline approach before implementation, list files to modify, identify risks, estimate complexity |
20
+ | `*discuss` | Explore trade-offs and alternatives, ask clarifying questions, present pros/cons, recommend with reasoning |
21
+ | `*debug` | Analyze error messages and stack traces, check common failure patterns, suggest targeted fixes |
22
+ | `*explain` | Explain in teaching detail, use analogies, show examples with code, build from basics to advanced |
23
+
24
+ **Usage:** Type the command anywhere in your prompt. The mode persists for that response.
25
+
26
+ **Source:** `.synapse/commands` (KEY=VALUE format, `COMMANDS_RULE_{MODE}_{INDEX}`)
27
+
28
+ ## `*synapse` Sub-Commands
29
+
30
+ These commands query or control the SYNAPSE engine state.
31
+
32
+ | Command | What it does |
33
+ |---------|-------------|
34
+ | `*synapse help` | Show available synapse commands and their descriptions |
35
+ | `*synapse status` | Display current state: active domains, layers, session info |
36
+ | `*synapse debug` | Show detailed debug info: manifest parse results, domain load times, rule counts |
37
+ | `*synapse domains` | List all registered domains with their state and trigger conditions |
38
+ | `*synapse session` | Show current session context: active agent, workflow, bracket level |
39
+ | `*synapse reload` | Force reload of manifest and all domain files from disk |
40
+
41
+ **Note:** These are read-only operations handled by the L7 star-command processor in the hook. They do not modify any files.
42
+
43
+ ## CRUD Operations
44
+
45
+ These commands modify domain files and the manifest. They are implemented as Claude Code slash commands in `.claude/commands/synapse/`.
46
+
47
+ ### Router
48
+
49
+ All CRUD operations go through the manager: `.claude/commands/synapse/manager.md`
50
+
51
+ The manager parses the sub-command and dispatches to the appropriate task file.
52
+
53
+ ### Available Operations
54
+
55
+ | Command | Task File | Purpose |
56
+ |---------|-----------|---------|
57
+ | `*synapse create` | `tasks/create-domain.md` | Create new domain file + manifest entry |
58
+ | `*synapse add` | `tasks/add-rule.md` | Add a new rule to an existing domain |
59
+ | `*synapse edit` | `tasks/edit-rule.md` | Edit or remove a rule by index |
60
+ | `*synapse toggle` | `tasks/toggle-domain.md` | Toggle domain STATE between active/inactive |
61
+ | `*synapse command` | `tasks/create-command.md` | Create a new star-command definition |
62
+ | `*synapse suggest` | `tasks/suggest-domain.md` | Suggest the best domain for a given rule |
63
+
64
+ ### Usage Examples
65
+
66
+ **Create a new domain:**
67
+ ```
68
+ *synapse create
69
+ ```
70
+ Prompts for: domain name, layer, description, initial rules.
71
+
72
+ **Add a rule to an existing domain:**
73
+ ```
74
+ *synapse add global "Always prefer functional patterns over imperative"
75
+ ```
76
+
77
+ **Toggle a domain off:**
78
+ ```
79
+ *synapse toggle agent-dev
80
+ ```
81
+
82
+ **Edit a specific rule:**
83
+ ```
84
+ *synapse edit global 3
85
+ ```
86
+ Opens rule at index 3 in `global` domain for editing.
87
+
88
+ **Create a new star-command:**
89
+ ```
90
+ *synapse command
91
+ ```
92
+ Prompts for: command name, behavior rules.
93
+
94
+ **Get domain suggestion for a rule:**
95
+ ```
96
+ *synapse suggest "Use TypeScript strict mode"
97
+ ```
98
+ Analyzes the rule content and suggests the best-fit domain.
99
+
100
+ ## Command Categories Summary
101
+
102
+ ```
103
+ Automatic per-event -> HOOK (synapse-engine.js, UserPromptSubmit)
104
+ User guidance/learning -> SKILL (synapse/SKILL.md + references)
105
+ User-invoked CRUD -> COMMAND (synapse/manager.md + 6 tasks)
106
+ Read-state star-cmds -> HOOK L7 (*synapse status, *synapse debug, *brief, *dev)
107
+ Write-file star-cmds -> COMMAND (*synapse create, *synapse add, *synapse toggle)
108
+ ```
109
+
110
+ ## Source Files
111
+
112
+ | File | Purpose |
113
+ |------|---------|
114
+ | `.synapse/commands` | Star-command rule definitions (L7) |
115
+ | `.claude/commands/synapse/manager.md` | CRUD command router |
116
+ | `.claude/commands/synapse/tasks/*.md` | Individual CRUD task workflows |
117
+ | `.claude/commands/synapse/templates/` | Domain and manifest templates |
118
+ | `.claude/commands/synapse/utils/manifest-parser-reference.md` | Parser format reference |