fix(skills): restore wp-coding-agents skills on every kimaki restart#62
Merged
fix(skills): restore wp-coding-agents skills on every kimaki restart#62
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wp-coding-agentsinstalls agent skills into three places whenCHAT_BRIDGE=kimaki:$SITE_PATH/.opencode/skills/(or.claude/skills/) — runtime dir, used by opencode/claude directly.$(npm root -g)/kimaki/skills/— the only path kimaki reads for Discord slash command registration. Kimaki hardcodes opencode'sskills.pathsto its own install dir (kimakisrc/opencode.ts:669-671), so this mirror copy is required for/upgrade-wp-coding-agents& friends to show up as Discord slash commands.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 viakimaki/post-upgrade.sh+kimaki/skills-kill-list.txt(runs on every kimaki restart — VPS viaExecStartPre, local viaupgrade.shinline). 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-skillstopped 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 atskills/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:$KIMAKI_DATA_DIR/kimaki-config/skills/(defaults to~/.kimaki/kimaki-config/skills/)/opt/kimaki-config/skills/lib/skills.shNew
install_skills_to_persistent_source()called from inside the existingCHAT_BRIDGE=kimakiblock. Mirrors everySKILL.md-containing subdir from the runtime skills dir into the persistent source dir. Idempotent (rm -rfthencp -r).Also drops the stale
"re-run --skills-only after upgrading"warning — the restore is now automatic on every kimaki restart.kimaki/post-upgrade.shAfter the existing kill loop, new restore loop:
KIMAKI_SKILL_SOURCE_DIRenv >$KIMAKI_DATA_DIR/kimaki-config/skills/>$HOME/.kimaki/kimaki-config/skills/>/opt/kimaki-config/skills/.SKILL.md,rm -rfthe target inSKILLS_DIRandcp -rfrom source.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 viaExecStartPre.skills/upgrade-wp-coding-agents/SKILL.mdStep 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— newWould mirror skills to persistent source: …/kimaki-config/skills/line surfaces.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.rm -rf $(npm root -g)/kimaki/skills/upgrade-wp-coding-agents, thenbash kimaki/post-upgrade.sh→ logskimaki-config: restored upgrade-wp-coding-agents(and 4 others), skill reappears in the bundled dir.Out of scope
ExecStartPrestill findspost-upgrade.sh+skills-kill-list.txtat their existing paths)..claude/skills/and.opencode/skills/in a single run) is a separate concern — tracked as a follow-up.AI assistance
npmwipe,post-upgrade.shrestore verified end-to-end.