| name | cortex-redeploy |
| description | Re-run the cortex plugin setup hook with the current userConfig and verify the Docker Compose deployment. Use when the user asks to redeploy cortex, apply plugin config changes immediately, rerun the setup hook, refresh the Docker deployment, or recover after an automated SessionStart/ConfigChange hook did not run. |
Cortex Redeploy
Run the binary-owned plugin setup hook directly, then verify the selected deployment mode is healthy.
Before Running
Explain that the hook exports current userConfig into environment variables, then delegates to cortex setup repair. The shared setup path repairs ~/.cortex/.env, writes Compose assets under ~/.cortex/compose, recreates the Docker Compose container when needed, and removes stale user-level cortex.service units/drop-ins left by older plugin versions. Recreating the container causes a brief /health gap.
If the user asked for a dry run only, stop after describing what would happen.
Workflow
-
Run:
${CLAUDE_PLUGIN_ROOT}/scripts/plugin-setup.sh
Capture stdout, stderr, and exit code.
-
Verify HTTP health:
curl -sS -m 3 -o /dev/null -w '%{http_code}' "$CLAUDE_PLUGIN_OPTION_SERVER_URL/health"
Expect 200.
-
Verify the active runtime:
docker ps --filter name=cortex --format '{{.Status}}'; expect Up ... (healthy) or briefly (starting) just after recreate. Wait up to 60 seconds before treating (starting) as a failure.
-
Verify runtime freshness:
${CLAUDE_PLUGIN_ROOT}/scripts/check-runtime-current.sh
Expect CURRENT. Treat STALE or FAIL as a failed redeploy verification and include the printed fix: line when present.
Report
Include:
- Hook exit code
- The
cortex: ... summary line printed by the hook
- Health check result
- Container state line
- Runtime freshness verdict (
CURRENT, STALE, or FAIL)
If anything failed, recommend cortex-dr for the comprehensive diagnostic.