inject
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInject Skill
注入Skill
Typically runs automatically via SessionStart hook.
Inject relevant prior knowledge into the current session.
通常通过SessionStart钩子自动运行。
向当前会话注入相关的已有知识。
How It Works
工作原理
The SessionStart hook runs:
bash
ao inject --apply-decay --format markdown --max-tokens 1000This searches for relevant knowledge and injects it into context.
SessionStart钩子会执行以下命令:
bash
ao inject --apply-decay --format markdown --max-tokens 1000该命令会搜索相关知识并将其注入上下文。
Manual Execution
手动执行
Given :
/inject [topic]当输入时:
/inject [主题]Step 1: Search for Relevant Knowledge
步骤1:搜索相关知识
With ao CLI:
bash
ao inject --context "<topic>" --format markdown --max-tokens 1000Without ao CLI, search manually:
bash
undefined使用ao CLI:
bash
ao inject --context "<topic>" --format markdown --max-tokens 1000不使用ao CLI时,手动搜索:
bash
undefinedRecent learnings
近期学习内容
ls -lt .agents/learnings/ | head -5
ls -lt .agents/learnings/ | head -5
Recent patterns
近期模式
ls -lt .agents/patterns/ | head -5
ls -lt .agents/patterns/ | head -5
Recent research
近期研究内容
ls -lt .agents/research/ | head -5
undefinedls -lt .agents/research/ | head -5
undefinedStep 2: Read Relevant Files
步骤2:读取相关文件
Use the Read tool to load the most relevant artifacts based on topic.
使用Read工具根据主题加载最相关的工件。
Step 3: Summarize for Context
步骤3:为上下文生成摘要
Present the injected knowledge:
- Key learnings relevant to current work
- Patterns that may apply
- Recent research on related topics
呈现注入的知识:
- 与当前工作相关的关键知识点
- 可能适用的模式
- 相关主题的近期研究成果
Knowledge Sources
知识来源
| Source | Location | Priority |
|---|---|---|
| Learnings | | High |
| Patterns | | High |
| Research | | Medium |
| Retros | | Medium |
| 来源 | 位置 | 优先级 |
|---|---|---|
| 学习内容 | | 高 |
| 模式 | | 高 |
| 研究内容 | | 中 |
| 回顾总结 | | 中 |
Decay Model
衰减模型
Knowledge relevance decays over time (~17%/week). More recent learnings are weighted higher.
知识的相关性会随时间衰减(约每周17%)。近期的学习内容权重更高。
Key Rules
核心规则
- Runs automatically - usually via hook
- Context-aware - filters by current directory/topic
- Token-budgeted - respects max-tokens limit
- Recency-weighted - newer knowledge prioritized
- 自动运行 - 通常通过钩子触发
- 上下文感知 - 根据当前目录/主题进行过滤
- 令牌预算控制 - 遵守最大令牌数限制
- 按时间权重排序 - 优先使用较新的知识