Skip to main content

Upgrades and Auto-Update Notifications

Goal

Users get notified of new ModusBrain features conversationally, and the agent walks them through upgrading with post-upgrade migrations that make the new version actually work.

What the User Gets

Without this: ModusBrain ships updates but nobody knows. The user stays on an old version with stale skills and missing features. Or worse, someone runs modusbrain upgrade but skips the post-upgrade steps, leaving new code with old agent behavior. With this: the agent checks for updates daily, sells the upgrade with punchy benefit-focused bullets, waits for explicit permission, then runs the full upgrade flow including re-reading skills, running migrations, and syncing schema. The user gets new capabilities automatically.

Self-upgrade modes (v0.42)

modusbrain now stays current the way gstack does: it rides invocation frequency. A throttled, cache-read-only check runs at the start of every modusbrain invocation (CLI and MCP) and emits an UPGRADE_AVAILABLE <old> <new> marker on stderr. No host cron required — every agent kind (Claude Code, Codex, OpenClaw, Hermes, the modusbrain serve host behind a Perplexity thin client) converges to current by construction. The behavior is governed by one file-plane config key, self_upgrade.mode: Enable hands-off upgrades on an always-on install with one line:
auto is deliberately NOT a default anywhere — it’s an explicit autonomy grant, because applying code from GitHub unattended is, by design, remote code execution. The trust model is TLS + GitHub (same as modusbrain upgrade); signature verification is a tracked follow-up. Apply manually any time with modusbrain self-upgrade.

Implementation

The Check (cron-initiated)

The Upgrade Message

Sell the upgrade. The user should feel “hell yeah, I want that.” Lead with what they can DO now that they couldn’t before, not what files changed.

Handling Responses

In notify mode (the default), never auto-upgrade — always wait for explicit confirmation. The auto mode (opt-in, see “Self-upgrade modes” above) is the only path that applies without a prompt, and only under its conservative gates (quiet hours + idle + doctor-gate). This per-cron-prompt flow is the notify experience.

The Full Upgrade Flow (after user says yes)

Migration Files

Migration files live at skills/migrations/vX.Y.Z.md. They contain agent instructions (not scripts) for post-upgrade actions that make the new version work for existing users. Example: v0.5.0 migration sets up live sync and runs the verification runbook. The agent reads migration files in version order and executes them step by step. Without migrations, the agent has new code but the user’s environment hasn’t changed.

Cron Registration

Frequency Preferences

Default: daily. Store in agent memory as modusbrain_update_frequency: daily|weekly|off. Also persist in ~/.modusbrain/update-state.json so it survives agent context resets.

Standalone Skillpack Users

If you loaded this SKILLPACK directly (copied or read from GitHub) without installing modusbrain, you can still stay current. Both MODUSBRAIN_SKILLPACK.md and MODUSBRAIN_RECOMMENDED_SCHEMA.md have version markers:
If the remote version is newer, fetch the full file and replace your local copy. Set up a weekly cron to check automatically.

Tricky Spots

  1. In notify mode, never auto-install. The upgrade waits for the user’s explicit “yes.” Even if the check detects an update and the changelog looks great, the agent messages the user and waits. The auto mode (opt-in) exists for headless/always-on installs where there’s no human to prompt — it applies only during quiet hours, only when idle, doctor-gated, never retrying a known-bad version. Don’t enable auto on an interactive workstation; the prompt-first notify flow is the right default there.
  2. Migration files are agent instructions, not scripts. They tell the agent what to do step by step in plain language. They are NOT bash scripts to execute blindly. The agent reads them, understands the context, and adapts to the user’s specific environment (e.g., skip a step if the user already has live sync configured).
  3. check-update should run on a daily cron. Don’t rely on the user remembering to check for updates. The cron runs modusbrain check-update --json daily at 9 AM (respecting quiet hours). If there’s nothing new, it stays completely silent. The user only hears about updates when there IS something worth upgrading to.

How to Verify

  1. Run check-update and verify detection. Execute modusbrain check-update --json. Verify it returns the current version and correctly reports whether an update is available. If update_available is false, verify the version matches the latest release on GitHub.
  2. Verify migration files are readable. List skills/migrations/ and check that each file follows the naming convention vX.Y.Z.md. Open one and verify it contains step-by-step agent instructions, not raw scripts. The agent should be able to read and execute each step.
  3. Test the full upgrade flow end-to-end. If an update is available, say “yes” and watch the agent execute the full flow: upgrade, re-read skills, run migrations, sync schema, report. Verify each step completes and the agent reports what changed.

Part of the ModusBrain Skillpack.