> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 每周 Knowledge 去重和清理

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="每周 Knowledge 去重与清理" description="安排一次周一的 Devin 会话，用于梳理新的建议、合并重复条目并解决相互冲突的指导——在无需人工干预的情况下，让你的知识库持续保持准确。" prompt="审查过去一周内的所有 Knowledge 建议。合并重复项，解决条目之间的冲突，丢弃已过时的建议，并将真正新增的建议纳入 Knowledge，并为其补充清晰的触发条件说明。然后扫描现有 Knowledge，查找引用已弃用模式的条目。" category="Devin 优化" features="计划, 高级" type="schedule" agent="advanced" />

<div className="uc-detail-wrapper">
  <Tip>不想手动设置？将此页面的链接粘贴到 Devin 会话中，并让它为你完成所有设置。</Tip>

  <Steps>
    <Step title="编写周一清理提示词">
      在你的团队一周内与 Devin 协作的过程中，[knowledge suggestions](/zh/product-guides/knowledge) 会在每次会话中持续累积——Devin 学到的模式、有效的命令、它发现的约定等。到了周五，你可能已经有十来条新建议在等着处理，而已有条目中有些则引用了已重命名的文件或已弃用的 API。可以在每周一早上固定安排一次 Devin 会话，在团队正式开始这一周之前处理完所有这些内容。

      你的提示应当涵盖两项工作：对上周的建议进行分类处理，以及对已有条目进行去重。下面是一个能同时完成这两项工作的提示示例：

      <PromptBlock type="schedule" agent="advanced">
        ```txt Monday knowledge deduplication and cleanup theme={null}
        Review and maintain our knowledge base:

        1. Triage pending suggestions from the past week:
           - If new and useful, propose a knowledge entry with a specific trigger description
           - If it overlaps with an existing entry, propose merging into the existing one
           - If outdated or too vague, propose dismissing it
        2. Deduplicate and resolve conflicts in existing entries:
           - Find entries covering the same topic (e.g., two entries about Docker build steps) and propose consolidating into one
           - Identify entries giving contradictory advice (e.g., different pool sizes) and propose a resolution based on recency
           - Flag entries referencing old file paths, deprecated APIs, or removed packages
        ```
      </PromptBlock>

      若要在每次运行结束时收到通知，为该计划配置一个 **Slack 频道**——Devin 会将建议变更的摘要发布到那里，这样你的团队无需打开会话就可以进行审阅。
    </Step>

    <Step title="创建周一上午 8 点的日程">
      你需要一个[计划会话](/zh/product-guides/scheduled-sessions)，这样 Devin 才能使用知识管理工具。

      1. 在 [app.devin.ai](https://app.devin.ai/?utm_source=docs\&utm_medium=use-case-gallery) 左侧侧边栏中进入 **Schedules**，或在首页输入框的上下文菜单里使用 **Schedule Devin** 选项
      2. 点击 **Create schedule**，将频率设置为你团队所在时区的 **Weekly — every Monday at 8:00 AM** (每周——每周一上午 8 点) ，这样在新一周开始前就有整整一周的建议可供处理
      3. 粘贴你的周一清理提示词
      4. 如有需要，可附加一个[playbook](/zh/product-guides/creating-playbooks)，用于规范 Devin 如何格式化新条目或组织 Knowledge 文件夹

      每次计划运行开始和结束时，Devin 都会发送电子邮件通知。如果你的团队使用了 [Slack integration](/zh/integrations/slack)，Devin 还会直接将摘要发送到你的频道。要了解更多排程选项，请参阅 [Scheduled Sessions guide](/zh/product-guides/scheduled-sessions)。
    </Step>

    <Step title="审查并批准第一次周一运行">
      在第一次周一运行完成后，打开该会话来查看 Devin 的建议。**Devin 不会自动应用 Knowledge 变更** —— 它会给出创建、合并和删除的建议，你需要手动批准或拒绝每一项。一个典型的摘要如下所示：

      ```
      Knowledge 去重与清理 — 周一，2月10日

      建议新增条目（3条）：
        - "Run prisma migrate deploy before integration tests" — 来自会话 #4821
        - "Redis cache TTL for user profiles is 5 minutes" — 来自会话 #4835
        - "Use vitest, not jest, for frontend unit tests" — 来自会话 #4802

      建议合并（2条）：
        - 合并 "Docker build steps" + "Container build process" → 单条条目
        - 合并两条关于 API 错误处理规范的重叠条目

      建议删除（1条）：
        - "Bundle with webpack" — 项目已于12月迁移至 Vite

      建议忽略（4条建议）：
        - 已被现有 Knowledge 覆盖

      冲突解决（1条）：
        - 两条条目对连接池大小存在分歧（5 vs 10）
        - 根据更近期的性能调优会话，建议采用 pool_size=10
      ```

      在会话中审查每条建议，并选择批准或拒绝。将前几次运行用于校准——如果 Devin 在建议删除时过于激进，在你的提示中添加一条备注：*"如有不确定，保留该条目并标记为待审查，而不是提出删除建议。"*
    </Step>

    <Step title="通过每月审计获得更深入的洞察">
      当你的每周一清理流程已经稳定运行后，每隔一两个月在一次性的 Devin 会话中使用这些提示词，进行更深入的维护：

      <PromptBlock agent="advanced">
        ```txt 每月知识陈旧性审查 theme={null}
        将每条知识条目与当前已连接代码库的实际状态进行交叉核对。
        标记所有引用了已重命名文件、已删除包、已弃用 API 或过时约定的条目。
        对于每条陈旧条目，基于代码库当前实际行为，给出一版更新后的内容建议。
        ```
      </PromptBlock>

      <PromptBlock agent="advanced">
        ```txt 按文件夹重组知识 theme={null}
        将知识库按文件夹重组为："Backend"、"Frontend"、
        "DevOps"、"Testing"、"API Design"。把现有条目移动到
        正确的文件夹中，并将触发器描述更新得更具体。
        ```
      </PromptBlock>

      \*\*提示：\*\*每周一的例行任务负责持续去重和建议的筛选分拣。这些更深入的审查——覆盖范围缺口分析和文件夹重组——属于一次性任务，建议每隔一两个月手动执行一次。
    </Step>
  </Steps>
</div>
