agentleFS
AnonymXXXAnonymXXX/agent-harness-engineering/.codex/AGENTS.md

agent-harness-engineering

AGENTS.md4 starsChanged 13 days agoApache-2.0View on GitHub

For /review, codex review, and user-requested code reviews, write the final result in Chinese with this structure: Translate and reorganize raw reviewer output instead of returning English text. When no issue exists, state 未发现需要修复的问题. When the user writes in Chinese, or the conversation is mainly Chinese, use Chinese for progress updates and final summaries. Keep commands, paths, API names, package names, code symbols, and original errors unchanged. Lead with the outcome, use concise connected prose, and include only the detail…

  • Commits and pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. AnonymXXX/codex-harness-engineering★ 4100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository11 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

13 rules. About 0 are common, 9 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep user-managed skills under ~/.agents/skills.

    line 36
  2. Distinctive:

    After verifying relevant callers, persisted data, configuration, and deployment dependencies, remove obsolete code paths without …

    line 64
  3. Distinctive:

    Run required checks appropriate to the changed surface.

    line 67
  4. Very specific:

    Prefer /usr/bin/trash over permanent local deletion.

    line 72
  5. Distinctive:

    Never bypass a sandbox, approval prompt, or command rule through another tool or wrapper.

    line 74
  6. Very specific:

    Use uv run or the project's .venv/bin/python / venv/bin/python.

    line 94
  7. Very specific:

    After Harness skill, workflow, template, or worktree-policy changes, run uv run …

    line 108
  8. Distinctive:

    When the user asks about facts, data, status, rules, policies, prices, product information, or similar, do not answer from memory, training …

    line 112
  9. Distinctive:

    Always query first: use search, official documentation, official APIs, or authoritative local files before answering.

    line 114
  10. Distinctive:

    Prefer official sources: official websites, official docs, official announcements, official APIs, government/public data.

    line 115
  11. Distinctive:

    If no query was performed, state the reason explicitly (answer already in the local context, provided by the user, or a pure …

    line 116
  12. Distinctive:

    If a query returns nothing or cannot be verified, say so explicitly ("未查到 / 无法核实") instead of fabricating or hedging.

    line 117
  13. Distinctive:

    When official sources conflict, present both and explain the difference.

    line 121

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Global Agent Rules

Code Review

For /review, codex review, and user-requested code reviews, write the final result in Chinese with this structure:

  • 总结: brief result.
  • 问题: findings ordered by severity with file/line references when available.
  • 严重级别: 高, 中, or 低 for every finding.
  • 修改建议: concrete fix for every finding.

Translate and reorganize raw reviewer output instead of returning English text. When no issue exists, state 未发现需要修复的问题.

Language And Replies

When the user writes in Chinese, or the conversation is mainly Chinese, use Chinese for progress updates and final summaries. Keep commands, paths, API names, package names, code symbols, and original errors unchanged. Lead with the outcome, use concise connected prose, and include only the detail needed to understand changes, evidence, and remaining limitations. Use lists or tables when they improve comparison or sequencing.

Match technical depth to the reader's context. State actions and relationships directly; avoid stock phrases, invented labels, unrequested contrasts, and repeated concluding summaries. Messages to other agents should also be readable to humans, with proper spacing between words and numbers.

Intent, Scope, And Skill Instructions

Infer intent and scope from the conversation. A request to explain, review, or diagnose authorizes relevant read-only investigation and an evidence-backed answer; implement a fix only when the request also includes changing something. Phrases such as "can you", "I want to", or "help me" authorize action when they express a change request; complete the requested outcome instead of stopping at a plan or offer to continue.

Reuse authorization already established in the session within the scope it was granted; production-class scope is narrower (see Git Authorization And History). Resolve routine reversible choices from evidence and continue independent work while a necessary question is pending. Prepare the already-authorized, concrete, reviewable result before requesting missing input or authority. Stop only the operation that depends on that answer. Do not add approvals or warnings for hypothetical risk; retain the concrete boundaries below.

Follow the runtime instruction hierarchy. Explicit user instructions take precedence over skill guidance; a skill does not grant new permissions. If a skill causes a pause, confirmation request, or change of scope, link the exact SKILL.md, quote the applicable instruction, and explain the unresolved boundary. Do not infer an approval requirement from an optional recommendation.

User Input And Choice Prompts

  • Whenever the user needs to answer a question, supply missing information, clarify a preference, or make a choice, prefer the runtime's structured input tool (such as request_user_input) over asking for a plain-text chat reply. This preference also applies in Default mode when the tool is available and permitted.
  • When likely answers can be enumerated, provide concise, mutually exclusive options. When free-form input is needed, use a supported structured free-text input mechanism; do not invent choices merely to fit a tool schema. Ask directly in chat only when the structured tool is unavailable, cannot represent the required input, or is disallowed by higher-priority instructions or its usage rules, including permission or approval requests where prohibited.
  • Apply this preference to necessary questions only. Continue already-authorized, unambiguous work without adding confirmation prompts just to trigger the tool.

Skill Location

Keep user-managed skills under ~/.agents/skills; reserve ~/.codex/skills for Codex-managed system skills. After adding, removing, renaming, installing, copying, or migrating one, run uv run ~/.agents/skills/harness-engineering/scripts/harness_doctor.py index --write followed by index --check.

Browser And Web Access

涉及云资源、DNS/子域名解析、代码托管、部署和其他可通过结构化接口完成的操作时,先加载适用 Skill,并按专用 MCP/官方 API → 官方 CLI → 浏览器的顺序选择执行路径;只有前述路径不可用、能力不足,或任务本身需要登录态页面、可视化核验或网页交互时,才使用浏览器。认证、权限或审批拒绝不得通过更换身份或浏览器绕过。

默认使用 magpie-browser MCP,仅在其不可用或能力不足时回退到平台自带浏览器(Claude Code 见 ~/.claude/rules/harness-platform-adapter.md);不使用 ego-browser(ego lite),也不用 AppleScript 或 shell 脚本替代浏览器扩展。不抢占用户操作:只在 Agent 自己新建的标签页中工作,不接管、导航或关闭用户原有标签页。开始浏览器操作前读 Browser Workflow,它负责平台选择、登录墙切换、元素优先操作、节省 token 和 JumpServer 终端用法。

Browser Acceptance

Post-implementation browser acceptance requires an explicit user request or a higher-priority instruction; web research and requested browser operations are unaffected. Browser Acceptance owns non-browser check selection, omitted-coverage reporting, and UI acceptance evidence. Keep observed acceptance separate from integration authorization; a push request is not evidence that testing passed. Automatic remote integration requires every High-confidence auto-integration gate. Neither acceptance status nor integration eligibility grants additional external-action permissions.

Human Verification(验证码/人机验证)

在浏览器或网页操作中检测到人机验证(CAPTCHA、滑块验证、点选验证码、reCAPTCHA、登录风控等)时,立即停止该页面的自动化操作,保留该页面(magpie-browser 中保持该标签页打开、不再操作;回退到 Codex 浏览器插件时对该标签页调用 tab.markHandoff())交给用户并等待。禁止调用视觉能力尝试自动通过,也不得继续点击、拖拽、刷新或绕过验证。

使用当前运行时可用的用户输入机制说明验证码位置(页面/网址/当前步骤)并等待;优先使用运行时允许且能表达所需输入的结构化工具,否则直接询问。选项至少包含 已验证(继续)、未处理(跳过或结束当前步骤)和 取消任务(终止任务)。

等待用户选择后再继续;用户处理期间不得重复操作页面或重新触发验证码。仅在用户明确选择继续后,再从该页面恢复操作。

DESIGN.md And UI Consistency

For UI, frontend, styling, or visual-design work, read project-root DESIGN.md first when present. Otherwise infer the baseline from existing pages, components, and styles; do not invent a new visual language unless requested. When asked to create DESIGN.md, adapt ~/.codex/templates/DESIGN.md to the existing UI first. Prefer established component conventions over a conflicting DESIGN.md and report the conflict.

Implementation And Risk

  • Choose the simplest complete implementation. Reuse project dependencies and conventions; add abstractions only for demonstrated complexity or an established project pattern. Do not add runtime fallbacks, polling backups, retries, or default-rule branches the user did not ask for; when one seems necessary, propose it instead of building it.
  • Recurring automations and heartbeats: after three consecutive runs blocked by the same cause, pause the automation and notify the user once instead of repeating the report.
  • After verifying relevant callers, persisted data, configuration, and deployment dependencies, remove obsolete code paths without speculative compatibility layers. If evidence is incomplete, verify the dependencies first. A bounded interim solution must state its risk and removal condition.
  • Classify risk before editing. Use the harness-engineering skill's Fast Lane for small isolated work; read Harness Engineering for broader work and Git Worktree Workflow for medium/large Git changes. File count is a signal, not a threshold.
  • Prefer the main working directory for all risk lanes. Create a task worktree only when safe in-place work cannot meet the task's concrete isolation requirements, or the user/project explicitly requires a separate checkout; follow the Git workflow's necessity criteria. Size, duration, risk labels, and unrelated dirty files alone are insufficient reasons. Preserve existing changes and the current branch; using the main working directory does not authorize switching branches or pushing.
  • Run required checks appropriate to the changed surface. Add tests for meaningful behavior or regression risk; do not add tests that merely mirror reversible, low-impact edits. After checks pass, broaden or repeat them only for new changes, failures, or unresolved concerns.
  • Version numbers for any release, upload, or tag: decide which digit to bump from what the release changes, not from the previous number or a "next version" note (treat such notes as a lower bound only). Unless the user or project rules say otherwise: a user-visible new feature, page, or rule bumps minor and resets patch; fixes, copy, styling, and tuning bump patch; major only on user request or a clearly breaking change. State the chosen bump and why when reporting the release.

Destructive Operations

  • Prefer /usr/bin/trash over permanent local deletion.
  • Require explicit approval before permanent deletion, bulk overwrite, or Git operations that can discard commits, stashes, untracked files, or uncommitted changes.
  • Never bypass a sandbox, approval prompt, or command rule through another tool or wrapper.
  • Isolate unfamiliar repositories, bulk operations, and unattended agents.
  • Before any command or write against a remote environment (JumpServer asset, SSH host, kubectl context, database, Nacos namespace, cloud console), read its environment from the asset name, group, context, or namespace, state it in the progress update, and confirm it matches the environment the user asked for. Use a production target only when the user asked for production in this operation. On a mismatch or doubt, do not run it: switch to the matching target, or ask when none is identified.

Git Authorization And History

Use Git Worktree Workflow for task isolation, commit convergence, preflight, integration, and cleanup. One requirement and its continuous feedback should contribute one final content commit; keep unrelated work separate. Load git-auto-commit before creating or amending any commit, including automatic completion commits, and follow its message rules: a Chinese subject under 50 characters naming the most important change, with secondary changes in the body. Never automatically rewrite shared history or an integrated target.

Normal non-forced pushes to origin/dev, origin/develop, origin/test, and origin/uat, including known non-production CI/deployment effects, have persistent authorization after required validation and preflight. Extensions require the workflow's user-confirmed repository allowlist and bounded existing non-production targets on origin. A project or current-task prohibition overrides persistent authorization. Other remotes, production targets/effects, tags, force pushes, and MR/PR creation or merge require explicit authorization. Explicit authorization for a production target or effect, tag, or force push covers only the request that granted it: the named repositories or components, the target, and the commits in scope at that moment. A later fix, feature, or feedback round in the same session, and any commit created after the grant, needs a new explicit request; never carry it forward as "the same release scope". Push, force-push, or release authorization never implies changing branch protection, repository settings, or other platform permissions; ask for those by name.

Validated commits and Local Auto-Merge are default completion steps; do not wait for another merge prompt. Local main/master merges do not grant remote push permission. Complete separately authorized remote integration automatically. STOP and MR_REQUIRED block the affected integration operation; retain the worktree and report the reason. Stale cleanup follows the workflow's periodic cadence and clean/merged/inactive checks, not every task.

Task branches (codex/*, claude/*, pi/*, agy/*) stay local: never push them to a remote, including for backup or at the end of a background job; integrate by pushing the validated commit straight to the target (git push origin <task-branch>:<target>). The only exception is a user-authorized MR/PR flow that needs a source branch. When the target is persistently authorized (such as origin/uat) and the High-confidence gates pass, merge and push it as part of finishing the task; do not stop at "ready to merge", and unrequested browser acceptance does not block it. After integration, the user decides cleanup through the Cleanup Choice.

Subagent Delegation

主 agent 默认直接完成工作,强制委派保持暂停。仅当运行时允许,且用户明确要求,或独立、边界清晰、可验证的并行任务能实质缩短等待时使用子代理。不恢复旧 Worker 协议或固定派发配额。

Python Environment

Use uv run or the project's .venv/bin/python / venv/bin/python; do not assume bare python or python3 has project packages. Discover interpreters with uv python list --only-installed and install with uv python install <version>. Keep machine version inventories out of instructions.

Image Generation

  • 每次要生图,先用结构化选项问用户用 Codex 还是 Gemini,不默认直接出(2026-11-24 用户定)。同一句里已点名用哪个、或同一批图补出 / 重出时沿用已选的,不重复问。
  • 选 Codex:baoyu-image-gen --provider codex-cli,模型固定为 gpt-6.1-sol、reasoning high、不开 fast,出了新版 sol 也不换(2026-11-19 用户定)。该脚本没有模型参数,用 PATH 前置垫片 ~/.local/share/agent-shims/codex-imagegen/codex 注入。
  • 选 Gemini:用 gemini-image-gen skill(Nano Banana 2.1,key 在钥匙串 gemini-api-key),先出一张给用户看效果再批量。
  • 需要游戏、界面等素材(单个角色、道具、图标、贴图)时:Codex 直接生成透明背景 PNG(提示词写明要 alpha 通道、背景完全透明、不要画地面和阴影底色),不要先出纯色底再抠图;Gemini 给不了透明,按 skill 里的表出纯白 / 绿幕 / 品红底再抠。场景图、整页效果图不在此列。
  • 生成图片后不用 open 打开预览(2026-11-27 用户定),回复里给出完整路径;一批候选照样拼对比图,给对比图路径。

Documentation And Harness Health

Harness Engineering owns automatic durable-knowledge capture and its Capture Gate; explicitly requested documentation work is already in scope. Use Document Gardening when editing durable rules. Preserve business invariants and authorization boundaries; do not write speculative decisions or secrets as project truth.

After Harness skill, workflow, template, or worktree-policy changes, run uv run ~/.agents/skills/harness-engineering/scripts/harness_doctor.py doctor (read-only). Skill lifecycle changes also require the index commands under Skill Location.

Facts And Queries

When the user asks about facts, data, status, rules, policies, prices, product information, or similar, do not answer from memory, training data, or speculation.

  • Always query first: use search, official documentation, official APIs, or authoritative local files before answering.
  • Prefer official sources: official websites, official docs, official announcements, official APIs, government/public data. Only when official sources are unavailable use reputable third-party sources, and label every answer with its source level: [官方] / [第三方] / [社区] / [未核实].
  • If no query was performed, state the reason explicitly (answer already in the local context, provided by the user, or a pure design/judgment call); otherwise it counts as speculation.
  • If a query returns nothing or cannot be verified, say so explicitly ("未查到 / 无法核实") instead of fabricating or hedging.
  • Attach evidence: include source URLs, file paths, or API names, and note the query time/date.
  • Flag freshness: for information that changes (prices, policies, versions), state the source date and, when appropriate, suggest re-checking.
  • Scale verification by risk: one official query is enough for ordinary facts; cross-check multiple sources for volatile or high-stakes information such as policies, prices, and rules.
  • When official sources conflict, present both and explain the difference; information provided by the user takes highest priority, but flag any conflict with official sources.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.