deeprefine-cli 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deeprefine_cli-0.1.5/PKG-INFO +317 -0
- deeprefine_cli-0.1.5/README.md +291 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/SKILL.md +16 -6
- deeprefine_cli-0.1.5/deeprefine_cli.egg-info/PKG-INFO +317 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/SKILL.md +16 -6
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/__init__.py +1 -1
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/paths.py +14 -8
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/refine_runner.py +20 -2
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/pyproject.toml +5 -5
- deeprefine_cli-0.1.3/PKG-INFO +0 -223
- deeprefine_cli-0.1.3/README.md +0 -197
- deeprefine_cli-0.1.3/deeprefine_cli.egg-info/PKG-INFO +0 -223
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/LICENSE +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/MANIFEST.in +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_cli.egg-info/SOURCES.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_cli.egg-info/dependency_links.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_cli.egg-info/entry_points.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_cli.egg-info/requires.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_cli.egg-info/top_level.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/adapter_graphify.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/cli.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/history.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/deeprefine_skill/installers.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.5}/setup.cfg +0 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deeprefine-cli
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: CLI and Cursor skill to refine graphify knowledge graphs with DeepRefine
|
|
5
|
+
Author: HKUST-KnowComp
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/HKUST-KnowComp/DeepRefine-Skill
|
|
8
|
+
Project-URL: Documentation, https://github.com/HKUST-KnowComp/DeepRefine-Skill#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/HKUST-KnowComp/DeepRefine-Skill
|
|
10
|
+
Project-URL: Issues, https://github.com/HKUST-KnowComp/DeepRefine-Skill/issues
|
|
11
|
+
Keywords: deeprefine,graphify,knowledge-graph,rag,cursor,agent-skill
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: openai>=1.0
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
|
|
29
|
+
# DeepRefine-Skill
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.5/)
|
|
33
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.5/)
|
|
34
|
+
[](https://arxiv.org/pdf/2605.10488)
|
|
35
|
+
[](https://github.com/HKUST-KnowComp/DeepRefine)
|
|
36
|
+
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
Type `/deeprefine` in your AI coding assistant after you've built a **[graphify](https://github.com/safishamsi/graphify)** knowledge base — it patches `graphify-out/graph.json` from your session's query history to evolve your LLM-Wiki.
|
|
40
|
+
|
|
41
|
+
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.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
/deeprefine
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Typical flow:** `graphify .` → `graphify query "..."` → record the question → `/deeprefine`.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
deeprefine history add --query "your question" # or let the agent do this
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
That's it. Under `graphify-out/.deeprefine/` you get:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
graphify-out/
|
|
57
|
+
├── graph.json updated graph (graphify reads this)
|
|
58
|
+
└── .deeprefine/
|
|
59
|
+
├── history.jsonl queries queued for refinement
|
|
60
|
+
├── refinement_results_*.jsonl run logs
|
|
61
|
+
└── graph.json.bak backup before each refine
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **Standalone repo.** Model code (`autorefiner`, `atlas_rag`) lives in a separate [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) checkout.
|
|
65
|
+
> `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.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## News
|
|
70
|
+
|
|
71
|
+
- [2026/6/2] deeprefine-cli v0.1.5 has been released! Agent-native `/deeprefine` flow + clearer CLI/Agent split.
|
|
72
|
+
- [2026/6/2] deeprefine-cli v0.1.4 has been released! Customize your LLM api.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Quick start
|
|
77
|
+
|
|
78
|
+
| Step | What |
|
|
79
|
+
|:----:|------|
|
|
80
|
+
| 1 | Install [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) in `atlastune` |
|
|
81
|
+
| 2 | `pip install deeprefine-cli` |
|
|
82
|
+
| 3 | `deeprefine cursor install` in your KB project |
|
|
83
|
+
| 4 | (Optional) start local vLLM, or use your API provider |
|
|
84
|
+
| 5 | Cursor chat: `/deeprefine` *(auto uses/adds query context)*; CLI mode: `history add` + `refine` |
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 1) DeepRefine (once)
|
|
88
|
+
conda activate atlastune
|
|
89
|
+
cd /path/to/DeepRefine && pip install -e .
|
|
90
|
+
|
|
91
|
+
# 2) CLI (once per env)
|
|
92
|
+
pip install deeprefine-cli
|
|
93
|
+
|
|
94
|
+
# 3) Cursor skill (KB project root)
|
|
95
|
+
cd /path/to/your-kb-project
|
|
96
|
+
deeprefine cursor install
|
|
97
|
+
|
|
98
|
+
# 4) Optional local vLLM (each session, from DeepRefine repo)
|
|
99
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
100
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
101
|
+
|
|
102
|
+
# OR use your API provider (no local vLLM)
|
|
103
|
+
export DEEPREFINE_LLM_URL=your-llm-endpoint
|
|
104
|
+
export DEEPREFINE_EMBED_URL=your-embed-endpoint
|
|
105
|
+
export DEEPREFINE_LLM_API_KEY=your_llm_api_key
|
|
106
|
+
export DEEPREFINE_EMBED_API_KEY=your_embed_api_key
|
|
107
|
+
export DEEPREFINE_MODEL=your_llm_model
|
|
108
|
+
export DEEPREFINE_EMBED_MODEL=your_embed_model
|
|
109
|
+
# optional (if your provider uses one key for both):
|
|
110
|
+
# export DEEPREFINE_API_KEY=your_shared_api_key
|
|
111
|
+
# optional model overrides:
|
|
112
|
+
|
|
113
|
+
# 5a) Refine in Cursor chat (agent-native, recommended)
|
|
114
|
+
# type in chat:
|
|
115
|
+
# /deeprefine
|
|
116
|
+
|
|
117
|
+
# 5b) Refine in terminal / CLI (manual flow)
|
|
118
|
+
deeprefine history add --query "your question"
|
|
119
|
+
deeprefine refine
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
In **Cursor chat** (agent):
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
/deeprefine
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Pipeline
|
|
131
|
+
|
|
132
|
+
| Stage | Tool | Input | Output |
|
|
133
|
+
|:-----:|------|-------|--------|
|
|
134
|
+
| Build | **graphify** | Project files | `graphify-out/graph.json` |
|
|
135
|
+
| Query | **graphify** | Questions | `graphify query "..."` |
|
|
136
|
+
| Refine | **deeprefine** | Graph + query history | Updated `graph.json`, logs |
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
project files
|
|
140
|
+
│
|
|
141
|
+
▼ graphify
|
|
142
|
+
graph.json ◄────────────────────────┐
|
|
143
|
+
│ │
|
|
144
|
+
▼ graphify query │ deeprefine refine
|
|
145
|
+
(Q&A session) │
|
|
146
|
+
│ │
|
|
147
|
+
▼ deeprefine history add │
|
|
148
|
+
history.jsonl ──────────────────────┘
|
|
149
|
+
│
|
|
150
|
+
▼ graphify query (verify)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
DeepRefine does not build the graph; it patches `graph.json` so later `graphify query` retrieves better.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Repository layout
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
DeepRefine-Skill/ ← this repo (PyPI: deeprefine-cli)
|
|
161
|
+
├── deeprefine_skill/ ← package (SKILL.md bundled)
|
|
162
|
+
└── scripts/deeprefine.py
|
|
163
|
+
|
|
164
|
+
DeepRefine/ ← separate clone
|
|
165
|
+
├── autorefiner/
|
|
166
|
+
├── AutoSchemaKG/
|
|
167
|
+
└── scripts/vllm_serve/
|
|
168
|
+
|
|
169
|
+
your-kb-project/
|
|
170
|
+
└── graphify-out/
|
|
171
|
+
├── graph.json
|
|
172
|
+
└── .deeprefine/ ← history, logs, FAISS cache
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Recommended sibling layout** (auto-detects `../DeepRefine` when `DEEPREFINE_REPO` is unset):
|
|
176
|
+
|
|
177
|
+
```text
|
|
178
|
+
www/code/
|
|
179
|
+
├── DeepRefine/
|
|
180
|
+
└── DeepRefine-Skill/
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Installation
|
|
186
|
+
|
|
187
|
+
### 1. DeepRefine (`atlastune`)
|
|
188
|
+
|
|
189
|
+
See [DeepRefine — Environment](https://github.com/HKUST-KnowComp/DeepRefine#environment).
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
conda activate atlastune
|
|
193
|
+
cd /path/to/DeepRefine
|
|
194
|
+
pip install -e .
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 2. CLI
|
|
198
|
+
|
|
199
|
+
| Method | Command |
|
|
200
|
+
|--------|---------|
|
|
201
|
+
| **PyPI** (recommended) | `pip install deeprefine-cli` |
|
|
202
|
+
| **Source** | `pip install -e /path/to/DeepRefine-Skill` |
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
deeprefine --help # verify
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 3. DeepRefine path (optional)
|
|
209
|
+
|
|
210
|
+
Only if `DeepRefine` is not `../DeepRefine` and not found by walking up from cwd:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
export DEEPREFINE_REPO=/path/to/DeepRefine
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### 4. Inference
|
|
217
|
+
|
|
218
|
+
Default: use your API provider from environment.
|
|
219
|
+
|
|
220
|
+
Optional local vLLM (from the **DeepRefine** repo):
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
conda activate atlastune
|
|
224
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
225
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
| Variable | Default |
|
|
229
|
+
|----------|---------|
|
|
230
|
+
| `DEEPREFINE_LLM_URL` | *(empty; SDK default endpoint)* |
|
|
231
|
+
| `DEEPREFINE_EMBED_URL` | *(empty; SDK default endpoint)* |
|
|
232
|
+
| `DEEPREFINE_API_KEY` | fallback to `OPENAI_API_KEY` |
|
|
233
|
+
| `DEEPREFINE_LLM_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
234
|
+
| `DEEPREFINE_EMBED_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
235
|
+
| `DEEPREFINE_MODEL` | `gpt-4.1-mini` |
|
|
236
|
+
| `DEEPREFINE_EMBED_MODEL` | `text-embedding-3-small` |
|
|
237
|
+
|
|
238
|
+
### 5. Cursor skill
|
|
239
|
+
|
|
240
|
+
Run at **KB project root** (folder with or that will have `graphify-out/`):
|
|
241
|
+
|
|
242
|
+
| Command | Scope |
|
|
243
|
+
|---------|-------|
|
|
244
|
+
| `deeprefine cursor install` | `.cursor/skills/` (this project) |
|
|
245
|
+
| `deeprefine cursor install --user` | `~/.cursor/skills/` (all projects) |
|
|
246
|
+
| `deeprefine install` | alias for `cursor install` |
|
|
247
|
+
| `deeprefine cursor uninstall` | remove skill |
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Workflow with graphify
|
|
252
|
+
|
|
253
|
+
**One-time**
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
pip install graphifyy deeprefine-cli # deeprefine-cli in atlastune
|
|
257
|
+
|
|
258
|
+
cd /path/to/your-kb-project
|
|
259
|
+
graphify cursor install
|
|
260
|
+
deeprefine cursor install
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Each session** (KB project root)
|
|
264
|
+
|
|
265
|
+
| # | Action |
|
|
266
|
+
|:-:|--------|
|
|
267
|
+
| 1 | `graphify .` or `/graphify .` → `graphify-out/graph.json` |
|
|
268
|
+
| 2 | `graphify query "..."` |
|
|
269
|
+
| 3 | Cursor chat: `/deeprefine` *(recommended; no manual `history add` needed)* |
|
|
270
|
+
| 4 | CLI alternative: `deeprefine history add --query "..."` → `deeprefine refine` |
|
|
271
|
+
| 5 | *(optional)* `graphify query "..."` to verify |
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Commands
|
|
276
|
+
|
|
277
|
+
All commands below run from **KB project root**.
|
|
278
|
+
|
|
279
|
+
| Command | Description |
|
|
280
|
+
|---------|-------------|
|
|
281
|
+
| `deeprefine history add --query "..."` | Record a query after graph Q&A |
|
|
282
|
+
| `deeprefine history list` | List all history entries |
|
|
283
|
+
| `deeprefine history list --pending` | List unrefined queries only |
|
|
284
|
+
| `deeprefine refine` | Refine all pending queries |
|
|
285
|
+
| `deeprefine refine --query "..."` | Refine one query (also recorded) |
|
|
286
|
+
| `deeprefine refine --rebuild-index` | Rebuild FAISS before refine |
|
|
287
|
+
| `deeprefine index --rebuild` | Rebuild FAISS cache only |
|
|
288
|
+
| `deeprefine cursor install \| uninstall` | Manage Cursor skill |
|
|
289
|
+
|
|
290
|
+
**Artifacts** (`graphify-out/.deeprefine/`)
|
|
291
|
+
|
|
292
|
+
| File | Purpose |
|
|
293
|
+
|------|---------|
|
|
294
|
+
| `history.jsonl` | Query history |
|
|
295
|
+
| `refinement_results_*.jsonl` | Refinement logs |
|
|
296
|
+
| `graph.json.bak` | Backup before refine |
|
|
297
|
+
| `reafiner.pkl` | FAISS index cache |
|
|
298
|
+
|
|
299
|
+
Cursor agent instructions: [SKILL.md](./SKILL.md) → installed as `.cursor/skills/deeprefine/SKILL.md`.
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Where to run what
|
|
304
|
+
|
|
305
|
+
| What | Where |
|
|
306
|
+
|------|-------|
|
|
307
|
+
| `pip install deeprefine-cli` | Anywhere (`atlastune` for refine) |
|
|
308
|
+
| `pip install -e .../DeepRefine` | DeepRefine repo |
|
|
309
|
+
| `graphify` / `deeprefine cursor install` | **KB project root** |
|
|
310
|
+
| `deeprefine refine` / `history` | **KB project root** |
|
|
311
|
+
| vLLM serve scripts | **DeepRefine repo** |
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## License
|
|
316
|
+
|
|
317
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# DeepRefine-Skill
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.5/)
|
|
7
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.5/)
|
|
8
|
+
[](https://arxiv.org/pdf/2605.10488)
|
|
9
|
+
[](https://github.com/HKUST-KnowComp/DeepRefine)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
Type `/deeprefine` in your AI coding assistant after you've built a **[graphify](https://github.com/safishamsi/graphify)** knowledge base — it patches `graphify-out/graph.json` from your session's query history to evolve your LLM-Wiki.
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/deeprefine
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Typical flow:** `graphify .` → `graphify query "..."` → record the question → `/deeprefine`.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
deeprefine history add --query "your question" # or let the agent do this
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
That's it. Under `graphify-out/.deeprefine/` you get:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
graphify-out/
|
|
31
|
+
├── graph.json updated graph (graphify reads this)
|
|
32
|
+
└── .deeprefine/
|
|
33
|
+
├── history.jsonl queries queued for refinement
|
|
34
|
+
├── refinement_results_*.jsonl run logs
|
|
35
|
+
└── graph.json.bak backup before each refine
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> **Standalone repo.** Model code (`autorefiner`, `atlas_rag`) lives in a separate [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) checkout.
|
|
39
|
+
> `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.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## News
|
|
44
|
+
|
|
45
|
+
- [2026/6/2] deeprefine-cli v0.1.5 has been released! Agent-native `/deeprefine` flow + clearer CLI/Agent split.
|
|
46
|
+
- [2026/6/2] deeprefine-cli v0.1.4 has been released! Customize your LLM api.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quick start
|
|
51
|
+
|
|
52
|
+
| Step | What |
|
|
53
|
+
|:----:|------|
|
|
54
|
+
| 1 | Install [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) in `atlastune` |
|
|
55
|
+
| 2 | `pip install deeprefine-cli` |
|
|
56
|
+
| 3 | `deeprefine cursor install` in your KB project |
|
|
57
|
+
| 4 | (Optional) start local vLLM, or use your API provider |
|
|
58
|
+
| 5 | Cursor chat: `/deeprefine` *(auto uses/adds query context)*; CLI mode: `history add` + `refine` |
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# 1) DeepRefine (once)
|
|
62
|
+
conda activate atlastune
|
|
63
|
+
cd /path/to/DeepRefine && pip install -e .
|
|
64
|
+
|
|
65
|
+
# 2) CLI (once per env)
|
|
66
|
+
pip install deeprefine-cli
|
|
67
|
+
|
|
68
|
+
# 3) Cursor skill (KB project root)
|
|
69
|
+
cd /path/to/your-kb-project
|
|
70
|
+
deeprefine cursor install
|
|
71
|
+
|
|
72
|
+
# 4) Optional local vLLM (each session, from DeepRefine repo)
|
|
73
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
74
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
75
|
+
|
|
76
|
+
# OR use your API provider (no local vLLM)
|
|
77
|
+
export DEEPREFINE_LLM_URL=your-llm-endpoint
|
|
78
|
+
export DEEPREFINE_EMBED_URL=your-embed-endpoint
|
|
79
|
+
export DEEPREFINE_LLM_API_KEY=your_llm_api_key
|
|
80
|
+
export DEEPREFINE_EMBED_API_KEY=your_embed_api_key
|
|
81
|
+
export DEEPREFINE_MODEL=your_llm_model
|
|
82
|
+
export DEEPREFINE_EMBED_MODEL=your_embed_model
|
|
83
|
+
# optional (if your provider uses one key for both):
|
|
84
|
+
# export DEEPREFINE_API_KEY=your_shared_api_key
|
|
85
|
+
# optional model overrides:
|
|
86
|
+
|
|
87
|
+
# 5a) Refine in Cursor chat (agent-native, recommended)
|
|
88
|
+
# type in chat:
|
|
89
|
+
# /deeprefine
|
|
90
|
+
|
|
91
|
+
# 5b) Refine in terminal / CLI (manual flow)
|
|
92
|
+
deeprefine history add --query "your question"
|
|
93
|
+
deeprefine refine
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
In **Cursor chat** (agent):
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
/deeprefine
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Pipeline
|
|
105
|
+
|
|
106
|
+
| Stage | Tool | Input | Output |
|
|
107
|
+
|:-----:|------|-------|--------|
|
|
108
|
+
| Build | **graphify** | Project files | `graphify-out/graph.json` |
|
|
109
|
+
| Query | **graphify** | Questions | `graphify query "..."` |
|
|
110
|
+
| Refine | **deeprefine** | Graph + query history | Updated `graph.json`, logs |
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
project files
|
|
114
|
+
│
|
|
115
|
+
▼ graphify
|
|
116
|
+
graph.json ◄────────────────────────┐
|
|
117
|
+
│ │
|
|
118
|
+
▼ graphify query │ deeprefine refine
|
|
119
|
+
(Q&A session) │
|
|
120
|
+
│ │
|
|
121
|
+
▼ deeprefine history add │
|
|
122
|
+
history.jsonl ──────────────────────┘
|
|
123
|
+
│
|
|
124
|
+
▼ graphify query (verify)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
DeepRefine does not build the graph; it patches `graph.json` so later `graphify query` retrieves better.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Repository layout
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
DeepRefine-Skill/ ← this repo (PyPI: deeprefine-cli)
|
|
135
|
+
├── deeprefine_skill/ ← package (SKILL.md bundled)
|
|
136
|
+
└── scripts/deeprefine.py
|
|
137
|
+
|
|
138
|
+
DeepRefine/ ← separate clone
|
|
139
|
+
├── autorefiner/
|
|
140
|
+
├── AutoSchemaKG/
|
|
141
|
+
└── scripts/vllm_serve/
|
|
142
|
+
|
|
143
|
+
your-kb-project/
|
|
144
|
+
└── graphify-out/
|
|
145
|
+
├── graph.json
|
|
146
|
+
└── .deeprefine/ ← history, logs, FAISS cache
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Recommended sibling layout** (auto-detects `../DeepRefine` when `DEEPREFINE_REPO` is unset):
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
www/code/
|
|
153
|
+
├── DeepRefine/
|
|
154
|
+
└── DeepRefine-Skill/
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Installation
|
|
160
|
+
|
|
161
|
+
### 1. DeepRefine (`atlastune`)
|
|
162
|
+
|
|
163
|
+
See [DeepRefine — Environment](https://github.com/HKUST-KnowComp/DeepRefine#environment).
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
conda activate atlastune
|
|
167
|
+
cd /path/to/DeepRefine
|
|
168
|
+
pip install -e .
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 2. CLI
|
|
172
|
+
|
|
173
|
+
| Method | Command |
|
|
174
|
+
|--------|---------|
|
|
175
|
+
| **PyPI** (recommended) | `pip install deeprefine-cli` |
|
|
176
|
+
| **Source** | `pip install -e /path/to/DeepRefine-Skill` |
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
deeprefine --help # verify
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 3. DeepRefine path (optional)
|
|
183
|
+
|
|
184
|
+
Only if `DeepRefine` is not `../DeepRefine` and not found by walking up from cwd:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
export DEEPREFINE_REPO=/path/to/DeepRefine
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 4. Inference
|
|
191
|
+
|
|
192
|
+
Default: use your API provider from environment.
|
|
193
|
+
|
|
194
|
+
Optional local vLLM (from the **DeepRefine** repo):
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
conda activate atlastune
|
|
198
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
199
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
| Variable | Default |
|
|
203
|
+
|----------|---------|
|
|
204
|
+
| `DEEPREFINE_LLM_URL` | *(empty; SDK default endpoint)* |
|
|
205
|
+
| `DEEPREFINE_EMBED_URL` | *(empty; SDK default endpoint)* |
|
|
206
|
+
| `DEEPREFINE_API_KEY` | fallback to `OPENAI_API_KEY` |
|
|
207
|
+
| `DEEPREFINE_LLM_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
208
|
+
| `DEEPREFINE_EMBED_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
209
|
+
| `DEEPREFINE_MODEL` | `gpt-4.1-mini` |
|
|
210
|
+
| `DEEPREFINE_EMBED_MODEL` | `text-embedding-3-small` |
|
|
211
|
+
|
|
212
|
+
### 5. Cursor skill
|
|
213
|
+
|
|
214
|
+
Run at **KB project root** (folder with or that will have `graphify-out/`):
|
|
215
|
+
|
|
216
|
+
| Command | Scope |
|
|
217
|
+
|---------|-------|
|
|
218
|
+
| `deeprefine cursor install` | `.cursor/skills/` (this project) |
|
|
219
|
+
| `deeprefine cursor install --user` | `~/.cursor/skills/` (all projects) |
|
|
220
|
+
| `deeprefine install` | alias for `cursor install` |
|
|
221
|
+
| `deeprefine cursor uninstall` | remove skill |
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Workflow with graphify
|
|
226
|
+
|
|
227
|
+
**One-time**
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pip install graphifyy deeprefine-cli # deeprefine-cli in atlastune
|
|
231
|
+
|
|
232
|
+
cd /path/to/your-kb-project
|
|
233
|
+
graphify cursor install
|
|
234
|
+
deeprefine cursor install
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Each session** (KB project root)
|
|
238
|
+
|
|
239
|
+
| # | Action |
|
|
240
|
+
|:-:|--------|
|
|
241
|
+
| 1 | `graphify .` or `/graphify .` → `graphify-out/graph.json` |
|
|
242
|
+
| 2 | `graphify query "..."` |
|
|
243
|
+
| 3 | Cursor chat: `/deeprefine` *(recommended; no manual `history add` needed)* |
|
|
244
|
+
| 4 | CLI alternative: `deeprefine history add --query "..."` → `deeprefine refine` |
|
|
245
|
+
| 5 | *(optional)* `graphify query "..."` to verify |
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Commands
|
|
250
|
+
|
|
251
|
+
All commands below run from **KB project root**.
|
|
252
|
+
|
|
253
|
+
| Command | Description |
|
|
254
|
+
|---------|-------------|
|
|
255
|
+
| `deeprefine history add --query "..."` | Record a query after graph Q&A |
|
|
256
|
+
| `deeprefine history list` | List all history entries |
|
|
257
|
+
| `deeprefine history list --pending` | List unrefined queries only |
|
|
258
|
+
| `deeprefine refine` | Refine all pending queries |
|
|
259
|
+
| `deeprefine refine --query "..."` | Refine one query (also recorded) |
|
|
260
|
+
| `deeprefine refine --rebuild-index` | Rebuild FAISS before refine |
|
|
261
|
+
| `deeprefine index --rebuild` | Rebuild FAISS cache only |
|
|
262
|
+
| `deeprefine cursor install \| uninstall` | Manage Cursor skill |
|
|
263
|
+
|
|
264
|
+
**Artifacts** (`graphify-out/.deeprefine/`)
|
|
265
|
+
|
|
266
|
+
| File | Purpose |
|
|
267
|
+
|------|---------|
|
|
268
|
+
| `history.jsonl` | Query history |
|
|
269
|
+
| `refinement_results_*.jsonl` | Refinement logs |
|
|
270
|
+
| `graph.json.bak` | Backup before refine |
|
|
271
|
+
| `reafiner.pkl` | FAISS index cache |
|
|
272
|
+
|
|
273
|
+
Cursor agent instructions: [SKILL.md](./SKILL.md) → installed as `.cursor/skills/deeprefine/SKILL.md`.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Where to run what
|
|
278
|
+
|
|
279
|
+
| What | Where |
|
|
280
|
+
|------|-------|
|
|
281
|
+
| `pip install deeprefine-cli` | Anywhere (`atlastune` for refine) |
|
|
282
|
+
| `pip install -e .../DeepRefine` | DeepRefine repo |
|
|
283
|
+
| `graphify` / `deeprefine cursor install` | **KB project root** |
|
|
284
|
+
| `deeprefine refine` / `history` | **KB project root** |
|
|
285
|
+
| vLLM serve scripts | **DeepRefine repo** |
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -5,7 +5,7 @@ description: >-
|
|
|
5
5
|
Reafiner based on session query history. Use when the user runs /deeprefine,
|
|
6
6
|
asks to improve the graphify KB after Q&A, or wants to patch graph.json from
|
|
7
7
|
failed retrieval queries.
|
|
8
|
-
disable-model-invocation:
|
|
8
|
+
disable-model-invocation: false
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# DeepRefine (graphify)
|
|
@@ -22,7 +22,7 @@ conda activate atlastune
|
|
|
22
22
|
cd /path/to/DeepRefine && pip install -e .
|
|
23
23
|
|
|
24
24
|
# 2) This skill CLI
|
|
25
|
-
pip install -
|
|
25
|
+
pip install deeprefine-cli
|
|
26
26
|
|
|
27
27
|
# 3) Optional if DeepRefine is not ../DeepRefine
|
|
28
28
|
export DEEPREFINE_REPO=/path/to/DeepRefine
|
|
@@ -32,18 +32,28 @@ cd /path/to/your-kb-project
|
|
|
32
32
|
deeprefine cursor install
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Inference defaults to your current API model setup (`OPENAI_API_KEY` or `DEEPREFINE_API_KEY`).
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Optional: local vLLM from DeepRefine (embedding `8128`, refine model `8134`; see `scripts/vllm_serve/`).
|
|
38
|
+
|
|
39
|
+
## `/deeprefine` (agent-native)
|
|
38
40
|
|
|
39
41
|
From the **KB project root** (with `graphify-out/graph.json`):
|
|
40
42
|
|
|
41
43
|
```bash
|
|
42
44
|
deeprefine history add --query "..." # after graph Q&A
|
|
43
|
-
deeprefine
|
|
45
|
+
/deeprefine # run inside agent (no extra API key)
|
|
44
46
|
```
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
What the agent should do when `/deeprefine` is invoked:
|
|
49
|
+
|
|
50
|
+
1. Load pending queries from `graphify-out/.deeprefine/history.jsonl`.
|
|
51
|
+
2. Read `graphify-out/graph.json`.
|
|
52
|
+
3. Propose and apply minimal graph updates directly to `graph.json` for unresolved queries.
|
|
53
|
+
4. Write a timestamped log to `graphify-out/.deeprefine/refinement_results_*.jsonl`.
|
|
54
|
+
5. Mark processed history items as `refined: true`.
|
|
55
|
+
|
|
56
|
+
Use `deeprefine refine` CLI only when explicitly asked to run DeepRefine runtime (vLLM/API).
|
|
47
57
|
|
|
48
58
|
## Paths
|
|
49
59
|
|