diff --git a/docs/sleep/plugin_load_test.md b/docs/sleep/plugin_load_test.md index e08eab4..c420646 100644 --- a/docs/sleep/plugin_load_test.md +++ b/docs/sleep/plugin_load_test.md @@ -23,7 +23,7 @@ from scratch for this test. Two forms were used: | Shell | What was run | Result | |---|---|---| | **Claude Code** (`scripts/sleep.sh`) | `harvest`, full `run`, `adopt` | harvest found 2 sessions → 2 tasks; `run` staged a proposal; `adopt` honored the safety contract (no live change when nothing was accepted) | -| **Codex** (`install.sh` + shared runner) | `install.sh` into a temp HOME | placed the user-level `~/.agents/skills/skillopt-sleep/SKILL.md` skill correctly and did not install a deprecated custom prompt | +| **Codex** (`install.sh` + shared runner) | `install.sh` into a temp HOME | placed the user-level `~/.agents/skills/skillopt-sleep/SKILL.md` skill correctly and moved any legacy custom prompt aside instead of installing one | | **Copilot** (`mcp_server.py`) | `initialize` → `tools/list` → `tools/call sleep_harvest` | 5 tools listed; `sleep_harvest` returned real engine output (2 sessions → 2 tasks) | ### Genuine improvement (real model, fresh persona) diff --git a/plugins/codex/README.md b/plugins/codex/README.md index 59d9381..376bc46 100644 --- a/plugins/codex/README.md +++ b/plugins/codex/README.md @@ -28,6 +28,9 @@ bash plugins/codex/install.sh # installs the skill export SKILLOPT_SLEEP_REPO="$(pwd)" # so the runner is found from anywhere ``` +If a previous install created `~/.codex/prompts/sleep.md`, the installer moves +that deprecated prompt aside with a `.skillopt-legacy*.bak` suffix. + Requires Python ≥ 3.10 and the `codex` CLI on PATH. ## Use diff --git a/plugins/codex/install.sh b/plugins/codex/install.sh index e2d413a..11b0735 100755 --- a/plugins/codex/install.sh +++ b/plugins/codex/install.sh @@ -4,7 +4,9 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +CODEX_HOME="${CODEX_HOME:-$HOME/.codex}" AGENTS_SKILLS="${HOME}/.agents/skills" +LEGACY_PROMPT="$CODEX_HOME/prompts/sleep.md" echo "[install] repo: $REPO_ROOT" @@ -13,11 +15,21 @@ mkdir -p "$AGENTS_SKILLS/skillopt-sleep" cp "$REPO_ROOT/plugins/codex/skills/skillopt-sleep/SKILL.md" "$AGENTS_SKILLS/skillopt-sleep/SKILL.md" echo "[install] skill -> $AGENTS_SKILLS/skillopt-sleep/SKILL.md" -# 2) record the repo location so the runner is found from anywhere +# 2) retire the old custom prompt entrypoint from previous installs +if [ -f "$LEGACY_PROMPT" ]; then + backup="${LEGACY_PROMPT}.skillopt-legacy.bak" + if [ -e "$backup" ]; then + backup="${LEGACY_PROMPT}.skillopt-legacy.$(date +%Y%m%d%H%M%S).bak" + fi + mv "$LEGACY_PROMPT" "$backup" + echo "[install] legacy prompt -> $backup" +fi + +# 3) record the repo location so the runner is found from anywhere echo "[install] add to your shell profile:" echo " export SKILLOPT_SLEEP_REPO=\"$REPO_ROOT\"" -# 3) optional: append an AGENTS.md hint (only if the user opts in) +# 4) optional: append an AGENTS.md hint (only if the user opts in) cat <