atomcode: Instructions file for Codex

AGENTS.md

atomcode AGENTS.md is an instructions file for Codex, OpenCode from atomgit-atomcode/atomcode. It costs 4,932 tokens per session, scanned A, original, MIT.

A project instruction document describing the current architecture, development boundaries, and rules for an AtomCode coding agent. It is written in Chinese and covers components such as the command-line tool, terminal interface, background service, and runtime.

In plain words
What is it for?
Use it when designing or modifying the listed Rust crates, runtime and session code, command and event handling, protocols, saved data formats, approvals, security boundaries, or cross-crate dependencies.
Why use it?
It gives developers a shared reference for changing sensitive parts of the system without relying on outdated migration notes or accidentally creating duplicate runtime lifecycles.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions Claude Code.

This is atomgit-atomcode/atomcode's own configuration. It tells Codex and OpenCode how to work on atomcode itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything atomcode configures →

Reuse

Borrowing it

Nothing to install: this file belongs to atomgit-atomcode/atomcode. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/atomgit-atomcode/atomcode/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/atomgit-atomcode/atomcode

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for atomcode AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/atomgit-atomcode/atomcode/agents-md/github.svg)](https://agentmods.dev/instructions/atomgit-atomcode/atomcode/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/atomgit-atomcode/atomcode/agents-md"><img src="https://agentmods.dev/badge/instructions/atomgit-atomcode/atomcode/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for atomcode AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/atomgit-atomcode/atomcode/agents-md"><img src="https://agentmods.dev/badge/instructions/atomgit-atomcode/atomcode/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,932 This file is loaded in full into every session.
When invoked 4,932 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.04932 $0.04932
Opus 5.5 $0.01973 $0.01973
Sonnet 5.5 $0.00986 $0.00986
Haiku 4.5 $0.00493 $0.00493

Measured 4d ago against content hash 0eca7efd6278, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

atomcode 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 4d 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 · 156 lines

How it starts

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

项目全局开发约束

适用范围与使用方式

本文件记录当前架构边界和长期开发约束,不再承担历史迁移进度报告的职责。历史方案、旧基线和已完成的 bridge 退役过程应留在 docs/,不得继续作为当前实现前提。

涉及以下范围时,设计或修改前必须先核对当前代码、调用方和近期 Git 历史:

  • crates/atomcode-kernel/;
  • crates/atomcode-capabilities/;
  • crates/atomcode-coding/ 的 runtime、provider、session、controller;
  • CLI、TUI、daemon、ACP 的 runtime、session、command/event 接入;
  • daemon 中保留的历史 core JSON 单向 importer 与兼容 DTO;
  • 公共协议、持久化格式、审批、安全边界或跨 crate 依赖方向。

本文件描述的是约束,不是永远正确的现状快照。若约束中的事实与当前代码冲突,以当前代码为准;先说明差异,再修正文档或实现,不得按旧路径盲目补代码。

当前架构事实

当前 coding agent 的目标调用链是:

CLI / TUI / daemon / background / ACP code
                    │
                    ▼
       CodingRuntimeHandle / DriverCommand
                    │
                    ▼
               CodingRuntime
                    │
                    ▼
          atomcode-kernel Agent
  • CodingRuntime 是 coding agent 的运行时所有者;driver 不应重新持有或重建第二套 live agent 生命周期。
  • kernel AgentCommand/AgentEvent 是运行时执行边界。coding 产品 driver 应使用 CodingRuntime;其他业务 driver 可以驱动其 L2 已装配的 kernel agent,但不得另建第二生命周期 owner,也不得把 provider、session、cd、goal、loop 等 coding 生命周期重新塞进 kernel 命令。
  • core legacy AgentClient/AgentCommand/AgentEvent、v1 engine 和 atomcode-bridge 已退役。不得重新引入 bridge、双 endpoint、v1/v2 选择开关或 core driver fallback。
  • atomcode-kernel、atomcode-capabilities、atomcode-coding 的生产依赖必须保持 core-free;尤其禁止 capabilities 反向依赖 core、L2 或前端。
  • native SessionManager 是唯一 session 存储(SessionMeta 索引、PresentationFile 等旁挂);会话内容是 kernel session 词汇的事件日志,SessionSnapshot 只是它的投影读法(见下一条与 0024);core session 模块与持久化 API 已退役。历史 core JSON 只允许由 daemon 私有 DTO 单向导入,禁止恢复 legacy writer、core 磁盘投影或双向持久化转换。
  • atomcode-core crate 已从 workspace 删除;生产代码不得重新依赖或重建同名兼容层。历史 core JSON 只由 daemon 私有 DTO 单向导入。
  • coding 的装配只有一套:parts::prepare 建能力图,runtime::mount 挂成 plexus 行清单(on_harness + host_rows)。手写的 kernel 中间件/钩子链(parts::assemble / build_coding_agent)与 ATOMCODE_ENGINE 开关已删除,不得重建第二套装配或引擎选择开关。链式当年的事件流录在 crates/atomcode-coding/tests/golden/differential/,差分台对着它回归;那些 golden 不可重录(录它的引擎已经没了),要改就改文件本身并在 commit 里说明理由。
  • coding runtime 里会话的唯一权威是 harness 事件日志(docs/adr/0024-the-session-log-is-the-authority.md):SessionManager 存事件格式会话——<id>.events(头一行 + 每条事实 {seq, at, event},流式片段不落盘)与 <id>.index(元数据,提交点),旁挂 .ui / .rewind / .rewind.txn / .todos;文件名一律避开已发布版本扫描的后缀,回滚不会读到半个会话。日志由 coding 的 session-store 行(coding/src/session_store.rs,host 把它 swap 进 session-persistence-jsonl 的位置,排在建 agent 的行之前)在 runtime 持有的租约下逐条同步追加,第一次写失败即停(上报 uncertain commit,runtime fail-close),之后一条都不再写;session-native 的 resume 就是重放这份日志,不得回退到快照或任何别的来源。撤销 / rewind / 恢复是追加事实(Rewound,目标不是已有前缀时整段撤回再提交目标对话,SessionManager::append_conversation_change),不重写日志;唯一的例外是重建失败时回滚自己刚追加、尚无 agent 读过的那段(truncate_events)。已发布版本存成快照的会话在打开时读时转换一次(open_for_resume / open_as_events),旧文件加 .migrated 挪开、不删。SnapshotHook / TranscriptHook 对事件会话只写索引与旁挂,不写快照与 transcript。harness 自己的 JSONL 行在本产品里关闭;sessions/harness/ 下的旧 journal 不读。
    • 读者:recall / /worklog 用 events::turn_records 从日志折出每回合记录(撤回的回合标 undone),网页历史读日志里的回合时间,Claude Code hooks 的 transcript_path 指向 <id>.events;TranscriptHook 已删。daemon 的无状态撤销与压缩也是追加事实(plan_conversation_change),每回合统计按 visible_turns 取舍。人取消时半截回复是 PartialReply 事实。索引记 format_version,比本构建新的会话在目录里标 needs_newer_version、拒绝 resume;读到不认识的事件种类同样按「更新的版本」拒读。
    • 团队成员与 task 子 agent 的会话同样落盘:各是一个事件会话,存成 storage_id(<lead>/<name> 的 / 换成 ~),索引记 parent,所以目录 / picker / --continue / recall 都不列、单独打开被拒、删 lead 时连带删;session-store 在 agent 创建时给它取一份自己的租约、移除时放掉,取不到就不让它运行。成员的创建参数在日志头 member 里,stop 等成员空闲后提交 Stopped 再移除;resume lead 时 team 行按 children(lead) 把没有 Stopped 的成员带回(角色按当前定义重算)。判据:harness/tests/team.rs 的 a_resumed_lead_brings_back_the_members_it_did_not_stop 等、coding/tests/runtime_criteria.rs::a_team_is_kept_and_comes_back_with_its_lead、capabilities 的 a_delegated_session_is_kept_under_its_parent。
  • describe_self 告诉模型的每一句都由实现那件事的行(或读 patch/flag 的启动器)经 self_knowledge::describes / describes_live 登记,self_knowledge 自己不假定挂了哪些行、不替任何领域开专用注册表。替换掉一行(swap/disable)就要接过它该说的话:session-native 描述原生会话、skills-host/mcp-host 描述 SKILLS/MCP、model 行描述 /model 都是这么来的。工具自己的 description() 每次请求都会发给模型,不要再为工具往 describe_self 里写第二份;describe_self 只补工具描述覆盖不到的:会话、人如何添加/配置能力、前端命令、配置文件(身份已在系统提示里由 persona 行说,不重复)。config.toml 的说明写在读它的代码旁边(coding/src/config.rs::describe_config_file,由 config-file 行登记;可安全编辑的设置目录由 atomcode_config::settings::describe_catalog 渲染)。判据在 harness/tests/self_knowledge.rs 与 coding/tests/runtime_criteria.rs 的 the_agent_is_told_where_its_session_really_is、a_capability_the_runtime_mounts_itself_still_describes_itself、a_runtime_configured_from_a_file_describes_the_file。
  • 凭据(API key、token)绝不进入行配置:配置树是可打印的数据(dump_runtime 原样渲染每行 config),也绝不进入 describe_self 的任何回答。需要凭据的行由宿主注册一个持有凭据的插件实例并 swap 过去(tool-web-keyed 是范例)。判据 coding/tests/mount_wiring.rs::a_configured_credential_never_enters_the_config_tree。
  • 产品目录是宿主交进来的数据:库(kernel/capabilities/coding/harness 行/review/auth/codingplan/tui)不写 .atomcode 字面量、不读 ATOMCODE_HOME,只收 atomcode_capabilities::ProductDirs(或从它取出的目录);harness 行经 product-dirs 缝取(atomcode_harness::product_dirs(ctx))。解析环境只在宿主:atomcode_coding::config::product_dirs_from_env()。名字只在 atomcode-config/src/distribution.rs 写一次,gates/product-dir.sh 基线为 0。判据 coding/tests/runtime_criteria.rs::a_runtime_under_another_name_keeps_to_its_own_dirs。
  • daemon/TUI 的 live/provider/UI 投影必须直接使用 kernel/coding 中立类型;持久化读取必须先得到严格 native 聚合。不得借转换层恢复旧 engine 命令、第二 runtime owner、core session 磁盘模型或静默 fallback。

Read the full file on GitHub · 156 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. 4d ago Changed · -80 lines · -2,907 tokens per session 0eca7efd6278
  2. 25d ago Changed · +109 lines · +5,315 tokens per session 8967d174e5e6
  3. 1mo ago Changed · +3 lines · +228 tokens per session 7af8cd95f96e
  4. 1mo ago First seen · 124 lines · 2,296 tokens per session scan A 6561acc7978d

Subscribe to this mod's changes

atomcode AGENTS.md is an instructions file published in the GitHub repository atomgit-atomcode/atomcode (206 stars, last pushed today), licensed MIT. It adds 4,932 tokens to every session, about $0.0197 per session on Opus 5.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

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,581 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deno copilot-instructions.md

Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.

denoland/deno · 3,077 tokens