feat: dreaming meta-agent + tg-transcribe + infra fixes (sessions 034-037)#54
Merged
Merged
Conversation
write_text открывал файл в w-mode и truncate'ил содержимое ДО того как мог упасть на encoding error — при surrogate-символах в чужом контенте CURRENT_CONTEXT.md обнулялся. Фикс: переписан _atomic_write через tempfile.NamedTemporaryFile в той же папке + fsync + os.replace. Atomic rename гарантирует что target либо содержит старый текст, либо новый — никогда промежуточное состояние. Дополнительно: stdin читается как bytes + decode utf-8 явно — больше не нужен PYTHONIOENCODING=utf-8 для запуска на Windows. Bonus: diary.md commands — regex-based парсинг номеров вместо isdigit slice, толерантен к суффиксам типа '001b_*.md' если появятся. Найден в session 037 при /handoff коллизии с surrogate-символами. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-agent) tools/tg-transcribe — replacement для cortex-vm + Gemini pipeline: - Groq Whisper-large-v3-turbo через локальный Telethon (stolen .session с VM) - 1-2 сек/voice (vs 10-25 сек cortex-vm + Gemini), 5 voices = 6.6 сек wall - CLI: latest @user [N] / message @user msg_id / file path/to.ogg - Voice cache в data/voices/ (re-runs не качают) - Free tier ~25 voices/min, GROQ_API_KEY в Cortex .env tools/dreaming — weekly meta-analysis самого Claude Code + субагентов: - Читает .claude/agent-memory + per-user diary за окно + все reflections - Шлёт в Gemini 3.1 Pro, получает 5 типов паттернов с предложениями правил для CLAUDE.md, .claude/agents/*, .claude/skills/*, hooks, memory - Output: runtime/dreaming/YYYY-MM-DD.md (gitignored, dry-run only) - Резолвит project root через CLAUDE_PROJECT_DIR → walk-up .env → fallback - Стоимость: ~$0.05/прогон, $2.6/год при еженедельном запуске - Production-ready для open-source: никакого хардкода путей, минимум deps Smoke-run на корпусе 100KB вернул 5 findings + 2 факта — 4 из них применены в этом сеансе (см. следующий коммит про max-transcriber + recipe). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… recipe
Findings from runtime/dreaming/2026-05-08.md (first dreaming run) — applied:
.claude/agents/max-transcriber.md
Добавлен блок «Сначала кнопка →T» в начале — в UI Max возле голосового
есть нативная кнопка транскрибации, работает на порядки быстрее CDP +
whisper pipeline. Через Playwright: browser_snapshot → найди кнопку →
browser_click. Текст появляется в чате.
CDP+whisper flow стал fallback'ом для случаев когда нативная не работает.
docs/learned-the-hard-way.md
Новый recipe «Удалил файл хука → фоновый спам 'File not found' до конца
сессии». Симптом: после rm .claude/hooks/<name>.py каждое действие
генерирует ошибку. Причина: Claude Code кеширует settings.json на время
жизни сессии. Фикс (выбрать один):
- Stub-вариант: заменить на no-op (sys.exit(0)), удалить позже
- Clean-вариант: убрать запись из settings.json + /clear
Источник: diary 028, dreaming-2026-05-08.
Skipped из dreaming-отчёта (не применены):
- Edit Unicode → _patch.py (over-fitting на 1 случае)
- SQL без чтения schema (overlap с уже существующими правилами)
Deferred:
- Хардкод абсолютных путей в worktree — уже в backlog (рефакторинг через
CLAUDE_PROJECT_DIR env var)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
3 коммита от мульти-сессионного дня 2026-05-08:
atomic_context_merge.pycrash-safe (write_text truncate-without-temp bug → tempfile + os.replace) +diary.mdregex-based number parsertools/tg-transcribe/(Groq Whisper, 1-2с/voice) иtools/dreaming/(weekly meta-analysis Claude Code + субагентов через Gemini 3.1 Pro)→Tbutton (CDP стал fallback), settings.json hook cache recipeWhy
CLAUDE_PROJECT_DIR)Smoke tests
tools/dreaming/: ruff clean, end-to-end run на 100KB корпусе → 5 findings, $0.05/прогонtools/tg-transcribe/: 5 voices = 6.6с wall-clock (vs 50-125с старым pipeline)scripts/atomic_context_merge.py: 5 параллельных воркеров → zero lost updates (runtime/test_handoff_race.py)Test plan
git pull→ проверить чтоtools/dreaming/работает (cd tools/dreaming && uv sync && uv run python dreaming.py --dry)tools/tg-transcribe/запускается (нужны GROQ_API_KEY + .session файл)/handoff— убедиться чтоatomic_context_merge.pyне падает на surrogate-символах (если встретятся)🤖 Generated with Claude Code