Skip to content

fix: respect GRAPHIFY_OUT env var in skill files and install templates#1054

Open
yeung108 wants to merge 3 commits into
safishamsi:v8from
yeung108:fix/respect-graphify-out-in-skill
Open

fix: respect GRAPHIFY_OUT env var in skill files and install templates#1054
yeung108 wants to merge 3 commits into
safishamsi:v8from
yeung108:fix/respect-graphify-out-in-skill

Conversation

@yeung108
Copy link
Copy Markdown

@yeung108 yeung108 commented May 28, 2026

Problem

The CLI correctly reads GRAPHIFY_OUT via os.environ.get("GRAPHIFY_OUT", "graphify-out"), but graphify claude install writes three categories of files that all hardcode graphify-out/:

  1. Skill files (~99-189 occurrences each) — when /graphify runs, the agent follows these literally and writes all output to graphify-out/ regardless of the env var
  2. Settings hooks — the bash/Python hooks check graphify-out/graph.json instead of the configured path
  3. CLAUDE.md / AGENTS.md / GEMINI.md sections — reference graphify-out/ in all path instructions

Users who set GRAPHIFY_OUT to a custom directory (e.g., .claude/.local.graphify) must manually patch all three after every graphify claude install.

Fix

Uses GRAPHIFY_OUT consistently as the single variable name across the entire stack — no aliases, no indirection.

Skill files (all 15 variants)

Added a preamble after "Follow these steps in order" that self-defaults the env var:

GRAPHIFY_OUT="${GRAPHIFY_OUT:-graphify-out}"

This is a standard bash idiom — if GRAPHIFY_OUT is already set (from the user's env), it keeps its current value; if unset, it defaults to graphify-out. Then replaced all hardcoded graphify-out with $GRAPHIFY_OUT. This works because:

  • Bash contexts: $GRAPHIFY_OUT expands normally
  • Python inside bash (-c "..." double-quoted strings): bash expands $GRAPHIFY_OUT before Python sees Path('$GRAPHIFY_OUT/...')
  • Cross-repo paths under ~/.graphify/repos/ are kept as-is (CLI-managed)

Install templates (__main__.py)

  • Bash settings hook: uses GRAPHIFY_OUT="${GRAPHIFY_OUT:-graphify-out}" for runtime env var resolution
  • CLAUDE.md / AGENTS.md / GEMINI.md sections: converted to f-strings using _GRAPHIFY_OUT (the existing Python variable on line 19) so the installed content reflects the user's current setting (defaults to graphify-out when env var is unset)
  • Cursor, Kiro, Devin, Antigravity rule templates: same f-string approach
  • Gemini Python hook: reads os.environ.get('GRAPHIFY_OUT', 'graphify-out')
  • OpenCode JS plugin: reads process.env.GRAPHIFY_OUT || "graphify-out"

CLI runtime code, help text, and default fallbacks are unchanged — they already use _GRAPHIFY_OUT or correctly show the default.

Related

yeung108 and others added 3 commits May 28, 2026 08:19
The CLI correctly reads GRAPHIFY_OUT via os.environ.get(), but the skill
files and install templates hardcode graphify-out/ everywhere. When
/graphify runs as a skill, the agent follows the instructions literally
and writes all output to graphify-out/ regardless of the env var.

Skill files (all variants):
- Add a preamble instructing the agent to set
  GOUT="${GRAPHIFY_OUT:-graphify-out}" before each bash block
- Replace all ~99 hardcoded graphify-out references with $GOUT
- Cross-repo paths under ~/.graphify/repos/ are kept as-is

Install templates (__main__.py):
- Settings hook: use _GOUT="${GRAPHIFY_OUT:-graphify-out}" instead of
  hardcoded path check
- CLAUDE.md, AGENTS.md, GEMINI.md sections: use f-strings with
  _GRAPHIFY_OUT so the installed content matches the user's setting
- Cursor, Kiro, Devin, Antigravity rule templates: same f-string fix
- Gemini Python hook: read GRAPHIFY_OUT from os.environ
- OpenCode JS plugin: read process.env.GRAPHIFY_OUT

Follows up on PR safishamsi#758 which fixed the CLI commands but not the skill
templates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the $GOUT shorthand with $GRAPHIFY_OUT everywhere in skill
files. The preamble now self-defaults the env var:

  GRAPHIFY_OUT="${GRAPHIFY_OUT:-graphify-out}"

One name across the entire stack — no alias indirection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use GRAPHIFY_OUT consistently in the bash hook and gout (no underscore)
in the inline Python hook. No more _GOUT indirection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yeung108 yeung108 marked this pull request as ready for review May 28, 2026 07:38
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