smart-loader
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSmart Context Loader
智能上下文加载器
When a user starts a new task or asks to work on something, check if there are historical patterns that suggest which files they'll need.
当用户开始新任务或要求处理某项工作时,检查是否存在能表明他们需要哪些文件的历史模式。
When to Activate
激活时机
- User describes a new task (bug fix, feature, refactor, review)
- User says "let's work on..." or "I need to fix..."
- Session just started and user is describing what they want to do
- User asks "what files do I need for this?"
- 用户描述新任务(bug修复、功能开发、重构、评审)
- 用户说“我们来处理……”或“我需要修复……”
- 会话刚启动,用户正在描述他们想要做的事情
- 用户询问“我做这个需要哪些文件?”
How to Use
使用方法
- Check for existing templates matching the task type:
bash
ls ~/.claude-context-optimizer/templates/ 2>/dev/null- Check historical patterns for the current directory:
bash
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js suggest "$(pwd)"- Based on the task description and historical data:
- If a matching template exists, mention it: "I see you have a '{name}' template. Want me to load that context?"
- If historical patterns suggest files, mention: "Based on previous sessions, you usually need these files for this type of task: ..."
- If patterns show files to avoid, mention: "Tip: [file] has been consistently unused in past sessions — I'll skip it."
- If nothing matches, proceed normally
- 检查是否存在匹配任务类型的现有模板:
bash
ls ~/.claude-context-optimizer/templates/ 2>/dev/null- 检查当前目录的历史模式:
bash
node ${CLAUDE_PLUGIN_ROOT}/src/tracker.js suggest "$(pwd)"- 根据任务描述和历史数据:
- 如果存在匹配的模板,告知用户:“我看到你有一个'{name}'模板。需要我加载这个上下文吗?”
- 如果历史模式提示了相关文件,告知用户:“根据之前的会话记录,处理这类任务你通常需要这些文件:……”
- 如果模式显示某些文件应避免,告知用户:“提示:[file]在过往会话中一直未被使用——我会跳过它。”
- 如果没有匹配项,正常进行
Auto-Optimization Tips
自动优化提示
When you detect patterns that waste tokens, proactively suggest improvements:
- If a large file (300+ lines) is being read fully: "I'll use offset/limit to read only the relevant section"
- If a file was wasted in 2+ past sessions: skip it silently or mention why
- If the user's task matches a known template: offer to apply it
当你检测到会浪费令牌的模式时,主动建议改进:
- 如果正在完整读取大文件(300行以上):“我会使用offset/limit仅读取相关部分”
- 如果某个文件在2次以上的过往会话中被浪费:静默跳过或说明原因
- 如果用户的任务匹配已知模板:主动提出应用该模板
Important
注意事项
- Do NOT automatically read files without user confirmation
- Only SUGGEST, don't force context loading
- Keep suggestions brief (top 3-5 files max)
- If no tracking data exists yet, skip silently — don't mention the optimizer
- Be helpful, not annoying — max 1 suggestion per task start
- 未经用户确认,请勿自动读取文件
- 仅提供建议,不要强制加载上下文
- 建议要简洁(最多列出3-5个核心文件)
- 如果尚无跟踪数据,静默跳过——不要提及优化器
- 提供帮助而非造成干扰——每个任务启动最多提供1次建议