opencode-config/docs/handoff/pr-103-remove-plugin-rust.md
Sergey 9d654a2201
chore(memory): remove plugin + setup-memory.sh + Rust artifacts (#103)
* 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>
2026-07-27 01:47:26 +03:00

86 lines
No EOL
6.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
pr: 103
title: Remove @mathew-cf/opencode-memory plugin + setup-memory.sh + Rust artifacts
---
## Что сделано
Cleanup двойной системы памяти после перехода на единую гибридную (5 TS tools
PR #101 + E2E PR #102). Удалено всё, что связано со старой plugin-based системой:
1. **`opencode.json`** — убран блок `plugin` с `@mathew-cf/opencode-memory`
(строки 3-10). JSON остался валидным.
2. **`Dockerfile:34`** — `@mathew-cf/opencode-memory` убран из `npm install -g`
(`opencode-ai repomix --unsafe-perm`).
3. **Удалены файлы**:
- `.opencode/scripts/setup-memory.sh` — заменён на auto-setup в `memory-save.ts`
- `.opencode/tools/memory-setup.ts` — заменён на `memory-doctor.ts` (read-only)
4. **Rust артефакты на хосте** (не в git):
- `~/.local/share/opencode/opencode-memory/.rag/index.bin` (7.5 MB, Rust binary)
- `~/.local/share/opencode/opencode-memory/.rag/meta.json` (12 KB, Rust формат
`hidden_size`/`model_id`/`file_hashes` — перетёр бы Python `version`/`files`)
- `~/.cache/opencode/packages/@mathew-cf/opencode-memory@latest/` (85 MB)
- `~/.cache/opencode/packages/@mathew-cf/opencode-memory/` (85 MB, sibling без
`@latest` — тот же плагин, удалён для полноты cleanup)
- Итого освобождено: ~177.5 MB
- Python `index.json` (210 MB, 4096-dim embeddings) НЕ тронут.
5. **`AGENTS.md`** (project) — таблица Tool Usage Policy обновлена: убран
`memory-setup()`, добавлены `memory-doctor`, `memory-save`, `memory-search`,
`memory-list`, `memory-access` (kebab-case для TS tools).
6. **`SKILL.md`** (`.opencode/skills/memory/`) — обновлены имена tools
(`memory_search``memory-search`), описание (плагин удалён, 5 TS tools),
default путь памяти (`/root/.local/share/opencode/opencode-memory`).
7. **Тесты** адаптированы под cleanup:
- `tests/test_dockerfile.py` — assertions инвертированы: плагин должен
ОТСУТСТВОВАТЬ в Dockerfile (issue #98). Regression-guards для `opencode-ai`
и `repomix` сохранены.
- Удалены `tests/test_setup_memory.py`, `tests/test_memory_setup_tool.py`,
`tests/test_memory_setup_tool.ts` — тесты для удалённых `setup-memory.sh`
и `memory-setup.ts`.
- `tests/test_commit_tool.py` — docstring обновлён (ссылка на `memory-setup.ts`
заменена на `spec-status.ts`).
## Почему
Двойная система (plugin + 5 TS tools) = каша. Plugin `@mathew-cf/opencode-memory`
не вызывался из-за бага wrapper-пути, Rust `rag-cli` binary конфликтовал с Python
`index.json` (разные форматы `meta.json` по одному пути). Cleanup ПОСЛЕ того как
5 TS tools работают (PR #101) и E2E тесты проходят (PR #102) — иначе остались бы
без памяти.
Часть эпика #94 (migration plan), фаза 3 (cleanup). Blocked by #97 (E2E green).
## Pending
- Глобальный `/root/.config/opencode/AGENTS.md` и
`/root/.config/opencode/skills/memory/SKILL.md` НЕ обновлены — Write tool
заблокирован для путей вне workspace (`FileSystem.writeFile` error). Это
ручная задача пользователя (копии тех же правок, что в project-файлах).
- `OPENAI_EMBEDDING_BATCH_DELAY` НЕ добавлен в `.env.example` — этот env var
НЕ существует в коде (`src/memory/embedder.py` использует только
`OPENAI_EMBEDDING_BATCH_SIZE` + `Retry-After` из 429-ответа). Добавление
мусорной переменной противоречит правилу «не добавлять мёртвый код». Issue #98
задача 8 ссылается на «аудит» — вероятно устаревшая/ошибочная находка.
- `~/.local/share/opencode/opencode-memory/.gitignore` — отсутствует. Это
локальный репозиторий памяти (отдельный git), `.gitignore` для `.rag/` там
не относится к этому PR — задача 5 issue #98, но не блокер (`.rag/` уже не
содержит Rust артефактов).
## Watch out
- **Кеш `@mathew-cf/opencode-memory/` (без `@latest`)** — кроме `@latest/`
существовал sibling-алиас `opencode-memory/` (85 MB, тот же плагин). Удалён
тоже — иначе кеш не полностью очищен. Issue #98 явно указывает только
`@latest/`, но критерий приёмки «Cache удалён» подразумевает полный cleanup.
- **meta.json** — Python `index.py` и Rust `rag-cli` пишут `meta.json` в ОДИН
путь (`<output>/.rag/meta.json`) но в РАЗНЫХ форматах. Rust: `{model_id,
hidden_size, num_chunks, file_hashes}`. Python: `{version, files:{rel:{sha256,
chunks}}}`. Текущий был Rust-формат → удалён; Python пересоздаст при следующем
reindex. Если снова поставить плагин — он перетрёт Python meta → broken.
- **Тест `test_memory_plugin_in_npm_install`** переименован в
`test_memory_plugin_removed_from_npm_install` (assertion инвертирован). Если
кто-то откатит cleanup — тест провалится с понятным сообщением.
- **Plugin auto-load** — после удаления блока `plugin` из `opencode.json`
плагин НЕ грузится при старте opencode (критерий #98 выполнен).
- **`memory-doctor` tool** — после cleanup НЕ репортит проблем с plugin/Rust
(он их и не проверял — проверяет ripgrep/Python/env/index, которые intact).