Skip to content

docs: v0.9.1 — post-Perplexity-review fixes (Grep matcher, hook health-check, cost caveat)#138

Open
dfrostar wants to merge 2 commits into
mainfrom
claude/v0.9.1-perplexity-review-fixes
Open

docs: v0.9.1 — post-Perplexity-review fixes (Grep matcher, hook health-check, cost caveat)#138
dfrostar wants to merge 2 commits into
mainfrom
claude/v0.9.1-perplexity-review-fixes

Conversation

@dfrostar
Copy link
Copy Markdown
Owner

Summary

Three small precision fixes flagged by a Perplexity Deep Research review of NeuralMind. Each was fact-checked against primary sources before landing. Single commit with Release-As: 0.9.1 footer so release-please proposes a clean v0.9.1 patch.

File Fix
neuralmind/hooks.py Comment block above the PostToolUse matchers documenting Claude Code v2.1.117+ behavior (Grep/Glob folded into Bash on native macOS/Linux). Our matcher list is robust: Grep stays for Windows + npm-install, Bash matcher catches rerouted searches on native builds.
docs/wiki/Troubleshooting.md New "Hook Issues" section with two entries: (1) post-Claude-Code-update health check via neuralmind benchmark ., (2) explicit scope statement — what NeuralMind compresses (built-in Read/Bash/Grep) vs. what it doesn't (third-party MCP tools via mcp__<server>__<tool>).
USAGE.md Inline caveat above the ROI Calculator dollar figures — best-case project-side projections, not independently audited; cross-link to HONEST-ASSESSMENT.md made prominent.

What was NOT changed, and why

  • No version pinning of graphifyy>=0.5.2. Perplexity confused our graphifyy (two y's) with the unrelated safishamsi/graphify repo. Whatever "v0.5.2 hotfix" they cite isn't ours.
  • No "MCP hooks don't work" warning. Current Claude Code hooks docs explicitly support MCP tool matchers via mcp__<server>__<tool>. Perplexity's architectural claim was wrong. Our hooks just don't subscribe to MCP tools (separate, intentional choice — now documented).
  • No reference to "GitHub bug #34713" (false hook-error labels). Unverified; specific issue numbers are exactly what AI research tools confabulate.

Test plan

  • python -m pytest tests/test_hooks.py tests/test_hooks_synapses.py — 26 of 26 passing
  • ruff check neuralmind/hooks.py — clean
  • black --check neuralmind/hooks.py — clean
  • No production code changes (hooks.py change is comment-only); no test changes
  • All claims verified against primary sources (Claude Code hooks reference, claude-agent-sdk-typescript#301)

Order of operations after this merges

  1. release-please proposes v0.9.1 (the Release-As: 0.9.1 footer forces the patch bump even though the commit is docs(...))
  2. Merge that release-please PR (squash) → cuts v0.9.1 tag
  3. release.yml + docker-publish.yml + sbom.yml all fire on the tag (auto if RELEASE_PLEASE_TOKEN secret is set, else gh workflow run from your laptop)

https://claude.ai/code/session_01SH6iHNAqeMJHXdq7ubVcuJ


Generated by Claude Code

…h-check, cost-projection caveat

Three small precision fixes flagged by a Perplexity Deep Research
review of NeuralMind. Each was fact-checked before landing — see the
notes below.

1. neuralmind/hooks.py: add a comment block above the PostToolUse
   matchers documenting Claude Code v2.1.117+ behavior. On native
   macOS/Linux builds the standalone Grep/Glob tools were folded
   into Bash (embedded bfs/ugrep, no separate tool round-trip). The
   Grep matcher entry stays — still active on Windows + npm-installed
   builds, and our Bash matcher catches rerouted search invocations
   on native builds. End-to-end coverage preserved either way.
   Reference: claude-agent-sdk-typescript#301 (open, observed
   behavior is mixed — the change may be partial or installer-
   dependent; our matcher list is robust to all observed states).

2. docs/wiki/Troubleshooting.md: new "Hook Issues" section between
   Query Issues and MCP Issues.
   - "Verify hooks are still firing after a Claude Code update" —
     `neuralmind benchmark .` as the regression-detection command,
     plus a one-liner to inspect ~/.claude/settings.json for the
     installed hook block.
   - "PostToolUse scope — what NeuralMind compresses" — explicitly
     names the built-in tools we compress (Read/Bash/Grep) vs. the
     MCP-tool space (mcp__<server>__<tool>) we deliberately don't
     subscribe to. Closes the implicit ambiguity Perplexity flagged,
     even though the underlying "MCP hooks don't exist" claim it
     made was wrong per current Claude Code hooks docs.

3. USAGE.md: stronger inline caveat above the ROI Calculator dollar
   figures. They're best-case project-side projections, not
   independently audited cost studies; readers should treat them as
   upper bounds for the canonical "loading the codebase to answer
   one question" workload. Cross-link to HONEST-ASSESSMENT.md
   (which already covered this in depth) made prominent right where
   the dollar figures appear.

What was NOT changed, and why:
- No version pinning of graphifyy>=0.5.2. Perplexity confused our
  graphifyy (two y's) with the unrelated safishamsi/graphify repo;
  whatever "v0.5.2 hotfix" they cite isn't ours.
- No "MCP hooks don't work" warning. Current Claude Code hooks docs
  explicitly support MCP tool matchers via mcp__<server>__<tool>;
  Perplexity's architectural claim was wrong. Our hooks just don't
  subscribe to MCP tools (separate choice, documented in #2 above).
- No reference to "GitHub bug #34713" (false hook-error labels) —
  unverified; specific issue numbers are exactly what AI research
  tools confabulate.

Tests: 26 hook tests passing; ruff + black clean.

Release-As: 0.9.1

https://claude.ai/code/session_01SH6iHNAqeMJHXdq7ubVcuJ
Copilot AI review requested due to automatic review settings May 18, 2026 12:54
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation question Further information is requested labels May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

NeuralMind self-benchmark

Status: PASS — floor , measured 5.9×.

Phase 1 — Reduction on committed fixture

  • Average reduction: 5.9×
  • Top-k retrieval hit rate: 71.7%
  • Naive baseline: 47,360 tokens (all fixture files concatenated)
  • NeuralMind total: 8,149 tokens across 10 queries
  • Estimated monthly savings @ 100 queries/day on Claude 3.5 Sonnet: ~$35.30
# Query Shape Naive NeuralMind Ratio Hit
1 auth-flow cross-file 4,736 815 5.8× 33.3%
2 api-endpoints focused 4,736 809 5.9× 100.0%
3 billing-flow cross-file 4,736 846 5.6× 33.3%
4 user-storage cross-file 4,736 672 7.0× 50.0%
5 jwt-verify focused 4,736 681 7.0× 100.0%
6 stripe-webhook focused 4,736 838 5.7× 100.0%
7 create-user cross-file 4,736 794 6.0× 50.0%
8 refund focused 4,736 827 5.7× 100.0%
9 db-choice identity 4,736 899 5.3× 100.0%
10 invoice-send cross-file 4,736 968 4.9× 50.0%

Phase 2 — Learning uplift

  • Memory events logged: 20
  • Learned patterns: 20
  • Reduction ratio after neuralmind learn: 5.9× (Δ +0.00× vs. cold)
  • Top-k hit rate after learning: 71.7% (Δ +0.0 points vs. cold)

Note: uplift numbers on a 500-line fixture are intentionally modest — the point is to
verify the learning mechanism persists and applies. On real production repos the lift
is larger; this test only catches regressions in persistence.

Assumptions

  • Baseline: every .py file in tests/fixtures/sample_project/ concatenated.
  • Tokenizer: tiktoken GPT-4o encoding (per-model breakdown in multi_model.json if generated).
  • Pricing: Claude 3.5 Sonnet input @ $3.0/MTok.
  • Regression floor: — well below NeuralMind's typical 40–70× on real repos.

Per-model token reduction

Model Tokenizer Naive NeuralMind Ratio Source
GPT-4o / GPT-4o-mini tiktoken o200k_base 4,739 927 5.1× measured
GPT-4 / GPT-3.5-turbo tiktoken cl100k_base 4,710 918 5.1× measured
Claude 3.5 Sonnet estimated: GPT-4o × 1.08 — install anthropic for an exact count 5,118 1,001 5.1× estimated
Llama 3 (70B) estimated: GPT-4o × 1.22 — Llama tokenizer requires model weights; estimate based on published vocab ratios 5,781 1,130 5.1× estimated

Rows marked measured use the provider's real tokenizer. Rows marked
estimated apply a published vocab-size correction to the GPT-4o count —
honest approximations, not hardcoded claims.


Automated by .github/workflows/ci-benchmark.yml — regenerate locally with python -m tests.benchmark.run.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies a small set of documentation/comment clarifications around Claude Code hook behavior, hook troubleshooting/diagnostics, and ROI calculator framing, targeting accuracy issues identified during an external review.

Changes:

  • Add an ROI-calculator caveat in USAGE.md and link prominently to docs/HONEST-ASSESSMENT.md.
  • Document Claude Code v2.1.117+ Grep/Glob → Bash behavior in neuralmind/hooks.py (comment-only).
  • Add a new “Hook Issues (Claude Code)” troubleshooting section clarifying hook health checks and PostToolUse compression scope.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
USAGE.md Adds a stronger caveat framing ROI dollar figures as best-case projections and links to Honest Assessment.
neuralmind/hooks.py Adds a compatibility note about Claude Code tool-dispatch changes affecting hook matchers.
docs/wiki/Troubleshooting.md Adds a new section on hook diagnostics and clarifies what NeuralMind does/doesn’t compress.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/wiki/Troubleshooting.md Outdated
Comment on lines +330 to +334
If the reduction ratio dropped sharply vs. your last run (and you didn't change your project), the hook layer may have regressed. Then check `~/.claude/settings.json` to confirm NeuralMind's PostToolUse block is still present:

```bash
python -c "import json; cfg = json.load(open('$HOME/.claude/settings.json')); \
print('NeuralMind hooks installed:', '_neuralmind_v' in str(cfg.get('hooks', {})))"
…pilot review

Two real bugs Copilot caught in the previous commit's snippet:

1. Wrong path. install-hooks defaults to project scope
   (<project>/.claude/settings.json), not ~/.claude/settings.json
   (--global). The snippet only inspected the global file, so a
   project-scope install would always report "not installed". Now
   the diagnostic scans both paths and labels them clearly.

2. Wrong identifier. The marker '_neuralmind_v' doesn't exist in
   our installed blocks. NeuralMind hook blocks are identified by
   the 'neuralmind _hook ...' command embedded in each block (per
   _is_neuralmind_block() in neuralmind/hooks.py:169-182). Updated
   the snippet to scan for that command across every event +
   matcher and print which event/matcher pairs are installed.

Also updated the Fix block to show both install commands (project
and --global) so users reinstall with the right scope.

Reference: PR #138 Copilot review
#138 (comment)

https://claude.ai/code/session_01SH6iHNAqeMJHXdq7ubVcuJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants