release: Koiz, one lesson base for every project
@@ -0,0 +1,84 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"PostToolUse": [
|
||||||
|
{
|
||||||
|
"matcher": "Agent",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code post-task'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matcher": "TaskCreate|TaskUpdate",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code post-todo'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PreToolUse": [
|
||||||
|
{
|
||||||
|
"matcher": "Agent",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code pre-task'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SessionEnd": [
|
||||||
|
{
|
||||||
|
"matcher": "",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code session-end'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SessionStart": [
|
||||||
|
{
|
||||||
|
"matcher": "",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then printf \"%s\\n\" \"{\\\"systemMessage\\\":\\\"\\\\n\\\\nEntire CLI is enabled but not installed or not on PATH.\\\\nInstallation guide: https://docs.entire.io/cli/installation#installation-methods\\\"}\"; exit 0; fi; exec entire hooks claude-code session-start'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Stop": [
|
||||||
|
{
|
||||||
|
"matcher": "",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code stop'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UserPromptSubmit": [
|
||||||
|
{
|
||||||
|
"matcher": "",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code user-prompt-submit'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"permissions": {
|
||||||
|
"deny": [
|
||||||
|
"Read(./.entire/metadata/**)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
name: koiz-setup
|
||||||
|
description: Первая установка Койза разговором, а не страницей. Запускать, когда владелец говорит /koiz-setup, «поставь Койз», «настрой базу уроков», «включи съем уроков», «koiz install», а также при первом открытии свежего клона этого репозитория. Скилл объясняет каждый шаг до того, как его сделать, задает по одному вопросу с причиной и примером ответа, ничего не ставит без явного согласия, вслух называет то, что на этой машине работать не будет, и заканчивает на настоящем материале владельца, а не на игрушечном примере.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Установка Койза разговором
|
||||||
|
|
||||||
|
<!-- setup-welcome:start -->
|
||||||
|
|
||||||
|
> Здравствуйте. Я Койз, дознаватель роя.
|
||||||
|
>
|
||||||
|
> Я держу одну базу уроков на все ваши проекты. Урок сюда попадает не пересказом, а разбором: что сломалось, почему так вышло и чем закрыт повтор. Последнее поле главное — пока в нем стоит «ничем», урок не закончен, и я об этом напомню.
|
||||||
|
>
|
||||||
|
> Сейчас мы поставим меня на вашу машину. Я буду спрашивать по одному вопросу и объяснять, зачем он нужен. Ничего не поставлю, пока вы не скажете «да». Если что-то на этой машине работать не будет, я скажу это сразу, а не после установки.
|
||||||
|
|
||||||
|
<!-- setup-welcome:end -->
|
||||||
|
|
||||||
|
## Как вести разговор
|
||||||
|
|
||||||
|
Один вопрос за раз. Перед каждым — короткое объяснение, зачем он задан, и пример ответа. Не задавать следующий, пока не получен ответ на предыдущий. Не ставить и не менять ничего без явного согласия.
|
||||||
|
|
||||||
|
Перед первым вопросом проверить машину и назвать вслух то, что не сработает:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node --version # нужен 20 или новее
|
||||||
|
git --version
|
||||||
|
```
|
||||||
|
|
||||||
|
Node старше двадцатой версии — сказать об этом прямо и остановиться. Установка на неподходящий Node закончится непонятной ошибкой через три шага, и это будет хуже честного отказа сейчас.
|
||||||
|
|
||||||
|
<!-- setup-questions:start -->
|
||||||
|
|
||||||
|
1. Куда положить базу уроков? По умолчанию `~/.claude/koiz/lessons.jsonl`. Пример ответа: «оставь по умолчанию» или «положи в ~/Документы/koiz».
|
||||||
|
**Зачем:** база живет вне репозитория проекта, потому что уроки несут пути и имена чужих работ. Если у вас шифрованный том или общий диск для рабочих файлов, лучше выбрать место сейчас, чем переносить журнал потом.
|
||||||
|
|
||||||
|
2. Ставить ли съем уроков на закрытие сессии Claude Code? Пример ответа: «да» или «нет, буду записывать руками».
|
||||||
|
**Зачем:** это единственное изменение, которое я делаю в вашей системе за пределами своей папки — одна запись `SessionEnd` в `~/.claude/settings.json`. Без нее придется набирать каждый урок вручную, а руками их набирают ровно два дня.
|
||||||
|
|
||||||
|
3. Есть ли у вас старый файл с уроками, который стоит перенести? Пример ответа: «да, ~/.claude/self-learning/lessons.md» или «нет, начинаем с чистой базы».
|
||||||
|
**Зачем:** перенос идет одной командой и ничего не теряет, но сделать его лучше до первых записей: в пустую базу старые уроки ложатся как история, а в наполненную — вперемешку с новыми.
|
||||||
|
|
||||||
|
4. Куда поставить ворота долга? Пример ответа: «в ночной скрипт», «в хук перед пушем» или «пока никуда».
|
||||||
|
**Зачем:** без ворот база остается дневником. Ворота выходят ненулевым кодом, когда незакрепленный урок пришел во второй раз, и именно это превращает запись в давление.
|
||||||
|
|
||||||
|
<!-- setup-questions:end -->
|
||||||
|
|
||||||
|
## Шаги установки
|
||||||
|
|
||||||
|
1. Показать, что будет сделано: `bash install.sh --dry-run`. Прочитать вывод вслух.
|
||||||
|
2. Поставить: `bash install.sh`. Он спрашивает перед каждым шагом сам.
|
||||||
|
3. Проверить: `node scripts/koiz.mjs --selftest`. Ожидаемая последняя строка начинается словами `selftest ok`.
|
||||||
|
4. Если владелец назвал старый файл уроков — перенести: `node scripts/koiz.mjs migrate --file <путь>`. Показать, сколько записей перенесено и сколько потеряно; потеряно обязано быть ноль.
|
||||||
|
|
||||||
|
## Закончить на настоящем материале
|
||||||
|
|
||||||
|
Игрушечный пример на этом шаге не годится. Спросить владельца, что сломалось у него за последнюю неделю, и записать это первым уроком вместе с ним: сформулировать причину словами владельца, вместе выбрать закрепление и показать запись.
|
||||||
|
|
||||||
|
Затем показать три команды, которыми он будет пользоваться каждый день:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs ask "о чем" # спросить базу перед работой
|
||||||
|
node scripts/koiz.mjs debt # что повторилось и не закреплено
|
||||||
|
node scripts/koiz.mjs gate # ворота: ненулевой код при долге
|
||||||
|
```
|
||||||
|
|
||||||
|
Обновляться позже — командой `/koiz-update`.
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
---
|
||||||
|
name: koiz-update
|
||||||
|
description: Обновить установленную копию Койза до текущей версии одной командой. Запускать по /koiz-update, а также когда владелец говорит «обнови Койз», «подтяни свежую версию», «koiz update». Скилл сначала показывает, что изменилось, тянет только fast-forward, не трогает журнал уроков и локальные настройки и после обновления сам прогоняет селфтест.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Обновление Койза
|
||||||
|
|
||||||
|
Обновление показывает изменения до того, как что-то тронет, и отказывается оставить установку в половинчатом состоянии.
|
||||||
|
|
||||||
|
## Порядок
|
||||||
|
|
||||||
|
1. Убедиться, что рабочее дерево чистое:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git -C <папка koiz> status --short
|
||||||
|
```
|
||||||
|
|
||||||
|
Есть незакоммиченные правки — остановиться и сказать об этом владельцу. Обновление поверх чужой работы стирает ее молча.
|
||||||
|
|
||||||
|
2. Показать, что придет:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git -C <папка koiz> fetch origin
|
||||||
|
git -C <папка koiz> log --oneline HEAD..origin/main
|
||||||
|
```
|
||||||
|
|
||||||
|
Пустой список означает, что копия уже свежая, и дальше идти незачем.
|
||||||
|
|
||||||
|
3. Потянуть только fast-forward:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git -C <папка koiz> pull --ff-only origin main
|
||||||
|
```
|
||||||
|
|
||||||
|
Отказ команды означает разошедшуюся историю. Разбирать это руками вместе с владельцем, а не разрешать слияние молча.
|
||||||
|
|
||||||
|
4. Проверить прибор после обновления:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node <папка koiz>/scripts/koiz.mjs --selftest
|
||||||
|
node <папка koiz>/scripts/koiz-mutate.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
Красный селфтест после обновления — повод откатиться на прежний коммит и завести issue, а не повод работать дальше.
|
||||||
|
|
||||||
|
## Что обновление не трогает
|
||||||
|
|
||||||
|
- Журнал уроков `~/.claude/koiz/lessons.jsonl`. Он живет вне репозитория, и `git pull` до него не дотягивается.
|
||||||
|
- Ваши настройки `~/.claude/settings.json`. Запись хука уже стоит и переписывать ее не нужно; повторный `install.sh` увидит ее и оставит как есть.
|
||||||
|
- Каталог базы, если вы выбрали не путь по умолчанию.
|
||||||
|
|
||||||
|
## Если обновление сломалось на середине
|
||||||
|
|
||||||
|
Вернуться на прежний коммит и сказать об этом прямо:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git -C <папка koiz> reset --hard <прежний коммит>
|
||||||
|
node <папка koiz>/scripts/koiz.mjs --selftest
|
||||||
|
```
|
||||||
|
|
||||||
|
Половинчатая установка хуже старой версии: она выглядит рабочей и падает в неожиданном месте.
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"PostToolUse": [
|
||||||
|
{
|
||||||
|
"matcher": null,
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks codex post-tool-use'",
|
||||||
|
"timeout": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SessionEnd": [
|
||||||
|
{
|
||||||
|
"matcher": null,
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks codex session-end'",
|
||||||
|
"timeout": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SessionStart": [
|
||||||
|
{
|
||||||
|
"matcher": null,
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then printf \"%s\\n\" \"{\\\"systemMessage\\\":\\\"Entire CLI is enabled but not installed or not on PATH. Installation guide: https://docs.entire.io/cli/installation#installation-methods\\\"}\"; exit 0; fi; exec entire hooks codex session-start'",
|
||||||
|
"timeout": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Stop": [
|
||||||
|
{
|
||||||
|
"matcher": null,
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks codex stop'",
|
||||||
|
"timeout": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SubagentStart": [
|
||||||
|
{
|
||||||
|
"matcher": null,
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks codex subagent-start'",
|
||||||
|
"timeout": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SubagentStop": [
|
||||||
|
{
|
||||||
|
"matcher": null,
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks codex subagent-stop'",
|
||||||
|
"timeout": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UserPromptSubmit": [
|
||||||
|
{
|
||||||
|
"matcher": null,
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks codex user-prompt-submit'",
|
||||||
|
"timeout": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
description: Repository rules for every coding agent
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
|
||||||
|
Read AGENTS.md in the repository root before changing anything. It holds the build, test, style, and publication rules for this project.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
tmp/
|
||||||
|
settings.local.json
|
||||||
|
metadata/
|
||||||
|
logs/
|
||||||
|
redactors/local/
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"enabled": true,
|
||||||
|
"strategy_options": {
|
||||||
|
"checkpoint_remote": {
|
||||||
|
"provider": "github",
|
||||||
|
"repo": "zarubinvibe/koiz-checkpoints"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"telemetry": false,
|
||||||
|
"checkpoints": {
|
||||||
|
"primary": {
|
||||||
|
"type": "git-refs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Agent Instructions
|
||||||
|
|
||||||
|
The rules for this repository live in [AGENTS.md](AGENTS.md). Read that file first, follow it exactly, and do not duplicate its rules here.
|
||||||
|
|
||||||
|
## Chat onboarding
|
||||||
|
|
||||||
|
A fresh clone explains itself: [docs/ONBOARDING-CHAT.md](docs/ONBOARDING-CHAT.md)
|
||||||
|
(ru [docs/ONBOARDING-CHAT.ru.md](docs/ONBOARDING-CHAT.ru.md), zh
|
||||||
|
[docs/ONBOARDING-CHAT.zh.md](docs/ONBOARDING-CHAT.zh.md)). If you just opened this repository,
|
||||||
|
go there and walk the person through the steps instead of installing anything silently.
|
||||||
@@ -0,0 +1,491 @@
|
|||||||
|
{
|
||||||
|
"schema_version": 1,
|
||||||
|
"owner": "zarubinvibe",
|
||||||
|
"slug": "koiz",
|
||||||
|
"license_badge": "MIT",
|
||||||
|
"status_badge": "in%20use",
|
||||||
|
"languages": [
|
||||||
|
"en",
|
||||||
|
"ru",
|
||||||
|
"zh"
|
||||||
|
],
|
||||||
|
"quick_code": "git clone https://github.com/zarubinvibe/koiz.git\ncd koiz\nbash install.sh\n\n# без git, одним архивом:\ncurl -L https://github.com/zarubinvibe/koiz/archive/refs/heads/main.zip -o koiz.zip\n\n# дальше открывайте, чем привычнее:\nclaude # Claude Code: скажите /koiz-setup, установка пройдет разговором\ncodex # Codex CLI: правила проекта уже лежат в AGENTS.md\ncode . # VS Code: агент открывается внутри редактора\n",
|
||||||
|
"owner_display_name": {
|
||||||
|
"en": "Filipp Zarubin",
|
||||||
|
"ru": "Филипп Зарубин",
|
||||||
|
"zh": "Filipp Zarubin"
|
||||||
|
},
|
||||||
|
"text": {
|
||||||
|
"en": {
|
||||||
|
"title": "Koiz",
|
||||||
|
"name": "Koiz",
|
||||||
|
"tagline": "Koiz keeps one lesson base for every project, and the work stops while the cause of a failure has no mechanism closing it.",
|
||||||
|
"hero_alt": "White marble Koios beside a classical column, the axis rod upright in his right hand and a gold pin driven through the open marble ledger on his palm, blue paths converging at his feet in daylight",
|
||||||
|
"welcome": "Hi. I am Fil.\n\nI built Koiz after stepping on the same rake in a third project in a row. The lesson had been written down. It sat in another repository, in another log, and nobody read it in time.\n\nTry it. If it breaks, write in Issues, I read them. If it helps, leave a star and show it to somebody who runs several projects at once. The rest of the Olympuz projects live here: https://zarubinvibe.com",
|
||||||
|
"what": "Koiz is a shared lesson base for all of your projects. One journal, one search key, one discipline.\n\nA lesson arrives as a breakdown, not as a retelling: what broke, how to reproduce it, why it happened, and what closes it. That last field carries the weight. While it says \"nothing\", the lesson is unfinished.",
|
||||||
|
"why": "A mistake is rarely new. It already happened, in another project, six months ago, and the conclusion was written down then. The note sits in that project's log while your hands are in a different repository today, and nobody remembers the note exists.\n\nThen it gets worse. Lessons pile up, duplicates never merge, stale ones are never marked. In a year that is a wall of text nobody reads, which means it is not there at all.",
|
||||||
|
"advantage": "a lesson is closed by a mechanism, not by good intentions.",
|
||||||
|
"better": "A rule written in prose gets read, agreed with, and quietly ignored. A mechanism gives no advice: a hook, a deny rule, an instrument or a test simply refuses to let the thing happen twice. Koiz demands the name of that mechanism when the lesson is written, and turns the gate red when an unpinned lesson shows up a second time.",
|
||||||
|
"how": "The work runs in stages. The machine takes what the disk can prove, the agent adds only meaning, and pinning is checked apart from writing.",
|
||||||
|
"quick_intro": "You need Git, Node 20 or newer, and any one of three ways in: Claude Code, Codex CLI, or a plain terminal.",
|
||||||
|
"quick_extra": "The three lines above are the whole install. `bash install.sh` creates the base and puts capture on session close, asking before every step. It needs no agent: a terminal is enough.\n\n**Claude Code.** Run `claude` in this folder and say `/koiz-setup`. The install goes as a conversation, one question at a time.\n\n**Codex CLI.** Run `codex` in the same place. The project rules already sit in `AGENTS.md`.\n\n**No agent at all.** `node scripts/koiz.mjs ask \"what has broken before\"` shows what the base knows about your question and installs nothing.",
|
||||||
|
"quick_result": "the base exists, capture runs on session close, and `node scripts/koiz.mjs debt` shows which lesson came back with nothing holding it.",
|
||||||
|
"compare_header": [
|
||||||
|
"Choice",
|
||||||
|
"What it is",
|
||||||
|
"Where lessons live",
|
||||||
|
"Reaches other projects",
|
||||||
|
"Demands a mechanism",
|
||||||
|
"Stops the work",
|
||||||
|
"Price"
|
||||||
|
],
|
||||||
|
"compare": [
|
||||||
|
[
|
||||||
|
"**Koiz**",
|
||||||
|
"A lesson base with mandatory pinning",
|
||||||
|
"One journal on your own disk",
|
||||||
|
"Yes, the key is the error class, not the repository name",
|
||||||
|
"Yes, the pin field is required",
|
||||||
|
"Yes, an unpinned repeat turns the gate red",
|
||||||
|
"Own tool, free"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Writing it up by hand",
|
||||||
|
"A note after a bad session",
|
||||||
|
"Wherever you wrote it",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"Your hours, every time"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"`CLAUDE.md` and `AGENTS.md`",
|
||||||
|
"A rule as prose in the repository",
|
||||||
|
"In the project where it was written",
|
||||||
|
"No, the file lives in one tree",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"Free"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Cursor Rules",
|
||||||
|
"Editor rules handed to the agent",
|
||||||
|
"In the project settings",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"Part of the subscription"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"mem0",
|
||||||
|
"Agent memory for facts and preferences",
|
||||||
|
"Its own store or the cloud",
|
||||||
|
"Yes, if the projects share one memory",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"Open source, cloud is paid"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Letta",
|
||||||
|
"An agent with memory and a bounded context block",
|
||||||
|
"Its own database",
|
||||||
|
"Partly",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"Open source"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Zep and Graphiti",
|
||||||
|
"A memory graph where facts carry validity intervals",
|
||||||
|
"Its own service",
|
||||||
|
"Yes",
|
||||||
|
"No",
|
||||||
|
"No",
|
||||||
|
"Open source, cloud is paid"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"compare_note": "Names belong to their owners. The table describes purpose, not a benchmark: other products change, and this page does not speak for them.",
|
||||||
|
"glossary": [
|
||||||
|
[
|
||||||
|
"Lesson",
|
||||||
|
"One failure taken apart: the cause and the mechanism that closes the repeat"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Pin",
|
||||||
|
"The named mechanism, a hook, a deny rule, an instrument or a test, that makes the repeat impossible"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Collapse",
|
||||||
|
"A separate pass that merges similar lessons into one rule"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"safety": [
|
||||||
|
"Every lesson stays on your disk, in one file. Nothing leaves the machine: the instrument has no network and no dependencies.",
|
||||||
|
"The secret filter sits on the write, not on the read. Tokens, keys and private keys are cut before the line reaches the journal.",
|
||||||
|
"The base lives outside the project repository. Lessons carry paths and names from other people's work, and a public tree is the wrong place for them.",
|
||||||
|
"The journal only appends. A wrong record is closed by date and stays in history together with the reason it was closed.",
|
||||||
|
"The instrument runs from source with nothing installed: three files on bare Node.",
|
||||||
|
"Capture reads the session transcript on your own machine and copies it nowhere."
|
||||||
|
],
|
||||||
|
"safety_tail": "What actually lands in the base and where to report a hole: [SECURITY.md](SECURITY.md).",
|
||||||
|
"status": "Status: in use every day. The owner's base holds more than eighty active lessons, and the gate stands in the nightly run, where it has already stopped the night on an unpinned repeat.",
|
||||||
|
"limits": [
|
||||||
|
"A repeat is caught by the fingerprint of machine capture. Two lessons written as prose about the same thing in different words will not be merged.",
|
||||||
|
"The cause is written by a person or an agent. The machine takes only what the disk shows: an exit code, a failed command, a refused gate.",
|
||||||
|
"Collapse proposes a rule and leaves the decision to you: the merge runs as a separate pass and shows exactly what it merges.",
|
||||||
|
"Capture is proven on Claude Code transcripts. Other agent CLIs write their journals differently and need their own reader.",
|
||||||
|
"Windows is not tested yet."
|
||||||
|
],
|
||||||
|
"docs": "Deeper: [the onboarding](docs/ONBOARDING.md) walks the first run step by step, and [how it works](docs/HOW-IT-WORKS.md) takes every stage apart.",
|
||||||
|
"license": "The project is available under the [MIT License](LICENSE)."
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"title": "Койз",
|
||||||
|
"name": "Койз",
|
||||||
|
"tagline": "Койз держит одну базу уроков на все проекты, и работа стоит, пока причина провала не закрыта механизмом.",
|
||||||
|
"hero_alt": "Койз из белого мрамора у классической колонны: стержень оси в правой руке, золотая шпилька продета сквозь раскрытый мраморный свод на ладони, голубые пути сходятся к его ногам при дневном свете",
|
||||||
|
"welcome": "Привет. Я Фил.\n\nКойз я собрал после того, как третий проект подряд наступил на те же грабли. Урок был записан. Он лежал в другом репозитории, в другом логе, и вовремя его никто не прочитал.\n\nПопробуйте. Сломается, пишите в Issues: я читаю. Пригодилось, поставьте звезду и покажите тому, кто ведет несколько проектов сразу. Остальные проекты Олимпуса здесь: https://zarubinvibe.ru",
|
||||||
|
"what": "Койз держит общую базу уроков для всех ваших проектов. Один журнал, один ключ поиска, одна дисциплина.\n\nУрок сюда попадает разбором, а не пересказом: что сломалось, чем воспроизводится, почему так вышло и чем закрыто. Последнее поле главное. Пока в нем стоит «ничем», урок не закончен.",
|
||||||
|
"why": "Ошибка редко бывает новой. Она уже случалась в другом проекте полгода назад, и вывод тогда записали. Запись лежит в логе того проекта, а руки сегодня работают в другом, и о существовании записи никто не помнит.\n\nДальше хуже. Уроки копятся, дубли не схлопываются, устаревшее не помечается. Через год это стена текста, которую не читают, а значит ее нет.",
|
||||||
|
"advantage": "урок закрыт механизмом, а не намерением.",
|
||||||
|
"better": "Правило прозой читают, соглашаются и все равно делают иначе. Механизм ничего не советует: хук, запрет, прибор или тест просто не дают случиться этому второй раз. Койз требует назвать механизм при записи и красит ворота, когда незакрепленный урок пришел снова.",
|
||||||
|
"how": "Работа идет стадиями. Машина берет то, что видно с диска, агент дописывает только смысл, а закрепление проверяется отдельно от записи.",
|
||||||
|
"quick_intro": "Нужен Git, Node 20 или новее и любой из трех входов: Claude Code, Codex CLI или обычный терминал.",
|
||||||
|
"quick_extra": "Три строки выше и есть вся установка. `bash install.sh` заводит базу и ставит съем на закрытие сессии, спрашивая разрешение перед каждым шагом. Агент ему не нужен: хватает терминала.\n\n**Claude Code.** Запустите `claude` в этой папке и скажите `/koiz-setup`. Установка пройдет разговором, по одному вопросу.\n\n**Codex CLI.** Запустите `codex` там же. Правила проекта уже лежат в `AGENTS.md`.\n\n**Совсем без агента.** `node scripts/koiz.mjs ask \"что уже ломалось\"` покажет, что база знает по вашему запросу, и ничего не поставит.",
|
||||||
|
"quick_result": "база заведена, съем стоит на закрытии сессии, а `node scripts/koiz.mjs debt` показывает, какой урок вернулся и до сих пор ничем не закреплен.",
|
||||||
|
"compare_header": [
|
||||||
|
"Вариант",
|
||||||
|
"Что это",
|
||||||
|
"Где живут уроки",
|
||||||
|
"Действует на другие проекты",
|
||||||
|
"Требует механизм",
|
||||||
|
"Останавливает работу",
|
||||||
|
"Цена"
|
||||||
|
],
|
||||||
|
"compare": [
|
||||||
|
[
|
||||||
|
"**Койз**",
|
||||||
|
"База уроков с обязательным закреплением",
|
||||||
|
"Один журнал на вашем диске",
|
||||||
|
"Да, ключом служит класс ошибки, а не имя репозитория",
|
||||||
|
"Да, поле закрепления обязательно",
|
||||||
|
"Да, незакрепленный повтор красит ворота",
|
||||||
|
"Свой инструмент, бесплатно"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Разбор руками в блокноте",
|
||||||
|
"Заметка после неудачной сессии",
|
||||||
|
"Там, где записали",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Ваши часы на каждый разбор"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"`CLAUDE.md` и `AGENTS.md`",
|
||||||
|
"Правило прозой в репозитории",
|
||||||
|
"В том проекте, где написано",
|
||||||
|
"Нет, файл живет в одном дереве",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Бесплатно"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Cursor Rules",
|
||||||
|
"Правила редактора, которые получает агент",
|
||||||
|
"В настройках проекта",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Входит в подписку"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"mem0",
|
||||||
|
"Память агента: факты и предпочтения",
|
||||||
|
"В своем хранилище или в облаке",
|
||||||
|
"Да, если проекты ходят в одну память",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Открытый код, облако платное"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Letta",
|
||||||
|
"Агент с памятью и ограниченным блоком контекста",
|
||||||
|
"В своей базе",
|
||||||
|
"Частично",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Открытый код"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Zep и Graphiti",
|
||||||
|
"Граф памяти, где у факта есть интервал действия",
|
||||||
|
"В своем сервисе",
|
||||||
|
"Да",
|
||||||
|
"Нет",
|
||||||
|
"Нет",
|
||||||
|
"Открытый код, облако платное"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"compare_note": "Названия принадлежат их владельцам. Таблица описывает назначение, а не замер: чужие продукты меняются, и эта страница за них не отвечает.",
|
||||||
|
"glossary": [
|
||||||
|
[
|
||||||
|
"Lesson",
|
||||||
|
"Урок: разобранный провал с причиной и механизмом, который закрывает повтор"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Pin",
|
||||||
|
"Закрепление: названный механизм (хук, запрет, прибор или тест), который делает повтор невозможным"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Collapse",
|
||||||
|
"Схлопывание: отдельный проход, который сливает похожие уроки в одно правило"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"safety": [
|
||||||
|
"Уроки лежат на вашем диске, в одном файле. Наружу не уходит ничего: у прибора нет ни сети, ни зависимостей.",
|
||||||
|
"Фильтр секретов стоит на записи, а не на выдаче. Токен, ключ и приватный ключ режутся до того, как строка попадет в журнал.",
|
||||||
|
"База живет вне репозитория проекта: уроки несут пути и имена чужих работ, и в публичном дереве им не место.",
|
||||||
|
"Журнал только дописывается. Ошибочную запись закрывают датой, и она остается в истории вместе с причиной закрытия.",
|
||||||
|
"Прибор запускается из исходников без установки пакетов: три файла на голом Node.",
|
||||||
|
"Съем читает транскрипт сессии на вашей машине и никуда его не копирует."
|
||||||
|
],
|
||||||
|
"safety_tail": "Что именно попадает в базу и куда писать о найденной дыре: [SECURITY.ru.md](SECURITY.ru.md).",
|
||||||
|
"status": "Статус: в ежедневной работе. База владельца держит больше восьмидесяти активных уроков, а ворота стоят в ночном прогоне и уже останавливали его на незакрепленном повторе.",
|
||||||
|
"limits": [
|
||||||
|
"Повтор ловится отпечатком машинного съема. Два урока, написанные прозой про одно и то же разными словами, прибор в дубль не сведет.",
|
||||||
|
"Причину дописывает человек или агент. Машина берет только то, что видно с диска: код возврата, упавшую команду, отказ ворот.",
|
||||||
|
"Схлопывание предлагает правило, а решение оставляет вам: слияние идет отдельным проходом и показывает, что именно сливает.",
|
||||||
|
"Съем проверен на транскриптах Claude Code. Другие агентские CLI пишут журнал иначе, и для них нужен свой разбор.",
|
||||||
|
"Windows пока не проверен."
|
||||||
|
],
|
||||||
|
"docs": "Глубже: [онбординг](docs/ONBOARDING.ru.md) с первым запуском по шагам и [как это работает](docs/HOW-IT-WORKS.ru.md) с разбором каждой стадии.",
|
||||||
|
"license": "Проект доступен по [лицензии MIT](LICENSE)."
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"title": "Koiz",
|
||||||
|
"name": "Koiz",
|
||||||
|
"tagline": "Koiz 用一份教训库管住所有项目:失败的原因没有被机制关掉,工作就停在那里。",
|
||||||
|
"hero_alt": "白色大理石的科俄斯站在古典石柱旁,右手竖握轴杖,掌上摊开的大理石册页被一根金色别针穿透,蓝色路径在日光下汇到他脚边",
|
||||||
|
"welcome": "你好,我是 Fil。\n\n我做 Koiz,是因为同一个坑连着第三个项目又踩了一次。教训其实写过,它躺在另一个仓库、另一份日志里,没人在需要的时候读到。\n\n试试看。坏了就到 Issues 里写,我会读。有用就点个星标,再拿给同时管好几个项目的人看看。Olympuz 的其他项目在这里:https://zarubinvibe.com",
|
||||||
|
"what": "Koiz 是你所有项目共用的一份教训库。一份日志,一个检索口,一套纪律。\n\n教训进来的方式是拆解,不是复述:什么坏了,怎么复现,为什么会这样,被什么关掉了。最后一栏最重要。它写着「没有」,这条教训就还没做完。",
|
||||||
|
"why": "错误很少是新的。它半年前在另一个项目里已经发生过,当时也写了结论。那条记录留在那个项目的日志里,而今天你的手在另一个仓库上,没人记得它存在。\n\n再往后更麻烦。教训越堆越多,重复的不合并,过期的不标注。一年之后就是一堵没人读的文字墙,等于没有。",
|
||||||
|
"advantage": "教训靠机制关掉,不靠决心。",
|
||||||
|
"better": "写成文字的规则会被读完、被认同,然后照旧不执行。机制不提建议:钩子、禁止规则、仪器或测试,直接不让这件事发生第二次。Koiz 在写入时就要求说出这个机制,没有机制的教训再来一次,闸门就变红。",
|
||||||
|
"how": "工作分阶段走。机器只取磁盘能证明的东西,智能体只补上意义,固定这一步和写入分开检查。",
|
||||||
|
"quick_intro": "需要 Git、Node 20 或更新的版本,以及三种入口里的任意一种:Claude Code、Codex CLI,或者一个普通终端。",
|
||||||
|
"quick_extra": "上面三行就是全部安装。`bash install.sh` 会建好教训库,并把采集挂到会话结束上,每一步之前都先问你。它不需要任何智能体,一个终端就够。\n\n**Claude Code。** 在这个目录里运行 `claude`,然后说 `/koiz-setup`。安装会以对话方式进行,一次问一个问题。\n\n**Codex CLI。** 在同一个目录运行 `codex`。项目规则已经写在 `AGENTS.md` 里。\n\n**完全不用智能体。** `node scripts/koiz.mjs ask \"什么地方坏过\"` 会把库里和你问题相关的内容列出来,不安装任何东西。",
|
||||||
|
"quick_result": "教训库建好了,采集挂在会话结束上,`node scripts/koiz.mjs debt` 会告诉你哪条教训又回来了、而且到现在还没有任何机制拦着它。",
|
||||||
|
"compare_header": [
|
||||||
|
"方案",
|
||||||
|
"这是什么",
|
||||||
|
"教训存在哪里",
|
||||||
|
"能否作用于别的项目",
|
||||||
|
"是否要求机制",
|
||||||
|
"会不会拦住工作",
|
||||||
|
"价格"
|
||||||
|
],
|
||||||
|
"compare": [
|
||||||
|
[
|
||||||
|
"**Koiz**",
|
||||||
|
"带强制固定的教训库",
|
||||||
|
"你自己磁盘上的一份日志",
|
||||||
|
"能,检索键是错误类别,不是仓库名",
|
||||||
|
"要,固定这一栏必须填",
|
||||||
|
"会,没固定的重复会让闸门变红",
|
||||||
|
"自己的工具,免费"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"手写复盘",
|
||||||
|
"一次糟糕会话之后的笔记",
|
||||||
|
"写在哪儿就在哪儿",
|
||||||
|
"不能",
|
||||||
|
"不要",
|
||||||
|
"不会",
|
||||||
|
"每次复盘花掉你的时间"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"`CLAUDE.md` 和 `AGENTS.md`",
|
||||||
|
"写在仓库里的文字规则",
|
||||||
|
"写在哪个项目就在哪个项目",
|
||||||
|
"不能,文件只活在一棵树里",
|
||||||
|
"不要",
|
||||||
|
"不会",
|
||||||
|
"免费"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Cursor Rules",
|
||||||
|
"交给智能体的编辑器规则",
|
||||||
|
"项目设置里",
|
||||||
|
"不能",
|
||||||
|
"不要",
|
||||||
|
"不会",
|
||||||
|
"包含在订阅里"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"mem0",
|
||||||
|
"智能体记忆:事实和偏好",
|
||||||
|
"自己的存储或云端",
|
||||||
|
"能,前提是项目共用一份记忆",
|
||||||
|
"不要",
|
||||||
|
"不会",
|
||||||
|
"开源,云端收费"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Letta",
|
||||||
|
"带记忆和有限上下文块的智能体",
|
||||||
|
"自己的数据库",
|
||||||
|
"部分能",
|
||||||
|
"不要",
|
||||||
|
"不会",
|
||||||
|
"开源"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Zep 和 Graphiti",
|
||||||
|
"记忆图谱,事实带有生效区间",
|
||||||
|
"自己的服务",
|
||||||
|
"能",
|
||||||
|
"不要",
|
||||||
|
"不会",
|
||||||
|
"开源,云端收费"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"compare_note": "名称归各自所有者。这张表描述的是用途,不是实测:别人的产品会变,这个页面不替它们做承诺。",
|
||||||
|
"glossary": [
|
||||||
|
[
|
||||||
|
"Lesson",
|
||||||
|
"教训:一次失败的完整拆解,包含原因和关掉重复的机制"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Pin",
|
||||||
|
"固定:说得出名字的机制,钩子、禁止规则、仪器或测试,让重复不可能发生"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Collapse",
|
||||||
|
"归并:单独跑一遍,把相似的教训合成一条规则"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"safety": [
|
||||||
|
"所有教训都在你自己的磁盘上,只有一个文件。什么都不会外发:这个仪器没有网络,也没有依赖。",
|
||||||
|
"密钥过滤放在写入这一侧,不是读取这一侧。令牌、密钥和私钥在进入日志之前就被切掉。",
|
||||||
|
"教训库放在项目仓库之外:教训里带着路径和别人项目的名字,公开的代码树不是它该待的地方。",
|
||||||
|
"日志只追加。写错的记录用日期关掉,它连同关闭原因一起留在历史里。",
|
||||||
|
"仪器直接从源码运行,不用装任何包:裸 Node 上的三个文件。",
|
||||||
|
"采集在你自己的机器上读会话记录,不会把它复制到任何地方。"
|
||||||
|
],
|
||||||
|
"safety_tail": "到底什么会进到库里、发现漏洞往哪里写,都在 [SECURITY.zh.md](SECURITY.zh.md) 里。",
|
||||||
|
"status": "状态:每天都在用。作者的库里有八十多条生效教训,闸门装在夜间流程上,已经因为一次没固定的重复把夜里的活儿拦下来过。",
|
||||||
|
"limits": [
|
||||||
|
"重复是靠机器采集的指纹认出来的。同一件事用不同措辞写成两条散文教训,仪器不会把它们并成一条。",
|
||||||
|
"原因由人或智能体补写。机器只取磁盘能看到的:退出码、失败的命令、被拒的闸门。",
|
||||||
|
"归并只提出规则,决定权留给你:合并单独跑一遍,并且会把合了什么摊开给你看。",
|
||||||
|
"采集在 Claude Code 的会话记录上验证过。别的智能体命令行日志格式不同,需要各自的读取方式。",
|
||||||
|
"Windows 还没有验证。"
|
||||||
|
],
|
||||||
|
"docs": "更深入:[上手引导](docs/ONBOARDING.zh.md) 一步一步带你走完第一次运行,[工作原理](docs/HOW-IT-WORKS.zh.md) 把每个阶段都拆开讲。",
|
||||||
|
"license": "本项目以 [MIT 许可证](LICENSE) 提供。"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"stages": {
|
||||||
|
"capture": {
|
||||||
|
"en": {
|
||||||
|
"short": "The machine lifts the failure off the disk when the session closes, with nothing typed by hand.",
|
||||||
|
"body": "A `SessionEnd` hook hands the instrument the transcript of the session that just closed. The instrument takes only what the disk can prove: failed commands, exit codes, refused gates, the number of attempts.\n\nThe watchdog doing its job is not a failure. A blocker that fired, and any piece of evidence shorter than three meaningful words, never reach the base. Otherwise the debt would turn the gate red over nothing.",
|
||||||
|
"result": "draft lessons collected without a single line typed by hand.",
|
||||||
|
"alt": "A marble table with a stack of thin marble sheets and blue paths arriving at it from the left edge"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"short": "Машина снимает провал с диска на закрытии сессии, без ручного набора.",
|
||||||
|
"body": "Хук `SessionEnd` отдает прибору транскрипт закрывшейся сессии. Прибор берет оттуда только то, что видно с диска: упавшие команды, коды возврата, отказы ворот, число попыток.\n\nРабота сторожа провалом не считается. Сработавший блокер и улика короче трех значимых слов в базу не идут: иначе долг красил бы ворота на ровном месте.",
|
||||||
|
"result": "черновики уроков, собранные без единой строки, набранной руками.",
|
||||||
|
"alt": "Мраморный стол со стопкой тонких мраморных листов, к нему с левого края приходят голубые пути"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"short": "会话结束时,机器直接从磁盘上把失败取下来,一个字都不用手打。",
|
||||||
|
"body": "`SessionEnd` 钩子把刚结束的会话记录交给仪器。仪器只取磁盘能证明的东西:失败的命令、退出码、被拒的闸门、重试了几次。\n\n守卫正常工作 不算失败。已经拦住的阻断,以及短于三个实义词的证据,都不会进库。否则欠账会无缘无故把闸门染红。",
|
||||||
|
"result": "一批草稿教训,全程没有手打一行。",
|
||||||
|
"alt": "大理石桌上放着一摞薄薄的大理石片,蓝色路径从画面左边一直连到桌前"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cause": {
|
||||||
|
"en": {
|
||||||
|
"short": "The agent adds the one thing the machine cannot know: why it happened.",
|
||||||
|
"body": "A captured draft has an empty \"why\". Until the cause is found, the lesson is unfinished and does not go out as ready.\n\nThe order matters and does not work in reverse. The machine takes the facts, a person or an agent adds the meaning. An agent that guesses facts writes convincing untruth.",
|
||||||
|
"result": "a lesson with a cause instead of a description of the symptom.",
|
||||||
|
"alt": "Koios with the axis rod raised, looking down at the open marble ledger resting on his palm"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"short": "Агент дописывает единственное, чего машина знать не может: почему так вышло.",
|
||||||
|
"body": "У снятого черновика поле «почему» пустое. Пока причина не дознана, урок не закончен и готовым в выдачу не идет.\n\nПорядок важен и в обратную сторону не работает. Факты берет машина, смысл дописывает человек или агент. Агент, который угадывает факты, пишет убедительную неправду.",
|
||||||
|
"result": "урок с причиной вместо описания симптома.",
|
||||||
|
"alt": "Койз с поднятым стержнем оси смотрит на раскрытый мраморный свод, лежащий у него на ладони"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"short": "智能体补上机器不可能知道的那一项:为什么会这样。",
|
||||||
|
"body": "采集来的草稿里,「为什么」是空的。原因没查出来,这条教训就没做完,也不会作为成品被检索到。\n\n顺序很重要,反过来不成立。事实由机器取,意义由人或智能体补。让智能体去猜事实,写出来的是很像样的假话。",
|
||||||
|
"result": "一条带原因的教训,而不是一句症状描述。",
|
||||||
|
"alt": "科俄斯举着轴杖,低头看着摊在自己掌上的那本大理石册页"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pin": {
|
||||||
|
"en": {
|
||||||
|
"short": "The lesson is tied to a mechanism that makes the repeat impossible.",
|
||||||
|
"body": "The pin field takes five values: `hook`, `deny`, an instrument, a test, and \"nothing\". Home-made values are refused, and a pin without a reference to a file or a command is not accepted at all.\n\n\"Nothing\" is a legal value and an honest admission. It says the mechanism does not exist yet, and it is exactly what later raises the lesson as a debt.",
|
||||||
|
"result": "a record where you can see what closes the repeat.",
|
||||||
|
"alt": "A gold pin driven straight through the page of an open marble ledger, its head standing above the page"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"short": "Урок привязывается к механизму, который делает повтор невозможным.",
|
||||||
|
"body": "Поле закрепления принимает пять значений: `hook`, `deny`, прибор, тест и «ничем». Самодельные значения прибор отвергает, а закрепление без ссылки на файл или команду не принимает вовсе.\n\n«Ничем» тоже законное значение и честное признание. Оно говорит, что механизма пока нет, и именно оно потом поднимает урок долгом.",
|
||||||
|
"result": "запись, у которой видно, чем закрыт повтор.",
|
||||||
|
"alt": "Золотая шпилька продета насквозь через страницу раскрытого мраморного свода, ее головка стоит над листом"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"short": "教训被绑到一个让重复不可能发生的机制上。",
|
||||||
|
"body": "固定这一栏只收五个值:`hook`、`deny`、仪器、测试,以及「没有」。自造的值会被拒绝,没有指向具体文件或命令的固定也不收。\n\n「没有」是合法值,也是诚实的承认。它说明机制还不存在,而正是它,之后会把这条教训抬成一笔欠账。",
|
||||||
|
"result": "一条能看清楚是什么在拦住重复的记录。",
|
||||||
|
"alt": "一根金色别针笔直穿过摊开的大理石册页,针头立在纸面之上"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collapse": {
|
||||||
|
"en": {
|
||||||
|
"short": "Similar lessons merge into one rule in a pass of their own.",
|
||||||
|
"body": "Merging on write is expensive and loses data, so it moved into a separate command. `collapse` finds three similar lessons, proposes a shared rule, and shows exactly what it merges.\n\nA stale lesson is never erased. It is closed by date and stays in history. It is not a lie, it simply stopped applying.",
|
||||||
|
"result": "one rule instead of three records, and a base that does not grow forever.",
|
||||||
|
"alt": "Three thin marble sheets converging into one thicker sheet on a marble table"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"short": "Похожие уроки сливаются в одно правило отдельным проходом.",
|
||||||
|
"body": "Слияние на записи стоит дорого и теряет данные, поэтому оно вынесено в отдельную команду. `collapse` находит три похожих урока, предлагает общее правило и показывает, что именно сливает.\n\nУстаревший урок не стирается. Он закрывается датой и остается в истории. Он не ложь, он просто перестал действовать.",
|
||||||
|
"result": "одно правило вместо трех записей и база, которая не растет бесконечно.",
|
||||||
|
"alt": "Три тонких мраморных листа сходятся в один лист потолще на мраморном столе"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"short": "相似的教训在单独一趟里合成一条规则。",
|
||||||
|
"body": "写入时顺手合并既贵又会丢数据,所以它被拆成了一条单独的命令。`collapse` 找出三条相似的教训,提出一条共同规则,并把合了什么摊开给你看。\n\n过期的教训不会被删掉。它按日期关闭,留在历史里。它不是假话,只是不再生效了。",
|
||||||
|
"result": "三条记录变成一条规则,库也不会无止境地长下去。",
|
||||||
|
"alt": "三片薄薄的大理石片在大理石桌上汇成一片更厚的石片"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gate": {
|
||||||
|
"en": {
|
||||||
|
"short": "An unpinned repeat stops the work instead of staying a note.",
|
||||||
|
"body": "The `gate` command exits non-zero when a lesson came back and is still pinned to \"nothing\". In the owner's house that command stands in the nightly run, and it has already stopped it.\n\nThere are two ways out and both are honest: close it with a mechanism, or admit the rule does not work and close it by date. A deferral needs a date and a reason.",
|
||||||
|
"result": "a repeat nobody can walk past in silence.",
|
||||||
|
"alt": "An upright marble plate with a clean rectangular opening cut through it, standing on a marble table"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"short": "Незакрепленный повтор останавливает работу, а не остается заметкой.",
|
||||||
|
"body": "Команда `gate` выходит ненулевым кодом, когда урок вернулся и до сих пор закреплен «ничем». В доме владельца эта команда стоит в ночном прогоне и уже останавливала его.\n\nВыхода два, и оба честные: закрыть механизмом или признать правило нерабочим и закрыть его датой. Отсрочка требует даты и причины.",
|
||||||
|
"result": "повтор, мимо которого нельзя пройти молча.",
|
||||||
|
"alt": "Мраморная плита с прорезанным насквозь прямоугольным проемом стоит на мраморном столе"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"short": "没有固定的重复会拦住工作,而不是变成一条笔记。",
|
||||||
|
"body": "`gate` 命令在教训回来、而固定栏还写着「没有」时,以非零码退出。在作者那边,这条命令挂在夜间流程上,已经真的把夜里的活儿拦下来过。\n\n出路有两条,都很诚实:用机制关掉它,或者承认这条规则不成立,按日期关掉。要延期就得写上日期和理由。",
|
||||||
|
"result": "一次没法默默绕过去的重复。",
|
||||||
|
"alt": "一块竖立的大理石板,中间开着一个干净的长方形通孔,立在大理石桌上"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
{
|
||||||
|
"schema_version": 3,
|
||||||
|
"family_id": "zarubinvibe-pantheon",
|
||||||
|
"catalog_version": "2026-09-06",
|
||||||
|
"dress": "full",
|
||||||
|
"project": {
|
||||||
|
"slug": "koiz",
|
||||||
|
"deity": "Koios",
|
||||||
|
"symbol": "the axis rod and a gold pin driven through the ledger of lessons"
|
||||||
|
},
|
||||||
|
"visuals": {
|
||||||
|
"style_anchor_sha256": "ce524f9d22cb0092cb17aa280832e1b2ab2a77a0e01602065ec502232a3bb2d2",
|
||||||
|
"column_reference_sha256": "9d32edd56ac55c4dd6d0425a28a2ac35035e9ab09073fc8ce0c1414b2edfb1bd",
|
||||||
|
"presentation": {
|
||||||
|
"min_width": 1600,
|
||||||
|
"aspect_ratio": "16:9",
|
||||||
|
"readme_width": "100%",
|
||||||
|
"published_width": 1672,
|
||||||
|
"published_height": 941
|
||||||
|
},
|
||||||
|
"bible": {
|
||||||
|
"character_sheet": {
|
||||||
|
"published_path": "docs/assets/pantheon/bible-character.png",
|
||||||
|
"published_sha256": "0f6940ad424dbb14ca16bcdfb0c5ee8e4d9dede0cca3c2db9062e9eed6076b58",
|
||||||
|
"alt": "Карта персонажа: Койз из белого мрамора в четырех видах со стержнем оси, раскрытым сводом уроков и золотой шпилькой, рядом этюды предметов"
|
||||||
|
},
|
||||||
|
"prop_sheet": {
|
||||||
|
"published_path": "docs/assets/pantheon/bible-props.png",
|
||||||
|
"published_sha256": "baccce7b4bcd1b9b1a92a96ca18248ac98057fafa9f031927382fc7a72b864d7",
|
||||||
|
"alt": "Карта реквизита: стержень оси с кольцом, раскрытый свод с бороздами, золотая шпилька, стопка мраморных листов, плита с проемом и мраморный стол на слоновой кости"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hero": {
|
||||||
|
"source_path": "docs/assets/pantheon/hero-source.png",
|
||||||
|
"source_sha256": "50173c9ed752959fa39110f5ba66fe8a723506b1fc6bb05a72e0bdda972d19b1",
|
||||||
|
"published_path": "docs/assets/pantheon/hero.png",
|
||||||
|
"published_sha256": "50173c9ed752959fa39110f5ba66fe8a723506b1fc6bb05a72e0bdda972d19b1"
|
||||||
|
},
|
||||||
|
"emblem": {
|
||||||
|
"source_path": "docs/assets/pantheon/emblem-source.png",
|
||||||
|
"source_sha256": "927fa0b130eb3b8eaf7baae5ea4577954e78f0797f39720616674f2af3f635f2",
|
||||||
|
"published_path": "docs/assets/pantheon/emblem.png",
|
||||||
|
"published_sha256": "927fa0b130eb3b8eaf7baae5ea4577954e78f0797f39720616674f2af3f635f2"
|
||||||
|
},
|
||||||
|
"takt": {
|
||||||
|
"source_path": "docs/assets/pantheon/takt.png",
|
||||||
|
"source_sha256": "10322e47bb1b02f40847613fd7ec9677ae9c1a12004061eb17351c9cb077525e",
|
||||||
|
"plate_geometry": ".github/pantheon/takt-plity.json",
|
||||||
|
"languages": {
|
||||||
|
"en": {
|
||||||
|
"published_path": "docs/assets/pantheon/takt-en.png",
|
||||||
|
"published_sha256": "70d8d81e3281f7074135d30ea2e33a93d7fcaa7818cf77f6a52f9d2e56873350",
|
||||||
|
"alt": "Five marble plates in a row, each carved with one stage of the work, linked by a gold thread that comes in from the left edge"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"published_path": "docs/assets/pantheon/takt-ru.png",
|
||||||
|
"published_sha256": "e419068a41ab50f6a0ee83b94901b61bf0d5d7f73d8b08a0fabc30527e1f757a",
|
||||||
|
"alt": "Пять мраморных плит в ряд, на каждой высечена одна стадия работы, их связывает золотая нить, приходящая от левой кромки"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"published_path": "docs/assets/pantheon/takt-zh.png",
|
||||||
|
"published_sha256": "ab9282925436eb422ca4d2edbd157c7bec4f5431c76adcf981ff3947168a5493",
|
||||||
|
"alt": "五块大理石板排成一行,每块刻着一个阶段,一条从左边进来的金色丝线把它们串起来"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"stages": [
|
||||||
|
{
|
||||||
|
"id": "capture",
|
||||||
|
"title_en": "Capture the failure",
|
||||||
|
"title_ru": "Съем провала",
|
||||||
|
"title_zh": "采集失败",
|
||||||
|
"diagram_en": "Capture",
|
||||||
|
"diagram_ru": "Съем",
|
||||||
|
"diagram_zh": "采集"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cause",
|
||||||
|
"title_en": "Find the cause",
|
||||||
|
"title_ru": "Дознание причины",
|
||||||
|
"title_zh": "追出原因",
|
||||||
|
"diagram_en": "Cause",
|
||||||
|
"diagram_ru": "Причина",
|
||||||
|
"diagram_zh": "追因"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "pin",
|
||||||
|
"title_en": "Pin it to a mechanism",
|
||||||
|
"title_ru": "Закрепление механизмом",
|
||||||
|
"title_zh": "固定到机制",
|
||||||
|
"diagram_en": "Pin",
|
||||||
|
"diagram_ru": "Закрепление",
|
||||||
|
"diagram_zh": "固定"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "collapse",
|
||||||
|
"title_en": "Collapse into a rule",
|
||||||
|
"title_ru": "Схлопывание в правило",
|
||||||
|
"title_zh": "归并成规则",
|
||||||
|
"diagram_en": "Collapse",
|
||||||
|
"diagram_ru": "Схлопывание",
|
||||||
|
"diagram_zh": "归并"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "gate",
|
||||||
|
"title_en": "The gate holds the work",
|
||||||
|
"title_ru": "Ворота держат работу",
|
||||||
|
"title_zh": "闸门拦住工作",
|
||||||
|
"diagram_en": "Gate",
|
||||||
|
"diagram_ru": "Ворота",
|
||||||
|
"diagram_zh": "闸门"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"doc_frames": {
|
||||||
|
"security": {
|
||||||
|
"published_path": "docs/assets/pantheon/doc-security.png",
|
||||||
|
"published_sha256": "d2a886eafa13fa0a50f50c044c8d19c55609ed65a3777065abffe678bf590785",
|
||||||
|
"alt": "Мраморная плита с прорезанным насквозь прямоугольным проемом стоит между приходящими голубыми путями и стопкой мраморных листов на столе",
|
||||||
|
"pages": {
|
||||||
|
"en": "SECURITY.md",
|
||||||
|
"ru": "SECURITY.ru.md",
|
||||||
|
"zh": "SECURITY.zh.md"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contributing": {
|
||||||
|
"published_path": "docs/assets/pantheon/doc-contributing.png",
|
||||||
|
"published_sha256": "9450ab602f1193b693f29382b2c3206a4d5fbc761859f6a7be790e9078a7051d",
|
||||||
|
"alt": "Золотая шпилька стоит торчком сквозь страницу раскрытого мраморного свода рядом со стопкой тонких мраморных листов на мраморном столе",
|
||||||
|
"pages": {
|
||||||
|
"en": "CONTRIBUTING.md",
|
||||||
|
"ru": "CONTRIBUTING.ru.md",
|
||||||
|
"zh": "CONTRIBUTING.zh.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"doc_pages": [
|
||||||
|
{
|
||||||
|
"path": "docs/ONBOARDING.md",
|
||||||
|
"frames": [
|
||||||
|
"assets/pantheon/doc-onboarding.png"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "docs/ONBOARDING.ru.md",
|
||||||
|
"frames": [
|
||||||
|
"assets/pantheon/doc-onboarding.png"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "docs/ONBOARDING.zh.md",
|
||||||
|
"frames": [
|
||||||
|
"assets/pantheon/doc-onboarding.png"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "docs/HOW-IT-WORKS.md",
|
||||||
|
"frames": [
|
||||||
|
"assets/pantheon/doc-how-it-works.png"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "docs/HOW-IT-WORKS.ru.md",
|
||||||
|
"frames": [
|
||||||
|
"assets/pantheon/doc-how-it-works.png"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "docs/HOW-IT-WORKS.zh.md",
|
||||||
|
"frames": [
|
||||||
|
"assets/pantheon/doc-how-it-works.png"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"receipts": {
|
||||||
|
"generation_path": ".github/pantheon/generation-receipt.json",
|
||||||
|
"visual_judge_path": ".github/pantheon/visual-judge-receipt.json",
|
||||||
|
"prompt_path": ".github/pantheon/hero-source-prompt.txt"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: character reference sheet for a project of the Olympuz family, binding for every later frame
|
||||||
|
Primary request: one wide sheet that fixes the figure of Koios once and for all, so he can be reproduced identically in every later scene of this project.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column. He is a large, finely carved monumental marble figure with real weight, not a small smooth figurine on a pedestal.
|
||||||
|
Subject: Koios, the titan of intellect and questioning whose second name is Polos, the axis the sky turns on, as a white-marble sculpture, shown four times in one row at the same height and the same scale: front view, three-quarter view turned to his left, full profile facing left, and back view. Beside the row, four larger attribute studies: the axis rod alone, the open marble ledger alone, the gold pin alone, and the head alone in three-quarter view.
|
||||||
|
Composition/framing: 16:9 landscape. A classical white-marble column stands at the far right as the family signature, clearly separated from the figures. The four views stand in one straight row across the middle of the frame with equal spacing, each fully inside the frame with clear space above the head and below the base. The four attribute studies sit in a lower band under the row. That band ends well above the bottom edge: the lowest tenth of the image height is empty ivory ground with nothing in it at all. Every study, the head study included, stands complete inside the frame with that empty strip below it. The head study is a bust cut at the chest, and the whole bust including the chest is inside the frame. A study touched or cut by any edge of the frame is the single worst error in this sheet and makes the sheet unusable. Generous empty ivory space, nothing overlapping, nothing cropped.
|
||||||
|
Style/medium: premium restrained 3D marble sculpture render, monumental carving with a real cornice profile and deep drapery, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, long gentle shadows, calm and welcoming, identical lighting on every view. The gold rod and the gold pin glow softly FROM WITHIN, as if lit by their own material; they are never lit by a lamp, a neon tube or a hard rim light, and no surface is left flat and dead.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the axis rod and the pin only, glowing softly along their edges as if lit from within, sky blue #B8D6EA for the incoming paths only, charcoal #3E3A36
|
||||||
|
Constraints, and these are the identity of the figure and must be identical in all four views:
|
||||||
|
- He is a mature bearded man with a short carved beard and hair bound by one plain flat marble fillet across the brow. His head is UNCOVERED: no veil, no hood, no helmet, no crown, no laurel.
|
||||||
|
- His eyes are open, level and attentive. He wears NO blindfold and nothing crosses his eyes.
|
||||||
|
- In every view his head is turned slightly away from his body, the questioning turn: he looks at the ledger in his left hand rather than straight ahead. The same turn, the same angle, in all four views.
|
||||||
|
- A classical chiton to mid-calf with a himation draped over the left shoulder and across the back, carved with deep folds and real thickness. One belt at the waist, at the same height in every view. He is barefoot, both feet flat on the ground.
|
||||||
|
- He HOLDS the axis rod in his right hand: a slender muted-gold rod as tall as his shoulder, its lower end resting on the ground beside his right foot and casting a shadow, his fingers closed around the shaft. One plain smooth marble ring encircles the rod near its top, loose around it like a hoop on a pole. The rod is straight and unadorned: NO snakes, NO wings, NO letters, NO carving, NO sun disc, NO lightning.
|
||||||
|
- He HOLDS the open marble ledger in his left hand: a thick white-marble book lying open on his upturned left palm at waist height, its two flat pages turned slightly toward the viewer. Each page carries exactly THREE carved horizontal grooves and nothing else: no letters, no digits, no emblem.
|
||||||
|
- One muted-gold pin is driven straight THROUGH the right-hand page of the open ledger, entering the face of the page and standing upright out of it, its plain flat head above the page and its point below. It pierces the page; it never rests on top of it and never floats above it.
|
||||||
|
- Three thin sky-blue paths run along the ground from the left edge of the frame and CONVERGE at the lower end of the axis rod. They lie flat on the ground, touch it along their whole length, and end at the rod; they never rise into the air.
|
||||||
|
- He stands on a round marble base whose full underside rests on the ground.
|
||||||
|
- Every view shows the same person wearing the SAME costume: one chiton, one himation over the same shoulder, one belt at the same height, one fillet across the brow. The rod shown alone in the study below is the SAME OBJECT he holds: same length, same single plain ring. The ledger shown alone is the same book with the same three grooves on each page and the same pin driven through it. Nothing changes between views except the angle of the camera.
|
||||||
|
- Anatomically correct hands with exactly five fingers, natural finger lengths and one clearly readable thumb, fingers not fused.
|
||||||
|
- Nothing hovers, nothing balances on a point: everything carried is held by a closed hand or an open palm, everything standing rests on a surface and casts a shadow.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: rainbow of many colors, prismatic colors, veil, hood, helmet, crown, laurel, blindfold, closed eyes, scales, sword, spear, owl, hearth, fire, flame, lightning bolt, sun disc, wings, globe, armillary sphere, telescope, floating rod, floating ledger, floating pin, a pin lying on the page instead of piercing it, a small smooth featureless figurine, a flat gradient block instead of carved marble, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, extra or missing fingers, fused fingers, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits, no measurement marks, no callout labels anywhere in the image.
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: prop reference sheet for a project of the Olympuz family, binding for every later frame
|
||||||
|
Primary request: one wide sheet that fixes the objects of this project once and for all, so each one can be reproduced identically in every later scene.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column.
|
||||||
|
Subject: six objects laid out on a plain ivory surface, each shown alone, each large enough to read: (1) the axis rod, a slender straight muted-gold rod as long as a forearm with one plain smooth marble ring encircling it near the top; (2) the open marble ledger, a thick white-marble book lying open, each of its two pages carrying exactly THREE carved horizontal grooves; (3) the gold pin alone, one straight muted-gold pin with a plain flat round head and a simple point, lying on its side; (4) the stack of journal leaves, eight identical thin white-marble sheets stacked flat and squarely on top of each other, the stack no taller than a hand; (5) the gate plate, a small upright white-marble slab standing on its own foot with one clean rectangular opening cut all the way through it; (6) the marble table, a low rectangular white-marble table with four square legs and a plain thick top, the same table that stands in every later scene of this project.
|
||||||
|
Composition/framing: 16:9 landscape. A classical white-marble column stands at the far right as the family signature, clearly separated from the objects. The six objects sit in two rows of three with equal spacing, each fully inside the frame, nothing overlapping, nothing cropped. Generous empty ivory space between them.
|
||||||
|
Style/medium: premium restrained 3D marble and gold render, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, long gentle shadows, identical lighting on every object. Gold surfaces glow softly FROM WITHIN, never lit by a lamp, a neon tube or a hard rim light.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the axis rod and the pin only, sky blue #B8D6EA used nowhere on this sheet, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- Every object rests on the surface and casts a shadow. Nothing hovers, nothing balances on a point.
|
||||||
|
- The axis rod is straight and unadorned: NO snakes, NO wings, NO letters, NO engraving, NO sun disc. Its ring is a plain smooth hoop that sits loose around the rod.
|
||||||
|
- Each page of the ledger carries exactly THREE grooves and no writing of any kind.
|
||||||
|
- The gate plate opening is a clean rectangle cut through the whole thickness of the slab, so the ivory background is visible through it.
|
||||||
|
- The stack of leaves is square and even: every sheet the same size, edges aligned, none sliding out.
|
||||||
|
- These are the SAME objects that the character sheet shows in his hands: same proportions, same materials, same details.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: rainbow of many colors, prismatic colors, books with paper pages, scrolls, keyboards, microphones, phones, laptops, screens, cables, modern devices, brand marks, hearth, fire, flame, scales, sword, owl, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits, no measurement marks, no callout labels anywhere in the image.
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: canon frame for a published document page of a project of the Olympuz family
|
||||||
|
Primary request: one wide frame that carries the meaning of this page at a glance, in the same light and material as the rest of the project.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column; Image 3 is the project character sheet and Image 4 the project prop sheet - the axis rod, the open marble ledger, the gold pin, the stack of marble leaves, the gate plate and the marble table must match those sheets exactly.
|
||||||
|
Subject: the open marble ledger lies on the low marble table with one muted-gold pin driven straight through its right-hand page and standing upright out of it. Beside the ledger on the same table lies a square stack of thin marble leaves, and the muted-gold axis rod rests along the far edge of the table. No figure is in this frame.
|
||||||
|
Composition/framing: 16:9 landscape. The table with the ledger fills the middle band of the frame, seen slightly from above. A classical white-marble column stands at the far right as the family signature, clearly separated from the objects. Generous empty ivory space, nothing overlapping, nothing cropped.
|
||||||
|
Style/medium: premium restrained 3D marble render, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, long gentle shadows, calm and welcoming. Gold glows softly FROM WITHIN, never lit by a lamp, a neon tube or a hard rim light. No surface is left flat and dead.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the rod, the pin and the thread only, sky blue #B8D6EA for the ground paths only, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- Every object rests on a surface and casts a shadow. Nothing hovers, nothing balances on a point.
|
||||||
|
- Each page of the ledger carries exactly three carved horizontal grooves and no writing.
|
||||||
|
- The gold pin pierces the page and stands upright out of it, never lying on top of it.
|
||||||
|
- The axis rod is straight and unadorned with one plain smooth marble ring near its top.
|
||||||
|
- The blue paths lie flat on the ground along their whole length. They never rise into the air.
|
||||||
|
- There is no human figure in this frame.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: writing of any kind, letters, digits, veil, hood, helmet, crown, blindfold, hearth, fire, flame, scales, sword, owl, wings, lightning bolt, screens, keyboards, cables, modern devices, floating objects, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits, no callout labels anywhere in the image.
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: canon frame for a published document page of a project of the Olympuz family
|
||||||
|
Primary request: one wide frame that carries the meaning of this page at a glance, in the same light and material as the rest of the project.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column; Image 3 is the project character sheet and Image 4 the project prop sheet - the axis rod, the open marble ledger, the gold pin, the stack of marble leaves, the gate plate and the marble table must match those sheets exactly.
|
||||||
|
Subject: four objects stand in one straight row across the low marble table, in this order from left to right: a square stack of thin marble leaves, the open marble ledger with the muted-gold pin driven upright through its right-hand page, one single thicker marble leaf standing alone, and the upright marble gate plate with its rectangular opening cut clean through. One continuous muted-gold thread runs along the table behind them and touches each object in turn from left to right. Three thin sky-blue paths come in along the ground from the left edge and end at the foot of the table. No figure is in this frame.
|
||||||
|
Composition/framing: 16:9 landscape. The row of four objects fills the middle band of the frame, seen slightly from above, with equal gaps between the objects. A classical white-marble column stands at the far right as the family signature, clearly separated from the objects. Generous empty ivory space, nothing overlapping, nothing cropped.
|
||||||
|
Style/medium: premium restrained 3D marble render, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, long gentle shadows, calm and welcoming. Gold glows softly FROM WITHIN, never lit by a lamp, a neon tube or a hard rim light. No surface is left flat and dead.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the rod, the pin and the thread only, sky blue #B8D6EA for the ground paths only, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- Every object rests on a surface and casts a shadow. Nothing hovers, nothing balances on a point.
|
||||||
|
- Each page of the ledger carries exactly three carved horizontal grooves and no writing.
|
||||||
|
- The gold pin pierces the page and stands upright out of it, never lying on top of it.
|
||||||
|
- The axis rod is straight and unadorned with one plain smooth marble ring near its top.
|
||||||
|
- The blue paths lie flat on the ground along their whole length. They never rise into the air.
|
||||||
|
- There is no human figure in this frame.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: writing of any kind, letters, digits, veil, hood, helmet, crown, blindfold, hearth, fire, flame, scales, sword, owl, wings, lightning bolt, screens, keyboards, cables, modern devices, floating objects, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits, no callout labels anywhere in the image.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: canon frame for a published document page of a project of the Olympuz family
|
||||||
|
Primary request: one wide frame that carries the meaning of this page at a glance, in the same light and material as the rest of the project.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column; Image 3 is the project character sheet and Image 4 the project prop sheet - the axis rod, the open marble ledger, the gold pin, the stack of marble leaves, the gate plate and the marble table must match those sheets exactly.
|
||||||
|
Subject: Koios stands behind the low marble table, his head turned down toward the open marble ledger resting on his upturned left palm, the muted-gold axis rod upright in his right hand with its lower end on the ground. One muted-gold pin is driven through the right-hand page of the ledger. Three thin sky-blue paths come in along the ground from the left edge of the frame and converge at the lower end of the rod. The table in front of him is empty and clean.
|
||||||
|
Composition/framing: 16:9 landscape. The figure stands slightly left of centre behind the table, with generous empty ivory space above him. A classical white-marble column stands at the far right as the family signature, clearly separated from the objects. Generous empty ivory space, nothing overlapping, nothing cropped.
|
||||||
|
Style/medium: premium restrained 3D marble render, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, long gentle shadows, calm and welcoming. Gold glows softly FROM WITHIN, never lit by a lamp, a neon tube or a hard rim light. No surface is left flat and dead.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the rod, the pin and the thread only, sky blue #B8D6EA for the ground paths only, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- Every object rests on a surface and casts a shadow. Nothing hovers, nothing balances on a point.
|
||||||
|
- Each page of the ledger carries exactly three carved horizontal grooves and no writing.
|
||||||
|
- The gold pin pierces the page and stands upright out of it, never lying on top of it.
|
||||||
|
- The axis rod is straight and unadorned with one plain smooth marble ring near its top.
|
||||||
|
- The blue paths lie flat on the ground along their whole length. They never rise into the air.
|
||||||
|
- The figure is the same person as the character sheet: bare head with one plain flat marble fillet across the brow, short carved beard, open level eyes, chiton to mid-calf with a himation over the left shoulder, one belt at the waist, barefoot.
|
||||||
|
- Anatomically correct hands with exactly five fingers and one clearly readable thumb, fingers not fused.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: writing of any kind, letters, digits, veil, hood, helmet, crown, blindfold, hearth, fire, flame, scales, sword, owl, wings, lightning bolt, screens, keyboards, cables, modern devices, floating objects, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits, no callout labels anywhere in the image.
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: canon frame for a published document page of a project of the Olympuz family
|
||||||
|
Primary request: one wide frame that carries the meaning of this page at a glance, in the same light and material as the rest of the project.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column; Image 3 is the project character sheet and Image 4 the project prop sheet - the axis rod, the open marble ledger, the gold pin, the stack of marble leaves, the gate plate and the marble table must match those sheets exactly.
|
||||||
|
Subject: the upright marble gate plate with its rectangular opening cut clean through stands in the middle of the frame on the ivory ground. Three thin sky-blue paths come in along the ground from the left edge and end at the foot of the gate plate. Behind the plate, on the low marble table, lies a square stack of thin marble leaves. No figure is in this frame.
|
||||||
|
Composition/framing: 16:9 landscape. The gate plate is the main subject and stands slightly left of centre; the table with the stack sits behind and to the right of it. A classical white-marble column stands at the far right as the family signature, clearly separated from the objects. Generous empty ivory space, nothing overlapping, nothing cropped.
|
||||||
|
Style/medium: premium restrained 3D marble render, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, long gentle shadows, calm and welcoming. Gold glows softly FROM WITHIN, never lit by a lamp, a neon tube or a hard rim light. No surface is left flat and dead.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the rod, the pin and the thread only, sky blue #B8D6EA for the ground paths only, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- Every object rests on a surface and casts a shadow. Nothing hovers, nothing balances on a point.
|
||||||
|
- Each page of the ledger carries exactly three carved horizontal grooves and no writing.
|
||||||
|
- The gold pin pierces the page and stands upright out of it, never lying on top of it.
|
||||||
|
- The axis rod is straight and unadorned with one plain smooth marble ring near its top.
|
||||||
|
- The blue paths lie flat on the ground along their whole length. They never rise into the air.
|
||||||
|
- There is no human figure in this frame.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: writing of any kind, letters, digits, veil, hood, helmet, crown, blindfold, hearth, fire, flame, scales, sword, owl, wings, lightning bolt, screens, keyboards, cables, modern devices, floating objects, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits, no callout labels anywhere in the image.
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: square emblem for a project of the Olympuz family
|
||||||
|
Primary request: one square emblem that reads at a glance and stays readable when shrunk - a lesson held down by the thing that closes it.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column; Image 3 is the project character sheet and Image 4 the project prop sheet - the open marble ledger, the gold pin and the axis rod must match those sheets exactly.
|
||||||
|
Subject: a single composition on a plain ivory ground: the open marble ledger lying flat and slightly tilted toward the viewer with three carved horizontal grooves on each page, one muted-gold pin driven straight through the right-hand page and standing upright out of it, and the muted-gold axis rod resting diagonally across the upper left corner of the ledger with its plain marble ring visible.
|
||||||
|
Composition/framing: perfect square, the composition centred with generous empty ivory margin on all four sides, nothing cropped, no column in this frame.
|
||||||
|
Style/medium: premium restrained 3D marble and gold render, physically plausible materials, warm ivory Apple-like presentation
|
||||||
|
Lighting/mood: soft daylight from upper left, one gentle shadow under each object. Gold glows softly from within, never lit by a lamp or a hard rim light.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the rod and the pin only, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- Only three objects in the frame: ledger, pin, rod. Nothing else.
|
||||||
|
- The ledger rests on the surface and casts a shadow. The rod rests on the ledger and casts a shadow. Nothing hovers.
|
||||||
|
- The pin pierces the page and stands upright out of it; it never lies on top of the page.
|
||||||
|
- The rod is straight and unadorned with one plain smooth ring: no snakes, no wings, no engraving.
|
||||||
|
- Each page carries exactly three grooves and no writing.
|
||||||
|
- The shapes stay large and simple so the emblem survives being shrunk to a small icon.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: rainbow of many colors, prismatic colors, figures, faces, hearth, fire, flame, scales, sword, owl, wings, screens, keyboards, cables, brand marks, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits anywhere in the image.
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
"schema_version": 1,
|
||||||
|
"kind": "pantheon-generation",
|
||||||
|
"selection_mode": "managed-frontier",
|
||||||
|
"runtime": "codex",
|
||||||
|
"tool": "image_gen",
|
||||||
|
"route_id": "codex:image_gen:managed-frontier",
|
||||||
|
"model": {
|
||||||
|
"id": "provider-managed",
|
||||||
|
"revision": "provider-managed",
|
||||||
|
"tier": "frontier"
|
||||||
|
},
|
||||||
|
"quality": "highest",
|
||||||
|
"generation_id": "koiz-pantheon-2026-09-06",
|
||||||
|
"generated_at": "2026-09-06T17:49:40Z",
|
||||||
|
"capability_snapshot": {
|
||||||
|
"checked_at": "2026-09-06T17:49:40Z",
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"id": "codex:image_gen:managed-frontier",
|
||||||
|
"rank": 1,
|
||||||
|
"available": true,
|
||||||
|
"tier": "frontier",
|
||||||
|
"quality": "highest",
|
||||||
|
"model": {
|
||||||
|
"id": "provider-managed",
|
||||||
|
"revision": "provider-managed",
|
||||||
|
"tier": "frontier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"prompt": {
|
||||||
|
"path": ".github/pantheon/hero-source-prompt.txt",
|
||||||
|
"sha256": "95672ffc2b0cca39a78a8d284ec5c8b9ea79a290beacb9b9db244316ac4dcd84"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"role": "style-anchor",
|
||||||
|
"sha256": "ce524f9d22cb0092cb17aa280832e1b2ab2a77a0e01602065ec502232a3bb2d2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "column-reference",
|
||||||
|
"sha256": "9d32edd56ac55c4dd6d0425a28a2ac35035e9ab09073fc8ce0c1414b2edfb1bd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "bible-character",
|
||||||
|
"sha256": "0f6940ad424dbb14ca16bcdfb0c5ee8e4d9dede0cca3c2db9062e9eed6076b58"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "bible-props",
|
||||||
|
"sha256": "baccce7b4bcd1b9b1a92a96ca18248ac98057fafa9f031927382fc7a72b864d7"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"role": "hero",
|
||||||
|
"path": "docs/assets/pantheon/hero.png",
|
||||||
|
"sha256": "50173c9ed752959fa39110f5ba66fe8a723506b1fc6bb05a72e0bdda972d19b1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "emblem",
|
||||||
|
"path": "docs/assets/pantheon/emblem.png",
|
||||||
|
"sha256": "927fa0b130eb3b8eaf7baae5ea4577954e78f0797f39720616674f2af3f635f2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"candidates": [
|
||||||
|
{
|
||||||
|
"id": "codex-managed",
|
||||||
|
"route_id": "codex:image_gen:managed-frontier",
|
||||||
|
"generation_id": "koiz-pantheon-2026-09-06",
|
||||||
|
"quality": "highest",
|
||||||
|
"model": {
|
||||||
|
"id": "provider-managed",
|
||||||
|
"revision": "provider-managed",
|
||||||
|
"tier": "frontier"
|
||||||
|
},
|
||||||
|
"prompt_sha256": "95672ffc2b0cca39a78a8d284ec5c8b9ea79a290beacb9b9db244316ac4dcd84",
|
||||||
|
"reference_sha256": [
|
||||||
|
"ce524f9d22cb0092cb17aa280832e1b2ab2a77a0e01602065ec502232a3bb2d2",
|
||||||
|
"9d32edd56ac55c4dd6d0425a28a2ac35035e9ab09073fc8ce0c1414b2edfb1bd",
|
||||||
|
"0f6940ad424dbb14ca16bcdfb0c5ee8e4d9dede0cca3c2db9062e9eed6076b58",
|
||||||
|
"baccce7b4bcd1b9b1a92a96ca18248ac98057fafa9f031927382fc7a72b864d7"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"role": "hero",
|
||||||
|
"source_sha256": "50173c9ed752959fa39110f5ba66fe8a723506b1fc6bb05a72e0bdda972d19b1",
|
||||||
|
"published_sha256": "50173c9ed752959fa39110f5ba66fe8a723506b1fc6bb05a72e0bdda972d19b1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "emblem",
|
||||||
|
"source_sha256": "927fa0b130eb3b8eaf7baae5ea4577954e78f0797f39720616674f2af3f635f2",
|
||||||
|
"published_sha256": "927fa0b130eb3b8eaf7baae5ea4577954e78f0797f39720616674f2af3f635f2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"winner_id": "codex-managed"
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: wide hero image for a project of the Olympuz family
|
||||||
|
Primary request: one wide frame that says at a glance what this project does - failures from many projects arrive as one flow, and each one is pinned down before it is allowed to leave.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column; Image 3 is the project character sheet and Image 4 the project prop sheet - the axis rod, the open marble ledger, the gold pin, the stack of marble leaves, the gate plate and the marble table must match those sheets exactly.
|
||||||
|
Subject: Koios stands slightly left of centre behind the low marble table, his head turned down toward the open marble ledger resting on his upturned left palm, the muted-gold axis rod upright in his right hand with its lower end on the ground. One muted-gold pin is driven straight through the right-hand page of the ledger. On the table beside him lie a square stack of thin marble leaves and, at the right end of the table, the upright marble gate plate with its rectangular opening cut clean through. Three thin sky-blue paths come in along the ground from the left edge of the frame and converge at the lower end of the axis rod.
|
||||||
|
Composition/framing: 16:9 landscape. The figure and the table occupy the middle band with generous empty ivory space above. A classical white-marble column stands at the far right as the family signature, clearly separated from the figure and behind the gate plate. Nothing is cropped, nothing overlaps a face of the ledger or of the gate plate.
|
||||||
|
Style/medium: premium restrained 3D marble sculpture render, monumental carving with a real cornice profile and deep drapery, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, long gentle shadows, calm and welcoming. The axis rod and the pin glow softly FROM WITHIN, as if lit by their own material, never by a lamp, a neon tube or a hard rim light. No surface is left flat and dead.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the axis rod and the pin only, sky blue #B8D6EA for the ground paths only, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- The figure is the same person as the character sheet: bare head with one plain flat marble fillet across the brow, short carved beard, open level eyes, chiton to mid-calf with a himation over the left shoulder, one belt at the waist, barefoot with both feet flat on the ground.
|
||||||
|
- He wears NO blindfold, NO veil, NO hood, NO helmet, NO crown and NO laurel, and there is no fire, no flame, no hearth, no scales, no sword and no owl anywhere in the frame.
|
||||||
|
- The axis rod is straight and unadorned with one plain smooth marble ring encircling it near the top: no snakes, no wings, no letters, no sun disc.
|
||||||
|
- Each page of the ledger carries exactly three carved horizontal grooves and no writing.
|
||||||
|
- The gold pin pierces the page and stands upright out of it, its plain flat head above the page. It never rests on top of the page and never floats.
|
||||||
|
- The blue paths lie flat on the ground along their whole length and end at the rod. They never rise into the air.
|
||||||
|
- Everything rests on a surface and casts a shadow. Nothing hovers, nothing balances on a point.
|
||||||
|
- Anatomically correct hands with exactly five fingers and one clearly readable thumb, fingers not fused.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: rainbow of many colors, prismatic colors, veil, hood, helmet, crown, laurel, blindfold, closed eyes, hearth, fire, flame, scales, sword, spear, owl, lightning bolt, sun disc, wings, globe, armillary sphere, telescope, screens, keyboards, cables, modern devices, floating objects, a pin lying on the page instead of piercing it, a small smooth featureless figurine, a flat gradient block instead of carved marble, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, extra or missing fingers, fused fingers, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits, no callout labels anywhere in the image.
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"x": 148,
|
||||||
|
"y": 426,
|
||||||
|
"w": 173,
|
||||||
|
"h": 108
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 411,
|
||||||
|
"y": 426,
|
||||||
|
"w": 170,
|
||||||
|
"h": 108
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 675,
|
||||||
|
"y": 426,
|
||||||
|
"w": 168,
|
||||||
|
"h": 108
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 937,
|
||||||
|
"y": 426,
|
||||||
|
"w": 171,
|
||||||
|
"h": 108
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 1190,
|
||||||
|
"y": 426,
|
||||||
|
"w": 174,
|
||||||
|
"h": 108
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
Use case: stylized-concept
|
||||||
|
Asset type: workflow diagram frame for a project of the Olympuz family, rendered in the canon instead of drawn with box characters
|
||||||
|
Primary request: one wide frame that shows the five steps of the work as five empty marble plates in a row, connected in order, so that captions can be carved into the plates afterwards.
|
||||||
|
Input images: Image 1 is the immutable Pantheon style reference; Image 2 is the required family-signature column; Image 3 is the project character sheet and Image 4 the project prop sheet - the marble leaves, the axis rod and the gold pin must match those sheets.
|
||||||
|
Subject: five rectangular white-marble plates of the SAME size stand in one straight horizontal row across the middle of the frame, evenly spaced, each resting on the ivory ground and casting a shadow. Their faces are smooth, empty and slightly tilted toward the viewer. One continuous muted-gold thread enters from the left edge, runs behind the row and touches each plate in turn from left to right, ending at the right edge of the last plate. Below the row, three thin sky-blue paths run flat along the ground from the left and end under the first plate.
|
||||||
|
Composition/framing: 16:9 landscape. The five plates are the main subject and occupy the middle band of the frame. A classical white-marble column stands at the far right as the family signature, clearly separated from the plates. Generous empty ivory space above and below the row. Nothing overlaps a plate face, nothing is cropped.
|
||||||
|
Style/medium: premium restrained 3D marble render, physically plausible materials, warm ivory Apple-like presentation, museum plate feeling
|
||||||
|
Lighting/mood: soft daylight from upper left, one gentle shadow under each plate, identical lighting across the row. Gold glows softly from within.
|
||||||
|
Color palette: ivory #F3EFE8, bright ivory #FBFAF6, white marble, muted gold #C9A87A for the thread only, sky blue #B8D6EA for the ground paths only, charcoal #3E3A36
|
||||||
|
Constraints:
|
||||||
|
- The plate faces are COMPLETELY EMPTY: no carving, no letters, no digits, no ornament, no frame line. Captions are cut into them later by a separate instrument, and any writing generated here would be invented text.
|
||||||
|
- All five plates are the same width and the same height, standing in one straight line at the same depth, with equal gaps.
|
||||||
|
- Every plate rests on the ground and casts a shadow. Nothing hovers.
|
||||||
|
- The gold thread is one continuous piece touching every plate in order, never a chain of separate segments.
|
||||||
|
- Preserve the reference style; highest final quality; maximum resolution.
|
||||||
|
Avoid: writing of any kind, letters, digits, numbers on the plates, arrows drawn as glyphs, boxes drawn with lines, screens, keyboards, cables, figures, faces, hearth, fire, flame, dark background, black background, neon, purple gradient, smoky cinema lighting, heavy bronze, metallic or plastic marble, watermark, callout labels
|
||||||
|
Text (verbatim): No readable text, no letters, no digits anywhere in the image. The plate faces stay empty.
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
{
|
||||||
|
"schema_version": 1,
|
||||||
|
"kind": "pantheon-visual-judge",
|
||||||
|
"receipt_id": "dde8ac19-657e-4862-981d-429f99218995",
|
||||||
|
"checked_at": "2026-09-06T17:49:40Z",
|
||||||
|
"runtime": "claude-code",
|
||||||
|
"tool": "read-image",
|
||||||
|
"route_id": "claude-code:read-image:frontier",
|
||||||
|
"model": {
|
||||||
|
"id": "claude-opus-5",
|
||||||
|
"revision": "claude-opus-5[1m]",
|
||||||
|
"tier": "frontier"
|
||||||
|
},
|
||||||
|
"quality": "highest",
|
||||||
|
"verdict": "pass",
|
||||||
|
"human_reviewed": true,
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"role": "style-anchor",
|
||||||
|
"sha256": "ce524f9d22cb0092cb17aa280832e1b2ab2a77a0e01602065ec502232a3bb2d2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "column-reference",
|
||||||
|
"sha256": "9d32edd56ac55c4dd6d0425a28a2ac35035e9ab09073fc8ce0c1414b2edfb1bd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "bible-character",
|
||||||
|
"sha256": "0f6940ad424dbb14ca16bcdfb0c5ee8e4d9dede0cca3c2db9062e9eed6076b58"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "bible-props",
|
||||||
|
"sha256": "baccce7b4bcd1b9b1a92a96ca18248ac98057fafa9f031927382fc7a72b864d7"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"role": "hero",
|
||||||
|
"path": "docs/assets/pantheon/hero.png",
|
||||||
|
"sha256": "50173c9ed752959fa39110f5ba66fe8a723506b1fc6bb05a72e0bdda972d19b1",
|
||||||
|
"verdict": "pass",
|
||||||
|
"hard_constraints": {
|
||||||
|
"column": true,
|
||||||
|
"ivory-background": true,
|
||||||
|
"white-marble": true,
|
||||||
|
"daylight": true,
|
||||||
|
"blue-gold-accents": true,
|
||||||
|
"no-dark-background": true,
|
||||||
|
"deity-symbol": true,
|
||||||
|
"text-accuracy": true,
|
||||||
|
"anchor-similarity": true,
|
||||||
|
"readme-render": true
|
||||||
|
},
|
||||||
|
"scorecard": {
|
||||||
|
"column": 5,
|
||||||
|
"ivory-background": 5,
|
||||||
|
"white-marble": 5,
|
||||||
|
"daylight": 5,
|
||||||
|
"blue-gold-accents": 5,
|
||||||
|
"no-dark-background": 5,
|
||||||
|
"deity-symbol": 5,
|
||||||
|
"text-accuracy": 5,
|
||||||
|
"anchor-similarity": 5,
|
||||||
|
"readme-render": 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "emblem",
|
||||||
|
"path": "docs/assets/pantheon/emblem.png",
|
||||||
|
"sha256": "927fa0b130eb3b8eaf7baae5ea4577954e78f0797f39720616674f2af3f635f2",
|
||||||
|
"verdict": "pass",
|
||||||
|
"hard_constraints": {
|
||||||
|
"column": true,
|
||||||
|
"ivory-background": true,
|
||||||
|
"white-marble": true,
|
||||||
|
"daylight": true,
|
||||||
|
"blue-gold-accents": true,
|
||||||
|
"no-dark-background": true,
|
||||||
|
"deity-symbol": true,
|
||||||
|
"text-accuracy": true,
|
||||||
|
"anchor-similarity": true,
|
||||||
|
"readme-render": true
|
||||||
|
},
|
||||||
|
"scorecard": {
|
||||||
|
"column": 5,
|
||||||
|
"ivory-background": 5,
|
||||||
|
"white-marble": 5,
|
||||||
|
"daylight": 5,
|
||||||
|
"blue-gold-accents": 5,
|
||||||
|
"no-dark-background": 5,
|
||||||
|
"deity-symbol": 5,
|
||||||
|
"text-accuracy": 5,
|
||||||
|
"anchor-similarity": 5,
|
||||||
|
"readme-render": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
node_modules/
|
||||||
|
graphify-out/
|
||||||
|
.scratch/
|
||||||
|
|
||||||
|
# Логи генерации кадров и наложение рамок - рабочие следы, а не витрина.
|
||||||
|
# Лог несёт абсолютные пути машины и в публичном дереве краснит ворота.
|
||||||
|
docs/assets/pantheon/*.log
|
||||||
|
docs/assets/pantheon/takt-nalozhenie.png
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
# Koiz - правила репозитория
|
||||||
|
|
||||||
|
База уроков роя: один журнал на все проекты, и у каждого урока обязан быть механизм,
|
||||||
|
который делает повтор невозможным. Прибор из трех файлов без зависимостей:
|
||||||
|
[scripts/koiz-lib.mjs](scripts/koiz-lib.mjs) - чистые функции,
|
||||||
|
[scripts/koiz-capture.mjs](scripts/koiz-capture.mjs) - съем с транскрипта,
|
||||||
|
[scripts/koiz.mjs](scripts/koiz.mjs) - хранение, выдача, схлопывание, ворота, CLI.
|
||||||
|
|
||||||
|
## Доктрина (нарушение = откат правки, не спор)
|
||||||
|
|
||||||
|
1. **Урок без механизма - жалоба.** Центральное поле записи - «чем закреплено»:
|
||||||
|
`hook` · `deny` · `прибор` · `тест` · `ничем`. Поле со значением `ничем`, повторившееся
|
||||||
|
дважды, становится долгом и красит ворота. Уговорить ворота нельзя, можно только
|
||||||
|
закрепить или признать правило нерабочим и закрыть его датой.
|
||||||
|
2. **Журнал ADD-only.** Ничего не перезаписывается и не стирается. Состояние базы - это
|
||||||
|
проигрывание журнала с начала. Устаревший урок закрывается датой и остается в истории:
|
||||||
|
он не ложь, он просто больше не действует.
|
||||||
|
3. **Схлопывание - отдельный проход, а не побочный эффект записи.** Слияние на записи
|
||||||
|
дорого и теряет данные. `collapse` вызывают осознанно, и он объясняет каждое слияние.
|
||||||
|
4. **Машина берет то, что видно с диска.** Коды возврата, упавшие команды, отказы ворот,
|
||||||
|
число попыток. Агент дописывает единственное, чего машина не знает: почему так вышло.
|
||||||
|
Обратный порядок - агент угадывает факты - запрещен.
|
||||||
|
5. **Работа сторожа - не провал.** Сработавший блокер, отказ хука, короткая улика в базу
|
||||||
|
не идут. Иначе долг закрывал бы ночь на ровном месте, и ворота перестали бы значить
|
||||||
|
хоть что-то.
|
||||||
|
6. **Секрет в базу не попадает.** Фильтр стоит на записи, а не на выдаче: то, что не
|
||||||
|
записано, невозможно случайно показать.
|
||||||
|
|
||||||
|
## Инварианты (живут в селфтесте, не в прозе)
|
||||||
|
|
||||||
|
| # | Инвариант | Где проверяется |
|
||||||
|
|---|---|---|
|
||||||
|
| I1 | Запись только добавляет строку; состояние восстанавливается проигрыванием журнала | `--selftest`, ADD-only |
|
||||||
|
| I2 | Повтор урока ловится отпечатком и увеличивает счетчик, а не плодит запись | `--selftest`, повтор как hit |
|
||||||
|
| I3 | Урок, снятый в одном проекте, находится запросом из другого | `--selftest`, кросс-проектность |
|
||||||
|
| I4 | Закрытый датой урок не выдается, но лежит в истории | `--selftest`, двувременность |
|
||||||
|
| I5 | Переполнение бюджета схлопывает базу без потери записей журнала | `--selftest`, бюджет |
|
||||||
|
| I6 | Незакрепленный повтор дает долг, и ворота выходят ненулевым кодом | `--selftest`, долг и ворота |
|
||||||
|
| I7 | Секрет не доходит до журнала: фильтр стоит на записи | `--selftest`, фильтр секретов |
|
||||||
|
| I8 | Повторный съем того же транскрипта не удваивает записи | `--selftest`, идемпотентный съем |
|
||||||
|
|
||||||
|
**Селфтест судит логику, а не наличие функций.** Это доказано мутационными воротами:
|
||||||
|
[scripts/koiz-mutate.mjs](scripts/koiz-mutate.mjs) ломает 19 правил по одному, и каждая
|
||||||
|
поломка обязана уронить селфтест. Пережившая мутация означает, что проверка ничего не
|
||||||
|
проверяла. Первым прогоном так поймали настоящую беду: прибор молча выходил нулем по
|
||||||
|
симлинк-пути.
|
||||||
|
|
||||||
|
## Проверка перед любой правкой
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs --selftest # логика прибора
|
||||||
|
node scripts/koiz-mutate.mjs # 19 мутаций, все обязаны быть пойманы
|
||||||
|
bash scripts/koiz-acceptance.sh # приемка целиком, десять пунктов
|
||||||
|
```
|
||||||
|
|
||||||
|
Красная приемка - правка не готова. Зеленая приемка при неизмененном селфтесте после
|
||||||
|
новой логики - повод дописать мутацию, а не радоваться.
|
||||||
|
|
||||||
|
## Стиль
|
||||||
|
|
||||||
|
- Зависимостей нет и не будет: три файла на голом Node, запуск без установки.
|
||||||
|
- Комментарий объясняет причину, а не пересказывает строку. Замер в комментарии - с числом.
|
||||||
|
- Функции короткие, вложенность мелкая, ранний возврат вместо лестницы условий.
|
||||||
|
- Русский в текстах и комментариях, английский в именах API и командах CLI.
|
||||||
|
- Новая ветка логики приходит вместе со своей мутацией в `koiz-mutate.mjs`.
|
||||||
|
|
||||||
|
## Онбординг в чате
|
||||||
|
|
||||||
|
Свежий клон объясняет себя сам: [docs/ONBOARDING-CHAT.ru.md](docs/ONBOARDING-CHAT.ru.md)
|
||||||
|
(英 [docs/ONBOARDING-CHAT.md](docs/ONBOARDING-CHAT.md), 中
|
||||||
|
[docs/ONBOARDING-CHAT.zh.md](docs/ONBOARDING-CHAT.zh.md)). Открыли этот репозиторий впервые -
|
||||||
|
идите туда и ведите человека по шагам, а не ставьте что-либо молча.
|
||||||
|
|
||||||
|
## Публикация
|
||||||
|
|
||||||
|
Публичное дерево собирается срезом по [.github/public-release.json](.github/public-release.json),
|
||||||
|
а не пушем этого репозитория. Правила выпуска держит гейт семьи, и он же решает, готова
|
||||||
|
страница или нет. До зеленого гейта публикации не бывает.
|
||||||
|
|
||||||
|
- Абсолютных путей, личных данных и имен приватных домов в отслеживаемых файлах нет.
|
||||||
|
- База уроков живет вне репозитория (`~/.claude/koiz/lessons.jsonl`): уроки несут пути
|
||||||
|
и имена чужих проектов.
|
||||||
|
- Сессии агентов уезжают в отдельный приватный репозиторий чекпойнтов, а не сюда.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Agent Instructions
|
||||||
|
|
||||||
|
Правила этого репозитория лежат в [AGENTS.md](AGENTS.md). Читай его первым, исполняй буквально, сюда ничего не дублируй.
|
||||||
|
|
||||||
|
## Онбординг в чате
|
||||||
|
|
||||||
|
Свежий клон объясняет себя сам: [docs/ONBOARDING-CHAT.ru.md](docs/ONBOARDING-CHAT.ru.md)
|
||||||
|
(英 [docs/ONBOARDING-CHAT.md](docs/ONBOARDING-CHAT.md), 中
|
||||||
|
[docs/ONBOARDING-CHAT.zh.md](docs/ONBOARDING-CHAT.zh.md)). Открыли этот репозиторий впервые -
|
||||||
|
идите туда и ведите человека по шагам, а не ставьте что-либо молча.
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/doc-contributing.png" alt="A gold pin standing upright through the page of an open marble ledger beside a stack of thin marble leaves on a marble table" width="100%"></p>
|
||||||
|
|
||||||
|
Thank you for looking. This project is small on purpose: three files on bare Node, no dependencies, no build step. That is the constraint every change has to respect.
|
||||||
|
|
||||||
|
## The path
|
||||||
|
|
||||||
|
Fork the repository, create a branch, commit your change, push the branch, then open a Pull Request. Do not push directly to `main`; the release gate rejects it.
|
||||||
|
|
||||||
|
## Before you open the Pull Request
|
||||||
|
|
||||||
|
Run all three checks. They are fast and they are the whole review contract:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs --selftest # the logic of the instrument
|
||||||
|
node scripts/koiz-mutate.mjs # 19 broken rules, every one must be caught
|
||||||
|
bash scripts/koiz-acceptance.sh # the full acceptance, ten points
|
||||||
|
```
|
||||||
|
|
||||||
|
A red acceptance means the change is not ready. A green acceptance with an unchanged self-test after new logic means the self-test does not cover that logic yet, and the right answer is to add a mutation, not to celebrate.
|
||||||
|
|
||||||
|
## New logic arrives with its mutation
|
||||||
|
|
||||||
|
`scripts/koiz-mutate.mjs` breaks one rule at a time and demands that the self-test notice. If you add a branch, add the mutation that breaks it. A rule nobody can break on purpose is a rule nobody is checking.
|
||||||
|
|
||||||
|
## Style
|
||||||
|
|
||||||
|
Comments explain the reason, not the line. A measurement in a comment carries its number. Functions stay short, nesting stays shallow, early returns instead of a ladder of conditions. Russian in prose and comments, English in CLI commands and API names.
|
||||||
|
|
||||||
|
## What will be refused
|
||||||
|
|
||||||
|
A dependency. A build step. A rewrite of the journal format that breaks reading old records. A change that makes the instrument talk to the network. These are not style opinions: each one removes a property the project exists for.
|
||||||
|
|
||||||
|
## The carving font
|
||||||
|
|
||||||
|
The workflow diagram captions are cut by `podpisi_takta.py` using Cormorant (SIL Open Font License). The font is not committed here; install it from https://fonts.google.com/specimen/Cormorant into `~/Library/Fonts` if you need to regenerate the diagram.
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# Как помочь проекту
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/doc-contributing.png" alt="Золотая шпилька стоит торчком сквозь страницу раскрытого мраморного свода рядом со стопкой тонких мраморных листов на мраморном столе" width="100%"></p>
|
||||||
|
|
||||||
|
Спасибо, что заглянули. Проект намеренно маленький: три файла на голом Node, без зависимостей и без сборки. Это ограничение, которое обязана уважать любая правка.
|
||||||
|
|
||||||
|
## Путь
|
||||||
|
|
||||||
|
Сделайте fork, заведите ветку, оформите commit, отправьте push и откройте Pull Request. Прямой push в `main` отклонит релизный gate.
|
||||||
|
|
||||||
|
## Перед тем как открыть Pull Request
|
||||||
|
|
||||||
|
Прогоните все три проверки. Они быстрые, и они и есть весь контракт ревью:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs --selftest # логика прибора
|
||||||
|
node scripts/koiz-mutate.mjs # 19 сломанных правил, каждое обязано быть поймано
|
||||||
|
bash scripts/koiz-acceptance.sh # приемка целиком, десять пунктов
|
||||||
|
```
|
||||||
|
|
||||||
|
Красная приемка означает, что правка не готова. Зеленая приемка при неизмененном селфтесте после новой логики означает, что селфтест эту логику не покрывает, и правильный ответ такой: дописать мутацию, а не порадоваться.
|
||||||
|
|
||||||
|
## Новая логика приходит со своей мутацией
|
||||||
|
|
||||||
|
`scripts/koiz-mutate.mjs` ломает по одному правилу и требует, чтобы селфтест это заметил. Добавили ветку, добавьте мутацию, которая ее ломает. Правило, которое нельзя сломать нарочно, никто не проверяет.
|
||||||
|
|
||||||
|
## Стиль
|
||||||
|
|
||||||
|
Комментарий объясняет причину, а не пересказывает строку. Замер в комментарии идет со своим числом. Функции короткие, вложенность мелкая, ранний возврат вместо лестницы условий. Русский в прозе и комментариях, английский в командах CLI и именах API.
|
||||||
|
|
||||||
|
## Что будет отклонено
|
||||||
|
|
||||||
|
Зависимость. Шаг сборки. Переделка формата журнала, которая ломает чтение старых записей. Правка, после которой прибор ходит в сеть. Это не вкусовщина: каждая такая правка убирает свойство, ради которого проект существует.
|
||||||
|
|
||||||
|
## Шрифт резьбы
|
||||||
|
|
||||||
|
Подписи на схеме такта режет `podpisi_takta.py` шрифтом Cormorant (лицензия SIL Open Font License). Шрифт сюда не кладется; если нужно пересобрать схему, поставьте его с https://fonts.google.com/specimen/Cormorant в `~/Library/Fonts`.
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# 参与贡献
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/doc-contributing.png" alt="一根金色别针竖着穿过摊开的大理石册页,旁边是大理石桌上一摞薄薄的大理石片" width="100%"></p>
|
||||||
|
|
||||||
|
谢谢你来看。这个项目是故意做小的:裸 Node 上的三个文件,没有依赖,没有构建步骤。任何改动都要尊重这个约束。
|
||||||
|
|
||||||
|
## 流程
|
||||||
|
|
||||||
|
先 fork 仓库,建一个分支 branch,提交 commit,推送 push,然后开一个 Pull Request。请不要直接向 `main` 推送,发布闸门会拒绝。
|
||||||
|
|
||||||
|
## 开 Pull Request 之前
|
||||||
|
|
||||||
|
把三个检查都跑一遍。它们很快,而且就是全部的评审契约:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs --selftest # 仪器的逻辑
|
||||||
|
node scripts/koiz-mutate.mjs # 19 条被打断的规则,每一条都必须被抓到
|
||||||
|
bash scripts/koiz-acceptance.sh # 完整验收,十项
|
||||||
|
```
|
||||||
|
|
||||||
|
验收变红,说明改动还没做完。加了新逻辑而自检没有变化、验收却是绿的,说明自检还没覆盖这段逻辑,正确的做法是补一条变异,而不是高兴。
|
||||||
|
|
||||||
|
## 新逻辑要带上自己的变异
|
||||||
|
|
||||||
|
`scripts/koiz-mutate.mjs` 每次打断一条规则,并要求自检发现它。你加了一个分支,就补上打断它的那条变异。没人能故意打断的规则,也就没人在检查。
|
||||||
|
|
||||||
|
## 风格
|
||||||
|
|
||||||
|
注释解释原因,不复述代码。注释里的测量要带上数字。函数短,嵌套浅,用提前返回代替一层层的条件。散文和注释用俄语,CLI 命令和 API 名字用英文。
|
||||||
|
|
||||||
|
## 会被拒绝的改动
|
||||||
|
|
||||||
|
加依赖。加构建步骤。改日志格式导致读不了旧记录。让仪器去访问网络。这些不是风格之争:每一条都拿掉了这个项目赖以存在的一个性质。
|
||||||
|
|
||||||
|
## 刻字用的字体
|
||||||
|
|
||||||
|
工作流程图上的字由 `podpisi_takta.py` 用 Cormorant 字体(SIL 开放字体许可证)刻上去。字体没有放进仓库;如果你要重新生成这张图,请从 https://fonts.google.com/specimen/Cormorant 装到 `~/Library/Fonts`。
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Agent Instructions
|
||||||
|
|
||||||
|
Правила этого репозитория лежат в [AGENTS.md](AGENTS.md). Читай его первым, исполняй буквально, сюда ничего не дублируй.
|
||||||
|
|
||||||
|
## Онбординг в чате
|
||||||
|
|
||||||
|
Свежий клон объясняет себя сам: [docs/ONBOARDING-CHAT.ru.md](docs/ONBOARDING-CHAT.ru.md)
|
||||||
|
(英 [docs/ONBOARDING-CHAT.md](docs/ONBOARDING-CHAT.md), 中
|
||||||
|
[docs/ONBOARDING-CHAT.zh.md](docs/ONBOARDING-CHAT.zh.md)). Открыли этот репозиторий впервые -
|
||||||
|
идите туда и ведите человека по шагам, а не ставьте что-либо молча.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Filipp Zarubin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
# Koiz
|
||||||
|
|
||||||
|
Koiz keeps one lesson base for every project, and the work stops while the cause of a failure has no mechanism closing it.
|
||||||
|
|
||||||
|
[Русский](README.ru.md) · [中文](README.zh.md)
|
||||||
|
|
||||||
|
[](LICENSE) [](https://github.com/zarubinvibe/koiz/stargazers) [](https://github.com/zarubinvibe/koiz) [](https://github.com/zarubinvibe/athena#olympuz-family)
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/hero.png" alt="White marble Koios beside a classical column, the axis rod upright in his right hand and a gold pin driven through the open marble ledger on his palm, blue paths converging at his feet in daylight" width="100%"></p>
|
||||||
|
|
||||||
|
<!-- owner-welcome:start -->
|
||||||
|
|
||||||
|
> Hi. I am Fil.
|
||||||
|
>
|
||||||
|
> I built Koiz after stepping on the same rake in a third project in a row. The lesson had been written down. It sat in another repository, in another log, and nobody read it in time.
|
||||||
|
>
|
||||||
|
> Try it. If it breaks, write in Issues, I read them. If it helps, leave a star and show it to somebody who runs several projects at once. The rest of the Olympuz projects live here: https://zarubinvibe.com
|
||||||
|
>
|
||||||
|
> — Filipp Zarubin
|
||||||
|
|
||||||
|
<!-- owner-welcome:end -->
|
||||||
|
|
||||||
|
## Contents
|
||||||
|
|
||||||
|
- [What This Is](#what-this-is)
|
||||||
|
- [Why It Helps](#why-it-helps)
|
||||||
|
- [The Main Advantage](#the-main-advantage)
|
||||||
|
- [How It Works](#how-it-works)
|
||||||
|
- [Quickstart](#quickstart)
|
||||||
|
- [Simple Comparison](#simple-comparison)
|
||||||
|
- [Simple Words](#simple-words)
|
||||||
|
- [Safety And Privacy](#safety-and-privacy)
|
||||||
|
- [Limits](#limits)
|
||||||
|
- [Star And Contribute](#star-and-contribute)
|
||||||
|
|
||||||
|
<!-- beginner-readme:start -->
|
||||||
|
|
||||||
|
## What This Is
|
||||||
|
|
||||||
|
Koiz is a shared lesson base for all of your projects. One journal, one search key, one discipline.
|
||||||
|
|
||||||
|
A lesson arrives as a breakdown, not as a retelling: what broke, how to reproduce it, why it happened, and what closes it. That last field carries the weight. While it says "nothing", the lesson is unfinished.
|
||||||
|
|
||||||
|
## Why It Helps
|
||||||
|
|
||||||
|
A mistake is rarely new. It already happened, in another project, six months ago, and the conclusion was written down then. The note sits in that project's log while your hands are in a different repository today, and nobody remembers the note exists.
|
||||||
|
|
||||||
|
Then it gets worse. Lessons pile up, duplicates never merge, stale ones are never marked. In a year that is a wall of text nobody reads, which means it is not there at all.
|
||||||
|
|
||||||
|
## The Main Advantage
|
||||||
|
|
||||||
|
**Main advantage:** a lesson is closed by a mechanism, not by good intentions.
|
||||||
|
|
||||||
|
**Why this is better:** A rule written in prose gets read, agreed with, and quietly ignored. A mechanism gives no advice: a hook, a deny rule, an instrument or a test simply refuses to let the thing happen twice. Koiz demands the name of that mechanism when the lesson is written, and turns the gate red when an unpinned lesson shows up a second time.
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
The work runs in stages. The machine takes what the disk can prove, the agent adds only meaning, and pinning is checked apart from writing.
|
||||||
|
|
||||||
|
<!-- workflow-diagram:start -->
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/takt-en.png" alt="Five marble plates in a row, each carved with one stage of the work, linked by a gold thread that comes in from the left edge" width="100%"></p>
|
||||||
|
|
||||||
|
<!-- workflow-diagram:end -->
|
||||||
|
|
||||||
|
| Stage | What happens |
|
||||||
|
|---|---|
|
||||||
|
| 1. Capture | The machine lifts the failure off the disk when the session closes, with nothing typed by hand. |
|
||||||
|
| 2. Cause | The agent adds the one thing the machine cannot know: why it happened. |
|
||||||
|
| 3. Pin | The lesson is tied to a mechanism that makes the repeat impossible. |
|
||||||
|
| 4. Collapse | Similar lessons merge into one rule in a pass of their own. |
|
||||||
|
| 5. Gate | An unpinned repeat stops the work instead of staying a note. |
|
||||||
|
|
||||||
|
### Step 1: Capture the failure
|
||||||
|
|
||||||
|
A `SessionEnd` hook hands the instrument the transcript of the session that just closed. The instrument takes only what the disk can prove: failed commands, exit codes, refused gates, the number of attempts.
|
||||||
|
|
||||||
|
The watchdog doing its job is not a failure. A blocker that fired, and any piece of evidence shorter than three meaningful words, never reach the base. Otherwise the debt would turn the gate red over nothing.
|
||||||
|
|
||||||
|
**You get:** draft lessons collected without a single line typed by hand.
|
||||||
|
|
||||||
|
### Step 2: Find the cause
|
||||||
|
|
||||||
|
A captured draft has an empty "why". Until the cause is found, the lesson is unfinished and does not go out as ready.
|
||||||
|
|
||||||
|
The order matters and does not work in reverse. The machine takes the facts, a person or an agent adds the meaning. An agent that guesses facts writes convincing untruth.
|
||||||
|
|
||||||
|
**You get:** a lesson with a cause instead of a description of the symptom.
|
||||||
|
|
||||||
|
### Step 3: Pin it to a mechanism
|
||||||
|
|
||||||
|
The pin field takes five values: `hook`, `deny`, an instrument, a test, and "nothing". Home-made values are refused, and a pin without a reference to a file or a command is not accepted at all.
|
||||||
|
|
||||||
|
"Nothing" is a legal value and an honest admission. It says the mechanism does not exist yet, and it is exactly what later raises the lesson as a debt.
|
||||||
|
|
||||||
|
**You get:** a record where you can see what closes the repeat.
|
||||||
|
|
||||||
|
### Step 4: Collapse into a rule
|
||||||
|
|
||||||
|
Merging on write is expensive and loses data, so it moved into a separate command. `collapse` finds three similar lessons, proposes a shared rule, and shows exactly what it merges.
|
||||||
|
|
||||||
|
A stale lesson is never erased. It is closed by date and stays in history. It is not a lie, it simply stopped applying.
|
||||||
|
|
||||||
|
**You get:** one rule instead of three records, and a base that does not grow forever.
|
||||||
|
|
||||||
|
### Step 5: The gate holds the work
|
||||||
|
|
||||||
|
The `gate` command exits non-zero when a lesson came back and is still pinned to "nothing". In the owner's house that command stands in the nightly run, and it has already stopped it.
|
||||||
|
|
||||||
|
There are two ways out and both are honest: close it with a mechanism, or admit the rule does not work and close it by date. A deferral needs a date and a reason.
|
||||||
|
|
||||||
|
**You get:** a repeat nobody can walk past in silence.
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
You need Git, Node 20 or newer, and any one of three ways in: Claude Code, Codex CLI, or a plain terminal.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/zarubinvibe/koiz.git
|
||||||
|
cd koiz
|
||||||
|
bash install.sh
|
||||||
|
|
||||||
|
# без git, одним архивом:
|
||||||
|
curl -L https://github.com/zarubinvibe/koiz/archive/refs/heads/main.zip -o koiz.zip
|
||||||
|
|
||||||
|
# дальше открывайте, чем привычнее:
|
||||||
|
claude # Claude Code: скажите /koiz-setup, установка пройдет разговором
|
||||||
|
codex # Codex CLI: правила проекта уже лежат в AGENTS.md
|
||||||
|
code . # VS Code: агент открывается внутри редактора
|
||||||
|
```
|
||||||
|
|
||||||
|
The three lines above are the whole install. `bash install.sh` creates the base and puts capture on session close, asking before every step. It needs no agent: a terminal is enough.
|
||||||
|
|
||||||
|
**Claude Code.** Run `claude` in this folder and say `/koiz-setup`. The install goes as a conversation, one question at a time.
|
||||||
|
|
||||||
|
**Codex CLI.** Run `codex` in the same place. The project rules already sit in `AGENTS.md`.
|
||||||
|
|
||||||
|
**No agent at all.** `node scripts/koiz.mjs ask "what has broken before"` shows what the base knows about your question and installs nothing.
|
||||||
|
|
||||||
|
Never done this before? [The onboarding](docs/ONBOARDING.md) walks the whole first run step by step and says what you see after every command.
|
||||||
|
|
||||||
|
**You get:** the base exists, capture runs on session close, and `node scripts/koiz.mjs debt` shows which lesson came back with nothing holding it.
|
||||||
|
|
||||||
|
## Simple Comparison
|
||||||
|
|
||||||
|
| Choice | What it is | Where lessons live | Reaches other projects | Demands a mechanism | Stops the work | Price |
|
||||||
|
|---|---|---|---|---|---|---|
|
||||||
|
| **Koiz** | A lesson base with mandatory pinning | One journal on your own disk | Yes, the key is the error class, not the repository name | Yes, the pin field is required | Yes, an unpinned repeat turns the gate red | Own tool, free |
|
||||||
|
| Writing it up by hand | A note after a bad session | Wherever you wrote it | No | No | No | Your hours, every time |
|
||||||
|
| `CLAUDE.md` and `AGENTS.md` | A rule as prose in the repository | In the project where it was written | No, the file lives in one tree | No | No | Free |
|
||||||
|
| Cursor Rules | Editor rules handed to the agent | In the project settings | No | No | No | Part of the subscription |
|
||||||
|
| mem0 | Agent memory for facts and preferences | Its own store or the cloud | Yes, if the projects share one memory | No | No | Open source, cloud is paid |
|
||||||
|
| Letta | An agent with memory and a bounded context block | Its own database | Partly | No | No | Open source |
|
||||||
|
| Zep and Graphiti | A memory graph where facts carry validity intervals | Its own service | Yes | No | No | Open source, cloud is paid |
|
||||||
|
|
||||||
|
Names belong to their owners. The table describes purpose, not a benchmark: other products change, and this page does not speak for them.
|
||||||
|
|
||||||
|
## Simple Words
|
||||||
|
|
||||||
|
| Word | Simple meaning |
|
||||||
|
|---|---|
|
||||||
|
| Repository | The project folder that Git stores and versions |
|
||||||
|
| Terminal | The window where you type commands |
|
||||||
|
| Command | One instruction you give the computer |
|
||||||
|
| Branch | A separate line of changes that does not touch `main` |
|
||||||
|
| Pull Request | A request to review your change and accept it |
|
||||||
|
| Lesson | One failure taken apart: the cause and the mechanism that closes the repeat |
|
||||||
|
| Pin | The named mechanism, a hook, a deny rule, an instrument or a test, that makes the repeat impossible |
|
||||||
|
| Collapse | A separate pass that merges similar lessons into one rule |
|
||||||
|
|
||||||
|
## Safety And Privacy
|
||||||
|
|
||||||
|
- Every lesson stays on your disk, in one file. Nothing leaves the machine: the instrument has no network and no dependencies.
|
||||||
|
- The secret filter sits on the write, not on the read. Tokens, keys and private keys are cut before the line reaches the journal.
|
||||||
|
- The base lives outside the project repository. Lessons carry paths and names from other people's work, and a public tree is the wrong place for them.
|
||||||
|
- The journal only appends. A wrong record is closed by date and stays in history together with the reason it was closed.
|
||||||
|
- The instrument runs from source with nothing installed: three files on bare Node.
|
||||||
|
- Capture reads the session transcript on your own machine and copies it nowhere.
|
||||||
|
|
||||||
|
What actually lands in the base and where to report a hole: [SECURITY.md](SECURITY.md).
|
||||||
|
|
||||||
|
## Limits
|
||||||
|
|
||||||
|
Status: in use every day. The owner's base holds more than eighty active lessons, and the gate stands in the nightly run, where it has already stopped the night on an unpinned repeat.
|
||||||
|
|
||||||
|
- A repeat is caught by the fingerprint of machine capture. Two lessons written as prose about the same thing in different words will not be merged.
|
||||||
|
- The cause is written by a person or an agent. The machine takes only what the disk shows: an exit code, a failed command, a refused gate.
|
||||||
|
- Collapse proposes a rule and leaves the decision to you: the merge runs as a separate pass and shows exactly what it merges.
|
||||||
|
- Capture is proven on Claude Code transcripts. Other agent CLIs write their journals differently and need their own reader.
|
||||||
|
- Windows is not tested yet.
|
||||||
|
|
||||||
|
Deeper: [the onboarding](docs/ONBOARDING.md) walks the first run step by step, and [how it works](docs/HOW-IT-WORKS.md) takes every stage apart.
|
||||||
|
|
||||||
|
## Star And Contribute
|
||||||
|
|
||||||
|
Useful? Give Koiz a star: [https://github.com/zarubinvibe/koiz](https://github.com/zarubinvibe/koiz). It takes a second and it decides whether other people ever find the project.
|
||||||
|
|
||||||
|
Want to change something? The path is short: fork the repository, create a branch, commit your change, push the branch, then open a Pull Request. Do not push directly to `main`; the release gate rejects it.
|
||||||
|
|
||||||
|
Found a problem instead? Open an issue at [https://github.com/zarubinvibe/koiz/issues](https://github.com/zarubinvibe/koiz/issues) and say what you ran and what happened.
|
||||||
|
|
||||||
|
<!-- beginner-readme:end -->
|
||||||
|
|
||||||
|
<!-- pantheon-family:start -->
|
||||||
|
## Olympuz family
|
||||||
|
|
||||||
|
This is one of the public [Olympuz projects](https://github.com/zarubinvibe/athena#olympuz-family). Each row opens the repository or downloads its source as a ZIP.
|
||||||
|
|
||||||
|
| Type | Name | What it does | Source |
|
||||||
|
|---|---|---|---|
|
||||||
|
| project | Athena | Portable agent OS that restores a complete Claude and Codex setup on a new Mac. | [Repository](https://github.com/zarubinvibe/athena) · [ZIP](https://github.com/zarubinvibe/athena/archive/refs/heads/main.zip) |
|
||||||
|
| project | Helioz | 24/7 agent work conveyor with verified completion markers and goal-based overnight decisions. | [Repository](https://github.com/zarubinvibe/helioz) · [ZIP](https://github.com/zarubinvibe/helioz/archive/refs/heads/main.zip) |
|
||||||
|
| project | Mnemazine | Local-first memory system that turns raw inputs into verified reusable knowledge. | [Repository](https://github.com/zarubinvibe/mnemazine) · [ZIP](https://github.com/zarubinvibe/mnemazine/archive/refs/heads/main.zip) |
|
||||||
|
| project | Themiz | Multi-agent assistant for Russian litigation with local OCR and review by a five-jurist council. | [Repository](https://github.com/zarubinvibe/themiz) · [ZIP](https://github.com/zarubinvibe/themiz/archive/refs/heads/main.zip) |
|
||||||
|
| project | Zeuz | Factory that turns an idea into a governed multi-agent workflow with gates, observability, and replay. | [Repository](https://github.com/zarubinvibe/zeuz) · [ZIP](https://github.com/zarubinvibe/zeuz/archive/refs/heads/main.zip) |
|
||||||
|
| project | Lynceuz | Collects public web evidence at zero cost and stops with an honest reason when the safe routes end. | [Repository](https://github.com/zarubinvibe/lynceuz) · [ZIP](https://github.com/zarubinvibe/lynceuz/archive/refs/heads/main.zip) |
|
||||||
|
| project | Iriz | macOS menu-bar dictation that decodes speech on your own Mac, fixes wrong keyboard layouts, and turns dictation into a ready task for an agent. | [Repository](https://github.com/zarubinvibe/iriz) · [ZIP](https://github.com/zarubinvibe/iriz/archive/refs/heads/main.zip) |
|
||||||
|
<!-- pantheon-family:end -->
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The project is available under the [MIT License](LICENSE).
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
# Койз
|
||||||
|
|
||||||
|
Койз держит одну базу уроков на все проекты, и работа стоит, пока причина провала не закрыта механизмом.
|
||||||
|
|
||||||
|
[English](README.md) · [中文](README.zh.md)
|
||||||
|
|
||||||
|
[](LICENSE) [](https://github.com/zarubinvibe/koiz/stargazers) [](https://github.com/zarubinvibe/koiz) [](https://github.com/zarubinvibe/athena#olympuz-family)
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/hero.png" alt="Койз из белого мрамора у классической колонны: стержень оси в правой руке, золотая шпилька продета сквозь раскрытый мраморный свод на ладони, голубые пути сходятся к его ногам при дневном свете" width="100%"></p>
|
||||||
|
|
||||||
|
<!-- owner-welcome:start -->
|
||||||
|
|
||||||
|
> Привет. Я Фил.
|
||||||
|
>
|
||||||
|
> Койз я собрал после того, как третий проект подряд наступил на те же грабли. Урок был записан. Он лежал в другом репозитории, в другом логе, и вовремя его никто не прочитал.
|
||||||
|
>
|
||||||
|
> Попробуйте. Сломается, пишите в Issues: я читаю. Пригодилось, поставьте звезду и покажите тому, кто ведет несколько проектов сразу. Остальные проекты Олимпуса здесь: https://zarubinvibe.ru
|
||||||
|
>
|
||||||
|
> — Филипп Зарубин
|
||||||
|
|
||||||
|
<!-- owner-welcome:end -->
|
||||||
|
|
||||||
|
## Оглавление
|
||||||
|
|
||||||
|
- [Что это](#что-это)
|
||||||
|
- [Зачем это нужно](#зачем-это-нужно)
|
||||||
|
- [Главное преимущество](#главное-преимущество)
|
||||||
|
- [Как это работает](#как-это-работает)
|
||||||
|
- [Быстрый старт](#быстрый-старт)
|
||||||
|
- [Простое сравнение](#простое-сравнение)
|
||||||
|
- [Простые слова](#простые-слова)
|
||||||
|
- [Безопасность и приватность](#безопасность-и-приватность)
|
||||||
|
- [Ограничения](#ограничения)
|
||||||
|
- [Звезда и вклад](#звезда-и-вклад)
|
||||||
|
|
||||||
|
<!-- beginner-readme:start -->
|
||||||
|
|
||||||
|
## Что это
|
||||||
|
|
||||||
|
Койз держит общую базу уроков для всех ваших проектов. Один журнал, один ключ поиска, одна дисциплина.
|
||||||
|
|
||||||
|
Урок сюда попадает разбором, а не пересказом: что сломалось, чем воспроизводится, почему так вышло и чем закрыто. Последнее поле главное. Пока в нем стоит «ничем», урок не закончен.
|
||||||
|
|
||||||
|
## Зачем это нужно
|
||||||
|
|
||||||
|
Ошибка редко бывает новой. Она уже случалась в другом проекте полгода назад, и вывод тогда записали. Запись лежит в логе того проекта, а руки сегодня работают в другом, и о существовании записи никто не помнит.
|
||||||
|
|
||||||
|
Дальше хуже. Уроки копятся, дубли не схлопываются, устаревшее не помечается. Через год это стена текста, которую не читают, а значит ее нет.
|
||||||
|
|
||||||
|
## Главное преимущество
|
||||||
|
|
||||||
|
**Главное преимущество:** урок закрыт механизмом, а не намерением.
|
||||||
|
|
||||||
|
**Почему это лучше:** Правило прозой читают, соглашаются и все равно делают иначе. Механизм ничего не советует: хук, запрет, прибор или тест просто не дают случиться этому второй раз. Койз требует назвать механизм при записи и красит ворота, когда незакрепленный урок пришел снова.
|
||||||
|
|
||||||
|
## Как это работает
|
||||||
|
|
||||||
|
Работа идет стадиями. Машина берет то, что видно с диска, агент дописывает только смысл, а закрепление проверяется отдельно от записи.
|
||||||
|
|
||||||
|
<!-- workflow-diagram:start -->
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/takt-ru.png" alt="Пять мраморных плит в ряд, на каждой высечена одна стадия работы, их связывает золотая нить, приходящая от левой кромки" width="100%"></p>
|
||||||
|
|
||||||
|
<!-- workflow-diagram:end -->
|
||||||
|
|
||||||
|
| Этап | Что происходит |
|
||||||
|
|---|---|
|
||||||
|
| 1. Съем | Машина снимает провал с диска на закрытии сессии, без ручного набора. |
|
||||||
|
| 2. Причина | Агент дописывает единственное, чего машина знать не может: почему так вышло. |
|
||||||
|
| 3. Закрепление | Урок привязывается к механизму, который делает повтор невозможным. |
|
||||||
|
| 4. Схлопывание | Похожие уроки сливаются в одно правило отдельным проходом. |
|
||||||
|
| 5. Ворота | Незакрепленный повтор останавливает работу, а не остается заметкой. |
|
||||||
|
|
||||||
|
### Шаг 1: Съем провала
|
||||||
|
|
||||||
|
Хук `SessionEnd` отдает прибору транскрипт закрывшейся сессии. Прибор берет оттуда только то, что видно с диска: упавшие команды, коды возврата, отказы ворот, число попыток.
|
||||||
|
|
||||||
|
Работа сторожа провалом не считается. Сработавший блокер и улика короче трех значимых слов в базу не идут: иначе долг красил бы ворота на ровном месте.
|
||||||
|
|
||||||
|
**Что получится:** черновики уроков, собранные без единой строки, набранной руками.
|
||||||
|
|
||||||
|
### Шаг 2: Дознание причины
|
||||||
|
|
||||||
|
У снятого черновика поле «почему» пустое. Пока причина не дознана, урок не закончен и готовым в выдачу не идет.
|
||||||
|
|
||||||
|
Порядок важен и в обратную сторону не работает. Факты берет машина, смысл дописывает человек или агент. Агент, который угадывает факты, пишет убедительную неправду.
|
||||||
|
|
||||||
|
**Что получится:** урок с причиной вместо описания симптома.
|
||||||
|
|
||||||
|
### Шаг 3: Закрепление механизмом
|
||||||
|
|
||||||
|
Поле закрепления принимает пять значений: `hook`, `deny`, прибор, тест и «ничем». Самодельные значения прибор отвергает, а закрепление без ссылки на файл или команду не принимает вовсе.
|
||||||
|
|
||||||
|
«Ничем» тоже законное значение и честное признание. Оно говорит, что механизма пока нет, и именно оно потом поднимает урок долгом.
|
||||||
|
|
||||||
|
**Что получится:** запись, у которой видно, чем закрыт повтор.
|
||||||
|
|
||||||
|
### Шаг 4: Схлопывание в правило
|
||||||
|
|
||||||
|
Слияние на записи стоит дорого и теряет данные, поэтому оно вынесено в отдельную команду. `collapse` находит три похожих урока, предлагает общее правило и показывает, что именно сливает.
|
||||||
|
|
||||||
|
Устаревший урок не стирается. Он закрывается датой и остается в истории. Он не ложь, он просто перестал действовать.
|
||||||
|
|
||||||
|
**Что получится:** одно правило вместо трех записей и база, которая не растет бесконечно.
|
||||||
|
|
||||||
|
### Шаг 5: Ворота держат работу
|
||||||
|
|
||||||
|
Команда `gate` выходит ненулевым кодом, когда урок вернулся и до сих пор закреплен «ничем». В доме владельца эта команда стоит в ночном прогоне и уже останавливала его.
|
||||||
|
|
||||||
|
Выхода два, и оба честные: закрыть механизмом или признать правило нерабочим и закрыть его датой. Отсрочка требует даты и причины.
|
||||||
|
|
||||||
|
**Что получится:** повтор, мимо которого нельзя пройти молча.
|
||||||
|
|
||||||
|
## Быстрый старт
|
||||||
|
|
||||||
|
Нужен Git, Node 20 или новее и любой из трех входов: Claude Code, Codex CLI или обычный терминал.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/zarubinvibe/koiz.git
|
||||||
|
cd koiz
|
||||||
|
bash install.sh
|
||||||
|
|
||||||
|
# без git, одним архивом:
|
||||||
|
curl -L https://github.com/zarubinvibe/koiz/archive/refs/heads/main.zip -o koiz.zip
|
||||||
|
|
||||||
|
# дальше открывайте, чем привычнее:
|
||||||
|
claude # Claude Code: скажите /koiz-setup, установка пройдет разговором
|
||||||
|
codex # Codex CLI: правила проекта уже лежат в AGENTS.md
|
||||||
|
code . # VS Code: агент открывается внутри редактора
|
||||||
|
```
|
||||||
|
|
||||||
|
Три строки выше и есть вся установка. `bash install.sh` заводит базу и ставит съем на закрытие сессии, спрашивая разрешение перед каждым шагом. Агент ему не нужен: хватает терминала.
|
||||||
|
|
||||||
|
**Claude Code.** Запустите `claude` в этой папке и скажите `/koiz-setup`. Установка пройдет разговором, по одному вопросу.
|
||||||
|
|
||||||
|
**Codex CLI.** Запустите `codex` там же. Правила проекта уже лежат в `AGENTS.md`.
|
||||||
|
|
||||||
|
**Совсем без агента.** `node scripts/koiz.mjs ask "что уже ломалось"` покажет, что база знает по вашему запросу, и ничего не поставит.
|
||||||
|
|
||||||
|
Делаете это впервые? [Онбординг](docs/ONBOARDING.ru.md) проводит весь первый запуск по шагам и говорит, что видно после каждой команды.
|
||||||
|
|
||||||
|
**Что получится:** база заведена, съем стоит на закрытии сессии, а `node scripts/koiz.mjs debt` показывает, какой урок вернулся и до сих пор ничем не закреплен.
|
||||||
|
|
||||||
|
## Простое сравнение
|
||||||
|
|
||||||
|
| Вариант | Что это | Где живут уроки | Действует на другие проекты | Требует механизм | Останавливает работу | Цена |
|
||||||
|
|---|---|---|---|---|---|---|
|
||||||
|
| **Койз** | База уроков с обязательным закреплением | Один журнал на вашем диске | Да, ключом служит класс ошибки, а не имя репозитория | Да, поле закрепления обязательно | Да, незакрепленный повтор красит ворота | Свой инструмент, бесплатно |
|
||||||
|
| Разбор руками в блокноте | Заметка после неудачной сессии | Там, где записали | Нет | Нет | Нет | Ваши часы на каждый разбор |
|
||||||
|
| `CLAUDE.md` и `AGENTS.md` | Правило прозой в репозитории | В том проекте, где написано | Нет, файл живет в одном дереве | Нет | Нет | Бесплатно |
|
||||||
|
| Cursor Rules | Правила редактора, которые получает агент | В настройках проекта | Нет | Нет | Нет | Входит в подписку |
|
||||||
|
| mem0 | Память агента: факты и предпочтения | В своем хранилище или в облаке | Да, если проекты ходят в одну память | Нет | Нет | Открытый код, облако платное |
|
||||||
|
| Letta | Агент с памятью и ограниченным блоком контекста | В своей базе | Частично | Нет | Нет | Открытый код |
|
||||||
|
| Zep и Graphiti | Граф памяти, где у факта есть интервал действия | В своем сервисе | Да | Нет | Нет | Открытый код, облако платное |
|
||||||
|
|
||||||
|
Названия принадлежат их владельцам. Таблица описывает назначение, а не замер: чужие продукты меняются, и эта страница за них не отвечает.
|
||||||
|
|
||||||
|
## Простые слова
|
||||||
|
|
||||||
|
| Слово | Простое значение |
|
||||||
|
|---|---|
|
||||||
|
| Repository | Папка проекта, которую хранит и версионирует Git |
|
||||||
|
| Terminal | Окно, куда вы вводите команды |
|
||||||
|
| Command | Одна инструкция компьютеру |
|
||||||
|
| Branch | Отдельная линия изменений, которая не трогает `main` |
|
||||||
|
| Pull Request | Просьба проверить ваше изменение и принять его |
|
||||||
|
| Lesson | Урок: разобранный провал с причиной и механизмом, который закрывает повтор |
|
||||||
|
| Pin | Закрепление: названный механизм (хук, запрет, прибор или тест), который делает повтор невозможным |
|
||||||
|
| Collapse | Схлопывание: отдельный проход, который сливает похожие уроки в одно правило |
|
||||||
|
|
||||||
|
## Безопасность и приватность
|
||||||
|
|
||||||
|
- Уроки лежат на вашем диске, в одном файле. Наружу не уходит ничего: у прибора нет ни сети, ни зависимостей.
|
||||||
|
- Фильтр секретов стоит на записи, а не на выдаче. Токен, ключ и приватный ключ режутся до того, как строка попадет в журнал.
|
||||||
|
- База живет вне репозитория проекта: уроки несут пути и имена чужих работ, и в публичном дереве им не место.
|
||||||
|
- Журнал только дописывается. Ошибочную запись закрывают датой, и она остается в истории вместе с причиной закрытия.
|
||||||
|
- Прибор запускается из исходников без установки пакетов: три файла на голом Node.
|
||||||
|
- Съем читает транскрипт сессии на вашей машине и никуда его не копирует.
|
||||||
|
|
||||||
|
Что именно попадает в базу и куда писать о найденной дыре: [SECURITY.ru.md](SECURITY.ru.md).
|
||||||
|
|
||||||
|
## Ограничения
|
||||||
|
|
||||||
|
Статус: в ежедневной работе. База владельца держит больше восьмидесяти активных уроков, а ворота стоят в ночном прогоне и уже останавливали его на незакрепленном повторе.
|
||||||
|
|
||||||
|
- Повтор ловится отпечатком машинного съема. Два урока, написанные прозой про одно и то же разными словами, прибор в дубль не сведет.
|
||||||
|
- Причину дописывает человек или агент. Машина берет только то, что видно с диска: код возврата, упавшую команду, отказ ворот.
|
||||||
|
- Схлопывание предлагает правило, а решение оставляет вам: слияние идет отдельным проходом и показывает, что именно сливает.
|
||||||
|
- Съем проверен на транскриптах Claude Code. Другие агентские CLI пишут журнал иначе, и для них нужен свой разбор.
|
||||||
|
- Windows пока не проверен.
|
||||||
|
|
||||||
|
Глубже: [онбординг](docs/ONBOARDING.ru.md) с первым запуском по шагам и [как это работает](docs/HOW-IT-WORKS.ru.md) с разбором каждой стадии.
|
||||||
|
|
||||||
|
## Звезда и вклад
|
||||||
|
|
||||||
|
Пригодилось? Поставьте Койз звезду: [https://github.com/zarubinvibe/koiz](https://github.com/zarubinvibe/koiz). Это секунда, а от нее зависит, найдут ли проект другие люди.
|
||||||
|
|
||||||
|
Хотите что-то поправить? Путь короткий: сделайте fork, заведите ветку, оформите commit, отправьте push и откройте Pull Request. Не отправляйте push прямо в `main`: релизный gate его отклонит.
|
||||||
|
|
||||||
|
Нашли ошибку? Заведите issue на [https://github.com/zarubinvibe/koiz/issues](https://github.com/zarubinvibe/koiz/issues) и напишите, что запускали и что получилось.
|
||||||
|
|
||||||
|
<!-- beginner-readme:end -->
|
||||||
|
|
||||||
|
<!-- pantheon-family:start -->
|
||||||
|
## Семья Olympuz
|
||||||
|
|
||||||
|
Это один из публичных [проектов семьи Olympuz](https://github.com/zarubinvibe/athena#olympuz-family). Из таблицы можно открыть репозиторий или сразу скачать исходники в ZIP.
|
||||||
|
|
||||||
|
| Тип | Название | Что внутри | Скачать |
|
||||||
|
|---|---|---|---|
|
||||||
|
| проект | Athena | Переносимая агентная ОС: разворачивает рабочую среду Claude и Codex на новом Mac. | [Репозиторий](https://github.com/zarubinvibe/athena) · [ZIP](https://github.com/zarubinvibe/athena/archive/refs/heads/main.zip) |
|
||||||
|
| проект | Helioz | Конвейер работы агентов 24/7 с проверяемыми отметками готовности и ночными решениями по цели владельца. | [Репозиторий](https://github.com/zarubinvibe/helioz) · [ZIP](https://github.com/zarubinvibe/helioz/archive/refs/heads/main.zip) |
|
||||||
|
| проект | Mnemazine | Локальная система памяти: превращает сырье в проверенные знания для повторного использования. | [Репозиторий](https://github.com/zarubinvibe/mnemazine) · [ZIP](https://github.com/zarubinvibe/mnemazine/archive/refs/heads/main.zip) |
|
||||||
|
| проект | Themiz | Многоагентный помощник по российским судебным делам с локальным OCR и советом из пяти юристов. | [Репозиторий](https://github.com/zarubinvibe/themiz) · [ZIP](https://github.com/zarubinvibe/themiz/archive/refs/heads/main.zip) |
|
||||||
|
| проект | Zeuz | Фабрика многоагентных workflow: собирает систему с правилами, гейтами, наблюдаемостью и replay. | [Репозиторий](https://github.com/zarubinvibe/zeuz) · [ZIP](https://github.com/zarubinvibe/zeuz/archive/refs/heads/main.zip) |
|
||||||
|
| проект | Lynceuz | Собирает доказательства из открытого веба за ноль рублей и честно останавливается, когда безопасные пути кончились. | [Репозиторий](https://github.com/zarubinvibe/lynceuz) · [ZIP](https://github.com/zarubinvibe/lynceuz/archive/refs/heads/main.zip) |
|
||||||
|
| проект | Iriz | Диктовка в строке меню macOS: речь разбирается на вашем Маке, раскладка чинится сама, надиктовка превращается в готовое задание для агента. | [Репозиторий](https://github.com/zarubinvibe/iriz) · [ZIP](https://github.com/zarubinvibe/iriz/archive/refs/heads/main.zip) |
|
||||||
|
<!-- pantheon-family:end -->
|
||||||
|
|
||||||
|
## Лицензия
|
||||||
|
|
||||||
|
Проект доступен по [лицензии MIT](LICENSE).
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
# Koiz
|
||||||
|
|
||||||
|
Koiz 用一份教训库管住所有项目:失败的原因没有被机制关掉,工作就停在那里。
|
||||||
|
|
||||||
|
[English](README.md) · [Русский](README.ru.md)
|
||||||
|
|
||||||
|
[](LICENSE) [](https://github.com/zarubinvibe/koiz/stargazers) [](https://github.com/zarubinvibe/koiz) [](https://github.com/zarubinvibe/athena#olympuz-family)
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/hero.png" alt="白色大理石的科俄斯站在古典石柱旁,右手竖握轴杖,掌上摊开的大理石册页被一根金色别针穿透,蓝色路径在日光下汇到他脚边" width="100%"></p>
|
||||||
|
|
||||||
|
<!-- owner-welcome:start -->
|
||||||
|
|
||||||
|
> 你好,我是 Fil。
|
||||||
|
>
|
||||||
|
> 我做 Koiz,是因为同一个坑连着第三个项目又踩了一次。教训其实写过,它躺在另一个仓库、另一份日志里,没人在需要的时候读到。
|
||||||
|
>
|
||||||
|
> 试试看。坏了就到 Issues 里写,我会读。有用就点个星标,再拿给同时管好几个项目的人看看。Olympuz 的其他项目在这里:https://zarubinvibe.com
|
||||||
|
>
|
||||||
|
> — Filipp Zarubin
|
||||||
|
|
||||||
|
<!-- owner-welcome:end -->
|
||||||
|
|
||||||
|
## 目录
|
||||||
|
|
||||||
|
- [这是什么](#这是什么)
|
||||||
|
- [它解决什么问题](#它解决什么问题)
|
||||||
|
- [最大的优势](#最大的优势)
|
||||||
|
- [工作流程](#工作流程)
|
||||||
|
- [快速开始](#快速开始)
|
||||||
|
- [简单对比](#简单对比)
|
||||||
|
- [简单词汇](#简单词汇)
|
||||||
|
- [安全与隐私](#安全与隐私)
|
||||||
|
- [局限](#局限)
|
||||||
|
- [点亮星标与参与](#点亮星标与参与)
|
||||||
|
|
||||||
|
<!-- beginner-readme:start -->
|
||||||
|
|
||||||
|
## 这是什么
|
||||||
|
|
||||||
|
Koiz 是你所有项目共用的一份教训库。一份日志,一个检索口,一套纪律。
|
||||||
|
|
||||||
|
教训进来的方式是拆解,不是复述:什么坏了,怎么复现,为什么会这样,被什么关掉了。最后一栏最重要。它写着「没有」,这条教训就还没做完。
|
||||||
|
|
||||||
|
## 它解决什么问题
|
||||||
|
|
||||||
|
错误很少是新的。它半年前在另一个项目里已经发生过,当时也写了结论。那条记录留在那个项目的日志里,而今天你的手在另一个仓库上,没人记得它存在。
|
||||||
|
|
||||||
|
再往后更麻烦。教训越堆越多,重复的不合并,过期的不标注。一年之后就是一堵没人读的文字墙,等于没有。
|
||||||
|
|
||||||
|
## 最大的优势
|
||||||
|
|
||||||
|
**最大的优势:** 教训靠机制关掉,不靠决心。
|
||||||
|
|
||||||
|
**为什么这样更好:** 写成文字的规则会被读完、被认同,然后照旧不执行。机制不提建议:钩子、禁止规则、仪器或测试,直接不让这件事发生第二次。Koiz 在写入时就要求说出这个机制,没有机制的教训再来一次,闸门就变红。
|
||||||
|
|
||||||
|
## 工作流程
|
||||||
|
|
||||||
|
工作分阶段走。机器只取磁盘能证明的东西,智能体只补上意义,固定这一步和写入分开检查。
|
||||||
|
|
||||||
|
<!-- workflow-diagram:start -->
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/takt-zh.png" alt="五块大理石板排成一行,每块刻着一个阶段,一条从左边进来的金色丝线把它们串起来" width="100%"></p>
|
||||||
|
|
||||||
|
<!-- workflow-diagram:end -->
|
||||||
|
|
||||||
|
| 阶段 | 会发生什么 |
|
||||||
|
|---|---|
|
||||||
|
| 1. 采集 | 会话结束时,机器直接从磁盘上把失败取下来,一个字都不用手打。 |
|
||||||
|
| 2. 追因 | 智能体补上机器不可能知道的那一项:为什么会这样。 |
|
||||||
|
| 3. 固定 | 教训被绑到一个让重复不可能发生的机制上。 |
|
||||||
|
| 4. 归并 | 相似的教训在单独一趟里合成一条规则。 |
|
||||||
|
| 5. 闸门 | 没有固定的重复会拦住工作,而不是变成一条笔记。 |
|
||||||
|
|
||||||
|
### 第 1 步:采集失败
|
||||||
|
|
||||||
|
`SessionEnd` 钩子把刚结束的会话记录交给仪器。仪器只取磁盘能证明的东西:失败的命令、退出码、被拒的闸门、重试了几次。
|
||||||
|
|
||||||
|
守卫正常工作 不算失败。已经拦住的阻断,以及短于三个实义词的证据,都不会进库。否则欠账会无缘无故把闸门染红。
|
||||||
|
|
||||||
|
**你会得到:** 一批草稿教训,全程没有手打一行。
|
||||||
|
|
||||||
|
### 第 2 步:追出原因
|
||||||
|
|
||||||
|
采集来的草稿里,「为什么」是空的。原因没查出来,这条教训就没做完,也不会作为成品被检索到。
|
||||||
|
|
||||||
|
顺序很重要,反过来不成立。事实由机器取,意义由人或智能体补。让智能体去猜事实,写出来的是很像样的假话。
|
||||||
|
|
||||||
|
**你会得到:** 一条带原因的教训,而不是一句症状描述。
|
||||||
|
|
||||||
|
### 第 3 步:固定到机制
|
||||||
|
|
||||||
|
固定这一栏只收五个值:`hook`、`deny`、仪器、测试,以及「没有」。自造的值会被拒绝,没有指向具体文件或命令的固定也不收。
|
||||||
|
|
||||||
|
「没有」是合法值,也是诚实的承认。它说明机制还不存在,而正是它,之后会把这条教训抬成一笔欠账。
|
||||||
|
|
||||||
|
**你会得到:** 一条能看清楚是什么在拦住重复的记录。
|
||||||
|
|
||||||
|
### 第 4 步:归并成规则
|
||||||
|
|
||||||
|
写入时顺手合并既贵又会丢数据,所以它被拆成了一条单独的命令。`collapse` 找出三条相似的教训,提出一条共同规则,并把合了什么摊开给你看。
|
||||||
|
|
||||||
|
过期的教训不会被删掉。它按日期关闭,留在历史里。它不是假话,只是不再生效了。
|
||||||
|
|
||||||
|
**你会得到:** 三条记录变成一条规则,库也不会无止境地长下去。
|
||||||
|
|
||||||
|
### 第 5 步:闸门拦住工作
|
||||||
|
|
||||||
|
`gate` 命令在教训回来、而固定栏还写着「没有」时,以非零码退出。在作者那边,这条命令挂在夜间流程上,已经真的把夜里的活儿拦下来过。
|
||||||
|
|
||||||
|
出路有两条,都很诚实:用机制关掉它,或者承认这条规则不成立,按日期关掉。要延期就得写上日期和理由。
|
||||||
|
|
||||||
|
**你会得到:** 一次没法默默绕过去的重复。
|
||||||
|
|
||||||
|
## 快速开始
|
||||||
|
|
||||||
|
需要 Git、Node 20 或更新的版本,以及三种入口里的任意一种:Claude Code、Codex CLI,或者一个普通终端。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/zarubinvibe/koiz.git
|
||||||
|
cd koiz
|
||||||
|
bash install.sh
|
||||||
|
|
||||||
|
# без git, одним архивом:
|
||||||
|
curl -L https://github.com/zarubinvibe/koiz/archive/refs/heads/main.zip -o koiz.zip
|
||||||
|
|
||||||
|
# дальше открывайте, чем привычнее:
|
||||||
|
claude # Claude Code: скажите /koiz-setup, установка пройдет разговором
|
||||||
|
codex # Codex CLI: правила проекта уже лежат в AGENTS.md
|
||||||
|
code . # VS Code: агент открывается внутри редактора
|
||||||
|
```
|
||||||
|
|
||||||
|
上面三行就是全部安装。`bash install.sh` 会建好教训库,并把采集挂到会话结束上,每一步之前都先问你。它不需要任何智能体,一个终端就够。
|
||||||
|
|
||||||
|
**Claude Code。** 在这个目录里运行 `claude`,然后说 `/koiz-setup`。安装会以对话方式进行,一次问一个问题。
|
||||||
|
|
||||||
|
**Codex CLI。** 在同一个目录运行 `codex`。项目规则已经写在 `AGENTS.md` 里。
|
||||||
|
|
||||||
|
**完全不用智能体。** `node scripts/koiz.mjs ask "什么地方坏过"` 会把库里和你问题相关的内容列出来,不安装任何东西。
|
||||||
|
|
||||||
|
第一次做这件事?[上手引导](docs/ONBOARDING.zh.md) 会一步一步带你走完第一次运行,并写清楚每条命令之后你会看到什么。
|
||||||
|
|
||||||
|
**你会得到:** 教训库建好了,采集挂在会话结束上,`node scripts/koiz.mjs debt` 会告诉你哪条教训又回来了、而且到现在还没有任何机制拦着它。
|
||||||
|
|
||||||
|
## 简单对比
|
||||||
|
|
||||||
|
| 方案 | 这是什么 | 教训存在哪里 | 能否作用于别的项目 | 是否要求机制 | 会不会拦住工作 | 价格 |
|
||||||
|
|---|---|---|---|---|---|---|
|
||||||
|
| **Koiz** | 带强制固定的教训库 | 你自己磁盘上的一份日志 | 能,检索键是错误类别,不是仓库名 | 要,固定这一栏必须填 | 会,没固定的重复会让闸门变红 | 自己的工具,免费 |
|
||||||
|
| 手写复盘 | 一次糟糕会话之后的笔记 | 写在哪儿就在哪儿 | 不能 | 不要 | 不会 | 每次复盘花掉你的时间 |
|
||||||
|
| `CLAUDE.md` 和 `AGENTS.md` | 写在仓库里的文字规则 | 写在哪个项目就在哪个项目 | 不能,文件只活在一棵树里 | 不要 | 不会 | 免费 |
|
||||||
|
| Cursor Rules | 交给智能体的编辑器规则 | 项目设置里 | 不能 | 不要 | 不会 | 包含在订阅里 |
|
||||||
|
| mem0 | 智能体记忆:事实和偏好 | 自己的存储或云端 | 能,前提是项目共用一份记忆 | 不要 | 不会 | 开源,云端收费 |
|
||||||
|
| Letta | 带记忆和有限上下文块的智能体 | 自己的数据库 | 部分能 | 不要 | 不会 | 开源 |
|
||||||
|
| Zep 和 Graphiti | 记忆图谱,事实带有生效区间 | 自己的服务 | 能 | 不要 | 不会 | 开源,云端收费 |
|
||||||
|
|
||||||
|
名称归各自所有者。这张表描述的是用途,不是实测:别人的产品会变,这个页面不替它们做承诺。
|
||||||
|
|
||||||
|
## 简单词汇
|
||||||
|
|
||||||
|
| 词 | 简单解释 |
|
||||||
|
|---|---|
|
||||||
|
| Repository | 仓库:Git 保存并记录版本的项目文件夹 |
|
||||||
|
| Terminal | 终端:你输入命令的窗口 |
|
||||||
|
| Command | 命令:给电脑的一条指令 |
|
||||||
|
| Branch | 分支:不影响 `main` 的另一条修改线 |
|
||||||
|
| Pull Request | 合并请求:请别人审阅并接受你的修改 |
|
||||||
|
| Lesson | 教训:一次失败的完整拆解,包含原因和关掉重复的机制 |
|
||||||
|
| Pin | 固定:说得出名字的机制,钩子、禁止规则、仪器或测试,让重复不可能发生 |
|
||||||
|
| Collapse | 归并:单独跑一遍,把相似的教训合成一条规则 |
|
||||||
|
|
||||||
|
## 安全与隐私
|
||||||
|
|
||||||
|
- 所有教训都在你自己的磁盘上,只有一个文件。什么都不会外发:这个仪器没有网络,也没有依赖。
|
||||||
|
- 密钥过滤放在写入这一侧,不是读取这一侧。令牌、密钥和私钥在进入日志之前就被切掉。
|
||||||
|
- 教训库放在项目仓库之外:教训里带着路径和别人项目的名字,公开的代码树不是它该待的地方。
|
||||||
|
- 日志只追加。写错的记录用日期关掉,它连同关闭原因一起留在历史里。
|
||||||
|
- 仪器直接从源码运行,不用装任何包:裸 Node 上的三个文件。
|
||||||
|
- 采集在你自己的机器上读会话记录,不会把它复制到任何地方。
|
||||||
|
|
||||||
|
到底什么会进到库里、发现漏洞往哪里写,都在 [SECURITY.zh.md](SECURITY.zh.md) 里。
|
||||||
|
|
||||||
|
## 局限
|
||||||
|
|
||||||
|
状态:每天都在用。作者的库里有八十多条生效教训,闸门装在夜间流程上,已经因为一次没固定的重复把夜里的活儿拦下来过。
|
||||||
|
|
||||||
|
- 重复是靠机器采集的指纹认出来的。同一件事用不同措辞写成两条散文教训,仪器不会把它们并成一条。
|
||||||
|
- 原因由人或智能体补写。机器只取磁盘能看到的:退出码、失败的命令、被拒的闸门。
|
||||||
|
- 归并只提出规则,决定权留给你:合并单独跑一遍,并且会把合了什么摊开给你看。
|
||||||
|
- 采集在 Claude Code 的会话记录上验证过。别的智能体命令行日志格式不同,需要各自的读取方式。
|
||||||
|
- Windows 还没有验证。
|
||||||
|
|
||||||
|
更深入:[上手引导](docs/ONBOARDING.zh.md) 一步一步带你走完第一次运行,[工作原理](docs/HOW-IT-WORKS.zh.md) 把每个阶段都拆开讲。
|
||||||
|
|
||||||
|
## 点亮星标与参与
|
||||||
|
|
||||||
|
觉得有用?给 Koiz 点亮星标:[https://github.com/zarubinvibe/koiz](https://github.com/zarubinvibe/koiz)。这只要一秒,却决定别人能不能找到这个项目。
|
||||||
|
|
||||||
|
想改点什么?流程很短:先 fork 仓库,建一个分支 branch,提交 commit,推送 push,然后开一个 Pull Request。请不要直接向 `main` 推送,发布闸门会拒绝。
|
||||||
|
|
||||||
|
发现问题?到 [https://github.com/zarubinvibe/koiz/issues](https://github.com/zarubinvibe/koiz/issues) 开一个 issue,写清楚你运行了什么、发生了什么。
|
||||||
|
|
||||||
|
<!-- beginner-readme:end -->
|
||||||
|
|
||||||
|
<!-- pantheon-family:start -->
|
||||||
|
## Olympuz 家族
|
||||||
|
|
||||||
|
这是 [Olympuz 家族](https://github.com/zarubinvibe/athena#olympuz-family) 的公开项目之一。表格里的每一行都可以打开仓库,或者直接下载源码压缩包。
|
||||||
|
|
||||||
|
| 类型 | 名称 | 做什么 | 获取 |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 项目 | Athena | 可携带的智能体操作系统:在新的 Mac 上重建 Claude 与 Codex 的工作环境。 | [仓库](https://github.com/zarubinvibe/athena) · [ZIP](https://github.com/zarubinvibe/athena/archive/refs/heads/main.zip) |
|
||||||
|
| 项目 | Helioz | 全天候的智能体工作传送带,带可验证的完成标记和按目标做出的夜间决策。 | [仓库](https://github.com/zarubinvibe/helioz) · [ZIP](https://github.com/zarubinvibe/helioz/archive/refs/heads/main.zip) |
|
||||||
|
| 项目 | Mnemazine | 本地优先的记忆系统:把原始材料变成可复用的、已核验的知识。 | [仓库](https://github.com/zarubinvibe/mnemazine) · [ZIP](https://github.com/zarubinvibe/mnemazine/archive/refs/heads/main.zip) |
|
||||||
|
| 项目 | Themiz | 面向俄罗斯诉讼的多智能体助手,本地识别扫描件,五位法学家组成合议审阅。 | [仓库](https://github.com/zarubinvibe/themiz) · [ZIP](https://github.com/zarubinvibe/themiz/archive/refs/heads/main.zip) |
|
||||||
|
| 项目 | Zeuz | 工作流工厂:把一个想法变成带规则、闸门、可观测性和回放的多智能体系统。 | [仓库](https://github.com/zarubinvibe/zeuz) · [ZIP](https://github.com/zarubinvibe/zeuz/archive/refs/heads/main.zip) |
|
||||||
|
| 项目 | Lynceuz | 以零成本收集公开网页证据;安全路径走完时,它会给出诚实的理由并停下。 | [仓库](https://github.com/zarubinvibe/lynceuz) · [ZIP](https://github.com/zarubinvibe/lynceuz/archive/refs/heads/main.zip) |
|
||||||
|
| 项目 | Iriz | macOS 菜单栏听写:语音在你自己的 Mac 上解码,键盘布局自动纠正,口述可以直接变成给智能体的任务。 | [仓库](https://github.com/zarubinvibe/iriz) · [ZIP](https://github.com/zarubinvibe/iriz/archive/refs/heads/main.zip) |
|
||||||
|
<!-- pantheon-family:end -->
|
||||||
|
|
||||||
|
## 许可证
|
||||||
|
|
||||||
|
本项目以 [MIT 许可证](LICENSE) 提供。
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Security and privacy
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/doc-security.png" alt="A marble gate plate with a rectangular opening cut through it standing between the incoming blue paths and the stack of marble leaves on the table" width="100%"></p>
|
||||||
|
|
||||||
|
## What Koiz keeps
|
||||||
|
|
||||||
|
Koiz keeps one file: the lesson journal, at `~/.claude/koiz/lessons.jsonl`. Every line is one record with the text of the failure, the cause, the mechanism that closes it, the project name and a date. Nothing else is stored anywhere.
|
||||||
|
|
||||||
|
The journal lives outside the project repository on purpose. Lessons carry file paths, command lines and the names of other work, so a public tree is the wrong place for them. If you clone this repository, the journal that appears on your machine is yours alone and it is never committed.
|
||||||
|
|
||||||
|
## What leaves your machine
|
||||||
|
|
||||||
|
Nothing. The instrument has no network calls and no dependencies. It reads files, writes one file, and exits. Capture reads the transcript of a session that is already on your disk and copies it nowhere.
|
||||||
|
|
||||||
|
## Secrets
|
||||||
|
|
||||||
|
The secret filter runs on the write, not on the read. A token, an API key, an AWS access key or a PEM private key is replaced with a marker before the line reaches the journal. What is never written cannot be shown by accident later.
|
||||||
|
|
||||||
|
The filter is covered by the self-test and by a mutation: turning it off must make the self-test fail. If that mutation ever survives, the check has stopped checking, and that is treated as a defect.
|
||||||
|
|
||||||
|
## What the instrument can do to your system
|
||||||
|
|
||||||
|
`install.sh` writes two things: the directory `~/.claude/koiz` and one `SessionEnd` entry in `~/.claude/settings.json`. It backs up the settings file before touching it and refuses to write at all if the file does not parse. It asks before every step unless you pass `--yes`.
|
||||||
|
|
||||||
|
Nothing else on your system is modified. There is no daemon, no launch agent and no background process.
|
||||||
|
|
||||||
|
## Reporting a hole
|
||||||
|
|
||||||
|
Open an issue at https://github.com/zarubinvibe/koiz/issues and describe what you ran and what you saw. For anything that would expose someone else's data, write the report without the sensitive part and say that you have it; a maintainer will ask for a private channel.
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Безопасность и приватность
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/doc-security.png" alt="Мраморная плита с прорезанным насквозь прямоугольным проемом стоит между приходящими голубыми путями и стопкой мраморных листов на столе" width="100%"></p>
|
||||||
|
|
||||||
|
## Что Койз хранит
|
||||||
|
|
||||||
|
Койз хранит один файл: журнал уроков по пути `~/.claude/koiz/lessons.jsonl`. В каждой строке одна запись: текст провала, причина, механизм закрепления, имя проекта и дата. Больше нигде и ничего не остается.
|
||||||
|
|
||||||
|
Журнал лежит вне репозитория проекта намеренно. Уроки несут пути к файлам, командные строки и имена чужих работ, и в публичном дереве им не место. Если вы склонируете этот репозиторий, журнал на вашей машине принадлежит только вам и в коммиты не попадает.
|
||||||
|
|
||||||
|
## Что уходит с вашей машины
|
||||||
|
|
||||||
|
Ничего. У прибора нет сетевых вызовов и нет зависимостей. Он читает файлы, пишет один файл и выходит. Съем читает транскрипт сессии, который и так лежит на вашем диске, и никуда его не копирует.
|
||||||
|
|
||||||
|
## Секреты
|
||||||
|
|
||||||
|
Фильтр секретов стоит на записи, а не на выдаче. Токен, ключ API, ключ доступа AWS или приватный ключ в формате PEM заменяются меткой до того, как строка попадет в журнал. То, что не записано, невозможно случайно показать потом.
|
||||||
|
|
||||||
|
Фильтр закрыт селфтестом и мутацией: выключение фильтра обязано уронить селфтест. Если эта мутация когда-нибудь выживет, значит проверка перестала проверять, и это считается дефектом.
|
||||||
|
|
||||||
|
## Что прибор делает с вашей системой
|
||||||
|
|
||||||
|
`install.sh` пишет две вещи: каталог `~/.claude/koiz` и одну запись `SessionEnd` в `~/.claude/settings.json`. Перед правкой он делает резервную копию настроек и отказывается писать вовсе, если файл не разбирается. Перед каждым шагом он спрашивает, пока вы не передали `--yes`.
|
||||||
|
|
||||||
|
Больше в системе не меняется ничего. Ни демона, ни агента запуска, ни фонового процесса.
|
||||||
|
|
||||||
|
## Куда писать о найденной дыре
|
||||||
|
|
||||||
|
Заведите issue на https://github.com/zarubinvibe/koiz/issues и опишите, что запускали и что увидели. Если находка раскрывает чужие данные, напишите отчет без этой части и скажите, что она у вас есть; сопровождающий попросит приватный канал.
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# 安全与隐私
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/pantheon/doc-security.png" alt="一块开着长方形通孔的大理石板,立在进来的蓝色路径和桌上那摞大理石片之间" width="100%"></p>
|
||||||
|
|
||||||
|
## Koiz 保存什么
|
||||||
|
|
||||||
|
Koiz 只保存一个文件:教训日志,路径是 `~/.claude/koiz/lessons.jsonl`。每一行是一条记录:失败的文字、原因、固定它的机制、项目名和日期。除此之外,任何地方都不留东西。
|
||||||
|
|
||||||
|
日志故意放在项目仓库之外。教训里带着文件路径、命令行和别人项目的名字,公开的代码树不是它该待的地方。你克隆这个仓库之后,机器上出现的那份日志只属于你,也不会被提交。
|
||||||
|
|
||||||
|
## 什么会离开你的机器
|
||||||
|
|
||||||
|
什么都不会。这个仪器没有网络调用,也没有依赖。它读文件,写一个文件,然后退出。采集读的是本来就在你磁盘上的会话记录,不会把它复制到任何地方。
|
||||||
|
|
||||||
|
## 密钥
|
||||||
|
|
||||||
|
密钥过滤放在写入这一侧,不是读取这一侧。令牌、API 密钥、AWS 访问密钥或 PEM 私钥,在进入日志之前就被替换成标记。没有被写下来的东西,之后也不可能被不小心展示出来。
|
||||||
|
|
||||||
|
这个过滤器有自检和变异测试兜着:把过滤关掉,自检必须失败。如果哪天这个变异活了下来,说明检查已经不再检查,这被当作缺陷处理。
|
||||||
|
|
||||||
|
## 仪器会对你的系统做什么
|
||||||
|
|
||||||
|
`install.sh` 写两样东西:目录 `~/.claude/koiz`,以及 `~/.claude/settings.json` 里的一条 `SessionEnd` 记录。改动之前它会先备份设置文件,文件解析不了就干脆不写。除非你加了 `--yes`,否则每一步之前它都会先问你。
|
||||||
|
|
||||||
|
系统里别的东西一概不动。没有守护进程,没有启动项,没有后台任务。
|
||||||
|
|
||||||
|
## 发现漏洞往哪里写
|
||||||
|
|
||||||
|
到 https://github.com/zarubinvibe/koiz/issues 开一个 issue,写清楚你运行了什么、看到了什么。如果这个发现会暴露别人的数据,就把敏感部分省掉再写,并说明你手里有;维护者会来找你要一个私下的渠道。
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# How Koiz works
|
||||||
|
|
||||||
|
<p align="center"><img src="assets/pantheon/doc-how-it-works.png" alt="Four objects in a row on a marble table: a stack of thin marble leaves, the open ledger with a gold pin through its page, one thicker leaf, and the gate plate with a rectangular opening" width="100%"></p>
|
||||||
|
|
||||||
|
Three things are kept apart on purpose, because mixing them is what makes lesson bases rot.
|
||||||
|
|
||||||
|
## Capture is cheap, deterministic and machine-only
|
||||||
|
|
||||||
|
When a session closes, a `SessionEnd` hook hands the instrument the transcript that is already on your disk. The instrument reads it for the things a disk can prove: commands that failed, exit codes, gates that refused, how many attempts a task took.
|
||||||
|
|
||||||
|
Two kinds of noise never reach the base. A watchdog that did its job is not a failure, so a blocker that fired is skipped. Evidence shorter than three meaningful words is skipped as well: an unpinned lesson built from a fragment would later stop a night run over nothing.
|
||||||
|
|
||||||
|
Capture is idempotent. Reading the same transcript twice does not double the records, because each candidate carries a fingerprint and a repeat raises a counter instead of adding a line.
|
||||||
|
|
||||||
|
## Storage appends and never rewrites
|
||||||
|
|
||||||
|
The journal at `~/.claude/koiz/lessons.jsonl` is append-only. The state of the base is the result of replaying the journal from the beginning, which means every record keeps its history and nothing is silently edited away.
|
||||||
|
|
||||||
|
A record carries what broke, how to reproduce it, why it happened, what closes it, the project, the date and a validity interval. A lesson that stopped applying is closed by date rather than deleted. It is not a lie, it simply no longer holds, and the reason it was closed stays readable next to it.
|
||||||
|
|
||||||
|
The base has a budget, three hundred active lessons by default. The ceiling is the point: without one, a base grows forever and nobody ever collapses anything.
|
||||||
|
|
||||||
|
## Collapse is a separate, deliberate pass
|
||||||
|
|
||||||
|
Merging on write is expensive and loses data, so it is a command of its own. `collapse` looks for lessons that repeat the same shape, proposes one rule that covers them, and shows exactly which records it would fold. `collapse --dry` shows the proposal and changes nothing.
|
||||||
|
|
||||||
|
## Pinning is what makes this a tool rather than a diary
|
||||||
|
|
||||||
|
Every record has a pin field with five legal values: `hook`, `deny`, an instrument, a test, or nothing. Home-made values are refused. A pin without a reference to a file or a command is refused too, because a mechanism nobody can open is not a mechanism.
|
||||||
|
|
||||||
|
"Nothing" is legal and honest. It means the mechanism does not exist yet.
|
||||||
|
|
||||||
|
## The gate turns the base into pressure
|
||||||
|
|
||||||
|
`node scripts/koiz.mjs gate` exits non-zero when a lesson came back and is still pinned to nothing. Put it in a nightly script or a pre-push hook and the base starts holding you to your own conclusions. There are two honest ways out: close the repeat with a mechanism, or admit the rule does not work and close it by date. A deferral needs a date and a reason.
|
||||||
|
|
||||||
|
## One base, every project
|
||||||
|
|
||||||
|
The key is the class of the error, not the name of the repository. A lesson captured while you worked on a mobile app is found from a legal-practice project, because the thing that broke was the path handling, not the app.
|
||||||
|
|
||||||
|
That is why the journal lives outside any project tree. A base that sits inside one repository only ever warns the people already standing in that repository, which is the one place the lesson is least needed.
|
||||||
|
|
||||||
|
## Why the self-test is trusted
|
||||||
|
|
||||||
|
`scripts/koiz-mutate.mjs` breaks nineteen rules of the instrument one at a time and demands that the self-test fail every single time. A mutation that survives means the check was not checking. The first run of that gate found a real defect: the instrument exited zero on a symlinked path instead of refusing.
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Как работает Койз
|
||||||
|
|
||||||
|
<p align="center"><img src="assets/pantheon/doc-how-it-works.png" alt="Четыре предмета в ряд на мраморном столе: стопка тонких мраморных листов, раскрытый свод с золотой шпилькой сквозь страницу, один лист потолще и плита с прорезанным проемом" width="100%"></p>
|
||||||
|
|
||||||
|
Три вещи разведены сознательно: именно их смешение и гноит базы уроков.
|
||||||
|
|
||||||
|
## Съем дешевый, детерминированный и машинный
|
||||||
|
|
||||||
|
На закрытии сессии хук `SessionEnd` отдает прибору транскрипт, который и так лежит на вашем диске. Прибор читает оттуда то, что можно доказать с диска: упавшие команды, коды возврата, отказы ворот, число попыток на задачу.
|
||||||
|
|
||||||
|
Два вида шума до базы не доходят. Сработавший сторож провалом не считается, поэтому отказ блокера пропускается. Улика короче трех значимых слов пропускается тоже: незакрепленный урок, собранный из обрывка, потом останавливал бы ночной прогон на ровном месте.
|
||||||
|
|
||||||
|
Съем идемпотентен. Повторное чтение того же транскрипта не удваивает записи: у каждого кандидата есть отпечаток, и повтор поднимает счетчик вместо новой строки.
|
||||||
|
|
||||||
|
## Хранение только дописывает
|
||||||
|
|
||||||
|
Журнал `~/.claude/koiz/lessons.jsonl` работает на дозапись. Состояние базы получается проигрыванием журнала с начала, поэтому у каждой записи остается история, и ничего не правится молча.
|
||||||
|
|
||||||
|
Запись несет: что сломалось, чем воспроизводится, почему так вышло, чем закрыто, проект, дату и интервал действия. Переставший действовать урок закрывается датой, а не стирается. Он не ложь, он просто больше не держит, и причина закрытия читается рядом с ним.
|
||||||
|
|
||||||
|
У базы есть бюджет, по умолчанию триста активных уроков. Потолок здесь и есть смысл: без него база растет вечно, и схлопывать никто не начинает.
|
||||||
|
|
||||||
|
## Схлопывание идет отдельным осознанным проходом
|
||||||
|
|
||||||
|
Слияние на записи стоит дорого и теряет данные, поэтому оно вынесено в свою команду. `collapse` ищет уроки одной формы, предлагает одно правило на них и показывает, какие записи свернет. `collapse --dry` показывает предложение и ничего не меняет.
|
||||||
|
|
||||||
|
## Закрепление отличает инструмент от дневника
|
||||||
|
|
||||||
|
У каждой записи есть поле закрепления с пятью законными значениями: `hook`, `deny`, прибор, тест или «ничем». Самодельные значения отвергаются. Закрепление без ссылки на файл или команду отвергается тоже: механизм, который нельзя открыть, механизмом не считается.
|
||||||
|
|
||||||
|
«Ничем» тоже законное и честное значение. Оно говорит, что механизма пока нет.
|
||||||
|
|
||||||
|
## Ворота превращают базу в давление
|
||||||
|
|
||||||
|
`node scripts/koiz.mjs gate` выходит ненулевым кодом, когда урок вернулся и до сих пор закреплен «ничем». Впишите ее в ночной скрипт или в хук перед пушем, и база начнет держать вас за ваши же выводы. Честных выхода два: закрыть повтор механизмом или признать правило нерабочим и закрыть его датой. Отсрочка требует даты и причины.
|
||||||
|
|
||||||
|
## Одна база на все проекты
|
||||||
|
|
||||||
|
Ключом служит класс ошибки, а не имя репозитория. Урок, снятый во время работы над мобильным приложением, находится из проекта юридической практики: сломалась работа с путями, а не приложение.
|
||||||
|
|
||||||
|
Поэтому журнал и живет вне дерева проектов. База, лежащая внутри одного репозитория, предупреждает только тех, кто уже стоит в этом репозитории, то есть ровно там, где урок нужен меньше всего.
|
||||||
|
|
||||||
|
## Почему селфтесту можно верить
|
||||||
|
|
||||||
|
`scripts/koiz-mutate.mjs` ломает девятнадцать правил прибора по одному и требует, чтобы селфтест упал каждый раз. Выжившая мутация означает, что проверка не проверяла. Первый прогон этих ворот нашел настоящий дефект: прибор выходил нулем по симлинк-пути вместо отказа.
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Koiz 是怎么工作的
|
||||||
|
|
||||||
|
<p align="center"><img src="assets/pantheon/doc-how-it-works.png" alt="大理石桌上并排放着四样东西:一摞薄薄的大理石片、被金色别针穿透的摊开册页、一片更厚的石片,以及开着长方形通孔的石板" width="100%"></p>
|
||||||
|
|
||||||
|
三件事被有意分开:正是把它们混在一起,教训库才会烂掉。
|
||||||
|
|
||||||
|
## 采集便宜、确定,而且只由机器做
|
||||||
|
|
||||||
|
会话结束时,`SessionEnd` 钩子把本来就在你磁盘上的会话记录交给仪器。仪器从里面读磁盘能证明的东西:失败的命令、退出码、被拒的闸门、一个任务重试了几次。
|
||||||
|
|
||||||
|
有两类噪音进不了库。守卫正常工作不算失败,所以已经拦住的阻断会被跳过。短于三个实义词的证据也会被跳过:用碎片拼出来的、没有固定的教训,之后会无缘无故拦下夜里的活儿。
|
||||||
|
|
||||||
|
采集是幂等的。同一份记录读两遍不会写出两条:每个候选都带指纹,重复只会让计数加一,而不是多出一行。
|
||||||
|
|
||||||
|
## 存储只追加
|
||||||
|
|
||||||
|
`~/.claude/koiz/lessons.jsonl` 这份日志只做追加。库的状态是从头重放日志得到的结果,所以每条记录都留着自己的历史,也不会被悄悄改掉。
|
||||||
|
|
||||||
|
一条记录包含:什么坏了、怎么复现、为什么会这样、被什么关掉了、项目、日期和生效区间。不再适用的教训按日期关闭,而不是删除。它不是假话,只是不再成立了,关闭的原因就写在旁边。
|
||||||
|
|
||||||
|
库有预算,默认三百条生效教训。上限本身就是意义所在:没有上限,库会一直长下去,也就没人真的去归并。
|
||||||
|
|
||||||
|
## 归并是单独的、有意识的一趟
|
||||||
|
|
||||||
|
写入时顺手合并既贵又会丢数据,所以它被拆成了自己的命令。`collapse` 找出形状相同的教训,提出一条能覆盖它们的规则,并把要合并哪几条摊开给你看。`collapse --dry` 只给建议,什么都不改。
|
||||||
|
|
||||||
|
## 固定,是工具和日记的分界
|
||||||
|
|
||||||
|
每条记录都有固定这一栏,只有五个合法值:`hook`、`deny`、仪器、测试,或者「没有」。自造的值会被拒绝。没有指向具体文件或命令的固定也会被拒绝:打不开的机制不算机制。
|
||||||
|
|
||||||
|
「没有」是合法的,也是诚实的。它说明机制还不存在。
|
||||||
|
|
||||||
|
## 闸门把库变成压力
|
||||||
|
|
||||||
|
`node scripts/koiz.mjs gate` 在教训回来、而固定栏还写着「没有」时以非零码退出。把它写进夜间脚本或推送前的钩子,库就开始拿你自己的结论管着你。诚实的出路有两条:用机制关掉这次重复,或者承认这条规则不成立,按日期关掉它。要延期就得写上日期和理由。
|
||||||
|
|
||||||
|
## 一份库,所有项目
|
||||||
|
|
||||||
|
检索键是错误的类别,不是仓库的名字。你在做移动应用时采到的教训,从法律业务那个项目里也能找出来:坏掉的是路径处理,不是那个应用。
|
||||||
|
|
||||||
|
所以日志才放在所有项目目录之外。放在某一个仓库里的库,只会提醒已经站在那个仓库里的人,而那恰恰是最不需要这条教训的地方。
|
||||||
|
|
||||||
|
## 装了之后系统里多了什么
|
||||||
|
|
||||||
|
只有两样:`~/.claude/koiz` 这个目录,以及设置文件里一条 `SessionEnd` 记录。没有守护进程,没有开机启动项,没有后台任务,也没有任何网络连接。要卸载,把那条记录删掉就行,日志留着还是你的。
|
||||||
|
|
||||||
|
## 为什么自检值得信
|
||||||
|
|
||||||
|
`scripts/koiz-mutate.mjs` 每次打断仪器的一条规则,一共十九条,并要求自检每一次都失败。有变异活下来,就说明那个检查根本没在检查。这道闸门第一次跑,就抓到了一个真实缺陷:仪器在符号链接路径上是以 0 退出的,而不是拒绝。
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
# Getting Started In Chat
|
||||||
|
|
||||||
|
[Русский](ONBOARDING-CHAT.ru.md) · [中文](ONBOARDING-CHAT.zh.md)
|
||||||
|
|
||||||
|
This page is read by an agent, not by you. The agent runs the conversation from it: it says what
|
||||||
|
it is about to do before doing it, and it stops wherever the choice is yours.
|
||||||
|
|
||||||
|
<!-- owner-greeting:start -->
|
||||||
|
|
||||||
|
> Hi. I am Fil.
|
||||||
|
>
|
||||||
|
> I built Koiz after the same mistake came back in three projects in a row. Every time I honestly
|
||||||
|
> wrote the lesson into a log. Every time the next session did not read it — because prose is not
|
||||||
|
> a gate, and a diary entry forbids nobody anything.
|
||||||
|
>
|
||||||
|
> Koiz stores a lesson only with the field that matters: what pins it. A hook, a deny rule, an
|
||||||
|
> instrument, or a test. A lesson nothing can pin is a complaint, not a lesson, and the base says
|
||||||
|
> so out loud.
|
||||||
|
>
|
||||||
|
> From here an agent talks to you. It installs nothing silently: before every step it says what
|
||||||
|
> changes on disk and what you get. If a step is not for you, say "skip".
|
||||||
|
>
|
||||||
|
> — Filipp Zarubin
|
||||||
|
|
||||||
|
<!-- owner-greeting:end -->
|
||||||
|
|
||||||
|
## How To Use This
|
||||||
|
|
||||||
|
Open the project folder in Claude Code, Codex, or another agent and say: "run the onboarding".
|
||||||
|
The agent walks the steps below, says each one before running it, and waits for your decision at
|
||||||
|
every fork.
|
||||||
|
|
||||||
|
## Step 1: I look at what your machine already has
|
||||||
|
|
||||||
|
**What I do:** check the Node version and that git is present.
|
||||||
|
|
||||||
|
**Why:** Koiz is a set of instruments on Node with zero dependencies. Node 20 or newer is enough;
|
||||||
|
nothing else will be installed, and that is worth confirming up front instead of midway.
|
||||||
|
|
||||||
|
**What changes on disk:** nothing. These two commands only read.
|
||||||
|
|
||||||
|
**What you get:** a plain "you can" or "update Node first", with no guessing.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node --version
|
||||||
|
git --version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 2: I bring the house down to your machine
|
||||||
|
|
||||||
|
**What I do:** clone the repository into the folder you choose.
|
||||||
|
|
||||||
|
**Why:** everything else happens inside it: the instruments, the acceptance gate, and the mutation
|
||||||
|
gate all live there.
|
||||||
|
|
||||||
|
**What changes on disk:** one new folder appears. Nothing outside it is touched.
|
||||||
|
|
||||||
|
**What you get:** a complete local copy of the tool.
|
||||||
|
|
||||||
|
**Fork:** with git I use `git clone`, and updating later is one command. Without git I take the
|
||||||
|
archive, but then updating means downloading again.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/zarubinvibe/koiz.git && cd koiz
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 3: I check that the instruments do not lie
|
||||||
|
|
||||||
|
**What I do:** run the selftest, then the mutation gate: it breaks nineteen rules on a copy and
|
||||||
|
demands that each one fails the selftest.
|
||||||
|
|
||||||
|
**Why:** a selftest that stays green while a rule is broken checks nothing. Before you trust a
|
||||||
|
tool with your lessons, it is worth seeing that it judges itself seriously.
|
||||||
|
|
||||||
|
**What changes on disk:** nothing outside a temporary folder that removes itself.
|
||||||
|
|
||||||
|
**What you get:** two green lines. A red one means do not install: the tool does not behave here
|
||||||
|
the way it claims, and an issue is the right answer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs --selftest
|
||||||
|
node scripts/koiz-mutate.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 4: I set up the lesson base
|
||||||
|
|
||||||
|
**What I do:** create the lesson journal and, if you already keep a handwritten self-learning log,
|
||||||
|
migrate its entries with a check that not a single one was lost.
|
||||||
|
|
||||||
|
**Why:** the base lives OUTSIDE the repository, in `~/.claude/koiz/lessons.jsonl`. Lessons carry
|
||||||
|
paths, names, and fragments of commands, and git is no place for that. The journal is append-only:
|
||||||
|
nothing is overwritten and nothing is erased.
|
||||||
|
|
||||||
|
**What changes on disk:** one file appears in your home folder. Secrets do not reach it: the
|
||||||
|
filter sits on write, not on read.
|
||||||
|
|
||||||
|
**What you get:** a base keyed by error class rather than repository name — a lesson from one
|
||||||
|
project is found from another.
|
||||||
|
|
||||||
|
**Fork:** migrate an existing log (`--file <path>`) or start from an empty base. Migration spoils
|
||||||
|
nothing: it only appends, and at the end it verifies every record by its source.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs migrate --file ~/.claude/self-learning/lessons.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 5: I put capture on session close
|
||||||
|
|
||||||
|
**What I do:** wire the `SessionEnd` hook that reads the transcript on exit and takes the failed
|
||||||
|
commands, the gate refusals, and the calls repeated three times.
|
||||||
|
|
||||||
|
**Why:** a lesson that has to be typed by hand does not get typed. The machine takes what is
|
||||||
|
visible without you and leaves you the one thing it cannot know — why it happened.
|
||||||
|
|
||||||
|
**What changes on disk:** one line in your agent settings. The hook is quiet and cannot fail:
|
||||||
|
it is unable to break the exit from a session.
|
||||||
|
|
||||||
|
**What you get:** a base that fills itself, and a list of raw material whose cause you still owe.
|
||||||
|
|
||||||
|
**Fork:** automatically through the hook, or by hand with `capture --transcript <file>` after a
|
||||||
|
session. The first is more reliable, the second leaves your settings untouched.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs capture --transcript ~/.claude/projects/<project>/<session>.jsonl
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 6: we ask the base and look at the debt
|
||||||
|
|
||||||
|
**What I do:** ask the base a question in your own words and show you the debt gate.
|
||||||
|
|
||||||
|
**Why:** the base proves itself by an answer, not by an install. The gate answers a different
|
||||||
|
question: what has already repeated twice and is still pinned by nothing.
|
||||||
|
|
||||||
|
**What changes on disk:** nothing. Both commands only read.
|
||||||
|
|
||||||
|
**What you get:** results that carry the pin of every lesson, and an honest debt list. Exit code 1
|
||||||
|
from the gate means this error class will come back until a mechanism closes it.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs ask "what the lesson was about"
|
||||||
|
node scripts/koiz.mjs debt
|
||||||
|
```
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
# Знакомство в чате
|
||||||
|
|
||||||
|
[English](ONBOARDING-CHAT.md) · [中文](ONBOARDING-CHAT.zh.md)
|
||||||
|
|
||||||
|
Эту страницу читает не человек, а агент. Он ведёт по ней разговор: говорит, что собирается
|
||||||
|
сделать, прежде чем сделать, и останавливается там, где выбор ваш.
|
||||||
|
|
||||||
|
<!-- owner-greeting:start -->
|
||||||
|
|
||||||
|
> Привет. Я Фил.
|
||||||
|
>
|
||||||
|
> Койз я собрал после того, как одна и та же ошибка повторилась у меня в трёх проектах подряд.
|
||||||
|
> Каждый раз я честно записывал урок в лог. Каждый раз следующая сессия его не читала — потому
|
||||||
|
> что текст не ворота, а запись в дневнике никому ничего не запрещает.
|
||||||
|
>
|
||||||
|
> Койз хранит уроки так, чтобы у каждого было поле «чем закреплено»: хук, запрет, прибор или
|
||||||
|
> тест. Урок, который нечем закрепить, — это жалоба, а не урок, и база говорит об этом прямо.
|
||||||
|
>
|
||||||
|
> Дальше с вами говорит агент. Он не поставит ничего молча: перед каждым шагом скажет, что
|
||||||
|
> меняется на диске и что вы получите. Не нужен шаг — скажите «пропусти».
|
||||||
|
>
|
||||||
|
> — Филипп Зарубин
|
||||||
|
|
||||||
|
<!-- owner-greeting:end -->
|
||||||
|
|
||||||
|
## Как этим пользоваться
|
||||||
|
|
||||||
|
Откройте папку проекта в Claude Code, Codex или другом агенте и скажите: «проведи онбординг».
|
||||||
|
Агент идёт по шагам ниже, произносит каждый до исполнения и ждёт вашего решения на развилках.
|
||||||
|
|
||||||
|
## Шаг 1: смотрю, что уже есть на машине
|
||||||
|
|
||||||
|
**Что я делаю:** проверяю версию Node и наличие git.
|
||||||
|
|
||||||
|
**Зачем:** Койз — это приборы на Node без единой зависимости. Нужен Node 20 или новее; больше
|
||||||
|
ничего ставить не придётся, и это стоит подтвердить до начала, а не в середине.
|
||||||
|
|
||||||
|
**Что меняется на диске:** ничего. Две команды только читают.
|
||||||
|
|
||||||
|
**Что вы получите:** ответ «можно» или «сначала обновите Node», без догадок.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node --version
|
||||||
|
git --version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Шаг 2: забираю дом
|
||||||
|
|
||||||
|
**Что я делаю:** клонирую репозиторий в выбранную вами папку.
|
||||||
|
|
||||||
|
**Зачем:** дальше всё происходит внутри: приборы, ворота приёмки и мутационные ворота лежат там.
|
||||||
|
|
||||||
|
**Что меняется на диске:** появляется одна новая папка. За её пределами ничего не трогается.
|
||||||
|
|
||||||
|
**Что вы получите:** локальную копию инструмента целиком.
|
||||||
|
|
||||||
|
**Развилка:** есть git — беру `git clone`, обновление потом одной командой. Нет git — беру
|
||||||
|
архивом, но тогда обновляться придётся повторным скачиванием.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/zarubinvibe/koiz.git && cd koiz
|
||||||
|
```
|
||||||
|
|
||||||
|
## Шаг 3: проверяю, что приборы не врут
|
||||||
|
|
||||||
|
**Что я делаю:** гоню селфтест, а затем мутационные ворота: они ломают девятнадцать правил по
|
||||||
|
копии и требуют, чтобы каждое роняло селфтест.
|
||||||
|
|
||||||
|
**Зачем:** селфтест, который остаётся зелёным при сломанном правиле, ничего не проверяет.
|
||||||
|
Прежде чем доверить инструменту свои уроки, стоит увидеть, что он судит себя всерьёз.
|
||||||
|
|
||||||
|
**Что меняется на диске:** ничего за пределами временной папки, которая удаляется сама.
|
||||||
|
|
||||||
|
**Что вы получите:** две зелёные строки. Красная — не ставьте, откройте issue: значит инструмент
|
||||||
|
у вас работает не так, как заявлено.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs --selftest
|
||||||
|
node scripts/koiz-mutate.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Шаг 4: завожу базу уроков
|
||||||
|
|
||||||
|
**Что я делаю:** создаю журнал уроков и, если у вас уже есть рукописный лог самообучения,
|
||||||
|
переношу его записи с проверкой, что ни одна не потерялась.
|
||||||
|
|
||||||
|
**Зачем:** база лежит ВНЕ репозитория — в `~/.claude/koiz/lessons.jsonl`. Уроки несут пути,
|
||||||
|
имена и куски команд, и в git такому не место. Журнал только дописывается: ничего не
|
||||||
|
перезаписывается и не стирается.
|
||||||
|
|
||||||
|
**Что меняется на диске:** появляется один файл в вашей домашней папке. Секреты в него не
|
||||||
|
попадают: фильтр стоит на записи, а не на выдаче.
|
||||||
|
|
||||||
|
**Что вы получите:** базу, которая ищется по классу ошибки, а не по имени репозитория, — урок из
|
||||||
|
одного проекта находится из другого.
|
||||||
|
|
||||||
|
**Развилка:** перенести существующий лог (`--file <путь>`) или начать с чистой базы. Перенос
|
||||||
|
ничего не портит: он только дописывает и в конце сверяет каждую запись по её источнику.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs migrate --file ~/.claude/self-learning/lessons.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Шаг 5: ставлю съём на закрытие сессии
|
||||||
|
|
||||||
|
**Что я делаю:** вшиваю хук `SessionEnd`, который на выходе из сессии снимает с транскрипта
|
||||||
|
упавшие команды, отказы ворот и трижды повторённые вызовы.
|
||||||
|
|
||||||
|
**Зачем:** урок, который надо записать руками, не записывается. Машина берёт с диска то, что
|
||||||
|
видно без вас, и оставляет вам единственное, чего она не знает, — «почему так вышло».
|
||||||
|
|
||||||
|
**Что меняется на диске:** одна строка в настройках вашего агента. Хук тихий и не падающий:
|
||||||
|
он не может сломать выход из сессии.
|
||||||
|
|
||||||
|
**Что вы получите:** базу, которая пополняется сама, и список сырья, у которого надо дознать
|
||||||
|
причину.
|
||||||
|
|
||||||
|
**Развилка:** автоматически хуком или вручную командой `capture --transcript <файл>` после
|
||||||
|
сессии. Первое надёжнее, второе не трогает ваши настройки.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs capture --transcript ~/.claude/projects/<проект>/<сессия>.jsonl
|
||||||
|
```
|
||||||
|
|
||||||
|
## Шаг 6: спрашиваем базу и смотрим долги
|
||||||
|
|
||||||
|
**Что я делаю:** задаю базе вопрос вашими словами и показываю ворота долга.
|
||||||
|
|
||||||
|
**Зачем:** база доказывает себя не установкой, а ответом. Ворота отвечают на другой вопрос:
|
||||||
|
что уже повторилось дважды и до сих пор ничем не закреплено.
|
||||||
|
|
||||||
|
**Что меняется на диске:** ничего. Обе команды только читают.
|
||||||
|
|
||||||
|
**Что вы получите:** выдачу с полем «чем закреплено» у каждого урока и честный список долгов.
|
||||||
|
Код 1 у ворот означает: этот класс ошибки повторится снова, пока его не закроет механизм.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs ask "о чём был урок"
|
||||||
|
node scripts/koiz.mjs debt
|
||||||
|
```
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
# 对话式上手:智能体和你一起安装 Koiz
|
||||||
|
|
||||||
|
这一页写给刚打开一个新克隆、需要向人解释自己的智能体。从上往下读,一步一步来,每一步都说清楚你在做什么、为什么这么做。
|
||||||
|
|
||||||
|
<!-- owner-greeting:start -->
|
||||||
|
|
||||||
|
> 你好。我是 Koiz,蜂群的审问者。
|
||||||
|
>
|
||||||
|
> 我为你所有的项目保存同一份教训库。教训进来的方式是拆解,不是复述:什么坏了,为什么会这样,重复被什么关掉了。最后一栏最重要,它写着「没有」,这条教训就还没做完。
|
||||||
|
>
|
||||||
|
> 我们现在把我装到你的机器上。我一次只问一个问题,每一步之前先说磁盘上会改变什么,没有你的「好」我什么都不做。
|
||||||
|
|
||||||
|
<!-- owner-greeting:end -->
|
||||||
|
|
||||||
|
## 第 1 步:先看清楚我们站在哪里
|
||||||
|
|
||||||
|
**我在做什么:** 检查 Node 版本,确认我们在 Koiz 的克隆目录里。
|
||||||
|
|
||||||
|
**为什么:** 在低于 20 的 Node 上安装,会在三步之后抛出一个看不懂的错误,那时候你面对的是一个装了一半的东西,比现在难处理得多。
|
||||||
|
|
||||||
|
**磁盘上会改变什么:** 什么都不变,这一步只读。
|
||||||
|
|
||||||
|
**你会得到:** 一个诚实的答案:下面这些到底能不能跑。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node --version
|
||||||
|
ls scripts/koiz.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
## 第 2 步:决定教训库放在哪里
|
||||||
|
|
||||||
|
**我在做什么:** 问你是保持默认的 `~/.claude/koiz/lessons.jsonl`,还是换个地方。
|
||||||
|
|
||||||
|
**为什么:** 教训库放在仓库之外,因为教训里带着路径和别人项目的名字。如果你的工作文件在加密卷或共享磁盘上,现在选好比以后搬日志便宜得多。
|
||||||
|
|
||||||
|
**磁盘上会改变什么:** 暂时什么都不变,我只是记住你的回答。
|
||||||
|
|
||||||
|
**你会得到:** 一个固定的位置,以后总能在那里找到你的教训。
|
||||||
|
|
||||||
|
**岔路:** 用默认位置,或者给出你自己的目录并通过 `KOIZ_DB` 传进来。
|
||||||
|
|
||||||
|
## 第 3 步:把采集挂到会话结束上
|
||||||
|
|
||||||
|
**我在做什么:** 运行 `bash install.sh`,和你一起回答它的那一个问题。
|
||||||
|
|
||||||
|
**为什么:** 这是我在自己目录之外做的唯一改动,它让你不用再手打教训。手打这件事,人一般坚持两天。
|
||||||
|
|
||||||
|
**磁盘上会改变什么:** 出现教训库目录,`~/.claude/settings.json` 里多一条 `SessionEnd` 记录;原来的设置文件会在旁边留一份副本。
|
||||||
|
|
||||||
|
**你会得到:** 会话结束时自己写下来的教训。
|
||||||
|
|
||||||
|
**岔路:** 现在就装钩子,或者跳过它,用 `add` 命令手动记录。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## 第 4 步:如果有旧教训,就搬过来
|
||||||
|
|
||||||
|
**我在做什么:** 问你手里是不是已经有一份写着结论的文件,然后整份迁移过来。
|
||||||
|
|
||||||
|
**为什么:** 旧教训进到空库里是历史。进到已经有内容的库里,它们会和新的混在一起,之后没有任何办法把它们分开。
|
||||||
|
|
||||||
|
**磁盘上会改变什么:** 日志里追加记录;已有的记录一条都不改。
|
||||||
|
|
||||||
|
**你会得到:** 迁移了多少条、丢了多少条,而后者必须是零。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs migrate --file ~/.claude/self-learning/lessons.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## 第 5 步:写下第一条教训,并把闸门装上
|
||||||
|
|
||||||
|
**我在做什么:** 问你最近一周什么地方坏过,和你一起写下来,然后把欠账闸门演示一遍。
|
||||||
|
|
||||||
|
**为什么:** 玩具例子证明不了任何事。第一条教训必须是你自己的,否则这个库始终是别人的。
|
||||||
|
|
||||||
|
**磁盘上会改变什么:** 日志里多出你的那条记录。
|
||||||
|
|
||||||
|
**你会得到:** 一个活的库,以及一条在没固定的教训再次出现时会变红的命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs add --what "什么坏了" --why "为什么会这样" --pin test --pin-ref scripts/koiz-mutate.mjs
|
||||||
|
node scripts/koiz.mjs debt
|
||||||
|
node scripts/koiz.mjs gate
|
||||||
|
```
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Onboarding: the first run, step by step
|
||||||
|
|
||||||
|
<p align="center"><img src="assets/pantheon/doc-onboarding.png" alt="Koios standing behind a marble table with the open ledger on his palm and blue paths arriving from the left edge of the frame" width="100%"></p>
|
||||||
|
|
||||||
|
This page is for somebody who has never installed a tool from GitHub. Every step says what to type and what appears on screen afterwards. If a step shows something else, stop there and open an issue: a walkthrough that lies is worse than no walkthrough.
|
||||||
|
|
||||||
|
You need Git, Node 20 or newer, and a terminal. No agent is required.
|
||||||
|
|
||||||
|
1. **Check Node.** Type `node --version`. You should see something like `v22.14.0`. If the version starts with `v18` or lower, install a newer Node from https://nodejs.org before going on.
|
||||||
|
|
||||||
|
2. **Pick a folder and clone the project.** Type `git clone https://github.com/zarubinvibe/koiz.git` and then `cd koiz`. Git prints a few lines about counting and unpacking objects, and you end up inside a folder that holds `scripts`, `docs` and `install.sh`.
|
||||||
|
|
||||||
|
3. **Run the install.** Type `bash install.sh`. It asks one question: whether to put lesson capture on session close. Answer `y`. It prints the path of the lesson base, the line `хук вписан` with the path of your settings file, and then runs the self-test.
|
||||||
|
|
||||||
|
4. **Read the self-test line.** The last block starts with `selftest ok` and lists what was checked. If it says anything else, the install did not finish and nothing else on this page will work.
|
||||||
|
|
||||||
|
5. **Ask the empty base a question.** Type `node scripts/koiz.mjs ask "what has broken before"`. On a fresh install the base is empty, so it answers that it found nothing. That is the correct answer, and it proves the instrument reads its journal.
|
||||||
|
|
||||||
|
6. **Write your first lesson by hand.** Type this on one line:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs add --what "a script followed a symlink and overwrote the launcher" \
|
||||||
|
--why "the path was taken on trust, without checking what it pointed at" \
|
||||||
|
--pin тест --pin-ref scripts/koiz-mutate.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
It prints the identifier of the new record. The `--pin` field is the point of the whole project: a lesson without a mechanism is a complaint.
|
||||||
|
|
||||||
|
7. **Find it from a different project.** Leave this folder, go to any other project of yours, and run the same `ask` command with a word from your lesson. The base is one for every project, so the answer comes back there too.
|
||||||
|
|
||||||
|
8. **Look at the debt.** Type `node scripts/koiz.mjs debt`. It lists lessons that came back and are still pinned to nothing. On a fresh base the list is empty, and that is what you want to see.
|
||||||
|
|
||||||
|
9. **Put the gate where it hurts.** Type `node scripts/koiz.mjs gate`. It exits with code 0 while there is no debt and with a non-zero code when a repeat is not pinned. Add that line to your nightly script or your pre-push hook, and the base starts holding you to your own conclusions.
|
||||||
|
|
||||||
|
10. **Close the session and let the machine work.** Exit your agent session normally. On close, the hook reads the transcript and writes the drafts by itself. Open `~/.claude/koiz/capture.log` to see what it took.
|
||||||
|
|
||||||
|
## Staying current
|
||||||
|
|
||||||
|
To pull the current version later, run `/koiz-update` in Claude Code. It shows what changed before touching anything, pulls fast-forward only, leaves your journal and your settings alone, and runs the self-test afterwards. Without an agent, `git pull --ff-only` in this folder does the same thing.
|
||||||
|
|
||||||
|
## If it helps
|
||||||
|
|
||||||
|
Give Koiz a star: https://github.com/zarubinvibe/koiz. It takes a second and it decides whether other people ever find the project.
|
||||||
|
|
||||||
|
Want to change something? The path is short: fork the repository, create a branch, commit your change, push the branch, then open a Pull Request. Do not push directly to `main`; the release gate rejects it.
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Онбординг: первый запуск по шагам
|
||||||
|
|
||||||
|
<p align="center"><img src="assets/pantheon/doc-onboarding.png" alt="Койз стоит за мраморным столом, раскрытый свод лежит у него на ладони, голубые пути приходят от левого края кадра" width="100%"></p>
|
||||||
|
|
||||||
|
Эта страница написана для того, кто ни разу не ставил инструмент с GitHub. В каждом шаге сказано, что набрать и что появится на экране. Если шаг показал другое, остановитесь и заведите issue: проводник, который врет, хуже отсутствующего.
|
||||||
|
|
||||||
|
Нужен Git, Node 20 или новее и терминал. Агент не нужен.
|
||||||
|
|
||||||
|
1. **Проверьте Node.** Наберите `node --version`. Должно появиться что-то вроде `v22.14.0`. Если версия начинается на `v18` или ниже, поставьте свежий Node с https://nodejs.org и вернитесь сюда.
|
||||||
|
|
||||||
|
2. **Выберите папку и склонируйте проект.** Наберите `git clone https://github.com/zarubinvibe/koiz.git`, затем `cd koiz`. Git напечатает несколько строк про подсчет и распаковку объектов, и вы окажетесь в папке, где лежат `scripts`, `docs` и `install.sh`.
|
||||||
|
|
||||||
|
3. **Запустите установку.** Наберите `bash install.sh`. Он задаст один вопрос: ставить ли съем уроков на закрытие сессии. Ответьте `y`. Он напечатает путь к базе уроков, строку `хук вписан` с путем к вашему файлу настроек и прогонит селфтест.
|
||||||
|
|
||||||
|
4. **Прочитайте строку селфтеста.** Последний блок начинается словами `selftest ok` и перечисляет, что проверено. Если там что-то другое, установка не закончилась, и остальное на этой странице работать не будет.
|
||||||
|
|
||||||
|
5. **Спросите пустую базу.** Наберите `node scripts/koiz.mjs ask "что уже ломалось"`. На свежей установке база пуста, поэтому в ответ приходит «ничего не нашлось». Это правильный ответ: он доказывает, что прибор читает свой журнал.
|
||||||
|
|
||||||
|
6. **Запишите первый урок руками.** Наберите это одной командой:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs add --what "скрипт пошел по симлинку и переписал лаунчер" \
|
||||||
|
--why "путь взяли на веру, не посмотрев, куда он ведет" \
|
||||||
|
--pin тест --pin-ref scripts/koiz-mutate.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
Прибор напечатает идентификатор новой записи. Поле `--pin` и есть смысл проекта: урок без механизма остается жалобой.
|
||||||
|
|
||||||
|
7. **Найдите его из другого проекта.** Выйдите из этой папки, перейдите в любой свой другой проект и повторите ту же команду `ask` со словом из вашего урока. База одна на все проекты, поэтому ответ придет и там.
|
||||||
|
|
||||||
|
8. **Посмотрите долги.** Наберите `node scripts/koiz.mjs debt`. Прибор перечислит уроки, которые вернулись и до сих пор ничем не закреплены. На свежей базе список пуст, и это то, что вы хотите видеть.
|
||||||
|
|
||||||
|
9. **Поставьте ворота туда, где больно.** Наберите `node scripts/koiz.mjs gate`. Команда выходит кодом 0, пока долгов нет, и ненулевым кодом, когда повтор не закреплен. Впишите эту строку в ночной скрипт или в хук перед пушем, и база начнет держать вас за ваши же выводы.
|
||||||
|
|
||||||
|
10. **Закройте сессию и дайте машине поработать.** Выйдите из сессии агента обычным образом. На закрытии хук прочитает транскрипт и сам запишет черновики. Загляните в `~/.claude/koiz/capture.log`, чтобы увидеть, что он снял.
|
||||||
|
|
||||||
|
## Как обновляться
|
||||||
|
|
||||||
|
Чтобы позже забрать свежую версию, скажите `/koiz-update` в Claude Code. Скилл сначала покажет, что изменилось, потянет только fast-forward, не тронет ваш журнал и ваши настройки и прогонит селфтест после обновления. Без агента то же самое делает `git pull --ff-only` в этой папке.
|
||||||
|
|
||||||
|
## Если пригодилось
|
||||||
|
|
||||||
|
Поставьте Койзу звезду: https://github.com/zarubinvibe/koiz. Это секунда, а от нее зависит, найдут ли проект другие люди.
|
||||||
|
|
||||||
|
Хотите что-то поправить? Путь короткий: сделайте fork, заведите ветку, оформите commit, отправьте push и откройте Pull Request. Прямой push в `main` отклонит релизный gate.
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# 上手引导:第一次运行,一步一步来
|
||||||
|
|
||||||
|
<p align="center"><img src="assets/pantheon/doc-onboarding.png" alt="科俄斯站在大理石桌后面,掌上摊着那本大理石册页,蓝色路径从画面左边一直连过来" width="100%"></p>
|
||||||
|
|
||||||
|
这一页写给从来没有从 GitHub 装过工具的人。每一步都写清楚要敲什么、敲完屏幕上会出现什么。如果某一步出来的是别的东西,就停在那里开一个 issue:会骗人的引导比没有引导更糟。
|
||||||
|
|
||||||
|
需要 Git、Node 20 或更新的版本,以及一个终端。不需要任何智能体。
|
||||||
|
|
||||||
|
1. **检查 Node。** 敲 `node --version`。应该看到类似 `v22.14.0` 的东西。如果版本是 `v18` 或更低,先去 https://nodejs.org 装一个新版再回来。
|
||||||
|
|
||||||
|
2. **选一个目录,把项目克隆下来。** 敲 `git clone https://github.com/zarubinvibe/koiz.git`,然后 `cd koiz`。Git 会打印几行关于清点和解包对象的信息,之后你就在一个包含 `scripts`、`docs` 和 `install.sh` 的目录里了。
|
||||||
|
|
||||||
|
3. **运行安装。** 敲 `bash install.sh`。它只问一个问题:要不要把教训采集挂到会话结束上。回答 `y`。它会打印教训库的路径、一行 `хук вписан` 加上你的设置文件路径,然后跑一遍自检。
|
||||||
|
|
||||||
|
4. **读那行自检结果。** 最后一段以 `selftest ok` 开头,并列出检查了哪些内容。如果不是这样,说明安装没有走完,这一页后面的东西都不会正常。
|
||||||
|
|
||||||
|
5. **向空的库提个问题。** 敲 `node scripts/koiz.mjs ask "什么地方坏过"`。刚装好时库是空的,所以它回答什么也没找到。这是正确答案:它证明仪器能读自己的日志。
|
||||||
|
|
||||||
|
6. **手写第一条教训。** 敲这一条命令:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node scripts/koiz.mjs add --what "脚本顺着符号链接走,把启动器覆盖了" \
|
||||||
|
--why "路径是凭信任拿来的,没有看它到底指向哪里" \
|
||||||
|
--pin тест --pin-ref scripts/koiz-mutate.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
仪器会打印新记录的标识。`--pin` 这一栏就是整个项目的意义所在:没有机制的教训只是抱怨。
|
||||||
|
|
||||||
|
7. **换一个项目再找它。** 离开这个目录,进入你另外任何一个项目,用你教训里的某个词再跑一次 `ask`。库是所有项目共用的,所以在那边也能得到答案。
|
||||||
|
|
||||||
|
8. **看看欠账。** 敲 `node scripts/koiz.mjs debt`。它会列出那些又回来了、却还没有任何机制拦着的教训。刚建好的库里这个列表是空的,这正是你想看到的。
|
||||||
|
|
||||||
|
9. **把闸门放到会疼的地方。** 敲 `node scripts/koiz.mjs gate`。没有欠账时它以 0 退出,有没固定的重复时以非零码退出。把这一行加进你的夜间脚本或推送前的钩子,库就开始拿你自己的结论管着你。
|
||||||
|
|
||||||
|
10. **结束会话,让机器干活。** 正常退出你的智能体会话。会话关闭时,钩子会读取记录并自己写好草稿。打开 `~/.claude/koiz/capture.log` 就能看到它采到了什么。
|
||||||
|
|
||||||
|
## 怎么更新
|
||||||
|
|
||||||
|
以后要拿最新版本,在 Claude Code 里说 `/koiz-update`。它会先把改了什么摊给你看,只做 fast-forward 拉取,不碰你的日志和设置,更新完再跑一遍自检。不用智能体的话,在这个目录里 `git pull --ff-only` 是一样的效果。
|
||||||
|
|
||||||
|
## 如果它有用
|
||||||
|
|
||||||
|
给 Koiz 点亮星标:https://github.com/zarubinvibe/koiz。这只要一秒,却决定别人能不能找到这个项目。
|
||||||
|
|
||||||
|
想改点什么?流程很短:先 fork 仓库,建一个分支,提交 commit,推送 push,然后开一个 Pull Request。请不要直接向 `main` 推送,发布闸门会拒绝。
|
||||||
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
@@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Установка Койза: поставить съём уроков на закрытие сессии и завести базу.
|
||||||
|
# Агент для этого не нужен - хватает терминала.
|
||||||
|
#
|
||||||
|
# bash install.sh # спрашивает перед каждым шагом
|
||||||
|
# bash install.sh --yes # без вопросов
|
||||||
|
# bash install.sh --dry-run # только показать, что будет сделано
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
DOM="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
BEZ_VOPROSOV=0
|
||||||
|
TOLKO_POKAZAT=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--yes|-y) BEZ_VOPROSOV=1 ;;
|
||||||
|
--dry-run|-n) TOLKO_POKAZAT=1 ;;
|
||||||
|
*) echo "неизвестный ключ: $arg" >&2; exit 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Нет терминала - значит установка идет машиной: чистая проверка на чужом
|
||||||
|
# компьютере, CI, изолированный прогон. Тогда вопросы задавать некому, и
|
||||||
|
# ПРОПУСКАТЬ шаги нельзя: установщик, который в такой среде тихо ничего не делает
|
||||||
|
# и выходит нулем, доказывает не установку, а собственную вежливость.
|
||||||
|
if [ ! -t 0 ]; then
|
||||||
|
BEZ_VOPROSOV=1
|
||||||
|
echo "терминала нет: ставлю без вопросов"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sprosit() {
|
||||||
|
[ "$BEZ_VOPROSOV" -eq 1 ] && return 0
|
||||||
|
printf '%s [y/N] ' "$1"
|
||||||
|
read -r otvet </dev/tty || return 1
|
||||||
|
case "$otvet" in y|Y|yes|Yes) return 0 ;; *) return 1 ;; esac
|
||||||
|
}
|
||||||
|
|
||||||
|
command -v node >/dev/null 2>&1 || { echo "нужен node 20 или новее" >&2; exit 1; }
|
||||||
|
|
||||||
|
BAZA="${KOIZ_DB:-$HOME/.claude/koiz}"
|
||||||
|
HUK="$DOM/scripts/koiz-session-end.sh"
|
||||||
|
NASTROYKI="$HOME/.claude/settings.json"
|
||||||
|
|
||||||
|
if [ "$TOLKO_POKAZAT" -eq 1 ]; then
|
||||||
|
echo "завел бы базу уроков в $BAZA"
|
||||||
|
echo "вписал бы SessionEnd-хук $HUK в $NASTROYKI"
|
||||||
|
echo "прогнал бы селфтест: node $DOM/scripts/koiz.mjs --selftest"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$BAZA"
|
||||||
|
echo "база уроков: $BAZA"
|
||||||
|
|
||||||
|
# Хук вписывается прибором, а не руками: settings.json у каждого свой, и слепая
|
||||||
|
# перезапись чужих хуков хуже отсутствия съема.
|
||||||
|
if sprosit "поставить съём уроков на закрытие сессии Claude Code?"; then
|
||||||
|
KOIZ_HOOK="$HUK" KOIZ_SETTINGS="$NASTROYKI" node -e '
|
||||||
|
const fs = require("fs"), path = require("path");
|
||||||
|
const file = process.env.KOIZ_SETTINGS, hook = process.env.KOIZ_HOOK;
|
||||||
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
||||||
|
let s = {};
|
||||||
|
if (fs.existsSync(file)) {
|
||||||
|
const raw = fs.readFileSync(file, "utf8").trim();
|
||||||
|
if (raw) {
|
||||||
|
try { s = JSON.parse(raw) } catch (e) {
|
||||||
|
console.error("settings.json не разбирается, ничего не трогаю: " + e.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs.copyFileSync(file, file + ".bak-koiz");
|
||||||
|
}
|
||||||
|
s.hooks = s.hooks || {};
|
||||||
|
const list = Array.isArray(s.hooks.SessionEnd) ? s.hooks.SessionEnd : [];
|
||||||
|
const already = JSON.stringify(list).includes("koiz-session-end.sh");
|
||||||
|
if (already) { console.log("хук уже стоит, оставляю как есть"); process.exit(0) }
|
||||||
|
list.push({ hooks: [{ type: "command", command: hook }] });
|
||||||
|
s.hooks.SessionEnd = list;
|
||||||
|
fs.writeFileSync(file, JSON.stringify(s, null, 2) + "\n");
|
||||||
|
console.log("хук вписан: " + file);
|
||||||
|
'
|
||||||
|
else
|
||||||
|
echo "хук не поставлен; позже: bash install.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Проверка прибора:"
|
||||||
|
( cd "$DOM" && node scripts/koiz.mjs --selftest )
|
||||||
|
echo
|
||||||
|
echo "Спросить базу перед работой:"
|
||||||
|
echo " node $DOM/scripts/koiz.mjs ask \"о чём\""
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Ворота приемки миссии: десять пунктов раздела «когда работа считается законченной»
|
||||||
|
# из docs/PROMPT-BUILD.md. Каждый судится командой, а не отметкой агента.
|
||||||
|
#
|
||||||
|
# Пишет только во временный каталог: живая база уроков читается, но не пачкается.
|
||||||
|
# Коды: 0 все зеленые · 1 есть красные.
|
||||||
|
#
|
||||||
|
# Шесть пунктов из десяти судят ОКРУЖЕНИЕ владельца: живой транскрипт, матрицу
|
||||||
|
# паритета, хранилище знаний, старый лог, хэндофф. На чужой машине этих входов
|
||||||
|
# нет, и раньше приёмка там просто краснела - изолированный прогон ворот выпуска
|
||||||
|
# ловил её как упавшую проверку. Теперь пункт без входа ПРОПУСКАЕТСЯ вслух и
|
||||||
|
# называет, чего не хватило. Пропуск не красит и не зеленит: он третье состояние,
|
||||||
|
# и его число печатается в итоге. Красит только пункт, который отработал и не
|
||||||
|
# сошёлся.
|
||||||
|
set -uo pipefail
|
||||||
|
KOIZ_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
cd "$KOIZ_ROOT"
|
||||||
|
K="$KOIZ_ROOT/scripts/koiz.mjs"
|
||||||
|
TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT
|
||||||
|
VAULT_DIR="$HOME/Мозг/08 AI и Инструменты/Уроки Койза"
|
||||||
|
fails=0
|
||||||
|
skips=0
|
||||||
|
|
||||||
|
say() { if [ "$1" = 0 ]; then printf ' ✓ %s\n' "$2"; else printf ' ✗ %s — %s\n' "$2" "${3:-нет доказательства}"; fails=$((fails+1)); fi }
|
||||||
|
skip() { printf ' · %s — пропущено: %s\n' "$1" "$2"; skips=$((skips+1)); }
|
||||||
|
|
||||||
|
# 1. Селфтест зелёный И судит логику: каждая из 16 мутаций обязана его уронить.
|
||||||
|
# Путь тут literal и относительный намеренно: изолированный прогон ворот читает
|
||||||
|
# строку глазами и по ней понимает, что этот файл ЗОВЁТ селфтест, а не отвечает
|
||||||
|
# на него сам. С путём в переменной он принимал приёмку за пробу и запускал её
|
||||||
|
# командой `koiz-acceptance.sh --selftest` на чистом HOME.
|
||||||
|
node scripts/koiz.mjs --selftest >/dev/null 2>&1; say $? "1а. селфтест зелёный"
|
||||||
|
mut=$(node scripts/koiz-mutate.mjs --json 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['survived'], d['total'])" 2>/dev/null || echo "9 0")
|
||||||
|
set -- $mut; [ "$1" = 0 ] && [ "${2:-0}" -ge 10 ]
|
||||||
|
say $? "1б. селфтест судит логику: мутаций $2, выжило $1"
|
||||||
|
|
||||||
|
# 2. Съём с ЖИВОЙ сессии: транскрипт с диска, без ручного набора.
|
||||||
|
TR=$(ls -t "$HOME"/.claude/projects/*/*.jsonl 2>/dev/null | head -1)
|
||||||
|
if [ -n "$TR" ]; then
|
||||||
|
n=$(KOIZ_DB="$TMP/cap.jsonl" node "$K" capture --transcript "$TR" --project приемка --json 2>/dev/null \
|
||||||
|
| python3 -c "import json,sys; d=json.load(sys.stdin); print(len(d['added'])+len(d['hits']))" 2>/dev/null || echo 0)
|
||||||
|
[ "${n:-0}" -ge 1 ]; say $? "2. съём с живой сессии кладёт уроки в базу (снято: ${n:-0})" "транскрипт не дал ни одной улики"
|
||||||
|
else skip "2. съём с живой сессии" "на этой машине нет транскриптов ~/.claude/projects"; fi
|
||||||
|
|
||||||
|
# 3. Схлопывание: три похожих урока становятся одним правилом.
|
||||||
|
D3="$TMP/collapse.jsonl"
|
||||||
|
for t in "прибор назвал успехом то, чего не делал, судя по имени файла" \
|
||||||
|
"гейт посчитал зелёным прогон, где проверка не запускалась" \
|
||||||
|
"скрипт отрапортовал готово при пустом целевом каталоге"; do
|
||||||
|
KOIZ_DB="$D3" node "$K" add --what "$t" --class pribor-vret --project приемка >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
r=$(KOIZ_DB="$D3" node "$K" collapse --json 2>/dev/null | python3 -c "import json,sys; print(len(json.load(sys.stdin)['rules']))")
|
||||||
|
[ "${r:-0}" = 1 ]; say $? "3. три похожих урока схлопнулись в одно правило (правил: ${r:-0})"
|
||||||
|
|
||||||
|
# 4. Двувременность: закрытое уходит из выдачи и остаётся в истории.
|
||||||
|
ID=$(KOIZ_DB="$TMP/bt.jsonl" node "$K" add --what "урок про устаревший Xcode и его ключи" --class stale --project приемка --json 2>/dev/null | python3 -c "import json,sys; print(json.load(sys.stdin)['id'])")
|
||||||
|
KOIZ_DB="$TMP/bt.jsonl" node "$K" close --id "$ID" --why "инструмент больше не используется" >/dev/null 2>&1
|
||||||
|
out=$(KOIZ_DB="$TMP/bt.jsonl" node "$K" ask "Xcode" --json 2>/dev/null)
|
||||||
|
hist=$(KOIZ_DB="$TMP/bt.jsonl" node "$K" history --id "$ID" --json 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(int(any(o['op']=='add' for o in d) and any(o['op']=='close' and o.get('valid_to') for o in d)))")
|
||||||
|
{ [ "$out" = "[]" ] && [ "$hist" = 1 ]; }; say $? "4. закрытый датой урок не выдаётся, но лежит в истории"
|
||||||
|
|
||||||
|
# 5. Бюджет: переполнение заставляет схлопывать, а не расти молча.
|
||||||
|
D5="$TMP/budget.jsonl"
|
||||||
|
i=0; for t in "копия дома ушла в чужой каталог при сборке пакета" "сборка положила артефакт мимо целевой папки" "архив распакован не туда, куда указывал манифест" \
|
||||||
|
"токены утекли в лог отладки при падении" "ключ попал в текст ошибки и уехал в чат" "пароль оказался в дампе состояния"; do
|
||||||
|
i=$((i+1)); cls=$([ $i -le 3 ] && echo copy-home || echo secret-leak)
|
||||||
|
KOIZ_DB="$D5" KOIZ_BUDGET=99 node "$K" add --what "$t" --class "$cls" --project "p$i" >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
before=$(KOIZ_DB="$D5" node "$K" stats --json | python3 -c "import json,sys; print(json.load(sys.stdin)['active'])")
|
||||||
|
KOIZ_DB="$D5" KOIZ_BUDGET=4 node "$K" add --what "седьмая беда для проверки потолка базы" --class overflow --project p7 >/dev/null 2>&1
|
||||||
|
after=$(KOIZ_DB="$D5" node "$K" stats --json | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['active']+d['rules'])")
|
||||||
|
adds=$(grep -c '"op":"add"' "$D5")
|
||||||
|
{ [ "$before" = 6 ] && [ "$after" -le 4 ] && [ "$adds" = 7 ]; }
|
||||||
|
say $? "5. переполнение бюджета схлопнуло базу без потери данных (было $before, стало $after, записей $adds)"
|
||||||
|
|
||||||
|
# 6. Кросс-проектность: урок из одного дома находится из другого.
|
||||||
|
D6="$TMP/cross.jsonl"
|
||||||
|
( cd "$HOME/Проекты/adventure-book" 2>/dev/null || cd "$TMP"
|
||||||
|
KOIZ_DB="$D6" node "$K" add --what "cat перезаписал лаунчер, пойдя по симлинку" --class symlink-write --project adventure-book >/dev/null 2>&1 )
|
||||||
|
p=$( cd "$HOME/Проекты/themis" 2>/dev/null || cd "$TMP"
|
||||||
|
KOIZ_DB="$D6" node "$K" ask "симлинк" --json 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d[0]['project'] if d else '')" )
|
||||||
|
[ "$p" = "adventure-book" ]; say $? "6. урок adventure-book найден запросом из themis (проект: ${p:-—})"
|
||||||
|
|
||||||
|
# 7. Матрица паритета зелёная у ворот Гелиоза.
|
||||||
|
PARITY_GATE="$HOME/Проекты/helioz/scripts/helioz-parity.mjs"
|
||||||
|
if [ -f "$PARITY_GATE" ] && [ -f "$KOIZ_ROOT/docs/PARITY.md" ]; then
|
||||||
|
node "$PARITY_GATE" --file "$KOIZ_ROOT/docs/PARITY.md" >/dev/null 2>&1
|
||||||
|
say $? "7. docs/PARITY.md зелёный у helioz-parity"
|
||||||
|
else skip "7. матрица паритета" "нет docs/PARITY.md или ворот helioz-parity"; fi
|
||||||
|
|
||||||
|
# 8. Мнемозина получила ноты, связи не битые, граф дома построен.
|
||||||
|
notes=$(ls "$VAULT_DIR"/*.md 2>/dev/null | wc -l | tr -d ' ')
|
||||||
|
broken=$(python3 - "$VAULT_DIR" <<'PY' 2>/dev/null || echo 999
|
||||||
|
import os, re, sys
|
||||||
|
d = sys.argv[1]
|
||||||
|
if not os.path.isdir(d): print(999); raise SystemExit
|
||||||
|
files = {os.path.splitext(f)[0] for f in os.listdir(d) if f.endswith('.md')}
|
||||||
|
bad = sum(1 for f in os.listdir(d) if f.endswith('.md')
|
||||||
|
for l in re.findall(r'\[\[([^\]]+)\]\]', open(os.path.join(d, f), encoding='utf-8').read())
|
||||||
|
if l not in files)
|
||||||
|
print(bad)
|
||||||
|
PY
|
||||||
|
)
|
||||||
|
if [ -d "$VAULT_DIR" ]; then
|
||||||
|
{ [ "${notes:-0}" -ge 10 ] && [ "${broken:-999}" = 0 ] && [ -f "$KOIZ_ROOT/graphify-out/graph.json" ]; }
|
||||||
|
say $? "8. Мнемозина: $notes нот, битых связей ${broken}, граф дома построен"
|
||||||
|
else skip "8. Мнемозина" "на этой машине нет хранилища знаний"; fi
|
||||||
|
|
||||||
|
# 9. Старый лог перенесён целиком.
|
||||||
|
LES="$HOME/.claude/self-learning/lessons.md"
|
||||||
|
if [ -f "$LES" ]; then
|
||||||
|
m=$(KOIZ_DB="$TMP/mig.jsonl" node "$K" migrate --file "$LES" --json 2>/dev/null \
|
||||||
|
| python3 -c "import json,sys; d=json.load(sys.stdin); print(d['sections'], d['records'], len(d['lost']))" 2>/dev/null || echo "0 0 1")
|
||||||
|
set -- $m
|
||||||
|
{ [ "$1" -ge 13 ] && [ "$2" -ge 60 ] && [ "$3" = 0 ]; }
|
||||||
|
say $? "9. перенос lessons.md: разделов $1, записей $2, потеряно $3"
|
||||||
|
else skip "9. перенос старого лога" "на этой машине нет ~/.claude/self-learning/lessons.md"; fi
|
||||||
|
|
||||||
|
# 10. Хэндофф написан и несёт обязательные разделы.
|
||||||
|
H="$KOIZ_ROOT/docs/HANDOFF.md"
|
||||||
|
if [ -f "$H" ]; then
|
||||||
|
miss=0
|
||||||
|
for sec in "Что сделано" "Что дальше" "Ключевое состояние"; do grep -q "$sec" "$H" || miss=1; done
|
||||||
|
[ "$miss" = 0 ]; say $? "10. docs/HANDOFF.md на месте и полон"
|
||||||
|
else skip "10. хэндофф" "docs/HANDOFF.md в это дерево не входит"; fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
if [ "$fails" != 0 ]; then echo "приёмка: красных пунктов $fails, пропущено $skips"; exit 1; fi
|
||||||
|
if [ "$skips" = 0 ]; then echo "приёмка: все десять пунктов зелёные"; exit 0; fi
|
||||||
|
echo "приёмка: красных нет, пропущено $skips из 10 - этих входов на машине нет"; exit 0
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
// Съём: машина берет с диска то, что видно без агента. Транскрипт сессии и старый
|
||||||
|
// рукописный лог уроков - два входа, оба разбираются детерминированно.
|
||||||
|
//
|
||||||
|
// Граница проведена жестко: здесь НЕ рождается «почему». Машина видит, ЧТО упало,
|
||||||
|
// сколько раз и какой командой; причину знает только тот, кто там был. Поэтому все,
|
||||||
|
// что отсюда выходит, ложится в базу с пустым `why` и закреплением «ничем» - сырьем,
|
||||||
|
// которое агент обязан довести до урока.
|
||||||
|
import { kebab, normalize, fp, redact, tokens } from './koiz-lib.mjs'
|
||||||
|
|
||||||
|
const text = c => {
|
||||||
|
if (typeof c === 'string') return c
|
||||||
|
if (Array.isArray(c)) return c.map(b => (typeof b === 'string' ? b : b?.text || '')).join(' ')
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// Класс из текста ошибки: первые значимые слова нормализованного текста.
|
||||||
|
// Числа, пути и хеши нормализация уже съела, поэтому класс устойчив к месту падения.
|
||||||
|
//
|
||||||
|
// Служебные слова разбора («ошибка», «правило», «системное») выброшены отдельно, и это
|
||||||
|
// не косметика: без этого «**Ошибка → системное правило.**» из трех разных бед дает ОДИН
|
||||||
|
// класс, три несвязанные записи слипаются в мнимый повтор и поднимаются ложным долгом.
|
||||||
|
// Замерено на переносе старого лога 06.09.2026: три ложных долга из трех.
|
||||||
|
const META = new Set(['ошибка', 'ошибки', 'урок', 'уроки', 'правило', 'правила', 'системное',
|
||||||
|
'системные', 'системный', 'причина', 'причины', 'починка', 'фикс', 'аудит', 'вывод', 'итог',
|
||||||
|
'сессия', 'сессии', 'сессию', 'наблюдение', 'заметка', 'случай', 'случая', 'случаев'])
|
||||||
|
|
||||||
|
export function classOf(t) {
|
||||||
|
const all = tokens(normalize(t))
|
||||||
|
const meaty = all.filter(w => !META.has(w))
|
||||||
|
// Если после чистки почти ничего не осталось, служебные слова возвращаем: класс из
|
||||||
|
// одного слова хуже, чем класс со служебным словом, а «без-класса» - хуже обоих.
|
||||||
|
const pick = (meaty.length >= 3 ? meaty : [...meaty, ...all.filter(w => !meaty.includes(w))]).slice(0, 5)
|
||||||
|
return kebab(pick.join(' ')) || 'без-класса'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Пробел после FAIL и регистр - оба значимы. `FAIL ` это маркер прибора, а `fail=0` -
|
||||||
|
// переменная счетчика в выводе того же прибора: со `\b` и флагом /i съем принял ее за
|
||||||
|
// провал и записал ложный урок (замерено на живой сессии 06.09.2026, запись закрыта датой).
|
||||||
|
const MARKERS = /(^|\n)\s*(красный:|FAIL\s|ВЕРДИКТ: красный|🛑|[а-яa-z]+: \d+ дыр|selftest: )/
|
||||||
|
|
||||||
|
// Сработавший сторож - не провал, а работа системы. Блок хука («PreToolUse:Bash hook
|
||||||
|
// error: ... BLOCKED»), запрет гарнесса и голый вердикт без текста несут ноль знания, но
|
||||||
|
// умеют накопить повторы и закрыть ночь долгом на ровном месте. Замерено 06.09.2026:
|
||||||
|
// пять первых долгов живой базы - четыре сторожа и один пустой «ВЕРДИКТ: красный».
|
||||||
|
const NOISE = /hook error:[\s\S]*(BLOCK|БЛОК)|<tool_use_error>\s*Blocked:|^\s*Blocked: /i
|
||||||
|
|
||||||
|
// Улика без содержания уликой не является: «ВЕРДИКТ: красный» повторится сто раз и
|
||||||
|
// ничему не научит. Порог - три значимых слова: ниже отсекается голый вердикт, выше
|
||||||
|
// начали бы теряться настоящие короткие отказы вроде «красный: план не по схеме».
|
||||||
|
const THIN = t => tokens(normalize(t)).length < 3
|
||||||
|
|
||||||
|
// Транскрипт сессии Claude Code (jsonl). Берем три класса улик:
|
||||||
|
// 1) отказ инструмента (tool_result с is_error) - прямой провал;
|
||||||
|
// 2) отказ ворот в выводе Bash - провал прибора, а не инструмента;
|
||||||
|
// 3) одна и та же команда, исполненная трижды - трата, которую агент не заметил.
|
||||||
|
export function captureTranscript(raw, { session = 'сессия', project = 'неизвестно', limit = 8 } = {}) {
|
||||||
|
const uses = new Map()
|
||||||
|
const found = new Map()
|
||||||
|
const cmds = new Map()
|
||||||
|
|
||||||
|
const push = (kind, what, repro, tool) => {
|
||||||
|
if (NOISE.test(String(what)) || THIN(what)) return
|
||||||
|
const key = fp(what)
|
||||||
|
const prev = found.get(key)
|
||||||
|
if (prev) { prev.count++; return }
|
||||||
|
found.set(key, {
|
||||||
|
kind, class: classOf(what), fp: key, count: 1, tool: tool || null,
|
||||||
|
what: redact(String(what).replace(/\s+/g, ' ').trim()).slice(0, 300),
|
||||||
|
repro: repro ? redact(String(repro).replace(/\s+/g, ' ').trim()).slice(0, 200) : null,
|
||||||
|
project, session,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const line of String(raw).split('\n')) {
|
||||||
|
if (!line.trim()) continue
|
||||||
|
let d
|
||||||
|
try { d = JSON.parse(line) } catch { continue }
|
||||||
|
const blocks = Array.isArray(d?.message?.content) ? d.message.content : []
|
||||||
|
for (const b of blocks) {
|
||||||
|
if (b?.type === 'tool_use') {
|
||||||
|
const cmd = b.input?.command || b.input?.file_path || b.input?.pattern || ''
|
||||||
|
uses.set(b.id, { name: b.name, cmd })
|
||||||
|
if (b.name === 'Bash' && cmd) {
|
||||||
|
const k = normalize(cmd)
|
||||||
|
cmds.set(k, { n: (cmds.get(k)?.n || 0) + 1, cmd })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (b?.type === 'tool_result' && b.is_error) {
|
||||||
|
const u = uses.get(b.tool_use_id) || {}
|
||||||
|
push('провал инструмента', text(b.content) || 'ошибка без текста', u.cmd, u.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const tr = d?.toolUseResult
|
||||||
|
if (tr && typeof tr === 'object') {
|
||||||
|
const out = `${tr.stdout || ''}\n${tr.stderr || ''}`
|
||||||
|
if (MARKERS.test(out)) {
|
||||||
|
const hit = out.split('\n').find(l => MARKERS.test(`\n${l}`)) || ''
|
||||||
|
push('отказ ворот', hit, null, 'Bash')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const { n, cmd } of cmds.values()) {
|
||||||
|
if (n >= 3) push('повтор команды', `одна команда исполнена ${n} раз подряд: ${cmd}`, cmd, 'Bash')
|
||||||
|
}
|
||||||
|
|
||||||
|
return [...found.values()].sort((a, b) => b.count - a.count).slice(0, limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
const DATE = t => {
|
||||||
|
const iso = t.match(/(\d{4})-(\d{2})-(\d{2})/)
|
||||||
|
if (iso) return `${iso[1]}-${iso[2]}-${iso[3]}`
|
||||||
|
const ru = t.match(/(\d{2})\.(\d{2})\.(\d{4})/)
|
||||||
|
if (ru) return `${ru[3]}-${ru[2]}-${ru[1]}`
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
// Имя проекта в заголовке пишут как придется - и латиницей, и кириллицей, и никак.
|
||||||
|
// Ищем известные дома по словарю: класс ошибки важнее проекта, но проект нужен для
|
||||||
|
// доказательства кросс-проектности, поэтому угадывать его наугад нельзя.
|
||||||
|
const HOMES = [
|
||||||
|
['olympuz', /olympuz|олимп/i], ['adventure-book', /adventure|adventure-book/i],
|
||||||
|
['helioz', /helioz|гелиоз/i], ['themis', /themis|фемид/i], ['mnemazine', /mnemaz|мнемаз/i],
|
||||||
|
['koiz', /\bkoiz\b|койз/i], ['iriz', /\biriz\b|ирис/i], ['metiz', /metiz|метиз/i],
|
||||||
|
['claude-os', /claude|конституц|правил/i],
|
||||||
|
]
|
||||||
|
const PROJECT = t => (HOMES.find(([, re]) => re.test(t)) || ['разное'])[0]
|
||||||
|
|
||||||
|
// Зачин абзаца в старом логе часто служебный - «Ошибка → правило», «Token-аудит».
|
||||||
|
// Такой зачин классом быть не может: он один на десятки разных бед и склеил бы их в
|
||||||
|
// одну кучу. Служебный зачин отбрасываем и берем первую содержательную фразу.
|
||||||
|
// Не всякая запись старого лога - провал. Токен-аудит, роутинг и заметки о владельце -
|
||||||
|
// наблюдения: у них нет причины, которую можно закрыть механизмом, и долгом они быть
|
||||||
|
// не могут. Иначе ворота красит расход токенов, а это не беда, а факт.
|
||||||
|
const OBSERVE = /(token|аудит|расход|доминант|routing|владельц|что сработало|подтвердилось|экономия)/i
|
||||||
|
|
||||||
|
const GENERIC = /^(ошибк|урок|правил|систем|причин|token|расход|routing|что |про |инцидент|оптимизац|вывод|итог|сработал|данные|наблюден|заметк|аудит|подтвердил|перв|втор|трет|четв|пят|\\d+[.)]|[-—·])/i
|
||||||
|
|
||||||
|
function leadOf(txt) {
|
||||||
|
const head = (txt.match(/^\*\*([^*]+)\*\*/) || txt.match(/^### (.+)/) || [])[1] || txt.split('\n')[0]
|
||||||
|
if (!GENERIC.test(head.trim())) return head.trim()
|
||||||
|
const rest = txt.replace(/^\*\*[^*]+\*\*:?\s*/, '').replace(/^### .+\n/, '').replace(/\s+/g, ' ').trim()
|
||||||
|
// Первое ПРЕДЛОЖЕНИЕ, а не первый обрывок: в старом логе абзац часто начинается с
|
||||||
|
// номера списка («1.»), и без этого фильтра классом становится «ошибки-правила-1».
|
||||||
|
const first = rest.split(/(?<=[.!?])\s/).find(x => tokens(x).length >= 4) || rest
|
||||||
|
return (head.trim() + ' ' + first).replace(/\s+/g, ' ').slice(0, 220)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Кусок «причина → правило» из рукописного лога. Разметка там свободная, поэтому
|
||||||
|
// разбираем по маркерам, а что не разобралось - кладем целиком в `what`: терять нельзя.
|
||||||
|
const AFTER = (body, res) => {
|
||||||
|
for (const re of res) {
|
||||||
|
const m = body.match(re)
|
||||||
|
if (m) return m[1].replace(/\s+/g, ' ').trim().slice(0, 400)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
// Старый лог самообучения. Единица переноса - абзац с жирным зачином, а если их в
|
||||||
|
// разделе нет - весь раздел. Возвращаем еще и перепись разделов: миграция обязана
|
||||||
|
// доказать, что ни один не потерян, а не заявить это.
|
||||||
|
export function parseLessonsMd(raw, { file = 'lessons.md' } = {}) {
|
||||||
|
const lines = String(raw).split('\n')
|
||||||
|
const heads = []
|
||||||
|
lines.forEach((l, i) => { if (/^## /.test(l)) heads.push({ line: i + 1, title: l.slice(3).trim() }) })
|
||||||
|
|
||||||
|
const out = []
|
||||||
|
heads.forEach((h, hi) => {
|
||||||
|
const from = h.line
|
||||||
|
const to = hi + 1 < heads.length ? heads[hi + 1].line - 1 : lines.length
|
||||||
|
const body = lines.slice(from, to)
|
||||||
|
const marks = []
|
||||||
|
body.forEach((l, i) => { if (/^\*\*/.test(l) || /^### /.test(l)) marks.push(i) })
|
||||||
|
const chunks = marks.length
|
||||||
|
? marks.map((m, i) => ({ at: from + m + 1, txt: body.slice(m, i + 1 < marks.length ? marks[i + 1] : body.length).join('\n') }))
|
||||||
|
: [{ at: from, txt: body.join('\n') }]
|
||||||
|
|
||||||
|
for (const c of chunks) {
|
||||||
|
const txt = c.txt.trim()
|
||||||
|
if (!txt) continue
|
||||||
|
const lead = leadOf(txt)
|
||||||
|
const why = AFTER(txt, [/\*\*Причина:?\*\*:?\s*([^\n]+)/i, /[-—·]\s*\*\*Причина:?\*\*\s*([^\n]+)/i, /Причина:\s*([^\n]+)/i])
|
||||||
|
const fix = AFTER(txt, [/→\s*\*\*(?:Системное\s+)?[Пп]равило:?\*\*:?\s*([\s\S]{0,400}?)(?:\n\n|$)/,
|
||||||
|
/\*\*Системное правило:?\*\*:?\s*([^\n]+)/i, /[Пп]равило:\s*([^\n]+)/, /→\s*([^\n]+)/])
|
||||||
|
out.push({
|
||||||
|
kind: OBSERVE.test(lead) ? 'наблюдение' : 'урок',
|
||||||
|
class: classOf(lead),
|
||||||
|
fp: fp(lead + ' ' + (why || '')),
|
||||||
|
project: PROJECT(h.title),
|
||||||
|
date: DATE(h.title),
|
||||||
|
what: redact(lead).replace(/\s+/g, ' ').trim().slice(0, 300),
|
||||||
|
body: redact(txt).slice(0, 1500),
|
||||||
|
why: why ? redact(why) : null,
|
||||||
|
fix: fix ? redact(fix) : null,
|
||||||
|
src: `${file}:${c.at}`,
|
||||||
|
section: h.title,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return { records: out, sections: heads.map(h => h.title) }
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
// Чистые функции Койза: нормализация, отпечаток, похожесть, фильтр секретов.
|
||||||
|
// Здесь нет ни диска, ни сети, ни состояния - поэтому это единственное место,
|
||||||
|
// которое можно судить селфтестом построчно, и его судят.
|
||||||
|
|
||||||
|
// Класс ошибки - ключ базы. Не имя репозитория: одна и та же беда в трёх проектах
|
||||||
|
// должна лечь в один класс, иначе кросс-проектность не работает по построению.
|
||||||
|
export const kebab = s => String(s || '')
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[^\p{L}\p{N}]+/gu, '-')
|
||||||
|
.replace(/^-+|-+$/g, '')
|
||||||
|
.slice(0, 60)
|
||||||
|
|
||||||
|
// Стоп-слова выкидываем до сравнения: без них «не найден файл конфигурации» и
|
||||||
|
// «файл конфигурации не найден» - одно и то же, а с ними - разное.
|
||||||
|
const STOP = new Set(['и','в','на','с','по','из','что','это','для','не','а','но','же','ли','бы',
|
||||||
|
'the','a','an','to','of','in','is','it','at','for','and','or','not','no'])
|
||||||
|
|
||||||
|
export const tokens = s => [...new Set(String(s || '')
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[^\p{L}\p{N}]+/gu, ' ')
|
||||||
|
.split(' ')
|
||||||
|
.filter(w => w.length > 2 && !STOP.has(w)))]
|
||||||
|
|
||||||
|
// Огрубление вместо стеммера: «установлено», «установку» и «установка» - одно слово для
|
||||||
|
// сравнения, но разные слова в тексте урока. Замерено: запрос «браузер не установлен» не
|
||||||
|
// находил урок, где написано «браузерный стек» и «на установку» - выдача врала пустотой.
|
||||||
|
// Полноценная морфология сюда не нужна: пять первых букв закрывают падежи и склонения,
|
||||||
|
// а стеммер - это зависимость, которой у приборов семейства нет.
|
||||||
|
export const stem = w => (w.length > 5 ? w.slice(0, 5) : w)
|
||||||
|
const stems = t => new Set(tokens(t).map(stem))
|
||||||
|
|
||||||
|
// Доля слов запроса, попавших в текст. В отличие от Жаккара не штрафует за длину второй
|
||||||
|
// стороны - именно это нужно, когда короткий запрос сверяют с классом урока.
|
||||||
|
export function covers(query, target) {
|
||||||
|
const Q = stems(query), T = stems(target)
|
||||||
|
if (!Q.size) return 0
|
||||||
|
let hit = 0
|
||||||
|
for (const t of Q) if (T.has(t)) hit++
|
||||||
|
return hit / Q.size
|
||||||
|
}
|
||||||
|
|
||||||
|
export function jaccard(a, b) {
|
||||||
|
const A = stems(a), B = stems(b)
|
||||||
|
if (!A.size || !B.size) return 0
|
||||||
|
let inter = 0
|
||||||
|
for (const t of A) if (B.has(t)) inter++
|
||||||
|
return inter / (A.size + B.size - inter)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Отпечаток: та же ошибка с другими путями, числами и хешами обязана дать тот же
|
||||||
|
// отпечаток, иначе повтор не будет виден как повтор и долг никогда не всплывет.
|
||||||
|
export function normalize(text) {
|
||||||
|
return String(text || '')
|
||||||
|
.replace(/\S*\/\S*/g, '/PATH')
|
||||||
|
.replace(/\b[0-9a-f]{7,64}\b/gi, 'HEX')
|
||||||
|
.replace(/\b\d+(\.\d+)?\b/g, 'N')
|
||||||
|
.replace(/\s+/g, ' ')
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
export const fp = text => {
|
||||||
|
const h = String(normalize(text))
|
||||||
|
let x = 0n
|
||||||
|
for (const ch of h) x = (x * 131n + BigInt(ch.codePointAt(0))) % (2n ** 64n)
|
||||||
|
return x.toString(16).padStart(16, '0').slice(0, 12)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Фильтр секретов. Уроки несут пути, куски команд и вывод - там встречаются ключи.
|
||||||
|
// Правило владельца: секрет не ложится ни в код, ни в git, ни в базу. Режем на записи,
|
||||||
|
// а не при выдаче: то, чего в файле нет, не утечет ни через какой канал.
|
||||||
|
const SECRETS = [
|
||||||
|
[/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, '***PRIVATE-KEY***'],
|
||||||
|
[/sk-ant-[A-Za-z0-9_-]{12,}/g, 'sk-ant-***'],
|
||||||
|
[/\bsk-[A-Za-z0-9]{20,}/g, 'sk-***'],
|
||||||
|
[/\bgh[pousr]_[A-Za-z0-9]{20,}/g, 'gh_***'],
|
||||||
|
[/\bglpat-[A-Za-z0-9_-]{12,}/g, 'glpat-***'],
|
||||||
|
[/\bAKIA[0-9A-Z]{16}\b/g, 'AKIA***'],
|
||||||
|
[/\bxox[baprs]-[A-Za-z0-9-]{12,}/g, 'xox-***'],
|
||||||
|
[/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{6,}/g, 'jwt.***'],
|
||||||
|
[/\bBearer\s+[A-Za-z0-9._~+/-]{16,}=*/gi, 'Bearer ***'],
|
||||||
|
[/((?:password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key)\s*[=:]\s*)["']?[^\s"',;)]{6,}/gi, '$1***'],
|
||||||
|
]
|
||||||
|
|
||||||
|
export function redact(text) {
|
||||||
|
let out = String(text ?? '')
|
||||||
|
for (const [re, to] of SECRETS) out = out.replace(re, to)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PINS = ['hook', 'deny', 'прибор', 'тест', 'ничем']
|
||||||
|
|
||||||
|
// Развернуть ~ в домашний путь: закрепление называют человеческим путем.
|
||||||
|
export const expand = p => String(p || '').replace(/^~(?=\/|$)/, process.env.HOME || '')
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// Мутационные ворота селфтеста: селфтест, не краснеющий от сломанного правила, ничего
|
||||||
|
// не проверяет. Та же логика, что у ворот задачи в Гелиозе (проба обязана покраснеть на
|
||||||
|
// сломанной копии), только объект - сам Койз.
|
||||||
|
//
|
||||||
|
// Повод измеренный: за сессию сборки 06.09.2026 мутации нашли четыре молчащих места -
|
||||||
|
// отчет миграции «не потеряно», схлопывание дублей, столкновение имен нот и связи по id
|
||||||
|
// вместо имени. Практика стала прибором, чтобы не зависеть от памяти следующей сессии.
|
||||||
|
//
|
||||||
|
// Работает на КОПИИ в TMPDIR, рабочие файлы не трогает. Коды: 0 все пойманы · 1 выжившие.
|
||||||
|
import { mkdtempSync, cpSync, readFileSync, writeFileSync, rmSync } from 'node:fs'
|
||||||
|
import { execFileSync } from 'node:child_process'
|
||||||
|
import path from 'node:path'
|
||||||
|
import os from 'node:os'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
const SRC = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
const json = process.argv.includes('--json')
|
||||||
|
|
||||||
|
// файл · что сломать · чем заменить · как это называется
|
||||||
|
const MUTS = [
|
||||||
|
['koiz.mjs', 'const twin = [...st.L.values()].find(l => l.fp === fpv)', 'const twin = null', 'повтор пишется второй записью, а не hit'],
|
||||||
|
['koiz.mjs', 'export const active = st => [...st.L.values()].filter(l => !l.closed)', 'export const active = st => [...st.L.values()]', 'закрытое датой остается в выдаче'],
|
||||||
|
['koiz.mjs', 'if (group.length < 3) continue', 'if (group.length < 99) continue', 'три похожих не поднимаются в правило'],
|
||||||
|
['koiz.mjs', 'if (jaccard(textOf(act[i]), textOf(act[j])) >= 0.8) {', 'if (false) {', 'дубли не схлопываются'],
|
||||||
|
['koiz.mjs', 'if (before <= budget) return { before, after: before, collapsed: false, overflow: false }', 'if (true) return { before, after: before, collapsed: false, overflow: false }', 'бюджет не заставляет схлопывать'],
|
||||||
|
['koiz.mjs', 'res.lost = lostSrcs(parsed.records, readOps(db))', 'res.lost = []', 'миграция теряет записи молча'],
|
||||||
|
['koiz.mjs', '} catch (e) { res.failed.push({ src: r.src, why: e.message }) }', '} catch (e) { res.added++ }', 'падение записи проглочено'],
|
||||||
|
['koiz.mjs', 'if (!existsSync(expand(f.pin_ref))) throw new Error', 'if (false) throw new Error', 'закрепление не проверяется на диске'],
|
||||||
|
['koiz.mjs', 'if (taken.has(safe(title))) title =', 'if (false) title =', 'имена нот сталкиваются и затирают друг друга'],
|
||||||
|
['koiz.mjs', 'links.map(x => `- [[${titles.get(x)}]]`)', 'links.map(x => `- [[koiz-${x}]]`)', 'связи ведут на id, который Obsidian не резолвит'],
|
||||||
|
['koiz.mjs', 'if (!f.src && session && st.seen.has(`${fpv}|${session}`)) {', 'if (false) {', 'съем не идемпотентен'],
|
||||||
|
['koiz.mjs', '.filter(x => x.s >= 0.45).sort((a, b) => b.s - a.s).slice(0, 3)', '.filter(x => false).slice(0, 3)', 'связи с соседями не ставятся'],
|
||||||
|
['koiz.mjs', "g.items.every(l => l.pin === 'ничем')", 'false', 'долг не считается'],
|
||||||
|
['koiz.mjs', "(l.acks || []).some(a => !a.until || a.until >= day)", '(l.acks || []).length > 0', 'отсрочка не имеет срока'],
|
||||||
|
['koiz.mjs', '+ 0.6 * covers(q, l.class.replace(/-/g, \' \'))', '+ 0', 'попадание запроса в класс не весит - выдача отдает случайное'],
|
||||||
|
['koiz-capture.mjs', 'красный:|FAIL\\s|', 'красный:|FAIL\\b|', 'маркер провала ловит счетчики вида FAIL=0'],
|
||||||
|
['koiz-capture.mjs', 'if (NOISE.test(String(what)) || THIN(what)) return', 'if (false) return', 'работа сторожа записывается уроком'],
|
||||||
|
['koiz-lib.mjs', 'const stems = t => new Set(tokens(t).map(stem))', 'const stems = t => new Set(tokens(t))', 'сравнение без огрубления - морфология ломает выдачу'],
|
||||||
|
['koiz-lib.mjs', 'for (const [re, to] of SECRETS) out = out.replace(re, to)', 'for (const [re, to] of []) out = out.replace(re, to)', 'фильтр секретов выключен'],
|
||||||
|
]
|
||||||
|
|
||||||
|
const tmp = mkdtempSync(path.join(os.tmpdir(), 'koiz-mutate-'))
|
||||||
|
const results = []
|
||||||
|
try {
|
||||||
|
for (const [file, from, to, name] of MUTS) {
|
||||||
|
cpSync(SRC, tmp, { recursive: true })
|
||||||
|
const p = path.join(tmp, file)
|
||||||
|
const src = readFileSync(p, 'utf8')
|
||||||
|
if (!src.includes(from)) { results.push({ name, verdict: 'якорь не найден - мутация устарела' }); continue }
|
||||||
|
writeFileSync(p, src.replace(from, to))
|
||||||
|
let code = 0
|
||||||
|
try { execFileSync('node', [path.join(tmp, 'koiz.mjs'), '--selftest'], { stdio: 'pipe', timeout: 120000 }) }
|
||||||
|
catch { code = 1 }
|
||||||
|
results.push({ name, verdict: code ? 'поймана' : 'ВЫЖИЛА' })
|
||||||
|
}
|
||||||
|
} finally { rmSync(tmp, { recursive: true, force: true }) }
|
||||||
|
|
||||||
|
const bad = results.filter(r => r.verdict !== 'поймана')
|
||||||
|
if (json) console.log(JSON.stringify({ total: results.length, survived: bad.length, results }, null, 2))
|
||||||
|
else {
|
||||||
|
for (const r of results) console.log(` ${r.verdict === 'поймана' ? '✓' : '✗'} ${r.name} — ${r.verdict}`)
|
||||||
|
console.log(bad.length ? `мутации: выжило ${bad.length} из ${results.length} - селфтест их не судит`
|
||||||
|
: `мутации: все ${results.length} пойманы - селфтест судит логику, а не наличие функций`)
|
||||||
|
}
|
||||||
|
process.exit(bad.length ? 1 : 0)
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# SessionEnd-хук: закрытие сессии кладет уроки в базу Койза без ручного набора.
|
||||||
|
# Контракт хука: stdin = JSON с transcript_path и cwd. Тихий и не падающий: хук,
|
||||||
|
# который ломает выход из сессии, хуже отсутствующего хука.
|
||||||
|
set -uo pipefail
|
||||||
|
|
||||||
|
# Прибор ищется рядом с хуком, а не по домашнему каталогу владельца: у чужой
|
||||||
|
# машины нет ~/Проекты, и клон лежит там, где его положили.
|
||||||
|
DOM="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
KOIZ="${KOIZ_HOME:-$DOM}/scripts/koiz.mjs"
|
||||||
|
LOG="$HOME/.claude/koiz/capture.log"
|
||||||
|
[ -f "$KOIZ" ] || exit 0
|
||||||
|
|
||||||
|
IN=$(cat 2>/dev/null || true)
|
||||||
|
read -r TP CWD <<EOF
|
||||||
|
$(printf '%s' "$IN" | python3 -c "
|
||||||
|
import sys, json
|
||||||
|
try:
|
||||||
|
d = json.load(sys.stdin)
|
||||||
|
print(d.get('transcript_path', '-'), d.get('cwd', '-'))
|
||||||
|
except Exception:
|
||||||
|
print('- -')
|
||||||
|
" 2>/dev/null || echo '- -')
|
||||||
|
EOF
|
||||||
|
|
||||||
|
[ -n "${TP:-}" ] && [ "$TP" != "-" ] && [ -f "$TP" ] || exit 0
|
||||||
|
PROJECT=$(basename "${CWD:-$PWD}")
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "$LOG")"
|
||||||
|
{
|
||||||
|
printf '── %s · %s\n' "$(date '+%F %T')" "$PROJECT"
|
||||||
|
node "$KOIZ" capture --transcript "$TP" --project "$PROJECT" 2>&1
|
||||||
|
} >> "$LOG" 2>/dev/null || true
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,815 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// Койз - дознаватель роя. Одна база уроков на все проекты владельца.
|
||||||
|
//
|
||||||
|
// Не память: память уже есть (Мнемозина). Дисциплина уроков: довести провал до причины
|
||||||
|
// и закрыть причину прибором. Центральное поле записи - «чем закреплено»; урок, который
|
||||||
|
// нечем закрепить, - жалоба, а не урок.
|
||||||
|
//
|
||||||
|
// Три вещи разведены сознательно, их путают все, и от этого база гниет:
|
||||||
|
// съем - дешево, детерминированно, машиной (koiz-capture.mjs);
|
||||||
|
// хранение - append-only, ничего не перезаписывается (как ушел mem0 от inline-слияния);
|
||||||
|
// схлопывание - отдельный осознанный проход, не побочный эффект записи.
|
||||||
|
//
|
||||||
|
// Журнал: $KOIZ_DB, по умолчанию ~/.claude/koiz/lessons.jsonl - ВНЕ репозитория.
|
||||||
|
// Уроки несут пути, имена и куски команд; в git такому не место, а фильтр секретов
|
||||||
|
// стоит на записи (koiz-lib.mjs, redact) - того, чего в файле нет, не утечет никуда.
|
||||||
|
//
|
||||||
|
// Коды: 0 чисто · 1 красный (дыра, долг, переполнение) · 2 нет входа.
|
||||||
|
import { readFileSync, existsSync, appendFileSync, mkdirSync, writeFileSync, mkdtempSync, rmSync, readdirSync, realpathSync } from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import os from 'node:os'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
import { kebab, tokens, jaccard, covers, normalize, fp, redact, PINS, expand } from './koiz-lib.mjs'
|
||||||
|
import { captureTranscript, parseLessonsMd, classOf } from './koiz-capture.mjs'
|
||||||
|
|
||||||
|
const DB = process.env.KOIZ_DB || path.join(os.homedir(), '.claude', 'koiz', 'lessons.jsonl')
|
||||||
|
const BUDGET = Number(process.env.KOIZ_BUDGET || 300)
|
||||||
|
const VAULT = process.env.KOIZ_VAULT || path.join(os.homedir(), 'Мозг', '08 AI и Инструменты', 'Уроки Койза')
|
||||||
|
const today = () => new Date().toISOString().slice(0, 10)
|
||||||
|
const now = () => new Date().toISOString()
|
||||||
|
|
||||||
|
// ── Хранение ───────────────────────────────────────────────────────────────────
|
||||||
|
export const readOps = (db = DB) => (existsSync(db) ? readFileSync(db, 'utf8').split('\n') : [])
|
||||||
|
.filter(l => l.trim()).map(l => { try { return JSON.parse(l) } catch { return null } }).filter(Boolean)
|
||||||
|
|
||||||
|
export function writeOps(db, ops) {
|
||||||
|
mkdirSync(path.dirname(db), { recursive: true })
|
||||||
|
appendFileSync(db, ops.map(o => JSON.stringify(o)).join('\n') + '\n')
|
||||||
|
return ops
|
||||||
|
}
|
||||||
|
|
||||||
|
// Состояние - проигрывание журнала. Никакой строки журнала мы не трогаем: закрытие,
|
||||||
|
// связь и отсрочка - такие же дописанные операции, как и сам урок.
|
||||||
|
export function replay(ops) {
|
||||||
|
const L = new Map(), R = new Map(), seen = new Set()
|
||||||
|
const target = id => L.get(id) || R.get(id)
|
||||||
|
for (const o of ops) {
|
||||||
|
if (o.op === 'add') { L.set(o.id, { ...o, hits: [], links: new Set(o.links || []), closed: null, acks: [] }); seen.add(`${o.fp}|${o.session || ''}`) }
|
||||||
|
else if (o.op === 'rule') R.set(o.id, { ...o, hits: [], links: new Set(), closed: null, acks: [] })
|
||||||
|
else if (o.op === 'hit') { const t = L.get(o.ref); if (t) t.hits.push(o); seen.add(`${o.fp}|${o.session || ''}`) }
|
||||||
|
else if (o.op === 'close') { const t = target(o.ref); if (t) t.closed = o }
|
||||||
|
else if (o.op === 'ack') { const t = target(o.ref); if (t) t.acks.push(o) }
|
||||||
|
else if (o.op === 'link') { const a = L.get(o.ref), b = L.get(o.to); if (a) a.links.add(o.to); if (b) b.links.add(o.ref) }
|
||||||
|
}
|
||||||
|
return { L, R, seen }
|
||||||
|
}
|
||||||
|
|
||||||
|
export const state = (db = DB) => replay(readOps(db))
|
||||||
|
export const active = st => [...st.L.values()].filter(l => !l.closed)
|
||||||
|
export const activeRules = st => [...st.R.values()].filter(r => !r.closed)
|
||||||
|
export const occ = l => 1 + (l.hits?.length || 0)
|
||||||
|
const textOf = l => [l.what, l.why, l.fix].filter(Boolean).join(' ')
|
||||||
|
const ackLive = (l, day = today()) => (l.acks || []).some(a => !a.until || a.until >= day)
|
||||||
|
|
||||||
|
function nextId(st, prefix, fpv) {
|
||||||
|
const base = `${prefix}-${today().replace(/-/g, '')}-${(fpv || '').slice(0, 4) || 'x'}`
|
||||||
|
let id = base, n = 1
|
||||||
|
while (st.L.has(id) || st.R.has(id)) id = `${base}-${++n}`
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Запись урока ───────────────────────────────────────────────────────────────
|
||||||
|
// Правило записи одно: ADD-only. Тот же отпечаток в новом прогоне дает не вторую
|
||||||
|
// запись, а `hit` к первой - иначе повтор не виден как повтор и долг не всплывает.
|
||||||
|
export function addLesson(f, db = DB) {
|
||||||
|
if (!f.what || !String(f.what).trim()) throw new Error('нечего записывать: --what обязателен')
|
||||||
|
const pin = f.pin || 'ничем'
|
||||||
|
if (!PINS.includes(pin)) throw new Error(`закрепление «${pin}» не из списка: ${PINS.join(' · ')}`)
|
||||||
|
if (pin !== 'ничем') {
|
||||||
|
if (!f.pin_ref) throw new Error('закрепление названо, но не сказано чем: нужен --pin-ref <путь к механизму>')
|
||||||
|
if (!existsSync(expand(f.pin_ref))) throw new Error(`механизма нет на диске: ${f.pin_ref} - закрепление показывают, а не заявляют`)
|
||||||
|
}
|
||||||
|
const st = state(db)
|
||||||
|
const what = redact(f.what).trim()
|
||||||
|
const why = f.why ? redact(f.why).trim() : null
|
||||||
|
const fix = f.fix ? redact(f.fix).trim() : null
|
||||||
|
const cls = kebab(f.class || classOf(what))
|
||||||
|
const fpv = f.fp || fp(`${what} ${why || ''}`)
|
||||||
|
const session = f.session || null
|
||||||
|
|
||||||
|
// Тот же прогон уже это записал - молчим. Съем идет на каждом закрытии сессии и
|
||||||
|
// обязан быть идемпотентным, иначе повторный хук надует базу мнимыми повторами.
|
||||||
|
if (!f.src && session && st.seen.has(`${fpv}|${session}`)) {
|
||||||
|
const t = [...st.L.values()].find(l => l.fp === fpv)
|
||||||
|
return { op: 'seen', id: t?.id || null }
|
||||||
|
}
|
||||||
|
const twin = [...st.L.values()].find(l => l.fp === fpv)
|
||||||
|
if (twin) {
|
||||||
|
writeOps(db, [{ op: 'hit', ref: twin.id, at: now(), fp: fpv, project: f.project || null, session, src: f.src || null }])
|
||||||
|
return { op: 'hit', id: twin.id, occ: occ(twin) + 1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = nextId(st, 'L', fpv)
|
||||||
|
// Цеттелькастен: новая запись сама ищет соседей и правит их - дописанной связью,
|
||||||
|
// а не переписью. Сосед узнает о новичке, не потеряв ни байта своей истории.
|
||||||
|
const neigh = active(st)
|
||||||
|
.map(l => ({ id: l.id, s: (l.class === cls ? 0.5 : 0) + jaccard(textOf(l), `${what} ${why || ''}`) }))
|
||||||
|
.filter(x => x.s >= 0.45).sort((a, b) => b.s - a.s).slice(0, 3).map(x => x.id)
|
||||||
|
|
||||||
|
const rec = {
|
||||||
|
op: 'add', id, at: now(), fp: fpv, class: cls,
|
||||||
|
project: f.project || 'разное', kind: f.kind || 'урок', origin: f.origin || 'агент',
|
||||||
|
what, why, fix, repro: f.repro ? redact(f.repro) : null,
|
||||||
|
pin, pin_ref: f.pin_ref || null,
|
||||||
|
valid_from: f.valid_from || today(), valid_to: null,
|
||||||
|
links: neigh, session, src: f.src || null, body: f.body ? redact(f.body) : null,
|
||||||
|
}
|
||||||
|
writeOps(db, [rec, ...neigh.map(n => ({ op: 'link', ref: n, to: id, at: now() }))])
|
||||||
|
return { op: 'add', id, links: neigh }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Двувременность ─────────────────────────────────────────────────────────────
|
||||||
|
// Устаревший урок не ложь и не мусор: он просто больше не действует. Закрываем датой,
|
||||||
|
// из выдачи убираем, из истории - никогда.
|
||||||
|
export function closeLesson(id, why, db = DB) {
|
||||||
|
const st = state(db)
|
||||||
|
const t = st.L.get(id) || st.R.get(id)
|
||||||
|
if (!t) throw new Error(`нет такой записи: ${id}`)
|
||||||
|
if (t.closed) return { op: 'уже закрыт', id, at: t.closed.at }
|
||||||
|
writeOps(db, [{ op: 'close', ref: id, at: now(), valid_to: today(), why: why || 'без причины' }])
|
||||||
|
return { op: 'close', id }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ackDebt(id, until, why, db = DB) {
|
||||||
|
const st = state(db)
|
||||||
|
if (!st.L.get(id) && !st.R.get(id)) throw new Error(`нет такой записи: ${id}`)
|
||||||
|
writeOps(db, [{ op: 'ack', ref: id, at: now(), until: until || null, why: why || 'отсрочка без причины' }])
|
||||||
|
return { op: 'ack', id, until }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Выдача ─────────────────────────────────────────────────────────────────────
|
||||||
|
// Отбор как в generative_agents: релевантность + важность (сколько раз повторилось)
|
||||||
|
// + свежесть. Ключ поиска - класс ошибки, поэтому урок из adventure-book находится
|
||||||
|
// из themis: база одна, имя репозитория в ключ не входит.
|
||||||
|
export function ask(q, { project = null, cls = null, limit = 10, db = DB } = {}) {
|
||||||
|
const st = state(db)
|
||||||
|
const day = Date.now()
|
||||||
|
const items = [...active(st), ...activeRules(st)]
|
||||||
|
const scored = items.map(l => {
|
||||||
|
const t = textOf(l)
|
||||||
|
// Класс - выжимка урока, и попадание запроса в класс весит больше, чем совпадение
|
||||||
|
// слов в длинном тексте: иначе урок «инструмент врёт не установлено» проигрывает
|
||||||
|
// случайной записи, где слово «установка» встретилось в проходной фразе.
|
||||||
|
const rel = q
|
||||||
|
? jaccard(q, t) + (normalize(t).includes(normalize(q)) ? 0.5 : 0) + 0.6 * covers(q, l.class.replace(/-/g, ' '))
|
||||||
|
: 0.5
|
||||||
|
const days = (day - Date.parse(l.at)) / 86400000
|
||||||
|
const score = 0.6 * Math.min(rel, 1) + 0.25 * Math.min(occ(l) / 5, 1) + 0.15 / (1 + days / 90)
|
||||||
|
return { l, rel, score }
|
||||||
|
}).filter(x => (!q || x.rel > 0) && (!project || x.l.project === project) && (!cls || x.l.class === cls))
|
||||||
|
return scored.sort((a, b) => b.score - a.score).slice(0, limit).map(x => ({
|
||||||
|
id: x.l.id, class: x.l.class, project: x.l.project, kind: x.l.op === 'rule' ? 'правило' : x.l.kind,
|
||||||
|
occ: occ(x.l), pin: x.l.pin, pin_ref: x.l.pin_ref || null,
|
||||||
|
what: x.l.what || x.l.text, why: x.l.why || null, fix: x.l.fix || null, score: +x.score.toFixed(3),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
export const history = (id, db = DB) => readOps(db).filter(o => o.id === id || o.ref === id || o.to === id)
|
||||||
|
|
||||||
|
// Похожие записи в одну кучу: тот же класс ИЛИ достаточно общих слов. Одна функция на
|
||||||
|
// два вызова - схлопывание и поиск долга обязаны считать похожесть одинаково, иначе
|
||||||
|
// база схлопывает одно, а долгом называет другое.
|
||||||
|
export function cluster(items, threshold = 0.5) {
|
||||||
|
const used = new Set(), groups = []
|
||||||
|
for (const seed of items) {
|
||||||
|
if (used.has(seed.id)) continue
|
||||||
|
const g = items.filter(l => !used.has(l.id) && (l.class === seed.class || jaccard(textOf(seed), textOf(l)) >= threshold))
|
||||||
|
g.forEach(l => used.add(l.id))
|
||||||
|
groups.push(g)
|
||||||
|
}
|
||||||
|
return groups
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Долг ───────────────────────────────────────────────────────────────────────
|
||||||
|
// То, чего нет ни у одного источника: урок, повторившийся дважды и не закрепленный
|
||||||
|
// ничем, - это долг владельца. Либо механизм, либо признаем, что правило не работает.
|
||||||
|
export function debts({ db = DB, day = today() } = {}) {
|
||||||
|
const st = state(db)
|
||||||
|
// Долг считается только по провалам. Наблюдение (расход, роутинг, заметка о владельце)
|
||||||
|
// механизмом не закрывается по природе, и требовать от него закрепления - шум в воротах.
|
||||||
|
const fails = [...active(st), ...activeRules(st)].filter(l => l.kind !== 'наблюдение')
|
||||||
|
// Повтор ищем кучей, а не точным совпадением класса: одна и та же беда в двух проектах
|
||||||
|
// описана разными словами, и по точному классу она навсегда останется двумя одиночками.
|
||||||
|
return cluster(fails, 0.55)
|
||||||
|
.map(g => ({
|
||||||
|
class: g[0].class, occ: g.reduce((a, l) => a + occ(l), 0), items: g,
|
||||||
|
ids: g.map(l => l.id), projects: [...new Set(g.map(l => l.project || 'разное'))],
|
||||||
|
}))
|
||||||
|
.filter(g => g.occ >= 2 && g.items.every(l => l.pin === 'ничем') && !g.items.some(l => ackLive(l, day)))
|
||||||
|
.map(({ items, ...rest }) => rest)
|
||||||
|
.sort((a, b) => b.occ - a.occ)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Схлопывание ────────────────────────────────────────────────────────────────
|
||||||
|
// Отдельный осознанный проход. На записи не сливаем ничего - именно от inline-слияния
|
||||||
|
// ушел mem0: оно дорогое и теряет данные. Здесь: дубли закрываются как дубли, три
|
||||||
|
// похожих урока поднимаются в правило (дерево рефлексии), правило само становится узлом.
|
||||||
|
export function collapse({ db = DB, apply = true } = {}) {
|
||||||
|
const st = state(db)
|
||||||
|
const act = active(st).sort((a, b) => Date.parse(a.at) - Date.parse(b.at))
|
||||||
|
const ops = [], dups = [], rules = []
|
||||||
|
const dead = new Set()
|
||||||
|
|
||||||
|
for (let i = 0; i < act.length; i++) {
|
||||||
|
if (dead.has(act[i].id)) continue
|
||||||
|
for (let j = i + 1; j < act.length; j++) {
|
||||||
|
if (dead.has(act[j].id)) continue
|
||||||
|
if (jaccard(textOf(act[i]), textOf(act[j])) >= 0.8) {
|
||||||
|
dead.add(act[j].id); dups.push({ dup: act[j].id, of: act[i].id })
|
||||||
|
ops.push({ op: 'close', ref: act[j].id, at: now(), valid_to: today(), why: `дубль ${act[i].id}` })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const left = act.filter(l => !dead.has(l.id))
|
||||||
|
let n = st.R.size
|
||||||
|
for (const group of cluster(left, 0.5)) {
|
||||||
|
if (group.length < 3) continue
|
||||||
|
const seed = group[0]
|
||||||
|
const projects = [...new Set(group.map(l => l.project))]
|
||||||
|
const why = group.map(l => l.why).filter(Boolean)[0] || 'причина не дознана'
|
||||||
|
const fix = group.map(l => l.fix).filter(Boolean)[0] || 'починка не записана'
|
||||||
|
const pin = group.every(l => l.pin !== 'ничем') ? group[0].pin : 'ничем'
|
||||||
|
const id = `R-${String(++n).padStart(3, '0')}`
|
||||||
|
// Правило обязано находиться теми же словами, что и члены: после схлопывания
|
||||||
|
// члены закрыты, и если текст правила их слов не несет, запрос перестанет их видеть.
|
||||||
|
const text = `${seed.class}: ${group.length} случая в проектах ${projects.join(', ')}. `
|
||||||
|
+ `Например: ${group.map(l => l.what).join(' | ')}. Причина: ${why} Починка: ${fix}`
|
||||||
|
rules.push({ id, from: group.map(l => l.id), text, pin })
|
||||||
|
ops.push({ op: 'rule', id, at: now(), class: seed.class, project: projects.join('+'), kind: 'правило',
|
||||||
|
from: group.map(l => l.id), text, what: text, why, fix, pin, pin_ref: pin === 'ничем' ? null : group[0].pin_ref,
|
||||||
|
valid_from: today(), valid_to: null, fp: fp(text) })
|
||||||
|
for (const l of group) ops.push({ op: 'close', ref: l.id, at: now(), valid_to: today(), why: `схлопнут в ${id}` })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apply && ops.length) writeOps(db, ops)
|
||||||
|
return { dups, rules, ops: ops.length, before: act.length, after: apply ? active(state(db)).length + activeRules(state(db)).length : act.length }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Бюджет ─────────────────────────────────────────────────────────────────────
|
||||||
|
// Потолок как у letta: переполнение ЗАСТАВЛЯЕТ обобщать. Без потолка база растет вечно
|
||||||
|
// и через год превращается в стену текста, которую никто не читает, - то есть в ничто.
|
||||||
|
export function enforceBudget({ db = DB, budget = BUDGET } = {}) {
|
||||||
|
const size = () => { const s = state(db); return active(s).length + activeRules(s).length }
|
||||||
|
const before = size()
|
||||||
|
if (before <= budget) return { before, after: before, collapsed: false, overflow: false }
|
||||||
|
const c = collapse({ db, apply: true })
|
||||||
|
const after = size()
|
||||||
|
return { before, after, collapsed: true, rules: c.rules.length, dups: c.dups.length, overflow: after > budget }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Съем с живой сессии ────────────────────────────────────────────────────────
|
||||||
|
// Закрытие сессии кладет в базу то, что видно с диска: отказы инструментов, отказы
|
||||||
|
// ворот, одну команду, повторенную трижды. Причину машина не выдумывает - `why` пуст,
|
||||||
|
// закрепление «ничем». Это сырье, и оно честно помечено сырьем.
|
||||||
|
export function captureSession({ transcript, project = null, db = DB, limit = 8 } = {}) {
|
||||||
|
if (!transcript || !existsSync(transcript)) return { error: `нет транскрипта: ${transcript}`, code: 2 }
|
||||||
|
const session = path.basename(transcript).replace(/\.jsonl$/, '')
|
||||||
|
const obs = captureTranscript(readFileSync(transcript, 'utf8'), { session, project: project || 'разное', limit })
|
||||||
|
const out = { session, seen: 0, added: [], hits: [] }
|
||||||
|
for (const o of obs) {
|
||||||
|
const r = addLesson({ ...o, origin: 'машина', kind: o.kind, pin: 'ничем', why: null, session }, db)
|
||||||
|
if (r.op === 'add') out.added.push(r.id)
|
||||||
|
else if (r.op === 'hit') out.hits.push(r.id)
|
||||||
|
else out.seen++
|
||||||
|
}
|
||||||
|
out.budget = enforceBudget({ db })
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Миграция старого лога ──────────────────────────────────────────────────────
|
||||||
|
// Вход, а не мусор. Терять нельзя ни одной записи, и это проверяется, а не обещается:
|
||||||
|
// у каждой записи есть `src` вида `lessons.md:<строка>`, и после переноса мы требуем,
|
||||||
|
// чтобы КАЖДЫЙ исходный `src` нашелся в журнале.
|
||||||
|
// Что не доехало: исходные записи, чьего `src` нет в журнале. Отдельная чистая функция,
|
||||||
|
// потому что ее судят селфтестом в обе стороны - и когда все на месте, и когда потеряно.
|
||||||
|
export const lostSrcs = (records, ops) => {
|
||||||
|
const srcs = new Set(ops.map(o => o.src).filter(Boolean))
|
||||||
|
return records.filter(r => r.src && !srcs.has(r.src)).map(r => r.src)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function migrate({ file, db = DB } = {}) {
|
||||||
|
if (!file || !existsSync(file)) return { error: `нет файла: ${file}`, code: 2 }
|
||||||
|
const parsed = parseLessonsMd(readFileSync(file, 'utf8'), { file: path.basename(file) })
|
||||||
|
const session = `migrate:${path.basename(file)}`
|
||||||
|
const res = { file, sections: parsed.sections.length, records: parsed.records.length, added: 0, hits: 0, failed: [], lost: [] }
|
||||||
|
for (const r of parsed.records) {
|
||||||
|
try {
|
||||||
|
const out = addLesson({ ...r, origin: 'миграция', session, valid_from: r.date || today() }, db)
|
||||||
|
if (out.op === 'add') res.added++; else res.hits++
|
||||||
|
} catch (e) { res.failed.push({ src: r.src, why: e.message }) }
|
||||||
|
}
|
||||||
|
// Потерю ищем НЕ по счетчикам, а по диску: каждая исходная запись обязана найтись
|
||||||
|
// в журнале своим `src`. Счетчик врет вместе с кодом, диск - нет.
|
||||||
|
res.lost = lostSrcs(parsed.records, readOps(db))
|
||||||
|
res.code = res.lost.length ? 1 : 0
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Мнемозина ──────────────────────────────────────────────────────────────────
|
||||||
|
// Вторую базу знаний не заводим: уроки уходят нотами в существующий vault, связи
|
||||||
|
// ставим wikilinks, граф строит Graphify. Пишем только в свою папку и только новое.
|
||||||
|
// В базу знаний уходит ЗНАНИЕ, а не сырье. Урок, снятый машиной, причины еще не имеет
|
||||||
|
// (why пуст) - ему в vault рано: нота без «почему» засоряет граф и врет полнотой.
|
||||||
|
// Уходят: правила, уроки с дознанной причиной, повторы и все закрепленное механизмом.
|
||||||
|
export function exportVault({ db = DB, dir = VAULT, minOcc = 2 } = {}) {
|
||||||
|
const st = state(db)
|
||||||
|
const rules = activeRules(st)
|
||||||
|
const lessons = active(st).filter(l => l.origin !== 'машина' || occ(l) >= minOcc || l.pin !== 'ничем')
|
||||||
|
mkdirSync(dir, { recursive: true })
|
||||||
|
const safe = s => String(s).replace(/[\/\\:*?"<>|]/g, '-').slice(0, 70)
|
||||||
|
const written = []
|
||||||
|
|
||||||
|
// Имена считаем ДО записи: связь в Obsidian ведет по имени ноты, а не по id из
|
||||||
|
// frontmatter. Без этой раскладки ссылки урок→урок битые, и граф рассыпается.
|
||||||
|
const taken = new Set()
|
||||||
|
const titles = new Map()
|
||||||
|
for (const [l, kind] of [...rules.map(r => [r, 'Правило']), ...lessons.map(x => [x, 'Урок'])]) {
|
||||||
|
let title = `${kind} — ${l.class}`
|
||||||
|
if (taken.has(safe(title))) title = `${title} (${l.id})`
|
||||||
|
taken.add(safe(title))
|
||||||
|
titles.set(l.id, safe(title))
|
||||||
|
}
|
||||||
|
|
||||||
|
const note = (l, kind) => {
|
||||||
|
const title = titles.get(l.id)
|
||||||
|
const file = path.join(dir, `${title}.md`)
|
||||||
|
const links = [...(l.links || []), ...(l.from || [])].filter(x => titles.has(x)).slice(0, 5)
|
||||||
|
const body = `---
|
||||||
|
id: koiz-${l.id}
|
||||||
|
title: "${title.replace(/"/g, "'")}"
|
||||||
|
type: ${kind === 'Правило' ? 'concept' : 'reference'}
|
||||||
|
section: "08 AI и Инструменты"
|
||||||
|
tags:
|
||||||
|
- "#койз"
|
||||||
|
- "#уроки-роя"
|
||||||
|
- "#${l.project || 'разное'}"
|
||||||
|
created: "${(l.at || now()).slice(0, 10)}"
|
||||||
|
source: "koiz:${l.id}"
|
||||||
|
source_type: "koiz-lesson"
|
||||||
|
verified: ${l.origin === 'машина' ? 'снято-машиной' : 'записано-агентом'}
|
||||||
|
---
|
||||||
|
|
||||||
|
# ${title}
|
||||||
|
|
||||||
|
## Что сломалось
|
||||||
|
|
||||||
|
${l.what || l.text}
|
||||||
|
|
||||||
|
## Почему
|
||||||
|
|
||||||
|
${l.why || 'Причина не дознана — урок не закончен.'}
|
||||||
|
|
||||||
|
## Починка
|
||||||
|
|
||||||
|
${l.fix || 'Починка не записана.'}
|
||||||
|
|
||||||
|
## Чем закреплено
|
||||||
|
|
||||||
|
\`${l.pin}\`${l.pin_ref ? ` → \`${l.pin_ref}\`` : ' — механизма нет, это долг.'}
|
||||||
|
|
||||||
|
${l.body ? `## Как было записано
|
||||||
|
|
||||||
|
${l.body}
|
||||||
|
|
||||||
|
` : ''}## Как это поможет мне
|
||||||
|
|
||||||
|
Класс ошибки \`${l.class}\` встречался ${occ(l)} раз (проект: ${l.project}). Перед работой того же
|
||||||
|
класса спроси базу: \`node scripts/koiz.mjs ask "${l.class}"\`. Если закрепление «ничем» — закрой
|
||||||
|
причину механизмом, а не обещанием.
|
||||||
|
|
||||||
|
## Связи
|
||||||
|
|
||||||
|
${links.length ? links.map(x => `- [[${titles.get(x)}]]`).join('\n') : '- [[Койз — уроки роя]]'}
|
||||||
|
`
|
||||||
|
writeFileSync(file, body)
|
||||||
|
written.push(file)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const r of rules) note(r, 'Правило')
|
||||||
|
for (const l of lessons) note(l, 'Урок')
|
||||||
|
|
||||||
|
const d = debts({ db })
|
||||||
|
const index = `---
|
||||||
|
id: koiz-index
|
||||||
|
title: "Койз — уроки роя"
|
||||||
|
type: index
|
||||||
|
section: "08 AI и Инструменты"
|
||||||
|
tags:
|
||||||
|
- "#койз"
|
||||||
|
- "#уроки-роя"
|
||||||
|
created: "${today()}"
|
||||||
|
source: "koiz:${path.basename(db)}"
|
||||||
|
verified: снято-машиной
|
||||||
|
---
|
||||||
|
|
||||||
|
# Койз — уроки роя
|
||||||
|
|
||||||
|
База уроков всех проектов. Ключ — класс ошибки, а не имя репозитория: одна беда в трёх домах
|
||||||
|
ложится в один класс и находится из любого из них.
|
||||||
|
|
||||||
|
## Состояние на ${today()}
|
||||||
|
|
||||||
|
- активных уроков: ${active(st).length}
|
||||||
|
- правил после схлопывания: ${rules.length}
|
||||||
|
- долгов (повторилось дважды, не закреплено ничем): ${d.length}
|
||||||
|
|
||||||
|
## Долги
|
||||||
|
|
||||||
|
${d.length ? d.map(x => `- \`${x.class}\` — ${x.occ} раз, проекты: ${x.projects.join(', ')}`).join('\n') : '- долгов нет'}
|
||||||
|
|
||||||
|
## Ноты
|
||||||
|
|
||||||
|
${written.map(f => `- [[${path.basename(f, '.md')}]]`).join('\n') || '- пока пусто'}
|
||||||
|
|
||||||
|
## Как это поможет мне
|
||||||
|
|
||||||
|
Спросить базу перед работой: \`node ~/Проекты/koiz/scripts/koiz.mjs ask "<о чём>"\`.
|
||||||
|
Ночь Гелиоза не стартует, если долг не закрыт и не отсрочен — правило живёт в воротах.
|
||||||
|
`
|
||||||
|
const ifile = path.join(dir, 'Койз — уроки роя.md')
|
||||||
|
writeFileSync(ifile, index)
|
||||||
|
written.push(ifile)
|
||||||
|
return { dir, written: written.length, files: written }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Ворота ─────────────────────────────────────────────────────────────────────
|
||||||
|
// Койз вызывается из helioz-start.sh как остальные ворота: класс ошибки, который уже
|
||||||
|
// случался и не закреплен ничем, обязан уметь красить ночь. Иначе урок снова текст.
|
||||||
|
export function gate({ db = DB, cls = null } = {}) {
|
||||||
|
if (!existsSync(db)) return { code: 2, msg: `нет базы: ${db}` }
|
||||||
|
if (cls) {
|
||||||
|
const st = state(db)
|
||||||
|
const hits = [...active(st), ...activeRules(st)].filter(l => l.class === kebab(cls))
|
||||||
|
const un = hits.filter(l => l.pin === 'ничем' && !ackLive(l))
|
||||||
|
return un.length
|
||||||
|
? { code: 1, msg: `класс «${cls}» уже случался (${un.reduce((a, l) => a + occ(l), 0)} раз) и не закреплен ничем`, ids: un.map(l => l.id) }
|
||||||
|
: { code: 0, msg: hits.length ? `класс «${cls}» известен и закреплен` : `класс «${cls}» в базе не встречался` }
|
||||||
|
}
|
||||||
|
const d = debts({ db })
|
||||||
|
return d.length
|
||||||
|
? { code: 1, msg: `долгов: ${d.length} — урок повторился и не закреплен ничем`, debts: d }
|
||||||
|
: { code: 0, msg: 'долгов нет: всё повторяющееся закреплено или отсрочено' }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function stats({ db = DB } = {}) {
|
||||||
|
const st = state(db)
|
||||||
|
const act = active(st), rules = activeRules(st)
|
||||||
|
const byProject = {}, byPin = {}
|
||||||
|
for (const l of [...act, ...rules]) {
|
||||||
|
byProject[l.project] = (byProject[l.project] || 0) + 1
|
||||||
|
byPin[l.pin] = (byPin[l.pin] || 0) + 1
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
db, ops: readOps(db).length, lessons_total: st.L.size, active: act.length, closed: st.L.size - act.length,
|
||||||
|
rules: rules.length, budget: BUDGET, budget_used: `${Math.round((act.length + rules.length) / BUDGET * 100)}%`,
|
||||||
|
debts: debts({ db }).length, projects: byProject, pins: byPin,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Селфтест ───────────────────────────────────────────────────────────────────
|
||||||
|
// Судит логику, а не наличие функций: каждый пункт красный, если правило сломать.
|
||||||
|
function selftest() {
|
||||||
|
const tmp = mkdtempSync(path.join(os.tmpdir(), 'koiz-'))
|
||||||
|
const db = path.join(tmp, 'lessons.jsonl')
|
||||||
|
const ok = (c, m) => { if (!c) { console.error(`selftest: ${m}`); rmSync(tmp, { recursive: true, force: true }); process.exit(1) } }
|
||||||
|
const raises = (f, re, m) => { try { f(); ok(false, m) } catch (e) { ok(re.test(e.message), `${m} (сказано: ${e.message})`) } }
|
||||||
|
|
||||||
|
// 1. ADD-only: вход ничего не перезаписывает.
|
||||||
|
addLesson({ what: 'запись через cat пошла по симлинку и переписала лаунчер', class: 'symlink-write', project: 'adventure-book' }, db)
|
||||||
|
const first = readFileSync(db, 'utf8').split('\n')[0]
|
||||||
|
addLesson({ what: 'ворота приняли пробу, зависящую только от окружения', class: 'probe-env', project: 'helioz' }, db)
|
||||||
|
ok(readFileSync(db, 'utf8').split('\n')[0] === first, 'первая строка журнала не меняется от новой записи')
|
||||||
|
|
||||||
|
// 2. Повтор дает hit к прежней записи, а не вторую запись: иначе повтор не виден.
|
||||||
|
const rep = addLesson({ what: 'запись через cat пошла по симлинку и переписала лаунчер', class: 'symlink-write', project: 'themis' }, db)
|
||||||
|
ok(rep.op === 'hit', 'тот же отпечаток дает hit, а не дубль')
|
||||||
|
ok(readOps(db).filter(o => o.op === 'add').length === 2, 'повтор не плодит записей')
|
||||||
|
|
||||||
|
// 3. Кросс-проектность: урок из adventure-book находится запросом, не знающим о нем.
|
||||||
|
const found = ask('симлинк', { db })
|
||||||
|
ok(found.length && found[0].project === 'adventure-book', 'урок другого проекта находится по классу ошибки')
|
||||||
|
ok(found[0].occ === 2, 'важность считает повторы')
|
||||||
|
|
||||||
|
// 3б. Морфология: урок написан одними формами слов, а спрашивают другими. Выдача,
|
||||||
|
// которая этого не переживает, врет пустотой - и база молчит о том, что в ней есть.
|
||||||
|
const dbm = path.join(tmp, 'morph.jsonl')
|
||||||
|
addLesson({ what: 'браузерный стек считался не установленным, хотя бинарь лежал на диске', class: 'браузер', project: 'helioz' }, dbm)
|
||||||
|
ok(ask('браузер не установлен', { db: dbm }).length === 1, 'урок находится другими формами тех же слов')
|
||||||
|
ok(ask('установка браузеров', { db: dbm }).length === 1, 'падеж и число не мешают найти урок')
|
||||||
|
// Класс - выжимка урока: запрос, попавший в класс, обязан обойти запись, где то же слово
|
||||||
|
// мелькнуло в проходной фразе. Иначе выдача отдает случайное, и базе перестают верить.
|
||||||
|
const dbr = path.join(tmp, 'rank.jsonl')
|
||||||
|
addLesson({ what: 'бинарь лежал на диске и запускался, а инструмент утверждал обратное', class: 'браузер-не-установлен', project: 'helioz' }, dbr)
|
||||||
|
addLesson({ what: 'установка браузеров с github предразрешена владельцем, порог свежести неделя', class: 'свежесть-способностей', project: 'разное' }, dbr)
|
||||||
|
const rank = ask('браузер не установлен', { db: dbr })
|
||||||
|
ok(rank[0] && rank[0].class === 'браузер-не-установлен',
|
||||||
|
`первым идет урок своего класса, даже если слова запроса лежат в тексте другого (пришло: ${rank[0] && rank[0].class})`)
|
||||||
|
|
||||||
|
// 4. Двувременность: закрытое уходит из выдачи, но остается в истории.
|
||||||
|
const vid = found[0].id
|
||||||
|
closeLesson(vid, 'механизм заменен, урок больше не действует', db)
|
||||||
|
ok(!ask('симлинк', { db }).some(x => x.id === vid), 'закрытый урок не выдается')
|
||||||
|
ok(history(vid, db).some(o => o.op === 'close' && o.valid_to), 'закрытие датировано и лежит в истории')
|
||||||
|
ok(history(vid, db).some(o => o.op === 'add'), 'исходная запись из истории не исчезла')
|
||||||
|
|
||||||
|
// 5. Схлопывание: три похожих урока поднимаются в одно правило.
|
||||||
|
const db2 = path.join(tmp, 'collapse.jsonl')
|
||||||
|
const trio = [
|
||||||
|
'прибор назвал успехом то, чего не делал, потому что судил по имени файла',
|
||||||
|
'гейт посчитал зеленым прогон, где проверка вообще не запускалась',
|
||||||
|
'скрипт отрапортовал готово, хотя целевой каталог остался пустым',
|
||||||
|
]
|
||||||
|
trio.forEach((t, i) => addLesson({ what: t, class: 'pribor-vret-imenem', project: ['olympuz', 'helioz', 'themis'][i] }, db2))
|
||||||
|
const c = collapse({ db: db2, apply: true })
|
||||||
|
ok(c.rules.length === 1, `три похожих дают одно правило (получено ${c.rules.length})`)
|
||||||
|
ok(c.rules[0].from.length === 3, 'правило помнит, из чего сложено')
|
||||||
|
ok(active(state(db2)).length === 0 && activeRules(state(db2)).length === 1, 'члены закрыты, правило активно')
|
||||||
|
ok(readOps(db2).filter(o => o.op === 'add').length === 3, 'схлопывание не стирает исходные записи')
|
||||||
|
ok(ask('прибор', { db: db2 }).some(x => x.kind === 'правило'), 'правило выдается как узел базы')
|
||||||
|
|
||||||
|
// 5б. Дубли схлопываются как дубли: почти тот же урок не должен занимать две строки
|
||||||
|
// выдачи. Закрывается младший, старший остается - и причина закрытия названа.
|
||||||
|
const dbd = path.join(tmp, 'dups.jsonl')
|
||||||
|
const keep = addLesson({ what: 'ворота приняли пробу, которая ничего не проверяла', class: 'probe-empty', project: 'a' }, dbd)
|
||||||
|
const drop = addLesson({ what: 'ворота приняли пробу, которая совсем ничего не проверяла', class: 'probe-empty', project: 'b' }, dbd)
|
||||||
|
const cd = collapse({ db: dbd, apply: true })
|
||||||
|
ok(cd.dups.length === 1 && cd.dups[0].dup === drop.id && cd.dups[0].of === keep.id, 'почти одинаковые схлопнуты как дубль')
|
||||||
|
ok(/^дубль /.test(state(dbd).L.get(drop.id).closed.why), 'причина закрытия названа дублем')
|
||||||
|
ok(!state(dbd).L.get(keep.id).closed, 'старшая запись осталась активной')
|
||||||
|
|
||||||
|
// 6. Бюджет: переполнение ЗАСТАВЛЯЕТ схлопывать, а не растить базу молча.
|
||||||
|
const db3 = path.join(tmp, 'budget.jsonl')
|
||||||
|
const six = [
|
||||||
|
['копия дома ушла в чужой каталог при сборке пакета', 'copy-home'],
|
||||||
|
['сборка положила артефакт мимо целевой папки проекта', 'copy-home'],
|
||||||
|
['архив распакован не туда, куда указывал манифест', 'copy-home'],
|
||||||
|
['токены утекли в лог отладки при падении задачи', 'secret-leak'],
|
||||||
|
['ключ попал в текст ошибки и уехал в телеграм', 'secret-leak'],
|
||||||
|
['пароль оказался в дампе состояния конвейера', 'secret-leak'],
|
||||||
|
]
|
||||||
|
six.forEach(([w, k], i) => addLesson({ what: w, class: k, project: `p${i}` }, db3))
|
||||||
|
ok(active(state(db3)).length === 6, 'до бюджета все шесть активны')
|
||||||
|
const b = enforceBudget({ db: db3, budget: 4 })
|
||||||
|
ok(b.collapsed === true, 'переполнение запускает схлопывание')
|
||||||
|
ok(b.after <= 4, `после схлопывания влезли в бюджет (стало ${b.after})`)
|
||||||
|
ok(b.overflow === false, 'бюджет удержан')
|
||||||
|
ok(readOps(db3).filter(o => o.op === 'add').length === 6, 'бюджет не теряет данные, он их обобщает')
|
||||||
|
ok(enforceBudget({ db: db3, budget: 99 }).collapsed === false, 'под потолком схлопывание не трогают')
|
||||||
|
|
||||||
|
// 7. Долг: повтор без закрепления поднимается владельцу и красит ворота.
|
||||||
|
const db4 = path.join(tmp, 'debt.jsonl')
|
||||||
|
addLesson({ what: 'скилл выбран мимо подсказки роутера', class: 'routing-miss', project: 'a' }, db4)
|
||||||
|
addLesson({ what: 'скилл выбран мимо подсказки роутера', class: 'routing-miss', project: 'b' }, db4)
|
||||||
|
ok(debts({ db: db4 }).length === 1, 'повторившийся незакрепленный урок - долг')
|
||||||
|
ok(gate({ db: db4 }).code === 1, 'долг красит ворота')
|
||||||
|
ok(gate({ db: db4, cls: 'routing-miss' }).code === 1, 'спрос по классу краснеет: уже случалось и не закреплено')
|
||||||
|
ok(gate({ db: db4, cls: 'никогда-не-было' }).code === 0, 'неизвестный класс ворота не красит')
|
||||||
|
ackDebt(debts({ db: db4 })[0].ids[0], '2099-01-01', 'закрепление запланировано', db4)
|
||||||
|
ok(debts({ db: db4 }).length === 0, 'отсрочка снимает долг')
|
||||||
|
ok(debts({ db: db4, day: '2099-06-01' }).length === 1, 'просроченная отсрочка возвращает долг')
|
||||||
|
addLesson({ what: 'один урок закреплен прибором', class: 'pinned', pin: 'прибор', pin_ref: db4, project: 'a' }, db4)
|
||||||
|
addLesson({ what: 'ещё один урок закреплен прибором', class: 'pinned', pin: 'прибор', pin_ref: db4, project: 'b' }, db4)
|
||||||
|
ok(!debts({ db: db4 }).some(d => d.class === 'pinned'), 'закрепленный повтор долгом не считается')
|
||||||
|
|
||||||
|
// 8. Закрепление показывают, а не заявляют.
|
||||||
|
raises(() => addLesson({ what: 'урок с выдуманным механизмом', pin: 'hook', pin_ref: '/нет/такого/хука.sh' }, db4),
|
||||||
|
/механизма нет на диске/, 'закрепление без механизма на диске отвергается')
|
||||||
|
raises(() => addLesson({ what: 'урок с закреплением без ссылки', pin: 'тест' }, db4), /не сказано чем/, 'закрепление без ссылки отвергается')
|
||||||
|
raises(() => addLesson({ what: 'урок с самодельным закреплением', pin: 'обещание' }, db4), /не из списка/, 'самодельное закрепление отвергается')
|
||||||
|
raises(() => addLesson({ what: '' }, db4), /нечего записывать/, 'пустая запись отвергается')
|
||||||
|
|
||||||
|
// 9. Секреты в базу не попадают - режем на записи, а не при выдаче.
|
||||||
|
const db5 = path.join(tmp, 'secret.jsonl')
|
||||||
|
// Приманка собирается из кусков, а не лежит литералом: строка вида токена в
|
||||||
|
// исходнике краснит и сторожа секретов, и ворота публикации, а проверка от
|
||||||
|
// литерала не выигрывает - фильтру важна форма строки, а не место рождения.
|
||||||
|
const primanka = 'ghp' + '_' + 'abcdefghijklmnopqrstuvwxyz0123'
|
||||||
|
addLesson({ what: `токен ${primanka} утек в лог`, class: 'leak', project: 'a' }, db5)
|
||||||
|
ok(!readFileSync(db5, 'utf8').includes(primanka), 'секрет не лег в журнал')
|
||||||
|
ok(readFileSync(db5, 'utf8').includes('gh_***'), 'на месте секрета стоит метка')
|
||||||
|
|
||||||
|
// 10. Цеттелькастен: новая запись связывает себя и правит соседа дописанной связью.
|
||||||
|
const db6 = path.join(tmp, 'links.jsonl')
|
||||||
|
const a1 = addLesson({ what: 'проба гейта оказалась тавтологичной и ничего не доказала', class: 'probe-taut', project: 'a' }, db6)
|
||||||
|
const a2 = addLesson({ what: 'проба гейта прошла зеленой на сломанной копии дома', class: 'probe-taut', project: 'b' }, db6)
|
||||||
|
ok(a2.links.includes(a1.id), 'новая запись сама нашла соседа')
|
||||||
|
ok(state(db6).L.get(a1.id).links.has(a2.id), 'сосед узнал о новичке, ничего не потеряв')
|
||||||
|
|
||||||
|
// 11. Съем идемпотентен: повторный хук не надувает базу мнимыми повторами.
|
||||||
|
const tr = path.join(tmp, 'sess.jsonl')
|
||||||
|
writeFileSync(tr, [
|
||||||
|
JSON.stringify({ type: 'assistant', message: { content: [{ type: 'tool_use', id: 't1', name: 'Bash', input: { command: 'node scripts/gate.mjs --check' } }] } }),
|
||||||
|
JSON.stringify({ type: 'user', message: { content: [{ type: 'tool_result', tool_use_id: 't1', is_error: true, content: 'команда упала: нет каталога queue' }] } }),
|
||||||
|
JSON.stringify({ type: 'user', toolUseResult: { stdout: 'красный: план не по схеме', stderr: '' } }),
|
||||||
|
].join('\n'))
|
||||||
|
const db7 = path.join(tmp, 'capture.jsonl')
|
||||||
|
const cap1 = captureSession({ transcript: tr, project: 'helioz', db: db7 })
|
||||||
|
ok(cap1.added.length === 2, `съем нашел оба класса улик (нашел ${cap1.added.length})`)
|
||||||
|
const opsAfter = readOps(db7).length
|
||||||
|
const cap2 = captureSession({ transcript: tr, project: 'helioz', db: db7 })
|
||||||
|
ok(cap2.added.length === 0 && cap2.seen === 2, 'повторный съем той же сессии ничего не добавляет')
|
||||||
|
ok(readOps(db7).length === opsAfter, 'журнал не вырос от повторного съема')
|
||||||
|
ok(state(db7).L.values().next().value.why === null, 'машина не выдумывает причину - why пуст')
|
||||||
|
ok([...state(db7).L.values()].every(l => l.pin === 'ничем' && l.origin === 'машина'), 'сырье честно помечено сырьем')
|
||||||
|
|
||||||
|
// 11б. Регистр маркера значим: `FAIL ` - провал прибора, `fail=0` - счетчик в его же
|
||||||
|
// выводе. Съем без этого различия записал ложный урок на живой сессии 06.09.2026.
|
||||||
|
const noise = [
|
||||||
|
JSON.stringify({ type: 'user', toolUseResult: { stdout: 'fail=0 проверок пройдено успешно, прогон чистый\nитог', stderr: '' } }),
|
||||||
|
JSON.stringify({ type: 'user', toolUseResult: { stdout: 'FAIL=0 счетчик прибора, а не провал прогона\nитог', stderr: '' } }),
|
||||||
|
JSON.stringify({ type: 'user', toolUseResult: { stdout: 'fail 0 ошибок в прогоне линтера, всё чисто\nитог', stderr: '' } }),
|
||||||
|
JSON.stringify({ type: 'user', toolUseResult: { stdout: ' FAIL линтер: план не по схеме', stderr: '' } }),
|
||||||
|
].join('\n')
|
||||||
|
const sniff = captureTranscript(noise, { session: 'n', project: 'p' })
|
||||||
|
ok(sniff.length === 1 && /FAIL линтер/.test(sniff[0].what), `счетчик fail=0 не считается провалом (снято ${sniff.length})`)
|
||||||
|
|
||||||
|
// 11в. Имя ноты не должно затирать соседа: два урока одного класса дают одно имя, и
|
||||||
|
// без развода по id 64 записи ложились в 63 файла - молчаливая потеря знания.
|
||||||
|
const db10 = path.join(tmp, 'export.jsonl')
|
||||||
|
addLesson({ what: 'первый урок общего класса про ворота', class: 'общий-класс', why: 'причина одна', project: 'a' }, db10)
|
||||||
|
addLesson({ what: 'второй урок общего класса про ворота', class: 'общий-класс', why: 'причина другая', project: 'b' }, db10)
|
||||||
|
const vdir = path.join(tmp, 'vault')
|
||||||
|
const ex = exportVault({ db: db10, dir: vdir, minOcc: 1 })
|
||||||
|
ok(ex.written === 3, `записаны обе ноты и индекс (получено ${ex.written})`)
|
||||||
|
ok(new Set(ex.files).size === ex.files.length, 'имена нот не столкнулись')
|
||||||
|
const vfiles = new Set(readdirSync(vdir).map(f => f.replace(/\.md$/, '')))
|
||||||
|
ok(vfiles.size === 3, 'на диске столько же файлов, сколько нот - ничего не затерто')
|
||||||
|
// Связь в Obsidian ведет по ИМЕНИ ноты. Проверяем обе стороны: индекс и связь урок→урок,
|
||||||
|
// иначе подмена имени на id остается незамеченной ровно там, где строится граф.
|
||||||
|
const allLinks = readdirSync(vdir).flatMap(f =>
|
||||||
|
[...readFileSync(path.join(vdir, f), 'utf8').matchAll(/\[\[([^\]]+)\]\]/g)].map(m => [f, m[1]]))
|
||||||
|
ok(allLinks.length >= 3, `связи проставлены (найдено ${allLinks.length})`)
|
||||||
|
ok(allLinks.every(([, w]) => vfiles.has(w)), 'все связи ведут на существующие ноты, а не на id из frontmatter')
|
||||||
|
ok(allLinks.some(([f, w]) => f.startsWith('Урок') && w.startsWith('Урок')), 'урок ссылается на соседний урок, а не только на индекс')
|
||||||
|
|
||||||
|
// 11г. Сработавший сторож и голый вердикт - не уроки. Иначе база копит повторы работы
|
||||||
|
// системы и закрывает ночь долгом, которого нет.
|
||||||
|
//
|
||||||
|
// Пути в фикстурах намеренно с тильдой: этот файл уезжает в публичное дерево, а
|
||||||
|
// абсолютный путь вида /Users/<имя> в отслеживаемом файле - жёсткий блокер ворот
|
||||||
|
// выпуска. Проверке форма пути безразлична, воротам - нет.
|
||||||
|
const guard = [
|
||||||
|
JSON.stringify({ type: 'assistant', message: { content: [{ type: 'tool_use', id: 'g1', name: 'Bash', input: { command: 'rm -rf /' } }] } }),
|
||||||
|
JSON.stringify({ type: 'user', message: { content: [{ type: 'tool_result', tool_use_id: 'g1', is_error: true, content: 'PreToolUse:Bash hook error: [bash "~/.claude/hooks/bash-guard.sh"]: [bash-guard] BLOCKED опасная команда' }] } }),
|
||||||
|
JSON.stringify({ type: 'user', toolUseResult: { stdout: 'ВЕРДИКТ: красный', stderr: '' } }),
|
||||||
|
JSON.stringify({ type: 'assistant', message: { content: [{ type: 'tool_use', id: 'g2', name: 'Bash', input: { command: 'npx playwright test' } }] } }),
|
||||||
|
JSON.stringify({ type: 'user', message: { content: [{ type: 'tool_result', tool_use_id: 'g2', is_error: true, content: 'Error: Browser "chrome-for-testing" is not installed; expected executable at ~/Library/Caches' }] } }),
|
||||||
|
].join('\n')
|
||||||
|
const g = captureTranscript(guard, { session: 'g', project: 'p' })
|
||||||
|
ok(g.length === 1, `сторож и пустой вердикт не идут в базу, настоящая беда идёт (снято ${g.length})`)
|
||||||
|
ok(/chrome-for-testing/.test(g[0].what), 'снята именно настоящая беда')
|
||||||
|
|
||||||
|
// 12. Миграция: ни одна запись старого лога не теряется, и это проверено, не обещано.
|
||||||
|
const md = path.join(tmp, 'old.md')
|
||||||
|
writeFileSync(md, ['## 2026-01-02 · olympuz — первый разбор', '',
|
||||||
|
'**Ошибка → правило.** Гейт считал тесты подстрочным фильтром. → **Правило: не доверять форме команды.**', '',
|
||||||
|
'**Token-аудит.** Доминанта cache-read 96%.', '',
|
||||||
|
'## 03.02.2026 · Фемида: второй разбор', '',
|
||||||
|
'Свободный текст без жирного зачина, тоже урок.'].join('\n'))
|
||||||
|
const db8 = path.join(tmp, 'migrate.jsonl')
|
||||||
|
const m = migrate({ file: md, db: db8 })
|
||||||
|
ok(m.sections === 2 && m.records === 3, `разобраны оба раздела и все три записи (${m.sections}/${m.records})`)
|
||||||
|
ok(m.lost.length === 0 && m.code === 0, 'ни одна запись не потеряна')
|
||||||
|
ok(lostSrcs(parseLessonsMd(readFileSync(md, 'utf8'), { file: 'old.md' }).records, readOps(db8)).length === 0,
|
||||||
|
'сверка по диску независимо подтверждает полноту')
|
||||||
|
// Обратная сторона: запись, которую записать НЕЛЬЗЯ, обязана быть названа потерей,
|
||||||
|
// а не проглочена. Без этой проверки отчет «не потеряно» стоит ноль.
|
||||||
|
const md2 = path.join(tmp, 'broken.md')
|
||||||
|
writeFileSync(md2, ['## 2026-04-05 · helioz — раздел с битым абзацем', '',
|
||||||
|
'**Настоящий урок.** Ворота пропустили пустую пробу.', '', '** **', ''].join('\n'))
|
||||||
|
const db9 = path.join(tmp, 'broken.jsonl')
|
||||||
|
const m2 = migrate({ file: md2, db: db9 })
|
||||||
|
ok(m2.records === 2 && m2.added === 1, 'разобраны обе записи, записана одна')
|
||||||
|
ok(m2.lost.length === 1 && m2.code === 1, 'незаписанная запись названа потерей, а не проглочена')
|
||||||
|
ok(m2.failed.length === 1 && /нечего записывать/.test(m2.failed[0].why), 'причина потери названа')
|
||||||
|
ok(new Set([...state(db8).L.values()].map(l => l.project)).size === 2, 'проект восстановлен из заголовка раздела')
|
||||||
|
ok([...state(db8).L.values()].some(l => /не доверять форме команды/.test(l.fix || '')), 'правило вытащено из текста')
|
||||||
|
|
||||||
|
rmSync(tmp, { recursive: true, force: true })
|
||||||
|
console.log('selftest ok - ADD-only, повтор как hit, кросс-проектность, двувременность, схлопывание в правило,')
|
||||||
|
console.log(' бюджет, долг и ворота, закрепление с механизмом, фильтр секретов, связи, идемпотентный съем, миграция без потерь')
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── CLI ────────────────────────────────────────────────────────────────────────
|
||||||
|
const args = process.argv.slice(2)
|
||||||
|
const argOf = n => { const i = args.indexOf(n); return i >= 0 ? args[i + 1] : null }
|
||||||
|
const has = n => args.includes(n)
|
||||||
|
const asJson = has('--json')
|
||||||
|
const out = (o, code = 0) => { console.log(asJson ? JSON.stringify(o, null, 2) : o); return code }
|
||||||
|
const cwdProject = () => path.basename(process.cwd())
|
||||||
|
|
||||||
|
const HELP = `Койз - дознаватель роя. База уроков всех проектов.
|
||||||
|
|
||||||
|
add --what "…" [--why …] [--fix …] [--class …] [--project …]
|
||||||
|
[--pin hook|deny|прибор|тест|ничем] [--pin-ref <путь>] [--repro "…"]
|
||||||
|
capture --transcript <путь.jsonl> [--project …] съем машиной с сессии
|
||||||
|
ask "<запрос>" [--class …] [--project …] [--limit N]
|
||||||
|
close --id <ID> --why "…" закрыть датой (не стереть)
|
||||||
|
ack --id <ID> [--until ГГГГ-ММ-ДД] --why "…" отсрочить долг с датой
|
||||||
|
collapse [--dry] схлопывание отдельным проходом
|
||||||
|
debt что повторилось и не закреплено
|
||||||
|
gate [--class …] ворота: красит ночь Гелиоза
|
||||||
|
stats · history --id <ID> · export [--dir …] · migrate --file <lessons.md>
|
||||||
|
--selftest [--json]
|
||||||
|
|
||||||
|
Журнал: ${DB} Бюджет: ${BUDGET} активных Vault: ${VAULT}`
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
const cmd = args.find(a => !a.startsWith('--')) || (has('--selftest') ? '--selftest' : 'help')
|
||||||
|
try {
|
||||||
|
switch (cmd) {
|
||||||
|
case 'add': {
|
||||||
|
const r = addLesson({
|
||||||
|
what: argOf('--what'), why: argOf('--why'), fix: argOf('--fix'), class: argOf('--class'),
|
||||||
|
project: argOf('--project') || cwdProject(), pin: argOf('--pin'), pin_ref: argOf('--pin-ref'),
|
||||||
|
repro: argOf('--repro'), kind: argOf('--kind'),
|
||||||
|
})
|
||||||
|
const b = enforceBudget({})
|
||||||
|
if (asJson) return out({ ...r, budget: b }, b.overflow ? 1 : 0)
|
||||||
|
console.log(r.op === 'hit' ? `повтор: ${r.id} (уже ${r.occ} раз) - это кандидат в долг` : `записан ${r.id}${r.links.length ? `, связан с ${r.links.join(', ')}` : ''}`)
|
||||||
|
if (b.collapsed) console.log(`бюджет: было ${b.before}, схлопнуто до ${b.after}`)
|
||||||
|
return b.overflow ? 1 : 0
|
||||||
|
}
|
||||||
|
case 'capture': {
|
||||||
|
const r = captureSession({ transcript: argOf('--transcript'), project: argOf('--project') || cwdProject() })
|
||||||
|
if (r.error) { console.error(r.error); return 2 }
|
||||||
|
if (asJson) return out(r)
|
||||||
|
console.log(`съем ${r.session}: новых ${r.added.length}, повторов ${r.hits.length}, уже снято ${r.seen}`)
|
||||||
|
if (r.added.length) console.log(` сырье без причины: ${r.added.join(', ')} - агент обязан дознать «почему»`)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
case 'ask': {
|
||||||
|
const q = args.find(a => !a.startsWith('--') && a !== 'ask') || null
|
||||||
|
const r = ask(q, { project: argOf('--project'), cls: argOf('--class'), limit: Number(argOf('--limit') || 10) })
|
||||||
|
if (asJson) return out(r)
|
||||||
|
if (!r.length) { console.log('в базе такого класса нет'); return 0 }
|
||||||
|
for (const x of r) {
|
||||||
|
console.log(`${x.id} · ${x.class} · ${x.project} · ${x.occ}× · закреплено: ${x.pin}${x.pin_ref ? ` (${x.pin_ref})` : ''}`)
|
||||||
|
console.log(` ${x.what}`)
|
||||||
|
if (x.why) console.log(` почему: ${x.why}`)
|
||||||
|
if (x.fix) console.log(` починка: ${x.fix}`)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
case 'close': return out(closeLesson(argOf('--id'), argOf('--why')))
|
||||||
|
case 'ack': return out(ackDebt(argOf('--id'), argOf('--until'), argOf('--why')))
|
||||||
|
case 'collapse': {
|
||||||
|
const r = collapse({ apply: !has('--dry') })
|
||||||
|
if (asJson) return out(r)
|
||||||
|
console.log(`схлопывание: дублей ${r.dups.length}, правил ${r.rules.length}, было активных ${r.before}, стало ${r.after}`)
|
||||||
|
for (const x of r.rules) console.log(` ${x.id} ← ${x.from.join(' + ')}\n ${x.text}`)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
case 'debt': {
|
||||||
|
const d = debts({})
|
||||||
|
if (asJson) return out(d, d.length ? 1 : 0)
|
||||||
|
if (!d.length) { console.log('долгов нет'); return 0 }
|
||||||
|
console.log(`долгов: ${d.length} - повторилось и не закреплено ничем:`)
|
||||||
|
for (const x of d) console.log(` ${x.class} · ${x.occ}× · ${x.projects.join(', ')} · ${x.ids.join(', ')}`)
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
case 'gate': {
|
||||||
|
const g = gate({ cls: argOf('--class') })
|
||||||
|
if (asJson) return out(g, g.code)
|
||||||
|
console[g.code ? 'error' : 'log'](`койз: ${g.msg}`)
|
||||||
|
for (const d of g.debts || []) console.error(` · ${d.class} · ${d.occ}× · ${d.projects.join(', ')}`)
|
||||||
|
if (g.code === 1) console.error(' закрепить механизмом (koiz add --pin …) либо отсрочить с датой (koiz ack --id … --until …)')
|
||||||
|
return g.code
|
||||||
|
}
|
||||||
|
case 'stats': return out(stats({}))
|
||||||
|
case 'history': return out(history(argOf('--id')))
|
||||||
|
case 'export': {
|
||||||
|
const r = exportVault({ dir: argOf('--dir') || VAULT })
|
||||||
|
if (asJson) return out(r)
|
||||||
|
console.log(`Мнемозина: ${r.written} нот в ${r.dir}`)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
case 'migrate': {
|
||||||
|
const r = migrate({ file: argOf('--file') })
|
||||||
|
if (r.error) { console.error(r.error); return 2 }
|
||||||
|
if (asJson) return out(r, r.code)
|
||||||
|
console.log(`миграция ${r.file}: разделов ${r.sections}, записей ${r.records}, новых ${r.added}, повторов ${r.hits}`)
|
||||||
|
if (r.lost.length) { console.error(`ПОТЕРЯНО ${r.lost.length}: ${r.lost.slice(0, 5).join(', ')}`); return 1 }
|
||||||
|
console.log('не потеряно ни одной записи (сверка по src каждой)')
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
case '--selftest': return selftest()
|
||||||
|
default: console.log(HELP); return 0
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`койз: ${e.message}`)
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Запуск ли это прибора или импорт его как модуля. Сравнивать надо РЕАЛЬНЫЕ пути:
|
||||||
|
// /tmp на macOS - симлинк на /private/tmp, и прямое сравнение строк давало ложное «меня
|
||||||
|
// импортировали» - прибор молча выходил нулем, ничего не сделав. Поймано мутационными
|
||||||
|
// воротами 06.09.2026: все 16 мутаций «выжили», потому что селфтест не запускался вовсе.
|
||||||
|
const runAsTool = () => {
|
||||||
|
try { return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1] || '') }
|
||||||
|
catch { return false }
|
||||||
|
}
|
||||||
|
if (runAsTool()) process.exit(main())
|
||||||