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). The same workflow is available from any terminal via the deeprefine CLI (deeprefine-cli on PyPI).

/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. deeprefine refine still needs DeepRefine + atlastune, with default inference from your current API model setup; you can override with custom base URL and API key.


Roadmap

Inference today: default to your current API model setup.

Optional: set custom OpenAI-compatible base URL and API key for LLM / embeddings.


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 deeprefine history adddeeprefine 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:

# 5) Refine
deeprefine history add --query "your question"
deeprefine refine

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 deeprefine history add --query "..."
4 deeprefine refine or /deeprefine
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.4.tar.gz (13.8 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.4-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deeprefine_cli-0.1.4.tar.gz
  • Upload date:
  • Size: 13.8 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.4.tar.gz
Algorithm Hash digest
SHA256 e5ba5f7417d8bbfbf1c7e02861b11b00f5d8ba761b85c01dc1b2aa6a3a563fc9
MD5 2a4a2ff34dc8e0bf241ea118318eb9d5
BLAKE2b-256 0b5e68b872952aa0d7bd204b9dbaee954d50642ed48bf29258fc081ed73348a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deeprefine_cli-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5fd729e75aa7d8fb83867e4a09c5d8ce8f71916df5d1d31d030fea9a0724db9e
MD5 61a76b91ce152ebf232aa8963ebd5f17
BLAKE2b-256 fbcc17880cc01d5d8e82e228e1dba0bec4f1c677ac6c02d5bfa3a1ce51aeca17

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