Repository navigation
Description
Affected version
graphifyy0.9.25 (uv tool install)graphify/install.py,dispatch_install_cli, ~line 2171-2177- Windows 11, but the code path is platform-independent
Summary
For the always-on platforms (aider, codex, opencode, claw, droid, trae, trae-cn, hermes), the user-scope install and the --project install call the same function with the same argument:
elif cmd in ("aider", "codex", "opencode", "claw", "droid", "trae", "trae-cn", "hermes"):
subcmd = sys.argv[2] if len(sys.argv) > 2 else ""
if subcmd == "install":
if "--project" in sys.argv[3:]:
_project_install(cmd, Path("."))
else:
_agents_install(Path("."), cmd) # <-- also Path(".")_agents_install then does:
target = (project_dir or Path(".")) / "AGENTS.md"So graphify codex install — documented as the user-scope install — writes AGENTS.md into whatever directory the shell happens to be in, not the user config dir (~/.codex/). The --project flag is effectively a no-op for these platforms.
Reproduce
$ cd /some/non-writable/or/unrelated/dir
$ graphify codex install
...
File ".../graphify/install.py", line 1421, in _agents_install
target.write_text(new_content, encoding="utf-8")
PermissionError: [Errno 13] Permission denied: 'AGENTS.md'Run it from a writable but unrelated directory and it succeeds — silently creating a stray AGENTS.md there:
$ cd ~
$ graphify codex install
graphify section written to C:\Users\<user>\AGENTS.md # not ~/.codex/AGENTS.mdCodex reads global instructions from ~/.codex/AGENTS.md, so the user-scope install lands somewhere Codex never reads.
Note the contrast: graphify claude install correctly targets ~/.claude/skills/ and ~/.claude/CLAUDE.md at user scope. Only the always-on branch has this problem.
Expected
graphify <platform> install(no--project) writes to that platform's user config directory — for Codex,~/.codex/AGENTS.md.graphify <platform> install --projectwrites to the current repo.- Neither should ever depend on the shell's cwd for the user-scope case.
Secondary effect
The related _install_codex_hook(project_dir or Path(".")) writes to project_dir / ".codex" / "hooks.json". With project_dir = Path("."), running the command from ~ happens to produce the correct ~/.codex/hooks.json, while running it from ~/.codex would produce a nested ~/.codex/.codex/hooks.json. The two writes want different working directories, so no single cwd makes both correct.
Workaround
Run from $HOME so hooks.json lands correctly, then move the AGENTS.md section into ~/.codex/AGENTS.md by hand.
Related
#1846 raises a different concern about the same function (undeclared mutation of AGENTS.md). This issue is about the target path being wrong and --project being indistinguishable from user scope.
Activity