compound-knowledge

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Compound knowledge

知识沉淀

Capture a solved problem as searchable documentation so nobody solves it twice. Adapted from EveryInc's compound-engineering plugin (https://github.com/EveryInc/compound-engineering-plugin).
Problem to document: $ARGUMENTS
If that is empty, document the most recently solved problem in this conversation. If nothing was actually fixed and verified, stop and say so; do not document a guess.
Exactly ONE file gets written: the final solution doc. Subagents return text only.
将已解决的问题记录为可搜索的文档,避免任何人重复解决同一问题。改编自 EveryInc 的 compound-engineering plugin(https://github.com/EveryInc/compound-engineering-plugin)。
要记录的问题:$ARGUMENTS
如果为空,则记录当前对话中最近解决的一个问题。如果实际上没有修复并验证任何内容,请停止并说明;不要记录猜测。
只会写入一个文件:最终解决方案文档。 Subagent 仅返回文本。

Convention (per project)

项目约定

docs/solutions/
at the project root is the knowledge store. insistir's learnings researcher greps it during planning, so keep paths, frontmatter and tags exactly as below.
Categories (subdirectories of
docs/solutions/
):
  • build-errors
  • test-failures
  • runtime-errors
  • performance-issues
  • database-issues
  • security-issues
  • ui-bugs
  • integration-issues
  • logic-errors
Filename:
docs/solutions/<category>/YYYY-MM-DD-<kebab-description>.md
Example:
docs/solutions/runtime-errors/2026-02-13-null-pointer-in-auth-middleware.md
File format: references/solution-template.md.
项目根目录下的
docs/solutions/
是知识库。insist 的 learnings researcher 会在规划期间使用 grep 检索该目录,因此请严格保持下列路径、frontmatter 和 tags 格式。
类别(
docs/solutions/
的子目录):
  • build-errors
  • test-failures
  • runtime-errors
  • performance-issues
  • database-issues
  • security-issues
  • ui-bugs
  • integration-issues
  • logic-errors
文件名:
docs/solutions/<category>/YYYY-MM-DD-<kebab-description>.md
示例:
docs/solutions/runtime-errors/2026-02-13-null-pointer-in-auth-middleware.md
文件格式:references/solution-template.md。

Phase 1: parallel gathering (3 read-only subagents)

阶段 1:并行收集(3 个只读 subagent)

Spawn the three in one message so they run in parallel (Claude Code: Agent tool, general-purpose type). Give each the problem summary, the relevant conversation excerpts (error messages, commands, diffs) and the files touched; they have no conversation history. Each returns structured text and writes nothing. No subagent support in this harness: do the three analyses yourself, in order.
在一条消息中同时启动这三个 subagent,使其并行运行(Claude Code:Agent 工具,general-purpose 类型)。向每个 subagent 提供问题摘要、相关对话片段(错误消息、命令、diff)以及涉及的文件;它们没有对话历史。每个 subagent 返回结构化文本,不写入任何内容。此 harness 不支持 subagent:改为依次自行完成这三项分析。

1a. Context analyzer

1a. 上下文分析器

Extract from the conversation and codebase:
  • Problem type: best-fitting category from the list above
  • Affected area: files, modules, systems
  • Severity: low / medium / high / critical
  • How detected: test failure, user report, monitoring alert, etc.
  • Impact: what was broken or degraded
从对话和代码库中提取:
  • 问题类型:上述列表中最匹配的类别
  • 受影响区域:文件、模块、系统
  • 严重程度:low / medium / high / critical
  • 检测方式:测试失败、用户报告、监控告警等
  • 影响:出现了哪些故障或功能退化

1b. Solution extractor

1b. 解决方案提取器

Extract from the conversation and code changes:
  • Root cause: why it happened (1-2 paragraphs)
  • Code references: files and lines involved
  • What fixed it: the actual changes (before/after snippets)
  • Key insight: the non-obvious realization that led to the fix
从对话和代码变更中提取:
  • 根因:问题发生的原因(1~2 个段落)
  • 代码引用:涉及的文件和行号
  • 修复内容:实际所做的变更(修改前/后的代码片段)
  • 关键洞察:促成修复的非显而易见认识

1c. Prevention strategist

1c. 预防策略师

Determine from the problem and solution:
  • Prevent recurrence: practices, checks, guards
  • Tests to add: cases that would catch it next time
  • Monitoring: alerts or checks that should exist
  • Related patterns: similar problems that may exist elsewhere
根据问题和解决方案确定:
  • 防止再次发生:实践、检查项和保护措施
  • 需要添加的测试:下次能够捕获该问题的测试用例
  • 监控:应设置的告警或检查
  • 相关模式:代码库中可能存在的类似问题

Phase 2: assembly (you, sequential)

阶段 2:组装(由你顺序执行)

  1. Read references/solution-template.md.
  2. Take the category from the context analyzer. Ambiguous between two categories → ask the user.
  3. Grep
    docs/solutions/
    for the key error string and symptom. A doc with the same root cause exists → update that file (refine sections, add to Related) instead of creating a duplicate.
  4. Otherwise name the file
    YYYY-MM-DD-<kebab-description>.md
    with today's date and create
    docs/solutions/<category>/
    if missing.
  5. Write the single file: every frontmatter field and every section filled from the subagent outputs. Tags carry the searchable keywords (error names, libraries, symptoms).
    status: draft
    unless the fix was verified by a test or reproduction in this session, then
    validated
    .
This is the only file write in the skill.
  1. 阅读 references/solution-template.md。
  2. 采用上下文分析器给出的类别。如果在两个类别之间存在歧义,则询问用户。
  3. 使用 grep 在
    docs/solutions/
    中检索关键错误字符串和症状。如果已有根因相同的文档,则更新该文件(完善相关章节并将其添加到 Related),而不是创建重复文档。
  4. 否则,使用今天的日期将文件命名为
    YYYY-MM-DD-<kebab-description>.md
    ,并在缺失时创建
    docs/solutions/<category>/
    。
  5. 写入唯一的文件:根据 subagent 输出填写每个 frontmatter 字段和每个章节。Tags 应包含可搜索关键词(错误名称、库、症状)。除非本次会话已通过测试或复现验证修复,否则使用
    status: draft
    ;验证通过则使用
    validated
    。
这是该 skill 中唯一一次文件写入。

Phase 3: optional follow-up

阶段 3:可选的后续操作

After writing, offer one follow-up by category and proceed only if the user confirms:
  • security-issues
    : check whether the fix needs broader application.
  • performance-issues
    : verify the improvement with a benchmark.
  • build-errors
    /
    test-failures
    : run the test suite to confirm the fix holds.
  • Other categories: search the codebase for the same pattern elsewhere.
写入后,根据类别提供一项后续操作,并且仅在用户确认后执行:
  • security-issues
    :检查该修复是否需要更广泛地应用。
  • performance-issues
    :使用 benchmark 验证改进效果。
  • build-errors
    /
    test-failures
    :运行测试套件,确认修复仍然有效。
  • 其他类别:在代码库中搜索其他地方是否存在相同模式。

Rules

规则

  • Subagents return TEXT only; they never write files.
  • One file per solved problem, always in the template format.
  • Ground every claim in the conversation or the code; mark anything unverified as such in the doc.
  • No secrets, tokens or personal data in the doc: redact them from logs and snippets.
  • Subagent 仅返回文本,绝不写入文件。
  • 每个已解决问题只对应一个文件,并且始终使用模板格式。
  • 每项结论都必须以对话或代码为依据;对于未经验证的内容,请在文档中明确标注。
  • 文档中不得包含 secret、token 或个人数据:从日志和代码片段中将其脱敏。