* chore(memory): remove plugin block from opencode.json * chore(memory): remove setup-memory.sh and memory-setup.ts * chore(memory): remove opencode-memory from Dockerfile * docs(memory): update AGENTS.md and SKILL.md for new tools * test(memory): drop tests for removed setup-memory.sh and memory-setup.ts * docs(handoff): add handoff and ADR-045 for plugin/rust removal * docs(handoff): set PR number * docs(project-map): update after plugin/rust removal --------- Co-authored-by: opencode-agent <agent@opencode.local>
63 lines
No EOL
4.3 KiB
Markdown
63 lines
No EOL
4.3 KiB
Markdown
# ADR-045: Remove @mathew-cf/opencode-memory plugin + Rust artifacts
|
||
|
||
## Статус
|
||
|
||
Accepted (2026-07-26)
|
||
|
||
## Контекст
|
||
|
||
После миграции на единую гибридную систему памяти (5 TS tools, PR #101) + E2E
|
||
покрытия (PR #102) сохранилась двойная система:
|
||
|
||
- **Plugin `@mathew-cf/opencode-memory`** прописан в `opencode.json` блоке
|
||
`plugin` и устанавливается в `Dockerfile` через `npm install -g`. Но plugin
|
||
не вызывается из-за бага wrapper-пути (см. ADR-043, handoff pr-101) —
|
||
фактически мёртвый код, съедающий ~85 MB в image + cache.
|
||
- **Rust `rag-cli` binary** (внутри плагина) пишет `.rag/index.bin` (7.5 MB) +
|
||
`.rag/meta.json` (12 KB) в Rust-формате (`hidden_size`, `model_id`,
|
||
`file_hashes`). Python `src/memory/index.py` пишет `.rag/index.json` (210 MB,
|
||
4096-dim embeddings) + `.rag/meta.json` в Python-формате (`version`, `files`).
|
||
**Конфликт**: оба пишут `meta.json` по одному пути, разные форматы → Rust
|
||
перетирает Python → broken индекс при сосуществовании.
|
||
- **`setup-memory.sh`** (4.6 KB) — shell-скрипт инициализации, заменён на
|
||
auto-setup внутри `memory-save.ts` (git init + hook если remote set).
|
||
- **`memory-setup.ts`** (716 B) — TS tool-обёртка над `setup-memory.sh`,
|
||
заменён на `memory-doctor.ts` (read-only диагностика, не модифицирующий).
|
||
|
||
Cleanup нужно делать ПОСЛЕ подтверждения что TS tools работают (PR #101) и E2E
|
||
тесты проходят (PR #102) — иначе остались бы без памяти. Issue #97 (E2E green)
|
||
был blocker для #98.
|
||
|
||
## Решение
|
||
|
||
Удалить все артефакты старой системы за один PR (issue #98, фаза 3 эпика #94):
|
||
|
||
1. `opencode.json` — убрать блок `plugin` целиком. JSON остался валидным.
|
||
2. `Dockerfile` — убрать `@mathew-cf/opencode-memory` из `npm install -g`.
|
||
3. `.opencode/scripts/setup-memory.sh` — удалить (auto-setup в `memory-save.ts`).
|
||
4. `.opencode/tools/memory-setup.ts` — удалить (заменён на `memory-doctor.ts`).
|
||
5. Rust артефакты на хосте: `.rag/index.bin`, `.rag/meta.json` (Rust-формат),
|
||
`~/.cache/opencode/packages/@mathew-cf/opencode-memory@latest/` + sibling
|
||
`opencode-memory/` (оба 85 MB). НЕ трогать `.rag/index.json` (Python).
|
||
6. `AGENTS.md` + `SKILL.md` — обновить Tool Usage Policy: убрать
|
||
`memory-setup()`, добавить 5 kebab-case tools (`memory-doctor`, `memory-save`,
|
||
`memory-search`, `memory-list`, `memory-access`).
|
||
7. Тесты: инвертировать assertions `test_dockerfile.py` (плагин должен
|
||
ОТСУТСТВОВАТЬ), удалить тесты для `setup-memory.sh` и `memory-setup.ts`.
|
||
|
||
Имя tool-casing: **kebab-case** для локальных `.opencode/tools/*.ts` (runtime
|
||
registry = filename), confirmed ADR-009 + memory `tool-name-casing-kebab-vs-mcp-snake`.
|
||
MCP plugin tools были snake_case, но плагин удалён — больше не актуально.
|
||
|
||
## Альтернативы
|
||
|
||
- **Оставить plugin как fallback** — отклонено: plugin не вызывается из-за
|
||
wrapper-бага, Rust meta.json конфилктует с Python, ~170 MB мёртвого веса.
|
||
Двойная система = каша, двойной maintenance, риск что Rust перетрёт Python
|
||
индекс.
|
||
- **Удалить только Rust артефакты, оставить plugin в конфиге** — отклонено:
|
||
plugin без `npm install` = silent skip (opencode логирует warning), но
|
||
оставляет мёртвый блок в конфиге + вводит в заблуждение.
|
||
- **Поэтапный cleanup (несколько PR)** — отклонено: артефакты тесно связаны
|
||
(plugin → setup-memory.sh → memory-setup.ts → Rust binary), частичный cleanup
|
||
оставляет поломанное состояние. |