npx skills add https://github.com/boshu2/agentops --skill inject已弃用(计划移除版本:v3.0.0) — 使用
ao lookup --query "topic"进行按需知识检索,或查看.agents/AGENTS.md进行知识导航。此技能和ao injectCLI 命令仍然有效,但不再由钩子或其他技能调用。
按需知识检索。启动时不自动运行(自 ag-8km 起)。
将相关的先验知识注入到当前会话中。
在默认的 manual 启动模式下,MEMORY.md 由 Claude Code 自动加载,且不会发生启动时注入。当您需要更深层次的上下文时,请使用 /inject 或 ao inject 进行按需检索。
在 lean 或 legacy 启动模式下(通过 设置),SessionStart 钩子会运行:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
AGENTOPS_STARTUP_CONTEXT_MODE# lean 模式(MEMORY.md 新鲜):400 个令牌
ao inject --apply-decay --format markdown --max-tokens 400 \
[--bead <bead-id>] [--predecessor <handoff-path>]
# legacy 模式:800 个令牌
ao inject --apply-decay --format markdown --max-tokens 800 \
[--bead <bead-id>] [--predecessor <handoff-path>]
这会搜索相关知识并将其注入到上下文中。
当提供 --bead 参数时(通过 Gas Town 的 HOOK_BEAD 环境变量):
当提供 --predecessor 参数时(交接文件的路径):
给定 /inject [主题]:
使用 ao CLI:
ao inject --context "<主题>" --format markdown --max-tokens 1000
不使用 ao CLI,手动搜索:
# 最近的学习记录
ls -lt .agents/learnings/ | head -5
# 最近的模式
ls -lt .agents/patterns/ | head -5
# 最近的研究
ls -lt .agents/research/ | head -5
# 全局学习记录(跨仓库知识)
ls -lt ~/.agents/learnings/ 2>/dev/null | head -5
# 全局模式(跨仓库模式)
ls -lt ~/.agents/patterns/ 2>/dev/null | head -5
# 遗留模式(只读回退,无新写入)
ls -lt ~/.claude/patterns/ 2>/dev/null | head -5
使用 Read 工具根据主题加载最相关的工件。
呈现注入的知识:
呈现注入的知识后,记录哪些文件被注入以用于反馈循环:
mkdir -p .agents/ao
# 将每个注入的学习记录文件记录为引用
for injected_file in <已读取并呈现的文件列表>; do
echo "{\"learning_file\": \"$injected_file\", \"timestamp\": \"$(date -Iseconds)\", \"session\": \"$(date +%Y-%m-%d)\"}" >> .agents/ao/citations.jsonl
done
引用跟踪实现了反馈循环:在 /post-mortem 期间,频繁被引用的学习记录会获得置信度提升,而未被引用的学习记录则会更快地衰减。
| 来源 | 位置 | 优先级 | 权重 |
|---|---|---|---|
| 学习记录 | .agents/learnings/ | 高 | 1.0 |
| 模式 | .agents/patterns/ | 高 | 1.0 |
| 全局学习记录 | ~/.agents/learnings/ | 高 | 0.8(可配置) |
| 全局模式 | ~/.agents/patterns/ | 高 | 0.8(可配置) |
| 研究 | .agents/research/ | 中 | — |
| 回顾 | .agents/learnings/ | 中 | — |
| 遗留模式 | ~/.claude/patterns/ | 低 | 0.6(只读,无新写入) |
知识相关性随时间衰减(约每周 17%)。较新的学习记录权重更高。
钩子触发: session-start.sh 在会话开始时运行,且 AGENTOPS_STARTUP_CONTEXT_MODE=lean 或 legacy
发生的情况:
ao inject --apply-decay --format markdown --max-tokens 400(lean)或 --max-tokens 800(legacy).agents/learnings/、.agents/patterns/、.agents/research/ 中搜索相关工件结果: 先前的学习记录、模式、研究在会话开始时自动可用,无需手动查找。
注意: 在默认的 manual 模式下,MEMORY.md 由 Claude Code 自动加载,此钩子仅输出指向按需检索命令(ao search、ao lookup)的指针。
用户说: /inject authentication 或 "recall knowledge about auth"
发生的情况:
ao inject --context "authentication" --format markdown --max-tokens 1000结果: 检索并总结了特定主题的知识,比完整读取工件能更快地加载上下文。
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 未注入知识 | 知识池为空或 ao CLI 不可用 | 运行 /post-mortem 来填充知识池;验证 ao CLI 是否已安装 |
| 知识不相关 | 主题不匹配或陈旧工件占主导 | 使用 --context "<主题>" 过滤;清理陈旧工件 |
| 超出令牌预算 | 高相关性工件过多 | 减少 --max-tokens 或提高主题特异性 |
| 衰减过于激进 | 最近的学习记录未被优先考虑 | 检查工件修改时间;验证 --apply-decay 标志 |
每周安装量
196
仓库
GitHub 星标数
197
首次出现
2026 年 2 月 2 日
安全审计
安装于
codex194
gemini-cli192
claude-code192
github-copilot192
kimi-cli192
amp192
DEPRECATED (removal target: v3.0.0) — Use
ao lookup --query "topic"for on-demand learnings retrieval, or see.agents/AGENTS.mdfor knowledge navigation. This skill and theao injectCLI command still work but are no longer called from hooks or other skills.
On-demand knowledge retrieval. Not run automatically at startup (since ag-8km).
Inject relevant prior knowledge into the current session.
In the default manual startup mode, MEMORY.md is auto-loaded by Claude Code and no startup injection occurs. Use /inject or ao inject for on-demand retrieval when you need deeper context.
In lean or legacy startup modes (set via AGENTOPS_STARTUP_CONTEXT_MODE), the SessionStart hook runs:
# lean mode (MEMORY.md fresh): 400 tokens
ao inject --apply-decay --format markdown --max-tokens 400 \
[--bead <bead-id>] [--predecessor <handoff-path>]
# legacy mode: 800 tokens
ao inject --apply-decay --format markdown --max-tokens 800 \
[--bead <bead-id>] [--predecessor <handoff-path>]
This searches for relevant knowledge and injects it into context.
When --bead is provided (via HOOK_BEAD env var from Gas Town):
When --predecessor is provided (path to a handoff file):
Given /inject [topic]:
With ao CLI:
ao inject --context "<topic>" --format markdown --max-tokens 1000
Without ao CLI, search manually:
# Recent learnings
ls -lt .agents/learnings/ | head -5
# Recent patterns
ls -lt .agents/patterns/ | head -5
# Recent research
ls -lt .agents/research/ | head -5
# Global learnings (cross-repo knowledge)
ls -lt ~/.agents/learnings/ 2>/dev/null | head -5
# Global patterns (cross-repo patterns)
ls -lt ~/.agents/patterns/ 2>/dev/null | head -5
# Legacy patterns (read-only fallback, no new writes)
ls -lt ~/.claude/patterns/ 2>/dev/null | head -5
Use the Read tool to load the most relevant artifacts based on topic.
Present the injected knowledge:
After presenting injected knowledge, record which files were injected for the feedback loop:
mkdir -p .agents/ao
# Record each injected learning file as a citation
for injected_file in <list of files that were read and presented>; do
echo "{\"learning_file\": \"$injected_file\", \"timestamp\": \"$(date -Iseconds)\", \"session\": \"$(date +%Y-%m-%d)\"}" >> .agents/ao/citations.jsonl
done
Citation tracking enables the feedback loop: learnings that are frequently cited get confidence boosts during /post-mortem, while uncited learnings decay faster.
| Source | Location | Priority | Weight |
|---|---|---|---|
| Learnings | .agents/learnings/ | High | 1.0 |
| Patterns | .agents/patterns/ | High | 1.0 |
| Global Learnings | ~/.agents/learnings/ | High | 0.8 (configurable) |
| Global Patterns | ~/.agents/patterns/ | High | 0.8 (configurable) |
Knowledge relevance decays over time (~17%/week). More recent learnings are weighted higher.
Hook triggers: session-start.sh runs at session start with AGENTOPS_STARTUP_CONTEXT_MODE=lean or legacy
What happens:
ao inject --apply-decay --format markdown --max-tokens 400 (lean) or --max-tokens 800 (legacy).agents/learnings/, .agents/patterns/, .agents/research/ for relevant artifactsResult: Prior learnings, patterns, research automatically available at session start without manual lookup.
Note: In the default manual mode, MEMORY.md is auto-loaded by Claude Code and this hook emits only a pointer to on-demand retrieval commands (ao search, ao lookup).
User says: /inject authentication or "recall knowledge about auth"
What happens:
ao inject --context "authentication" --format markdown --max-tokens 1000Result: Topic-specific knowledge retrieved and summarized, enabling faster context loading than full artifact reads.
| Problem | Cause | Solution |
|---|---|---|
| No knowledge injected | Empty knowledge pools or ao CLI unavailable | Run /post-mortem to seed pools; verify ao CLI installed |
| Irrelevant knowledge | Topic mismatch or stale artifacts dominate | Use --context "<topic>" to filter; prune stale artifacts |
| Token budget exceeded | Too many high-relevance artifacts | Reduce --max-tokens or increase topic specificity |
| Decay too aggressive | Recent learnings not prioritized | Check artifact modification times; verify --apply-decay flag |
Weekly Installs
196
Repository
GitHub Stars
197
First Seen
Feb 2, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex194
gemini-cli192
claude-code192
github-copilot192
kimi-cli192
amp192
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
106,200 周安装
LinkedIn个人品牌塑造技能 - 专业资料分析与优化工具,提升职场可见度与互动率
347 周安装
Next.js 14全栈开发模板:TypeScript + TailwindCSS + Supabase最佳实践
376 周安装
Salesforce Apex 代码生成与审查工具 - sf-apex 技能详解
409 周安装
GitLab工作流最佳实践指南:合并请求、CI/CD流水线与DevOps最佳实践
377 周安装
AI团队自动组建与任务执行工具 - Team Assemble 技能详解
417 周安装
fetch-tweet:无需JavaScript获取Twitter/X推文数据,支持原文、作者和互动统计
419 周安装
| Research |
.agents/research/ |
| Medium |
| — |
| Retros | .agents/learnings/ | Medium | — |
| Legacy Patterns | ~/.claude/patterns/ | Low | 0.6 (read-only, no new writes) |