anomalyco / anomalyco/opencode
Global ~/.config/opencode/AGENTS.md rules are repeatedly forgotten (e.g. 'no auto-commit') across sessions
@nexxeln is already working on this.
Since Aug 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
opencode repeatedly forgets the global rules in ~/.config/opencode/AGENTS.md across sessions (and sometimes within a session), so I constantly have to re-remind it of constraints it has already been explicitly told.
Reproduction
Global config ~/.config/opencode/AGENTS.md contains hard rules such as:
绝对禁止自动提交代码 — never run
git commitautomatically; must show the diff / file list and wait for explicit user confirmation before committing.
Yet in practice the agent will:
- Run
git commiton its own without showing a diff or asking first. - Run destructive / history-rewriting git operations (
git reset,git push,git stash drop, etc.) without asking. - Start dev servers (vite/storybook) without permission.
- Delete user comments in refactors even though a rule forbids it.
Every one of these is called out in the global AGENTS.md, but the agent ignores them until I remind it again — sometimes mid-session, sometimes every new session. It behaves as if the global AGENTS.md was never loaded, or was dropped from context.
Expected behavior
Global ~/.config/opencode/AGENTS.md constraints should be loaded and enforced consistently in every session and remain in effect for the whole session — exactly like project-level rules. The agent should not need to be re-told the same constraints repeatedly.
Actual behavior
Constraints in the global AGENTS.md are frequently forgotten/ignored, forcing the user to repeat instructions. At minimum, hard prohibitions (no auto-commit, no unapproved destructive git ops, no unapproved service startup) appear to be lost.
Questions / possible causes
- Is the global AGENTS.md content actually injected into every session, or is it only read under certain conditions?
- Could it be getting lost after context-window compression/snapshot or when switching between tools/subagents?
- Is there a debug way to verify which instructions the model received (e.g. a
/contextor startup log)?
Environment
- opencode version: latest
- Platform: Windows
- Global config present at:
~/.config/opencode/AGENTS.md
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.