Skip to content

[FEATURE]:Support AGENTS.local.md as a personal local instruction override #872

Description

@MrSong9957

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Why this is needed (developer pain point)

Developers using or contributing to MiMo Code often want to add their own
instructions
— personal preferences, temporary experiments, or local/sensitive
config (API quirks, local paths) — without modifying the project's AGENTS.md.
Editing AGENTS.md pollutes PRs and affects the whole team; maintaining a fork
just for personal instructions is overkill.

Today MiMo Code has no mechanism for personal local overrides — any custom
instruction must go into the shared AGENTS.md / CLAUDE.md. This proposes a
.local.md layer (typically gitignored) that stacks personal instructions on top
of the project's instructions without touching the original repo.

Proposed loading logic

Add a .local.md override layer in systemPaths
(packages/opencode/src/session/instruction.ts), stacked on top of the existing
main instructions (AGENTS.md / CLAUDE.md, unchanged):

  • Candidates, in order: AGENTS.local.md, CLAUDE.local.md.
  • First-match-wins — only ONE is loaded: if AGENTS.local.md exists anywhere
    up the directory tree, it wins and CLAUDE.local.md is NOT loaded (mirrors
    AGENTS.md > CLAUDE.md for the main files). The two never stack together.
  • All ancestor matches of the winning candidate within the worktree are loaded
    (via the existing fs.findUp), then the candidate loop stops.
  • Gated behind the existing MIMOCODE_DISABLE_CLAUDE_CODE_PROMPT flag.

This aligns with Claude Code's four-tier memory model, where the personal local
tier is .local.md.
tier is .local.md.

Details

  • Location: packages/opencode/src/session/instruction.ts (systemPaths).
  • Draft implementation + tests ready as a PR if there's interest.

Searched open issues — none found for .local.md / AGENTS.local.md.


为什么需要(开发者刚需)

开发者在使用或向上游贡献 MiMo Code 时,经常想加入自己的指令——个人偏好、
临时实验、或本地/敏感配置(API 怪癖、本地路径)——又不想修改项目的
AGENTS.md
。改 AGENTS.md 会污染 PR、影响整个团队;为个人指令单独维护 fork
又太重。

目前 MiMo Code 没有任何个人本地覆盖机制——任何自定义指令都得写进共享的
AGENTS.md / CLAUDE.md。本提议增加一个 .local.md 层(通常 gitignored),把
个人指令叠加在项目指令之上,不碰原仓库

提议的加载逻辑

systemPathspackages/opencode/src/session/instruction.ts)新增 .local.md
覆盖层,叠加在既有主指令(AGENTS.md / CLAUDE.md,不变)之上:

  • 候选顺序:AGENTS.local.mdCLAUDE.local.md
  • first-match-wins,只加载其中一个:若树上任意位置存在 AGENTS.local.md,它
    胜出,CLAUDE.local.md 不加载(镜像主指令的 AGENTS.md > CLAUDE.md)。
    两者不会同时叠加。
  • 胜出候选在 worktree 内的所有祖先匹配都加载(复用既有 fs.findUp),随后候选
    循环停止。
  • 受既有 MIMOCODE_DISABLE_CLAUDE_CODE_PROMPT flag 门控。

这与 Claude Code 四层记忆模型对齐(个人本地层即 .local.md)。


实测效果

  1. 根目录仅有 CLAUDE.local.md
Image Image
  1. 新增 AGENTS.local.md ,与CLAUDE.local.md同时存在
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions