fix(install): resolve Codex agents path on Windows (#340)#398
Open
tirth8205 wants to merge 1 commit into
Open
Conversation
On Windows, Codex CLI doesn't auto-traverse the
`~/.understand-anything-plugin` junction when interpreting relative
`agents/<name>.md` paths emitted by the skill, so subagent dispatches
silently fail to load the agent definition unless the user types the
full path. This bites Codex on Windows but is latent across every
non-Claude host that doesn't inject a runtime plugin root.
Two-pronged fix:
1. `understand-anything-plugin/skills/understand/SKILL.md` and
`understand-anything-plugin/hooks/auto-update-prompt.md`: prefix every
agent-definition reference with the resolved `$PLUGIN_ROOT` so the
dispatcher always receives an absolute path. This mirrors the pattern
already used in `understand-domain/SKILL.md` ("Read the
domain-analyzer agent prompt from $PLUGIN_ROOT/agents/...") and
benefits every platform, not just Windows + Codex.
2. `install.ps1`: also create a vendor-specific plugin-root junction for
codex/opencode/pi (e.g.
`~/.codex/understand-anything/understand-anything-plugin`). These
paths are already in the SKILL.md fallback chain, so even if a host's
Windows runtime refuses to traverse the universal junction it can
still discover the plugin via the vendor-specific one.
`install.sh` is left untouched — symlinks on POSIX already resolve the
universal junction correctly, and the SKILL.md change is the symmetric
fix that helps every platform equally.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Closes #340.
On Windows + Codex CLI,
/understandfails to dispatch its subagents because the relativeagents/<name>.mdpaths emitted by the skill aren't auto-resolved to~/.understand-anything-plugin/agents/<name>.md. The reporter confirmed the agents load when the full path is typed manually, so the underlying junction is fine — it's the implicit path resolution that breaks.This PR ships a two-pronged, defensive fix:
understand-anything-plugin/skills/understand/SKILL.md+hooks/auto-update-prompt.md: everyagents/<name>.mdreference now reads$PLUGIN_ROOT/agents/<name>.md, using the plugin-root variable that the SKILL.md already resolves in Phase 0 step 1.5. This mirrors the pattern already used inunderstand-domain/SKILL.md("Read the domain-analyzer agent prompt from$PLUGIN_ROOT/agents/domain-analyzer.md") and gives every host — Claude Code, Codex, opencode, gemini, pi, anything else — an unambiguous absolute path, so it no longer matters whether the host auto-traverses the universal junction.install.ps1only: for thecodex,opencode, andpiplatforms, also create a vendor-specific plugin-root junction (e.g.~/.codex/understand-anything/understand-anything-plugin). These paths are already in the SKILL.md fallback chain, so even on the worst-case Windows host that won't traverse~/.understand-anything-plugin, the plugin is still discoverable through the vendor-specific junction. POSIX symlinks already resolve the universal junction correctly, soinstall.shis intentionally untouched — the SKILL.md change is the symmetric fix that helps every platform equally.Diagnosis
/understand's SKILL.md resolves a$PLUGIN_ROOTvia a bash chain that probes$CLAUDE_PLUGIN_ROOT,~/.understand-anything-plugin,~/.agents/skills/understand/../..(afterrealpath), and several vendor-specific paths. Once resolved, subsequent phases used to say:That bare
agents/...reference is what hosts have to guess at. On Claude Code the runtime knows the plugin layout and finds it. On Codex Linux/macOS the LLM appears to chase the$PLUGIN_ROOTvariable and read$PLUGIN_ROOT/agents/...anyway. On Codex Windows the path stays unresolved relative to whatever the host's notion of cwd is, the read fails, and dispatch silently drops. Making the absolute path explicit removes the guess.Why install.ps1 also changed
I want a belt-and-suspenders mitigation for Windows users. Even with the SKILL.md fix, the plugin-root resolution chain itself depends on bash (
realpath,readlink -f,$()substitution). If a Windows host doesn't run bash at all and only the universal~/.understand-anything-pluginjunction is created, and the host happens to also refuse to traverse it, the fallback chain has nothing left to try. Mirroring the junction at~/.codex/understand-anything/understand-anything-plugin(which is already in the fallback chain) adds another lifeline.What I could verify (and what I couldn't)
I'm developing on macOS, so I cannot reproduce the Windows + Codex symptom directly. What I did verify:
install.ps1parses as valid PowerShell (manual review —pwshis not installed on this machine). The newLink-Extra-Plugin-Roothelper uses standardTest-Path/Split-Path/New-Itemcalls and reuses the existingRemove-Reparsefor uninstall. The$cfg.Contains('ExtraPluginLink') -and $cfg.ExtraPluginLinkguard is short-circuited so the.ExtraPluginLinkaccess never runs when the key is missing.agents/<name>.mdreferences in dispatch context were updated; only two intentional doc cross-references remain (auto-update-prompt.md:40describes "same semantics as Step 2.5 in agents/project-scanner.md" andextract-import-map.mjs:11is a comment about prior prose docs) — neither is a dispatch path.pnpm lintis clean.What I cannot verify from macOS:
Asking the reporter (and any Windows Codex users): please re-run the installer (
iwr -useb https://raw.githubusercontent.com/tirth8205/Understand-Anything/fix/windows-codex-agents-path/install.ps1 | iex, then./install.ps1 codex), verify that the new junction at~/.codex/understand-anything/understand-anything-pluginexists, then run$understand-anything:understand --language en --fulland confirm the agent definitions load without specifying the full path.Linked issue
How I tested this
pnpm lint(clean)agents/<name>.mdreferences — every dispatch now uses$PLUGIN_ROOT/agents/<name>.mdinstall.ps1(nopwshavailable locally to parse)Versioning
🤖 Generated with Claude Code