Files
nexus/wiki/concepts/AGENTS.md.md
2026-04-28 00:02:50 +08:00

41 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "AGENTS.md"
type: concept
tags: [opencode, ai, project-context, documentation]
sources: [如何在ubuntu上安装opencode并配置vibe-kanban]
last_updated: 2026-04-27
---
## Overview
**AGENTS.md** 是 OpenCode 等 AI 编程代理为项目自动生成的角色定义文件,包含项目结构、编码规范和最佳实践,帮助 AI 理解项目上下文,生成更准确、更符合团队风格的代码。
## Purpose
当运行 `opencode /init`OpenCode 会分析项目结构并自动生成 `AGENTS.md` 文件。该文件记录:
- 项目目录结构
- 编码规范和约定
- 使用的技术栈
- 项目的特殊要求或约束
## Best Practice
OpenCode 官方建议:**将项目的 `AGENTS.md` 文件提交到 Git 版本控制**。这样每次协作clone/checkout时 AI 都能获取最新的项目上下文,保证不同开发者、不同会话中 AI 行为的一致性。
## File Location
- 项目根目录:`<project>/AGENTS.md`
- 会被 OpenCode 自动加载,无需手动指定
## Related Concepts
- [[Vibe Coding]] — AGENTS.md 是 Vibe Coding 工作流中上下文固定的关键机制
- [[Plan Mode]] — Plan Mode 依赖 AGENTS.md 提供项目上下文
- [[Build Mode]] — Build Mode 依赖 AGENTS.md 保持编码风格一致
- [[OpenCode]] — AGENTS.md 由 OpenCode 的 `/init` 命令自动生成
## Aliases
- agents.md
- agents file
- 项目角色定义文件