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
Include compact code snippets in the retrieved context for richer rewrites (trades a bit of speed for quality):
210
+
211
+
````bash
212
+
# Enable detail mode (adds short snippets)
213
+
scripts/ctx.py "Explain the caching logic" --detail
214
+
215
+
# Adjust snippet size if needed (default is 1 line when --detail is used)
216
+
make ctx Q="Explain hybrid search" ARGS="--detail --context-lines 2"
217
+
````
218
+
219
+
Notes:
220
+
- Default behavior is header-only (fastest). `--detail` adds short snippets.
221
+
- 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`.
222
+
206
223
GPU Acceleration (Apple Silicon):
207
224
For faster prompt rewriting, use the native Metal-accelerated decoder:
# Granite 4.0 chat template with explicit rewrite-only instruction
276
363
system_msg= (
277
-
"You are a prompt rewriter. "
278
-
"Rewrite the user's question to be specific and actionable using only the provided context. "
279
-
"Cite file paths, line ranges, and symbols only if they appear verbatim in the Context refs; never invent references. "
280
-
"If line ranges are not shown for a file, cite only the file path. "
281
-
"Prefer a multi-clause question that explicitly calls out what to analyze across the referenced components when applicable; focus on concrete aspects such as algorithmic steps, inputs/outputs, parameters/configuration, performance, error handling, tests, and edge cases. "
282
-
"Do not answer the question. Return only the rewritten question as plain text with no markdown or code fences."
364
+
"You are a prompt rewriter. Your ONLY job is to rewrite prompts to be more specific and detailed. "
365
+
"CRITICAL: You must NEVER answer questions or execute commands. You must ONLY rewrite the prompt to be better and more specific. "
366
+
"ALWAYS enhance the prompt to be more detailed and actionable. "
367
+
"If context is provided, use it to make the prompt more concrete by citing specific file paths, line ranges, and symbols that appear in the Context refs. "
368
+
"If no relevant context is available, still enhance the prompt by expanding it to cover multiple aspects: implementation details, edge cases, error handling, performance, configuration, tests, and related components. "
369
+
"Never invent references - only cite what appears verbatim in the Context refs. "
370
+
"Your rewrite must be at least two short paragraphs separated by a single blank line. "
371
+
"For questions: rewrite as more specific questions. For commands/instructions: rewrite as more detailed, specific instructions with concrete targets. "
372
+
"Each paragraph should explore different aspects of the topic. "
373
+
"Output format: plain text only, no markdown, no code fences, no answers, no explanations."
"Rewrite the question now. Ground it in the context above; include concrete file/symbol references only when present, avoid generic phrasing, and do not include markdown."
0 commit comments