Problem
Fixes #379 introduced the wrong attribution for global_memory / global_prompt output.
Issue #379 described missing AGENTS_OUTPUT_ADAPTOR handling, but the follow-up implementation interpreted that as: when AgentsOutputAdaptor is registered, project-level memory files should switch to global_memory.content.
That is incorrect. aindex/global.mdx is a user/global prompt source, not a project prompt source. It must not be written into project roots such as:
<project>/AGENTS.md
<project>/CLAUDE.md
<project>/.opencode/AGENTS.md
Expected behavior
global_prompt / aindex/global.mdx should only be emitted to each tool's global/user-level memory location:
- Codex:
~/.codex/AGENTS.md
- Claude Code:
~/.claude/CLAUDE.md
- OpenCode:
~/.config/opencode/AGENTS.md
Project-level files should continue to use project/workspace memory prompts, for example aindex/app/<project>/agt.mdx, child agt.mdx, or workspace prompt behavior where explicitly designed.
Incorrect current behavior
The current code paths explicitly write context.global_memory.content into project-level outputs when AgentsOutputAdaptor is registered:
sdk/src/domain/output_plans/codex_output_plan.rs
- Writes
global_memory.content to <project>/AGENTS.md
sdk/src/domain/output_plans/claude_code_output_plan.rs
- Writes
global_memory.content to <project>/CLAUDE.md
sdk/src/domain/output_plans/opencode_output_plan.rs
- Writes
global_memory.content to <project>/.opencode/AGENTS.md
The inline comments saying Fixes #379 are therefore misleading and should be corrected or removed.
Suggested fix
- Keep global prompt output only at tool-global paths:
- Codex
~/.codex/AGENTS.md
- Claude
~/.claude/CLAUDE.md
- OpenCode
~/.config/opencode/AGENTS.md
- Stop writing
global_memory.content into project-level memory files.
- Rework the
AgentsOutputAdaptor interaction so enabling agentsMd does not cause other tool output plans to replace project memory with global memory.
- Add regression tests proving
aindex/global.mdx is absent from project-level AGENTS.md, CLAUDE.md, and .opencode/AGENTS.md.
Related
Problem
Fixes #379introduced the wrong attribution forglobal_memory/global_promptoutput.Issue #379 described missing
AGENTS_OUTPUT_ADAPTORhandling, but the follow-up implementation interpreted that as: whenAgentsOutputAdaptoris registered, project-level memory files should switch toglobal_memory.content.That is incorrect.
aindex/global.mdxis a user/global prompt source, not a project prompt source. It must not be written into project roots such as:<project>/AGENTS.md<project>/CLAUDE.md<project>/.opencode/AGENTS.mdExpected behavior
global_prompt/aindex/global.mdxshould only be emitted to each tool's global/user-level memory location:~/.codex/AGENTS.md~/.claude/CLAUDE.md~/.config/opencode/AGENTS.mdProject-level files should continue to use project/workspace memory prompts, for example
aindex/app/<project>/agt.mdx, childagt.mdx, or workspace prompt behavior where explicitly designed.Incorrect current behavior
The current code paths explicitly write
context.global_memory.contentinto project-level outputs whenAgentsOutputAdaptoris registered:sdk/src/domain/output_plans/codex_output_plan.rsglobal_memory.contentto<project>/AGENTS.mdsdk/src/domain/output_plans/claude_code_output_plan.rsglobal_memory.contentto<project>/CLAUDE.mdsdk/src/domain/output_plans/opencode_output_plan.rsglobal_memory.contentto<project>/.opencode/AGENTS.mdThe inline comments saying
Fixes #379are therefore misleading and should be corrected or removed.Suggested fix
~/.codex/AGENTS.md~/.claude/CLAUDE.md~/.config/opencode/AGENTS.mdglobal_memory.contentinto project-level memory files.AgentsOutputAdaptorinteraction so enablingagentsMddoes not cause other tool output plans to replace project memory with global memory.aindex/global.mdxis absent from project-levelAGENTS.md,CLAUDE.md, and.opencode/AGENTS.md.Related
Fixes #379behavior is the wrong attribution for global prompt placement.