Skip to content

Instantly share code, notes, and snippets.

@PEZ
Last active August 12, 2025 12:11
Show Gist options
  • Select an option

  • Save PEZ/660181ab810949b3576b4f7e2a7b517e to your computer and use it in GitHub Desktop.

Select an option

Save PEZ/660181ab810949b3576b4f7e2a7b517e to your computer and use it in GitHub Desktop.
A prompt file for VS Code Copilot to help with crafting good task prompts from one liners
mode
agent

You are an AI assistant designed to help users create high-quality, detailed task prompts. DO NOT WRITE ANY CODE.

Your goal is to iteratively refine the user’s prompt by:

At all times when you need clarification on details, ask specific questions to the user using the joyride_request_human_input tool.

  • Understanding the task scope and objectives
  • Defining expected deliverables and success criteria
  • Perform repl explorations, using the available REPL connection, to further your understanding of the task
    • Also consider using other tools to gather sufficient information about the task.
  • Clarifying technical and procedural requirements
  • Organizing the prompt into clear sections or steps
  • Ensuring the prompt is easy to understand and follow

After gathering sufficient information, produce the improved prompt as markdown, use Joyride to place the markdown on the system clipboard, as well as typing it out in the chat. Use this exact Joyride code for clipboard operations:

(require '["vscode" :as vscode])
(vscode/env.clipboard.writeText "your-markdown-text-here")

Announce to the user that the prompt is available on the clipboard, and also ask the user if they want any changes or additions. Repeat the copy + chat + ask after any revisions of the prompt.

@PEZ
Copy link
Author

PEZ commented Aug 12, 2025

Example: I prompted, using Claude Sonnet 4, and a Clojure coding chatmode:

/boost-prompt I have the following code and want to create an lm tool with it:

(def timeout-ms 10000)
(def timeout-s (/ timeout-ms 1000))

(defn request-human-input! [prompt]
  (let [!state (atom {::result ::empty->what-would-rich-hickey-do?})]
    (p/create
     (fn [resolve-fn _reject]
       (let [input-box (vscode/window.createInputBox)]
         (set! (.-title input-box) "AI Agent needs input")
         (set! (.-prompt input-box) prompt)
         (set! (.-placeholder input-box) (str "Start typing to cancel auto-dismiss (" timeout-s "s timeout)..."))
         (set! (.-ignoreFocusOut input-box) true)
         (swap! !state assoc ::timeout-id
                (js/setTimeout (fn [] (.hide input-box)) timeout-ms))
         (.onDidChangeValue input-box (fn [_] (when-let [timeout-id (::timeout-id @!state)]
                                                (swap! !state dissoc ::timeout-id)
                                                (js/clearTimeout timeout-id))))
         (.onDidAccept input-box (fn []
                                   (let [value (.-value input-box)]
                                     (when-not (string/blank? value)
                                       (swap! !state assoc ::result value))
                                     (.hide input-box))))
         (.onDidHide input-box (fn []
                                 (.dispose input-box)
                                 (resolve-fn (str (::result @!state)))))
         (.show input-box))))))

(comment
  (p/let [a (request-human-input! "hello?")]
    (def a a))
  :rcf)

The agent then started to examine the project, and asked me a series questions, like what to name the tool, it's main purpose, my focus areas for the implementations, etcetera. Investigating more of the project, and asked some more questions, then cooked this prompt and placed in my clipboard:


Implement Human Input LM Tool for Joyride

Overview

Implement a new Language Model tool called request_human_input that allows AI agents to request human guidance during task execution. This tool will provide a VS Code input box interface for human-AI collaboration in Joyride.

Requirements

Core Functionality

  • Tool Name: request_human_input
  • Purpose: Enable AI agents to ask humans for input/guidance during development tasks
  • Always Available: No configuration settings required (unlike evaluation tool)
  • Display Name: "Request Human Input"
  • User Description: "Ask the human developer for input or guidance"
  • Model Description: "Ask the human developer for input or guidance. Give your question context in the chat, then use this tool to request input from the human."

Implementation Pattern

Follow the existing Joyride LM tool patterns:

  1. File Structure: Create src/joyride/lm/human_input.cljs
  2. Registration: Add to src/joyride/lm.cljs register-tools! function
  3. Package.json: Add tool definition to languageModelTools array

Core Function Implementation

Use the provided request-human-input! function as the foundation:

(def timeout-ms 10000)
(def timeout-s (/ timeout-ms 1000))

(defn request-human-input! [prompt]
  (let [!state (atom {::result ::empty->what-would-rich-hickey-do?})]
    (p/create
     (fn [resolve-fn _reject]
       (let [input-box (vscode/window.createInputBox)]
         (set! (.-title input-box) "Your Copilot needs your input")
         (set! (.-prompt input-box) prompt)
         (set! (.-placeholder input-box) (str "Start typing to cancel auto-dismiss (" timeout-s "s timeout)..."))
         (set! (.-ignoreFocusOut input-box) true)
         (swap! !state assoc ::timeout-id
                (js/setTimeout (fn [] (.hide input-box)) timeout-ms))
         (.onDidChangeValue input-box (fn [_] (when-let [timeout-id (::timeout-id @!state)]
                                                (swap! !state dissoc ::timeout-id)
                                                (js/clearTimeout timeout-id))))
         (.onDidAccept input-box (fn []
                                   (let [value (.-value input-box)]
                                     (when-not (string/blank? value)
                                       (swap! !state assoc ::result value))
                                     (.hide input-box))))
         (.onDidHide input-box (fn []
                                 (.dispose input-box)
                                 (resolve-fn (str (::result @!state)))))
         (.show input-box))))))

Tool Schema

{
  "name": "request_human_input",
  "displayName": "Request Human Input",
  "modelDescription": "Ask the human developer for input or guidance. Give your question context in the chat, then use this tool to request input from the human.",
  "userDescription": "Ask the human developer for input or guidance",
  "canBeReferencedInPrompt": true,
  "toolReferenceName": "human-input",
  "icon": "$(person)",
  "inputSchema": {
    "type": "object",
    "properties": {
      "prompt": {
        "type": "string",
        "description": "The question to ask the human. First provide context in the chat, this prompt is for framing the question."
      }
    },
    "required": ["prompt"]
  }
}

Implementation Steps

1. Create the Human Input Module

  • File: src/joyride/lm/human_input.cljs
  • Namespace: joyride.lm.human-input
  • Dependencies: ["vscode" :as vscode], [clojure.string :as string], [promesa.core :as p], [joyride.lm.core :as core]

2. Implement Core Functions

  • request-human-input!: The main function (provided above)
  • invoke-tool!: Tool invocation handler following Joyride patterns
  • register-tool!: Registration function

3. Follow Joyride Tool Patterns

Reference existing tools in the codebase:

  • Error Handling: Use core/create-error-result for errors
  • Success Response: Use core/create-success-result for success
  • Logging: Use js/console.log for registration success
  • Parameter Extraction: Extract prompt from input options
  • Promise Handling: Return promises properly for VS Code LM API

4. Update Registration

  • File: src/joyride/lm.cljs
  • Add: Require the new namespace
  • Add: Register the tool in register-tools! function
  • Add: Include disposable in return collection

5. Update Package.json

  • File: package.json
  • Location: contributes.languageModelTools array
  • Add: The tool definition JSON schema (provided above)

Technical Details

Input Box Behavior

  • Title: "Your Copilot needs your input"
  • Timeout: 10 seconds with auto-dismiss
  • Focus: ignoreFocusOut set to true
  • Cancellation: Typing cancels timeout
  • Default Response: Returns the default value if no input provided

No Over-Engineering

  • Single Parameter: Only prompt (string)
  • No Validation: Basic string parameter, no complex validation needed
  • No Configuration: Always available, no settings
  • Straightforward: Follow existing patterns exactly

Integration Points

  • VS Code LM API: Primary interface for GitHub Copilot
  • Disposables: Proper lifecycle management
  • Error Handling: Basic try/catch in registration
  • Logging: Console logging for debugging

Success Criteria

  1. Tool Registration: Successfully registers with VS Code LM API
  2. Input Box: Shows VS Code input box with correct title and placeholder
  3. Timeout Behavior: Auto-dismisses after 10 seconds if no interaction
  4. User Input: Captures and returns user input when provided
  5. Default Handling: Returns default value when no input given
  6. Promise Resolution: Properly resolves promises for async operation
  7. Pattern Compliance: Follows existing Joyride LM tool patterns exactly

Files to Modify

  1. src/joyride/lm/human_input.cljs (new file)
  2. src/joyride/lm.cljs (add registration)
  3. package.json (add tool definition)

Reference Implementation

Study the existing tools in src/joyride/lm/ for patterns:

  • evaluation.cljs for tool structure
  • docs.cljs for simple tool patterns
  • core.cljs for shared utilities

The implementation should be straightforward, following established patterns without over-thinking the requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment