You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,12 +189,17 @@ This re-enables the `llamacpp` container and resets `.env` to `http://llamacpp:8
189
189
190
190
### CLI: ctx prompt enhancer
191
191
192
-
A thin CLI that retrieves code context and rewrites your input into a better, context-aware prompt using the local LLM decoder. By default it prints ONLY the improved prompt.
192
+
A thin CLI that retrieves code context and rewrites your input into a better, context-aware prompt using the local LLM decoder. Works with both questions and commands/instructions. By default it prints ONLY the improved prompt.
193
193
194
194
Examples:
195
195
````bash
196
-
# Default: print only the improved prompt (uses Docker llama.cpp on port 8080)
197
-
scripts/ctx.py "Explain the caching logic to me in detail"
196
+
# Questions: Enhanced with specific details and multiple aspects
197
+
scripts/ctx.py "What is ReFRAG?"
198
+
# Output: Two detailed question paragraphs with file/line references
199
+
200
+
# Commands: Enhanced with concrete targets and implementation details
201
+
scripts/ctx.py "Refactor ctx.py"
202
+
# Output: Two detailed instruction paragraphs with specific steps
198
203
199
204
# Via Make target (default improved prompt only)
200
205
make ctx Q="Explain the caching logic to me in detail"
Include compact code snippets in the retrieved context for richer rewrites (trades a bit of speed for quality):
210
215
211
216
````bash
212
-
# Enable detail mode (adds short snippets)
217
+
# Enable detail mode (adds short snippets) - works with questions
213
218
scripts/ctx.py "Explain the caching logic" --detail
214
219
220
+
# Detail mode with commands - gets more specific implementation details
221
+
scripts/ctx.py "Add error handling to ctx.py" --detail
222
+
215
223
# Adjust snippet size if needed (default is 1 line when --detail is used)
216
224
make ctx Q="Explain hybrid search" ARGS="--detail --context-lines 2"
217
225
````
218
226
219
227
Notes:
220
228
- Default behavior is header-only (fastest). `--detail` adds short snippets.
221
229
- If `--detail` is set and `--context-lines` remains at its default (0), ctx.py automatically uses 1 line to keep snippets concise. Override with `--context-lines N`.
230
+
- Detail mode is optimized for speed: automatically clamps to max 4 results and 1 result per file.
231
+
- Performance: ~12-15s with detail mode vs ~45-50s without optimization.
222
232
223
233
GPU Acceleration (Apple Silicon):
224
234
For faster prompt rewriting, use the native Metal-accelerated decoder:
0 commit comments