setup-agent: Codex, Junie and Claude Code overwrite each other's block in one AGENTS.md; the Junie block names tools other agents do not have

Abierto
#58 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
shell

Línea de trabajo

Start by running the reproduction steps in the issue: the three jbcontext setup-agent --scope project --instructions commands, watching the block between <!-- jbcontext-instructions-start --> and the end marker in AGENTS.md change each time. Then follow the setup-agent code path that resolves the project instruction file (including a CLAUDE.md symlink) and the per-agent instruction text written into it. Done means a shared target ends up with one order-independent, agent-neutral block — or setup warns that another agent already manages the file — plus a README.md note for updates.skip-agents-on-upgrade.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Version: jbcontext 0.9.21 (build 1593), macOS.

What happens

For --scope project, Codex and Junie CLI both use <repo>/AGENTS.md as the instruction file (setup-agent --dump-auto shows it). Each agent writes its own text between <!-- jbcontext-instructions-start --> and <!-- jbcontext-instructions-end -->, so whichever agent was set up last wins.

jbcontext upgrade refreshes every registered agent. As a result, after an upgrade the block inside a committed AGENTS.md can switch to another agent's variant, and AGENTS.md shows as modified in git status for everyone on the team who upgrades.

Many repositories also symlink CLAUDE.md -> AGENTS.md to keep a single instruction file across agents. Because setup-agent writes through an in-repository symlink, setting up Claude Code replaces the same block in AGENTS.md.

Since #56, the Junie block tells the agent to "use grep_search" and to "open the files it returns with open". When AGENTS.md is shared, Codex, Claude Code and other agents read these instructions too, and they have no tools with those names.

Steps to reproduce

git init demo && cd demo
echo "# Project rules" > AGENTS.md
ln -s AGENTS.md CLAUDE.md
jbcontext setup-agent --agent codex  --scope project --instructions --non-interactive
jbcontext setup-agent --agent junie  --scope project --instructions --non-interactive
jbcontext setup-agent --agent claude --scope project --instructions --non-interactive

After each command, AGENTS.md contains one pair of markers, but its content and checksum change three times: first the Codex block, then the Junie block with grep_search and open, then the Claude Code block. The symlink stays intact.

Expected

When several registered agents resolve to the same instruction file (directly or through a symlink), the file gets one block that does not depend on the order of setup and does not name tools of one agent only. Two possible ways:

  1. Write one agent-neutral block when the target is a shared file such as AGENTS.md.
  2. Keep AGENTS.md agent-neutral and put agent-specific tool hints in files that only that agent reads.

At a minimum, setup-agent could warn when the target file is already managed for another agent.

Workaround

We commit .jbcontext.json with "skipAgentsOnUpgrade": true (written by jbcontext config set --shared updates.skip-agents-on-upgrade true) and maintain the AGENTS.md block by hand. The v0.9.12 release notes mention this setting, but README.md does not; a line there would help other teams that commit AGENTS.md.

Lenguaje dominante
Shell
Estrellas
38
Forks
4
Merge medio
5 h 26 min
PR fusionados (30 d)
5

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de JetBrains/context

Todos los issues de JetBrains/context

Issues similares

Más issues de Shell/Bash

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.