tribal-knowledge
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTribal Knowledge
部落知识库(Tribal Knowledge)
~/tk~/tkWhat belongs here
收录范围
- Tool behavior and pitfalls: misleading flags, version quirks, confusing output.
- How repos and services connect: who calls whom, where config lives, shared contracts.
- Environment facts: how to reach logs, clusters, CI, dashboards.
- Repo internals learned by tracing code.
Not here: user preferences, anything a quick read of the code or README answers, one incident's verdict (that is a record, see below), and secrets of any kind.
- 工具行为与陷阱:具有误导性的命令行选项、版本特殊特性、令人困惑的输出。
- 代码仓库与服务的关联关系:调用链路、配置存放位置、共享契约。
- 环境相关事实:日志、集群、CI、仪表盘的访问方式。
- 通过代码追踪学到的仓库内部原理。
不收录内容:用户偏好、任何通读代码或README就能得到答案的内容、单次事件的结论(属于记录,见下文)、以及任何类型的机密信息。
Layout
目录结构
~/tk/
tools/
rtk.md
workspace1/
repo1.md
repo1/
conf.md
history/
checkout-timeout-2026-09-21.md- One note per thing (a tool, repo, service, or workspace), named after it: its real identifier when it has one (), kebab-case otherwise.
order_sync_worker.md - When a thing needs several notes, its parts go in a directory of the same name next to its note (and
repo1.md).repo1/ - Create directories as needed, reusing existing ones first. Add a subdirectory once a directory passes ~15 notes or 3+ notes share a theme.
- Split, merge, or move notes whenever the tree stops fitting the knowledge. Move with and fix inbound links in the same commit.
git mv
~/tk/
tools/
rtk.md
workspace1/
repo1.md
repo1/
conf.md
history/
checkout-timeout-2026-09-21.md- 每个对象(工具、仓库、服务或工作区)对应一篇笔记,以对象命名:如果有正式标识符就用正式标识符(如 ),否则用短横线命名法(kebab-case)。
order_sync_worker.md - 如果一个对象需要多篇笔记,相关内容放在笔记旁同名的目录中(如 和
repo1.md)。repo1/ - 根据需要创建目录,优先复用已有目录。当一个目录下的笔记超过约15篇,或有3篇及以上笔记属于同一主题时,添加子目录。
- 当目录树不再适配知识结构时,随时拆分、合并或移动笔记。使用 移动笔记,并在同一次提交中修复入站链接。
git mv
Note format
笔记格式
markdown
---
keywords: [rtk, proxy, token-saving, truncated-output]
index: when rtk output looks truncated. how rtk condenses output and how to get raw output via rtk proxy.
votes: [+2026-10-03, -2026-09-20]
---
Free-form body. Terse, pitfalls first. See also [kubectl](kubectl.md).- Frontmatter is exactly these three single-line fields in this order, so search stays line-based.
- : what someone would search to find this note. Exact identifiers verbatim with case kept (binary, repo, service, table and command names, env vars, error strings). Aliases and plain concepts in lowercase kebab-case. No commas inside a keyword. A generic platform word only when the note is mainly about that platform.
keywords - : one line telling a reader whether the note has what they need, in the form "when to open it. what it holds."
index - Back every claim with evidence the next reader can re-check: file path and symbol (cite code as ), command, tool version, or URL.
<repo>:<path> - Link related notes with relative markdown links. The pre-commit hook rejects links that do not resolve.
- Consider splitting a note past ~300 lines.
markdown
---
keywords: [rtk, proxy, token-saving, truncated-output]
index: when rtk output looks truncated. how rtk condenses output and how to get raw output via rtk proxy.
votes: [+2026-10-03, -2026-09-20]
---
Free-form body. Terse, pitfalls first. See also [kubectl](kubectl.md).- frontmatter 必须严格包含以下三个单行字段,且顺序保持不变,以支持基于行的搜索。
- :用户搜索该笔记时可能用到的关键词。精确标识符需原样保留大小写(二进制文件、仓库、服务、表与命令名称、环境变量、错误字符串)。别名和通用概念使用小写短横线命名法(kebab-case)。关键词内部不能包含逗号。仅当笔记主要围绕某个平台时,才添加通用平台词。
keywords - :用一行内容告诉读者这篇笔记是否包含他们需要的信息,格式为「何时打开它 + 包含什么内容」。
index - 每个结论都要有可供后续读者复现验证的依据:文件路径与符号(代码引用格式为 )、命令、工具版本或URL。
<repo>:<path> - 使用相对 Markdown 链接关联相关笔记。pre-commit 钩子会拒绝无法解析的链接。
- 当笔记超过约300行时,考虑拆分。
Records
记录
A record captures one investigation or incident and is true for its date only. Write one only when the user asks.
- Name it , usually under
<topic>-YYYY-MM-DD.md.<workspace>/history/ - Same frontmatter, with for good. Records are never re-verified, so the hook rejects votes on them.
votes: [] - Lasting facts learned along the way also go into regular notes.
记录用于存档单次调查或事件,仅对其发生当日有效。仅在用户要求时编写记录。
- 命名格式为 ,通常存放在
<topic>-YYYY-MM-DD.md目录下。<workspace>/history/ - 使用相同的 frontmatter,字段设为
votes即可。记录永远不会被重新验证,因此钩子会拒绝记录中的投票内容。[] - 过程中学到的具有长期价值的事实,也需要写入常规笔记中。
Searching
搜索方法
Narrow by keywords, then judge candidates by their and lines before opening any note:
indexvotessh
rg -i -A2 '^keywords:.*\b(rtk|proxy)\b' ~/tk\bsyncorder_sync_workerWhen keywords miss, search full text but print only each matching note's line:
indexsh
rg -il 'connection reset' ~/tk | xargs -r rg -H -m1 '^index:'- prints in walk order, not relevance, so
rgdrops arbitrary notes.| head - Records match too. Add to skip them.
-g '!*-20[0-9][0-9]-[0-9][0-9]-[0-9][0-9].md'
先通过关键词缩小范围,然后在打开任何笔记之前,通过 和 行判断候选笔记是否符合需求:
indexvotessh
rg -i -A2 '^keywords:.*\b(rtk|proxy)\b' ~/tk\bsyncorder_sync_worker如果关键词搜索没有结果,可以进行全文搜索,但仅打印每个匹配笔记的 行:
indexsh
rg -il 'connection reset' ~/tk | xargs -r rg -H -m1 '^index:'- 按目录遍历顺序输出结果,而非相关度排序,因此
rg会随机丢弃部分笔记。| head - 记录也会被匹配到。添加 参数可以跳过记录。
-g '!*-20[0-9][0-9]-[0-9][0-9]-[0-9][0-9].md'
Votes
投票机制
votes+YYYY-MM-DD-YYYY-MM-DD- The evidence holds: prepend .
+today - The note is wrong and you know the truth: fix it, drop any related line, and reset votes to
DISPUTED.[+today] - The note looks wrong but the truth is unclear: prepend and add
-todaynext to the claim.> DISPUTED YYYY-MM-DD: <reason> - A new note starts at .
[+today]
votes+YYYY-MM-DD-YYYY-MM-DD- 依据成立:在开头添加 。
+today - 笔记有误且你知道正确内容:修正笔记,删除所有相关的 行,并将 votes 重置为
DISPUTED。[+today] - 笔记看起来有误但正确内容尚不明确:在开头添加 ,并在该结论旁添加
-today。> DISPUTED YYYY-MM-DD: <原因> - 新笔记的初始 votes 为 。
[+today]
Writing
编写规范
- Write as soon as you learn something, not at the end of the task. Before your final answer, make sure every note you relied on got its vote and every finding got recorded.
- Search first and update an existing note rather than adding a duplicate.
- When you add to a note, extend its and
keywordsto cover the addition. Ifindexno longer fits on one line, split the note.index - When a search missed a note that turned out relevant, add the missed terms to its .
keywords - If does not exist, ask the user to run the setup script from https://github.com/wxiaoyun/skills.
~/tk
- 学到新内容后立即记录,不要等到任务结束。在最终答复之前,确保你依赖的每篇笔记都已投票,所有发现都已记录。
- 先搜索,优先更新已有笔记而非添加重复内容。
- 当你向笔记添加内容时,扩展其 和
keywords以覆盖新增内容。如果index无法在一行内容纳,拆分该笔记。index - 如果某次搜索漏掉了一篇实际相关的笔记,将漏掉的关键词添加到该笔记的 中。
keywords - 如果 不存在,让用户运行 https://github.com/wxiaoyun/skills 中的安装脚本。
~/tk
Saving
保存方式
After each change, commit, and if a remote exists, rebase onto it and push. The run id is the first 8 characters of , or .
$CLAUDE_CODE_SESSION_ID$PI_SESSION_ID$CODEX_THREAD_IDsh
git -C ~/tk add -A && git -C ~/tk commit -m 'tk: <what changed> (<run-id>)'
[ -n "$(git -C ~/tk remote)" ] && git -C ~/tk pull --rebase --autostash && git -C ~/tk pushThe pre-commit hook checks note format and links. Fix what it reports and retry once. A failed save never blocks your answer.
If notes changed (votes excluded), end your answer with .
tk: +added.md ~changed.md -deleted.md每次修改后提交,如果存在远程仓库,就基于远程仓库 rebase 然后推送。运行 ID 是 、 或 的前8个字符。
$CLAUDE_CODE_SESSION_ID$PI_SESSION_ID$CODEX_THREAD_IDsh
git -C ~/tk add -A && git -C ~/tk commit -m 'tk: <what changed> (<run-id>)'
[ -n "$(git -C ~/tk remote)" ] && git -C ~/tk pull --rebase --autostash && git -C ~/tk pushpre-commit 钩子会检查笔记格式和链接。修复它报告的问题后重试一次。保存失败永远不会阻碍你给出答复。
如果笔记有变更(不包括 votes 变更),在你的答复末尾加上 。
tk: +added.md ~changed.md -deleted.md