deeprefine-cli 0.1.4__tar.gz → 0.1.6__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.
Files changed (23) hide show
  1. {deeprefine_cli-0.1.4/deeprefine_cli.egg-info → deeprefine_cli-0.1.6}/PKG-INFO +20 -22
  2. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/README.md +19 -21
  3. deeprefine_cli-0.1.6/SKILL.md +80 -0
  4. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6/deeprefine_cli.egg-info}/PKG-INFO +20 -22
  5. deeprefine_cli-0.1.6/deeprefine_skill/SKILL.md +80 -0
  6. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_skill/__init__.py +1 -1
  7. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/pyproject.toml +1 -1
  8. deeprefine_cli-0.1.4/SKILL.md +0 -54
  9. deeprefine_cli-0.1.4/deeprefine_skill/SKILL.md +0 -54
  10. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/LICENSE +0 -0
  11. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/MANIFEST.in +0 -0
  12. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_cli.egg-info/SOURCES.txt +0 -0
  13. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_cli.egg-info/dependency_links.txt +0 -0
  14. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_cli.egg-info/entry_points.txt +0 -0
  15. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_cli.egg-info/requires.txt +0 -0
  16. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_cli.egg-info/top_level.txt +0 -0
  17. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_skill/adapter_graphify.py +0 -0
  18. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_skill/cli.py +0 -0
  19. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_skill/history.py +0 -0
  20. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_skill/installers.py +0 -0
  21. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_skill/paths.py +0 -0
  22. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/deeprefine_skill/refine_runner.py +0 -0
  23. {deeprefine_cli-0.1.4 → deeprefine_cli-0.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeprefine-cli
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: CLI and Cursor skill to refine graphify knowledge graphs with DeepRefine
5
5
  Author: HKUST-KnowComp
6
6
  License-Expression: MIT
@@ -29,8 +29,8 @@ Dynamic: license-file
29
29
  # DeepRefine-Skill
30
30
 
31
31
 
32
- [![PyPi](https://img.shields.io/badge/PyPi-v0.1.4-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.4/)
33
- [![Python](https://img.shields.io/badge/Python-3.10,3.11,3.12-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.4/)
32
+ [![PyPi](https://img.shields.io/badge/PyPi-v0.1.6-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.6/)
33
+ [![Python](https://img.shields.io/badge/Python-3.10,3.11,3.12-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.6/)
34
34
  [![Paper](https://img.shields.io/badge/Paper-DeepRefine-b31b1b.svg)](https://arxiv.org/pdf/2605.10488)
35
35
  [![Project](https://img.shields.io/badge/Project-DeepRefine-green.svg)](https://github.com/HKUST-KnowComp/DeepRefine)
36
36
 
@@ -38,17 +38,13 @@ Dynamic: license-file
38
38
 
39
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
40
 
41
- 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](https://pypi.org/project/deeprefine-cli/)).
41
+ Works in **Cursor** (install the skill once with `deeprefine cursor install`). In Cursor, `/deeprefine` tells the agent to run **`deeprefine refine`** in your project — the full Reafiner loop (judgement abduction → action generation), not a hand-edited `graph.json`.
42
42
 
43
43
  ```
44
44
  /deeprefine
45
45
  ```
46
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
- ```
47
+ **Typical flow:** `graphify .` → `graphify query "..."` → `/deeprefine` (agent runs `deeprefine refine` for session queries).
52
48
 
53
49
  That's it. Under `graphify-out/.deeprefine/` you get:
54
50
 
@@ -62,15 +58,13 @@ graphify-out/
62
58
  ```
63
59
 
64
60
  > **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`. `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.
61
+ > `pip install deeprefine-cli` ships the CLI and `SKILL.md`. `/deeprefine` and terminal `deeprefine refine` both use the same DeepRefine runtime (vLLM or API keys in your shell). Configure inference once in `atlastune`.
66
62
 
67
63
  ---
68
64
 
69
- ## Roadmap
70
-
71
- **Inference today:** default to your current API model setup.
65
+ ## News
72
66
 
73
- **Optional:** set custom OpenAI-compatible base URL and API key for LLM / embeddings.
67
+ - [2026/6/2] deeprefine-cli v0.1.6 has been released! Customize your LLM api in CLI.
74
68
 
75
69
  ---
76
70
 
@@ -82,7 +76,7 @@ graphify-out/
82
76
  | 2 | `pip install deeprefine-cli` |
83
77
  | 3 | `deeprefine cursor install` in your KB project |
84
78
  | 4 | (Optional) start local vLLM, or use your API provider |
85
- | 5 | `deeprefine history add` `deeprefine refine` |
79
+ | 5 | Cursor chat: `/deeprefine` *(agent runs `deeprefine refine`)*; or terminal: `history add` + `refine` |
86
80
 
87
81
  ```bash
88
82
  # 1) DeepRefine (once)
@@ -111,7 +105,9 @@ export DEEPREFINE_EMBED_MODEL=your_embed_model
111
105
  # export DEEPREFINE_API_KEY=your_shared_api_key
112
106
  # optional model overrides:
113
107
 
114
- # 5) Refine
108
+ # 5) Refine — full Reafiner loop
109
+ # Cursor chat: type /deeprefine (agent runs deeprefine refine --query "..." per session question)
110
+ # Terminal manual flow:
115
111
  deeprefine history add --query "your question"
116
112
  deeprefine refine
117
113
  ```
@@ -132,11 +128,13 @@ deeprefine refine
132
128
  ▼ graphify
133
129
  graph.json ◄────────────────────────┐
134
130
  │ │
135
- ▼ graphify query │ deeprefine refine
136
- (Q&A session)
131
+ ▼ graphify query "..." │ deeprefine refine
132
+ ▼ graphify query "..." │ (per session query)
133
+ ▼ ... │
134
+ (many Q&A in session) │
137
135
  │ │
138
- ▼ deeprefine history add
139
- history.jsonl ──────────────────────┘
136
+ /deeprefine
137
+ (DeepRefine loop) ────────────────────┘
140
138
 
141
139
  ▼ graphify query (verify)
142
140
  ```
@@ -257,8 +255,8 @@ deeprefine cursor install
257
255
  |:-:|--------|
258
256
  | 1 | `graphify .` or `/graphify .` → `graphify-out/graph.json` |
259
257
  | 2 | `graphify query "..."` |
260
- | 3 | `deeprefine history add --query "..."` |
261
- | 4 | `deeprefine refine` or `/deeprefine` |
258
+ | 3 | Cursor chat: `/deeprefine` *(agent runs `deeprefine refine` / `--query` for session questions)* |
259
+ | 4 | Terminal alternative: `deeprefine history add --query "..."` `deeprefine refine` |
262
260
  | 5 | *(optional)* `graphify query "..."` to verify |
263
261
 
264
262
  ---
@@ -3,8 +3,8 @@
3
3
  # DeepRefine-Skill
4
4
 
5
5
 
6
- [![PyPi](https://img.shields.io/badge/PyPi-v0.1.4-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.4/)
7
- [![Python](https://img.shields.io/badge/Python-3.10,3.11,3.12-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.4/)
6
+ [![PyPi](https://img.shields.io/badge/PyPi-v0.1.6-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.6/)
7
+ [![Python](https://img.shields.io/badge/Python-3.10,3.11,3.12-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.6/)
8
8
  [![Paper](https://img.shields.io/badge/Paper-DeepRefine-b31b1b.svg)](https://arxiv.org/pdf/2605.10488)
9
9
  [![Project](https://img.shields.io/badge/Project-DeepRefine-green.svg)](https://github.com/HKUST-KnowComp/DeepRefine)
10
10
 
@@ -12,17 +12,13 @@
12
12
 
13
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
14
 
15
- 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](https://pypi.org/project/deeprefine-cli/)).
15
+ Works in **Cursor** (install the skill once with `deeprefine cursor install`). In Cursor, `/deeprefine` tells the agent to run **`deeprefine refine`** in your project — the full Reafiner loop (judgement abduction → action generation), not a hand-edited `graph.json`.
16
16
 
17
17
  ```
18
18
  /deeprefine
19
19
  ```
20
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
- ```
21
+ **Typical flow:** `graphify .` → `graphify query "..."` → `/deeprefine` (agent runs `deeprefine refine` for session queries).
26
22
 
27
23
  That's it. Under `graphify-out/.deeprefine/` you get:
28
24
 
@@ -36,15 +32,13 @@ graphify-out/
36
32
  ```
37
33
 
38
34
  > **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`. `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.
35
+ > `pip install deeprefine-cli` ships the CLI and `SKILL.md`. `/deeprefine` and terminal `deeprefine refine` both use the same DeepRefine runtime (vLLM or API keys in your shell). Configure inference once in `atlastune`.
40
36
 
41
37
  ---
42
38
 
43
- ## Roadmap
44
-
45
- **Inference today:** default to your current API model setup.
39
+ ## News
46
40
 
47
- **Optional:** set custom OpenAI-compatible base URL and API key for LLM / embeddings.
41
+ - [2026/6/2] deeprefine-cli v0.1.6 has been released! Customize your LLM api in CLI.
48
42
 
49
43
  ---
50
44
 
@@ -56,7 +50,7 @@ graphify-out/
56
50
  | 2 | `pip install deeprefine-cli` |
57
51
  | 3 | `deeprefine cursor install` in your KB project |
58
52
  | 4 | (Optional) start local vLLM, or use your API provider |
59
- | 5 | `deeprefine history add` `deeprefine refine` |
53
+ | 5 | Cursor chat: `/deeprefine` *(agent runs `deeprefine refine`)*; or terminal: `history add` + `refine` |
60
54
 
61
55
  ```bash
62
56
  # 1) DeepRefine (once)
@@ -85,7 +79,9 @@ export DEEPREFINE_EMBED_MODEL=your_embed_model
85
79
  # export DEEPREFINE_API_KEY=your_shared_api_key
86
80
  # optional model overrides:
87
81
 
88
- # 5) Refine
82
+ # 5) Refine — full Reafiner loop
83
+ # Cursor chat: type /deeprefine (agent runs deeprefine refine --query "..." per session question)
84
+ # Terminal manual flow:
89
85
  deeprefine history add --query "your question"
90
86
  deeprefine refine
91
87
  ```
@@ -106,11 +102,13 @@ deeprefine refine
106
102
  ▼ graphify
107
103
  graph.json ◄────────────────────────┐
108
104
  │ │
109
- ▼ graphify query │ deeprefine refine
110
- (Q&A session)
105
+ ▼ graphify query "..." │ deeprefine refine
106
+ ▼ graphify query "..." │ (per session query)
107
+ ▼ ... │
108
+ (many Q&A in session) │
111
109
  │ │
112
- ▼ deeprefine history add
113
- history.jsonl ──────────────────────┘
110
+ /deeprefine
111
+ (DeepRefine loop) ────────────────────┘
114
112
 
115
113
  ▼ graphify query (verify)
116
114
  ```
@@ -231,8 +229,8 @@ deeprefine cursor install
231
229
  |:-:|--------|
232
230
  | 1 | `graphify .` or `/graphify .` → `graphify-out/graph.json` |
233
231
  | 2 | `graphify query "..."` |
234
- | 3 | `deeprefine history add --query "..."` |
235
- | 4 | `deeprefine refine` or `/deeprefine` |
232
+ | 3 | Cursor chat: `/deeprefine` *(agent runs `deeprefine refine` / `--query` for session questions)* |
233
+ | 4 | Terminal alternative: `deeprefine history add --query "..."` `deeprefine refine` |
236
234
  | 5 | *(optional)* `graphify query "..."` to verify |
237
235
 
238
236
  ---
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: deeprefine
3
+ description: >-
4
+ Refines a graphify knowledge graph (graphify-out/graph.json) using DeepRefine
5
+ Reafiner (judgement, error abduction, KG action generation). Use when the user
6
+ runs /deeprefine, asks to improve the graphify KB after Q&A, or wants to patch
7
+ graph.json from failed retrieval queries.
8
+ disable-model-invocation: false
9
+ ---
10
+
11
+ # DeepRefine (graphify)
12
+
13
+ Refine `graphify-out/graph.json` with the **full DeepRefine Reafiner loop** (multi-hop retrieval → answerable judgement → error abduction → refinement actions). Do **not** hand-edit `graph.json`.
14
+
15
+ ## Setup (once)
16
+
17
+ **DeepRefine-Skill** (CLI + this file) is separate from the **DeepRefine** model repo.
18
+
19
+ ```bash
20
+ conda activate atlastune
21
+ cd /path/to/DeepRefine && pip install -e .
22
+ pip install deeprefine-cli
23
+ export DEEPREFINE_REPO=/path/to/DeepRefine # if not ../DeepRefine
24
+ cd /path/to/your-kb-project
25
+ deeprefine cursor install
26
+ ```
27
+
28
+ **Inference** (required for `deeprefine refine`; configure in the shell where you run commands):
29
+
30
+ - **Local vLLM:** start DeepRefine `scripts/vllm_serve/` (embedding `8128`, refine `8134`), or
31
+ - **API:** set `DEEPREFINE_LLM_URL`, `DEEPREFINE_EMBED_URL`, `DEEPREFINE_LLM_API_KEY`, `DEEPREFINE_EMBED_API_KEY`, and model names.
32
+
33
+ ## `/deeprefine` — run the real Reafiner via CLI
34
+
35
+ When the user invokes `/deeprefine`, **orchestrate** refinement by running the CLI in the **KB project root** (directory containing `graphify-out/graph.json`). The subprocess runs `Reafiner.refine()` — not a free-form graph edit in chat.
36
+
37
+ ### Agent steps
38
+
39
+ 1. **Confirm cwd** is the KB project root (`graphify-out/graph.json` exists).
40
+ 2. **Collect queries** to refine:
41
+ - Prefer questions from **this chat session** after recent `graphify query` / `/graphify query` (user questions about the KB).
42
+ - Optionally check pending history: `deeprefine history list --pending`.
43
+ 3. **Run refinement** (use `atlastune`; do not edit `graph.json` yourself):
44
+
45
+ ```bash
46
+ conda activate atlastune
47
+ # If there are pending entries and they match what the user wants refined:
48
+ deeprefine refine
49
+
50
+ # Otherwise, for each session query (records + refines in one step):
51
+ deeprefine refine --query "exact user question from this session"
52
+ ```
53
+
54
+ 4. **Report results** from CLI stdout: queries processed, node/edge counts, log path under `graphify-out/.deeprefine/refinement_results_*.jsonl`.
55
+ 5. On failure (missing API key, vLLM down, no graph), show the error and tell the user which env vars or vLLM scripts to fix — do not fall back to manual JSON patching.
56
+
57
+ ### Rules
58
+
59
+ | Do | Don't |
60
+ |----|--------|
61
+ | Run `deeprefine refine` / `deeprefine refine --query "..."` | Hand-edit `graphify-out/graph.json` |
62
+ | Use `atlastune` + configured inference | Simulate judgement/abduction in chat only |
63
+ | Use exact user queries from the session | Require the user to run `history add` first in Cursor |
64
+
65
+ ### What runs inside `deeprefine refine`
66
+
67
+ Per query, the DeepRefine runtime executes:
68
+
69
+ 1. Multi-hop subgraph retrieval (FAISS + KG expansion)
70
+ 2. **Answerable judgement** per hop
71
+ 3. **Error abduction** when retrieval fails across hops
72
+ 4. **Refinement action generation** and application to the KG
73
+ 5. Persist updated `graph.json`, FAISS cache, and `history.jsonl` (`refined: true`)
74
+
75
+ ## Paths
76
+
77
+ - History: `graphify-out/.deeprefine/history.jsonl`
78
+ - Log: `graphify-out/.deeprefine/refinement_results_*.jsonl`
79
+ - Backup: `graphify-out/.deeprefine/graph.json.bak`
80
+ - FAISS cache: `graphify-out/.deeprefine/cache/reafiner_data.pkl`
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeprefine-cli
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: CLI and Cursor skill to refine graphify knowledge graphs with DeepRefine
5
5
  Author: HKUST-KnowComp
6
6
  License-Expression: MIT
@@ -29,8 +29,8 @@ Dynamic: license-file
29
29
  # DeepRefine-Skill
30
30
 
31
31
 
32
- [![PyPi](https://img.shields.io/badge/PyPi-v0.1.4-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.4/)
33
- [![Python](https://img.shields.io/badge/Python-3.10,3.11,3.12-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.4/)
32
+ [![PyPi](https://img.shields.io/badge/PyPi-v0.1.6-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.6/)
33
+ [![Python](https://img.shields.io/badge/Python-3.10,3.11,3.12-blue.svg)](https://pypi.org/project/deeprefine-cli/0.1.6/)
34
34
  [![Paper](https://img.shields.io/badge/Paper-DeepRefine-b31b1b.svg)](https://arxiv.org/pdf/2605.10488)
35
35
  [![Project](https://img.shields.io/badge/Project-DeepRefine-green.svg)](https://github.com/HKUST-KnowComp/DeepRefine)
36
36
 
@@ -38,17 +38,13 @@ Dynamic: license-file
38
38
 
39
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
40
 
41
- 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](https://pypi.org/project/deeprefine-cli/)).
41
+ Works in **Cursor** (install the skill once with `deeprefine cursor install`). In Cursor, `/deeprefine` tells the agent to run **`deeprefine refine`** in your project — the full Reafiner loop (judgement abduction → action generation), not a hand-edited `graph.json`.
42
42
 
43
43
  ```
44
44
  /deeprefine
45
45
  ```
46
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
- ```
47
+ **Typical flow:** `graphify .` → `graphify query "..."` → `/deeprefine` (agent runs `deeprefine refine` for session queries).
52
48
 
53
49
  That's it. Under `graphify-out/.deeprefine/` you get:
54
50
 
@@ -62,15 +58,13 @@ graphify-out/
62
58
  ```
63
59
 
64
60
  > **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`. `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.
61
+ > `pip install deeprefine-cli` ships the CLI and `SKILL.md`. `/deeprefine` and terminal `deeprefine refine` both use the same DeepRefine runtime (vLLM or API keys in your shell). Configure inference once in `atlastune`.
66
62
 
67
63
  ---
68
64
 
69
- ## Roadmap
70
-
71
- **Inference today:** default to your current API model setup.
65
+ ## News
72
66
 
73
- **Optional:** set custom OpenAI-compatible base URL and API key for LLM / embeddings.
67
+ - [2026/6/2] deeprefine-cli v0.1.6 has been released! Customize your LLM api in CLI.
74
68
 
75
69
  ---
76
70
 
@@ -82,7 +76,7 @@ graphify-out/
82
76
  | 2 | `pip install deeprefine-cli` |
83
77
  | 3 | `deeprefine cursor install` in your KB project |
84
78
  | 4 | (Optional) start local vLLM, or use your API provider |
85
- | 5 | `deeprefine history add` `deeprefine refine` |
79
+ | 5 | Cursor chat: `/deeprefine` *(agent runs `deeprefine refine`)*; or terminal: `history add` + `refine` |
86
80
 
87
81
  ```bash
88
82
  # 1) DeepRefine (once)
@@ -111,7 +105,9 @@ export DEEPREFINE_EMBED_MODEL=your_embed_model
111
105
  # export DEEPREFINE_API_KEY=your_shared_api_key
112
106
  # optional model overrides:
113
107
 
114
- # 5) Refine
108
+ # 5) Refine — full Reafiner loop
109
+ # Cursor chat: type /deeprefine (agent runs deeprefine refine --query "..." per session question)
110
+ # Terminal manual flow:
115
111
  deeprefine history add --query "your question"
116
112
  deeprefine refine
117
113
  ```
@@ -132,11 +128,13 @@ deeprefine refine
132
128
  ▼ graphify
133
129
  graph.json ◄────────────────────────┐
134
130
  │ │
135
- ▼ graphify query │ deeprefine refine
136
- (Q&A session)
131
+ ▼ graphify query "..." │ deeprefine refine
132
+ ▼ graphify query "..." │ (per session query)
133
+ ▼ ... │
134
+ (many Q&A in session) │
137
135
  │ │
138
- ▼ deeprefine history add
139
- history.jsonl ──────────────────────┘
136
+ /deeprefine
137
+ (DeepRefine loop) ────────────────────┘
140
138
 
141
139
  ▼ graphify query (verify)
142
140
  ```
@@ -257,8 +255,8 @@ deeprefine cursor install
257
255
  |:-:|--------|
258
256
  | 1 | `graphify .` or `/graphify .` → `graphify-out/graph.json` |
259
257
  | 2 | `graphify query "..."` |
260
- | 3 | `deeprefine history add --query "..."` |
261
- | 4 | `deeprefine refine` or `/deeprefine` |
258
+ | 3 | Cursor chat: `/deeprefine` *(agent runs `deeprefine refine` / `--query` for session questions)* |
259
+ | 4 | Terminal alternative: `deeprefine history add --query "..."` `deeprefine refine` |
262
260
  | 5 | *(optional)* `graphify query "..."` to verify |
263
261
 
264
262
  ---
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: deeprefine
3
+ description: >-
4
+ Refines a graphify knowledge graph (graphify-out/graph.json) using DeepRefine
5
+ Reafiner (judgement, error abduction, KG action generation). Use when the user
6
+ runs /deeprefine, asks to improve the graphify KB after Q&A, or wants to patch
7
+ graph.json from failed retrieval queries.
8
+ disable-model-invocation: false
9
+ ---
10
+
11
+ # DeepRefine (graphify)
12
+
13
+ Refine `graphify-out/graph.json` with the **full DeepRefine Reafiner loop** (multi-hop retrieval → answerable judgement → error abduction → refinement actions). Do **not** hand-edit `graph.json`.
14
+
15
+ ## Setup (once)
16
+
17
+ **DeepRefine-Skill** (CLI + this file) is separate from the **DeepRefine** model repo.
18
+
19
+ ```bash
20
+ conda activate atlastune
21
+ cd /path/to/DeepRefine && pip install -e .
22
+ pip install deeprefine-cli
23
+ export DEEPREFINE_REPO=/path/to/DeepRefine # if not ../DeepRefine
24
+ cd /path/to/your-kb-project
25
+ deeprefine cursor install
26
+ ```
27
+
28
+ **Inference** (required for `deeprefine refine`; configure in the shell where you run commands):
29
+
30
+ - **Local vLLM:** start DeepRefine `scripts/vllm_serve/` (embedding `8128`, refine `8134`), or
31
+ - **API:** set `DEEPREFINE_LLM_URL`, `DEEPREFINE_EMBED_URL`, `DEEPREFINE_LLM_API_KEY`, `DEEPREFINE_EMBED_API_KEY`, and model names.
32
+
33
+ ## `/deeprefine` — run the real Reafiner via CLI
34
+
35
+ When the user invokes `/deeprefine`, **orchestrate** refinement by running the CLI in the **KB project root** (directory containing `graphify-out/graph.json`). The subprocess runs `Reafiner.refine()` — not a free-form graph edit in chat.
36
+
37
+ ### Agent steps
38
+
39
+ 1. **Confirm cwd** is the KB project root (`graphify-out/graph.json` exists).
40
+ 2. **Collect queries** to refine:
41
+ - Prefer questions from **this chat session** after recent `graphify query` / `/graphify query` (user questions about the KB).
42
+ - Optionally check pending history: `deeprefine history list --pending`.
43
+ 3. **Run refinement** (use `atlastune`; do not edit `graph.json` yourself):
44
+
45
+ ```bash
46
+ conda activate atlastune
47
+ # If there are pending entries and they match what the user wants refined:
48
+ deeprefine refine
49
+
50
+ # Otherwise, for each session query (records + refines in one step):
51
+ deeprefine refine --query "exact user question from this session"
52
+ ```
53
+
54
+ 4. **Report results** from CLI stdout: queries processed, node/edge counts, log path under `graphify-out/.deeprefine/refinement_results_*.jsonl`.
55
+ 5. On failure (missing API key, vLLM down, no graph), show the error and tell the user which env vars or vLLM scripts to fix — do not fall back to manual JSON patching.
56
+
57
+ ### Rules
58
+
59
+ | Do | Don't |
60
+ |----|--------|
61
+ | Run `deeprefine refine` / `deeprefine refine --query "..."` | Hand-edit `graphify-out/graph.json` |
62
+ | Use `atlastune` + configured inference | Simulate judgement/abduction in chat only |
63
+ | Use exact user queries from the session | Require the user to run `history add` first in Cursor |
64
+
65
+ ### What runs inside `deeprefine refine`
66
+
67
+ Per query, the DeepRefine runtime executes:
68
+
69
+ 1. Multi-hop subgraph retrieval (FAISS + KG expansion)
70
+ 2. **Answerable judgement** per hop
71
+ 3. **Error abduction** when retrieval fails across hops
72
+ 4. **Refinement action generation** and application to the KG
73
+ 5. Persist updated `graph.json`, FAISS cache, and `history.jsonl` (`refined: true`)
74
+
75
+ ## Paths
76
+
77
+ - History: `graphify-out/.deeprefine/history.jsonl`
78
+ - Log: `graphify-out/.deeprefine/refinement_results_*.jsonl`
79
+ - Backup: `graphify-out/.deeprefine/graph.json.bak`
80
+ - FAISS cache: `graphify-out/.deeprefine/cache/reafiner_data.pkl`
@@ -1,3 +1,3 @@
1
1
  """DeepRefine agent skill: refine graphify graph.json via Reafiner."""
2
2
 
3
- __version__ = "0.1.4"
3
+ __version__ = "0.1.6"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deeprefine-cli"
7
- version = "0.1.4"
7
+ version = "0.1.6"
8
8
  description = "CLI and Cursor skill to refine graphify knowledge graphs with DeepRefine"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,54 +0,0 @@
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 deeprefine-cli
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
- Inference defaults to your current API model setup (`OPENAI_API_KEY` or `DEEPREFINE_API_KEY`).
36
-
37
- Optional: local vLLM from DeepRefine (embedding `8128`, refine model `8134`; see `scripts/vllm_serve/`).
38
-
39
- ## `/deeprefine`
40
-
41
- From the **KB project root** (with `graphify-out/graph.json`):
42
-
43
- ```bash
44
- deeprefine history add --query "..." # after graph Q&A
45
- deeprefine refine # all pending queries
46
- ```
47
-
48
- Do not hand-edit `graph.json` for refinement.
49
-
50
- ## Paths
51
-
52
- - History: `graphify-out/.deeprefine/history.jsonl`
53
- - Log: `graphify-out/.deeprefine/refinement_results_*.jsonl`
54
- - Backup: `graphify-out/.deeprefine/graph.json.bak`
@@ -1,54 +0,0 @@
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 deeprefine-cli
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
- Inference defaults to your current API model setup (`OPENAI_API_KEY` or `DEEPREFINE_API_KEY`).
36
-
37
- Optional: local vLLM from DeepRefine (embedding `8128`, refine model `8134`; see `scripts/vllm_serve/`).
38
-
39
- ## `/deeprefine`
40
-
41
- From the **KB project root** (with `graphify-out/graph.json`):
42
-
43
- ```bash
44
- deeprefine history add --query "..." # after graph Q&A
45
- deeprefine refine # all pending queries
46
- ```
47
-
48
- Do not hand-edit `graph.json` for refinement.
49
-
50
- ## Paths
51
-
52
- - History: `graphify-out/.deeprefine/history.jsonl`
53
- - Log: `graphify-out/.deeprefine/refinement_results_*.jsonl`
54
- - Backup: `graphify-out/.deeprefine/graph.json.bak`
File without changes
File without changes