Upgrading ContextRelay
ContextRelay is published to npm as @proofofwork-agency/contextrelay and ships prebuilt bundles, so upgrading happens in two steps:
- Update the package with your package manager.
- Reconcile your project with
ctxrelay upgradeso the parts ContextRelay manages on your behalf - the project config, the managed instruction blocks inCLAUDE.md/AGENTS.md, the bare/contextrelaycommand, and the registered Claude plugin - line up with the new version.
The binaries contextrelay, ctxrelay, and context-relay are interchangeable; this page uses ctxrelay.
Updating the npm package only changes the files on disk. It does not touch your .contextrelay/config.json, the managed blocks in your instruction files, or the plugin Claude Code has registered. ctxrelay upgrade is the third flow alongside ctxrelay init (first-time setup) and ctxrelay dev (local source rebuild): it brings the agent-facing surface in line with the package you just installed - safely and idempotently.
Step 1 - Update the package
Update to the latest release:
npm install -g @proofofwork-agency/contextrelay@latest
Pin to a specific version when you want a controlled bump:
npm install -g @proofofwork-agency/contextrelay@3.x
Confirm the installed version:
ctxrelay --version
Step 2 - Reconcile with ctxrelay upgrade
From inside your project, run:
ctxrelay upgrade
ctxrelay upgrade reconciles the following, in order, and prints a summary at the end:
- Validates the installed version and records the version it applied, so the next run (and
ctxrelay doctor) can show thefrom → tochange. - Migrate-merges
.contextrelay/config.json. It deep-merges the current defaults into your existing config, so new default keys are added while your explicit values are preserved. Settings you have chosen - coordinator, permissions, activation (auto-connect vs dormant), autonomy, budgets, write-mode - are left exactly as they are. If no project config exists yet, it creates one with defaults, likeinit. - Refreshes the managed instruction blocks in the
CLAUDE.md/AGENTS.mdfiles that already carry a ContextRelay block (your project files plus the conventional global copies and ancestor copies). Each file's state is preserved: a full block is re-rendered as a full block, and a slim (dormant) block stays slim. Only the content inside the managed markers is touched - your own prose outside that region is never altered. - Refreshes the bare
/contextrelaycommand at~/.claude/commands/contextrelay.mdonly if it already exists (it exists when you have gone dormant withctxrelay standalone on). If it is absent,upgradedoes not create it. - Re-registers and reinstalls the Claude plugin so Claude Code picks up the new bundles. This step is best-effort: if it fails (for example, Claude Code is not installed or you are offline),
upgradeprints a clear remediation instead of failing the whole command. - Prints a summary: the version change (
from X → Y, ornow at Y), the config keys added, the instruction files refreshed (with full/slim state), the bare-command status, and the plugin status.
Config reconciliation is additive. It adds the new default keys that a release introduces and leaves your explicit choices untouched. It does not reset your coordinator, flip your activation state, or change your permissions. Always read the printed summary so you know exactly what changed before you resume work.
ctxrelay upgrade re-registers the plugin, but a Claude Code session that is already open keeps the previously loaded plugin until you reload it. When the upgrade finishes, run /reload-plugins in your active Claude Code session (or restart it) so the new plugin takes effect. upgrade reminds you of this in its summary.
Preview first with --dry-run
To see exactly what upgrade would do without writing anything or touching the plugin, run:
ctxrelay upgrade --dry-run
This computes and prints the full plan - config keys that would be added, instruction files that would be refreshed and in which state, bare-command and plugin actions - and performs zero writes. It is the safest way to inspect a bump before applying it.
Flags
| Flag | Effect |
|---|---|
--dry-run | Compute and print the plan only. Writes nothing and runs no plugin install. |
--no-plugin | Skip the Claude plugin re-register/reinstall step. Use this when Claude Code is not installed or you are offline; config and instruction reconciliation still run. |
--instructions <mode> | Control how instruction files are handled (see below). Default: refresh. |
-h, --help | Show usage. |
The --instructions modes:
refresh(default) - refresh only the instruction files that already carry a managed block, preserving each file's slim/full state. This is the conservative default: it never adds a block where there isn't one.project/global/both- additionally install blocks where they are missing, the same wayinitdoes, for the chosen scope.skip- touch no instruction files at all.
# Refresh existing blocks and also install missing project-scope blocks
ctxrelay upgrade --instructions project
# Reconcile config and plugin only; leave all instruction files alone
ctxrelay upgrade --instructions skip
ctxrelay upgrade never runs git, npm, or release operations; it never changes your coordinator or your activation on/off state; and it never "un-slims" a dormant file (that would silently re-activate a session you intentionally quieted). It also does not rebuild ContextRelay from source - that is ctxrelay dev, for local development checkouts.
Verify the upgrade
After upgrading, confirm everything is healthy:
ctxrelay status
ctxrelay doctor
ctxrelay statusprints daemon, session, ledger, and policy state.ctxrelay doctorchecks binaries, auth, state, plugin registration, daemon health, and stale locks. Add--no-authto skip the Claude/Codex auth probes if you only want a quick local check.
Glance at the summary and confirm the coordinator and permissions are still what you expect - see config.json reference and Configure collaboration policy.
The ContextRelay daemon can keep using the previously loaded bundle until it is restarted. ctxrelay upgrade does not force-restart the daemon, so to be certain a long-running daemon is on the new code: finish any active turns and handoffs, run ctxrelay kill, then relaunch your agents (ctxrelay claude / ctxrelay codex, or ctxrelay pair). See Daily operation and Troubleshooting and recovery.
Manual fallback (older releases)
If you are on a ContextRelay release that predates ctxrelay upgrade, you can perform the same reconciliation by hand:
# 1. Re-register and reinstall the Claude plugin
ctxrelay dev # local development checkout (rebuilds from source)
# or reinstall the shipped plugin for your installed package
# 2. Refresh the managed instruction blocks for your scope
ctxrelay instructions install --scope project # or: global | both
# 3. Confirm plugin registration, daemon health, and config
ctxrelay doctor
# 4. Restart the daemon when idle so it loads the new bundle
ctxrelay kill # then relaunch your agents
Then run /reload-plugins in any open Claude Code session, exactly as you would after ctxrelay upgrade.
ctxrelay instructions install rewrites the managed block in your committed CLAUDE.md / AGENTS.md. If those files are under version control, review the diff and commit it deliberately (a fix or chore branch + PR), so the change is reviewed rather than slipping in unnoticed. ContextRelay never deletes content outside its own managed markers.
Next steps
- Tutorial: upgrade ContextRelay safely - a step-by-step walkthrough with a dry-run first.
- config.json reference - every key that reconciliation preserves or adds.
- Troubleshooting and recovery - what to do if the plugin, daemon, or config looks wrong after an upgrade.
- Configure collaboration policy - confirm coordinator and permissions after a bump.