@gcunharodrigues/wrxn 0.2.0 → 0.2.1
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/lib/executor.cjs +1 -1
- package/migrations/002-seeded-honesty.cjs +100 -0
- package/package.json +1 -1
- package/payload/.claude/constitution.md +4 -1
- package/payload/.claude/hooks/enforce-push-authority.cjs +6 -5
- package/payload/.claude/hooks/session-end.cjs +86 -46
- package/payload/.claude/skills/synapse/SKILL.md +94 -93
- package/payload/.claude/skills/synapse/assets/README.md +18 -34
- package/payload/.claude/skills/synapse/references/brackets.md +50 -76
- package/payload/.claude/skills/synapse/references/commands.md +43 -100
- package/payload/.claude/skills/synapse/references/domains.md +41 -105
- package/payload/.claude/skills/synapse/references/layers.md +74 -152
- package/payload/.claude/skills/synapse/references/manifest.md +58 -108
- package/payload/.synapse/global +1 -1
- package/payload/.synapse/routing +1 -1
- package/payload/docs/agents/domain.md +8 -13
|
@@ -1,100 +1,74 @@
|
|
|
1
|
-
# SYNAPSE
|
|
1
|
+
# SYNAPSE token budget & handoff
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
*(This reference covers the flat token-budget governor and the non-blocking handoff directive — the
|
|
4
|
+
two controls SYNAPSE applies after it assembles the layer sections.)*
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## The flat token budget
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Everything except the constitution is trimmable. SYNAPSE applies ONE flat budget — there are no
|
|
9
|
+
per-tier or per-window budgets.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## How Brackets Are Calculated
|
|
19
|
-
|
|
20
|
-
The context tracker estimates remaining context using:
|
|
11
|
+
- **Budget:** `RULES_BUDGET_TOKENS` in `.synapse/manifest` (default `600`), overridable per session
|
|
12
|
+
with the `WRXN_RULES_BUDGET` env var.
|
|
13
|
+
- **Estimate:** a section's token cost is estimated as `ceil(characters / 4)`.
|
|
14
|
+
- **Exempt:** the constitution (L0) sits outside the budget and is always kept.
|
|
15
|
+
- **How it trims:** the trimmable sections keep manifest order. While the kept set is over budget,
|
|
16
|
+
whole sections are dropped from the END of that order first — the last-declared domain goes first,
|
|
17
|
+
so earlier-declared domains have higher priority. Sections are dropped whole, never partially.
|
|
18
|
+
- **What it records:** if anything was dropped, a line is appended naming the dropped domains:
|
|
21
19
|
|
|
22
20
|
```
|
|
23
|
-
|
|
21
|
+
[SYNAPSE-RULES-TRIM] ROUTING dropped over the 600-token rules budget
|
|
24
22
|
```
|
|
25
23
|
|
|
26
|
-
|
|
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
|
|
24
|
+
## The handoff directive
|
|
39
25
|
|
|
40
|
-
|
|
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 |
|
|
26
|
+
When the real consumed context reaches the handoff threshold, SYNAPSE appends a **non-blocking**
|
|
27
|
+
`[HANDOFF REQUIRED]` directive. It never refuses work — it orders a clean wrap-up:
|
|
46
28
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
29
|
+
```
|
|
30
|
+
[HANDOFF REQUIRED]
|
|
31
|
+
Context is at ~42% of the model window (>= the 40% handoff threshold). NON-BLOCKING — do NOT stop work:
|
|
32
|
+
1. Finish the current request.
|
|
33
|
+
2. Run the handoff skill to write the baton (a compact handoff document).
|
|
34
|
+
3. Tell the operator to /clear and open a fresh session, where the baton injects on resume.
|
|
35
|
+
```
|
|
54
36
|
|
|
55
|
-
|
|
37
|
+
Like the constitution, the handoff directive is outside the budget — it is never trimmed.
|
|
56
38
|
|
|
57
|
-
###
|
|
58
|
-
- Minimize injected rules to essentials only
|
|
59
|
-
- Avoid redundant context — agent has full conversation history
|
|
60
|
-
- Full layer stack available but lean injection
|
|
39
|
+
### The threshold
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- Monitor token usage — consider summarizing long outputs
|
|
65
|
-
- Prefer concise code examples over verbose explanations
|
|
41
|
+
`consumed = resident_tokens / model_window`. The directive fires when `consumed >=` the threshold.
|
|
42
|
+
The threshold is resolved as: `WRXN_HANDOFF_PCT` env var > `HANDOFF_PCT` in the manifest > `0.40`.
|
|
66
43
|
|
|
67
|
-
###
|
|
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
|
|
44
|
+
### Resident tokens
|
|
72
45
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- Document incomplete work in story file
|
|
46
|
+
The real tokens currently resident in context: the last assistant turn's
|
|
47
|
+
`input_tokens + cache_read_input_tokens + cache_creation_input_tokens` read from the session
|
|
48
|
+
transcript (output tokens are excluded — they are not resident in the next prompt). If the transcript
|
|
49
|
+
is unreadable, the handoff math is skipped silently.
|
|
78
50
|
|
|
79
|
-
|
|
51
|
+
### The model window
|
|
80
52
|
|
|
81
|
-
The
|
|
53
|
+
The window is resolved by an explicit precedence, so the math is correct on both 200k and 1M sessions
|
|
54
|
+
instead of assuming a fixed window:
|
|
82
55
|
|
|
83
|
-
1.
|
|
84
|
-
2.
|
|
85
|
-
3.
|
|
56
|
+
1. `WRXN_CONTEXT_WINDOW` env var (a positive number wins unconditionally).
|
|
57
|
+
2. The live statusline sidecar for the session (tracks a mid-session model switch).
|
|
58
|
+
3. `CONTEXT_WINDOW` in `.synapse/manifest`.
|
|
59
|
+
4. `~/.claude.json` — a model id tagged `[1m]` ⇒ 1,000,000.
|
|
60
|
+
5. Self-correcting net: resident already past 200,000 ⇒ the window must be larger (1,000,000).
|
|
61
|
+
6. Fallback: 200,000.
|
|
86
62
|
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
SUMMARY → KEYWORD → SQUAD → TASK → WORKFLOW → AGENT → CONSTITUTION
|
|
90
|
-
```
|
|
63
|
+
## Why a flat budget
|
|
91
64
|
|
|
92
|
-
|
|
65
|
+
An earlier engine varied the budget by an estimate of how much window remained. This engine does not:
|
|
66
|
+
one flat budget keeps assembly cheap and predictable, and the handoff directive — driven by real
|
|
67
|
+
token usage — covers the "running low" case directly instead of through tiered injection.
|
|
93
68
|
|
|
94
|
-
## Source
|
|
69
|
+
## Source
|
|
95
70
|
|
|
96
71
|
| File | Purpose |
|
|
97
72
|
|------|---------|
|
|
98
|
-
| `.
|
|
99
|
-
| `.synapse/
|
|
100
|
-
| `.aiox-core/core/synapse/output/formatter.js` | Token budget enforcement + truncation |
|
|
73
|
+
| `.claude/hooks/synapse-engine.cjs` | `applyBudget`, `estimateTokens`, `resolveBudget`; `readResidentTokens`, `modelWindow`, `resolveHandoffPct`, `handoffDirective`. |
|
|
74
|
+
| `.synapse/manifest` | `RULES_BUDGET_TOKENS`, `HANDOFF_PCT`, `CONTEXT_WINDOW`. |
|
|
@@ -1,118 +1,61 @@
|
|
|
1
|
-
# SYNAPSE
|
|
1
|
+
# SYNAPSE invocation & configuration
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## SYNAPSE has no interactive commands
|
|
4
4
|
|
|
5
|
-
SYNAPSE
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
3. **CRUD operations** — Create, modify, and manage domains and rules
|
|
5
|
+
SYNAPSE is not something you call. It is a hook that runs automatically on every prompt. There are no
|
|
6
|
+
mode toggles and no management sub-commands — you change its behavior by editing its files or by
|
|
7
|
+
setting environment variables. (The legacy engine's interactive command surface was removed.)
|
|
9
8
|
|
|
10
|
-
##
|
|
9
|
+
## How it is invoked
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
SYNAPSE is wired as a `UserPromptSubmit` hook in the install's `.claude/settings.json`:
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"hooks": {
|
|
16
|
+
"UserPromptSubmit": [
|
|
17
|
+
{ "hooks": [ { "type": "command", "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/synapse-engine.cjs\"" } ] }
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
69
21
|
```
|
|
70
|
-
Prompts for: domain name, layer, description, initial rules.
|
|
71
22
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```
|
|
23
|
+
On each prompt Claude Code passes the event JSON on stdin; the engine returns an envelope whose
|
|
24
|
+
`additionalContext` is the `<synapse-rules>` block (or `{}` to inject nothing). It is fail-open: any
|
|
25
|
+
fault injects nothing and never blocks the prompt.
|
|
76
26
|
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
*synapse toggle agent-dev
|
|
80
|
-
```
|
|
27
|
+
## Configuration
|
|
81
28
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
29
|
+
| Knob | Where | Effect |
|
|
30
|
+
|------|-------|--------|
|
|
31
|
+
| `RULES_BUDGET_TOKENS` | `.synapse/manifest` | Token ceiling on the trimmable sections (default 600). |
|
|
32
|
+
| `HANDOFF_PCT` | `.synapse/manifest` | Handoff threshold as a window fraction (default 0.40). |
|
|
33
|
+
| `CONTEXT_WINDOW` | `.synapse/manifest` | Pin the model window (tokens) for the handoff math. |
|
|
34
|
+
| `WRXN_RULES_BUDGET` | env | Overrides the rules budget for the session. |
|
|
35
|
+
| `WRXN_HANDOFF_PCT` | env | Overrides the handoff threshold for the session. |
|
|
36
|
+
| `WRXN_CONTEXT_WINDOW` | env | Forces the model window for the session. |
|
|
87
37
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*synapse command
|
|
91
|
-
```
|
|
92
|
-
Prompts for: command name, behavior rules.
|
|
38
|
+
To add or change the injected rules, edit the domain files and the registry — see
|
|
39
|
+
[domains & rule files](domains.md) and [the manifest format](manifest.md).
|
|
93
40
|
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
*synapse suggest "Use TypeScript strict mode"
|
|
97
|
-
```
|
|
98
|
-
Analyzes the rule content and suggests the best-fit domain.
|
|
41
|
+
## Inspecting it
|
|
99
42
|
|
|
100
|
-
|
|
43
|
+
Run the engine by hand with a sample event to see exactly what it would inject:
|
|
101
44
|
|
|
45
|
+
```sh
|
|
46
|
+
echo '{"prompt":"please deploy","cwd":"'"$PWD"'"}' \
|
|
47
|
+
| node .claude/hooks/synapse-engine.cjs
|
|
102
48
|
```
|
|
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
49
|
|
|
110
|
-
|
|
50
|
+
- An empty `{}` means nothing was injected — check that you are inside a wrxn install (a
|
|
51
|
+
`wrxn.install.json` receipt exists at or above `cwd`) and that domains are `active` in the manifest.
|
|
52
|
+
- A `<synapse-rules>` block shows the assembled layers; a recall domain (e.g. `routing`) appears only
|
|
53
|
+
when the prompt contains one of its trigger words (the sample above includes `deploy`).
|
|
54
|
+
|
|
55
|
+
## Source
|
|
111
56
|
|
|
112
57
|
| File | Purpose |
|
|
113
58
|
|------|---------|
|
|
114
|
-
| `.synapse
|
|
115
|
-
| `.claude/
|
|
116
|
-
| `.
|
|
117
|
-
| `.claude/commands/synapse/templates/` | Domain and manifest templates |
|
|
118
|
-
| `.claude/commands/synapse/utils/manifest-parser-reference.md` | Parser format reference |
|
|
59
|
+
| `.claude/hooks/synapse-engine.cjs` | The engine entry point (`main`) + `compose`. |
|
|
60
|
+
| `.claude/settings.json` | Wires the `UserPromptSubmit` hook. |
|
|
61
|
+
| `.synapse/manifest` | The budget/handoff scalars. |
|
|
@@ -1,126 +1,62 @@
|
|
|
1
|
-
# SYNAPSE
|
|
1
|
+
# SYNAPSE domains & rule files
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A domain is a small `KEY=VALUE` file of rules that SYNAPSE injects into prompts. Each domain is
|
|
4
|
+
registered in `.synapse/manifest` and its rules live in a sibling file `.synapse/<domain>` (the
|
|
5
|
+
lowercased prefix). The engine reads them on every `UserPromptSubmit`.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## The kinds of domain
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
| Kind | How it fires | Manifest | Seeded example |
|
|
10
|
+
|------|--------------|----------|----------------|
|
|
11
|
+
| Constitution | always; never trimmed | `CONSTITUTION_STATE=active`, `_ALWAYS_ON=true` | sourced from `.claude/constitution.md` |
|
|
12
|
+
| Always-on (L1) | every prompt | `<DOMAIN>_STATE=active`, `_ALWAYS_ON=true` | `global`, `pipeline` |
|
|
13
|
+
| Keyword-recall (L6) | when a trigger word is in the prompt | `<DOMAIN>_STATE=active`, `_RECALL=word,...` | `routing` |
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
The constitution is the one special case: it has no `.synapse/` file — its body is rendered from
|
|
16
|
+
`.claude/constitution.md`.
|
|
10
17
|
|
|
11
|
-
|
|
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-sdc`, `workflow-qa-loop` |
|
|
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` |
|
|
18
|
+
## Rule-file format
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
Rules are `<DOMAIN>_RULE_<N>=text` lines, where `<DOMAIN>` is the uppercase prefix and `<N>` orders
|
|
21
|
+
the rules ascending. Blank lines and `#` comments are ignored.
|
|
23
22
|
|
|
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
23
|
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
24
|
+
# .synapse/global (always-on, L1)
|
|
25
|
+
GLOBAL_RULE_0=git push, PR creation, and release tags are deliberate acts held behind a confirmation flag (anti-accidental-push) — `devops` is a dispatch-phase label, not an authority.
|
|
26
|
+
GLOBAL_RULE_1=The unit of work is an issue with explicit acceptance criteria.
|
|
27
|
+
GLOBAL_RULE_2=Before building, apply the decision hierarchy: REUSE > ADAPT > CREATE.
|
|
65
28
|
```
|
|
66
|
-
# SYNAPSE Workflow Domain: Story Development (L3)
|
|
67
|
-
|
|
68
|
-
WORKFLOW_SDC_RULE_0=Follow SDC phases: Create → Validate → Implement → QA Gate
|
|
69
|
-
WORKFLOW_SDC_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
29
|
|
|
76
|
-
|
|
30
|
+
At assembly the rules render as a numbered section headed by the domain — `[GLOBAL]` for an
|
|
31
|
+
always-on domain, `[RECALL: routing]` for a recall domain.
|
|
77
32
|
|
|
78
|
-
|
|
79
|
-
|-----|---------|---------|
|
|
80
|
-
| `{PREFIX}_STATE` | Domain active state (`active` or `inactive`) | `AGENT_DEV_STATE=active` |
|
|
33
|
+
## The seeded domains
|
|
81
34
|
|
|
82
|
-
|
|
35
|
+
| File | Kind | What it carries |
|
|
36
|
+
|------|------|-----------------|
|
|
37
|
+
| `.synapse/global` | always-on | WRXN operational invariants (devops-only push, issue-driven work, the decision hierarchy, conventional commits, the green-suite push gate). |
|
|
38
|
+
| `.synapse/pipeline` | always-on | The unified-dev build route and how to scale it to the task. |
|
|
39
|
+
| `.synapse/routing` | keyword-recall | Representative recall rules (worktrees, deploys, the unit of work). |
|
|
83
40
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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_SDC_WORKFLOW_TRIGGER=sdc` |
|
|
90
|
-
| `{PREFIX}_RECALL` | Keywords that trigger domain (L6) | `MYLIB_RECALL=react,hooks` |
|
|
91
|
-
| `{PREFIX}_EXCLUDE` | Agents/contexts to exclude from | `MYLIB_EXCLUDE=qa` |
|
|
41
|
+
`global` and `pipeline` are managed (kernel-owned, overwritten on `wrxn update`). `routing` is seeded
|
|
42
|
+
— operator-owned, created once at init and never overwritten on update. Edit `routing` freely; add
|
|
43
|
+
your own recall rules there.
|
|
92
44
|
|
|
93
|
-
|
|
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
|
-
- 4 Workflow domains (L3): `sdc`, `qa-loop`, `spec`, `brownfield` (triggers; keys `WORKFLOW_SDC`, `WORKFLOW_QA_LOOP`, `WORKFLOW_SPEC`, `WORKFLOW_BROWNFIELD`)
|
|
101
|
-
|
|
102
|
-
## Creating Custom Domains
|
|
103
|
-
|
|
104
|
-
Use the CRUD command to create a new domain:
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
*synapse create
|
|
108
|
-
```
|
|
45
|
+
## Adding a domain
|
|
109
46
|
|
|
110
|
-
|
|
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
|
|
47
|
+
There is no interactive creator — add a domain by editing two files:
|
|
115
48
|
|
|
116
|
-
|
|
49
|
+
1. Create `.synapse/<name>` with `<NAME>_RULE_0=...` lines.
|
|
50
|
+
2. Register it in `.synapse/manifest`:
|
|
51
|
+
- always-on: `<NAME>_STATE=active` and `<NAME>_ALWAYS_ON=true`.
|
|
52
|
+
- keyword-recall: `<NAME>_STATE=active` and `<NAME>_RECALL=word1,word2`.
|
|
117
53
|
|
|
118
|
-
|
|
54
|
+
See [the manifest format](manifest.md) and the [templates](../assets/README.md).
|
|
119
55
|
|
|
120
|
-
## Source
|
|
56
|
+
## Source
|
|
121
57
|
|
|
122
58
|
| File | Purpose |
|
|
123
59
|
|------|---------|
|
|
124
|
-
| `.synapse/manifest` |
|
|
125
|
-
| `.synapse
|
|
126
|
-
| `.
|
|
60
|
+
| `.synapse/manifest` | Domain registry. |
|
|
61
|
+
| `.synapse/<domain>` | The rule files. |
|
|
62
|
+
| `.claude/hooks/synapse-engine.cjs` | `domainRules` / `renderRulesSection` read + render them. |
|