Reference: docs/zig-migration-rules.md — https://ziglang.org/download/0.15.1/
SplitIterator semantics changed significantly in Zig 0.15:
.first()and.next()now return?[]const u8(optional) instead of direct slices- Multiple
orelsecalls fail when left side is not optional - Direct slice access pattern requires using
?[0..N]or iterator index notation
Rules:
- ✅ Используйте
if (iterator_expr) |capture|для optionals,orelseдля non-optionals - ✅ Не полагайтесь на поведение
next()/first()из Zig 0.14 — они могут не работать в Zig 0.15 - ✅ Проверяйте типы с помощью
@as(),@intCast(), или явной аннотации типа
ArrayList.init() now uses error union return types:
- Return type is
!ArrayList(Header, null)or similar error unions - Cannot use
.append()or.writer()with error returns
Rules:
- ✅ Используйте
ArrayList(Header).initCapacity(allocator, capacity)вместоArrayList(Header).init(allocator) - ✅ Обрабатывайте error union из
init()явно с помощьюifилиswitch - ✅ Не пытайтесь присвоить результат
init()переменной до проверки ошибок
orelse now requires optional on LEFT side:
if (optional_expr) |capture| else_exprRules:
- ✅ Левая сторона
orelseДОЛЖНА быть optional (т.е.ifилиwhile) - ✅ Для получения среза из optional:
if (opt) |val| opt.? else default_value - ✅ Не используйте
orelseдля простых развилок без захвата ошибок
✅ stream.read(buffer) возвращает количество прочитанных байтов
- Используйте
if (bytes_read > 0)проверки - Не используйте
readAll()— эта функция была удалена в Zig 0.15
Ссылка на правила миграции
Миграция API: Zig 0.15 Compatibility
- Типы данных: optional, error unions
- Ссылка на: docs/zig-migration-rules.md
Дата добавления: 2026-04-03
Every container/agent MUST have SOUL.md at its root.
SOUL.md contains:
- Agent type (Ralph / Mu / Scholar / Copywright / Oracle / Swarm / Custom)
- Bound GitHub issue number
- Mission statement
- Allowed commands
- Stop conditions
- Reporting format (Protocol v2)
- References to CLAUDE.md and AGENTS.md
Template: templates/SOUL.md
Every container MUST be bound to exactly one GitHub issue.
Canonical registry: .trinity/issue_bindings.json
{
"issue_number": 505,
"agent_id": "ralph-505-a1",
"soul_file": ".trinity/souls/issue-505-ralph-505-a1/SOUL.md",
"session_id": "sess_123",
"railway_service_id": "svc_abc",
"deployment_id": "dep_xyz",
"experience_file": ".trinity/experience/issue-505-run-001.jsonl",
"status": "ACTIVE"
}Every significant agent action MUST be reflected as a GitHub issue comment.
Comment format (Protocol v2):
🔍 [RESEARCH] Step 1/8📜 [SPEC] Reused nearest template⚙️ [CODEGEN] .tri -> .zig🧪 [TEST] 6/7 passed☣️ [VERDICT] Past: 3/7. Now: 7/7✅ [DONE] Build clean. Commit pushed
.trispec — Logic and algorithms.trinity/experience/— Episodes and learnings- GitHub issue — Immutable event thread
.trinity/issue_bindings.json— Issue ↔ session ↔ service ↔ soul mapping
tri agent spawn <issue>— Create container + SOUL.md + register bindingtri agent run <issue>— Execute 8-step cycle with journalingtri agent stop <issue>— Delete service + final comment
tri dev scan— Read issues + experiencetri dev pick --smart— Priority + MNL (avoid 3+ fails)tri spec create— .tri spec from experience templatetri gen— .tri → .t27 + .zigtri test— Compare outputstri verdict --toxic— "Past: 3/7. Now: 7/7"tri experience save— Episode + learnings + mistakestri git commit— [DONE] + pushtri loop decide— Continue or Done?
Each step writes to:
- GitHub issue (comment)
.trinity/agent_events.jsonl.trinity/experience/...
- Task X: 3 consecutive fails → SKIP (toxic)
- Task Y: 0 fails, similar to solved Z → PICK
- Task Z: 1 fail, but fix found → PICK with learning
- ❌ No direct
.zigwriting where.tri -> tri genshould be used - ❌ No logic duplication between spec and code
- ✅ Every container must have
SOUL.md - ✅ Every container must be bound to exactly one issue
- ✅ Every significant action must be reflected as issue comment