跳到正文
Skillpedia
智能体7.6k · #13149

context-xray

它能做什么

这项技能展示智能体当前对话上下文的各个部分,以及每部分占用的空间。它让你或智能体保留重要的部分,并隐藏过时的部分。适合长对话开始变慢或变得混乱的人。

适用场景

  • ✓当长对话变得很大,你想查看哪些内容占用了空间的时候。
  • ✓当某个旧的工具结果或文件已不再相关,应当排除在外的时候。
  • ✓当一项重要的任务规格或约束需要贯穿整个对话的时候。

技能链接

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/context-xray/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/context-xray/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“这个对话已经很长了。你能告诉我哪些内容占用的空间最多,并保留我的项目需求吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体列出对话各部分及其大小。你或智能体可以固定某一部分以保留它,也可以隐藏某一部分使其不再进入后续回复。隐藏从不删除对话历史。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Context X-Ray

Context X-Ray is the framework's context garbage-collection surface. It shows the current thread's model-bound context as content-derived segments with token counts, then lets the user or agent pin, evict, or restore individual segments.

Actions

Action When to use
context-manifest-get Read the current manifest for a thread. Returns token totals, segment status, source, and whether changes are enforceable.
context-preview-get Compose the would-be system context for the current user/org/app without a live thread. Returns labeled system sections with provenance, governance tier, token counts, and bounded previews. Backs the Agent page Context tab.
context-pin Preserve a segment across future compaction/model calls. Use for task specs, acceptance criteria, user constraints, and other durable context.
context-evict Exclude a stale or irrelevant segment from future model calls. Eviction is reversible and never deletes chat history.
context-restore Undo a pin, evict, or summarize directive for a segment.
context-report External hosts can report their visible context inventory. These manifests are advisory unless Agent-Native owns the emitted content.
context-compact Compact the thread now: fold every not-yet-compacted message into observational memory instead of waiting for the post-turn threshold. Takes effect on the next model call; the transcript is unchanged.

System Sections

Manifests now cover the system-prompt half of context, not just conversation segments. Each system section carries a provenance label (framework-core, actions-prompt, template, enterprise-workspace-core, sql-workspace, legacy-app-default, organization, personal, memory, db-schema, tools, model-overlay, runtime-context) and a governance tier:

  • required — framework/enterprise policy; can never be altered by the user.
  • inherited — template/org/workspace instructions; managed elsewhere, visible here.
  • user — personal instructions and memory; editable through Files.

System sections are display-only provenance: they cannot be pinned, evicted, or summarized. The persisted manifest stores source refs, scope, content hashes, token counts, and bounded previews (~200 chars) — never raw prompt bodies; full content stays behind the resource/access model. The in-chat X-Ray panel groups these under "System", and the Agent page Context tab renders the full breakdown (via context-preview-get) with a system-vs-conversation split meter. Manifests are the latest snapshot per thread; there is no per-iteration history.

Rules

  • Never evict or summarize protected segments. The manifest marks active-turn user/tool/thinking context as protected.
  • System sections are never evictable; required/inherited tiers are locked by design — do not present controls that imply otherwise.
  • Prefer pinning the user's task, requirements, and decisions before evicting large stale tool results.
  • Eviction excludes content from future model calls; it does not delete the canonical transcript or files.
  • In external/advisory mode, be honest: recorded directives are intent for the host except for Agent-Native-originated content we can actually withhold.
  • If token counts are estimated, describe reclaim as approximate.

Typical Flow

  1. Call context-manifest-get with the active threadId.
  2. Sort segments by tokenCount and inspect large stale Tool results or Files read entries.
  3. Call context-pin for essential specs or user instructions.
  4. Call context-evict for large irrelevant segments.
  5. Offer context-restore if the user wants undo.
常见问题

隐藏某部分会删除对话吗?

不会。隐藏是可以撤销的,对话历史从不会被删除。

固定有什么作用?

它会在之后的回复中保留该部分上下文,因此在对话被压缩时不会丢失。

我能撤销修改吗?

可以。恢复某个片段会撤销固定、隐藏或摘要的更改。

详情

作者的原始描述

Inspect and manage the live agent context window with Context X-Ray. Use when context is getting large, the user asks what is in context, or stale tool results/files should be pinned, evicted, restored, or reported by an external host.

repo: BuilderIO/agent-native

热度

GitHub 星标
7.6k
排名
#13149
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能