diff --git a/README.md b/README.md index 1e9f903..b383869 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,173 @@ -# Athena +

+ Athena — a portable agent operating system +

-Переносимая агентная ОС. Чистый Mac → **одна команда** → вся система: от каскада `CLAUDE.md` до боевого рантайма. +

Athena

+ +

+ A portable agent operating system.
+ A clean Mac → one command → your entire system: from the CLAUDE.md cascade to the live runtime. +

+ +

+ 🇬🇧 English · 🇷🇺 Русский +

+ +--- ```bash git clone ~/Проекты/athena && cd ~/Проекты/athena -cp athena.config.example.sh athena.config.sh # заполни свои репо/значения -./bootstrap.sh # или --dry-run +cp athena.config.example.sh athena.config.sh # fill in your repos / values +./bootstrap.sh # or --dry-run ``` -## Три плоскости — не смешивать +That is the whole onboarding. No manual setup, no checklist to forget, no drift between machines. -| Плоскость | Дом | Что | +--- + +## Why this exists + +An AI agent is only as good as the system around it — its constitution, rules, hooks, capability registry, the projects it can see, the knowledge it can recall. Over months that system grows into hundreds of files spread across `~/.claude`, `~/.codex`, `~/.agents`, project folders, a knowledge vault, launch agents, and secrets. + +That growth creates three quiet failures: + +1. **Non-portability.** A new Mac means days of manual re-setup, and the result never quite matches the old machine. +2. **Drift.** Two machines slowly diverge; what works on one breaks on the other. +3. **Leak risk.** Personal data and secrets get tangled into the same tree you would otherwise want to share or open-source. + +Athena turns that entire system into **one reproducible artifact**. The public scaffold lives here. Your personal layer lives in a private overlay. One idempotent script reassembles both into a working machine — every time, identically. + +> This repository is the **generic, public scaffold**. It contains zero personal data: no `/Users/...` hardcodes, no secrets, no private content. Everything personal is injected at deploy time from a private overlay (see [Generic ⊕ private](#generic--private)). + +--- + +## Three planes — never mixed + +

+ The three planes: Consciousness, Knowledge, Work +

+ +Everything you own falls into exactly one of three planes. Keeping them separate is what makes the system legible as it grows — runtime junk never pollutes canon, secrets never touch code, knowledge never scatters into project folders. + +```mermaid +flowchart TB + subgraph P1["🧠 Consciousness — the agent OS"] + C["~/.claude · ~/.codex · ~/.agents
constitution · rules · hooks · agents · capability registry (SSOT)"] + end + subgraph P2["📚 Knowledge"] + K["~/Мозг (vault)
durable knowledge · Karpathy method · graph links"] + end + subgraph P3["⚙️ Work"] + W["~/Проекты · ~/Хранилище · ~/Архив
code projects · documents · media · cold archive"] + end + P1 -.governs.-> P3 + P2 -.feeds.-> P1 +``` + +| Plane | Home | What lives there | Managed by | +|---|---|---|---| +| **Consciousness** | `~/.claude` · `~/.codex` · `~/.agents` | constitution, rules, hooks, agents, registry SSOT | chezmoi | +| **Knowledge** | `~/Мозг` | durable knowledge (Karpathy method), private repo | private vault repo | +| **Work** | `~/Проекты` · `~/Хранилище` · `~/Архив` | projects, documents, media | per-project git | + +The layout rules live **inside** the system: [`rules/structure.md`](rules/structure.md) (the declarative source of truth), the `organize` skill (the procedure), and a PreToolUse hook (the hard invariant). The system grows along them instead of into chaos. + +--- + +## Six layers of deployment + +

+ The six deployment layers stacking into one system +

+ +`bootstrap.sh` is an orchestrator. It builds the machine bottom-up in ordered, independently runnable layers. Each layer is idempotent: run it once or a hundred times, the result is the same. + +```mermaid +flowchart LR + L0["0 · Base
Homebrew + CLI"] --> L0b["0b · Tools
~/tools"] + L0b --> L1["1 · Consciousness
chezmoi merged-source"] + L1 --> L2["2 · Registry
capability SSOT"] + L2 --> L3["3 · Work
projects"] + L3 --> L4["4 · Knowledge
vault"] + L4 --> L5["5 · Runtime
secrets · MCP · launchd"] + L5 --> L6["6 · Smoke
parity + lint"] +``` + +| Layer | Name | What it does | |---|---|---| -| **Сознание** (агент-ОС) | `~/.claude` · `~/.codex` · `~/.agents` | конституция, rules, hooks, agents, реестр SSOT — через chezmoi | -| **Знания** | `~/Мозг` | durable-знание по методу Карпаты, приватный репо | -| **Работа** | `~/Проекты` · `~/Хранилище` · `~/Архив` | проекты, документы, медиа | +| **0** | Base | Homebrew + CLI (`claude`, `codex`, `gh`, `node`, `python`, `uv`, `ffmpeg`) — from `Brewfile` | +| **0b** | Tools | external tools → `~/tools` (bots etc.), cloned **before** Consciousness | +| **1** | Consciousness | chezmoi deploys `~/.claude` · `~/.codex` · `~/.agents` from the merged source | +| **2** | Registry | `build_registry` → `capability-plan` SSOT | +| **3** | Work | clone + install projects from `projects.manifest` | +| **4** | Knowledge | clone the private vault repo | +| **5** | Runtime | `~/.secrets` (Keychain) · MCP reauth · launchd agents | +| **6** | Smoke | Claude = Codex parity + structure lint | -Правила раскладки живут ВНУТРИ системы: [`rules/structure.md`](rules/structure.md) (декларатив) + skill `organize` (процедура) + PreToolUse-hook (инвариант). Рост системы идёт по ним. - -## Шесть слоёв разворота (`bootstrap.sh`) - -``` -0 База Homebrew + CLI (claude, codex, gh, node, python, uv, ffmpeg) — Brewfile -1 Сознание chezmoi разворачивает ~/.claude · ~/.codex · ~/.agents -2 Реестр build_registry → capability-plan SSOT -3 Работа clone + install.sh проектов по projects.manifest -4 Знания clone приватного vault-репо -5 Рантайм ~/.secrets (Keychain) · MCP reauth · launchd -6 Smoke паритет Claude=Codex + линт структуры +```bash +./bootstrap.sh --only=1 # run a single layer +./bootstrap.sh --dry-run # show everything, change nothing ``` -Запуск по слоям: `./bootstrap.sh --only=1`. Сухой прогон: `--dry-run`. +--- -## Generic vs личное +## Generic ⊕ private -- **В репо (publishable):** `bootstrap.sh`, `Brewfile`, `rules/structure.md`, skills, `claude-starter/`, шаблоны `chezmoi/`, `launchd/`, `smoke/`. Без `/Users/...`, без личных данных. -- **НЕ в репо:** значения секретов (Keychain / `~/.secrets`), контент vault (свой приватный репо), `athena.config.sh`, `projects.manifest`. +

+ Generic and private sources merging into one +

-Личная инстанция = заполненный `athena.config.sh` + приватный chezmoi-source поверх этого generic-каркаса. +The hardest problem in sharing a personal system is the boundary: the structure is worth open-sourcing, the contents are not. Athena solves it with a **merged source**. Layer 1 rsyncs the generic base, lays the private overlay on top (overlay wins on conflict), then runs a single `chezmoi apply`. -## Подробное описание функций +```mermaid +flowchart LR + G["Generic source
./chezmoi · public"] --> M{{"merged-source"}} + P["Private overlay
$ATHENA_PRIVATE_REPO · personal"] --> M + M --> A["chezmoi apply
~/.claude · ~/.codex · ~/.agents"] +``` -Каждая функция (слои, merged-source, самообучение, smoke-гейты, security-щит, CI) — с «что/как/зачем»: -- 🇷🇺 [docs/FEATURES.ru.md](docs/FEATURES.ru.md) -- 🇬🇧 [docs/FEATURES.en.md](docs/FEATURES.en.md) +- Leave `ATHENA_PRIVATE_REPO` empty → a valid **generic-only** deploy. +- Set it → your `references/`, active launch agents, and secret generators are layered in. +- A `PERSONAL_RE` smoke gate fails the build if personal data ever lands in a tracked public file. The boundary is enforced, not hoped for. -## Лицензия +See the architecture decision: [`docs/decisions/0001-merged-source-generic-private.md`](docs/decisions/0001-merged-source-generic-private.md). -MIT — см. [LICENSE](LICENSE). +--- + +## Why it's efficient + +- **One command, idempotent.** No manual steps to skip or misremember. Re-running converges instead of duplicating; launch agents are only reloaded when their plist actually changed (no flicker). +- **Fail-closed runtime.** Layer 5 counts loaded vs. failed launch agents and exits non-zero on any failure — a half-deployed machine never reports success. +- **Provable parity.** Layer 6 smoke verifies Claude and Codex see the same registry, every plist is valid, every guard hook actually blocks secrets, and no personal data is tracked. +- **Token economy by design.** A capability registry (SSOT) routes the right skill/agent/MCP quality-first, so the agent spends reasoning on the task, not on rediscovering its own tools. +- **Self-describing growth.** Layout rules, the `organize` skill, and a hard hook keep expansion legible; the constitution stays a lean router, not a junk drawer. + +--- + +## Generic vs personal + +| In the repo (publishable) | **Not** in the repo | +|---|---| +| `bootstrap.sh`, `Brewfile`, `smoke/` | secret **values** (Keychain / `~/.secrets`) | +| `rules/structure.md`, skills, `launchd/` | vault content (your private repo) | +| `chezmoi/` templates, `claude-starter/` | `athena.config.sh`, `projects.manifest` | + +A personal instance = a filled-in `athena.config.sh` + a private chezmoi overlay on top of this generic scaffold. + +--- + +## Commands + +```bash +shellcheck bootstrap.sh smoke/*.sh # lint +./bootstrap.sh --dry-run # dry run +./bootstrap.sh --only=<0|0b|1..6> # single layer +smoke/smoke.sh # parity + structure smoke +smoke/dry-validate.sh # template render validation (no chezmoi) +``` + +Read [`specs/`](specs/) first for the phased plan, [`docs/decisions/`](docs/decisions/) for architecture decisions, and the project [`CLAUDE.md`](CLAUDE.md) for the map. + +--- + +

Athena — goddess of wisdom and strategy. Your system, made portable.

diff --git a/README.ru.md b/README.ru.md new file mode 100644 index 0000000..cc569f9 --- /dev/null +++ b/README.ru.md @@ -0,0 +1,173 @@ +

+ Athena — переносимая агентная операционная система +

+ +

Athena

+ +

+ Переносимая агентная операционная система.
+ Чистый Mac → одна команда → вся твоя система: от каскада CLAUDE.md до боевого рантайма. +

+ +

+ 🇬🇧 English · 🇷🇺 Русский +

+ +--- + +```bash +git clone ~/Проекты/athena && cd ~/Проекты/athena +cp athena.config.example.sh athena.config.sh # впиши свои репо / значения +./bootstrap.sh # или --dry-run +``` + +Это весь онбординг. Никакой ручной настройки, никакого чеклиста, который забудешь, никакого дрейфа между машинами. + +--- + +## Зачем это нужно + +AI-агент хорош ровно настолько, насколько хороша система вокруг него — конституция, правила, хуки, реестр способностей, видимые проекты, доступные знания. За месяцы эта система разрастается в сотни файлов по `~/.claude`, `~/.codex`, `~/.agents`, папкам проектов, vault знаний, launch-агентам и секретам. + +Этот рост порождает три тихих отказа: + +1. **Непереносимость.** Новый Mac = дни ручной пересборки, и результат всё равно не совпадает со старой машиной. +2. **Дрейф.** Две машины медленно расходятся; что работает на одной — ломается на другой. +3. **Риск утечки.** Личные данные и секреты сплетаются с тем же деревом, которым иначе хотелось бы делиться или открыть в open-source. + +Athena превращает всю эту систему в **один воспроизводимый артефакт**. Публичный каркас живёт здесь. Личный слой — в приватном overlay. Один идемпотентный скрипт пересобирает оба в рабочую машину — каждый раз идентично. + +> Этот репозиторий — **generic, публичный каркас**. Ноль личных данных: ни хардкода `/Users/...`, ни секретов, ни приватного контента. Всё личное вливается на этапе разворота из приватного overlay (см. [Generic ⊕ private](#generic--private)). + +--- + +## Три плоскости — не смешивать + +

+ Три плоскости: Сознание, Знания, Работа +

+ +Всё, чем ты владеешь, попадает ровно в одну из трёх плоскостей. Их разделение и делает систему читаемой по мере роста — рантайм-мусор не загрязняет канон, секреты не касаются кода, знания не растекаются по папкам проектов. + +```mermaid +flowchart TB + subgraph P1["🧠 Сознание — агент-ОС"] + C["~/.claude · ~/.codex · ~/.agents
конституция · правила · хуки · агенты · реестр способностей (SSOT)"] + end + subgraph P2["📚 Знания"] + K["~/Мозг (vault)
durable-знание · метод Карпаты · граф-связи"] + end + subgraph P3["⚙️ Работа"] + W["~/Проекты · ~/Хранилище · ~/Архив
код-проекты · документы · медиа · холодный архив"] + end + P1 -.управляет.-> P3 + P2 -.питает.-> P1 +``` + +| Плоскость | Дом | Что внутри | Чем управляется | +|---|---|---|---| +| **Сознание** | `~/.claude` · `~/.codex` · `~/.agents` | конституция, правила, хуки, агенты, реестр SSOT | chezmoi | +| **Знания** | `~/Мозг` | durable-знание (метод Карпаты), приватный репо | приватный vault-репо | +| **Работа** | `~/Проекты` · `~/Хранилище` · `~/Архив` | проекты, документы, медиа | per-project git | + +Правила раскладки живут **внутри** системы: [`rules/structure.md`](rules/structure.md) (декларативный источник истины), skill `organize` (процедура) и PreToolUse-хук (жёсткий инвариант). Система растёт по ним, а не в хаос. + +--- + +## Шесть слоёв разворота + +

+ Шесть слоёв разворота, складывающихся в систему +

+ +`bootstrap.sh` — оркестратор. Он собирает машину снизу вверх упорядоченными, независимо запускаемыми слоями. Каждый слой идемпотентен: запусти раз или сто — результат тот же. + +```mermaid +flowchart LR + L0["0 · База
Homebrew + CLI"] --> L0b["0b · Инструменты
~/tools"] + L0b --> L1["1 · Сознание
chezmoi merged-source"] + L1 --> L2["2 · Реестр
capability SSOT"] + L2 --> L3["3 · Работа
проекты"] + L3 --> L4["4 · Знания
vault"] + L4 --> L5["5 · Рантайм
секреты · MCP · launchd"] + L5 --> L6["6 · Smoke
паритет + линт"] +``` + +| Слой | Имя | Что делает | +|---|---|---| +| **0** | База | Homebrew + CLI (`claude`, `codex`, `gh`, `node`, `python`, `uv`, `ffmpeg`) — из `Brewfile` | +| **0b** | Инструменты | внешние инструменты → `~/tools` (боты и т.п.), клонятся **до** Сознания | +| **1** | Сознание | chezmoi разворачивает `~/.claude` · `~/.codex` · `~/.agents` из merged-source | +| **2** | Реестр | `build_registry` → `capability-plan` SSOT | +| **3** | Работа | clone + install проектов по `projects.manifest` | +| **4** | Знания | clone приватного vault-репо | +| **5** | Рантайм | `~/.secrets` (Keychain) · MCP reauth · launchd-агенты | +| **6** | Smoke | паритет Claude = Codex + линт структуры | + +```bash +./bootstrap.sh --only=1 # один слой +./bootstrap.sh --dry-run # показать всё, не менять ничего +``` + +--- + +## Generic ⊕ private + +

+ Generic и private источники сливаются в один +

+ +Самая трудная задача при шеринге личной системы — граница: структуру открыть стоит, содержимое — нет. Athena решает её **merged-source**. Слой 1 rsync-ит generic-базу, накладывает приватный overlay сверху (overlay побеждает на конфликте), затем делает один `chezmoi apply`. + +```mermaid +flowchart LR + G["Generic source
./chezmoi · публичный"] --> M{{"merged-source"}} + P["Приватный overlay
$ATHENA_PRIVATE_REPO · личный"] --> M + M --> A["chezmoi apply
~/.claude · ~/.codex · ~/.agents"] +``` + +- Пусто `ATHENA_PRIVATE_REPO` → валидный **generic-only** разворот. +- Задан → твои `references/`, активные launch-агенты и генераторы секретов вливаются сверху. +- Smoke-гейт `PERSONAL_RE` валит сборку, если личные данные попадут в tracked публичный файл. Граница обеспечена, а не «на авось». + +Архитектурное решение: [`docs/decisions/0001-merged-source-generic-private.md`](docs/decisions/0001-merged-source-generic-private.md). + +--- + +## Почему это эффективно + +- **Одна команда, идемпотентно.** Нет ручных шагов, которые пропустишь или забудешь. Повтор сходится, а не дублирует; launch-агенты перезагружаются только когда их plist реально изменился (без мигания). +- **Fail-closed рантайм.** Слой 5 считает загруженные vs упавшие launch-агенты и выходит с ненулевым кодом при любом сбое — полу-развёрнутая машина никогда не отрапортует «успех». +- **Доказуемый паритет.** Smoke слоя 6 сверяет, что Claude и Codex видят один реестр, каждый plist валиден, каждый guard-хук реально блокирует секреты, и ни одного личного данного в tracked. +- **Токен-экономия by design.** Реестр способностей (SSOT) роутит нужный skill/agent/MCP quality-first — агент тратит рассуждение на задачу, а не на переоткрытие собственных инструментов. +- **Самоописываемый рост.** Правила раскладки, skill `organize` и жёсткий хук держат расширение читаемым; конституция остаётся лин-роутером, а не свалкой. + +--- + +## Generic vs личное + +| В репо (публикуемо) | **НЕ** в репо | +|---|---| +| `bootstrap.sh`, `Brewfile`, `smoke/` | **значения** секретов (Keychain / `~/.secrets`) | +| `rules/structure.md`, skills, `launchd/` | контент vault (твой приватный репо) | +| шаблоны `chezmoi/`, `claude-starter/` | `athena.config.sh`, `projects.manifest` | + +Личная инстанция = заполненный `athena.config.sh` + приватный chezmoi-overlay поверх этого generic-каркаса. + +--- + +## Команды + +```bash +shellcheck bootstrap.sh smoke/*.sh # линт +./bootstrap.sh --dry-run # сухой прогон +./bootstrap.sh --only=<0|0b|1..6> # один слой +smoke/smoke.sh # паритет + структура +smoke/dry-validate.sh # валидация рендера шаблонов (без chezmoi) +``` + +Читай [`specs/`](specs/) первым (фазовый план), [`docs/decisions/`](docs/decisions/) для архитектурных решений, и проектный [`CLAUDE.md`](CLAUDE.md) как карту. + +--- + +

Athena — богиня мудрости и стратегии. Твоя система, ставшая переносимой.

diff --git a/docs/assets/hero.png b/docs/assets/hero.png new file mode 100644 index 0000000..daf05c9 Binary files /dev/null and b/docs/assets/hero.png differ diff --git a/docs/assets/merge.png b/docs/assets/merge.png new file mode 100644 index 0000000..ea33b92 Binary files /dev/null and b/docs/assets/merge.png differ diff --git a/docs/assets/six-layers.png b/docs/assets/six-layers.png new file mode 100644 index 0000000..1fbea58 Binary files /dev/null and b/docs/assets/six-layers.png differ diff --git a/docs/assets/three-planes.png b/docs/assets/three-planes.png new file mode 100644 index 0000000..16fb48d Binary files /dev/null and b/docs/assets/three-planes.png differ