Skip to main content

CLI and Cursor skill to refine graphify knowledge graphs with DeepRefine

Project description

DeepRefine-Skill

PyPi Python Paper Project

Type /deeprefine in your AI coding assistant after you've built a graphify knowledge base — it patches graphify-out/graph.json from your session's query history to evolve your LLM-Wiki.

Works in Cursor (install the skill once with deeprefine cursor install). In Cursor, /deeprefine runs in agent-native mode (no extra API key needed). The runtime CLI (deeprefine refine) is still available for vLLM/API execution.

/deeprefine

Typical flow: graphify .graphify query "..." → record the question → /deeprefine.

deeprefine history add --query "your question"   # or let the agent do this

That's it. Under graphify-out/.deeprefine/ you get:

graphify-out/
├── graph.json                          updated graph (graphify reads this)
└── .deeprefine/
    ├── history.jsonl                   queries queued for refinement
    ├── refinement_results_*.jsonl      run logs
    └── graph.json.bak                  backup before each refine

Standalone repo. Model code (autorefiner, atlas_rag) lives in a separate DeepRefine checkout.
pip install deeprefine-cli ships the CLI and SKILL.md. In Cursor, /deeprefine uses agent-native refinement; deeprefine refine uses DeepRefine runtime (vLLM/API) when you explicitly choose CLI execution.


News

  • [2026/6/2] deeprefine-cli v0.1.5 has been released! Agent-native /deeprefine flow + clearer CLI/Agent split.
  • [2026/6/2] deeprefine-cli v0.1.4 has been released! Customize your LLM api.

Quick start

Step What
1 Install DeepRefine in atlastune
2 pip install deeprefine-cli
3 deeprefine cursor install in your KB project
4 (Optional) start local vLLM, or use your API provider
5 Cursor chat: /deeprefine (auto uses/adds query context); CLI mode: history add + refine
# 1) DeepRefine (once)
conda activate atlastune
cd /path/to/DeepRefine && pip install -e .

# 2) CLI (once per env)
pip install deeprefine-cli

# 3) Cursor skill (KB project root)
cd /path/to/your-kb-project
deeprefine cursor install

# 4) Optional local vLLM (each session, from DeepRefine repo)
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh

# OR use your API provider (no local vLLM)
export DEEPREFINE_LLM_URL=your-llm-endpoint
export DEEPREFINE_EMBED_URL=your-embed-endpoint
export DEEPREFINE_LLM_API_KEY=your_llm_api_key
export DEEPREFINE_EMBED_API_KEY=your_embed_api_key
export DEEPREFINE_MODEL=your_llm_model
export DEEPREFINE_EMBED_MODEL=your_embed_model
# optional (if your provider uses one key for both):
# export DEEPREFINE_API_KEY=your_shared_api_key
# optional model overrides:

# 5a) Refine in Cursor chat (agent-native, recommended)
# type in chat:
# /deeprefine

# 5b) Refine in terminal / CLI (manual flow)
deeprefine history add --query "your question"
deeprefine refine

In Cursor chat (agent):

/deeprefine

Pipeline

Stage Tool Input Output
Build graphify Project files graphify-out/graph.json
Query graphify Questions graphify query "..."
Refine deeprefine Graph + query history Updated graph.json, logs
  project files
        │
        ▼ graphify
   graph.json ◄────────────────────────┐
        │                              │
        ▼ graphify query               │ deeprefine refine
   (Q&A session)                      │
        │                              │
        ▼ deeprefine history add       │
   history.jsonl ──────────────────────┘
        │
        ▼ graphify query (verify)

DeepRefine does not build the graph; it patches graph.json so later graphify query retrieves better.


Repository layout

DeepRefine-Skill/              ← this repo (PyPI: deeprefine-cli)
├── deeprefine_skill/          ← package (SKILL.md bundled)
└── scripts/deeprefine.py

DeepRefine/                    ← separate clone
├── autorefiner/
├── AutoSchemaKG/
└── scripts/vllm_serve/

your-kb-project/
└── graphify-out/
    ├── graph.json
    └── .deeprefine/           ← history, logs, FAISS cache

Recommended sibling layout (auto-detects ../DeepRefine when DEEPREFINE_REPO is unset):

www/code/
├── DeepRefine/
└── DeepRefine-Skill/

Installation

1. DeepRefine (atlastune)

See DeepRefine — Environment.

conda activate atlastune
cd /path/to/DeepRefine
pip install -e .

2. CLI

Method Command
PyPI (recommended) pip install deeprefine-cli
Source pip install -e /path/to/DeepRefine-Skill
deeprefine --help    # verify

3. DeepRefine path (optional)

Only if DeepRefine is not ../DeepRefine and not found by walking up from cwd:

export DEEPREFINE_REPO=/path/to/DeepRefine

4. Inference

Default: use your API provider from environment.

Optional local vLLM (from the DeepRefine repo):

conda activate atlastune
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
Variable Default
DEEPREFINE_LLM_URL (empty; SDK default endpoint)
DEEPREFINE_EMBED_URL (empty; SDK default endpoint)
DEEPREFINE_API_KEY fallback to OPENAI_API_KEY
DEEPREFINE_LLM_API_KEY fallback to DEEPREFINE_API_KEY
DEEPREFINE_EMBED_API_KEY fallback to DEEPREFINE_API_KEY
DEEPREFINE_MODEL gpt-4.1-mini
DEEPREFINE_EMBED_MODEL text-embedding-3-small

5. Cursor skill

Run at KB project root (folder with or that will have graphify-out/):

Command Scope
deeprefine cursor install .cursor/skills/ (this project)
deeprefine cursor install --user ~/.cursor/skills/ (all projects)
deeprefine install alias for cursor install
deeprefine cursor uninstall remove skill

Workflow with graphify

One-time

pip install graphifyy deeprefine-cli    # deeprefine-cli in atlastune

cd /path/to/your-kb-project
graphify cursor install
deeprefine cursor install

Each session (KB project root)

# Action
1 graphify . or /graphify .graphify-out/graph.json
2 graphify query "..."
3 Cursor chat: /deeprefine (recommended; no manual history add needed)
4 CLI alternative: deeprefine history add --query "..."deeprefine refine
5 (optional) graphify query "..." to verify

Commands

All commands below run from KB project root.

Command Description
deeprefine history add --query "..." Record a query after graph Q&A
deeprefine history list List all history entries
deeprefine history list --pending List unrefined queries only
deeprefine refine Refine all pending queries
deeprefine refine --query "..." Refine one query (also recorded)
deeprefine refine --rebuild-index Rebuild FAISS before refine
deeprefine index --rebuild Rebuild FAISS cache only
deeprefine cursor install | uninstall Manage Cursor skill

Artifacts (graphify-out/.deeprefine/)

File Purpose
history.jsonl Query history
refinement_results_*.jsonl Refinement logs
graph.json.bak Backup before refine
reafiner.pkl FAISS index cache

Cursor agent instructions: SKILL.md → installed as .cursor/skills/deeprefine/SKILL.md.


Where to run what

What Where
pip install deeprefine-cli Anywhere (atlastune for refine)
pip install -e .../DeepRefine DeepRefine repo
graphify / deeprefine cursor install KB project root
deeprefine refine / history KB project root
vLLM serve scripts DeepRefine repo

License

MIT — see LICENSE.

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

deeprefine_cli-0.1.5.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

deeprefine_cli-0.1.5-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file deeprefine_cli-0.1.5.tar.gz.

File metadata

  • Download URL: deeprefine_cli-0.1.5.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for deeprefine_cli-0.1.5.tar.gz
Algorithm Hash digest
SHA256 85b28e3e2182a92858173210600f5826b0df0a533a761a4bbb5ce04d08462964
MD5 b2700ace35a24b83010c2eec67a63691
BLAKE2b-256 f65284b532be69b690e6d0740dd4dd65ee1a323383d15b3a28f1cff40629f17c

See more details on using hashes here.

File details

Details for the file deeprefine_cli-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: deeprefine_cli-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for deeprefine_cli-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9969edd04f2c8529bea59fb0cd0b6e2d3c940058d5fd1ac22cc3da6f5913a460
MD5 2fdb3523c5fdc6e2f4c147452af403e3
BLAKE2b-256 c601e174e6d868975fe74b0d8e883a3d02b4fbcb748e4dd3e46c704e2cdeb00f

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