← 返回 Skills 市场
Lobster Attachment Inject
作者
wangxiaofei860208-source
· GitHub ↗
· v1.0.1
· MIT-0
106
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install lobster-attachment-inject
功能描述
动态附件注入 — 在不修改system prompt的情况下注入动态内容。参考Claude Code的Attachment消息机制。
使用说明 (SKILL.md)
Attachment Inject — 动态附件注入
参考 Claude Code 的 attachments.ts,将动态内容作为attachment消息注入而非嵌入system prompt。
问题
每次注入技能列表、Agent列表等动态内容到system prompt会:
- 增加每次请求的token消耗
- 内容变化时破坏prompt cache
- 无法动态更新
解决方案
模式1: 按需读取(当前OpenClaw支持)
不预注入内容,而是在需要时读取:
用户提到"调度Agent" → 读 agents/*.md → 选择合适的Agent
用户提到"调试" → 读 skills/systematic-debugging/SKILL.md → 激活技能
模式2: 注册表文件(轻量注入)
维护一个注册表文件,包含名称+描述,不包含完整内容:
# agents/registry.md(自动生成)
| Agent | 描述 |
|-------|------|
| code-reviewer | 代码质量+安全审查 |
| planner | 实现规划(Opus) |
| chief-of-staff | 多渠道消息分诊 |
...
# skills/registry.md(自动生成)
| 技能 | 描述 |
|------|------|
| coordinator | 三层多Agent协调 |
| compact | 长会话压缩 |
...
模式3: 动态注入点
在AGENTS.md中定义占位符,每次会话开始时替换:
\x3C!-- INJECT:SKILLS_REGISTRY -->
\x3C!-- INJECT:AGENTS_REGISTRY -->
\x3C!-- INJECT:MEMORY_SUMMARY -->
注册表生成脚本
# 生成技能注册表
for dir in skills/*/; do
name=$(basename "$dir")
desc=$(grep "^description:" "$dir/SKILL.md" 2>/dev/null | head -1 | sed 's/description: *//' | cut -c1-60)
echo "| $name | $desc |"
done
# 生成Agent注册表
for f in agents/*.md; do
name=$(grep "^name:" "$f" | head -1 | sed 's/name: *//')
desc=$(grep "^description:" "$f" | head -1 | sed 's/description: *//' | cut -c1-60)
echo "| $name | $desc |"
done
最佳实践
- 注册表 \x3C 500 token — 只含名称和一行描述
- 完整内容按需加载 — 匹配到任务时才读SKILL.md
- 变化时只更新注册表 — 不动system prompt
- 核心技能始终加载 — 9个核心技能的描述直接在AGENTS.md中
安全使用建议
This skill appears to do what it says: build small registries and inject dynamic content by reading/writing local agent/skill markdown files. Before installing, consider: 1) the skill requests read/write capability — confirm you trust it to read files under the workspace (it could read any file the agent has access to); 2) it writes registry and AGENTS.md content, which is persistent and may affect future prompts — review and restrict target paths or require manual approval of injected content; 3) the provided shell snippets are simple directory-readers but avoid running them on sensitive directories; and 4) because there is no install or external network usage, the main risk is local file access — limit its scope (e.g., restrict to skills/ and agents/ directories) or review changes after first run. If you need higher assurance, ask the author for a more explicit file-scope policy or a code implementation you can audit.
功能分析
Type: OpenClaw Skill
Name: lobster-attachment-inject
Version: 1.0.1
The skill 'lobster-attachment-inject' is a utility designed to optimize prompt management by using registry files and on-demand loading instead of large system prompts. It includes a bash script in SKILL.md for generating these registries by reading local skill and agent directories, which is consistent with its stated purpose and requested 'read/write' permissions.
能力评估
Purpose & Capability
Name/description, examples, and scripts all describe building lightweight registries and injecting dynamic content via attachment-like messages. The declared need to read agents/*.md and skills/*/SKILL.md and to write registry files is coherent with the stated goal.
Instruction Scope
SKILL.md explicitly instructs the agent to read skill and agent markdown files, generate registry.md files, and replace placeholders in AGENTS.md at session start. These actions stay within the domain of managing agent/skill metadata and do not call external endpoints or request unrelated system data, but they do allow reading many repository files (skills/*, agents/*).
Install Mechanism
Instruction-only skill with no install spec and no code files — lowest install risk. The provided shell snippets are advisory and would run only if the agent chose to execute them.
Credentials
No environment variables or credentials are requested. However the frontmatter metadata indicates the skill requires read/write capability; that capability can be broad (allows reading arbitrary files the agent can access). No explicit env secrets appear necessary for the described functionality.
Persistence & Privilege
always:false (good). The instructions propose writing registry files and replacing placeholders in AGENTS.md each session — which creates persistent artifacts and can alter documents used to construct prompts. This is consistent with the skill's purpose but is also a persistence vector to be aware of.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install lobster-attachment-inject - 安装完成后,直接呼叫该 Skill 的名称或使用
/lobster-attachment-inject触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Renamed the skill from "attachment-inject" to "lobster-attachment-inject"
- Updated all references in SKILL.md to reflect the new skill name
- No changes to implementation or functionality; documentation only
v1.0.0
- Initial release of attachment-inject skill for dynamic content injection without modifying the system prompt.
- Implements Claude Code-style attachment messaging for managing dynamic skill and agent lists.
- Reduces token usage, preserves prompt cache, and supports on-demand/dynamic updates.
- Provides three content injection modes: lazy reading, registry files, and runtime slot replacement.
- Includes scripts and best practices for automatic registry generation and efficient skill loading.
元数据
常见问题
Lobster Attachment Inject 是什么?
动态附件注入 — 在不修改system prompt的情况下注入动态内容。参考Claude Code的Attachment消息机制。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 106 次。
如何安装 Lobster Attachment Inject?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install lobster-attachment-inject」即可一键安装,无需额外配置。
Lobster Attachment Inject 是免费的吗?
是的,Lobster Attachment Inject 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Lobster Attachment Inject 支持哪些平台?
Lobster Attachment Inject 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Lobster Attachment Inject?
由 wangxiaofei860208-source(@wangxiaofei860208-source)开发并维护,当前版本 v1.0.1。
推荐 Skills