Generate repository-specific Cursor rules and AGENTS.md files from Graphify dependency graphs.
Project description
PromptGrapher
PromptGrapher turns a Graphify dependency graph into repository-specific Cursor rules. It is designed to work against arbitrary projects, not just a single language or framework.
What It Does
- Reads
graphify-out/graph.jsonorgraphify-out/manifest.json. - Infers the project's primary languages, framework hints, architecture style, naming patterns, hotspots, entrypoints, and test presence.
- Sends that summary to an OpenAI-compatible model.
- Writes
.cursor/rules/project-rules.mdcfor Cursor andAGENTS.mdas a root-level backup/source-of-truth.
Requirements
- Python 3.10+
- No separate Graphify install step.
graphifyyis installed as a dependency. - An OpenAI-compatible API key and model name
Installation
Install from PyPI:
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install prompt-grapher
On Windows PowerShell, activate the environment with:
.venv\Scripts\Activate.ps1
Configuration
From the root of the project you want to analyze, create a .env file:
prompt-grapher init
Then set:
AI_API_KEYAI_MODEL_NAMEAI_BASE_URLif you are using a non-default OpenAI-compatible endpoint such as Groq, OpenRouter, or Ollama
PromptGrapher also falls back to OPENAI_API_KEY, GROQ_API_KEY, and OPENROUTER_API_KEY.
Important: prompt-grapher init writes the .env file into your current working directory, so run it inside the repository you want to analyze.
Usage
From the project root, analyze the current repository and auto-run Graphify when needed:
prompt-grapher analyze .
Re-running prompt-grapher analyze refreshes the Graphify artifact by default before regenerating rules, so architecture and module changes are picked up automatically.
If you intentionally want to reuse the current graphify-out contents without refreshing them, use:
prompt-grapher analyze /path/to/project --reuse-graph
By default, PromptGrapher bootstraps Graphify with a code-only graph build that does not require a second LLM provider:
python -m graphify update /path/to/project --no-cluster
This mode is enough for PromptGrapher's architecture heuristics and works well for PyPI installs.
If you explicitly want Graphify's semantic extraction path, switch strategies:
prompt-grapher analyze /path/to/project --graphify-strategy semantic --graphify-backend openai --graphify-model gpt-4.1-mini
Semantic extraction requires a Graphify-supported backend and its API key.
Reuse an existing Graphify artifact:
prompt-grapher analyze /path/to/project --graph-input /path/to/project/graphify-out/graph.json
Override the model or output filename:
prompt-grapher analyze /path/to/project --model gpt-4.1-mini --output-file .cursor/rules/project-rules.mdc --agents-file AGENTS.md
Quick Start
pip install prompt-grapher
cd /path/to/project
prompt-grapher init
# fill AI_API_KEY and AI_MODEL_NAME in .env
prompt-grapher analyze .
Local Smoke Tests
pip install -e .[dev]
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prompt_grapher-1.4.2.tar.gz.
File metadata
- Download URL: prompt_grapher-1.4.2.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4c42b411e20d49451c0892e8b39a1467f9e0867354c3d7aa5e7f79fb0dda65b
|
|
| MD5 |
299beb6c5bd78fe50b7d82bcb85984c1
|
|
| BLAKE2b-256 |
2700b1184711695d678ab53d3d945b4ac2d79eecbb1fcbf497f10286af172f8c
|
File details
Details for the file prompt_grapher-1.4.2-py3-none-any.whl.
File metadata
- Download URL: prompt_grapher-1.4.2-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d8af6a013cc09ee8c47abbd0dc5364c1a9c8a286d9604660484396df9c93b4d
|
|
| MD5 |
356564ba297e82689a38669847173fdc
|
|
| BLAKE2b-256 |
3cd28762405e78120bfca9bbed148d3b5d3078d18d524ebc8213103de5580880
|