til
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesetil
TIL
Capture and manage "Today I Learned" entries on OpenTIL -- from drafting to publishing, all within the CLI.
在OpenTIL上捕获和管理「今日所学(Today I Learned)」条目——从起草到发布,全程在CLI内完成。
Setup
设置
- Go to https://opentil.ai/dashboard/settings/tokens and create a Personal Access Token with ,
read:entries, andwrite:entriesscopesdelete:entries - Copy the token (starts with )
til_ - Set the environment variable:
bash
export OPENTIL_TOKEN="til_xxx"- 访问https://opentil.ai/dashboard/settings/tokens,创建一个拥有`read:entries`、`write:entries`和`delete:entries`权限的个人访问令牌
- 复制该令牌(以开头)
til_ - 设置环境变量:
bash
export OPENTIL_TOKEN="til_xxx"Token Resolution
令牌解析顺序
Token resolution order:
- environment variable
$OPENTIL_TOKEN - file (created by
~/.til/credentials)/til auth
If neither is set, entries are saved locally to .
~/.til/drafts/令牌解析优先级:
- 环境变量
$OPENTIL_TOKEN - 文件(由
~/.til/credentials命令创建)/til auth
如果两者都未设置,条目将本地保存到目录。
~/.til/drafts/Subcommand Routing
子命令路由
The first word after determines the action. Reserved words route to management subcommands; anything else is treated as content to capture.
/til| Invocation | Action |
|---|---|
| List entries (default: drafts) |
| Publish an entry |
| Unpublish (revert to draft) |
| AI-assisted edit |
| Search entries by title |
| Delete entry (with confirmation) |
| Show site status and connection info |
| Sync local drafts to OpenTIL |
| List site tags with usage counts |
| List site categories |
| Batch-capture multiple TIL entries |
| Connect OpenTIL account (browser auth) |
| Capture content as a new TIL |
| Extract insights from conversation (multi-candidate) |
Reserved words: , , , , , , , , , , , .
listpublishunpublisheditsearchdeletestatussynctagscategoriesbatchauth/til| 调用方式 | 操作 |
|---|---|
| 列出条目(默认:草稿) |
| 发布条目 |
| 取消发布(恢复为草稿) |
| AI辅助编辑 |
| 按标题搜索条目 |
| 删除条目(需确认) |
| 显示站点状态和连接信息 |
| 将本地草稿同步到OpenTIL |
| 列出站点标签及使用次数 |
| 列出站点分类 |
| 批量捕获多个TIL条目 |
| 连接OpenTIL账户(浏览器认证) |
| 将内容捕获为新的TIL条目 |
| 从对话中提取见解(多候选) |
保留字:, , , , , , , , , , , 。
listpublishunpublisheditsearchdeletestatussynctagscategoriesbatchauthReference Loading
参考文件加载规则
⚠️ DO NOT read reference files unless specified below. SKILL.md contains enough inline context for most operations.
⚠️ 除非以下情况指定,否则请勿读取参考文件。SKILL.md包含了大多数操作所需的内联上下文。
On subcommand dispatch (load before execution):
子命令执行前加载:
| Subcommand | References to load |
|---|---|
| none |
| none |
| references/management.md |
| references/management.md |
| references/management.md, references/local-drafts.md |
| references/management.md, references/api.md |
| 子命令 | 需加载的参考文件 |
|---|---|
| 无 |
| 无 |
| references/management.md |
| references/management.md |
| references/management.md, references/local-drafts.md |
| references/management.md, references/api.md |
On-demand (load only when the situation arises):
按需加载(仅在特定场景触发时加载):
| Trigger | Reference to load |
|---|---|
| API returns non-2xx after inline error handling is insufficient | references/api.md |
| Auto-detection context (proactive TIL suggestion) | references/auto-detection.md |
| No token found (first-run local fallback) | references/local-drafts.md |
| 触发条件 | 需加载的参考文件 |
|---|---|
| 内联错误处理后API仍返回非2xx状态码 | references/api.md |
| 自动检测上下文(主动建议TIL) | references/auto-detection.md |
| 未找到令牌(首次运行本地 fallback) | references/local-drafts.md |
API Quick Reference
API快速参考
Create and publish an entry:
bash
curl -X POST "https://opentil.ai/api/v1/entries" \
-H "Authorization: Bearer $OPENTIL_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"entry": {
"title": "Go interfaces are satisfied implicitly",
"content": "In Go, a type implements an interface...",
"tag_names": ["go", "interfaces"],
"published": true,
"lang": "en"
}
}'Key create parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| string | yes | Markdown body (max 100,000 chars) |
| string | no | Entry title (max 200 chars). Auto-generates slug. |
| array | no | 1-3 lowercase tags, e.g. |
| boolean | no | |
| string | no | Language code: |
| string | no | Custom URL slug. Auto-generated from title if omitted. |
| string | no | |
Management endpoints:
| Endpoint | Method | Description |
|---|---|---|
| GET | List/search entries |
| GET | Get a single entry |
| PATCH | Update entry fields |
| DELETE | Permanently delete entry |
| POST | Publish a draft |
| POST | Revert to draft |
| GET | Site info (username, entry counts, etc.) |
| GET | List tags with usage counts |
| GET | List categories with entry counts |
Full parameter list, response format, and error handling: see references/api.md
创建并发布条目:
bash
curl -X POST "https://opentil.ai/api/v1/entries" \
-H "Authorization: Bearer $OPENTIL_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"entry": {
"title": "Go interfaces are satisfied implicitly",
"content": "In Go, a type implements an interface...",
"tag_names": ["go", "interfaces"],
"published": true,
"lang": "en"
}
}'创建条目关键参数:
| 字段 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| string | 是 | Markdown正文(最大100,000字符) |
| string | 否 | 条目标题(最大200字符),自动生成URL别名 |
| array | 否 | 1-3个小写标签,例如 |
| boolean | 否 | |
| string | 否 | 语言代码: |
| string | 否 | 自定义URL别名,若省略则从标题自动生成 |
| string | 否 | |
管理端点:
| 端点 | 请求方法 | 描述 |
|---|---|---|
| GET | 列出/搜索条目 |
| GET | 获取单个条目详情 |
| PATCH | 更新条目字段 |
| DELETE | 永久删除条目 |
| POST | 发布草稿 |
| POST | 恢复为草稿 |
| GET | 站点信息(用户名、条目数量等) |
| GET | 列出标签及使用次数 |
| GET | 列出分类及条目数量 |
完整参数列表、响应格式和错误处理:请查看references/api.md
Execution Flow
执行流程
Every invocation follows this flow:
/til- Generate -- craft the TIL entry (title, body, tags, lang)
- Check token -- resolve token (env var → )
~/.til/credentials- Found -> POST to API with -> show published URL
published: true - Not found -> save to -> show first-run setup guide
~/.til/drafts/
- Found -> POST to API with
- Never lose content -- the entry is always persisted somewhere
- On API failure -> save locally as draft (fallback unchanged)
每次调用都遵循以下流程:
/til- 生成——制作TIL条目(标题、正文、标签、语言)
- 检查令牌——解析令牌(环境变量 → )
~/.til/credentials- 找到令牌 → 携带参数POST到API → 显示发布后的URL
published: true - 未找到令牌 → 保存到→ 显示首次运行设置指南
~/.til/drafts/
- 找到令牌 → 携带
- 永不丢失内容——条目始终会被持久化到某个位置
- API调用失败时 → 本地保存为草稿(fallback逻辑不变)
/til <content>
-- Explicit Capture
/til <content>/til <content>
—— 显式捕获
/til <content>The user's input is raw material -- a seed, not the final entry. Generate a complete TIL from it:
- Short input (a sentence or phrase) -> expand into a full entry with context and examples
- Long input (a paragraph or more) -> refine and structure, but preserve the user's intent
Steps:
- Treat the user's input as a seed -- craft a complete title + body from it
- Generate a concise title (5-15 words) in the same language as the content
- Write a self-contained Markdown body (see Content Guidelines below)
- Infer 1-3 lowercase tags from technical domain (e.g. ,
rails,postgresql)go - Detect language -> set (
lang,en,zh-CN,zh-TW,ja,ko,es,fr,de,pt-BR,pt,ru,ar,bs,da,nb,pl,th,tr)it - Follow Execution Flow above (check token -> POST or save locally)
No confirmation needed -- the user explicitly asked to capture. Execute directly.
用户输入是原始素材——是种子而非最终条目。需要基于输入生成完整的TIL条目:
- 短输入(一句话或短语)→ 扩展为包含上下文和示例的完整条目
- 长输入(一段或多段内容)→ 优化结构,但保留用户原意
步骤:
- 将用户输入视为种子,生成完整的标题+正文
- 生成简洁标题(5-15个单词),语言与输入内容一致
- 撰写独立完整的Markdown正文(请遵循下方内容规范)
- 从技术领域推断1-3个小写标签(例如,
rails,postgresql)go - 检测语言 → 设置参数(
lang,en,zh-CN,zh-TW,ja,ko,es,fr,de,pt-BR,pt,ru,ar,bs,da,nb,pl,th,tr)it - 遵循上述执行流程(检查令牌 → POST或本地保存)
无需确认——用户已明确要求捕获,直接执行。
/til
-- Extract from Conversation
/til/til
—— 从对话提取
/tilWhen is used without arguments, analyze the current conversation for learnable insights.
/tilSteps:
- Scan the conversation for knowledge worth preserving -- surprising facts, useful techniques, debugging breakthroughs, "aha" moments
- Identify all TIL-worthy insights (not just one), up to 5
- Branch based on count:
0 insights:
No clear TIL insights found in this conversation.1 insight: Generate the full draft (title, body, tags), show it, ask for confirmation. On confirmation -> follow Execution Flow.
2+ insights: Show a numbered list (max 5), let the user choose:
Found 3 TIL-worthy insights:
1. Go interfaces are satisfied implicitly
2. PostgreSQL JSONB arrays don't support GIN @>
3. CSS :has() enables parent selection
Which to capture? (1/2/3/all/none)- Single number -> generate draft for that insight, show confirmation, proceed
- Comma-separated list (e.g. ) -> generate drafts for selected, show all for confirmation, POST sequentially
1,3 - -> generate drafts for each, show all for confirmation, POST sequentially
all - -> cancel
none
- For each selected insight, generate a standalone TIL entry following Content Guidelines
- Show the generated entry to the user and ask for confirmation before proceeding
- On confirmation -> follow Execution Flow above (check token -> POST or save locally)
当不带参数使用时,分析当前对话以提取值得记录的见解。
/til步骤:
- 扫描对话,寻找值得保存的知识——意外发现的事实、实用技巧、调试突破、「恍然大悟」的时刻
- 识别所有适合作为TIL的见解(不止一个),最多5个
- 根据数量分支处理:
0个见解:
在本次对话中未发现明确的TIL见解。1个见解: 生成完整草稿(标题、正文、标签),展示给用户并请求确认。确认后 → 遵循执行流程。
2个及以上见解: 显示编号列表(最多5个),让用户选择:
发现3个适合作为TIL的见解:
1. Go接口为隐式实现
2. PostgreSQL JSONB数组不支持GIN @>操作符
3. CSS :has()支持父元素选择
要捕获哪一个?(1/2/3/all/none)- 单个数字 → 生成对应见解的草稿,展示确认后继续
- 逗号分隔列表(如)→ 为选中的见解生成草稿,全部展示确认后依次POST
1,3 - → 为每个见解生成草稿,全部展示确认后依次POST
all - → 取消操作
none
- 为每个选中的见解生成符合内容规范的独立TIL条目
- 在执行前,必须向用户展示生成的条目并请求确认
- 确认后 → 遵循上述执行流程(检查令牌 → POST或本地保存)
Auto-Detection
自动检测
When working alongside a user, proactively detect moments worth capturing as TIL entries.
在与用户协作时,主动检测适合捕获为TIL条目的时刻。
When to Suggest
建议时机
Suggest when the conversation produces a genuine "aha" moment — something surprising, non-obvious, or worth remembering. Examples:
- Debugging uncovered a non-obvious root cause
- A language/framework behavior contradicted common assumptions
- Refactoring revealed a clearly superior pattern
- Performance optimization yielded measurable improvement
- An obscure but useful tool flag or API parameter was discovered
- Two technologies interacting produced unexpected behavior
Do NOT suggest for: standard tool usage, documented behavior, typo-caused bugs, or widely known best practices.
当对话产生真正的「恍然大悟」时刻时提出建议——例如意外的事实、实用技巧、非显而易见的内容或值得记住的知识点。示例:
- 调试发现了非显而易见的根本原因
- 语言/框架的行为与普遍认知不符
- 重构发现了更优的模式
- 性能优化取得了可衡量的提升
- 发现了一个小众但实用的工具参数或API
- 两种技术交互产生了意外行为
请勿为以下场景提出建议:标准工具使用、文档已有说明、打字错误导致的bug、广为人知的最佳实践。
Rate Limiting
频率限制
- Once per session — after suggesting once (accepted or declined), never suggest again
- Natural pauses only — suggest at resolution points or task boundaries, never mid-problem-solving
- Respect rejection — if declined, move on without persuasion
- 每会话一次——无论用户接受或拒绝建议,在同一会话中不再提出第二次
- 仅在自然停顿点——在问题解决或任务边界时提出,不要在问题解决过程中打断
- 尊重拒绝——如果用户拒绝,无需劝说,继续当前任务
Suggestion Format
建议格式
Append at the end of your normal response. Never interrupt workflow.
Template:
💡 TIL: [concise title of the insight]
Tags: [tag1, tag2] · Capture? (yes/no)Example (at the end of a debugging response):
...so the fix is to close the channel before the goroutine exits.
💡 TIL: Unclosed Go channels in goroutines cause silent memory leaks
Tags: go, concurrency · Capture? (yes/no)附加在正常回复末尾,绝不打断工作流程。
模板:
💡 TIL: [见解的简洁标题]
标签: [tag1, tag2] · 是否捕获?(是/否)示例(在调试回复末尾):
...所以修复方法是在goroutine退出前关闭通道。
💡 TIL: 未关闭的Go通道会导致静默内存泄漏
标签: go, concurrency · 是否捕获?(是/否)Capture Flow
捕获流程
Auto-detected TILs bypass the extract flow. The suggestion itself is the candidate.
- User replies /
yes/y/ok→ agent generates full entry (title, body, tags, lang) from the suggested insight → follows Execution Flow (POST or save locally)sure - User replies / ignores / continues other topic → move on, do not ask again
no
Non-affirmative responses (continuing the conversation about something else) are treated as implicit decline.
Detailed trigger examples, state machine, and anti-patterns: see references/auto-detection.md
自动检测到的TIL跳过提取流程,建议本身即为候选条目。
- 用户回复/
是/y/好的→ 代理根据建议的见解生成完整条目(标题、正文、标签、语言)→ 遵循执行流程(POST或本地保存)确定 - 用户回复/忽略/继续其他话题 → 继续当前任务,不再询问
否
非肯定回复(继续讨论其他内容)视为隐含拒绝。
详细的触发示例、状态机和反模式:请查看references/auto-detection.md
Management Subcommands
管理子命令
Management subcommands require a token. There is no local fallback -- management operations need the API.
管理子命令需要令牌,无本地fallback——管理操作依赖API。
/til list [drafts|published|all]
/til list [drafts|published|all]/til list [drafts|published|all]
/til list [drafts|published|all]List entries. Default filter: .
drafts- API:
GET /entries?status=<filter>&per_page=10 - Display as a compact table with short IDs (last 8 chars, prefixed with )
... - Show pagination info at the bottom
列出条目,默认筛选条件:(草稿)。
drafts- API调用:
GET /entries?status=<filter>&per_page=10 - 以紧凑表格展示,显示短ID(最后8个字符,前缀为)
... - 底部显示分页信息
/til publish [<id> | last]
/til publish [<id> | last]/til publish [<id> | last]
/til publish [<id> | last]Publish a draft entry.
- resolves to the most recently created entry in this session (tracked via
lastset on every successful POST)last_created_entry_id - Fetch the entry first, show title/tags, ask for confirmation
- On success, display the published URL
- If already published, show informational message (not an error)
发布草稿条目。
- 指代本次会话中最近创建的条目(通过每次成功POST后设置的
last跟踪)last_created_entry_id - 先获取条目详情,显示标题/标签,请求确认
- 成功后显示发布URL
- 如果条目已发布,显示提示信息(非错误)
/til unpublish <id>
/til unpublish <id>/til unpublish <id>
/til unpublish <id>Revert a published entry to draft.
- Fetch the entry first, confirm before unpublishing
- If already a draft, show informational message
将已发布条目恢复为草稿。
- 先获取条目详情,确认后再执行取消发布
- 如果条目已是草稿,显示提示信息
/til edit <id> [instructions]
/til edit <id> [instructions]/til edit <id> [instructions]
/til edit <id> [instructions]AI-assisted editing of an existing entry.
- Fetch the full entry via
GET /entries/:id - Apply changes based on instructions (or ask what to change if none given)
- Show a diff preview of proposed changes
- On confirmation, with only the changed fields
PATCH /entries/:id
AI辅助编辑现有条目。
- 通过获取完整条目
GET /entries/:id - 根据指令修改内容(若未提供指令则询问修改需求)
- 显示修改预览差异
- 确认后,仅将修改的字段通过提交
PATCH /entries/:id
/til search <keyword>
/til search <keyword>/til search <keyword>
/til search <keyword>Search entries by title.
- API:
GET /entries?q=<keyword>&per_page=10 - Same compact table format as
list
按标题搜索条目。
- API调用:
GET /entries?q=<keyword>&per_page=10 - 与命令使用相同的紧凑表格格式
list
/til delete <id>
/til delete <id>/til delete <id>
/til delete <id>Permanently delete an entry.
- Fetch the entry, show title and status
- Double-confirm: "This cannot be undone. Type 'delete' to confirm."
- On confirmation,
DELETE /entries/:id
永久删除条目。
- 获取条目详情,显示标题和状态
- 二次确认:「此操作不可撤销。请输入'delete'确认。」
- 确认后执行
DELETE /entries/:id
/til status
/til status/til status
/til statusShow site status and connection info. Works without a token (degraded display).
- With token: -> show username, entry breakdown (total/published/drafts), token status, local draft count, dashboard link
GET /site - Without token: show "not connected", local draft count, setup link
显示站点状态和连接信息。无需令牌即可使用(功能受限展示)。
- 已配置令牌:调用→ 显示用户名、条目统计(总数/已发布/草稿)、令牌状态、本地草稿数量、仪表盘链接
GET /site - 未配置令牌:显示「未连接」、本地草稿数量、设置链接
/til sync
/til sync/til sync
/til syncExplicitly sync local drafts from to OpenTIL. Requires token.
~/.til/drafts/- List pending drafts, POST each one, delete local file on success
- Show summary with success/failure per draft
将中的本地草稿显式同步到OpenTIL,需要令牌。
~/.til/drafts/- 列出待同步草稿,逐个POST到API,成功后删除本地文件
- 显示同步总结,包含每个草稿的成功/失败状态
/til tags
/til tags/til tags
/til tagsList site tags sorted by usage count (top 20). Requires token.
- API:
GET /tags?sort=popular&per_page=20&with_entries=true - Show as compact table with tag name and entry count
按使用次数排序列出站点标签(前20个),需要令牌。
- API调用:
GET /tags?sort=popular&per_page=20&with_entries=true - 以紧凑表格展示标签名称和条目数量
/til categories
/til categories/til categories
/til categoriesList site categories. Requires token.
- API:
GET /categories - Show as compact table with name, entry count, and description
列出站点分类,需要令牌。
- API调用:
GET /categories - 以紧凑表格展示分类名称、条目数量和描述
/til batch <topics>
/til batch <topics>/til batch <topics>
/til batch <topics>Batch-capture multiple TIL entries in one invocation. Requires explicit topic list.
- User lists topics separated by newlines, semicolons, or markdown list items (/
-)1. - Generate a draft for each -> show all drafts for confirmation -> POST sequentially
- On partial failure, show per-entry success/failure (same format as )
/til sync
一次调用批量捕获多个TIL条目,需要明确的主题列表。
- 用户通过换行、分号或Markdown列表项(/
-)分隔主题1. - 为每个主题生成草稿 → 展示所有草稿请求确认 → 依次POST
- 部分失败时,显示每个条目的成功/失败状态(与格式相同)
/til sync
ID Resolution
ID解析规则
- In listings, show IDs in short form: + last 8 characters
... - Accept both short and full IDs as input
- Resolve short IDs by suffix match against the current listing
- If ambiguous (multiple matches), ask for clarification
- 在列表中,以短格式显示ID:+ 最后8个字符
... - 接受短ID和完整ID作为输入
- 通过后缀匹配当前列表解析短ID
- 若存在歧义(多个匹配项),请用户澄清
Session State
会话状态
Track -- set on every successful (201). Used by . Not persisted across sessions.
last_created_entry_idPOST /entries/til publish lastDetailed subcommand flows, display formats, and error handling: see references/management.md
跟踪——每次成功执行后设置。供命令使用,跨会话不持久化。
last_created_entry_idPOST /entries/til publish last详细的子命令流程、展示格式和错误处理:请查看references/management.md
Agent Identity
代理身份标识
Three layers of attribution signal distinguish human-initiated from agent-initiated TILs.
三层归因标识区分人工发起和代理发起的TIL条目。
Layer 1: HTTP Headers
第一层:HTTP请求头
Include these headers on every API call:
X-OpenTIL-Source: human | agent
X-OpenTIL-Agent: <your agent display name>
X-OpenTIL-Model: <human-readable model name>- Source: and
/til <content>->/til; Auto-detected ->humanagent - Agent: use your tool's display name (e.g. ,
Claude Code,Cursor). Do not use a slug.GitHub Copilot - Model: use a human-readable model name (e.g. ,
Claude Opus 4.6,GPT-4o). Do not use a model ID.Gemini 2.5 Pro - Agent and Model are optional -- omit them if you are unsure.
每次API调用都需包含以下请求头:
X-OpenTIL-Source: human | agent
X-OpenTIL-Agent: <你的代理显示名称>
X-OpenTIL-Model: <易读的模型名称>- Source:和
/til <content>→/til;自动检测的条目 →humanagent - Agent:使用工具的显示名称(例如,
Claude Code,Cursor),请勿使用短名称GitHub Copilot - Model:使用易读的模型名称(例如,
Claude Opus 4.6,GPT-4o),请勿使用模型IDGemini 2.5 Pro - Agent和Model为可选字段——若不确定可省略
Layer 2: Tag Convention
第二层:标签约定
- Auto-detected TILs: automatically add to the tag list
agent-assisted - and
/til <content>: do not add the tag (unless the Agent substantially rewrote the content)/til
- 自动检测的TIL条目:自动添加标签
agent-assisted - 和
/til <content>:请勿添加该标签(除非代理对内容进行了大幅改写)/til
Layer 3: Attribution Rendering (Backend)
第三层:归因展示(后端处理)
Agent-initiated TILs are visually marked on OpenTIL automatically based on the
field. No content modification needed -- the backend renders attribution
in the display layer.
source- Public page: shows , or
✨ via {agent_name}when agent_name is absent✨ AI - Tooltip (hover): shows when both are present
{agent_name} · {model} - Dashboard: shows ✨ badge + agent_name, or "Agent" when agent_name is absent
Do NOT append any footer or attribution text to the content body.
代理发起的TIL条目会在OpenTIL上自动标记,基于字段。无需修改内容——后端会在展示层处理归因。
source- 公开页面:显示,若未提供agent_name则显示
✨ via {agent_name}✨ AI - 悬停提示:若同时提供agent_name和model,显示
{agent_name} · {model} - 仪表盘:显示✨徽章+agent_name,若未提供则显示「Agent」
请勿在内容末尾添加任何页脚或归因文本。
Summary
总结
| Dimension | | | Auto-detected |
|---|---|---|---|
| Trigger | User explicit | User command | Agent proactive |
| Confirmations | 0 (direct publish) | 1 (review before publish) | 1 (suggest → capture) |
| Source header | | | |
| Agent header | Yes | Yes | Yes |
| Model header | Yes | Yes | Yes |
| No | No | Yes |
| Attribution | Automatic (backend) | Automatic (backend) | Automatic (backend) |
| 维度 | | | 自动检测 |
|---|---|---|---|
| 触发方式 | 用户显式调用 | 用户命令 | 代理主动建议 |
| 确认次数 | 0(直接发布) | 1(发布前审核) | 1(建议→捕获) |
| Source头 | | | |
| Agent头 | 是 | 是 | 是 |
| Model头 | 是 | 是 | 是 |
| 否 | 否 | 是 |
| 归因方式 | 自动(后端) | 自动(后端) | 自动(后端) |
Content Guidelines
内容规范
Every TIL entry must follow these rules:
- Self-contained: The reader must understand the entry without any conversation context. Never write "as we discussed", "the above error", "this project's config", etc.
- Desensitized: Remove project names, company details, colleague names, internal URLs, and proprietary business logic. Generalize specifics: "our User model" -> "a model", "the production server" -> "a production environment", "the Acme payment service" -> "a payment gateway".
- Universally valuable: Write to StackOverflow-answer standards. A stranger searching for this topic should find the entry immediately useful. Content only useful to the author belongs in private notes, not TIL.
- Factual tone: State facts, show examples, explain why. Avoid first-person narrative ("I was debugging...", "I discovered..."). Exception: brief situational context is fine ("When upgrading Rails from 7.2 to 8.0...").
- One insight per entry: Each TIL teaches exactly ONE thing. If there are multiple insights, create separate entries.
- Concrete examples: Include code snippets, commands, or specific data whenever relevant. Avoid vague descriptions.
- Title: 5-15 words. Descriptive, same language as content. No "TIL:" prefix.
- Content: Use the most efficient format for the knowledge — tables for comparisons, code blocks for examples, lists for enumerations, math (/
$inline$) for formulas with fractions/subscripts/superscripts/greek letters, Mermaid diagrams ($$display$$) for flows/states/sequences that text cannot clearly express. Simple expressions like```mermaidstay as inline code; use math only when notation complexity warrants it. Only use prose when explaining causation or context. Never pad content; if one sentence suffices, don't write a paragraph.O(n) - Tags: 1-3 lowercase tags from the technical domain (,
go,rails,postgresql,css). No generic tags likelinuxorprogramming.til - Lang: Detect from content. Chinese -> , Traditional Chinese ->
zh-CN, English ->zh-TW, Japanese ->en, Korean ->ja.ko - Category: Do not auto-infer -- only include it if the user explicitly specifies a category/topic.
category_name
所有TIL条目必须遵循以下规则:
- 独立完整:读者无需对话上下文即可理解条目内容。请勿使用「如我们讨论的」「上述错误」「本项目配置」等表述。
- 脱敏处理:移除项目名称、公司细节、同事姓名、内部URL和专有业务逻辑。将具体信息泛化:「我们的User模型」→「某个模型」,「生产服务器」→「生产环境」,「Acme支付服务」→「支付网关」。
- 通用价值:内容需达到StackOverflow回答的标准。陌生用户搜索相关主题时,应能立即从中获得帮助。仅对作者有用的内容应存为私人笔记,而非TIL。
- 客观语气:陈述事实、展示示例、解释原因。避免第一人称叙事(「我在调试...」「我发现...」)。例外:简短的场景上下文是允许的(「在将Rails从7.2升级到8.0时...」)。
- 单条见解:每个TIL仅讲解一个知识点。若有多个见解,请创建独立条目。
- 具体示例:相关时需包含代码片段、命令或具体数据。避免模糊描述。
- 标题:5-15个单词,描述性强,语言与内容一致。请勿添加「TIL:」前缀。
- 内容格式:选择最适合知识呈现的格式——对比用表格,示例用代码块,枚举用列表,复杂公式用KaTeX数学公式(/
$inline$),流程/状态/序列用Mermaid图($$display$$)。简单表达式如```mermaid保持内联代码格式;仅当符号复杂度需要时才使用数学公式。仅在解释因果关系或上下文时使用 prose。绝不凑字数——一句话能说明的,不要写一段。O(n) - 标签:1-3个技术领域的小写标签(,
go,rails,postgresql,css)。请勿使用linux或programming等通用标签。til - 语言:根据内容自动检测。简体中文→,繁体中文→
zh-CN,英文→zh-TW,日文→en,韩文→ja。ko - 分类:请勿自动推断——仅当用户明确指定分类/主题时才添加。
category_name
Result Messages
结果消息
API Success (token configured, 201)
API调用成功(已配置令牌,返回201)
Published to OpenTIL
Title: Go interfaces are satisfied implicitly
Tags: go, interfaces
URL: https://opentil.ai/@username/go-interfaces-are-satisfied-implicitlyExtract the field from the API response for the URL.
url已发布到OpenTIL
标题: Go接口为隐式实现
标签: go, interfaces
URL: https://opentil.ai/@username/go-interfaces-are-satisfied-implicitly从API响应中提取字段作为展示的URL。
urlSync Local Drafts
同步本地草稿
After the first successful API call, check for pending files. If any exist, offer to sync:
~/.til/drafts/Draft saved to OpenTIL
Title: Go interfaces are satisfied implicitly
Tags: go, interfaces
Review: https://opentil.ai/@username/go-interfaces-are-satisfied-implicitly
Found 3 local drafts from before. Sync them to OpenTIL?On confirmation, POST each draft to the API. Delete the local file after each successful sync. Keep files that fail. Show summary:
Synced 3 local drafts to OpenTIL
+ Go defer runs in LIFO order
+ PostgreSQL JSONB indexes support GIN operators
+ CSS :has() selector enables parent selectionIf the user declines, keep the local files and do not ask again in this session.
首次API调用成功后,检查目录是否有待处理文件。若存在,询问是否同步:
~/.til/drafts/草稿已保存到OpenTIL
标题: Go接口为隐式实现
标签: go, interfaces
查看: https://opentil.ai/@username/go-interfaces-are-satisfied-implicitly
发现3个之前的本地草稿。是否同步到OpenTIL?用户确认后,将每个草稿POST到API。成功同步后删除本地文件,失败的文件保留。显示总结:
已将3个本地草稿同步到OpenTIL
+ Go defer按后进先出顺序执行
+ PostgreSQL JSONB索引支持GIN操作符
+ CSS :has()选择器支持父元素选择若用户拒绝,保留本地文件,本会话不再询问。
First Run (no token)
首次运行(无令牌)
Save the draft locally, then show a concise setup hint. This is NOT an error -- the user successfully captured a TIL.
TIL captured
Title: Go interfaces are satisfied implicitly
Tags: go, interfaces
File: ~/.til/drafts/20260210-143022-go-interfaces.md
Sync to OpenTIL? Run: /til authOnly show the setup hint on the first local save in this session. On subsequent saves, use the short form:
TIL captured
Title: Go interfaces are satisfied implicitly
Tags: go, interfaces
File: ~/.til/drafts/20260210-143022-go-interfaces.md将草稿本地保存,然后显示简洁的设置提示。这不是错误——用户已成功捕获TIL条目。
已捕获TIL条目
标题: Go接口为隐式实现
标签: go, interfaces
文件: ~/.til/drafts/20260210-143022-go-interfaces.md
是否同步到OpenTIL?请运行:/til auth仅在本会话的第一次本地保存时显示设置提示。后续保存使用简化格式:
已捕获TIL条目
标题: Go接口为隐式实现
标签: go, interfaces
文件: ~/.til/drafts/20260210-143022-go-interfaces.mdError Handling
错误处理
On ANY API failure, always save the draft locally first. Never let user content be lost.
422 -- Validation error: Analyze the error response, fix the issue (e.g. truncate title to 200 chars, correct lang code), and retry. Only save locally if the retry also fails.
401 -- Token invalid or expired:
TIL captured (saved locally -- token expired)
File: ~/.til/drafts/20260210-143022-go-interfaces.md
Token expired. Run /til auth to reconnect.Network failure or 5xx:
TIL captured (saved locally -- API unavailable)
File: ~/.til/drafts/20260210-143022-go-interfaces.mdFull error codes, 422 auto-fix logic, and rate limit details: see references/api.md
任何API调用失败时,必须先将草稿本地保存。绝不能丢失用户内容。
422——验证错误: 分析错误响应,修复问题(例如将标题截断到200字符、修正语言代码),并重试。仅当重试失败时才本地保存。
401——令牌无效或过期:
已捕获TIL条目(本地保存——令牌已过期)
文件: ~/.til/drafts/20260210-143022-go-interfaces.md
令牌已过期。请运行/til auth重新连接。网络故障或5xx错误:
已捕获TIL条目(本地保存——API不可用)
文件: ~/.til/drafts/20260210-143022-go-interfaces.md完整的错误码、422自动修复逻辑和速率限制详情:请查看references/api.md
Local Draft Fallback
本地草稿Fallback
When the API is unavailable or no token is configured, drafts are saved locally to .
~/.til/drafts/File format:
YYYYMMDD-HHMMSS-<slug>.mdmarkdown
---
title: "Go interfaces are satisfied implicitly"
tags: [go, interfaces]
lang: en
---
In Go, a type implements an interface...Full directory structure, metadata fields, and sync protocol: see references/local-drafts.md
当API不可用或未配置令牌时,草稿会本地保存到目录。
~/.til/drafts/文件格式:
YYYYMMDD-HHMMSS-<slug>.mdmarkdown
---
title: "Go interfaces are satisfied implicitly"
tags: [go, interfaces]
lang: en
---
In Go, a type implements an interface...完整的目录结构、元数据字段和同步协议:请查看references/local-drafts.md
Notes
注意事项
- Entries are published immediately by default () -- use
published: trueto revert to draft/til unpublish <id> - The API auto-generates a URL slug from the title
- Tags are created automatically if they don't exist on the site
- Content is rendered to HTML server-side (GFM Markdown with syntax highlighting, KaTeX math, and Mermaid diagrams)
- Management subcommands (,
list,publish,edit,search,delete,tags,categories,sync) require a token -- no local fallback. Exception:batchandstatuswork without a token.auth - Scope errors map to specific scopes: /
list/search/tagsneedcategories,read:entries/publish/unpublish/edit/syncneedbatch,write:entriesneedsdelete.delete:entriesusesstatuswhen available but works without a token.read:entries
- 默认情况下条目会立即发布()——使用
published: true恢复为草稿/til unpublish <id> - API会根据标题自动生成URL别名
- 若站点不存在对应标签,会自动创建
- 内容在服务端渲染为HTML(支持GFM Markdown、语法高亮、KaTeX数学公式和Mermaid图)
- 管理子命令(,
list,publish,edit,search,delete,tags,categories,sync)需要令牌——无本地fallback。例外:batch和status无需令牌即可使用。auth - 权限错误对应具体权限:/
list/search/tags需要categories权限,read:entries/publish/unpublish/edit/sync需要batch权限,write:entries需要delete权限。delete:entries在有权限时使用status,但无令牌时也可使用。read:entries