agent-knowledge-framework AGENTS.md

A repository guide for AI agents working on agent-knowledge-framework, a structured collection of shared and role-specific notes, principles, skills, insights, and past experience. It explains how agents should load and update that knowledge.

In plain words
What is it for?
Loading role and project instructions, searching deeper guidance for risky tasks or errors, coordinating multiple agents, and recording lessons from completed work.
Why use it?
It helps agents find the right project guidance at the right time and preserve useful lessons after important work. It also requires write operations to happen in a separate worktree rather than directly on the main branch.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/st1page/agent-knowledge-framework/agents-md
Clone the repo
git clone --depth 1 https://github.com/st1page/agent-knowledge-framework

Made for: Codex, OpenCode.

Per session 1,462 This file is loaded in full into every session.
When invoked 1,462 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01462 $0.01462
Opus 5 $0.00731 $0.00731
Sonnet 5 $0.00292 $0.00292
Haiku 4.5 $0.00146 $0.00146

Measured 2d ago against content hash 8be5a7363b56, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

agent-knowledge-framework AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 111 lines

How it starts

The opening of the file, as written. The whole thing — 111 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Notes

每个 agent 在开始任何任务前,必须先通读本文件和角色 AGENTS.md,再开始动手。

仓库结构

agent-knowledge-framework/
├── base/                       # 通用知识(所有角色共享)
│   ├── experience/             # 不属于特定角色的经验
│   ├── principles/             # 通用原则和规范
│   ├── skills/                 # 通用技能(每个技能目录主入口为 SKILL.md)
│   └── insights/               # 通用洞察(跨角色的规律性认知)
└── roles/                      # 各角色目录
    ├── cli-tool-dev/          # CLI/TUI 工具开发
    ├── maintainer/            # 知识仓库维护
    └── <role>/
        ├── AGENTS.md          # 角色描述 + 知识索引(始终加载)
        ├── principles/        # 角色专有原则
        ├── skills/            # 角色专有技能
        ├── insights/          # 角色专有洞察
        └── experience/        # 角色经验复盘

知识加载与沉淀

  • 常驻 contextAGENTS.md(本文件)+ roles/<role>/AGENTS.md
  • 按需加载(分层):角色/目录 AGENTS.md 索引 → skill/principle/insight → experience(按 source 或 "Escalate to experience if" 升级)
  • 症状/高风险直达:出现特定报错或做迁移/发布/权限操作时,可直接用关键词检索 experience
  • Context 压缩后:如果你不确定索引内容或协作规则细节,说明 context 已被压缩,立即重新 Read 本文件 + 角色 AGENTS.md

详细的加载策略(常驻 vs 按需判断标准、experience 唤醒、摘要写法)见 base/principles/knowledge-loading.md

完成重要工作后(PR review 修复、跨层 bug 修复、首次跑通流程、踩坑),agent 应主动沉淀经验。知识分类(experience/skill/principle/insight)、存放位置判断、提炼流程和反模式,见 base/knowledge-sedimentation.md

多 Agent 协作规则

本仓库假定多个 coding agent 可能同时修改,所有写操作必须遵守以下规则。

Agent 工作中涉及两类仓库,规则同样适用:

  • Agent 目录(本仓库):存放角色知识、经验、技能文档
  • 工作目录(实际代码仓库)

1. 所有写操作必须在 worktree 中进行,禁止直接 push main

始终创建 worktree,不要在主工作目录中 git checkoutgit checkout -b 切分支。只读操作可以在 main 上进行。

常见违规模式(禁止)

  • git checkout -b <branch> 然后直接在主工作目录编辑——这不是 worktree,只是切了分支
  • "先写完再搬到 worktree"——一旦开始编辑就很难搬,必须一开始就在 worktree 里

正确流程

git fetch origin
git worktree add .claude/worktrees/<topic> -b <agent>/<topic> origin/main
cd .claude/worktrees/<topic>
# ... 编辑、commit ...
git push -u origin <agent>/<topic>

关键:永远基于 origin/main 创建 worktree,不要基于本地 main(可能过时)。详见 base/principles/git-worktree.md

检查点:执行任何 git checkout -b 或文件编辑前,先问自己"我现在在 worktree 里吗?"。如果 pwd 不包含 .claude/worktrees/,停下来,先创建 worktree。

Read the full file on GitHub · 111 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 111 lines · 1,462 tokens per session scan A 8be5a7363b56

Subscribe to this mod's changes

agent-knowledge-framework AGENTS.md is an instructions file published in the GitHub repository st1page/agent-knowledge-framework (41 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 1,462 tokens to every session, about $0.0073 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories