


























结论(直接回答)
关键证据(源码片段 —— 我直接引用了仓库实现)
async def load_agents_md(work_dir: KaosPath) -> str | None:
paths = [
work_dir / "AGENTS.md",
work_dir / "agents.md",
]
for path in paths:
if await path.is_file():
logger.info("Loaded agents.md: {path}", path=path)
return (await path.read_text()).strip()
logger.info("No AGENTS.md found in {work_dir}", work_dir=work_dir)
return None
pub async fn load_agents_md(work_dir: &KaosPath) -> Option<String> {
let candidates = [
work_dir.clone() / "AGENTS.md",
work_dir.clone() / "agents.md",
];
for path in candidates {
if path.is_file(true).await {
if let Ok(text) = path.read_text().await {
info!("Loaded agents.md: {}", path.to_string_lossy());
return Some(text.trim().to_string());
}
}
}
info!("No AGENTS.md found in {}", work_dir.to_string_lossy());
None
}
@registry.command
async def init(soul: KimiSoul, args: str):
"""Analyze the codebase and generate an `AGENTS.md` file"""
...
agents_md = load_agents_md(soul.runtime.builtin_args.KIMI_WORK_DIR)
system_message = system(
"The user just ran `/init` slash command. "
"The system has analyzed the codebase and generated an `AGENTS.md` file. "
f"Latest AGENTS.md file content:\n{agents_md}"
)
...
def get_share_dir() -> Path:
"""Get the share directory path."""
if share_dir := os.getenv("KIMI_SHARE_DIR"):
share_dir = Path(share_dir)
else:
share_dir = Path.home() / ".kimi"
share_dir.mkdir(parents=True, exist_ok=True)
return share_dir
解释与补充
如果你需要「全局规则文件」的行为(可选实现/建议)
额外说明(检索说明)
如果你要我继续做
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。