@dzhechkov/keysarium 1.2.0 → 1.3.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 +7 -2
- package/package.json +2 -2
- package/templates/.claude/commands/brain-export.md +97 -20
- package/templates/.claude/commands/brain-import.md +75 -4
- package/templates/CLAUDE.md +20 -14
- package/templates/docs/feature-adr/01-architecture.md +750 -0
- package/templates/docs/feature-adr/02-functionality.md +712 -0
- package/templates/docs/feature-adr/03-deployment-guide.md +614 -0
- package/templates/docs/feature-adr/04-admin-guide.md +564 -0
- package/templates/docs/feature-adr/05-user-guide.md +508 -0
- package/templates/docs/feature-adr/06-user-flows.md +1101 -0
- package/templates/docs/keysarium-core/01-architecture.md +559 -0
- package/templates/docs/keysarium-core/02-functionality.md +953 -0
- package/templates/docs/keysarium-core/03-deployment-guide.md +625 -0
- package/templates/docs/keysarium-core/04-admin-guide.md +529 -0
- package/templates/docs/keysarium-core/05-user-guide.md +599 -0
- package/templates/docs/keysarium-core/06-user-flows.md +804 -0
- package/templates/lib/memory-protocol.md +127 -22
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
# Функциональность @dzhechkov/keysarium-core
|
|
2
|
+
|
|
3
|
+
> Полный справочник по всем протоколам, алгоритмам и JSON-схемам фреймворка.
|
|
4
|
+
|
|
5
|
+
## Содержание
|
|
6
|
+
|
|
7
|
+
1. [Governance — Управление](#1-governance--управление)
|
|
8
|
+
2. [Memory — Обучение](#2-memory--обучение)
|
|
9
|
+
3. [Orchestration — Оркестрация](#3-orchestration--оркестрация)
|
|
10
|
+
4. [Verification — Верификация](#4-verification--верификация)
|
|
11
|
+
5. [Trust Tiers — Классификация доверия](#5-trust-tiers--классификация-доверия)
|
|
12
|
+
6. [Platform — Мультиплатформенность](#6-platform--мультиплатформенность)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. Governance — Управление
|
|
17
|
+
|
|
18
|
+
### 1.1. Constitution (constitution.md)
|
|
19
|
+
|
|
20
|
+
Набор **нерушимых инвариантов**, которые проверяются на каждом stage gate.
|
|
21
|
+
|
|
22
|
+
#### Формат инварианта
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
### INV-{NNN}: {Short Name}
|
|
26
|
+
|
|
27
|
+
**Rule:** {Что всегда должно быть истинным}
|
|
28
|
+
**Enforcement:** {Как проверить — deterministic check, file existence, hash}
|
|
29
|
+
**On violation:** {HALT | WARN | RETRY(N)}
|
|
30
|
+
**Rationale:** {Зачем этот инвариант нужен}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### 7 базовых инвариантов
|
|
34
|
+
|
|
35
|
+
| ID | Название | Rule | Enforcement | On Violation |
|
|
36
|
+
|----|---------|------|-------------|-------------|
|
|
37
|
+
| INV-001 | Artifact Integrity | Артефакт верифицируем по witness chain hash | SHA-256 check после каждого этапа | HALT |
|
|
38
|
+
| INV-002 | Stage Completion Signal | Этап не завершён без promise tag | Проверка `<promise>` в checkpoint output | HALT |
|
|
39
|
+
| INV-003 | Human Checkpoint Required | Нет авто-перехода без подтверждения человека | Orchestrator ждёт explicit user input | HALT |
|
|
40
|
+
| INV-004 | Evaluator Independence | Судьи в panel работают изолированно | Judge attestation protocol | HALT |
|
|
41
|
+
| INV-005 | Loop Detection | Агент не повторяет действие 3+ раз подряд | Track last 3 actions per agent | WARN + escalate |
|
|
42
|
+
| INV-006 | Memory Consistency | Нет противоречивых паттернов в памяти | Check pattern_id conflicts при store | WARN |
|
|
43
|
+
| INV-007 | No Unverified Claims | Research не содержит непроверенных фактов | Scan для claims без source citation | HALT |
|
|
44
|
+
|
|
45
|
+
#### Доменные расширения
|
|
46
|
+
|
|
47
|
+
Нумерация с INV-100. Примеры:
|
|
48
|
+
|
|
49
|
+
- **Banking:** INV-100 Data Perimeter — все LLM-вызовы только к on-premise моделям
|
|
50
|
+
- **BTO:** INV-100 Judge-Generator Separation — модель генерации ≠ модель оценки
|
|
51
|
+
|
|
52
|
+
#### Интеграция
|
|
53
|
+
|
|
54
|
+
На каждом stage gate:
|
|
55
|
+
1. Загрузить constitution + доменные расширения
|
|
56
|
+
2. Запустить enforcement check для каждого инварианта
|
|
57
|
+
3. HALT → остановить pipeline
|
|
58
|
+
4. WARN → логировать и продолжить
|
|
59
|
+
5. RETRY(N) → повторить до N раз, затем HALT
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### 1.2. Shard Protocol (shard-protocol.md)
|
|
64
|
+
|
|
65
|
+
Решает проблему **context drift**: после ~40 минут правила «выпадают» из контекста агента.
|
|
66
|
+
|
|
67
|
+
#### Формат shard
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# {Stage Name} Governance Shard
|
|
71
|
+
|
|
72
|
+
## Time Budget
|
|
73
|
+
- Allocated: {percentage}% of total pipeline time
|
|
74
|
+
- Hard limit: {minutes} minutes
|
|
75
|
+
|
|
76
|
+
## Prerequisites
|
|
77
|
+
- Required upstream promises: [{PROMISE_TAG_1}, {PROMISE_TAG_2}]
|
|
78
|
+
- Required input files: [{file_list}]
|
|
79
|
+
|
|
80
|
+
## Skill to Load
|
|
81
|
+
- Primary: {skill_name} (read SKILL.md at: {path})
|
|
82
|
+
|
|
83
|
+
## Rules for This Stage
|
|
84
|
+
1. {Rule 1}
|
|
85
|
+
2. {Rule 2}
|
|
86
|
+
|
|
87
|
+
## Quality Gates
|
|
88
|
+
- [ ] {Gate 1}
|
|
89
|
+
- [ ] {Gate 2}
|
|
90
|
+
|
|
91
|
+
## Promise Tag
|
|
92
|
+
On successful completion, emit: `<promise>{PROMISE_TAG}</promise>`
|
|
93
|
+
|
|
94
|
+
## Anti-Patterns for This Stage
|
|
95
|
+
| Pattern | Fix |
|
|
96
|
+
|---------|-----|
|
|
97
|
+
| {Anti-pattern 1} | {Fix} |
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Протокол загрузки (7 шагов)
|
|
101
|
+
|
|
102
|
+
1. **Determine shard path** — construct filename from stage ID
|
|
103
|
+
2. **Read shard** — load into agent context
|
|
104
|
+
3. **Validate prerequisites** — check upstream promises
|
|
105
|
+
4. **Validate inputs** — check required files exist
|
|
106
|
+
5. **Load skill** — read SKILL.md if specified
|
|
107
|
+
6. **Start timer** — track against budget
|
|
108
|
+
7. **Execute stage** — follow rules and quality gates
|
|
109
|
+
|
|
110
|
+
#### Naming Convention
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
{stage-id}.shard.md
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Примеры: `stage-0-init.shard.md`, `bto-evaluation.shard.md`
|
|
117
|
+
|
|
118
|
+
#### Best Practice
|
|
119
|
+
|
|
120
|
+
- Держите shard под **100 строк** для оптимального context usage
|
|
121
|
+
- Включайте только правила релевантные текущему этапу
|
|
122
|
+
- Всегда включайте promise tag и time budget
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### 1.3. Checkpoint Protocol (checkpoint-protocol.md)
|
|
127
|
+
|
|
128
|
+
Обязательные точки синхронизации «человек ↔ система».
|
|
129
|
+
|
|
130
|
+
#### Формат checkpoint
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
=====================================================
|
|
134
|
+
CHECKPOINT {N}: {Stage Name} Complete
|
|
135
|
+
<promise>{PROMISE_TAG}</promise>
|
|
136
|
+
|
|
137
|
+
{2-3 line summary}
|
|
138
|
+
Artifacts created: {list}
|
|
139
|
+
|
|
140
|
+
Options:
|
|
141
|
+
- "ok" / "proceed" — advance to next stage
|
|
142
|
+
- "deepen {section}" — elaborate
|
|
143
|
+
- "{specific feedback}" — adjust
|
|
144
|
+
=====================================================
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Promise Tags
|
|
148
|
+
|
|
149
|
+
| Правило | Описание |
|
|
150
|
+
|---------|---------|
|
|
151
|
+
| Emit only when conditions met | Promise = подтверждение что quality gates пройдены |
|
|
152
|
+
| `_INCOMPLETE` suffix | Если условия НЕ выполнены: `<promise>TAG_INCOMPLETE</promise>` |
|
|
153
|
+
| Downstream check | Следующий этап проверяет upstream promises перед стартом |
|
|
154
|
+
|
|
155
|
+
#### Классификация reward по ответу пользователя
|
|
156
|
+
|
|
157
|
+
| Ответ | Reward | Label | Детекция |
|
|
158
|
+
|-------|--------|-------|----------|
|
|
159
|
+
| "ок", "proceed", одно слово | 1.0 | excellent | Single-word approval |
|
|
160
|
+
| "углуби X", feedback на 1 область | 0.7 | good | Scoped to one area |
|
|
161
|
+
| Переработка 3+ областей | 0.3 | needs_work | Multiple areas affected |
|
|
162
|
+
| "заново", "это неправильно" | 0.0 | failed | Full restart |
|
|
163
|
+
|
|
164
|
+
#### Интеграция
|
|
165
|
+
|
|
166
|
+
- **С governance:** на checkpoint запускаются все invariant checks
|
|
167
|
+
- **С memory:** после ответа пользователя → memory_store() с reward
|
|
168
|
+
- **С witness chain:** на "ok" → compute SHA-256 hash → append to chain
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 2. Memory — Обучение
|
|
173
|
+
|
|
174
|
+
### 2.1. memory_query(context)
|
|
175
|
+
|
|
176
|
+
Вызывается в **начале** каждого этапа для загрузки исторических паттернов.
|
|
177
|
+
|
|
178
|
+
#### Input
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"stage": "stage-2",
|
|
183
|
+
"domain": "banking",
|
|
184
|
+
"slug": "bank-kc-automation",
|
|
185
|
+
"skill": "goap-research-ed25519"
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### Алгоритм (7 шагов)
|
|
190
|
+
|
|
191
|
+
1. **Check enabled** — читаем `{memory-root}/config.json`, если `enabled: false` → пустой результат
|
|
192
|
+
2. **Resolve path** — `{memory-root}/{domain}/` (сканируем все slug, не только текущий)
|
|
193
|
+
3. **Scan records** — читаем все `{stage}_*.json` файлы по matching stage
|
|
194
|
+
4. **Filter expired** — исключаем records где `expires_at < current_date`
|
|
195
|
+
5. **Sort** — по `reward` DESC, затем `timestamp` DESC
|
|
196
|
+
6. **Limit** — top `max_results_per_query` записей (default 10)
|
|
197
|
+
7. **Enrich** — загружаем `_patterns/domain-patterns.json` для matching domain
|
|
198
|
+
|
|
199
|
+
#### Output
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"records": [
|
|
204
|
+
{
|
|
205
|
+
"project_slug": "bank-kc-automation",
|
|
206
|
+
"stage": "stage-2",
|
|
207
|
+
"reward": 1.0,
|
|
208
|
+
"reward_label": "excellent",
|
|
209
|
+
"skill_used": "goap-research-ed25519",
|
|
210
|
+
"outcome_summary": "Research completed with verified sources",
|
|
211
|
+
"timestamp": "2026-02-15T14:30:00Z"
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"patterns": [
|
|
215
|
+
{
|
|
216
|
+
"pattern_id": "banking-stage-2-bottleneck",
|
|
217
|
+
"description": "Banking projects struggle in research phase",
|
|
218
|
+
"confidence": 0.85,
|
|
219
|
+
"actionable_advice": "Allocate extra time for regulatory research"
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"count": 3,
|
|
223
|
+
"domain": "banking"
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### Использование после query
|
|
228
|
+
|
|
229
|
+
1. Log: `"Loaded {count} historical patterns for {stage} in {domain} domain"`
|
|
230
|
+
2. Если `records` не пустые — review top 3 для relevant approaches
|
|
231
|
+
3. Если `patterns` не пустые — apply actionable advice
|
|
232
|
+
4. Если всё пустое (первый запуск) — продолжить нормально
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### 2.2. memory_store(result, reward)
|
|
237
|
+
|
|
238
|
+
Вызывается на каждом **checkpoint** после ответа пользователя.
|
|
239
|
+
|
|
240
|
+
#### Input
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{
|
|
244
|
+
"project_slug": "bank-kc-automation",
|
|
245
|
+
"domain": "banking",
|
|
246
|
+
"stage": "stage-2",
|
|
247
|
+
"stage_name": "Research",
|
|
248
|
+
"skill_used": "goap-research-ed25519",
|
|
249
|
+
"reward": 0.7,
|
|
250
|
+
"reward_label": "good",
|
|
251
|
+
"reward_reason": "User requested additional regulatory depth",
|
|
252
|
+
"context": {
|
|
253
|
+
"stage_number": 2,
|
|
254
|
+
"domain_detected": "banking",
|
|
255
|
+
"upstream_promises": ["DISCOVERY_COMPLETE", "CASE_EXPLORED"],
|
|
256
|
+
"patterns_loaded": 3,
|
|
257
|
+
"time_budget_pct": 15.0,
|
|
258
|
+
"agent_count": 3
|
|
259
|
+
},
|
|
260
|
+
"outcome": {
|
|
261
|
+
"artifacts_created": ["02_research_findings.md"],
|
|
262
|
+
"checkpoint_response": "углуби регуляторику",
|
|
263
|
+
"iterations": 2,
|
|
264
|
+
"promise_emitted": "RESEARCH_PARANOID_PASSED"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
#### Алгоритм (6 шагов)
|
|
270
|
+
|
|
271
|
+
1. **Ensure directory** — создать `{memory-root}/{domain}/{slug}/` если не существует
|
|
272
|
+
2. **Build record** — полный RewardRecord JSON
|
|
273
|
+
3. **Compute expires_at** — `current_date + retention_days` (default 90)
|
|
274
|
+
4. **Generate filename** — `{stage}_{ISO-timestamp}.json`
|
|
275
|
+
5. **Write file** — JSON в `{memory-root}/{domain}/{slug}/{filename}`
|
|
276
|
+
6. **Log** — `"Stored reward {reward} ({label}) for {stage} of {slug}"`
|
|
277
|
+
|
|
278
|
+
#### RewardRecord Schema
|
|
279
|
+
|
|
280
|
+
```json
|
|
281
|
+
{
|
|
282
|
+
"id": "bank-kc_stage-2_2026-02-15T14:30:00Z",
|
|
283
|
+
"version": "1.0",
|
|
284
|
+
"timestamp": "ISO-8601",
|
|
285
|
+
"project_slug": "bank-kc-automation",
|
|
286
|
+
"domain": "banking",
|
|
287
|
+
"stage": "stage-2",
|
|
288
|
+
"stage_name": "Research",
|
|
289
|
+
"skill_used": "goap-research-ed25519",
|
|
290
|
+
"reward": 0.7,
|
|
291
|
+
"reward_label": "good",
|
|
292
|
+
"reward_reason": "...",
|
|
293
|
+
"context": { "..." },
|
|
294
|
+
"outcome": { "..." },
|
|
295
|
+
"promise_tag": "RESEARCH_PARANOID_PASSED",
|
|
296
|
+
"expires_at": "2026-05-15T14:30:00Z"
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
#### Namespace structure
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
{memory-root}/
|
|
304
|
+
├── config.json
|
|
305
|
+
├── _patterns/
|
|
306
|
+
│ └── domain-patterns.json
|
|
307
|
+
├── _stats/
|
|
308
|
+
│ └── reward-summary.json
|
|
309
|
+
├── banking/
|
|
310
|
+
│ └── bank-kc-automation/
|
|
311
|
+
│ ├── stage-0_2026-02-15T10:00:00Z.json
|
|
312
|
+
│ ├── stage-1_2026-02-15T10:30:00Z.json
|
|
313
|
+
│ └── stage-2_2026-02-15T14:30:00Z.json
|
|
314
|
+
└── retail/
|
|
315
|
+
└── ecommerce-recommendations/
|
|
316
|
+
└── ...
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
### 2.3. Reward Tracker (reward-tracker.md)
|
|
322
|
+
|
|
323
|
+
Аналитический движок, вычисляющий агрегаты и обнаруживающий паттерны.
|
|
324
|
+
|
|
325
|
+
#### 6-шаговый процесс
|
|
326
|
+
|
|
327
|
+
**Step 1: Load All Records** — рекурсивный scan `{memory-root}/`, исключая config/patterns/summary. Parse каждый JSON как RewardRecord. Exclude expired.
|
|
328
|
+
|
|
329
|
+
**Step 2: Per-Stage Averages**
|
|
330
|
+
|
|
331
|
+
```json
|
|
332
|
+
{
|
|
333
|
+
"stage-2": {
|
|
334
|
+
"avg_reward": 0.85,
|
|
335
|
+
"total_runs": 12,
|
|
336
|
+
"distribution": { "excellent": 8, "good": 3, "needs_work": 1, "failed": 0 },
|
|
337
|
+
"trend": "stable",
|
|
338
|
+
"best_project": "bank-kc",
|
|
339
|
+
"worst_project": "healthcare-ai"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Trend Detection:** Делим records на 2 половины по timestamp. Newer_avg - Older_avg > 0.15 → "improving", < -0.15 → "degrading", иначе → "stable". Минимум 4 записи.
|
|
345
|
+
|
|
346
|
+
**Step 3: Per-Domain Averages**
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"banking": {
|
|
351
|
+
"avg_reward": 0.72,
|
|
352
|
+
"total_runs": 18,
|
|
353
|
+
"stage_breakdown": { "stage-0": 0.85, "stage-1": 0.90, "stage-2": 0.55 },
|
|
354
|
+
"bottleneck_stage": "stage-2",
|
|
355
|
+
"strongest_stage": "stage-1"
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**Bottleneck Detection:** Этап с минимальным средним reward в домене. Только если 3+ записей.
|
|
361
|
+
|
|
362
|
+
**Step 4: Per-Skill Effectiveness**
|
|
363
|
+
|
|
364
|
+
```json
|
|
365
|
+
{
|
|
366
|
+
"goap-research-ed25519": {
|
|
367
|
+
"overall_avg": 0.74,
|
|
368
|
+
"total_runs": 15,
|
|
369
|
+
"by_domain": {
|
|
370
|
+
"banking": { "avg": 0.65, "runs": 8 },
|
|
371
|
+
"retail": { "avg": 0.85, "runs": 7 }
|
|
372
|
+
},
|
|
373
|
+
"best_domain": "retail",
|
|
374
|
+
"worst_domain": "banking"
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**Step 5: Pattern Detection** — 6 правил:
|
|
380
|
+
|
|
381
|
+
| Правило | Условие | Шаблон паттерна |
|
|
382
|
+
|---------|---------|----------------|
|
|
383
|
+
| Stage Bottleneck | avg < 0.5 в домене, 3+ записей | "{domain} struggles in {stage}" |
|
|
384
|
+
| Stage Excellence | avg > 0.9 в домене, 3+ записей | "{domain} excels in {stage}" |
|
|
385
|
+
| Skill-Domain Mismatch | avg < 0.5 в одном домене, > 0.7 в другом | "{skill} underperforms in {domain}" |
|
|
386
|
+
| Improving Trend | trend = "improving" | "{stage} quality improving in {domain}" |
|
|
387
|
+
| Degrading Trend | trend = "degrading" | "{stage} quality degrading — investigate" |
|
|
388
|
+
| Time Overhead | avg iterations > 2.0 | "{domain} requires more iterations in {stage}" |
|
|
389
|
+
|
|
390
|
+
**Confidence:** `min(1.0, evidence_count / 10)`
|
|
391
|
+
|
|
392
|
+
**Step 6: Write Outputs** — `reward-summary.json` и `domain-patterns.json`
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
### 2.4. DreamEngine (dream-engine.md)
|
|
397
|
+
|
|
398
|
+
Фоновый процесс, строящий concept graphs и генерирующий cross-domain insights.
|
|
399
|
+
|
|
400
|
+
#### Trigger Evaluation
|
|
401
|
+
|
|
402
|
+
```json
|
|
403
|
+
{
|
|
404
|
+
"version": "1.0",
|
|
405
|
+
"last_dream_completed_at": null,
|
|
406
|
+
"records_since_last_dream": 0,
|
|
407
|
+
"pending_events": [],
|
|
408
|
+
"config": {
|
|
409
|
+
"time_threshold_minutes": 60,
|
|
410
|
+
"volume_threshold": 20,
|
|
411
|
+
"event_triggers_enabled": true
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**3 типа триггеров:**
|
|
417
|
+
|
|
418
|
+
| Триггер | Условие | Default |
|
|
419
|
+
|---------|---------|---------|
|
|
420
|
+
| Time | Прошло > threshold минут с последнего dream | 60 min |
|
|
421
|
+
| Volume | records_since_last_dream ≥ threshold | 20 records |
|
|
422
|
+
| Event | pending_events непустой и enabled | true |
|
|
423
|
+
|
|
424
|
+
#### Dream Execution Protocol (5 шагов)
|
|
425
|
+
|
|
426
|
+
**Step 1: Load Data** — check memory root, read summary + patterns, scan records, exclude expired, sort by reward DESC, take top 200. Exit if < 5 records.
|
|
427
|
+
|
|
428
|
+
**Step 2: Build Concept Graph** — nodes (domain, stage, skill, outcome) + edges (domain→stage, stage→skill, skill→outcome) weighted by reward. Per-node aggregates: avg_reward, count, trend.
|
|
429
|
+
|
|
430
|
+
**Step 3: Detect Cross-Domain Associations (4 метода):**
|
|
431
|
+
- 3a: Cross-domain stage comparison (gap > 0.15)
|
|
432
|
+
- 3b: Skill-domain mismatch (gap > 0.15)
|
|
433
|
+
- 3c: Stage correlation (co-occurrence of low rewards ≥ 3)
|
|
434
|
+
- 3d: Temporal trends (systematic reward changes)
|
|
435
|
+
|
|
436
|
+
**Step 4: Generate Insights** — for each association → Insight JSON (type, description, confidence, impact, rank_score). Sort by rank_score DESC, take top 20.
|
|
437
|
+
|
|
438
|
+
**Step 5: Store and Clean** — write `dream-{timestamp}.json`, enforce max 10 files, reset triggers.
|
|
439
|
+
|
|
440
|
+
#### Dream Result Schema
|
|
441
|
+
|
|
442
|
+
```json
|
|
443
|
+
{
|
|
444
|
+
"version": "1.0",
|
|
445
|
+
"dream_id": "dream-20260301-143022",
|
|
446
|
+
"status": "completed",
|
|
447
|
+
"trigger_reason": "volume",
|
|
448
|
+
"started_at": "ISO-8601",
|
|
449
|
+
"completed_at": "ISO-8601",
|
|
450
|
+
"records_analyzed": 200,
|
|
451
|
+
"concept_graph_nodes": 24,
|
|
452
|
+
"concept_graph_edges": 36,
|
|
453
|
+
"associations_found": 8,
|
|
454
|
+
"insights": [ "..." ],
|
|
455
|
+
"metadata": {
|
|
456
|
+
"domains_covered": ["banking", "retail"],
|
|
457
|
+
"stages_covered": ["stage-0", "stage-1", "stage-2"],
|
|
458
|
+
"total_reward_records_in_memory": 42
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## 3. Orchestration — Оркестрация
|
|
466
|
+
|
|
467
|
+
### 3.1. Queen Protocol (queen-protocol.md)
|
|
468
|
+
|
|
469
|
+
10-шаговый lifecycle координатора верхнего уровня.
|
|
470
|
+
|
|
471
|
+
| Step | Name | Purpose | Failure Mode |
|
|
472
|
+
|------|------|---------|-------------|
|
|
473
|
+
| 1 | INIT | Создать project directory | Abort on error |
|
|
474
|
+
| 2 | HEALTH | Проверить ресурсы (skills, shards, constitution) | Abort on missing |
|
|
475
|
+
| 3 | LOAD | Загрузить memory + dream insights + brain | Graceful (proceed without) |
|
|
476
|
+
| 4 | DETECT | Классифицировать domain + set variables | Default "general" |
|
|
477
|
+
| 5 | SHARD | Загрузить governance shard для текущего этапа | Fallback to master config |
|
|
478
|
+
| 6 | ORCHESTRATE | Выбрать topology + assign model + spawn agents | Halt at checkpoint |
|
|
479
|
+
| 7 | MONITOR | Track execution + display checkpoints | HALT if skipped (INV-003) |
|
|
480
|
+
| 8 | COLLECT | Собрать артефакты + verify quality gates | Halt if mandatory missing |
|
|
481
|
+
| 9 | STORE | memory_store() + update dream triggers | Graceful (log and continue) |
|
|
482
|
+
| 10 | REPORT | Summary + list artifacts + time report | Always succeeds |
|
|
483
|
+
|
|
484
|
+
```
|
|
485
|
+
INIT → HEALTH → LOAD → DETECT → SHARD
|
|
486
|
+
↓
|
|
487
|
+
ORCHESTRATE
|
|
488
|
+
↓
|
|
489
|
+
MONITOR ←→ (repeat per stage)
|
|
490
|
+
↓
|
|
491
|
+
COLLECT → STORE → REPORT
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
#### Customization
|
|
495
|
+
|
|
496
|
+
- Steps 1-3 (INIT, HEALTH, LOAD) — **универсальные**, оставить как есть
|
|
497
|
+
- Step 4 (DETECT) — кастомизировать detection logic
|
|
498
|
+
- Step 5 (SHARD) — указать на ваш shard directory
|
|
499
|
+
- Step 6 (ORCHESTRATE) — определить ваши stages и topologies
|
|
500
|
+
- Steps 7-10 (MONITOR, COLLECT, STORE, REPORT) — **универсальные**
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
### 3.2. Topology Selection (topology-selection.md)
|
|
505
|
+
|
|
506
|
+
6 типов топологий для организации агентов внутри этапа.
|
|
507
|
+
|
|
508
|
+
#### Star
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
Coordinator
|
|
512
|
+
/ | \
|
|
513
|
+
Agent1 Agent2 Agent3
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
- **Координация:** централизованная
|
|
517
|
+
- **Communication:** hub-and-spoke
|
|
518
|
+
- **Fault tolerance:** medium
|
|
519
|
+
- **Scalability:** good
|
|
520
|
+
- **Best for:** простые параллельные задачи, multi-evaluator panels (изолированные)
|
|
521
|
+
|
|
522
|
+
#### Mesh
|
|
523
|
+
|
|
524
|
+
```
|
|
525
|
+
Agent1 ←→ Agent2
|
|
526
|
+
↕ ↕
|
|
527
|
+
Agent3 ←→ Agent4
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
- **Координация:** децентрализованная
|
|
531
|
+
- **Communication:** all-to-all
|
|
532
|
+
- **Fault tolerance:** high
|
|
533
|
+
- **Scalability:** limited (O(n²) communication)
|
|
534
|
+
- **Best for:** fault-tolerant research
|
|
535
|
+
|
|
536
|
+
#### Hierarchical
|
|
537
|
+
|
|
538
|
+
```
|
|
539
|
+
Queen
|
|
540
|
+
/ \
|
|
541
|
+
Manager1 Manager2
|
|
542
|
+
/ \ / \
|
|
543
|
+
W1 W2 W3 W4
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
- **Координация:** иерархическая
|
|
547
|
+
- **Communication:** parent-child
|
|
548
|
+
- **Fault tolerance:** medium
|
|
549
|
+
- **Scalability:** excellent
|
|
550
|
+
- **Best for:** 10+ агентов, multi-level tasks
|
|
551
|
+
|
|
552
|
+
#### Ring
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
Agent1 → Agent2 → Agent3 → Agent4
|
|
556
|
+
↑ |
|
|
557
|
+
└──────────────────────────┘
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
- **Координация:** последовательная
|
|
561
|
+
- **Communication:** unidirectional
|
|
562
|
+
- **Fault tolerance:** low
|
|
563
|
+
- **Scalability:** limited (linear latency)
|
|
564
|
+
- **Best for:** iterative refinement (draft → review → polish)
|
|
565
|
+
|
|
566
|
+
#### Hybrid
|
|
567
|
+
|
|
568
|
+
Комбинация двух+ топологий. Разные части stage используют разные arrangements.
|
|
569
|
+
|
|
570
|
+
#### Adaptive
|
|
571
|
+
|
|
572
|
+
Начинает как Star, эволюционирует:
|
|
573
|
+
- Если disagreement > 3 points → switch to Mesh
|
|
574
|
+
- Если простая задача → stay Star
|
|
575
|
+
- Если complexity выше threshold → elevate to Hierarchical
|
|
576
|
+
|
|
577
|
+
#### Selection Guide
|
|
578
|
+
|
|
579
|
+
| Характеристика | Рекомендация |
|
|
580
|
+
|---------------|-------------|
|
|
581
|
+
| Независимые параллельные задачи | **Star** |
|
|
582
|
+
| Fault-tolerant research | **Mesh** |
|
|
583
|
+
| Multi-evaluator panel | **Star** (isolated) |
|
|
584
|
+
| Итеративное улучшение | **Ring** |
|
|
585
|
+
| Complex multi-level | **Hierarchical** |
|
|
586
|
+
| Heterogeneous sub-tasks | **Hybrid** |
|
|
587
|
+
| Uncertain complexity | **Adaptive** |
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
### 3.3. Background Workers (background-workers.md)
|
|
592
|
+
|
|
593
|
+
Non-blocking агенты для долгих операций.
|
|
594
|
+
|
|
595
|
+
#### Directory Structure
|
|
596
|
+
|
|
597
|
+
```
|
|
598
|
+
{workers-root}/
|
|
599
|
+
├── registry.json ← Managed by orchestrator ONLY
|
|
600
|
+
├── wkr-{YYYYMMDD}-{HHmmss}-{type}/
|
|
601
|
+
│ ├── status.json ← Written by worker
|
|
602
|
+
│ ├── stop-requested ← Flag file (orchestrator creates)
|
|
603
|
+
│ ├── output/ ← Worker output
|
|
604
|
+
│ └── error.log ← On failure
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
#### Registry Schema
|
|
608
|
+
|
|
609
|
+
```json
|
|
610
|
+
{
|
|
611
|
+
"version": "1.0",
|
|
612
|
+
"max_concurrent": 3,
|
|
613
|
+
"workers": [
|
|
614
|
+
{
|
|
615
|
+
"worker_id": "wkr-20260301-143022-consolidate",
|
|
616
|
+
"type": "consolidate",
|
|
617
|
+
"status": "running",
|
|
618
|
+
"model": "sonnet",
|
|
619
|
+
"started_at": "ISO-8601",
|
|
620
|
+
"completed_at": null,
|
|
621
|
+
"output_dir": "...",
|
|
622
|
+
"retry_count": 0
|
|
623
|
+
}
|
|
624
|
+
]
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
#### 6 правил изоляции
|
|
629
|
+
|
|
630
|
+
1. Workers MUST only write to their own directory
|
|
631
|
+
2. Workers MUST NOT modify project files directly
|
|
632
|
+
3. Workers MUST NOT modify pipeline configuration
|
|
633
|
+
4. Workers MUST NOT spawn sub-agents
|
|
634
|
+
5. Workers MAY read project files (read-only)
|
|
635
|
+
6. Workers write deltas/reports that user decides whether to apply
|
|
636
|
+
|
|
637
|
+
#### Протоколы
|
|
638
|
+
|
|
639
|
+
| Операция | Шаги |
|
|
640
|
+
|---------|------|
|
|
641
|
+
| **Launch** | Validate type → check concurrency (max 3) → create dir → update registry → spawn agent → confirm |
|
|
642
|
+
| **Status** | Read registry → read each status.json → update registry → prune 24h old entries → display |
|
|
643
|
+
| **Stop** | Verify running → write stop-requested flag → update registry → worker exits gracefully |
|
|
644
|
+
|
|
645
|
+
#### Error Handling
|
|
646
|
+
|
|
647
|
+
- Max 2 retries per original request
|
|
648
|
+
- Each retry = NEW worker (new ID, incremented retry_count)
|
|
649
|
+
- retry_count ≥ 2 → permanently failed
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
653
|
+
### 3.4. Model Routing (model-routing.md)
|
|
654
|
+
|
|
655
|
+
3-tier система назначения моделей по сложности задачи.
|
|
656
|
+
|
|
657
|
+
| Tier | Model | Latency | Cost | Задачи |
|
|
658
|
+
|------|-------|---------|------|--------|
|
|
659
|
+
| 1 | haiku | ~500ms | 1x | Formatting, validation, structural checks, quick ranking |
|
|
660
|
+
| 2 | sonnet | ~2s | 15x | Research synthesis, analysis, judge panels, mutation workers |
|
|
661
|
+
| 3 | opus | ~5s | 75x | Creative design, complex solving, storytelling, architecture |
|
|
662
|
+
|
|
663
|
+
#### Enforcement Rules
|
|
664
|
+
|
|
665
|
+
1. **NEVER** Tier 3 для structural checks — wasteful
|
|
666
|
+
2. **NEVER** Tier 1 для judge panels — insufficient quality
|
|
667
|
+
3. **NEVER** Tier 1 для creative work — shallow output
|
|
668
|
+
4. **ALWAYS** specify model при spawn агента
|
|
669
|
+
5. Без спецификации → наследуется от parent (обычно Tier 3)
|
|
670
|
+
|
|
671
|
+
#### Cost Impact
|
|
672
|
+
|
|
673
|
+
```
|
|
674
|
+
Without routing: 20 tasks × Tier 3 = 20 × 75x = 1500x
|
|
675
|
+
With routing: 8×Tier1 + 8×Tier2 + 4×Tier3 = 8 + 120 + 300 = 428x
|
|
676
|
+
Savings: ~71%
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
## 4. Verification — Верификация
|
|
682
|
+
|
|
683
|
+
### 4.1. Witness Chain (witness-chain.md)
|
|
684
|
+
|
|
685
|
+
SHA-256 hash-chain для tamper-evident целостности артефактов.
|
|
686
|
+
|
|
687
|
+
#### Constants
|
|
688
|
+
|
|
689
|
+
```
|
|
690
|
+
NULL_HASH = "0000000000000000000000000000000000000000000000000000000000000000"
|
|
691
|
+
CHAIN_FILE = ".witness-chain.json"
|
|
692
|
+
HASH_PREFIX = "sha256:"
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
#### Hash Computation
|
|
696
|
+
|
|
697
|
+
```bash
|
|
698
|
+
# Platform detection
|
|
699
|
+
if command -v sha256sum &>/dev/null; then SHA_CMD="sha256sum"
|
|
700
|
+
elif command -v shasum &>/dev/null; then SHA_CMD="shasum -a 256"
|
|
701
|
+
fi
|
|
702
|
+
|
|
703
|
+
# File hash
|
|
704
|
+
HASH=$(${SHA_CMD} "path/to/file.md" | awk '{print $1}')
|
|
705
|
+
|
|
706
|
+
# Chained hash
|
|
707
|
+
CHAINED_HASH=$(printf '%s%s' "${FILE_CONTENT}" "${PREV_HASH}" | ${SHA_CMD} | awk '{print $1}')
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
#### Chain Operations
|
|
711
|
+
|
|
712
|
+
| Операция | Preconditions | Procedure |
|
|
713
|
+
|---------|--------------|-----------|
|
|
714
|
+
| **Genesis** | First artifact created, no chain file | Compute hash with NULL_HASH → create chain file |
|
|
715
|
+
| **Append** | Chain exists, new artifact created | Read last hash → compute chained hash → append record |
|
|
716
|
+
| **Verify** | Chain file exists | Walk chain, recompute each hash, compare |
|
|
717
|
+
| **Repair** | Artifact legitimately modified | Rehash modified → cascade rehash ALL downstream |
|
|
718
|
+
|
|
719
|
+
#### Chain File Schema
|
|
720
|
+
|
|
721
|
+
```json
|
|
722
|
+
{
|
|
723
|
+
"project_slug": "bank-kc-automation",
|
|
724
|
+
"created_at": "ISO-8601",
|
|
725
|
+
"last_updated": "ISO-8601",
|
|
726
|
+
"chain": [
|
|
727
|
+
{
|
|
728
|
+
"sequence": 0,
|
|
729
|
+
"stage": "stage-0",
|
|
730
|
+
"artifact": "00_discovery.md",
|
|
731
|
+
"hash": "sha256:<64 hex>",
|
|
732
|
+
"previous_hash": "sha256:0000...0000",
|
|
733
|
+
"timestamp": "ISO-8601",
|
|
734
|
+
"promise_tag": "DISCOVERY_COMPLETE"
|
|
735
|
+
}
|
|
736
|
+
]
|
|
737
|
+
}
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
---
|
|
741
|
+
|
|
742
|
+
### 4.2. Judge Attestation (judge-attestation.md)
|
|
743
|
+
|
|
744
|
+
Криптографическое доказательство независимости оценщиков.
|
|
745
|
+
|
|
746
|
+
#### Hash Construction
|
|
747
|
+
|
|
748
|
+
```
|
|
749
|
+
evaluation_hash = SHA-256(judge_id | artifact_hash | score | rationale_summary)
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
- `judge_id` — уникальный ID роли судьи
|
|
753
|
+
- `artifact_hash` — SHA-256 оцениваемого артефакта
|
|
754
|
+
- `score` — числовой score с 1 decimal ("8.2")
|
|
755
|
+
- `rationale_summary` — первые 500 символов rationale
|
|
756
|
+
|
|
757
|
+
#### Chain Linking
|
|
758
|
+
|
|
759
|
+
```
|
|
760
|
+
Judge 1: previous = NULL_HASH
|
|
761
|
+
Judge 2: previous = Judge 1's evaluation_hash
|
|
762
|
+
Judge 3: previous = Judge 2's evaluation_hash
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
#### Isolation Proof Logic
|
|
766
|
+
|
|
767
|
+
1. **Hash Independence** — each evaluation_hash computed from judge's own data only
|
|
768
|
+
2. **Chain Integrity** — previous_attestation_hash links order, NOT scores
|
|
769
|
+
3. **Timestamp Monotonicity** — timestamps strictly increasing
|
|
770
|
+
|
|
771
|
+
#### Attestation Schema
|
|
772
|
+
|
|
773
|
+
```json
|
|
774
|
+
{
|
|
775
|
+
"evaluations": [
|
|
776
|
+
{
|
|
777
|
+
"evaluation_id": "bto-eval-001",
|
|
778
|
+
"artifact_path": "path/to/artifact.md",
|
|
779
|
+
"artifact_hash": "sha256:<hex>",
|
|
780
|
+
"panel_size": 3,
|
|
781
|
+
"attestations": [
|
|
782
|
+
{
|
|
783
|
+
"judge_id": "domain-expert",
|
|
784
|
+
"score": 8.2,
|
|
785
|
+
"rationale_summary": "...",
|
|
786
|
+
"evaluation_hash": "sha256:<hex>",
|
|
787
|
+
"timestamp": "ISO-8601",
|
|
788
|
+
"previous_attestation_hash": "sha256:0000...0000"
|
|
789
|
+
}
|
|
790
|
+
],
|
|
791
|
+
"final_score": 7.94,
|
|
792
|
+
"weights": { "domain-expert": 0.4, "critic": 0.3, "auditor": 0.3 }
|
|
793
|
+
}
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
#### Meta-Judge
|
|
799
|
+
|
|
800
|
+
При disagreement > 3 points → meta-judge MAY reference other judges' scores (это synthesizer, не independent evaluator). Appended to attestation chain.
|
|
801
|
+
|
|
802
|
+
---
|
|
803
|
+
|
|
804
|
+
### 4.3. Audit Trail (audit-trail.md)
|
|
805
|
+
|
|
806
|
+
Единая история всех решений и оценок.
|
|
807
|
+
|
|
808
|
+
#### Directory Structure
|
|
809
|
+
|
|
810
|
+
```
|
|
811
|
+
{audit-root}/
|
|
812
|
+
├── audit-log.json ← Master event log
|
|
813
|
+
├── witness-chains/
|
|
814
|
+
│ └── {project-slug}.json ← Per-project witness chain
|
|
815
|
+
├── attestations/
|
|
816
|
+
│ └── {evaluation-id}.json ← Per-evaluation attestations
|
|
817
|
+
└── decisions/
|
|
818
|
+
└── {decision-id}.json ← Decision records
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
#### 10 типов событий
|
|
822
|
+
|
|
823
|
+
| Event Type | Source Protocol |
|
|
824
|
+
|-----------|---------------|
|
|
825
|
+
| `artifact_created` | witness-chain.md |
|
|
826
|
+
| `artifact_verified` | witness-chain.md |
|
|
827
|
+
| `artifact_modified` | witness-chain.md (repair) |
|
|
828
|
+
| `evaluation_started` | judge-attestation.md |
|
|
829
|
+
| `evaluation_completed` | judge-attestation.md |
|
|
830
|
+
| `checkpoint_reached` | checkpoint-protocol.md |
|
|
831
|
+
| `checkpoint_approved` | checkpoint-protocol.md |
|
|
832
|
+
| `checkpoint_revised` | checkpoint-protocol.md |
|
|
833
|
+
| `reward_stored` | memory-protocol.md |
|
|
834
|
+
| `decision_made` | (this protocol) |
|
|
835
|
+
|
|
836
|
+
#### Retention
|
|
837
|
+
|
|
838
|
+
- Audit logs retained for **lifetime of project** (no auto-expiry)
|
|
839
|
+
- NOT subject to memory protocol's expiration rules
|
|
840
|
+
- On brain export: audit trail included as metadata (event counts, not full events)
|
|
841
|
+
|
|
842
|
+
---
|
|
843
|
+
|
|
844
|
+
## 5. Trust Tiers — Классификация доверия
|
|
845
|
+
|
|
846
|
+
### 5.1. Tier System (tier-system.md)
|
|
847
|
+
|
|
848
|
+
| Tier | Label | Requirements | Confidence |
|
|
849
|
+
|------|-------|-------------|-----------|
|
|
850
|
+
| 3 | Verified | Eval tests + panel score ≥ 8.5 | Highest — production-ready |
|
|
851
|
+
| 2 | Validated | Panel score ≥ 7.0 | High — tested |
|
|
852
|
+
| 1 | Structured | SKILL.md + references/ or modules/ | Medium — organized |
|
|
853
|
+
| 0 | Advisory | Basic SKILL.md | Low — use with caution |
|
|
854
|
+
|
|
855
|
+
#### Classification Checklist
|
|
856
|
+
|
|
857
|
+
```
|
|
858
|
+
[ ] SKILL.md exists → Tier 0 minimum
|
|
859
|
+
[ ] SKILL.md has complete protocol → Tier 0
|
|
860
|
+
[ ] references/ OR modules/ OR structured output → Tier 1
|
|
861
|
+
[ ] Multi-evaluator panel score ≥ 7.0 → Tier 2
|
|
862
|
+
[ ] Deterministic eval tests exist and pass → Tier 3
|
|
863
|
+
[ ] Panel score ≥ 8.5 → Tier 3
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
#### Enforcement
|
|
867
|
+
|
|
868
|
+
| Context | Rule |
|
|
869
|
+
|---------|------|
|
|
870
|
+
| Production pipeline | Warn on Tier 0 skills |
|
|
871
|
+
| Critical decisions | Require Tier 2+ |
|
|
872
|
+
| Evaluation panels | Judges should be Tier 1+ |
|
|
873
|
+
| Knowledge export | Include tier metadata |
|
|
874
|
+
|
|
875
|
+
---
|
|
876
|
+
|
|
877
|
+
### 5.2. Promotion Protocol (promotion-protocol.md)
|
|
878
|
+
|
|
879
|
+
#### Tier 0 → Tier 1
|
|
880
|
+
|
|
881
|
+
**Requirements:** Complete SKILL.md + references/ OR modules/ OR structured output
|
|
882
|
+
**Process:** Structural check (no formal evaluation)
|
|
883
|
+
|
|
884
|
+
#### Tier 1 → Tier 2
|
|
885
|
+
|
|
886
|
+
**Requirements:** Pass 3-judge panel with avg score ≥ 7.0, no judge < 5.0
|
|
887
|
+
**Panel:** Domain Expert (0.4) + Critic (0.3) + Completeness Auditor (0.3)
|
|
888
|
+
**Process:** Submit for evaluation → judges score independently → compute weighted average → if ≥ 7.0 → promote
|
|
889
|
+
|
|
890
|
+
#### Tier 2 → Tier 3
|
|
891
|
+
|
|
892
|
+
**Requirements:** Score ≥ 8.5 + deterministic eval test suite (5+ tests) passing
|
|
893
|
+
**Process:** Create test cases → verify all pass → re-evaluate or use existing score ≥ 8.5 → promote
|
|
894
|
+
|
|
895
|
+
#### Demotion
|
|
896
|
+
|
|
897
|
+
| Trigger | Demotion |
|
|
898
|
+
|---------|---------|
|
|
899
|
+
| Eval tests start failing | Tier 3 → Tier 2 |
|
|
900
|
+
| Re-evaluation score drops | Tier 2 → Tier 1 |
|
|
901
|
+
| Materials removed | Tier 1 → Tier 0 |
|
|
902
|
+
|
|
903
|
+
#### Cross-Project Transfer
|
|
904
|
+
|
|
905
|
+
При импорте скилла из другого проекта, tier = **recommendation**:
|
|
906
|
+
1. Accept as-is (trust source)
|
|
907
|
+
2. Require re-evaluation (verify locally)
|
|
908
|
+
3. Demote by one tier (conservative)
|
|
909
|
+
|
|
910
|
+
---
|
|
911
|
+
|
|
912
|
+
## 6. Platform — Мультиплатформенность
|
|
913
|
+
|
|
914
|
+
### 6.1. Adapter Registry (adapter-registry.md)
|
|
915
|
+
|
|
916
|
+
| Platform | Config Format | Max Size |
|
|
917
|
+
|----------|--------------|---------|
|
|
918
|
+
| Claude Code | `.claude/` directory | Native (no limit) |
|
|
919
|
+
| Cursor | `.cursorrules` flat file | < 10K tokens |
|
|
920
|
+
| OpenCode | `.opencode/` directory | No hard limit |
|
|
921
|
+
| GitHub Copilot | `.github/copilot-instructions.md` | < 8K tokens |
|
|
922
|
+
|
|
923
|
+
#### Translation Rules
|
|
924
|
+
|
|
925
|
+
| Source Element | Cursor | OpenCode | Copilot |
|
|
926
|
+
|---------------|--------|----------|---------|
|
|
927
|
+
| Skill loading | Inline summary | Separate .md | Inline summary |
|
|
928
|
+
| Agent tool refs | "Break into sub-tasks" | "Break into sub-tasks" | "Break into sub-tasks" |
|
|
929
|
+
| Model routing | Omit | Omit | Omit |
|
|
930
|
+
| Promise tags | Keep as markers | Keep as markers | Keep as markers |
|
|
931
|
+
| Governance shards | Omit (single-file) | Include | Omit (single-file) |
|
|
932
|
+
|
|
933
|
+
#### Adding New Platform
|
|
934
|
+
|
|
935
|
+
1. Create template: `platform/templates/{name}.md`
|
|
936
|
+
2. Add to registry table
|
|
937
|
+
3. Define: Target Format, Generation Protocol, Content Adaptation, Size Constraints, Example Output
|
|
938
|
+
|
|
939
|
+
---
|
|
940
|
+
|
|
941
|
+
## Error Handling — Сводная таблица
|
|
942
|
+
|
|
943
|
+
| Ситуация | Поведение |
|
|
944
|
+
|---------|----------|
|
|
945
|
+
| Memory root не существует | query → empty; store → create |
|
|
946
|
+
| config.json missing | Use defaults (90 days, 10 results) |
|
|
947
|
+
| Corrupted JSON | Skip file, log warning, continue |
|
|
948
|
+
| Write failure | Log error, continue (non-blocking) |
|
|
949
|
+
| sha256sum not available | Log WARNING, skip witness chain |
|
|
950
|
+
| Worker exceeds concurrency | Reject (not queue) |
|
|
951
|
+
| Invariant HALT violation | Stop pipeline, report to human |
|
|
952
|
+
| Invariant WARN violation | Log and continue |
|
|
953
|
+
| Dream insufficient data | Exit with status, zero insights |
|