← Back to Skills Marketplace
wangxiaofei860208-source

Lobster Attachment Inject

by wangxiaofei860208-source · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ Security Clean
106
Downloads
0
Stars
1
Active Installs
2
Versions
Install in OpenClaw
/install lobster-attachment-inject
Description
动态附件注入 — 在不修改system prompt的情况下注入动态内容。参考Claude Code的Attachment消息机制。
README (SKILL.md)

Attachment Inject — 动态附件注入

参考 Claude Code 的 attachments.ts,将动态内容作为attachment消息注入而非嵌入system prompt。

问题

每次注入技能列表、Agent列表等动态内容到system prompt会:

  1. 增加每次请求的token消耗
  2. 内容变化时破坏prompt cache
  3. 无法动态更新

解决方案

模式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

最佳实践

  1. 注册表 \x3C 500 token — 只含名称和一行描述
  2. 完整内容按需加载 — 匹配到任务时才读SKILL.md
  3. 变化时只更新注册表 — 不动system prompt
  4. 核心技能始终加载 — 9个核心技能的描述直接在AGENTS.md中
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install lobster-attachment-inject
  3. After installation, invoke the skill by name or use /lobster-attachment-inject
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug lobster-attachment-inject
Version 1.0.1
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 2
Frequently Asked Questions

What is Lobster Attachment Inject?

动态附件注入 — 在不修改system prompt的情况下注入动态内容。参考Claude Code的Attachment消息机制。 It is an AI Agent Skill for Claude Code / OpenClaw, with 106 downloads so far.

How do I install Lobster Attachment Inject?

Run "/install lobster-attachment-inject" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Lobster Attachment Inject free?

Yes, Lobster Attachment Inject is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Lobster Attachment Inject support?

Lobster Attachment Inject is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Lobster Attachment Inject?

It is built and maintained by wangxiaofei860208-source (@wangxiaofei860208-source); the current version is v1.0.1.

💬 Comments