Skip to content

fix(skills): restore wp-coding-agents skills on every kimaki restart#62

Merged
chubes4 merged 1 commit intomainfrom
fix-post-upgrade-skill-restore
Apr 24, 2026
Merged

fix(skills): restore wp-coding-agents skills on every kimaki restart#62
chubes4 merged 1 commit intomainfrom
fix-post-upgrade-skill-restore

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented Apr 24, 2026

Summary

wp-coding-agents installs agent skills into three places when CHAT_BRIDGE=kimaki:

  1. $SITE_PATH/.opencode/skills/ (or .claude/skills/) — runtime dir, used by opencode/claude directly.
  2. $(npm root -g)/kimaki/skills/ — the only path kimaki reads for Discord slash command registration. Kimaki hardcodes opencode's skills.paths to its own install dir (kimaki src/opencode.ts:669-671), so this mirror copy is required for /upgrade-wp-coding-agents & friends to show up as Discord slash commands.
  3. (new) the persistent kimaki-config skill source — see below.

The fragility: npm update -g kimaki (or any reinstall) wipes $(npm root -g)/kimaki/skills/. wp-coding-agents already handles the kill-list side of kimaki's bundled-skill cleanup via kimaki/post-upgrade.sh + kimaki/skills-kill-list.txt (runs on every kimaki restart — VPS via ExecStartPre, local via upgrade.sh inline). But there was no symmetric restore process re-copying wp-coding-agents skills back in. Discord slash commands silently degraded between upgrades.

Repro on a real Studio install: /upgrade-wp-coding-agents-skill stopped being registered as a Discord slash command because the skill file wasn't in $(npm root -g)/kimaki/skills/ even though it lived in the repo at skills/upgrade-wp-coding-agents/SKILL.md.

Fix

Make the kimaki skill-restore symmetric with the kill-list flow — both run automatically on every kimaki restart, both idempotent.

Persistent skill source dir

New durable source of truth for wp-coding-agents skills, mirroring the kimaki-config/plugins/ pattern already used for plugin persistence:

  • Local: $KIMAKI_DATA_DIR/kimaki-config/skills/ (defaults to ~/.kimaki/kimaki-config/skills/)
  • VPS: /opt/kimaki-config/skills/

lib/skills.sh

New install_skills_to_persistent_source() called from inside the existing CHAT_BRIDGE=kimaki block. Mirrors every SKILL.md-containing subdir from the runtime skills dir into the persistent source dir. Idempotent (rm -rf then cp -r).

Also drops the stale "re-run --skills-only after upgrading" warning — the restore is now automatic on every kimaki restart.

kimaki/post-upgrade.sh

After the existing kill loop, new restore loop:

  1. Resolve source dir: KIMAKI_SKILL_SOURCE_DIR env > $KIMAKI_DATA_DIR/kimaki-config/skills/ > $HOME/.kimaki/kimaki-config/skills/ > /opt/kimaki-config/skills/.
  2. For each subdir containing SKILL.md, rm -rf the target in SKILLS_DIR and cp -r from source.
  3. Log kimaki-config: restored <skill>. Count restored skills separately from removed.

Header comment updated to document both kill and restore roles. Filenames unchanged (post-upgrade.sh / skills-kill-list.txt) because VPS systemd unit references them via ExecStartPre.

skills/upgrade-wp-coding-agents/SKILL.md

Step 4 now documents the persistent skill source dir and the dual kill/restore passes.

Testing

  • bash -n lib/skills.sh kimaki/post-upgrade.sh — passes.
  • tests/bridge-render.sh — all 8 snapshots byte-identical.
  • ./setup.sh --local --skills-only --wp-path … --chat kimaki --dry-run — new Would mirror skills to persistent source: …/kimaki-config/skills/ line surfaces.
  • Real run on Studio install (intelligence-chubes4): all three dirs populated — .claude/skills/ (runtime), $(npm root -g)/kimaki/skills/ (kimaki bundled), and ~/.kimaki/kimaki-config/skills/ (new persistent source), 5 skills each.
  • Wipe simulation: rm -rf $(npm root -g)/kimaki/skills/upgrade-wp-coding-agents, then bash kimaki/post-upgrade.sh → logs kimaki-config: restored upgrade-wp-coding-agents (and 4 others), skill reappears in the bundled dir.

Out of scope

  • Doesn't touch kimaki itself.
  • No file renames (VPS systemd ExecStartPre still finds post-upgrade.sh + skills-kill-list.txt at their existing paths).
  • No VPS systemd unit changes.
  • Multi-runtime skill-dir population (e.g. populating both .claude/skills/ and .opencode/skills/ in a single run) is a separate concern — tracked as a follow-up.

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (Opus 4.7)
  • Used for: drafted the fix design and implementation (persistent source path, symmetric restore loop, idempotency). Chris reviewed and validated the full restore cycle on his Studio install — real populate run, simulated npm wipe, post-upgrade.sh restore verified end-to-end.

npm update -g kimaki wipes $(npm root -g)/kimaki/skills/, which is the
only path kimaki reads for Discord slash command registration (kimaki
hardcodes opencode's skills.paths to its own install dir). Without a
restore mechanism, wp-coding-agents skills silently disappear between
upgrades and slash commands like /upgrade-wp-coding-agents stop working.

Make the kimaki skill-restore symmetric with the existing kill-list flow:
both run automatically on every kimaki restart, both idempotent.

- lib/skills.sh: add install_skills_to_persistent_source() that mirrors
  every SKILL.md-containing subdir into a persistent source dir
  ($KIMAKI_DATA_DIR/kimaki-config/skills/ on local, /opt/kimaki-config/
  skills/ on VPS). Drops the stale "re-run --skills-only after upgrading"
  warning — the restore is now automatic.

- kimaki/post-upgrade.sh: after the kill loop, resolve the persistent
  source dir (KIMAKI_SKILL_SOURCE_DIR env > $KIMAKI_DATA_DIR path >
  ~/.kimaki fallback > /opt fallback) and rm -rf + cp -r each skill
  subdir into SKILLS_DIR. Counts restored skills separately from removed.
  Header comment now documents both roles.

- skills/upgrade-wp-coding-agents/SKILL.md: Step 4 now documents the
  persistent skill source dir and the dual kill/restore passes.

Filenames unchanged (VPS systemd unit references post-upgrade.sh and
skills-kill-list.txt via ExecStartPre).
@chubes4 chubes4 merged commit 7fbe0a3 into main Apr 24, 2026
2 checks passed
@chubes4 chubes4 deleted the fix-post-upgrade-skill-restore branch April 24, 2026 00:09
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