Skip to main content

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

  1. Reads graphify-out/graph.json or graphify-out/manifest.json.
  2. Infers the project's primary languages, framework hints, architecture style, naming patterns, hotspots, entrypoints, and test presence.
  3. Sends that summary to an OpenAI-compatible model.
  4. Writes .cursor/rules/project-rules.mdc for Cursor and AGENTS.md as a root-level backup/source-of-truth.

Requirements

  • Python 3.10+
  • No separate Graphify install step. graphifyy is installed as a dependency.
  • An OpenAI-compatible API key and model name

Installation

python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

Configuration

Create a .env file:

prompt-grapher init

Then set:

  • AI_API_KEY
  • AI_MODEL_NAME
  • AI_BASE_URL if 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.

Usage

Analyze a project and auto-run Graphify when needed:

prompt-grapher analyze /path/to/project

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

Local Smoke Tests

pip install -e .[dev]
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prompt_grapher-1.4.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prompt_grapher-1.4.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file prompt_grapher-1.4.1.tar.gz.

File metadata

  • Download URL: prompt_grapher-1.4.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for prompt_grapher-1.4.1.tar.gz
Algorithm Hash digest
SHA256 a59b50439e5c3b7e1e62b55c0cdad3d681531f161dd822cc7826f3f5c4ed06ed
MD5 70678479e0711b41aa10d4c6acf9dffc
BLAKE2b-256 85f02a75ccf87c964f4127548f658a9975f70495986e59d6034ec7416ce115aa

See more details on using hashes here.

File details

Details for the file prompt_grapher-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: prompt_grapher-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for prompt_grapher-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9a61e370a534b4d4b578998a6f9e1e961adf4cdf9039613b89a48080c6e420e
MD5 8f9e94e2f0cae440a9d88a684a1cda08
BLAKE2b-256 393431723a2607ae745b1f4b6a6a9e04eadbd1a935170359683f7650469f3286

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page