Skip to content

Tip: Graphify file writes invalidate prompt cache in Claude Code (Recommended docs update) #1387

Description

@Korck-lab

Hello Graphify team!

Graphify is an awesome tool for providing structured context to AI coding agents. However, when run interactively inside Anthropic's Claude Code CLI, we detected a performance/cost gotcha that we wanted to share along with a recommended documentation update.

We developed claude-code-optimizer to audit local session logs for cache misses and token waste. Across 515 active projects utilizing Graphify (with 2,404 total command calls):

  • The Issue: In 54 sessions, the Graphify tool generated output file writes (such as graph.json or graphify-out) in unignored workspace directories.
  • The Cost Impact: Every time a file in the workspace is written to without being ignored, it instantly invalidates Claude's prompt cache. On the subsequent turn, Claude is forced to re-upload and re-parse the entire codebase context at full cache-write rates ($3.75/M tokens), losing the 90% caching discount.
  • Recommended Mitigation: We suggest adding a tip in your README recommending that users add Graphify's output directories to their project's .claudignore file:
# .claudignore
graph.json
graphify-out/

This keeps the prompt cache warm and prevents costly invalidation loops when graphing the codebase!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions