From bb4a3f68f7b2aaea41e7c8879baa393845707719 Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Thu, 4 Dec 2025 10:25:47 -0800 Subject: [PATCH] feat: add simplified prompt option via USE_SIMPLE_PROMPT env var (#718) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a shorter, more concise prompt for tag mode that trusts the model to figure out details. Opt-in via USE_SIMPLE_PROMPT=true. The simplified prompt keeps all context data but reduces instructions from ~250 to ~70 lines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude --- src/create-prompt/index.ts | 121 +++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/src/create-prompt/index.ts b/src/create-prompt/index.ts index 0367a6a..7a62e6e 100644 --- a/src/create-prompt/index.ts +++ b/src/create-prompt/index.ts @@ -459,6 +459,123 @@ export function generatePrompt( return mode.generatePrompt(context, githubData, useCommitSigning); } +/** + * Generates a simplified prompt for tag mode (opt-in via USE_SIMPLE_PROMPT env var) + * @internal + */ +function generateSimplePrompt( + context: PreparedContext, + githubData: FetchDataResult, + useCommitSigning: boolean = false, +): string { + const { + contextData, + comments, + changedFilesWithSHA, + reviewData, + imageUrlMap, + } = githubData; + const { eventData } = context; + + const { triggerContext } = getEventTypeAndContext(context); + + const formattedContext = formatContext(contextData, eventData.isPR); + const formattedComments = formatComments(comments, imageUrlMap); + const formattedReviewComments = eventData.isPR + ? formatReviewComments(reviewData, imageUrlMap) + : ""; + const formattedChangedFiles = eventData.isPR + ? formatChangedFilesWithSHA(changedFilesWithSHA) + : ""; + + const hasImages = imageUrlMap && imageUrlMap.size > 0; + const imagesInfo = hasImages + ? `\n\n +Images from comments have been saved to disk. Paths are in the formatted content above. Use Read tool to view them. +` + : ""; + + const formattedBody = contextData?.body + ? formatBody(contextData.body, imageUrlMap) + : "No description provided"; + + const entityType = eventData.isPR ? "pull request" : "issue"; + const jobUrl = `${GITHUB_SERVER_URL}/${context.repository}/actions/runs/${process.env.GITHUB_RUN_ID}`; + + let promptContent = `You were tagged on a GitHub ${entityType} via "${context.triggerPhrase}". Read the request and decide how to help. + + +${formattedContext} + + +<${eventData.isPR ? "pr" : "issue"}_body> +${formattedBody} + + + +${formattedComments || "No comments"} + +${ + eventData.isPR + ? ` + +${formattedReviewComments || "No review comments"} + + + +${formattedChangedFiles || "No files changed"} +` + : "" +}${imagesInfo} + + +repository: ${context.repository} +${eventData.isPR && eventData.prNumber ? `pr_number: ${eventData.prNumber}` : ""} +${!eventData.isPR && eventData.issueNumber ? `issue_number: ${eventData.issueNumber}` : ""} +trigger: ${triggerContext} +triggered_by: ${context.triggerUsername ?? "Unknown"} +claude_comment_id: ${context.claudeCommentId} + +${ + (eventData.eventName === "issue_comment" || + eventData.eventName === "pull_request_review_comment" || + eventData.eventName === "pull_request_review") && + eventData.commentBody + ? ` + +${sanitizeContent(eventData.commentBody)} +` + : "" +} + +Your request is in above${eventData.eventName === "issues" ? ` (or the ${entityType} body for assigned/labeled events)` : ""}. + +Decide what's being asked: +1. **Question or code review** - Answer directly or provide feedback +2. **Code change** - Implement the change, commit, and push + +Communication: +- Your ONLY visible output is your GitHub comment - update it with progress and results +- Use mcp__github_comment__update_claude_comment to update (only "body" param needed) +- Use checklist format for tasks: - [ ] incomplete, - [x] complete +- Use ### headers (not #) +${getCommitInstructions(eventData, githubData, context, useCommitSigning)} +${ + eventData.claudeBranch + ? ` +When done with changes, provide a PR link: +[Create a PR](${GITHUB_SERVER_URL}/${context.repository}/compare/${eventData.baseBranch}...${eventData.claudeBranch}?quick_pull=1&title=&body=) +Use THREE dots (...) between branches. URL-encode all parameters.` + : "" +} + +Always include at the bottom: +- Job link: [View job run](${jobUrl}) +- Follow the repo's CLAUDE.md file for project-specific guidelines`; + + return promptContent; +} + /** * Generates the default prompt for tag mode * @internal @@ -468,6 +585,10 @@ export function generateDefaultPrompt( githubData: FetchDataResult, useCommitSigning: boolean = false, ): string { + // Use simplified prompt if opted in + if (process.env.USE_SIMPLE_PROMPT === "true") { + return generateSimplePrompt(context, githubData, useCommitSigning); + } const { contextData, comments,