Skip to content

fix(skills): complete native skill symlink mapping and add prompt injection fallback#1713

Merged
piorpua merged 4 commits intomainfrom
fix/skill-symlink-native-support
Mar 25, 2026
Merged

fix(skills): complete native skill symlink mapping and add prompt injection fallback#1713
piorpua merged 4 commits intomainfrom
fix/skill-symlink-native-support

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

Summary

  • Fix skill loading for all ACP backends by completing AGENT_SKILLS_DIRS mapping and adding prompt injection fallback for unsupported CLIs
  • Fix Windows symlink permission issue ('dir''junction')
  • Fix codebuddy mapping from .claude/skills to .codebuddy/skills

Changes

src/process/utils/initAgent.ts

  • Expand AGENT_SKILLS_DIRS from 3 to 11 backends (add codex, qwen, iflow, goose, droid, kimi, vibe, cursor)
  • Fix codebuddy directory mapping
  • Remove broken DEFAULT_SKILLS_DIRS (.agents/skills/) fallback — no CLI natively scans it
  • Export hasNativeSkillSupport() function for callers to check backend support
  • Change symlink type from 'dir' to 'junction' (no admin privileges needed on Windows; no-op on macOS/Linux)
  • setupAssistantWorkspace returns early for unsupported backends (caller should use prompt injection)

src/process/task/AcpAgentManager.ts

  • Import hasNativeSkillSupport and prepareFirstMessageWithSkillsIndex
  • First-message handling now branches:
    • Native support: only inject preset rules (skills discovered via workspace symlinks)
    • No native support: fallback to prepareFirstMessageWithSkillsIndex (rules + skills index injected into first message)

tests/unit/initAgent.skills.test.ts (new)

  • 19 unit tests covering hasNativeSkillSupport and setupAssistantWorkspace
  • Tests: supported/unsupported backends, directory mapping, junction type, builtin priority, cron skip, existing target skip, multiple skills, etc.

Related Issue

Closes #1712

Test Plan

  • 19 new unit tests all pass
  • Full test suite passes (1321 tests, 0 failures)
  • Manual: verify Codex backend can load skills via .codex/skills/ symlink
  • Manual: verify unsupported backend (e.g., opencode) receives skills via prompt injection
  • Manual: verify Windows symlink works without admin privileges

zk added 4 commits March 25, 2026 20:39
…ection fallback

- Add all verified backends to AGENT_SKILLS_DIRS (codex, qwen, iflow, goose, droid, kimi, vibe, cursor)
- Fix codebuddy mapping from .claude/skills to .codebuddy/skills
- Remove broken DEFAULT_SKILLS_DIRS (.agents/skills/) fallback that no CLI scans
- Export hasNativeSkillSupport() for callers to check backend support
- Change symlink type from 'dir' to 'junction' for Windows compatibility
- AcpAgentManager: fallback to prepareFirstMessageWithSkillsIndex for unsupported backends
- Add 19 unit tests covering hasNativeSkillSupport and setupAssistantWorkspace

Closes #1712
…tibility

- Use vi.hoisted() for mock tracking variables to ensure proper initialization
- Normalize all paths to forward slashes in mock functions (stat, lstat, symlink, existsSync)
- Replace path.join() in assertions with hardcoded forward-slash paths
- Fixes CI failure on Windows where backslash paths didn't match mock keys
@piorpua piorpua merged commit 008229d into main Mar 25, 2026
14 of 17 checks passed
@piorpua piorpua deleted the fix/skill-symlink-native-support branch March 25, 2026 13:06
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.

fix(skills): native skill symlink broken for most backends

2 participants