feat: support personal local instruction overrides via .local.md#1127
Open
MrSong9957 wants to merge 1 commit into
Open
feat: support personal local instruction overrides via .local.md#1127MrSong9957 wants to merge 1 commit into
MrSong9957 wants to merge 1 commit into
Conversation
Add a .local.md personal local instruction override layer in Instruction.systemPaths (packages/opencode/src/session/instruction.ts), stacked on top of the main AGENTS.md/CLAUDE.md (unchanged): - Candidates AGENTS.local.md / CLAUDE.local.md, first-match-wins (only one is loaded - AGENTS.local.md wins if present, CLAUDE.local.md is then skipped). - Gated behind the existing MIMOCODE_DISABLE_CLAUDE_CODE_PROMPT flag, and sits inside the MIMOCODE_DISABLE_PROJECT_CONFIG gate. - All ancestor matches of the winning candidate within the worktree are loaded via the existing fs.findUp. Includes a CLAUDE.local.md template as a reference for personal no-upstream-pollution constraints. Closes XiaomiMiMo#872
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #872
What
Adds a
.local.mdpersonal local instruction override layer inInstruction.systemPaths(packages/opencode/src/session/instruction.ts), stacked on top of the mainAGENTS.md/CLAUDE.md(unchanged):AGENTS.local.md/CLAUDE.local.md, first-match-wins (only one is loaded —AGENTS.local.mdwins if present,CLAUDE.local.mdis then skipped).MIMOCODE_DISABLE_CLAUDE_CODE_PROMPTflag, and sits inside theMIMOCODE_DISABLE_PROJECT_CONFIGgate (added upstream after feat: support personal local instruction overrides via .local.md #873).fs.findUp.Also adds a
CLAUDE.local.mdat the repo root as a reference template showing a personal "no-upstream-pollution" constraint (intentionally committed as an example; it does not affect the build).Motivation and full loading logic in #872.
Verification
bun test test/session/instruction.test.ts→ 13 pass / 1 todo / 0 fail (3 new.local.mdtests: stacking / CLAUDE.md fallback / first-match-wins; original 10 tests no regression)bun typecheck(@mimo-ai/cli) → cleanbun dev):CLAUDE.local.mdloads when noAGENTS.local.md; addingAGENTS.local.mdmakes it win andCLAUDE.local.mdis skipped.改动内容
在
Instruction.systemPaths(packages/opencode/src/session/instruction.ts)新增.local.md个人本地指令覆盖层,叠加在既有主指令(AGENTS.md/CLAUDE.md,不变)之上:AGENTS.local.md/CLAUDE.local.md,first-match-wins(只加载其中一个——若存在AGENTS.local.md则它胜出,随即跳过CLAUDE.local.md)。MIMOCODE_DISABLE_CLAUDE_CODE_PROMPTflag 门控,并位于 feat: support personal local instruction overrides via .local.md #873 之后上游新增的MIMOCODE_DISABLE_PROJECT_CONFIG门控之内。fs.findUp)。另外在仓库根目录新增
CLAUDE.local.md作为参考模板,示范一个个人"禁止污染上游"约束(作为示例提交,不影响构建)。动机与完整加载逻辑见 #872。
验证
bun test test/session/instruction.test.ts→ 13 pass / 1 todo / 0 fail(3 个新增.local.md测试:stacking / CLAUDE.md fallback / first-match-wins;原 10 个测试零回归)bun typecheck(@mimo-ai/cli)→ 无错误bun dev):无AGENTS.local.md时加载CLAUDE.local.md;加入AGENTS.local.md后它胜出,CLAUDE.local.md被跳过。