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,126 @@
1
+ # SYNAPSE Domains Reference
2
+
3
+ ## What is a Domain?
4
+
5
+ A domain is a text file containing KEY=VALUE rules that SYNAPSE injects into prompts. Each domain maps to a specific layer (L0-L7) and is registered in the manifest file (`.synapse/manifest`).
6
+
7
+ Domains live in `.synapse/` and use a simple KEY=VALUE format with comments.
8
+
9
+ ## Domain Types by Layer
10
+
11
+ | Layer | Type | Trigger | Example Files |
12
+ |-------|------|---------|---------------|
13
+ | L0 | Constitution | Always active (`ALWAYS_ON=true`, `NON_NEGOTIABLE=true`) | `constitution` |
14
+ | L1 | Global | Always active (`ALWAYS_ON=true`) | `global`, `context` |
15
+ | L2 | Agent-scoped | Active agent matches `AGENT_TRIGGER` | `agent-dev`, `agent-qa`, `agent-architect` |
16
+ | L3 | Workflow-scoped | Active workflow matches `WORKFLOW_TRIGGER` | `workflow-story-dev`, `workflow-epic-create` |
17
+ | L4 | Task context | Active task detected in session | (injected dynamically) |
18
+ | L5 | Squad discovery | Squad is active in session | (squad domains) |
19
+ | L6 | Keyword (RECALL) | User prompt contains keyword from `RECALL` field | (keyword-triggered domains) |
20
+ | L7 | Star-commands | User types `*command` in prompt | `commands` |
21
+
22
+ ## KEY=VALUE Format
23
+
24
+ ### Syntax Rules
25
+
26
+ ```
27
+ # Comments start with #
28
+ # Empty lines are ignored
29
+
30
+ # Keys use SCREAMING_SNAKE_CASE with domain prefix
31
+ DOMAINPREFIX_RULE_0=First rule text
32
+ DOMAINPREFIX_RULE_1=Second rule text
33
+
34
+ # Grouped comments describe rule sections
35
+ # [section-name] COMMAND:
36
+ # 0. First behavior
37
+ # 1. Second behavior
38
+ ```
39
+
40
+ ### Key Naming Convention
41
+
42
+ ```
43
+ {DOMAIN_KEY}_RULE_{INDEX}={RULE_TEXT}
44
+ ```
45
+
46
+ - `DOMAIN_KEY`: Unique prefix matching manifest registration (e.g., `CONSTITUTION`, `GLOBAL`, `AGENT_DEV`)
47
+ - `RULE`: Literal word `RULE` (or `STATE`, `ALWAYS_ON`, etc. for manifest keys)
48
+ - `INDEX`: Zero-based integer or descriptive suffix
49
+ - `RULE_TEXT`: Plain text rule content
50
+
51
+ ### Example: Agent Domain
52
+
53
+ ```
54
+ # SYNAPSE Agent Domain: @dev (L2)
55
+ # Agent-scoped rules for developer agent
56
+ # Source: .aiox-core/development/agents/dev.md
57
+
58
+ AGENT_DEV_RULE_0=Follow story tasks sequentially — read task, implement, test, mark [x]
59
+ AGENT_DEV_RULE_1=ONLY update Dev Agent Record sections in story files
60
+ AGENT_DEV_RULE_2=Run CodeRabbit pre-commit review before marking story complete
61
+ ```
62
+
63
+ ### Example: Workflow Domain
64
+
65
+ ```
66
+ # SYNAPSE Workflow Domain: Story Development (L3)
67
+
68
+ WORKFLOW_STORY_DEV_RULE_0=Follow SDC phases: Create → Validate → Implement → QA Gate
69
+ WORKFLOW_STORY_DEV_RULE_1=Update story checkboxes as tasks complete
70
+ ```
71
+
72
+ ## Manifest Registration
73
+
74
+ Every domain must be registered in `.synapse/manifest`. The manifest uses the same KEY=VALUE format:
75
+
76
+ ### Required Manifest Keys
77
+
78
+ | Key | Purpose | Example |
79
+ |-----|---------|---------|
80
+ | `{PREFIX}_STATE` | Domain active state (`active` or `inactive`) | `AGENT_DEV_STATE=active` |
81
+
82
+ ### Optional Manifest Keys
83
+
84
+ | Key | Purpose | Example |
85
+ |-----|---------|---------|
86
+ | `{PREFIX}_ALWAYS_ON` | Domain always loaded (L0, L1) | `CONSTITUTION_ALWAYS_ON=true` |
87
+ | `{PREFIX}_NON_NEGOTIABLE` | Cannot be overridden (L0 only) | `CONSTITUTION_NON_NEGOTIABLE=true` |
88
+ | `{PREFIX}_AGENT_TRIGGER` | Activate when agent matches (L2) | `AGENT_DEV_AGENT_TRIGGER=dev` |
89
+ | `{PREFIX}_WORKFLOW_TRIGGER` | Activate when workflow matches (L3) | `WORKFLOW_STORY_DEV_WORKFLOW_TRIGGER=story_development` |
90
+ | `{PREFIX}_RECALL` | Keywords that trigger domain (L6) | `MYLIB_RECALL=react,hooks` |
91
+ | `{PREFIX}_EXCLUDE` | Agents/contexts to exclude from | `MYLIB_EXCLUDE=qa` |
92
+
93
+ ### Current Manifest Domains
94
+
95
+ The manifest at `.synapse/manifest` registers:
96
+ - 1 Constitution domain (L0, NON_NEGOTIABLE, ALWAYS_ON)
97
+ - 2 Global domains (L1, ALWAYS_ON): `global`, `context`
98
+ - 1 Commands domain (L7): `commands`
99
+ - 12 Agent domains (L2): one per core agent (`agent-dev`, `agent-qa`, etc.)
100
+ - 3 Workflow domains (L3): `workflow-story-dev`, `workflow-epic-create`, `workflow-arch-review`
101
+
102
+ ## Creating Custom Domains
103
+
104
+ Use the CRUD command to create a new domain:
105
+
106
+ ```
107
+ *synapse create
108
+ ```
109
+
110
+ This will:
111
+ 1. Ask for domain name, layer, and description
112
+ 2. Create the domain file in `.synapse/`
113
+ 3. Add the manifest entry to `.synapse/manifest`
114
+ 4. Validate the format is parseable by domain-loader
115
+
116
+ For the domain file template, see: `.claude/commands/synapse/templates/domain-template`
117
+
118
+ For the manifest entry template, see: `.claude/commands/synapse/templates/manifest-entry-template`
119
+
120
+ ## Source Files
121
+
122
+ | File | Purpose |
123
+ |------|---------|
124
+ | `.synapse/manifest` | Central domain registry |
125
+ | `.synapse/*` | Domain content files |
126
+ | `.aiox-core/core/synapse/domain/domain-loader.js` | Domain parser (SYN-1) |
@@ -0,0 +1,186 @@
1
+ # SYNAPSE 8-Layer Architecture Reference
2
+
3
+ ## Overview
4
+
5
+ SYNAPSE processes rules through an 8-layer pipeline executed sequentially on every prompt. Each layer has a specific purpose, trigger condition, and priority level. The engine orchestrator (`.aiox-core/core/synapse/engine.js`) chains all layers and the output formatter produces the final `<synapse-rules>` XML block.
6
+
7
+ ## Layer Pipeline
8
+
9
+ ```
10
+ L0 Constitution → L1 Global → L2 Agent → L3 Workflow → L4 Task → L5 Squad → L6 Keyword → L7 Star-Command
11
+ ```
12
+
13
+ Layers execute in order. Each layer's output is collected and passed to the formatter.
14
+
15
+ ## Layer Details
16
+
17
+ ### L0: Constitution (NON-NEGOTIABLE)
18
+
19
+ | Property | Value |
20
+ |----------|-------|
21
+ | **Purpose** | Enforce inviolable framework principles (6 articles) |
22
+ | **Trigger** | Always active (`ALWAYS_ON=true`, `NON_NEGOTIABLE=true`) |
23
+ | **Priority** | Highest — cannot be overridden by any other layer |
24
+ | **Domain file** | `.synapse/constitution` |
25
+ | **Source** | Auto-generated from `.aiox-core/constitution.md` via `generate-constitution.js` |
26
+ | **Implementation** | `.aiox-core/core/synapse/layers/l0-constitution.js` |
27
+
28
+ **Articles:** CLI First, Agent Authority, Story-Driven Development, No Invention, Quality First, Absolute Imports.
29
+
30
+ ### L1: Global + Context
31
+
32
+ | Property | Value |
33
+ |----------|-------|
34
+ | **Purpose** | Universal rules applied to all prompts + bracket-specific behavior |
35
+ | **Trigger** | Always active (`ALWAYS_ON=true`) |
36
+ | **Priority** | High — applies to every prompt regardless of context |
37
+ | **Domain files** | `.synapse/global`, `.synapse/context` |
38
+ | **Implementation** | `.aiox-core/core/synapse/layers/l1-global.js` |
39
+
40
+ **Content:** Coding standards, import rules, TypeScript rules, error handling patterns, bracket-specific context rules.
41
+
42
+ ### L2: Agent-Scoped
43
+
44
+ | Property | Value |
45
+ |----------|-------|
46
+ | **Purpose** | Inject agent-specific rules when an agent is active |
47
+ | **Trigger** | `AGENT_TRIGGER` matches active agent ID from session |
48
+ | **Priority** | Medium-high — only active when agent is activated |
49
+ | **Domain files** | `.synapse/agent-dev`, `.synapse/agent-qa`, `.synapse/agent-architect`, etc. (12 total) |
50
+ | **Implementation** | `.aiox-core/core/synapse/layers/l2-agent.js` |
51
+
52
+ **Agents covered:** dev, qa, architect, pm, po, sm, devops, analyst, data-engineer, ux (ux-design-expert), aiox-master, squad-creator.
53
+
54
+ ### L3: Workflow-Scoped
55
+
56
+ | Property | Value |
57
+ |----------|-------|
58
+ | **Purpose** | Inject workflow-specific rules when a workflow is active |
59
+ | **Trigger** | `WORKFLOW_TRIGGER` matches active workflow from session |
60
+ | **Priority** | Medium — active during specific development workflows |
61
+ | **Domain files** | `.synapse/workflow-story-dev`, `.synapse/workflow-epic-create`, `.synapse/workflow-arch-review` |
62
+ | **Implementation** | `.aiox-core/core/synapse/layers/l3-workflow.js` |
63
+
64
+ ### L4: Task Context
65
+
66
+ | Property | Value |
67
+ |----------|-------|
68
+ | **Purpose** | Inject context about the currently active task |
69
+ | **Trigger** | Active task detected in session state |
70
+ | **Priority** | Medium — active during task execution |
71
+ | **Domain files** | Dynamic (injected from session context) |
72
+ | **Implementation** | `.aiox-core/core/synapse/layers/l4-task.js` |
73
+
74
+ ### L5: Squad Discovery
75
+
76
+ | Property | Value |
77
+ |----------|-------|
78
+ | **Purpose** | Discover and inject rules from active squad domains |
79
+ | **Trigger** | Squad is active in session |
80
+ | **Priority** | Medium-low — only when working with squads |
81
+ | **Domain files** | Squad-specific domains (discovered at runtime) |
82
+ | **Implementation** | `.aiox-core/core/synapse/layers/l5-squad.js` |
83
+
84
+ ### L6: Keyword (RECALL)
85
+
86
+ | Property | Value |
87
+ |----------|-------|
88
+ | **Purpose** | Activate domains when user prompt contains matching keywords |
89
+ | **Trigger** | User prompt contains keyword listed in domain's `RECALL` field |
90
+ | **Priority** | Low — optional, skipped in DEPLETED bracket to conserve tokens |
91
+ | **Domain files** | Any domain with `RECALL` key in manifest |
92
+ | **Implementation** | `.aiox-core/core/synapse/layers/l6-keyword.js` |
93
+
94
+ ### L7: Star-Command
95
+
96
+ | Property | Value |
97
+ |----------|-------|
98
+ | **Purpose** | Detect and inject mode-switching commands (`*brief`, `*dev`, `*synapse status`, etc.) |
99
+ | **Trigger** | User types `*command` in prompt |
100
+ | **Priority** | Highest for explicit commands — user intent is paramount |
101
+ | **Domain file** | `.synapse/commands` |
102
+ | **Implementation** | `.aiox-core/core/synapse/layers/l7-star-command.js` |
103
+
104
+ ## Pipeline Execution Flow
105
+
106
+ ```
107
+ 1. Hook receives UserPromptSubmit event (stdin JSON)
108
+ 2. Engine calculates context bracket (prompt count → percent → bracket)
109
+ 3. Engine determines active layers for current bracket
110
+ 4. For each active layer (L0 → L7):
111
+ a. Layer processor loads relevant domain(s)
112
+ b. Rules are filtered/resolved
113
+ c. Layer output is collected
114
+ 5. Memory bridge consulted (if pro available, DEPLETED/CRITICAL brackets)
115
+ 6. Formatter assembles <synapse-rules> XML within token budget
116
+ 7. Output written to stdout (appended to user prompt)
117
+ ```
118
+
119
+ ## Conflict Resolution
120
+
121
+ When rules from different layers conflict:
122
+
123
+ 1. **NON_NEGOTIABLE wins** — L0 Constitution rules cannot be overridden
124
+ 2. **Higher layer number = more specific** — L7 Star-Command overrides L1 Global for the current prompt
125
+ 3. **Agent > Global** — L2 agent-scoped rules take precedence over L1 global rules
126
+ 4. **Workflow > Agent** — L3 workflow rules can augment L2 agent rules
127
+ 5. **Explicit > Implicit** — Star-commands (explicit user intent) override automatic rules
128
+
129
+ ## Output Format
130
+
131
+ The formatter produces XML output:
132
+
133
+ ```xml
134
+ <synapse-rules>
135
+ [CONTEXT BRACKET: MODERATE] 40-60% context remaining — all layers active
136
+ [CONSTITUTION] (NON-NEGOTIABLE) CLI First | Agent Authority | Story-Driven | No Invention | Quality First | Absolute Imports
137
+ [ACTIVE AGENT: @dev] Follow story tasks, update Dev Agent Record only, CodeRabbit pre-commit
138
+ [ACTIVE WORKFLOW: story_development] Follow SDC phases, update checkboxes
139
+ [TASK CONTEXT] Current task details
140
+ [SQUAD: mmos] Squad-specific rules
141
+ [STAR-COMMANDS] *dev: Code over explanation, minimal changes
142
+ [DEVMODE STATUS] Pipeline metrics (if DEVMODE=true)
143
+ [LOADED DOMAINS SUMMARY] constitution, global, context, agent-dev, workflow-story-dev, commands
144
+ </synapse-rules>
145
+ ```
146
+
147
+ **Section ordering** (highest priority first):
148
+ 1. CONTEXT_BRACKET
149
+ 2. CONSTITUTION
150
+ 3. AGENT
151
+ 4. WORKFLOW
152
+ 5. TASK
153
+ 6. SQUAD
154
+ 7. KEYWORD
155
+ 8. MEMORY_HINTS
156
+ 9. STAR_COMMANDS
157
+ 10. DEVMODE
158
+ 11. SUMMARY
159
+
160
+ ## Performance Targets
161
+
162
+ | Metric | Target | Hard Limit |
163
+ |--------|--------|------------|
164
+ | Total pipeline | <70ms | <100ms |
165
+ | Individual layer | <15ms | <20ms (L0/L7: <5ms) |
166
+ | Startup (.synapse/ discovery) | <5ms | <10ms |
167
+ | Session I/O | <10ms | <15ms |
168
+
169
+ **Timeout behavior:** If any layer exceeds its time limit, it is skipped with a warning. The pipeline never blocks the prompt.
170
+
171
+ ## Source Files
172
+
173
+ | File | Purpose |
174
+ |------|---------|
175
+ | `.aiox-core/core/synapse/engine.js` | SynapseEngine orchestrator |
176
+ | `.aiox-core/core/synapse/layers/l0-constitution.js` | L0 processor |
177
+ | `.aiox-core/core/synapse/layers/l1-global.js` | L1 processor |
178
+ | `.aiox-core/core/synapse/layers/l2-agent.js` | L2 processor |
179
+ | `.aiox-core/core/synapse/layers/l3-workflow.js` | L3 processor |
180
+ | `.aiox-core/core/synapse/layers/l4-task.js` | L4 processor |
181
+ | `.aiox-core/core/synapse/layers/l5-squad.js` | L5 processor |
182
+ | `.aiox-core/core/synapse/layers/l6-keyword.js` | L6 processor |
183
+ | `.aiox-core/core/synapse/layers/l7-star-command.js` | L7 processor |
184
+ | `.aiox-core/core/synapse/layers/layer-processor.js` | Abstract base class |
185
+ | `.aiox-core/core/synapse/output/formatter.js` | XML formatter + token budget |
186
+ | `.claude/hooks/synapse-engine.js` | Hook entry point |
@@ -0,0 +1,142 @@
1
+ # SYNAPSE Manifest Reference
2
+
3
+ ## Overview
4
+
5
+ The manifest (`.synapse/manifest`) is the central registry for all SYNAPSE domains. It uses a KEY=VALUE format and determines which domains are loaded, when they activate, and how they behave.
6
+
7
+ The manifest is parsed by `domain-loader.js` (`.aiox-core/core/synapse/domain/domain-loader.js`) on every prompt.
8
+
9
+ ## File Format
10
+
11
+ ```
12
+ # Comments start with #
13
+ # Empty lines are ignored
14
+
15
+ # Debug mode toggle
16
+ DEVMODE=false
17
+
18
+ # Domain registration: {PREFIX}_{KEY}={VALUE}
19
+ CONSTITUTION_STATE=active
20
+ CONSTITUTION_ALWAYS_ON=true
21
+ CONSTITUTION_NON_NEGOTIABLE=true
22
+ ```
23
+
24
+ ## Valid Keys
25
+
26
+ Every domain is identified by a unique prefix (e.g., `CONSTITUTION`, `GLOBAL`, `AGENT_DEV`). The following keys are valid for each prefix:
27
+
28
+ ### Required Keys
29
+
30
+ | Key | Type | Description |
31
+ |-----|------|-------------|
32
+ | `{PREFIX}_STATE` | `active` \| `inactive` | Whether the domain is loaded. Required for every domain. |
33
+
34
+ ### Optional Keys
35
+
36
+ | Key | Type | Description | Used By |
37
+ |-----|------|-------------|---------|
38
+ | `{PREFIX}_ALWAYS_ON` | `true` \| `false` | Domain always loaded regardless of context | L0, L1 |
39
+ | `{PREFIX}_NON_NEGOTIABLE` | `true` \| `false` | Rules cannot be overridden by other layers | L0 only |
40
+ | `{PREFIX}_AGENT_TRIGGER` | agent ID string | Activate when this agent is active | L2 |
41
+ | `{PREFIX}_WORKFLOW_TRIGGER` | workflow ID string | Activate when this workflow is active | L3 |
42
+ | `{PREFIX}_RECALL` | comma-separated keywords | Activate when user prompt contains keyword | L6 |
43
+ | `{PREFIX}_EXCLUDE` | comma-separated values | Contexts/agents to exclude domain from | Any |
44
+
45
+ ### Global Key
46
+
47
+ | Key | Type | Description |
48
+ |-----|------|-------------|
49
+ | `DEVMODE` | `true` \| `false` | Enable debug metrics in output |
50
+
51
+ ## Complete Manifest Example
52
+
53
+ Below is the current manifest structure (from `.synapse/manifest`):
54
+
55
+ ```
56
+ # Debug mode
57
+ DEVMODE=false
58
+
59
+ # Layer 0: Constitution (NON-NEGOTIABLE)
60
+ CONSTITUTION_STATE=active
61
+ CONSTITUTION_ALWAYS_ON=true
62
+ CONSTITUTION_NON_NEGOTIABLE=true
63
+
64
+ # Layer 1: Global (ALWAYS_ON)
65
+ GLOBAL_STATE=active
66
+ GLOBAL_ALWAYS_ON=true
67
+
68
+ # Layer 1: Context brackets (ALWAYS_ON)
69
+ CONTEXT_STATE=active
70
+ CONTEXT_ALWAYS_ON=true
71
+
72
+ # Layer 7: Star-commands
73
+ COMMANDS_STATE=active
74
+
75
+ # Layer 2: Agent-scoped domains
76
+ AGENT_DEV_STATE=active
77
+ AGENT_DEV_AGENT_TRIGGER=dev
78
+ AGENT_QA_STATE=active
79
+ AGENT_QA_AGENT_TRIGGER=qa
80
+ AGENT_ARCHITECT_STATE=active
81
+ AGENT_ARCHITECT_AGENT_TRIGGER=architect
82
+ # ... (12 agent domains total)
83
+
84
+ # Layer 3: Workflow domains
85
+ WORKFLOW_STORY_DEV_STATE=active
86
+ WORKFLOW_STORY_DEV_WORKFLOW_TRIGGER=story_development
87
+ WORKFLOW_EPIC_CREATE_STATE=active
88
+ WORKFLOW_EPIC_CREATE_WORKFLOW_TRIGGER=epic_creation
89
+ WORKFLOW_ARCH_REVIEW_STATE=active
90
+ WORKFLOW_ARCH_REVIEW_WORKFLOW_TRIGGER=architecture_review
91
+ ```
92
+
93
+ ## Domain-to-File Mapping
94
+
95
+ The domain-loader resolves domain prefixes to files in `.synapse/`:
96
+
97
+ | Prefix | File | Layer |
98
+ |--------|------|-------|
99
+ | `CONSTITUTION` | `.synapse/constitution` | L0 |
100
+ | `GLOBAL` | `.synapse/global` | L1 |
101
+ | `CONTEXT` | `.synapse/context` | L1 |
102
+ | `COMMANDS` | `.synapse/commands` | L7 |
103
+ | `AGENT_DEV` | `.synapse/agent-dev` | L2 |
104
+ | `AGENT_QA` | `.synapse/agent-qa` | L2 |
105
+ | `WORKFLOW_STORY_DEV` | `.synapse/workflow-story-dev` | L3 |
106
+
107
+ **Naming convention:** The prefix is derived from the filename by:
108
+ 1. Converting to SCREAMING_SNAKE_CASE
109
+ 2. Removing hyphens and replacing with underscores
110
+
111
+ ## Troubleshooting
112
+
113
+ ### Domain Not Loading
114
+
115
+ 1. Check `{PREFIX}_STATE=active` in manifest
116
+ 2. Verify the domain file exists in `.synapse/`
117
+ 3. For L2 domains: verify `AGENT_TRIGGER` matches the active agent ID
118
+ 4. For L3 domains: verify `WORKFLOW_TRIGGER` matches the active workflow
119
+ 5. Run `*synapse debug` to see manifest parse results
120
+
121
+ ### Invalid Format Errors
122
+
123
+ - Keys must use SCREAMING_SNAKE_CASE
124
+ - Values cannot contain newlines
125
+ - No spaces around `=` sign
126
+ - Comments must start with `#` at the beginning of the line
127
+
128
+ ### Adding a New Domain
129
+
130
+ Use `*synapse create` or manually:
131
+ 1. Create the domain file in `.synapse/` with KEY=VALUE rules
132
+ 2. Add the registration keys to `.synapse/manifest`
133
+ 3. Run `*synapse reload` to reload from disk
134
+
135
+ ## Source Files
136
+
137
+ | File | Purpose |
138
+ |------|---------|
139
+ | `.synapse/manifest` | The manifest file itself |
140
+ | `.aiox-core/core/synapse/domain/domain-loader.js` | Manifest parser + domain file loader |
141
+ | `.claude/commands/synapse/utils/manifest-parser-reference.md` | Detailed parser format spec |
142
+ | `.claude/commands/synapse/templates/manifest-entry-template` | Template for new manifest entries |