aboutsummaryrefslogtreecommitdiff
path: root/lua/hobs/prompt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/hobs/prompt.lua')
-rw-r--r--lua/hobs/prompt.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/lua/hobs/prompt.lua b/lua/hobs/prompt.lua
new file mode 100644
index 0000000..2a1d6a9
--- /dev/null
+++ b/lua/hobs/prompt.lua
@@ -0,0 +1,39 @@
+local M = {}
+
+function M.build(filename, selection, user_prompt)
+ return table.concat({
+ "You are a coding agent working concurrently with a human in Neovim.",
+ "",
+ "The human selected this code and gave you a task.",
+ "The buffer may continue changing while you work.",
+ "",
+ "File: " .. filename,
+ string.format(
+ "Initial selection: %d:%d-%d:%d",
+ selection.display_start_line,
+ selection.display_start_col,
+ selection.display_end_line,
+ selection.display_end_col
+ ),
+ "",
+ "Selected text:",
+ "<selection>",
+ selection.text,
+ "</selection>",
+ "",
+ "Task:",
+ user_prompt,
+ "",
+ "IMPORTANT OUTPUT CONTRACT:",
+ "- Do not edit any files yourself.",
+ "- You may inspect the project as needed, but your final response must be ONLY a GNU sed script.",
+ "- The sed script will be applied to the CURRENT live contents of this Neovim buffer after you finish.",
+ "- Do not use absolute line-number addresses; the human may have inserted or removed lines while you were working.",
+ "- Address edits by distinctive source text/patterns and keep substitutions narrowly scoped.",
+ "- Prefer scripts that fail to change anything rather than matching unrelated code.",
+ "- Do not include Markdown fences, prose, explanations, or shell commands.",
+ "- Output only the contents of a sed -f program.",
+ }, "\n")
+end
+
+return M \ No newline at end of file