Skip to content

Enforce Claude graph lookup before raw search#626

Open
robertmonka wants to merge 2 commits intosafishamsi:v5from
robertmonka:claude-graphify-guard
Open

Enforce Claude graph lookup before raw search#626
robertmonka wants to merge 2 commits intosafishamsi:v5from
robertmonka:claude-graphify-guard

Conversation

@robertmonka
Copy link
Copy Markdown

Summary

  • install a Claude UserPromptSubmit reminder before tool selection
  • add a Claude PreToolUse guard that blocks raw search/read/list tools until graphify is used in the session
  • refresh stale CLAUDE.md graphify sections during install and preserve unrelated Claude hooks
  • cover refresh, hook cleanup, and guard behavior in tests

Tests

  • PYTHONPYCACHEPREFIX=/tmp/graphify-pycache python -m py_compile graphify/main.py tests/test_claude_md.py tests/test_install.py
  • uv run --with pytest pytest tests/test_claude_md.py -q
  • uv run --with pytest pytest tests/ -q --tb=short

@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, The embedded guard script detects graph usage and excludes graphify-out/.claude paths using hard-coded POSIX separators, which fails on Windows-style backslash paths and causes incorrect blocking/allowing behavior. This breaks the guard for the repo’s Windows Claude platform.

Severity: action required | Category: correctness

How to fix: Normalize guard path separators

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

The guard script compares paths using hard-coded forward slashes, which fails on Windows/backslash paths and breaks the intended allow/block behavior.

Issue Context

The repo supports a Windows Claude platform. The guard should recognize graph report/wiki reads and exclude graphify-out/.claude paths regardless of path separator.

Fix Focus Areas

  • graphify/main.py[63-116]

Implementation notes

  • Normalize incoming file_path strings early (e.g., norm = path.replace('\\', '/')).
  • Run all endswith/in checks against the normalized string.
  • Add/extend tests to cover Windows-style paths (unit-test normalization directly, or test with backslash file_path strings).

We noticed a couple of other issues in this PR as well - happy to share if helpful.


Spotted by Qodo code review - free for open-source projects.

@robertmonka robertmonka force-pushed the claude-graphify-guard branch from db4c844 to 6c28d76 Compare May 4, 2026 17:32
@robertmonka robertmonka force-pushed the claude-graphify-guard branch from 6c28d76 to 4b7d0ac Compare May 4, 2026 18:18
@robertmonka
Copy link
Copy Markdown
Author

Thanks for the review! I pushed an update addressing the Windows path separator issue in the Claude guard, rebased the branch onto the current v5, and the latest PR checks show no failing checks. Could you please take another look and merge if it looks good?

@robertmonka
Copy link
Copy Markdown
Author

Quick correction: please hold off on merging for now. I saw the refreshed CI failures after the rebase and am fixing them before asking for another review.

@robertmonka
Copy link
Copy Markdown
Author

The requested Qodo fix is now addressed: the Claude guard normalizes Windows-style backslash paths before checking graphify-out and .claude paths, with regression tests added. I also fixed the refreshed CI failures after rebasing onto v5.\n\nVerification:\n- Local full test suite: 471 passed\n- GitHub Actions: test (3.10), test (3.11), test (3.12), and test (3.13) are all passing\n- PR is mergeable\n\nThis is ready to merge when you have a chance.

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.

2 participants