Documentation
¶
Index ¶
- Constants
- func FormatCompactSummary(summary string) string
- func GetCompactPrompt(customInstructions string) string
- func GetCompactUserSummaryMessage(summary string, suppressFollowUp bool, transcriptPath string, ...) string
- func GetPartialCompactPrompt(customInstructions string, direction PartialCompactDirection) string
- type PartialCompactDirection
Constants ¶
View Source
const BASE_COMPACT_PROMPT = `Your task is to create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions. This summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing development work without losing context. ` + DETAILED_ANALYSIS_INSTRUCTION_BASE + ` Your summary should include the following sections: 1. Primary Request and Intent: Capture all of the user's explicit requests and intents in detail 2. Key Technical Concepts: List all important technical concepts, technologies, and frameworks discussed. 3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Pay special attention to the most recent messages and include full code snippets where applicable and include a summary of why this file read or edit is important. 4. Errors and fixes: List all errors that you ran into, and how you fixed them. Pay special attention to specific user feedback that you received, especially if the user told you to do something differently. 5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts. 6. All user messages: List ALL user messages that are not tool results. These are critical for understanding the users' feedback and changing intent. 7. Pending Tasks: Outline any pending tasks that you have explicitly been asked to work on. 8. Current Work: Describe in detail precisely what was being worked on immediately before this summary request, paying special attention to the most recent messages from both user and assistant. Include file names and code snippets where applicable. 9. Optional Next Step: List the next step that you will take that is related to the most recent work you were doing. IMPORTANT: ensure that this step is DIRECTLY in line with the user's most recent explicit requests, and the task you were working on immediately before this summary request. If your last task was concluded, then only list next steps if they are explicitly in line with the users request. Do not start on tangential requests or really old requests that were already completed without confirming with the user first. If there is a next step, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no drift in task interpretation. Here's an example of how your output should be structured: <example> <analysis> [Your thought process, ensuring all points are covered thoroughly and accurately] </analysis> <summary> 1. Primary Request and Intent: [Detailed description] 2. Key Technical Concepts: - [Concept 1] - [Concept 2] - [...] 3. Files and Code Sections: - [File Name 1] - [Summary of why this file is important] - [Summary of the changes made to this file, if any] - [Important Code Snippet] - [File Name 2] - [Important Code Snippet] - [...] 4. Errors and fixes: - [Detailed description of error 1]: - [How you fixed the error] - [User feedback on the error if any] - [...] 5. Problem Solving: [Description of solved problems and ongoing troubleshooting] 6. All user messages: - [Detailed non tool use user message] - [...] 7. Pending Tasks: - [Task 1] - [Task 2] - [...] 8. Current Work: [Precise description of current work] 9. Optional Next Step: [Optional Next step to take] </summary> </example> Please provide your summary based on the conversation so far, following this structure and ensuring precision and thoroughness in your response. There may be additional summarization instructions provided in the included context. If so, remember to follow these instructions when creating the above summary. Examples of instructions include: <example> ## Compact Instructions When summarizing the conversation focus on typescript code changes and also remember the mistakes you made and how to fixed them. </example> <example> # Summary instructions When you are using compact - please focus on test output and code changes. Include file reads verbatim. </example> `
BASE_COMPACT_PROMPT 完整压缩提示词
View Source
const DETAILED_ANALYSIS_INSTRUCTION_BASE = `` /* 847-byte string literal not displayed */
DETAILED_ANALYSIS_INSTRUCTION 分析指令
View Source
const DETAILED_ANALYSIS_INSTRUCTION_PARTIAL = `` /* 822-byte string literal not displayed */
View Source
const NO_TOOLS_PREAMBLE = `` /* 381-byte string literal not displayed */
NO_TOOLS_PREAMBLE 禁止工具调用的前缀
View Source
const NO_TOOLS_TRAILER = `` /* 173-byte string literal not displayed */
NO_TOOLS_TRAILER 结尾提醒
View Source
const PARTIAL_COMPACT_PROMPT = `Your task is to create a detailed summary of the RECENT portion of the conversation — the messages that follow earlier retained context. The earlier messages are being kept intact and do NOT need to be summarized. Focus your summary on what was discussed, learned, and accomplished in the recent messages only. ` + DETAILED_ANALYSIS_INSTRUCTION_PARTIAL + ` Your summary should include the following sections: 1. Primary Request and Intent: Capture the user's explicit requests and intents from the recent messages 2. Key Technical Concepts: List important technical concepts, technologies, and frameworks discussed recently. 3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Include full code snippets where applicable and include a summary of why this file read or edit is important. 4. Errors and fixes: List errors encountered and how they were fixed. 5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts. 6. All user messages: List ALL user messages from the recent portion that are not tool results. 7. Pending Tasks: Outline any pending tasks from the recent messages. 8. Current Work: Describe precisely what was being worked on immediately before this summary request. 9. Optional Next Step: List the next step related to the most recent work. Include direct quotes from the most recent conversation. Here's an example of how your output should be structured: <example> <analysis> [Your thought process, ensuring all points are covered thoroughly and accurately] </analysis> <summary> 1. Primary Request and Intent: [Detailed description] 2. Key Technical Concepts: - [Concept 1] - [Concept 2] 3. Files and Code Sections: - [File Name 1] - [Summary of why this file is important] - [Important Code Snippet] 4. Errors and fixes: - [Error description]: - [How you fixed it] 5. Problem Solving: [Description] 6. All user messages: - [Detailed non tool use user message] 7. Pending Tasks: - [Task 1] 8. Current Work: [Precise description of current work] 9. Optional Next Step: [Optional Next step to take] </summary> </example> Please provide your summary based on the RECENT messages only (after the retained earlier context), following this structure and ensuring precision and thoroughness in your response. `
PARTIAL_COMPACT_PROMPT 部分压缩提示词(总结最近消息)
View Source
const PARTIAL_COMPACT_UP_TO_PROMPT = `Your task is to create a detailed summary of this conversation. This summary will be placed at the start of a continuing session; newer messages that build on this context will follow after your summary (you do not see them here). Summarize thoroughly so that someone reading only your summary and then the newer messages can fully understand what happened and continue the work. ` + DETAILED_ANALYSIS_INSTRUCTION_BASE + ` Your summary should include the following sections: 1. Primary Request and Intent: Capture the user's explicit requests and intents in detail 2. Key Technical Concepts: List important technical concepts, technologies, and frameworks discussed. 3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Include full code snippets where applicable and include a summary of why this file read or edit is important. 4. Errors and fixes: List errors encountered and how they were fixed. 5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts. 6. All user messages: List ALL user messages that are not tool results. 7. Pending Tasks: Outline any pending tasks. 8. Work Completed: Describe what was accomplished by the end of this portion. 9. Context for Continuing Work: Summarize any context, decisions, or state that would be needed to understand and continue the work in subsequent messages. Here's an example of how your output should be structured: <example> <analysis> [Your thought process, ensuring all points are covered thoroughly and accurately] </analysis> <summary> 1. Primary Request and Intent: [Detailed description] 2. Key Technical Concepts: - [Concept 1] - [Concept 2] 3. Files and Code Sections: - [File Name 1] - [Summary of why this file is important] - [Important Code Snippet] 4. Errors and fixes: - [Error description]: - [How you fixed it] 5. Problem Solving: [Description] 6. All user messages: - [Detailed non tool use user message] 7. Pending Tasks: - [Task 1] 8. Work Completed: [Description of what was accomplished] 9. Context for Continuing Work: [Key context, decisions, or state needed to continue the work] </summary> </example> Please provide your summary following this structure, ensuring precision and thoroughness in your response. `
PARTIAL_COMPACT_UP_TO_PROMPT 部分压缩提示词(总结到指定点)
Variables ¶
This section is empty.
Functions ¶
func FormatCompactSummary ¶
FormatCompactSummary 格式化 LLM 输出的摘要 参考: src/services/compact/prompt.ts:311-335
func GetCompactPrompt ¶
GetCompactPrompt 获取完整压缩提示词
func GetCompactUserSummaryMessage ¶
func GetCompactUserSummaryMessage(summary string, suppressFollowUp bool, transcriptPath string, recentMessagesPreserved bool) string
GetCompactUserSummaryMessage 构建压缩后的摘要消息 参考: src/services/compact/prompt.ts:337-374
func GetPartialCompactPrompt ¶
func GetPartialCompactPrompt(customInstructions string, direction PartialCompactDirection) string
GetPartialCompactPrompt 获取部分压缩提示词
Types ¶
type PartialCompactDirection ¶
type PartialCompactDirection string
PartialCompactDirection 部分压缩方向
const ( PartialCompactDirectionFrom PartialCompactDirection = "from" // 从早期保留点到最近 PartialCompactDirectionUpTo PartialCompactDirection = "up_to" // 从开始到指定点 )
Click to show internal directories.
Click to hide internal directories.