@dzhechkov/keysarium-core 1.0.0
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/README.md +126 -0
- package/governance/checkpoint-protocol.md +129 -0
- package/governance/constitution.md +144 -0
- package/governance/shard-protocol.md +118 -0
- package/index.md +89 -0
- package/memory/dream-engine.md +148 -0
- package/memory/memory-protocol.md +197 -0
- package/memory/reward-tracker.md +162 -0
- package/orchestration/background-workers.md +141 -0
- package/orchestration/model-routing.md +92 -0
- package/orchestration/queen-protocol.md +154 -0
- package/orchestration/topology-selection.md +175 -0
- package/package.json +44 -0
- package/platform/adapter-registry.md +93 -0
- package/platform/templates/copilot.md +81 -0
- package/platform/templates/cursor.md +65 -0
- package/platform/templates/opencode.md +69 -0
- package/trust-tiers/promotion-protocol.md +144 -0
- package/trust-tiers/tier-system.md +111 -0
- package/verification/audit-trail.md +154 -0
- package/verification/judge-attestation.md +130 -0
- package/verification/witness-chain.md +138 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Model Routing — 3-Tier Model Assignment
|
|
2
|
+
|
|
3
|
+
> Rules for assigning the right AI model tier to each task in a multi-agent pipeline.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Not every task requires the most capable (and expensive) model. A 3-tier routing system assigns the appropriate model based on task complexity, ensuring cost efficiency without sacrificing quality where it matters.
|
|
8
|
+
|
|
9
|
+
## The 3 Tiers
|
|
10
|
+
|
|
11
|
+
| Tier | Model Class | Latency | Relative Cost | When to Use |
|
|
12
|
+
|------|-------------|---------|---------------|-------------|
|
|
13
|
+
| Tier 1 | Fast/Cheap (e.g., haiku) | ~500ms | 1x (baseline) | Simple transforms, pattern matching, structural checks |
|
|
14
|
+
| Tier 2 | Balanced (e.g., sonnet) | ~2s | 15x | Research synthesis, analysis, multi-evaluator panels |
|
|
15
|
+
| Tier 3 | Premium (e.g., opus) | ~5s | 75x | Creative work, complex problem solving, novel synthesis |
|
|
16
|
+
|
|
17
|
+
## Task Classification Rules
|
|
18
|
+
|
|
19
|
+
### Tier 1 Tasks (Fast/Cheap)
|
|
20
|
+
|
|
21
|
+
Use the cheapest model for:
|
|
22
|
+
- File formatting and restructuring
|
|
23
|
+
- Simple transforms (slug generation, path construction)
|
|
24
|
+
- Structural validation checks (does the file have required sections?)
|
|
25
|
+
- Pattern matching (does this text contain specific markers?)
|
|
26
|
+
- Quick ranking passes (sorting candidates by simple criteria)
|
|
27
|
+
|
|
28
|
+
### Tier 2 Tasks (Balanced)
|
|
29
|
+
|
|
30
|
+
Use the balanced model for:
|
|
31
|
+
- Research synthesis and summarization
|
|
32
|
+
- Analytical work (comparing options, evaluating trade-offs)
|
|
33
|
+
- Multi-evaluator judge panels (domain expert, critic, auditor)
|
|
34
|
+
- Mutation workers in optimization loops
|
|
35
|
+
- Structured generation (scripts, Q&A preparation)
|
|
36
|
+
|
|
37
|
+
### Tier 3 Tasks (Premium)
|
|
38
|
+
|
|
39
|
+
Use the premium model for:
|
|
40
|
+
- Creative design work (prototypes, user journeys)
|
|
41
|
+
- Complex problem solving (TRIZ, game theory analysis)
|
|
42
|
+
- Novel synthesis (combining best elements from multiple candidates)
|
|
43
|
+
- Storytelling and narrative construction
|
|
44
|
+
- System architecture design
|
|
45
|
+
|
|
46
|
+
## Enforcement Rules
|
|
47
|
+
|
|
48
|
+
1. **NEVER** use Tier 3 for structural checks — this wastes budget with no quality gain
|
|
49
|
+
2. **NEVER** use Tier 1 for evaluator panels — quality will be insufficient for reliable scoring
|
|
50
|
+
3. **NEVER** use Tier 1 for creative work — output will be shallow and predictable
|
|
51
|
+
4. When spawning agents, ALWAYS specify the model tier explicitly
|
|
52
|
+
5. If not specified, the agent inherits the parent's tier (usually Tier 3 by default)
|
|
53
|
+
|
|
54
|
+
## Cost Impact
|
|
55
|
+
|
|
56
|
+
Using proper routing can reduce costs by 80-90% compared to using Tier 3 for everything:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Example pipeline with 20 tasks:
|
|
60
|
+
Without routing: 20 tasks * Tier 3 = 20 * 75x = 1500x
|
|
61
|
+
With routing: 8 Tier 1 + 8 Tier 2 + 4 Tier 3 = 8 + 120 + 300 = 428x
|
|
62
|
+
Savings: ~71%
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Per-Pipeline Customization
|
|
66
|
+
|
|
67
|
+
Each pipeline should define a routing table mapping its specific tasks to tiers:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
| Task | Tier | Rationale |
|
|
71
|
+
|------|------|-----------|
|
|
72
|
+
| {Your task 1} | 1 | {Why Tier 1 is sufficient} |
|
|
73
|
+
| {Your task 2} | 2 | {Why Tier 2 is needed} |
|
|
74
|
+
| {Your task 3} | 3 | {Why Tier 3 is required} |
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Anti-Patterns
|
|
78
|
+
|
|
79
|
+
| Anti-Pattern | Detection | Fix |
|
|
80
|
+
|-------------|-----------|-----|
|
|
81
|
+
| Everything on Tier 3 | No model parameter in agent spawns | Add explicit model routing |
|
|
82
|
+
| Judge on Tier 1 | Quality scores have high variance | Upgrade judges to Tier 2 |
|
|
83
|
+
| Creative work on Tier 1 | Outputs are generic and shallow | Upgrade to Tier 3 |
|
|
84
|
+
| Structural check on Tier 3 | Simple pass/fail taking 5+ seconds | Downgrade to Tier 1 |
|
|
85
|
+
|
|
86
|
+
## Integration with Orchestration
|
|
87
|
+
|
|
88
|
+
The Queen Coordinator should:
|
|
89
|
+
1. Load the routing table at INIT
|
|
90
|
+
2. When spawning each agent, consult the routing table
|
|
91
|
+
3. Specify the model parameter based on the task type
|
|
92
|
+
4. Log the model used for each task (for cost tracking)
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Queen Coordinator Protocol — 10-Step Orchestration Lifecycle
|
|
2
|
+
|
|
3
|
+
> Standard protocol for the top-level coordinator (the "Queen") in a multi-agent pipeline.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Queen Coordinator is the master orchestrator that manages the lifecycle of a multi-agent pipeline execution. It follows a mandatory 10-step protocol that ensures proper initialization, execution, and finalization.
|
|
8
|
+
|
|
9
|
+
This protocol is inspired by the Agentic QE 10-phase mandatory coordinator protocol and Ruflo's hierarchical orchestration model.
|
|
10
|
+
|
|
11
|
+
## The 10 Steps
|
|
12
|
+
|
|
13
|
+
### Step 1: INIT
|
|
14
|
+
|
|
15
|
+
**Purpose:** Initialize the working environment.
|
|
16
|
+
|
|
17
|
+
**Actions:**
|
|
18
|
+
1. Create the project working directory (e.g., `projects/{slug}/`)
|
|
19
|
+
2. Verify directory structure matches expected layout
|
|
20
|
+
3. Initialize metadata files (if applicable)
|
|
21
|
+
|
|
22
|
+
**Failure mode:** If directory creation fails, abort with error.
|
|
23
|
+
|
|
24
|
+
### Step 2: HEALTH
|
|
25
|
+
|
|
26
|
+
**Purpose:** Verify all required resources are available.
|
|
27
|
+
|
|
28
|
+
**Actions:**
|
|
29
|
+
1. Check that all required skills exist and are readable
|
|
30
|
+
2. Verify governance shards are present for all active stages
|
|
31
|
+
3. Check that the constitution file is accessible
|
|
32
|
+
4. Verify external dependencies (commands, tools) are available
|
|
33
|
+
|
|
34
|
+
**Failure mode:** If any critical resource is missing, abort with diagnostic message.
|
|
35
|
+
|
|
36
|
+
### Step 3: LOAD
|
|
37
|
+
|
|
38
|
+
**Purpose:** Load historical knowledge from memory.
|
|
39
|
+
|
|
40
|
+
**Actions:**
|
|
41
|
+
1. Call `memory_query()` with the current domain and first stage
|
|
42
|
+
2. Load the most recent dream insights (if available)
|
|
43
|
+
3. Load the brain file (if it exists from a previous export)
|
|
44
|
+
4. Log: "Loaded {N} historical patterns" or "No historical data available (first run)"
|
|
45
|
+
|
|
46
|
+
**Failure mode:** Graceful degradation — if no memory exists, proceed without it.
|
|
47
|
+
|
|
48
|
+
### Step 4: DETECT
|
|
49
|
+
|
|
50
|
+
**Purpose:** Classify the project's domain and characteristics.
|
|
51
|
+
|
|
52
|
+
**Actions:**
|
|
53
|
+
1. Analyze the input to detect the relevant domain
|
|
54
|
+
2. Identify key characteristics (e.g., regulatory requirements, latency needs)
|
|
55
|
+
3. Set cross-pipeline variables: `{DOMAIN}`, `{PRIMARY_USER}`, etc.
|
|
56
|
+
|
|
57
|
+
**Failure mode:** If domain cannot be detected, use "general" as default.
|
|
58
|
+
|
|
59
|
+
### Step 5: SHARD
|
|
60
|
+
|
|
61
|
+
**Purpose:** Load the governance shard for the current stage.
|
|
62
|
+
|
|
63
|
+
**Actions:**
|
|
64
|
+
1. Determine the current stage
|
|
65
|
+
2. Read the corresponding governance shard
|
|
66
|
+
3. Validate prerequisites (upstream promises)
|
|
67
|
+
4. Apply domain-specific rules based on the detected domain
|
|
68
|
+
|
|
69
|
+
**Failure mode:** If shard is missing, fall back to the master configuration.
|
|
70
|
+
|
|
71
|
+
### Step 6: ORCHESTRATE
|
|
72
|
+
|
|
73
|
+
**Purpose:** Execute the pipeline stages with appropriate topologies.
|
|
74
|
+
|
|
75
|
+
**Actions:**
|
|
76
|
+
1. For each active stage:
|
|
77
|
+
a. Select topology (from `topology-selection.md`)
|
|
78
|
+
b. Assign model tier (from `model-routing.md`)
|
|
79
|
+
c. Spawn agents per the topology
|
|
80
|
+
d. Execute the stage
|
|
81
|
+
e. Collect results from all agents
|
|
82
|
+
f. Synthesize results (if parallel agents)
|
|
83
|
+
|
|
84
|
+
**Failure mode:** If a stage fails, halt at checkpoint and report to human.
|
|
85
|
+
|
|
86
|
+
### Step 7: MONITOR
|
|
87
|
+
|
|
88
|
+
**Purpose:** Track execution and enforce checkpoints.
|
|
89
|
+
|
|
90
|
+
**Actions:**
|
|
91
|
+
1. After each stage, display the checkpoint
|
|
92
|
+
2. Wait for human confirmation
|
|
93
|
+
3. Record the reward based on the human's response
|
|
94
|
+
4. Check time budget vs. actual elapsed time
|
|
95
|
+
5. Warn if budget is exceeded
|
|
96
|
+
|
|
97
|
+
**Failure mode:** If checkpoint is skipped, halt — INV-003 violated.
|
|
98
|
+
|
|
99
|
+
### Step 8: COLLECT
|
|
100
|
+
|
|
101
|
+
**Purpose:** Gather all artifacts produced by the pipeline.
|
|
102
|
+
|
|
103
|
+
**Actions:**
|
|
104
|
+
1. Enumerate all files created in the project directory
|
|
105
|
+
2. Verify each artifact against its quality gates
|
|
106
|
+
3. Compile a manifest of all outputs
|
|
107
|
+
|
|
108
|
+
**Failure mode:** If mandatory artifacts are missing, report and halt.
|
|
109
|
+
|
|
110
|
+
### Step 9: STORE
|
|
111
|
+
|
|
112
|
+
**Purpose:** Persist knowledge for future use.
|
|
113
|
+
|
|
114
|
+
**Actions:**
|
|
115
|
+
1. Call `memory_store()` for the final stage outcome
|
|
116
|
+
2. Update the trigger state for the dream engine
|
|
117
|
+
3. If this was a significant execution, trigger knowledge extraction
|
|
118
|
+
|
|
119
|
+
**Failure mode:** Graceful — if storage fails, log and continue (pipeline output is not lost).
|
|
120
|
+
|
|
121
|
+
### Step 10: REPORT
|
|
122
|
+
|
|
123
|
+
**Purpose:** Produce the final output and summary.
|
|
124
|
+
|
|
125
|
+
**Actions:**
|
|
126
|
+
1. Generate a summary of all stages and their outcomes
|
|
127
|
+
2. List all artifacts created
|
|
128
|
+
3. Report time spent vs. budget per stage
|
|
129
|
+
4. Report any warnings or issues encountered
|
|
130
|
+
5. Emit the final pipeline promise tag
|
|
131
|
+
|
|
132
|
+
**Failure mode:** N/A — reporting always succeeds.
|
|
133
|
+
|
|
134
|
+
## Lifecycle Diagram
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
INIT → HEALTH → LOAD → DETECT → SHARD
|
|
138
|
+
↓
|
|
139
|
+
ORCHESTRATE
|
|
140
|
+
↓
|
|
141
|
+
MONITOR ←→ (repeat per stage)
|
|
142
|
+
↓
|
|
143
|
+
COLLECT → STORE → REPORT
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Customization
|
|
147
|
+
|
|
148
|
+
To adapt this protocol for your pipeline:
|
|
149
|
+
|
|
150
|
+
1. Steps 1-3 (INIT, HEALTH, LOAD) are universal — keep as-is
|
|
151
|
+
2. Step 4 (DETECT) — customize detection logic for your domain categories
|
|
152
|
+
3. Step 5 (SHARD) — point to your shard directory
|
|
153
|
+
4. Step 6 (ORCHESTRATE) — define your stages and their topologies
|
|
154
|
+
5. Steps 7-10 (MONITOR, COLLECT, STORE, REPORT) — universal, keep as-is
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Topology Selection — Agent Arrangement Patterns
|
|
2
|
+
|
|
3
|
+
> 6 topology types for organizing agents within a pipeline stage.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
When a pipeline stage uses multiple agents, the agents must be arranged in a topology that defines communication patterns and coordination. This document defines 6 standard topologies and provides guidance on when to use each.
|
|
8
|
+
|
|
9
|
+
## Topology Types
|
|
10
|
+
|
|
11
|
+
### 1. Star
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Coordinator
|
|
15
|
+
/ | \
|
|
16
|
+
Agent1 Agent2 Agent3
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Description:** One coordinator spawns worker agents and collects their results. Workers do not communicate with each other.
|
|
20
|
+
|
|
21
|
+
**Best for:**
|
|
22
|
+
- Simple parallel tasks with independent sub-problems
|
|
23
|
+
- Tasks where a single synthesis step combines all results
|
|
24
|
+
- When fault isolation is important (one worker failure does not affect others)
|
|
25
|
+
|
|
26
|
+
**Properties:**
|
|
27
|
+
- Coordination: centralized
|
|
28
|
+
- Communication: hub-and-spoke
|
|
29
|
+
- Fault tolerance: medium (coordinator is single point of failure)
|
|
30
|
+
- Scalability: good (add more workers without topology change)
|
|
31
|
+
|
|
32
|
+
### 2. Mesh
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Agent1 ←→ Agent2
|
|
36
|
+
↕ ↕
|
|
37
|
+
Agent3 ←→ Agent4
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Description:** All agents can communicate with all other agents. Each agent operates autonomously and shares findings.
|
|
41
|
+
|
|
42
|
+
**Best for:**
|
|
43
|
+
- Fault-tolerant research where any agent can cover for another
|
|
44
|
+
- Tasks where agents may discover information relevant to other agents
|
|
45
|
+
- When no single coordinator is needed
|
|
46
|
+
|
|
47
|
+
**Properties:**
|
|
48
|
+
- Coordination: decentralized
|
|
49
|
+
- Communication: all-to-all
|
|
50
|
+
- Fault tolerance: high (any agent can be lost)
|
|
51
|
+
- Scalability: limited (communication overhead grows quadratically)
|
|
52
|
+
|
|
53
|
+
### 3. Hierarchical
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Queen
|
|
57
|
+
/ \
|
|
58
|
+
Manager1 Manager2
|
|
59
|
+
/ \ / \
|
|
60
|
+
W1 W2 W3 W4
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Description:** Multi-level hierarchy. The Queen delegates to managers, who delegate to workers. Results flow upward.
|
|
64
|
+
|
|
65
|
+
**Best for:**
|
|
66
|
+
- Complex stages with sub-stages
|
|
67
|
+
- When different expertise levels are needed at different tiers
|
|
68
|
+
- Large-scale parallelism (10+ agents)
|
|
69
|
+
|
|
70
|
+
**Properties:**
|
|
71
|
+
- Coordination: hierarchical
|
|
72
|
+
- Communication: parent-child only
|
|
73
|
+
- Fault tolerance: medium (manager failure affects its workers)
|
|
74
|
+
- Scalability: excellent (add more levels as needed)
|
|
75
|
+
|
|
76
|
+
### 4. Ring
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Agent1 → Agent2 → Agent3 → Agent4
|
|
80
|
+
↑ |
|
|
81
|
+
└──────────────────────────┘
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Description:** Agents pass work sequentially in a ring. Each agent processes the work and passes it to the next, adding refinements.
|
|
85
|
+
|
|
86
|
+
**Best for:**
|
|
87
|
+
- Iterative refinement tasks (draft -> review -> polish -> finalize)
|
|
88
|
+
- When each agent adds a specific type of value
|
|
89
|
+
- Pipeline-within-a-pipeline scenarios
|
|
90
|
+
|
|
91
|
+
**Properties:**
|
|
92
|
+
- Coordination: sequential
|
|
93
|
+
- Communication: unidirectional ring
|
|
94
|
+
- Fault tolerance: low (any break stops the ring)
|
|
95
|
+
- Scalability: limited (latency increases linearly)
|
|
96
|
+
|
|
97
|
+
### 5. Hybrid
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Coordinator
|
|
101
|
+
/ \
|
|
102
|
+
[Star cluster] [Mesh cluster]
|
|
103
|
+
/ | \ A1 ←→ A2
|
|
104
|
+
W1 W2 W3 ↕ ↕
|
|
105
|
+
A3 ←→ A4
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Description:** Combines two or more topologies. Different parts of the stage use different agent arrangements.
|
|
109
|
+
|
|
110
|
+
**Best for:**
|
|
111
|
+
- Stages with heterogeneous sub-tasks
|
|
112
|
+
- When some sub-tasks need isolation (star) and others need collaboration (mesh)
|
|
113
|
+
|
|
114
|
+
**Properties:**
|
|
115
|
+
- Coordination: mixed
|
|
116
|
+
- Communication: varies by cluster
|
|
117
|
+
- Fault tolerance: varies
|
|
118
|
+
- Scalability: good (each cluster scales independently)
|
|
119
|
+
|
|
120
|
+
### 6. Adaptive
|
|
121
|
+
|
|
122
|
+
**Description:** The topology starts as one type and evolves during execution based on conditions.
|
|
123
|
+
|
|
124
|
+
**Rules:**
|
|
125
|
+
- Start with Star
|
|
126
|
+
- If agent disagreement detected (scores differ by > 3 points): switch to Mesh for reconciliation
|
|
127
|
+
- If task is simple and progressing well: stay as Star
|
|
128
|
+
- If complexity exceeds threshold: elevate to Hierarchical
|
|
129
|
+
|
|
130
|
+
**Best for:**
|
|
131
|
+
- Uncertain tasks where the right topology is not known in advance
|
|
132
|
+
- When the system should self-organize based on outcomes
|
|
133
|
+
|
|
134
|
+
**Properties:**
|
|
135
|
+
- Coordination: dynamic
|
|
136
|
+
- Communication: evolves
|
|
137
|
+
- Fault tolerance: high (adapts around failures)
|
|
138
|
+
- Scalability: good (adapts structure to load)
|
|
139
|
+
|
|
140
|
+
## Selection Guide
|
|
141
|
+
|
|
142
|
+
| Stage Characteristic | Recommended Topology | Rationale |
|
|
143
|
+
|---------------------|---------------------|-----------|
|
|
144
|
+
| Independent parallel tasks | **Star** | Simple, reliable, easy to synthesize |
|
|
145
|
+
| Fault-tolerant research | **Mesh** | Any agent can cover for another |
|
|
146
|
+
| Multi-evaluator panel | **Star** (isolated) | Judges must NOT communicate |
|
|
147
|
+
| Iterative refinement | **Ring** | Each pass adds specific value |
|
|
148
|
+
| Complex multi-level work | **Hierarchical** | Delegate and aggregate |
|
|
149
|
+
| Heterogeneous sub-tasks | **Hybrid** | Match topology to sub-task type |
|
|
150
|
+
| Uncertain complexity | **Adaptive** | Start simple, evolve as needed |
|
|
151
|
+
|
|
152
|
+
## Integration with Model Routing
|
|
153
|
+
|
|
154
|
+
Each topology can specify model tiers for its agents:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Star:
|
|
158
|
+
Coordinator: opus (complex synthesis)
|
|
159
|
+
Workers: sonnet (analytical work) or haiku (simple tasks)
|
|
160
|
+
|
|
161
|
+
Hierarchical:
|
|
162
|
+
Queen: opus
|
|
163
|
+
Managers: sonnet
|
|
164
|
+
Workers: haiku
|
|
165
|
+
|
|
166
|
+
Mesh:
|
|
167
|
+
All agents: same tier (usually sonnet)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Implementation Note
|
|
171
|
+
|
|
172
|
+
In Claude Code, topologies are implemented using the Agent tool:
|
|
173
|
+
- Star/Hierarchical: Orchestrator spawns Agent tool calls
|
|
174
|
+
- Mesh: Multiple Agent calls that read shared files
|
|
175
|
+
- Ring: Sequential Agent calls, each reading the previous agent's output
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dzhechkov/keysarium-core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Core framework for multi-agent pipelines: governance, memory, orchestration, verification, trust tiers, and multi-platform support",
|
|
5
|
+
"main": "index.md",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.md",
|
|
8
|
+
"governance/",
|
|
9
|
+
"memory/",
|
|
10
|
+
"orchestration/",
|
|
11
|
+
"verification/",
|
|
12
|
+
"trust-tiers/",
|
|
13
|
+
"platform/"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"claude",
|
|
17
|
+
"claude-code",
|
|
18
|
+
"ai",
|
|
19
|
+
"multi-agent",
|
|
20
|
+
"pipeline",
|
|
21
|
+
"framework",
|
|
22
|
+
"governance",
|
|
23
|
+
"orchestration",
|
|
24
|
+
"verification",
|
|
25
|
+
"trust-tiers",
|
|
26
|
+
"memory",
|
|
27
|
+
"reward-learning",
|
|
28
|
+
"keysarium-core"
|
|
29
|
+
],
|
|
30
|
+
"author": "dzhechko",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=16.0.0"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/dzhechko/product-keysarium-2026",
|
|
38
|
+
"directory": "packages/dz-keysarium-core"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/dzhechko/product-keysarium-2026#keysarium-core",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/dzhechko/product-keysarium-2026/issues"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Platform Adapter Registry
|
|
2
|
+
|
|
3
|
+
> Central registry for multi-platform support. Maps each supported AI coding platform to its configuration format, output paths, and translation strategy.
|
|
4
|
+
|
|
5
|
+
## Supported Platforms
|
|
6
|
+
|
|
7
|
+
| Platform | Config Format | Output Structure | Complexity |
|
|
8
|
+
|----------|---------------|------------------|------------|
|
|
9
|
+
| Claude Code | `.claude/` directory | Native — skills, rules, commands, shards | Native |
|
|
10
|
+
| Cursor | `.cursorrules` + optional `.cursor/skills/` | Flat rules file with inlined skills | Low |
|
|
11
|
+
| OpenCode | `.opencode/` directory | Directory hierarchy mirroring Claude Code | Low |
|
|
12
|
+
| GitHub Copilot | `.github/copilot-instructions.md` | Single markdown file | Medium |
|
|
13
|
+
|
|
14
|
+
## Platform Details
|
|
15
|
+
|
|
16
|
+
### Claude Code (Native)
|
|
17
|
+
|
|
18
|
+
| Property | Value |
|
|
19
|
+
|----------|-------|
|
|
20
|
+
| Config directory | `.claude/` |
|
|
21
|
+
| Skills | `.claude/skills/{name}/SKILL.md` |
|
|
22
|
+
| Rules | `.claude/rules/{name}.md` |
|
|
23
|
+
| Commands | `.claude/commands/{name}.md` |
|
|
24
|
+
| Shards | `.claude/shards/{name}.shard.md` |
|
|
25
|
+
| Notes | This is the native format. No translation needed. |
|
|
26
|
+
|
|
27
|
+
### Cursor
|
|
28
|
+
|
|
29
|
+
| Property | Value |
|
|
30
|
+
|----------|-------|
|
|
31
|
+
| Config file | `.cursorrules` (project root) |
|
|
32
|
+
| Format | Plain text / markdown |
|
|
33
|
+
| Skills | Key instructions extracted and inlined; large skills in `.cursor/skills/` |
|
|
34
|
+
| Rules | All rules concatenated under sections |
|
|
35
|
+
| Max size | Recommended < 10,000 tokens |
|
|
36
|
+
|
|
37
|
+
### OpenCode
|
|
38
|
+
|
|
39
|
+
| Property | Value |
|
|
40
|
+
|----------|-------|
|
|
41
|
+
| Config directory | `.opencode/` |
|
|
42
|
+
| Config file | `.opencode/config.yaml` |
|
|
43
|
+
| Skills | `.opencode/skills/{name}.md` (one file per skill) |
|
|
44
|
+
| Rules | `.opencode/rules/{name}.md` (one file per rule) |
|
|
45
|
+
| Notes | Most structurally similar to Claude Code |
|
|
46
|
+
|
|
47
|
+
### GitHub Copilot
|
|
48
|
+
|
|
49
|
+
| Property | Value |
|
|
50
|
+
|----------|-------|
|
|
51
|
+
| Config file | `.github/copilot-instructions.md` |
|
|
52
|
+
| Format | Single markdown file |
|
|
53
|
+
| Skills | Summarized into sections within the file |
|
|
54
|
+
| Rules | Merged into the instructions file |
|
|
55
|
+
| Max size | Recommended < 8,000 tokens |
|
|
56
|
+
|
|
57
|
+
## Translation Strategy
|
|
58
|
+
|
|
59
|
+
### Source Structure
|
|
60
|
+
|
|
61
|
+
The source of truth is the Claude Code `.claude/` directory (or equivalent). Translation generates platform-specific configs from this source.
|
|
62
|
+
|
|
63
|
+
### Translation Rules
|
|
64
|
+
|
|
65
|
+
| Source Element | Cursor | OpenCode | Copilot |
|
|
66
|
+
|----------------|--------|----------|---------|
|
|
67
|
+
| `Read: .claude/skills/X/SKILL.md` | "Follow the X skill protocol" | `See: .opencode/skills/X.md` | Summarize inline |
|
|
68
|
+
| Agent tool references | "Break into sub-tasks" | "Break into sub-tasks" | "Break into sub-tasks" |
|
|
69
|
+
| Model routing | Omit (platform-managed) | Omit (platform-managed) | Omit (platform-managed) |
|
|
70
|
+
| `$ARGUMENTS` variable | "User-provided input" | "User-provided input" | "User-provided context" |
|
|
71
|
+
| Promise tags | Keep as markers | Keep as markers | Keep as markers |
|
|
72
|
+
| Checkpoint protocol | "Pause and confirm" | "Pause and confirm" | "Confirm before proceeding" |
|
|
73
|
+
| Governance shards | Omit (single-file) | Include if directory-based | Omit (single-file) |
|
|
74
|
+
|
|
75
|
+
## Adding a New Platform
|
|
76
|
+
|
|
77
|
+
To add support for a new platform:
|
|
78
|
+
|
|
79
|
+
1. Create a template file in `platform/templates/{platform-name}.md`
|
|
80
|
+
2. Add an entry to the "Supported Platforms" table above
|
|
81
|
+
3. Add a "Platform Details" section
|
|
82
|
+
4. Define translation rules for the new platform
|
|
83
|
+
5. Test generation with the new platform
|
|
84
|
+
|
|
85
|
+
## Template Format
|
|
86
|
+
|
|
87
|
+
Each platform template file should include:
|
|
88
|
+
|
|
89
|
+
1. **Target Format** — Description of the platform's config format
|
|
90
|
+
2. **Generation Protocol** — Step-by-step instructions for generating the config
|
|
91
|
+
3. **Content Adaptation Rules** — Table mapping source elements to target format
|
|
92
|
+
4. **Size Constraints** — Token/word limits for the platform
|
|
93
|
+
5. **Example Output Structure** — What the generated files look like
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# GitHub Copilot Platform Template
|
|
2
|
+
|
|
3
|
+
> Generates `.github/copilot-instructions.md` from pipeline source configuration.
|
|
4
|
+
|
|
5
|
+
## Target Format
|
|
6
|
+
|
|
7
|
+
GitHub Copilot reads custom instructions from `.github/copilot-instructions.md`. This is a single markdown file with all project-level instructions.
|
|
8
|
+
|
|
9
|
+
## Generation Protocol
|
|
10
|
+
|
|
11
|
+
### Step 1: Generate `.github/copilot-instructions.md`
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
# {Project Name} -- Copilot Instructions
|
|
15
|
+
|
|
16
|
+
> Auto-generated from pipeline configuration. Source of truth: {source path}
|
|
17
|
+
|
|
18
|
+
## Project Overview
|
|
19
|
+
{Purpose, key concepts, directory structure overview}
|
|
20
|
+
|
|
21
|
+
## Core Rules
|
|
22
|
+
{For each rule, 5-10 actionable bullet points.
|
|
23
|
+
Focus on constraints and do/don't instructions.}
|
|
24
|
+
|
|
25
|
+
## Skills Reference
|
|
26
|
+
{For each skill:
|
|
27
|
+
**Purpose:** one-line
|
|
28
|
+
**Key protocol:** 3-5 steps
|
|
29
|
+
**Quality gates:** 2-4 checks}
|
|
30
|
+
|
|
31
|
+
## Pipeline Overview
|
|
32
|
+
{Phase | Purpose | Key Output table}
|
|
33
|
+
|
|
34
|
+
## Anti-Patterns
|
|
35
|
+
{Pattern | Fix table}
|
|
36
|
+
|
|
37
|
+
## Domain-Specific Guidance
|
|
38
|
+
{3-4 bullet points per domain}
|
|
39
|
+
|
|
40
|
+
## File Conventions
|
|
41
|
+
{Key naming and directory rules}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2: Size Check
|
|
45
|
+
|
|
46
|
+
Verify the file is under 8,000 tokens (~6,000 words). Priority for trimming:
|
|
47
|
+
1. Core Rules (keep all)
|
|
48
|
+
2. Anti-Patterns (keep all)
|
|
49
|
+
3. Skills Reference (summarize further)
|
|
50
|
+
4. Pipeline Overview (keep)
|
|
51
|
+
5. Domain-Specific Guidance (trim)
|
|
52
|
+
|
|
53
|
+
### Step 3: Directory Safety
|
|
54
|
+
|
|
55
|
+
If `.github/copilot-instructions.md` already exists, generate to `copilot-instructions.generated.md` and warn.
|
|
56
|
+
|
|
57
|
+
## Content Adaptation Rules
|
|
58
|
+
|
|
59
|
+
| Source Element | Copilot Adaptation |
|
|
60
|
+
|----------------|---------------------|
|
|
61
|
+
| Skill references | Summarize inline (no separate files) |
|
|
62
|
+
| Agent tool references | "Break complex tasks into sub-tasks" |
|
|
63
|
+
| Model routing | Omit entirely |
|
|
64
|
+
| Promise tags | Keep as phase completion markers |
|
|
65
|
+
| Checkpoint protocol | "Confirm with user before moving to next phase" |
|
|
66
|
+
| Governance shards | Summarize key constraints only |
|
|
67
|
+
|
|
68
|
+
## Copilot-Specific Notes
|
|
69
|
+
|
|
70
|
+
1. Copilot reads the entire file on each interaction — shorter is better
|
|
71
|
+
2. No directory-based skills — everything in one markdown file
|
|
72
|
+
3. Copilot does not support slash commands — reference as "workflows" or "procedures"
|
|
73
|
+
4. Focus on rules and constraints — Copilot benefits most from clear do/don't
|
|
74
|
+
5. Code patterns over prose — show examples instead of descriptions
|
|
75
|
+
|
|
76
|
+
## Example Output
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
.github/
|
|
80
|
+
└── copilot-instructions.md (single file, <8K tokens)
|
|
81
|
+
```
|