展示HN:意图层:一种用于AI代理的上下文工程技能
Show HN: Intent Layer: A context engineering skill for AI agents

原始链接: https://www.railly.dev/blog/intent-layer/

## 意图层:为AI代理提供“心理地图” Crafter Station 发布了“意图层”,一项旨在提高 Claude 和 Copilot 等 AI 代码助手可靠性的新技能。核心问题是:这些代理在处理大型代码库时经常遇到困难,由于缺乏对项目结构的理解,会浪费 token 并遗漏关键上下文——这是经验丰富的工程师随着时间推移而发展起来的能力。 意图层通过启用“上下文工程”,从系统提示基础设施开始来解决这个问题。它帮助开发者在文件夹边界处创建 `AGENTS.md` 文件,为代理提供关于代码的重要信息——其目的、关键文件和潜在陷阱——这些信息并非直接存在于代码中。 运行 `npx skills add crafter-station/skills --skill intent-layer` 会分析你的代码库,建议上下文节点位置,并指导文档编写。早期结果显示出显著的改进:token 使用量减少(例如,从 40k 减少到 16k),以及更快速、更准确的错误识别。 意图层是 Crafter Station 一系列上下文工程技能中的第一个,它建立在 Tyler Brandt 的“意图层”和 DAIR.AI/LangChain 的框架之上。

这个Hacker News讨论强调了构建可靠AI代理的关键问题:**意图漂移**。与其仅仅关注改进AI模型本身,核心问题往往在于代理的目标超出初始参数。 一位有实践经验的评论者发现,通过实施“**意图层**”取得了成功——明确定义并*限制*代理执行的每个步骤。这意味着每个动作都会声明其允许的范围、工具和有效输出,并在之后撤销这些权限。 虽然这种方法可能看起来不如允许代理自由行动灵活,但它大大提高了可预测性并减少了意外行为。这种方法类似于GTWY的运作方式,为代理对齐提供了一个实用的解决方案,而无需依赖复杂的提示或事后验证检查。本质上,清晰、循序渐进的意图管理对于构建值得信赖的AI代理至关重要。
相关文章

原文

Today I’m releasing /intent-layer, the first skill from Crafter Station .

npx skills add crafter-station/skills --skill intent-layer -g

Works with Claude Code, Codex, Cursor, Copilot, and 10+ more agents .

The Problem

I’ve been using Claude Code daily for months. Same model, same prompts, completely different results depending on the repo.

On a large codebase I watched Claude:

  • Burn 40k tokens exploring dead ends
  • Find mocked tests, outdated docs, random utilities
  • Miss the config file with the actual bug

Reasonable search. Wrong places. Bug still there.

Why This Happens

Your best engineers don’t grep randomly. They have a mental map:

  • What each folder owns
  • What breaks if you touch it wrong
  • Where the real logic lives

That map took years to build. Your agents don’t have it.

The Solution: Context Engineering

Context engineering is designing the full information an agent needs to perform reliably:

  • System prompts and instructions
  • Structured inputs and outputs
  • Tools and their definitions
  • RAG and memory systems

Intent Layer solves the first piece: system prompt infrastructure.

What Intent Layer Does

The skill helps you set up AGENTS.md files at folder boundaries. Simple markdown that gives agents the context they can’t get from code alone:

# Payment Service

## Purpose

Handles payment processing and settlement.
Does NOT own billing/invoicing (see billing-service).

## Contracts

- All processor calls go through src/clients/processor.ts
- Settlement config lives in ../platform-config/rules/

## Pitfalls

- src/legacy/ looks dead but handles pre-2023 accounts
- Test mode hits real sandbox. Charges appear then void.

Run /intent-layer on your project and it:

  1. Detects existing CLAUDE.md / AGENTS.md files
  2. Analyzes your codebase structure
  3. Suggests where to add context nodes
  4. Asks what patterns and pitfalls to document

Run it again later to audit existing nodes or find new candidates as your codebase grows.

Results

Same bug, with AGENTS.md in place:

  • 16k tokens loaded (not 40k)
  • Went straight to the config file
  • Found it first try

Try It

npx skills add crafter-station/skills --skill intent-layer -g

What’s Next

Intent Layer is the first of several context engineering skills I’m building. More coming soon.

Credits

Built on The Intent Layer by Tyler Brandt. His AI Adoption Roadmap maps the stages most teams are stuck at. Start there for the full methodology.

Context engineering framework from DAIR.AI and LangChain .

Also related to my earlier AI-First Manifesto where I proposed LLMS.md files. Intent Layer is the evolved version of that idea.


Follow @RaillyHugo for more on context engineering.

联系我们 contact @ memedata.com