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.
- package/.aiox-core/cli/commands/pro/buyer.js +379 -0
- package/.aiox-core/cli/commands/pro/index.js +191 -52
- package/.aiox-core/cli/commands/validate/index.js +2 -0
- package/.aiox-core/core/code-intel/helpers/dev-helper.js +1 -1
- package/.aiox-core/core/code-intel/helpers/devops-helper.js +0 -1
- package/.aiox-core/core/code-intel/helpers/planning-helper.js +1 -1
- package/.aiox-core/core/code-intel/helpers/qa-helper.js +2 -2
- package/.aiox-core/core/config/schemas/framework-config.schema.json +1 -0
- package/.aiox-core/core/config/template-overrides.js +1 -1
- package/.aiox-core/core/doctor/checks/ide-sync.js +81 -25
- package/.aiox-core/core/doctor/checks/rules-files.js +0 -1
- package/.aiox-core/core/doctor/checks/skills-count.js +83 -15
- package/.aiox-core/core/graph-dashboard/cli.js +1 -2
- package/.aiox-core/core/graph-dashboard/data-sources/code-intel-source.js +1 -1
- package/.aiox-core/core/ids/layer-classifier.js +1 -1
- package/.aiox-core/core/pro/pro-updater.js +578 -0
- package/.aiox-core/core/synapse/context/context-tracker.js +107 -9
- package/.aiox-core/core/synapse/layers/layer-processor.js +1 -1
- package/.aiox-core/core-config.yaml +15 -1
- package/.aiox-core/data/capability-detection.js +15 -15
- package/.aiox-core/data/entity-registry.yaml +18 -2
- package/.aiox-core/data/registry-update-log.jsonl +5 -0
- package/.aiox-core/data/tok3-token-comparison.js +0 -4
- package/.aiox-core/data/tool-search-validation.js +1 -1
- package/.aiox-core/development/agents/aiox-master.md +44 -6
- package/.aiox-core/development/agents/data-engineer.md +4 -4
- package/.aiox-core/development/agents/devops.md +52 -2
- package/.aiox-core/development/agents/po.md +1 -1
- package/.aiox-core/development/agents/qa.md +5 -11
- package/.aiox-core/development/agents/sm.md +3 -3
- package/.aiox-core/development/agents/ux-design-expert.md +1 -1
- package/.aiox-core/development/scripts/unified-activation-pipeline.js +29 -3
- package/.aiox-core/development/tasks/dev-develop-story.md +46 -7
- package/.aiox-core/development/tasks/devops-pro-access-grant.md +93 -0
- package/.aiox-core/development/tasks/devops-pro-activate.md +42 -0
- package/.aiox-core/development/tasks/devops-pro-check-access.md +34 -0
- package/.aiox-core/development/tasks/devops-pro-request-reset.md +34 -0
- package/.aiox-core/development/tasks/devops-pro-resend-verification.md +32 -0
- package/.aiox-core/development/tasks/devops-pro-reset-password.md +36 -0
- package/.aiox-core/development/tasks/devops-pro-validate-login.md +36 -0
- package/.aiox-core/development/tasks/devops-pro-verify-status.md +33 -0
- package/.aiox-core/development/tasks/qa-gate.md +54 -4
- package/.aiox-core/development/tasks/validate-next-story.md +39 -2
- package/.aiox-core/framework-config.yaml +1 -0
- package/.aiox-core/infrastructure/scripts/codex-skills-sync/README.md +69 -0
- package/.aiox-core/infrastructure/scripts/codex-skills-sync/bootstrap.js +727 -0
- package/.aiox-core/infrastructure/scripts/codex-skills-sync/index.js +10 -0
- package/.aiox-core/infrastructure/scripts/codex-skills-sync/validate.js +65 -4
- package/.aiox-core/infrastructure/scripts/generate-settings-json.js +29 -4
- package/.aiox-core/infrastructure/scripts/ide-sync/agent-parser.js +4 -0
- package/.aiox-core/infrastructure/scripts/ide-sync/index.js +67 -7
- package/.aiox-core/infrastructure/scripts/ide-sync/transformers/claude-code.js +145 -3
- package/.aiox-core/infrastructure/scripts/repair-agent-references.js +263 -0
- package/.aiox-core/infrastructure/scripts/validate-claude-integration.js +60 -8
- package/.aiox-core/infrastructure/scripts/validate-paths.js +13 -0
- package/.aiox-core/install-manifest.yaml +134 -82
- package/.aiox-core/utils/filters/index.js +2 -1
- package/.claude/commands/AIOX/agents/aiox-master.md +21 -0
- package/.claude/commands/AIOX/agents/analyst.md +21 -0
- package/.claude/commands/AIOX/agents/architect.md +21 -0
- package/.claude/commands/AIOX/agents/data-engineer.md +21 -0
- package/.claude/commands/AIOX/agents/dev.md +21 -0
- package/.claude/commands/AIOX/agents/devops.md +21 -0
- package/.claude/commands/AIOX/agents/pm.md +21 -0
- package/.claude/commands/AIOX/agents/po.md +21 -0
- package/.claude/commands/AIOX/agents/qa.md +21 -0
- package/.claude/commands/AIOX/agents/sm.md +21 -0
- package/.claude/commands/AIOX/agents/squad-creator.md +21 -0
- package/.claude/commands/AIOX/agents/ux-design-expert.md +21 -0
- package/.claude/commands/AIOX/scripts/agent-config-loader.js +624 -0
- package/.claude/commands/AIOX/scripts/generate-greeting.js +160 -0
- package/.claude/commands/AIOX/scripts/greeting-builder.js +866 -0
- package/.claude/commands/AIOX/scripts/session-context-loader.js +286 -0
- package/.claude/commands/AIOX/stories/story-6.1.4.md +1404 -0
- package/.claude/commands/cohort-squad/agents/cohort-manager.md +156 -0
- package/.claude/commands/design-system/agents/brad-frost.md +1097 -0
- package/.claude/commands/design-system/agents/dan-mall.md +857 -0
- package/.claude/commands/design-system/agents/dave-malouf.md +2272 -0
- package/.claude/commands/design-system/agents/design-chief.md +102 -0
- package/.claude/commands/design-system/agents/nano-banana-generator.md +162 -0
- package/.claude/commands/greet.md +101 -0
- package/.claude/commands/synapse/manager.md +75 -0
- package/.claude/commands/synapse/tasks/add-rule.md +94 -0
- package/.claude/commands/synapse/tasks/create-command.md +109 -0
- package/.claude/commands/synapse/tasks/create-domain.md +127 -0
- package/.claude/commands/synapse/tasks/diagnose-synapse.md +245 -0
- package/.claude/commands/synapse/tasks/edit-rule.md +109 -0
- package/.claude/commands/synapse/tasks/suggest-domain.md +116 -0
- package/.claude/commands/synapse/tasks/toggle-domain.md +83 -0
- package/.claude/commands/synapse/templates/domain-template +8 -0
- package/.claude/commands/synapse/templates/manifest-entry-template +4 -0
- package/.claude/commands/synapse/utils/manifest-parser-reference.md +134 -0
- package/.claude/hooks/precompact-session-digest.cjs +2 -2
- package/.claude/skills/AIOX/agents/aiox-master/SKILL.md +511 -0
- package/.claude/skills/AIOX/agents/analyst/SKILL.md +281 -0
- package/.claude/skills/AIOX/agents/architect/SKILL.md +482 -0
- package/.claude/skills/AIOX/agents/data-engineer/SKILL.md +503 -0
- package/.claude/skills/AIOX/agents/dev/SKILL.md +568 -0
- package/.claude/skills/AIOX/agents/devops/SKILL.md +597 -0
- package/.claude/skills/AIOX/agents/pm/SKILL.md +385 -0
- package/.claude/skills/AIOX/agents/po/SKILL.md +343 -0
- package/.claude/skills/AIOX/agents/qa/SKILL.md +451 -0
- package/.claude/skills/AIOX/agents/sm/SKILL.md +295 -0
- package/.claude/skills/AIOX/agents/squad-creator/SKILL.md +352 -0
- package/.claude/skills/AIOX/agents/ux-design-expert/SKILL.md +503 -0
- package/.claude/skills/architect-first/SKILL.md +275 -0
- package/.claude/skills/architect-first/assets/architecture-template.md +505 -0
- package/.claude/skills/architect-first/assets/config-template.yaml +351 -0
- package/.claude/skills/architect-first/references/architecture-checklist.md +216 -0
- package/.claude/skills/architect-first/references/pre-implementation-checklist.md +119 -0
- package/.claude/skills/architect-first/references/stop-rules-guide.md +291 -0
- package/.claude/skills/architect-first/references/testing-strategy-guide.md +477 -0
- package/.claude/skills/architect-first/scripts/architecture_validator.py +490 -0
- package/.claude/skills/architect-first/scripts/check_coupling.py +306 -0
- package/.claude/skills/architect-first/scripts/validate_risk_mitigation.py +382 -0
- package/.claude/skills/checklist-runner/SKILL.md +113 -0
- package/.claude/skills/clone-mind.md +329 -0
- package/.claude/skills/coderabbit-review/SKILL.md +106 -0
- package/.claude/skills/course-generation-workflow.md +76 -0
- package/.claude/skills/enhance-workflow.md +466 -0
- package/.claude/skills/mcp-builder/LICENSE.txt +202 -0
- package/.claude/skills/mcp-builder/SKILL.md +328 -0
- package/.claude/skills/mcp-builder/reference/evaluation.md +602 -0
- package/.claude/skills/mcp-builder/reference/mcp_best_practices.md +915 -0
- package/.claude/skills/mcp-builder/reference/node_mcp_server.md +916 -0
- package/.claude/skills/mcp-builder/reference/python_mcp_server.md +752 -0
- package/.claude/skills/mcp-builder/scripts/connections.py +151 -0
- package/.claude/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/.claude/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/.claude/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/.claude/skills/ralph.md +181 -0
- package/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/.claude/skills/skill-creator/SKILL.md +209 -0
- package/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/.claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/.claude/skills/squad.md +301 -0
- package/.claude/skills/synapse/SKILL.md +132 -0
- package/.claude/skills/synapse/assets/README.md +50 -0
- package/.claude/skills/synapse/references/brackets.md +100 -0
- package/.claude/skills/synapse/references/commands.md +118 -0
- package/.claude/skills/synapse/references/domains.md +126 -0
- package/.claude/skills/synapse/references/layers.md +186 -0
- package/.claude/skills/synapse/references/manifest.md +142 -0
- package/.claude/skills/tech-search/SKILL.md +431 -0
- package/.claude/skills/tech-search/prompts/page-extract.md +133 -0
- package/README.en.md +2 -2
- package/README.md +8 -2
- package/bin/aiox.js +55 -4
- package/bin/utils/framework-guard.js +4 -2
- package/bin/utils/pro-detector.js +119 -28
- package/bin/utils/validate-publish.js +6 -6
- package/docs/aiox-agent-flows/devops-system.md +18 -0
- package/docs/aiox-workflows/README.md +1 -0
- package/docs/aiox-workflows/pro-access-grant-workflow.md +218 -0
- package/docs/guides/pro/access-grant-ops-playbook.md +370 -0
- package/docs/guides/pro/install-gate-setup.md +12 -6
- package/docs/guides/pro/squad-creator-handoff-pro-access-ops.md +134 -0
- package/docs/guides/supabase-ops-handoff.md +768 -0
- package/package.json +12 -1
- package/packages/aiox-pro-cli/bin/aiox-pro.js +33 -12
- package/packages/installer/src/config/configure-environment.js +118 -50
- package/packages/installer/src/installer/aiox-core-installer.js +124 -27
- package/packages/installer/src/installer/brownfield-upgrader.js +66 -9
- package/packages/installer/src/installer/dependency-installer.js +4 -0
- package/packages/installer/src/pro/pro-scaffolder.js +5 -5
- package/packages/installer/src/updater/index.js +151 -10
- package/packages/installer/src/wizard/ide-config-generator.js +73 -7
- package/packages/installer/src/wizard/index.js +119 -31
- package/packages/installer/src/wizard/pro-setup.js +118 -47
- package/packages/installer/src/wizard/validation/validators/dependency-validator.js +32 -25
- package/packages/installer/src/wizard/validation/validators/file-structure-validator.js +26 -0
- package/packages/installer/tests/unit/artifact-copy-pipeline/artifact-copy-pipeline.test.js +84 -1
- package/packages/installer/tests/unit/claude-md-template-v5/claude-md-template-v5.test.js +1 -1
- package/packages/installer/tests/unit/doctor/doctor-checks.test.js +85 -19
- package/packages/installer/tests/unit/entity-registry-bootstrap.test.js +4 -4
- package/packages/installer/tests/unit/generate-settings-json/generate-settings-json.test.js +5 -5
- package/packages/installer/tests/unit/ide-sync-integration/ide-sync-integration.test.js +4 -4
- package/packages/installer/tests/unit/merger/yaml-merger.test.js +11 -11
- package/pro/README.md +12 -1
- package/pro/license/index.js +3 -11
- package/pro/license/license-api.js +25 -0
- package/pro/license/license-cache.js +135 -31
- package/pro/license/license-crypto.js +59 -3
- package/pro/package.json +5 -4
- package/pro/squads/README.md +16 -16
- package/pro/squads/index.js +1 -1
- package/scripts/e2e/installed-skills-smoke.js +264 -0
- package/scripts/package-synapse.js +3 -3
- package/scripts/validate-package-completeness.js +8 -11
- package/.aiox-core/lib/build.json +0 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Create Domain
|
|
2
|
+
|
|
3
|
+
Creates a new SYNAPSE domain file and registers it in the manifest.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Create a new custom domain in `.synapse/` with a corresponding entry in `.synapse/manifest`, allowing users to add their own rule sets to the SYNAPSE context engine.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- `.synapse/manifest` exists
|
|
16
|
+
- `.synapse/` directory exists
|
|
17
|
+
- User provides a domain name
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
| Parameter | Required | Description |
|
|
24
|
+
|-----------|----------|-------------|
|
|
25
|
+
| `domain-name` | Yes | Name for the new domain (kebab-case, lowercase) |
|
|
26
|
+
| `description` | No | Short description of the domain's purpose |
|
|
27
|
+
| `recall-keywords` | No | Comma-separated RECALL keywords for L6 matching |
|
|
28
|
+
| `exclude-keywords` | No | Comma-separated EXCLUDE keywords |
|
|
29
|
+
| `initial-rules` | No | One or more initial rules to include |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Steps
|
|
34
|
+
|
|
35
|
+
### Step 1: Validate Domain Name
|
|
36
|
+
|
|
37
|
+
- Domain name MUST be lowercase kebab-case (e.g., `my-custom-rules`)
|
|
38
|
+
- Allowed characters: `a-z`, `0-9`, `-`
|
|
39
|
+
- Must NOT start or end with `-`
|
|
40
|
+
- Must NOT be empty
|
|
41
|
+
|
|
42
|
+
If invalid, report: `Error: Domain name must be lowercase kebab-case (e.g., "my-custom-rules"). Got: "{name}"`
|
|
43
|
+
|
|
44
|
+
### Step 2: Derive Domain Key
|
|
45
|
+
|
|
46
|
+
Convert the kebab-case name to UPPERCASE_SNAKE_CASE for use in manifest and domain file:
|
|
47
|
+
- `my-custom-rules` -> `MY_CUSTOM_RULES`
|
|
48
|
+
|
|
49
|
+
### Step 3: Check Uniqueness
|
|
50
|
+
|
|
51
|
+
Read `.synapse/manifest` and check if `{DOMAIN_KEY}_STATE` already exists.
|
|
52
|
+
|
|
53
|
+
If it exists, report: `Error: Domain "{domain-name}" already exists in the manifest. Use "add" to add rules to it instead.`
|
|
54
|
+
|
|
55
|
+
Check if file `.synapse/{domain-name}` already exists on the filesystem.
|
|
56
|
+
|
|
57
|
+
If it exists, report: `Error: Domain file ".synapse/{domain-name}" already exists on disk.`
|
|
58
|
+
|
|
59
|
+
### Step 4: Create Domain File
|
|
60
|
+
|
|
61
|
+
Create `.synapse/{domain-name}` using the template from `.claude/commands/synapse/templates/domain-template`:
|
|
62
|
+
|
|
63
|
+
```ini
|
|
64
|
+
# ==========================================
|
|
65
|
+
# SYNAPSE Domain: {DOMAIN_NAME}
|
|
66
|
+
# Created: {CURRENT_DATE}
|
|
67
|
+
# Description: {DESCRIPTION}
|
|
68
|
+
# ==========================================
|
|
69
|
+
|
|
70
|
+
# Rules
|
|
71
|
+
{DOMAIN_KEY}_RULE_0={FIRST_RULE_OR_PLACEHOLDER}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- Replace `{DOMAIN_NAME}` with the domain display name (e.g., `My Custom Rules`)
|
|
75
|
+
- Replace `{DOMAIN_KEY}` with the UPPERCASE_SNAKE_CASE key
|
|
76
|
+
- Replace `{DATE}` with current date (YYYY-MM-DD)
|
|
77
|
+
- Replace `{DESCRIPTION}` with user-provided description or `Custom domain`
|
|
78
|
+
- If user provided initial rules, add them as `{DOMAIN_KEY}_RULE_0`, `_RULE_1`, etc.
|
|
79
|
+
- If no initial rules, use a placeholder: `{DOMAIN_KEY}_RULE_0=Add your first rule here`
|
|
80
|
+
|
|
81
|
+
### Step 5: Add Manifest Entry
|
|
82
|
+
|
|
83
|
+
Append to `.synapse/manifest` using the template from `.claude/commands/synapse/templates/manifest-entry-template`:
|
|
84
|
+
|
|
85
|
+
```ini
|
|
86
|
+
|
|
87
|
+
# Layer 6: {domain-name}
|
|
88
|
+
{DOMAIN_KEY}_STATE=active
|
|
89
|
+
{DOMAIN_KEY}_RECALL={recall-keywords-or-empty}
|
|
90
|
+
{DOMAIN_KEY}_EXCLUDE={exclude-keywords-or-empty}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- Add a blank line before the new entry for readability
|
|
94
|
+
- If no RECALL keywords provided, use domain name words as defaults
|
|
95
|
+
- EXCLUDE is empty by default
|
|
96
|
+
|
|
97
|
+
### Step 6: Validate
|
|
98
|
+
|
|
99
|
+
- Read back the manifest and verify `{DOMAIN_KEY}_STATE=active` is present
|
|
100
|
+
- Read back the domain file and verify it parses correctly (has at least one rule line)
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Validation
|
|
105
|
+
|
|
106
|
+
- [ ] Domain file created at `.synapse/{domain-name}`
|
|
107
|
+
- [ ] Manifest entry added with `_STATE=active`
|
|
108
|
+
- [ ] Domain name is valid kebab-case
|
|
109
|
+
- [ ] No duplicate domain in manifest or filesystem
|
|
110
|
+
- [ ] Domain file follows KEY=VALUE format parseable by SYN-1
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Error Handling
|
|
115
|
+
|
|
116
|
+
| Error | Message |
|
|
117
|
+
|-------|---------|
|
|
118
|
+
| Invalid name | `Error: Domain name must be lowercase kebab-case (e.g., "my-custom-rules"). Got: "{name}"` |
|
|
119
|
+
| Domain exists (manifest) | `Error: Domain "{name}" already exists in the manifest. Use "add" to add rules to it instead.` |
|
|
120
|
+
| Domain exists (file) | `Error: Domain file ".synapse/{name}" already exists on disk.` |
|
|
121
|
+
| Manifest not found | `Error: .synapse/manifest not found. SYNAPSE must be initialized first (SYN-8).` |
|
|
122
|
+
| Write failure | `Error: Failed to write domain file. Check filesystem permissions.` |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
*Create Domain — SYNAPSE CRUD Command C2*
|
|
127
|
+
*Source: SYNAPSE-HOOK-SKILL-COMMAND-ANALYSIS.md section 2.3*
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# SYNAPSE Diagnostics Task
|
|
2
|
+
|
|
3
|
+
Run a comprehensive diagnostic of the SYNAPSE context engine, comparing expected vs. actual pipeline state, including **session performance analysis** with exact timing data.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Execute the following steps in order:
|
|
8
|
+
|
|
9
|
+
### Step 1: Run Diagnostics Script
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
node -e "const {runDiagnostics}=require('./.aiox-core/core/synapse/diagnostics/synapse-diagnostics');console.log(runDiagnostics(process.cwd()))"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Step 2: Display Report
|
|
16
|
+
|
|
17
|
+
Show the full markdown report output to the user.
|
|
18
|
+
|
|
19
|
+
### Step 3: Analyze Gaps
|
|
20
|
+
|
|
21
|
+
If the report contains any FAIL or WARN items:
|
|
22
|
+
1. List each gap with its severity
|
|
23
|
+
2. Provide the recommended fix from the report
|
|
24
|
+
3. Ask the user if they want to apply any fixes
|
|
25
|
+
|
|
26
|
+
### Step 4: Session Performance Analysis
|
|
27
|
+
|
|
28
|
+
Run the timing analyzer to get **exact execution data** for this session:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
node -e "
|
|
32
|
+
const fs = require('fs');
|
|
33
|
+
const path = require('path');
|
|
34
|
+
const os = require('os');
|
|
35
|
+
|
|
36
|
+
const LOG_DIR = path.join(os.homedir(), '.claude', 'logs');
|
|
37
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
38
|
+
const logFile = path.join(LOG_DIR, 'timing-' + today + '.jsonl');
|
|
39
|
+
|
|
40
|
+
if (!fs.existsSync(logFile)) {
|
|
41
|
+
console.log('NO_TIMING_DATA');
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const lines = fs.readFileSync(logFile, 'utf8').trim().split('\n');
|
|
46
|
+
const entries = lines.map(l => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean);
|
|
47
|
+
|
|
48
|
+
// Group by session
|
|
49
|
+
const sessions = {};
|
|
50
|
+
entries.forEach(e => {
|
|
51
|
+
if (!sessions[e.session]) sessions[e.session] = [];
|
|
52
|
+
sessions[e.session].push(e);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Find the latest session (most likely current)
|
|
56
|
+
const sessionIds = Object.keys(sessions);
|
|
57
|
+
const latestSessionId = sessionIds[sessionIds.length - 1];
|
|
58
|
+
const currentEvents = sessions[latestSessionId] || [];
|
|
59
|
+
|
|
60
|
+
// Build JSON output for analysis
|
|
61
|
+
const result = {
|
|
62
|
+
date: today,
|
|
63
|
+
logFile,
|
|
64
|
+
totalSessions: sessionIds.length,
|
|
65
|
+
currentSession: {
|
|
66
|
+
id: latestSessionId ? latestSessionId.slice(0, 12) : null,
|
|
67
|
+
totalEntries: currentEvents.length,
|
|
68
|
+
firstEvent: currentEvents[0] ? currentEvents[0].timestamp : null,
|
|
69
|
+
lastEvent: currentEvents.length ? currentEvents[currentEvents.length - 1].timestamp : null,
|
|
70
|
+
wallClockMs: currentEvents.length >= 2
|
|
71
|
+
? currentEvents[currentEvents.length - 1].epochMs - currentEvents[0].epochMs
|
|
72
|
+
: 0,
|
|
73
|
+
timeline: [],
|
|
74
|
+
toolSummary: {},
|
|
75
|
+
gaps: [],
|
|
76
|
+
totalToolTimeMs: 0,
|
|
77
|
+
totalThinkingTimeMs: 0,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Build timeline
|
|
82
|
+
let prevEpoch = null;
|
|
83
|
+
currentEvents.forEach(e => {
|
|
84
|
+
const gap = prevEpoch ? e.epochMs - prevEpoch : 0;
|
|
85
|
+
const item = {
|
|
86
|
+
time: e.timestamp ? e.timestamp.slice(11, 23) : '',
|
|
87
|
+
event: e.event === 'PreToolUse' ? 'START' : 'END',
|
|
88
|
+
tool: e.tool,
|
|
89
|
+
durationMs: e.durationMs || null,
|
|
90
|
+
gapMs: gap,
|
|
91
|
+
input: e.input || null,
|
|
92
|
+
};
|
|
93
|
+
result.currentSession.timeline.push(item);
|
|
94
|
+
prevEpoch = e.epochMs;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Tool duration summary
|
|
98
|
+
currentEvents.filter(e => e.durationMs).forEach(e => {
|
|
99
|
+
if (!result.currentSession.toolSummary[e.tool]) {
|
|
100
|
+
result.currentSession.toolSummary[e.tool] = { calls: 0, totalMs: 0, maxMs: 0, durations: [] };
|
|
101
|
+
}
|
|
102
|
+
const ts = result.currentSession.toolSummary[e.tool];
|
|
103
|
+
ts.calls++;
|
|
104
|
+
ts.totalMs += e.durationMs;
|
|
105
|
+
ts.maxMs = Math.max(ts.maxMs, e.durationMs);
|
|
106
|
+
ts.durations.push(e.durationMs);
|
|
107
|
+
result.currentSession.totalToolTimeMs += e.durationMs;
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Gap analysis (thinking time between PostToolUse → PreToolUse)
|
|
111
|
+
for (let i = 1; i < currentEvents.length; i++) {
|
|
112
|
+
if (currentEvents[i].event === 'PreToolUse' && currentEvents[i - 1].event === 'PostToolUse') {
|
|
113
|
+
const gapMs = currentEvents[i].epochMs - currentEvents[i - 1].epochMs;
|
|
114
|
+
result.currentSession.gaps.push({
|
|
115
|
+
from: currentEvents[i - 1].tool,
|
|
116
|
+
to: currentEvents[i].tool,
|
|
117
|
+
gapMs,
|
|
118
|
+
});
|
|
119
|
+
result.currentSession.totalThinkingTimeMs += gapMs;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Sort gaps descending
|
|
124
|
+
result.currentSession.gaps.sort((a, b) => b.gapMs - a.gapMs);
|
|
125
|
+
|
|
126
|
+
console.log(JSON.stringify(result, null, 2));
|
|
127
|
+
"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Step 5: Render Performance Report
|
|
131
|
+
|
|
132
|
+
Using the JSON output from Step 4, present a **Session Performance Report** with these sections:
|
|
133
|
+
|
|
134
|
+
#### 5a. Session Overview
|
|
135
|
+
|
|
136
|
+
| Metric | Value |
|
|
137
|
+
|--------|-------|
|
|
138
|
+
| Wall Clock Total | (firstEvent → lastEvent) |
|
|
139
|
+
| Tool Execution Time | sum of all durationMs |
|
|
140
|
+
| Thinking/Processing Time | total gaps between PostToolUse → PreToolUse |
|
|
141
|
+
| Overhead Ratio | thinkingTime / wallClock as % |
|
|
142
|
+
|
|
143
|
+
#### 5b. Execution Timeline
|
|
144
|
+
|
|
145
|
+
Show every tool call in chronological order:
|
|
146
|
+
```
|
|
147
|
+
HH:MM:SS.mmm START ToolName — input summary
|
|
148
|
+
HH:MM:SS.mmm END ToolName [Xms] (+Yms gap)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Highlight any gaps > 5 seconds with a warning marker.
|
|
152
|
+
|
|
153
|
+
#### 5c. Tool Duration Ranking
|
|
154
|
+
|
|
155
|
+
Table sorted by total time descending:
|
|
156
|
+
|
|
157
|
+
| Tool | Calls | Total | Avg | Max |
|
|
158
|
+
|------|-------|-------|-----|-----|
|
|
159
|
+
| ... | | | | |
|
|
160
|
+
|
|
161
|
+
#### 5d. Largest Thinking Gaps
|
|
162
|
+
|
|
163
|
+
Show top 10 gaps (PostToolUse → PreToolUse), sorted descending:
|
|
164
|
+
|
|
165
|
+
| Gap | From → To | Analysis |
|
|
166
|
+
|-----|-----------|----------|
|
|
167
|
+
| Xs | Tool A → Tool B | (explain likely cause) |
|
|
168
|
+
|
|
169
|
+
For the Analysis column, infer causes:
|
|
170
|
+
- **> 15s gap**: Likely LLM processing large context or generating long response
|
|
171
|
+
- **5-15s gap**: Normal thinking for complex decisions, reading tool output
|
|
172
|
+
- **2-5s gap**: Standard inter-tool processing
|
|
173
|
+
- **< 2s gap**: Fast, healthy
|
|
174
|
+
|
|
175
|
+
#### 5e. Bottleneck Diagnosis
|
|
176
|
+
|
|
177
|
+
Based on the data, provide a concrete diagnosis:
|
|
178
|
+
1. What % of total time was spent in tool execution vs thinking?
|
|
179
|
+
2. Which specific tool call or gap was the single largest time consumer?
|
|
180
|
+
3. Actionable recommendations to reduce total time
|
|
181
|
+
|
|
182
|
+
### Step 6: Handle Missing Timing Data
|
|
183
|
+
|
|
184
|
+
If Step 4 outputs `NO_TIMING_DATA`:
|
|
185
|
+
1. Inform the user that the timing hooks are not yet capturing data
|
|
186
|
+
2. Explain that timing data requires the `PreToolUse`/`PostToolUse` hooks in `~/.claude/settings.json`
|
|
187
|
+
3. Check if hooks are registered:
|
|
188
|
+
```bash
|
|
189
|
+
node -e "const s=require(require('os').homedir()+'/.claude/settings.json');console.log(JSON.stringify({pre:!!s.hooks?.PreToolUse,post:!!s.hooks?.PostToolUse}))"
|
|
190
|
+
```
|
|
191
|
+
4. If hooks are missing, offer to install them
|
|
192
|
+
5. Note: timing data only exists for the **current session onwards** — previous sessions have no retroactive data
|
|
193
|
+
|
|
194
|
+
### Step 7: Quick Health Summary
|
|
195
|
+
|
|
196
|
+
Combine SYNAPSE health + Performance into a single status line:
|
|
197
|
+
|
|
198
|
+
- **Healthy + Fast**: "SYNAPSE 100% | Session: Xs wall, Y% thinking"
|
|
199
|
+
- **Healthy + Slow**: "SYNAPSE 100% | Session: Xs wall, Y% thinking — bottleneck: [detail]"
|
|
200
|
+
- **Degraded**: "SYNAPSE N warnings | Session: Xs wall — [top issue]"
|
|
201
|
+
- **Broken**: "SYNAPSE N critical issues — fix before performance analysis"
|
|
202
|
+
- **No timing**: "SYNAPSE [status] | Timing hooks not active — run next session for data"
|
|
203
|
+
|
|
204
|
+
## Context
|
|
205
|
+
|
|
206
|
+
This diagnostic checks:
|
|
207
|
+
1. **Hook Status** - Is the synapse-engine hook registered and functional?
|
|
208
|
+
2. **Session Status** - Does the session have active_agent, prompt_count, bracket?
|
|
209
|
+
3. **Manifest Integrity** - Do all manifest domains have corresponding files?
|
|
210
|
+
4. **Pipeline Simulation** - For the current bracket, which layers should be active?
|
|
211
|
+
5. **UAP Bridge** - Did the UAP write _active-agent.json at activation?
|
|
212
|
+
6. **Memory Bridge** - Is Pro available? Does the bracket require memory hints?
|
|
213
|
+
7. **Gaps & Recommendations** - Prioritized list of issues with fixes
|
|
214
|
+
8. **Session Performance** - Exact timing of every tool call, thinking gaps, bottleneck diagnosis
|
|
215
|
+
|
|
216
|
+
## When to Use
|
|
217
|
+
|
|
218
|
+
- After activating an agent, to verify SYNAPSE is injecting the right context
|
|
219
|
+
- When agent-specific rules seem to be missing from responses
|
|
220
|
+
- When debugging context injection issues
|
|
221
|
+
- **When activation or responses feel slow** — timing data pinpoints exactly where time is spent
|
|
222
|
+
- As part of story development for SYNAPSE-related changes
|
|
223
|
+
- Periodically to verify system health
|
|
224
|
+
|
|
225
|
+
## Dependencies
|
|
226
|
+
|
|
227
|
+
- **Timing hooks**: `~/.claude/hooks/timing-logger.js` (PreToolUse/PostToolUse)
|
|
228
|
+
- **Timing analyzer**: `~/.claude/hooks/analyze-timing.js` (CLI report)
|
|
229
|
+
- **SYNAPSE diagnostics**: `.aiox-core/core/synapse/diagnostics/synapse-diagnostics.js`
|
|
230
|
+
|
|
231
|
+
## Quick Commands
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Full diagnostic (this skill)
|
|
235
|
+
/synapse:tasks:diagnose-synapse
|
|
236
|
+
|
|
237
|
+
# Timing report only (CLI)
|
|
238
|
+
node ~/.claude/hooks/analyze-timing.js
|
|
239
|
+
|
|
240
|
+
# Timing for specific date
|
|
241
|
+
node ~/.claude/hooks/analyze-timing.js 2026-02-17
|
|
242
|
+
|
|
243
|
+
# Last N entries
|
|
244
|
+
node ~/.claude/hooks/analyze-timing.js --last 50
|
|
245
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Edit Rule
|
|
2
|
+
|
|
3
|
+
Edits or removes a rule by index in an existing SYNAPSE domain file.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Modify the text of an existing rule or delete it entirely, re-numbering remaining rules to maintain a sequential index.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- `.synapse/manifest` exists
|
|
16
|
+
- Target domain exists in manifest AND as a file in `.synapse/`
|
|
17
|
+
- Target rule index exists in the domain file
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
| Parameter | Required | Description |
|
|
24
|
+
|-----------|----------|-------------|
|
|
25
|
+
| `domain-name` | Yes | Existing domain name (kebab-case) |
|
|
26
|
+
| `index` | Yes | Rule index number to edit or remove |
|
|
27
|
+
| `new-text` | No | New rule text (omit to delete the rule) |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Steps
|
|
32
|
+
|
|
33
|
+
### Step 1: Validate Domain Exists
|
|
34
|
+
|
|
35
|
+
1. Derive the domain key: `my-domain` -> `MY_DOMAIN`
|
|
36
|
+
2. Verify `{DOMAIN_KEY}_STATE` exists in `.synapse/manifest`
|
|
37
|
+
3. Verify `.synapse/{domain-name}` file exists on disk
|
|
38
|
+
|
|
39
|
+
### Step 2: Find Target Rule
|
|
40
|
+
|
|
41
|
+
Read the domain file and find the line matching `{DOMAIN_KEY}_RULE_{index}=`.
|
|
42
|
+
|
|
43
|
+
If not found: `Error: Rule index {index} not found in domain "{domain-name}". Domain has rules 0-{max}.`
|
|
44
|
+
|
|
45
|
+
### Step 3: Edit or Delete
|
|
46
|
+
|
|
47
|
+
**If new-text is provided (EDIT):**
|
|
48
|
+
- Replace the rule line with `{DOMAIN_KEY}_RULE_{index}={new-text}`
|
|
49
|
+
- Display: `Updated rule {index} in {domain-name}: {new-text}`
|
|
50
|
+
|
|
51
|
+
**If new-text is NOT provided (DELETE):**
|
|
52
|
+
- Remove the rule line from the file
|
|
53
|
+
- Re-number all remaining rules sequentially starting from 0
|
|
54
|
+
- Display: `Deleted rule {index} from {domain-name}. Re-numbered {count} remaining rules.`
|
|
55
|
+
|
|
56
|
+
### Step 4: Re-Number After Deletion
|
|
57
|
+
|
|
58
|
+
When a rule is deleted, re-number all remaining rules to maintain a sequential index:
|
|
59
|
+
|
|
60
|
+
**Before:**
|
|
61
|
+
```
|
|
62
|
+
MY_DOMAIN_RULE_0=First rule
|
|
63
|
+
MY_DOMAIN_RULE_1=Second rule <-- DELETED
|
|
64
|
+
MY_DOMAIN_RULE_2=Third rule
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**After:**
|
|
68
|
+
```
|
|
69
|
+
MY_DOMAIN_RULE_0=First rule
|
|
70
|
+
MY_DOMAIN_RULE_1=Third rule
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Algorithm:
|
|
74
|
+
1. Collect all rule values (preserving order, excluding deleted rule)
|
|
75
|
+
2. Rewrite all rules with sequential indices starting from 0
|
|
76
|
+
3. Preserve all non-rule lines (comments, blanks) in their original positions
|
|
77
|
+
|
|
78
|
+
### Step 5: Validate
|
|
79
|
+
|
|
80
|
+
- Read back the domain file
|
|
81
|
+
- Verify rules are sequentially numbered (0, 1, 2, ... N) with no gaps
|
|
82
|
+
- Verify total rule count matches expected (original count minus 1 for delete)
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Validation
|
|
87
|
+
|
|
88
|
+
- [ ] Target rule exists before edit/delete
|
|
89
|
+
- [ ] After edit: rule text updated correctly
|
|
90
|
+
- [ ] After delete: remaining rules re-numbered sequentially (no gaps)
|
|
91
|
+
- [ ] Non-rule lines (comments, blanks) preserved
|
|
92
|
+
- [ ] Domain file remains parseable after modification
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Error Handling
|
|
97
|
+
|
|
98
|
+
| Error | Message |
|
|
99
|
+
|-------|---------|
|
|
100
|
+
| Domain not found | `Error: Domain "{name}" not found in manifest.` |
|
|
101
|
+
| Domain file missing | `Error: Domain file ".synapse/{name}" not found on disk.` |
|
|
102
|
+
| Index not found | `Error: Rule index {index} not found in domain "{name}". Domain has rules 0-{max}.` |
|
|
103
|
+
| Negative index | `Error: Rule index must be a non-negative integer.` |
|
|
104
|
+
| Edit with empty text | `Error: New rule text cannot be empty. To delete, omit the new text.` |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
*Edit Rule — SYNAPSE CRUD Command C4*
|
|
109
|
+
*Source: SYNAPSE-HOOK-SKILL-COMMAND-ANALYSIS.md section 2.3*
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Suggest Domain
|
|
2
|
+
|
|
3
|
+
Analyzes a rule and suggests the ideal SYNAPSE domain for it.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Help users place rules in the most appropriate domain by analyzing the rule's content, matching it against existing domain keywords, and considering domain purposes.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- `.synapse/manifest` exists
|
|
16
|
+
- At least one domain exists in `.synapse/`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Required | Description |
|
|
23
|
+
|-----------|----------|-------------|
|
|
24
|
+
| `rule-text` | Yes | The rule text to analyze |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
|
|
30
|
+
### Step 1: Load Existing Domains
|
|
31
|
+
|
|
32
|
+
Read `.synapse/manifest` and build a list of all domains with their:
|
|
33
|
+
- Domain name and key
|
|
34
|
+
- RECALL keywords (from `{DOMAIN_KEY}_RECALL`)
|
|
35
|
+
- Current state (active/inactive)
|
|
36
|
+
- Rule count (from reading each domain file)
|
|
37
|
+
|
|
38
|
+
### Step 2: Analyze Rule Content
|
|
39
|
+
|
|
40
|
+
Examine the rule text for:
|
|
41
|
+
- **Agent references:** mentions of `@dev`, `@qa`, `@architect`, etc. -> suggests agent-specific domain
|
|
42
|
+
- **Workflow references:** mentions of "story", "sprint", "review", "deploy" -> suggests workflow domain
|
|
43
|
+
- **Technical keywords:** "test", "lint", "commit", "branch" -> match against RECALL keywords
|
|
44
|
+
- **Domain-specific terms:** "security", "performance", "accessibility" -> match domain names
|
|
45
|
+
|
|
46
|
+
### Step 3: Score Domains
|
|
47
|
+
|
|
48
|
+
For each existing domain, calculate a relevance score:
|
|
49
|
+
|
|
50
|
+
| Factor | Weight | Points | Description |
|
|
51
|
+
|--------|--------|--------|-------------|
|
|
52
|
+
| RECALL keyword match | High | 3 | Rule text contains a domain's RECALL keyword |
|
|
53
|
+
| Domain name word match | Medium | 2 | Rule text contains words from domain name |
|
|
54
|
+
| Agent trigger match | High | 3 | Rule mentions an agent that triggers a domain |
|
|
55
|
+
| Existing rule similarity | Low | 1 | Rule is similar to existing rules in domain |
|
|
56
|
+
|
|
57
|
+
Sum the points for each domain. Maximum possible score is 9 (round up to 10 if all factors match). Present as `{score}/10`.
|
|
58
|
+
|
|
59
|
+
### Step 4: Present Suggestion
|
|
60
|
+
|
|
61
|
+
Display the top suggestion(s):
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
Suggested domain for rule: "{rule-text}"
|
|
65
|
+
|
|
66
|
+
1. {domain-name} (score: {score}/10)
|
|
67
|
+
Reason: {justification}
|
|
68
|
+
RECALL keywords: {keywords}
|
|
69
|
+
Current rules: {count}
|
|
70
|
+
|
|
71
|
+
2. {domain-name} (score: {score}/10)
|
|
72
|
+
Reason: {justification}
|
|
73
|
+
|
|
74
|
+
[NEW] Create new domain "{suggested-name}"
|
|
75
|
+
If no existing domain fits well.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Step 5: Offer Quick Action (Optional)
|
|
79
|
+
|
|
80
|
+
After displaying the suggestion, offer:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Quick actions:
|
|
84
|
+
1. Add rule to {suggested-domain} now
|
|
85
|
+
2. Create new domain and add rule
|
|
86
|
+
3. Cancel (do nothing)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If user selects 1: Follow the add-rule task for the suggested domain.
|
|
90
|
+
If user selects 2: Follow the create-domain task, then add-rule.
|
|
91
|
+
If user selects 3: Exit without changes.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Validation
|
|
96
|
+
|
|
97
|
+
- [ ] All existing domains loaded and analyzed
|
|
98
|
+
- [ ] Suggestion includes justification
|
|
99
|
+
- [ ] Score is based on keyword matching and domain analysis
|
|
100
|
+
- [ ] Quick action options work correctly if selected
|
|
101
|
+
- [ ] Handles case where no good match exists (suggests new domain)
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Error Handling
|
|
106
|
+
|
|
107
|
+
| Error | Message |
|
|
108
|
+
|-------|---------|
|
|
109
|
+
| No domains exist | `No domains found in manifest. Use "create" to create your first domain.` |
|
|
110
|
+
| Empty rule text | `Error: Please provide the rule text to analyze.` |
|
|
111
|
+
| Manifest not found | `Error: .synapse/manifest not found. SYNAPSE must be initialized first.` |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
*Suggest Domain — SYNAPSE CRUD Command C7*
|
|
116
|
+
*Source: SYNAPSE-HOOK-SKILL-COMMAND-ANALYSIS.md section 2.3*
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Toggle Domain
|
|
2
|
+
|
|
3
|
+
Toggles a SYNAPSE domain between active and inactive in the manifest.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Enable or disable a domain by changing its `_STATE` value in `.synapse/manifest`. This controls whether the domain's rules are loaded by the SYNAPSE engine. The domain file itself is NOT modified.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- `.synapse/manifest` exists
|
|
16
|
+
- Target domain exists in the manifest
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Required | Description |
|
|
23
|
+
|-----------|----------|-------------|
|
|
24
|
+
| `domain-name` | Yes | Domain name to toggle (kebab-case) |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
|
|
30
|
+
### Step 1: Validate Domain Exists in Manifest
|
|
31
|
+
|
|
32
|
+
1. Derive the domain key: `my-domain` -> `MY_DOMAIN`
|
|
33
|
+
2. Read `.synapse/manifest`
|
|
34
|
+
3. Find the line `{DOMAIN_KEY}_STATE=active` or `{DOMAIN_KEY}_STATE=inactive`
|
|
35
|
+
|
|
36
|
+
If not found: `Error: Domain "{domain-name}" not found in manifest.`
|
|
37
|
+
|
|
38
|
+
### Step 2: Toggle State
|
|
39
|
+
|
|
40
|
+
- If current state is `active`, change to `inactive`
|
|
41
|
+
- If current state is `inactive`, change to `active`
|
|
42
|
+
|
|
43
|
+
**Modify ONLY the manifest file.** Do NOT modify the domain file in `.synapse/{domain-name}`.
|
|
44
|
+
|
|
45
|
+
Replace the line `{DOMAIN_KEY}_STATE={old-state}` with `{DOMAIN_KEY}_STATE={new-state}` in `.synapse/manifest`.
|
|
46
|
+
|
|
47
|
+
### Step 3: Display Result
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Toggled domain "{domain-name}":
|
|
51
|
+
{DOMAIN_KEY}_STATE: {old-state} -> {new-state}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Step 4: Validate
|
|
55
|
+
|
|
56
|
+
- Read back `.synapse/manifest`
|
|
57
|
+
- Verify `{DOMAIN_KEY}_STATE={new-state}` is present
|
|
58
|
+
- Verify the domain file was NOT modified (compare timestamp or content)
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Validation
|
|
63
|
+
|
|
64
|
+
- [ ] Domain exists in manifest before toggle
|
|
65
|
+
- [ ] Only `_STATE` value changed in manifest
|
|
66
|
+
- [ ] Domain file (`.synapse/{domain-name}`) was NOT modified
|
|
67
|
+
- [ ] Previous and new state displayed to user
|
|
68
|
+
- [ ] Manifest remains parseable after modification
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Error Handling
|
|
73
|
+
|
|
74
|
+
| Error | Message |
|
|
75
|
+
|-------|---------|
|
|
76
|
+
| Domain not in manifest | `Error: Domain "{name}" not found in manifest.` |
|
|
77
|
+
| Manifest not found | `Error: .synapse/manifest not found. SYNAPSE must be initialized first.` |
|
|
78
|
+
| Invalid state value | `Error: Unexpected state value "{value}" for domain "{name}". Expected "active" or "inactive".` |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
*Toggle Domain — SYNAPSE CRUD Command C5*
|
|
83
|
+
*Source: SYNAPSE-HOOK-SKILL-COMMAND-ANALYSIS.md section 2.3*
|