Skip to content

docs: clarify that restarting the bot does not recreate the brain#14

Merged
smixs merged 1 commit into
mainfrom
docs/restart-vs-brain
Jun 17, 2026
Merged

docs: clarify that restarting the bot does not recreate the brain#14
smixs merged 1 commit into
mainfrom
docs/restart-vs-brain

Conversation

@smixs

@smixs smixs commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Problem (reported by a downstream fork)

The dev changed CLAUDE_MODEL in .env, ran dbrain restart, and nothing happened. That's because the bot restart reuses the live tmux session as-is_ensure_locked returns early when the session already exists. This is by design (KillMode=process keeps the brain alive so it stays on the subscription), but it's non-obvious.

Fix (docs only)

Document in README and docs/setup-guide.ru.md the distinction:

  • Settings read only at session creationCLAUDE_MODEL, mcp-config.json, the system prompt — take effect only after the brain is recreated: tmux kill-session -t "$(cat ~/.dbrain/brain.name)"; the bot rebuilds it on the next message.
  • Bot-level .env (tokens, ALLOWED_USER_IDS, TZ) applies on a plain dbrain restart.

No code change.

Closes feedback item #4 (model change not applied by a simple bot restart — not a bug, a documentation gap).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b860b8c24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/setup-guide.ru.md Outdated
@@ -1091,6 +1091,12 @@ TZ=Europe/Moscow

Опционально: `CLAUDE_MODEL=sonnet` — переключить сессию на Sonnet, если упираетесь в недельные лимиты подписки; `CRON_ENABLED=false` — выключить планировщик напоминаний.

> **Важно: `dbrain restart` ≠ пересоздание мозга.** Перезапуск перезапускает только Python-процесс бота; долгоживущая сессия Claude Code в tmux при этом **сознательно выживает** (`KillMode=process`) — именно она держит вас на подписке, а не на платных токенах. Поэтому настройки, которые читаются только при СОЗДАНИИ сессии — `CLAUDE_MODEL`, `mcp-config.json`, системный промпт — после простого `dbrain restart` НЕ применятся. Чтобы они вступили в силу, пересоздайте мозг:
> ```bash
> tmux kill-session -t "$(cat ~/.dbrain/brain.name)" # бот поднимет новую сессию при следующем сообщении

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recreate the cron brain too

In installations with CRON_ENABLED left at its default, scheduled jobs run through a second persistent Claude session named ${brain}_cron (get_cron_session builds it with the same model/MCP/system prompt settings). This one-liner only kills the main tmux session, so after following the documented recreation step, reminders/cron jobs can still run with the old CLAUDE_MODEL, mcp-config.json, or prompt until the cron session is killed as well.

Useful? React with 👍 / 👎.

Comment thread docs/setup-guide.ru.md Outdated
@@ -1091,6 +1091,12 @@ TZ=Europe/Moscow

Опционально: `CLAUDE_MODEL=sonnet` — переключить сессию на Sonnet, если упираетесь в недельные лимиты подписки; `CRON_ENABLED=false` — выключить планировщик напоминаний.

> **Важно: `dbrain restart` ≠ пересоздание мозга.** Перезапуск перезапускает только Python-процесс бота; долгоживущая сессия Claude Code в tmux при этом **сознательно выживает** (`KillMode=process`) — именно она держит вас на подписке, а не на платных токенах. Поэтому настройки, которые читаются только при СОЗДАНИИ сессии — `CLAUDE_MODEL`, `mcp-config.json`, системный промпт — после простого `dbrain restart` НЕ применятся. Чтобы они вступили в силу, пересоздайте мозг:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the contradictory MCP restart instruction

This clarification says mcp-config.json changes do not apply after a plain dbrain restart, but the MCP section immediately below still instructs users to add mcp-config.json and then run dbrain restart. In the Russian setup guide this leaves users with two conflicting procedures for the same MCP setup flow, and the later instruction is the one they are likely to follow when adding an MCP server.

Useful? React with 👍 / 👎.

@smixs smixs force-pushed the docs/restart-vs-brain branch from 9b860b8 to 9f9ca3d Compare June 17, 2026 02:01
A downstream fork hit this: changing CLAUDE_MODEL and running `dbrain restart`
did nothing, because the bot restart reuses the live tmux session as-is
(_ensure_locked returns early when the session exists). That is by design —
KillMode=process keeps the brain alive across restarts so it stays on the
subscription — but it is non-obvious.

Document in README and the setup guide that session-creation-time settings
(CLAUDE_MODEL, mcp-config.json, system prompt) need an actual brain recreation.
Recreate BOTH sessions — the main brain and the cron brain (${brain}_cron),
which get_cron_session builds with the same model/MCP/prompt — else scheduled
jobs keep running with the old settings (Codex review). Also fix the MCP
section, which previously told users a plain `dbrain restart` picks up
mcp-config.json — it does not (Codex review). Bot-level .env (tokens,
ALLOWED_USER_IDS, TZ) still applies on a plain restart.
@smixs smixs force-pushed the docs/restart-vs-brain branch from 9f9ca3d to 0c1d987 Compare June 17, 2026 02:15
@smixs smixs merged commit 8afe32e into main Jun 17, 2026
@smixs smixs deleted the docs/restart-vs-brain branch June 17, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant