Agent 提示词:会话记忆更新指令
Agent Prompt: Session memory update instructions
v2.0.58Instructions for updating session memory files during conversations
模板变量 / Template Variables
MAX_SECTION_TOKENS
重要提示:此消息及这些指令并非实际用户对话的一部分。请勿在笔记内容中包含任何关于"记笔记"、"会话笔记提取"或这些更新指令的引用。
根据上述用户对话(排除此记笔记指令消息以及系统提示、claude.md条目或任何过往会话摘要),更新会话笔记文件。
文件 已为您读取。以下是其当前内容: <current_notes_content> </current_notes_content>
您的唯一任务是使用 Edit 工具更新笔记文件,然后停止。您可以进行多次编辑(根据需要更新每个部分)——在单条消息中并行调用所有 Edit 工具。请勿调用任何其他工具。
编辑的关键规则:
- 文件必须保持其精确结构,所有部分、标题和斜体描述均需完整保留 -- 切勿修改、删除或添加部分标题(以'#'开头的行,如 # 任务规范) -- 切勿修改或删除斜体 部分描述 行(这些是紧接每个标题后的斜体行——以斜体开始和结束) -- 斜体 部分描述 是必须完全按原样保留的模板指令——它们指导每个部分应包含的内容 -- 仅更新每个现有部分中斜体 部分描述 下方出现的实际内容 -- 请勿在现有结构之外添加任何新部分、摘要或信息
- 请勿在笔记中的任何地方引用此记笔记过程或指令
- 如果没有实质性的新见解需要添加,可以跳过更新某个部分。不要添加"尚无信息"之类的填充内容,如果合适的话,只需让部分保持空白/未编辑状态
- 为每个部分编写详细、信息密集的内容——包括具体细节,如文件路径、函数名称、错误消息、确切命令、技术细节等
- 对于"关键结果",请包含用户请求的完整、确切的输出(例如,完整表格、完整答案等)
- 请勿包含已存在于上下文中的 CLAUDE.md 文件中的信息
- 将每个部分控制在约 ${MAX_SECTION_TOKENS} 个词元/单词以内——如果某个部分接近此限制,请通过循环淘汰较不重要的细节来压缩内容,同时保留最关键的信息
- 重点关注可操作的、具体的信息,这些信息应有助于理解或重现对话中讨论的工作
- 重要提示:始终更新"当前状态"以反映最近的工作——这对于压缩后的连续性至关重要
使用 Edit 工具,参数为 file_path:
结构保留提醒: 每个部分都有两个必须完全按当前文件中的原样保留的组成部分:
- 部分标题(以 # 开头的行)
- 斜体描述行(紧接标题后的 斜体文本——这是模板指令)
您仅更新这两个保留行之后出现的实际内容。以斜体开始和结束的斜体描述行是模板结构的一部分,不是要编辑或删除的内容。
记住:并行使用 Edit 工具然后停止。编辑后不要继续。仅包含来自实际用户对话的见解,切勿来自这些记笔记指令。请勿删除或更改部分标题或斜体 部分描述。
英文原文 / English Original
IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "note-taking", "session notes extraction", or these update instructions in the notes content.
Based on the user conversation above (EXCLUDING this note-taking instruction message as well as system prompt, claude.md entries, or any past session summaries), update the session notes file.
The file has already been read for you. Here are its current contents: <current_notes_content> </current_notes_content>
Your ONLY task is to use the Edit tool to update the notes file, then stop. You can make multiple edits (update every section as needed) - make all Edit tool calls in parallel in a single message. Do not call any other tools.
CRITICAL RULES FOR EDITING:
- The file must maintain its exact structure with all sections, headers, and italic descriptions intact -- NEVER modify, delete, or add section headers (the lines starting with '#' like # Task specification) -- NEVER modify or delete the italic section description lines (these are the lines in italics immediately following each header - they start and end with underscores) -- The italic section descriptions are TEMPLATE INSTRUCTIONS that must be preserved exactly as-is - they guide what content belongs in each section -- ONLY update the actual content that appears BELOW the italic section descriptions within each existing section -- Do NOT add any new sections, summaries, or information outside the existing structure
- Do NOT reference this note-taking process or instructions anywhere in the notes
- It's OK to skip updating a section if there are no substantial new insights to add. Do not add filler content like "No info yet", just leave sections blank/unedited if appropriate.
- Write DETAILED, INFO-DENSE content for each section - include specifics like file paths, function names, error messages, exact commands, technical details, etc.
- For "Key results", include the complete, exact output the user requested (e.g., full table, full answer, etc.)
- Do not include information that's already in the CLAUDE.md files included in the context
- Keep each section under ~${MAX_SECTION_TOKENS} tokens/words - if a section is approaching this limit, condense it by cycling out less important details while preserving the most critical information
- Focus on actionable, specific information that would help someone understand or recreate the work discussed in the conversation
- IMPORTANT: Always update "Current State" to reflect the most recent work - this is critical for continuity after compaction
Use the Edit tool with file_path:
STRUCTURE PRESERVATION REMINDER: Each section has TWO parts that must be preserved exactly as they appear in the current file:
- The section header (line starting with #)
- The italic description line (the italicized text immediately after the header - this is a template instruction)
You ONLY update the actual content that comes AFTER these two preserved lines. The italic description lines starting and ending with underscores are part of the template structure, NOT content to be edited or removed.
REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edits. Only include insights from the actual user conversation, never from these note-taking instructions. Do not delete or change section headers or italic section descriptions.