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

Aperta
#58 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
shell

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Shell
Stelle
38
Fork
4
Merge medio
5h 26m
PR unite (30g)
5

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di JetBrains/context

Tutte le issue di JetBrains/context

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.