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
PromptGrapher is a CLI tool. End users do not need to create or activate a virtual environment just to run it.
Recommended global install with pipx:
pipx install prompt-grapher
Alternative global install with pip:
python -m pip install --upgrade prompt-grapher
After installation, verify the command is available:
prompt-grapher --help
Windows note
If prompt-grapher is not recognized after a global pip install, the Python Scripts directory is likely not on your PATH.
You can inspect the user scripts path with:
python -m site --user-base
Then ensure the corresponding Scripts folder is on PATH. Example:
%APPDATA%\Python\Python311\Scripts
Using pipx usually avoids this friction because it manages CLI exposure for you.
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
pipx install prompt-grapher
cd /path/to/project
prompt-grapher init
# fill AI_API_KEY and AI_MODEL_NAME in .env
prompt-grapher analyze .
Development Setup
Use a virtual environment only if you are developing PromptGrapher locally:
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e .[dev]
On Windows PowerShell:
.venv\Scripts\Activate.ps1
pip install -e .[dev]
Local Smoke Tests
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.3.tar.gz.
File metadata
- Download URL: prompt_grapher-1.4.3.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11aa2518c5be03c12ce7d962fe15ac6eabd6397c023414efb87b54b8e2d4c696
|
|
| MD5 |
605479268de4885dc7094ebb31802549
|
|
| BLAKE2b-256 |
0837fbd7ed2a2faa26d35de8998af9d9fd473723e383b3dfd0ce30e4c2f2823c
|
File details
Details for the file prompt_grapher-1.4.3-py3-none-any.whl.
File metadata
- Download URL: prompt_grapher-1.4.3-py3-none-any.whl
- Upload date:
- Size: 15.1 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 |
cb62c315c296bcd9674f86ff78103a02076ff41d2c4634a31896f2998c1bbad9
|
|
| MD5 |
0c7c03dd78bf59aeea50007b5f837e6f
|
|
| BLAKE2b-256 |
475e3d37371075631ae4407f012dcb455a40ad73d10bcd8ce75bc84bf234c8f7
|