- 开始使用
- 最佳实践
- 功能
- 技能
- CLI
- 示例
- 高级
- 帮助
为您的智能体提供项目上下文
智能体上下文文件,例如 Agents.md:一种持久性指令文件,可让您的 UiPath 项目约定在会话之间保持一致,并控制偏移。
每次会话时,您的编码智能体都会重新启动。如果没有一个长期的项目约定来源,相同的指令就会重复发生,当忘记指令时,智能体就会发生变化。上下文文件解决了此问题:智能体在会话开始时自动读取的文件,其中包含其每次应遵循的规则和约定。
为何需要上下文文件
在每个提示中重新输入约定,不仅速度慢,而且容易出错。上下文文件使这些指令具有持久性和一致性,因此智能体默认会遵循您的住宅风格,而不是猜测。
Agents.md,通用约定
AGENTS.md是一个新兴的跨工具约定:是项目根目录中的一个 Markdown 文件,编码智能体可以读取该文件以获取项目指令。某些智能体会改为查找自身的文件名,但无论确切的名称如何,概念是相同的。智能体自带的文档列出了所需的文件名和位置。
全局作用域和项目作用域
大多数智能体都支持两个级别的上下文:
- “全局”包含应用于每个项目的个人声誉偏好,例如您的默认 UiPath 组织和租户,或您的首选样式。
- 项目将特定于一个项目的约定保存在项目的上下文文件中,以便与存储库一起迁移,让整个团队受益。
组织范围内的规则属于全局上下文;特定于项目的规则位于项目文件中。
要在其中放置的内容
实用的上下文文件应简短具体。对于 UiPath 工作,有用的内容包括:
- 此项目的 UiPath 技能,以便智能体使用合适的技能(例如,
uipath-rpa用于机器人流程自动化 (RPA) 工作,或uipath-maestro-flow用于流程编排)。 - 常备质量规则,例如“在宣布工作已完成之前,始终运行工作流分析器并解决所有问题”。
- 首选和已固定的包,以及要支持或避免的活动(例如,相对于“调用代码”的原生活动)。
- 项目约定:命名、结构和您的团队遵循的模式。
- 智能体必须遵循的显式约束条件,例如不覆盖录制的用户界面工作流或现有配置文件。
UiPath 项目的缩写AGENTS.md可能如下所示:
# Project conventions
- Use the `uipath-rpa` skill for automation work in this project.
- Always run the Workflow Analyzer (Analyze Project) and resolve every problem before calling work done.
- Prefer native activities over Invoke Code; keep UI activities inside a Use Application/Browser scope.
- Pin package versions in project.json; do not upgrade packages without asking.
# Project conventions
- Use the `uipath-rpa` skill for automation work in this project.
- Always run the Workflow Analyzer (Analyze Project) and resolve every problem before calling work done.
- Prefer native activities over Invoke Code; keep UI activities inside a Use Application/Browser scope.
- Pin package versions in project.json; do not upgrade packages without asking.
有关值得在此处捕获的 RPA 特定约定,请参阅RPA 工作流。
Context files written by the UiPath skills
When the RPA skill works on a UiPath project that has no project context yet, or whose context is out of date, it discovers the project's structure, dependencies, and conventions and writes them to two files:
.claude/rules/project-context.md- The root
AGENTS.md, inside a block between<!-- PROJECT-CONTEXT:START -->and<!-- PROJECT-CONTEXT:END -->markers. Content outside the markers stays as you wrote it. If the markers are not present, the block is appended to the file.
For an empty or newly created project, the files are written after the first build. To refresh the project context at any time, ask the agent to regenerate it.
保持其最新状态
上下文文件的性能取决于其内容。过期的文件会悄悄地误导智能体,就像错误的注释会误导开发者一样,因此随着约定的变化,该文件值得修剪。