Skip to content

Sstobo/context-graph-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Context Graph

Most developers deal with the same 10-20 errors over and over through the years. Different for each person, and different for each library, framework and platform. I build this to help people stop repeating the same work. Solve once, and have Claude remember the what how and why, forever.

By creating a persistent context graph, updating on every bug fix, and using regex and keyword scoring in the hook layer to match current issues with the all your previous fixes helps you and Claude avoid repeating the same work.

Install

git clone https://github.com/sstobo/context-graph-plugin.git
cd context-graph-plugin
./setup.sh

Choose global (all projects) or local (current project only). Restart Claude Code.

Usage

Capture a fix after solving an error:

/graph-it

Triggering /graph-it

Claude finds the error you just fixed, proposes a summary, and saves it after you confirm.

Saved fix example

Automatic injection happens continuously. The hook scans both your prompts and Claude's outputs (bash commands, file writes, edits) for error patterns, matches against your fix database using regex + keyword scoring, and injects the top matches as context.

Context graph in action

How it works

How Context Graph works

  1. Dual monitoring - Hooks watch two streams:

    • UserPromptSubmit - errors you paste or describe
    • PostToolUse (Bash, Write, Edit) - errors in Claude's command output and file operations
  2. Pattern detection - Text is scanned against regex patterns in patterns.json (TypeScript errors, runtime exceptions, build failures, etc.)

  3. Fix matching - When a pattern matches, fixes.json is searched. Each fix has an errorSignature regex and keywords. Scoring combines pattern match, keyword overlap, confidence score, and project history.

  4. Context injection - Top 3 matches get injected as a <context-graph> block. Claude sees prior solutions before responding and acknowledges the match.

Your data

Global install: ~/.claude/context-graph/ Local install: ./.claude/context-graph/

  • fixes.json - your captured fixes (edit directly to tweak)
  • patterns.json - error patterns to detect (add your own)

Run ./setup.sh --fresh to reset data files.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors