deeprefine-cli 0.1.3__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HKUST-KnowComp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ include SKILL.md
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: deeprefine-cli
3
+ Version: 0.1.3
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
8
+ Project-URL: Documentation, https://github.com/HKUST-KnowComp/DeepRefine
9
+ Project-URL: Repository, https://github.com/HKUST-KnowComp/DeepRefine
10
+ Project-URL: Issues, https://github.com/HKUST-KnowComp/DeepRefine/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
+ # DeepRefine-Skill
28
+
29
+ Cursor skill and CLI to refine **[graphify](https://github.com/safishamsi/graphify)** knowledge graphs with **[DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine)** (`graphify-out/graph.json` + session query history).
30
+
31
+ This repository is **standalone**. The DeepRefine model code (`autorefiner`, `atlas_rag`) lives in a separate **DeepRefine** checkout.
32
+
33
+ ---
34
+
35
+ ## Repository layout
36
+
37
+ ```
38
+ DeepRefine-Skill/ ← this repo (pip install -e .)
39
+ ├── README.md
40
+ ├── SKILL.md
41
+ ├── pyproject.toml
42
+ ├── deeprefine_skill/
43
+ └── scripts/deeprefine.py
44
+
45
+ DeepRefine/ ← separate clone (training + Reafiner)
46
+ ├── autorefiner/
47
+ ├── AutoSchemaKG/
48
+ └── ...
49
+
50
+ your-kb-project/ ← your data (graphify-out/)
51
+ └── graphify-out/graph.json
52
+ ```
53
+
54
+ Recommended clone layout:
55
+
56
+ ```text
57
+ www/code/
58
+ ├── DeepRefine/
59
+ └── DeepRefine-Skill/ # sibling → auto-detected if DEEPREFINE_REPO unset
60
+ ```
61
+
62
+ ---
63
+
64
+ ## How graphify and DeepRefine fit together
65
+
66
+ | Stage | Tool | Input | Output |
67
+ |-------|------|-------|--------|
68
+ | Build | **graphify** | Project files | `graphify-out/graph.json`, report, HTML |
69
+ | Query | **graphify** | Questions | `graphify query "..."` |
70
+ | Refine | **DeepRefine** (this repo) | Graph + **query history** | Updated `graph.json`, logs |
71
+
72
+ DeepRefine does not build the graph; it edits `graph.json` incrementally so later `graphify query` works better.
73
+
74
+ ---
75
+
76
+ ## Setup
77
+
78
+ ### 1. DeepRefine environment (`atlastune`)
79
+
80
+ Follow [DeepRefine/README](https://github.com/HKUST-KnowComp/DeepRefine) **Environment** to create `atlastune` and install the main repo:
81
+
82
+ ```bash
83
+ conda activate atlastune
84
+ cd /path/to/DeepRefine
85
+ pip install -e .
86
+ ```
87
+
88
+ ### 2. Install this CLI
89
+
90
+ **From PyPI:**
91
+
92
+ ```bash
93
+ conda activate atlastune
94
+ pip install deeprefine-cli
95
+ ```
96
+
97
+ **From source (development):**
98
+
99
+ ```bash
100
+ pip install -e /path/to/DeepRefine-Skill
101
+ ```
102
+
103
+ Verify:
104
+
105
+ ```bash
106
+ deeprefine --help
107
+ ```
108
+
109
+ > `deeprefine refine` still requires a local [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) checkout (`autorefiner`, `atlas_rag`) and running vLLM services — see below.
110
+
111
+ ### 3. Point to DeepRefine (if not cloned as sibling)
112
+
113
+ Only needed when `DeepRefine` is **not** at `../DeepRefine` relative to this repo and not found by walking up from your cwd:
114
+
115
+ ```bash
116
+ export DEEPREFINE_REPO=/path/to/DeepRefine
117
+ ```
118
+
119
+ Add to `~/.bashrc` if you use a fixed path.
120
+
121
+ ### 4. Start vLLM (before `deeprefine refine`)
122
+
123
+ From the **DeepRefine** repo:
124
+
125
+ ```bash
126
+ conda activate atlastune
127
+ bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
128
+ bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
129
+ ```
130
+
131
+ | Variable | Default |
132
+ |----------|---------|
133
+ | `DEEPREFINE_LLM_URL` | `http://127.0.0.1:8134/v1` |
134
+ | `DEEPREFINE_EMBED_URL` | `http://127.0.0.1:8128/v1` |
135
+ | `DEEPREFINE_MODEL` | `HaoyuHuang2/DeepRefine-v1-8B` |
136
+ | `DEEPREFINE_EMBED_MODEL` | `Qwen/Qwen3-Embedding-0.6B` |
137
+
138
+ ### 5. Install Cursor skill (KB project root)
139
+
140
+ ```bash
141
+ cd /path/to/your-kb-project # must contain or will contain graphify-out/
142
+ deeprefine cursor install
143
+ ```
144
+
145
+ Same pattern as `graphify cursor install`. Use `--user` for all projects.
146
+
147
+ ---
148
+
149
+ ## Workflow with graphify
150
+
151
+ **One-time**
152
+
153
+ ```bash
154
+ pip install graphifyy
155
+ graphify cursor install # in KB project
156
+ pip install -e /path/to/DeepRefine-Skill # in atlastune
157
+ deeprefine cursor install # in KB project
158
+ ```
159
+
160
+ **Per session** (KB project root)
161
+
162
+ 1. `/graphify .` or `graphify .` → `graphify-out/graph.json`
163
+ 2. `graphify query "..."` or `/graphify query "..."`
164
+ 3. `deeprefine history add --query "..."`
165
+ 4. `/deeprefine` or `deeprefine refine`
166
+ 5. Optional: `graphify query "..."` again to verify
167
+
168
+ ```
169
+ project files ──graphify──► graph.json
170
+
171
+ graphify query
172
+
173
+ deeprefine history add
174
+
175
+ deeprefine refine
176
+
177
+ graphify query
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Command cheat sheet (KB project root)
183
+
184
+ ```bash
185
+ deeprefine history add --query "..."
186
+ deeprefine history list --pending
187
+ deeprefine refine
188
+ deeprefine refine --query "..."
189
+ deeprefine index --rebuild
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Where to run commands
195
+
196
+ | Command | Directory |
197
+ |---------|-----------|
198
+ | `pip install -e .../DeepRefine-Skill` | Any |
199
+ | `pip install -e .../DeepRefine` | DeepRefine repo |
200
+ | `graphify` / `deeprefine cursor install` | **KB project root** |
201
+ | `deeprefine refine` | **KB project root** |
202
+ | vLLM serve scripts | **DeepRefine repo** |
203
+
204
+ Agent instructions: [SKILL.md](./SKILL.md).
205
+
206
+ ---
207
+
208
+ ## Publish to PyPI (maintainers)
209
+
210
+ ```bash
211
+ cd /path/to/DeepRefine-Skill
212
+ python -m pip install --upgrade build twine
213
+ python -m build
214
+ twine check dist/*
215
+ twine upload dist/* # needs PyPI token: TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-...
216
+ ```
217
+
218
+ Test install from TestPyPI first (optional):
219
+
220
+ ```bash
221
+ twine upload --repository testpypi dist/*
222
+ pip install -i https://test.pypi.org/simple/ deeprefine-cli
223
+ ```
@@ -0,0 +1,197 @@
1
+ # DeepRefine-Skill
2
+
3
+ Cursor skill and CLI to refine **[graphify](https://github.com/safishamsi/graphify)** knowledge graphs with **[DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine)** (`graphify-out/graph.json` + session query history).
4
+
5
+ This repository is **standalone**. The DeepRefine model code (`autorefiner`, `atlas_rag`) lives in a separate **DeepRefine** checkout.
6
+
7
+ ---
8
+
9
+ ## Repository layout
10
+
11
+ ```
12
+ DeepRefine-Skill/ ← this repo (pip install -e .)
13
+ ├── README.md
14
+ ├── SKILL.md
15
+ ├── pyproject.toml
16
+ ├── deeprefine_skill/
17
+ └── scripts/deeprefine.py
18
+
19
+ DeepRefine/ ← separate clone (training + Reafiner)
20
+ ├── autorefiner/
21
+ ├── AutoSchemaKG/
22
+ └── ...
23
+
24
+ your-kb-project/ ← your data (graphify-out/)
25
+ └── graphify-out/graph.json
26
+ ```
27
+
28
+ Recommended clone layout:
29
+
30
+ ```text
31
+ www/code/
32
+ ├── DeepRefine/
33
+ └── DeepRefine-Skill/ # sibling → auto-detected if DEEPREFINE_REPO unset
34
+ ```
35
+
36
+ ---
37
+
38
+ ## How graphify and DeepRefine fit together
39
+
40
+ | Stage | Tool | Input | Output |
41
+ |-------|------|-------|--------|
42
+ | Build | **graphify** | Project files | `graphify-out/graph.json`, report, HTML |
43
+ | Query | **graphify** | Questions | `graphify query "..."` |
44
+ | Refine | **DeepRefine** (this repo) | Graph + **query history** | Updated `graph.json`, logs |
45
+
46
+ DeepRefine does not build the graph; it edits `graph.json` incrementally so later `graphify query` works better.
47
+
48
+ ---
49
+
50
+ ## Setup
51
+
52
+ ### 1. DeepRefine environment (`atlastune`)
53
+
54
+ Follow [DeepRefine/README](https://github.com/HKUST-KnowComp/DeepRefine) **Environment** to create `atlastune` and install the main repo:
55
+
56
+ ```bash
57
+ conda activate atlastune
58
+ cd /path/to/DeepRefine
59
+ pip install -e .
60
+ ```
61
+
62
+ ### 2. Install this CLI
63
+
64
+ **From PyPI:**
65
+
66
+ ```bash
67
+ conda activate atlastune
68
+ pip install deeprefine-cli
69
+ ```
70
+
71
+ **From source (development):**
72
+
73
+ ```bash
74
+ pip install -e /path/to/DeepRefine-Skill
75
+ ```
76
+
77
+ Verify:
78
+
79
+ ```bash
80
+ deeprefine --help
81
+ ```
82
+
83
+ > `deeprefine refine` still requires a local [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) checkout (`autorefiner`, `atlas_rag`) and running vLLM services — see below.
84
+
85
+ ### 3. Point to DeepRefine (if not cloned as sibling)
86
+
87
+ Only needed when `DeepRefine` is **not** at `../DeepRefine` relative to this repo and not found by walking up from your cwd:
88
+
89
+ ```bash
90
+ export DEEPREFINE_REPO=/path/to/DeepRefine
91
+ ```
92
+
93
+ Add to `~/.bashrc` if you use a fixed path.
94
+
95
+ ### 4. Start vLLM (before `deeprefine refine`)
96
+
97
+ From the **DeepRefine** repo:
98
+
99
+ ```bash
100
+ conda activate atlastune
101
+ bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
102
+ bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
103
+ ```
104
+
105
+ | Variable | Default |
106
+ |----------|---------|
107
+ | `DEEPREFINE_LLM_URL` | `http://127.0.0.1:8134/v1` |
108
+ | `DEEPREFINE_EMBED_URL` | `http://127.0.0.1:8128/v1` |
109
+ | `DEEPREFINE_MODEL` | `HaoyuHuang2/DeepRefine-v1-8B` |
110
+ | `DEEPREFINE_EMBED_MODEL` | `Qwen/Qwen3-Embedding-0.6B` |
111
+
112
+ ### 5. Install Cursor skill (KB project root)
113
+
114
+ ```bash
115
+ cd /path/to/your-kb-project # must contain or will contain graphify-out/
116
+ deeprefine cursor install
117
+ ```
118
+
119
+ Same pattern as `graphify cursor install`. Use `--user` for all projects.
120
+
121
+ ---
122
+
123
+ ## Workflow with graphify
124
+
125
+ **One-time**
126
+
127
+ ```bash
128
+ pip install graphifyy
129
+ graphify cursor install # in KB project
130
+ pip install -e /path/to/DeepRefine-Skill # in atlastune
131
+ deeprefine cursor install # in KB project
132
+ ```
133
+
134
+ **Per session** (KB project root)
135
+
136
+ 1. `/graphify .` or `graphify .` → `graphify-out/graph.json`
137
+ 2. `graphify query "..."` or `/graphify query "..."`
138
+ 3. `deeprefine history add --query "..."`
139
+ 4. `/deeprefine` or `deeprefine refine`
140
+ 5. Optional: `graphify query "..."` again to verify
141
+
142
+ ```
143
+ project files ──graphify──► graph.json
144
+
145
+ graphify query
146
+
147
+ deeprefine history add
148
+
149
+ deeprefine refine
150
+
151
+ graphify query
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Command cheat sheet (KB project root)
157
+
158
+ ```bash
159
+ deeprefine history add --query "..."
160
+ deeprefine history list --pending
161
+ deeprefine refine
162
+ deeprefine refine --query "..."
163
+ deeprefine index --rebuild
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Where to run commands
169
+
170
+ | Command | Directory |
171
+ |---------|-----------|
172
+ | `pip install -e .../DeepRefine-Skill` | Any |
173
+ | `pip install -e .../DeepRefine` | DeepRefine repo |
174
+ | `graphify` / `deeprefine cursor install` | **KB project root** |
175
+ | `deeprefine refine` | **KB project root** |
176
+ | vLLM serve scripts | **DeepRefine repo** |
177
+
178
+ Agent instructions: [SKILL.md](./SKILL.md).
179
+
180
+ ---
181
+
182
+ ## Publish to PyPI (maintainers)
183
+
184
+ ```bash
185
+ cd /path/to/DeepRefine-Skill
186
+ python -m pip install --upgrade build twine
187
+ python -m build
188
+ twine check dist/*
189
+ twine upload dist/* # needs PyPI token: TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-...
190
+ ```
191
+
192
+ Test install from TestPyPI first (optional):
193
+
194
+ ```bash
195
+ twine upload --repository testpypi dist/*
196
+ pip install -i https://test.pypi.org/simple/ deeprefine-cli
197
+ ```
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: deeprefine
3
+ description: >-
4
+ Refines a graphify knowledge graph (graphify-out/graph.json) using DeepRefine
5
+ Reafiner based on session query history. Use when the user runs /deeprefine,
6
+ asks to improve the graphify KB after Q&A, or wants to patch graph.json from
7
+ failed retrieval queries.
8
+ disable-model-invocation: true
9
+ ---
10
+
11
+ # DeepRefine (graphify)
12
+
13
+ Refine a **[graphify](https://github.com/safishamsi/graphify)** `graph.json` with the DeepRefine agent loop.
14
+
15
+ ## Setup
16
+
17
+ **DeepRefine-Skill** (CLI + this file) is separate from the **DeepRefine** model repo.
18
+
19
+ ```bash
20
+ # 1) DeepRefine env (atlastune) + main package
21
+ conda activate atlastune
22
+ cd /path/to/DeepRefine && pip install -e .
23
+
24
+ # 2) This skill CLI
25
+ pip install -e /path/to/DeepRefine-Skill
26
+
27
+ # 3) Optional if DeepRefine is not ../DeepRefine
28
+ export DEEPREFINE_REPO=/path/to/DeepRefine
29
+
30
+ # 4) Cursor skill in KB project root
31
+ cd /path/to/your-kb-project
32
+ deeprefine cursor install
33
+ ```
34
+
35
+ Start vLLM from DeepRefine: embedding `8128`, refine model `8134` (see DeepRefine `scripts/vllm_serve/`).
36
+
37
+ ## `/deeprefine`
38
+
39
+ From the **KB project root** (with `graphify-out/graph.json`):
40
+
41
+ ```bash
42
+ deeprefine history add --query "..." # after graph Q&A
43
+ deeprefine refine # all pending queries
44
+ ```
45
+
46
+ Do not hand-edit `graph.json` for refinement.
47
+
48
+ ## Paths
49
+
50
+ - History: `graphify-out/.deeprefine/history.jsonl`
51
+ - Log: `graphify-out/.deeprefine/refinement_results_*.jsonl`
52
+ - Backup: `graphify-out/.deeprefine/graph.json.bak`