Skip to content

feat: Advertise Repository Instructions by Default - #416

Merged
danny-avila merged 1 commit into
mainfrom
danny-avila/repository-instructions-default
Dec 4, 2026
Merged

danny-avila merged 1 commit into
mainfrom
danny-avila/repository-instructions-default

Conversation

@danny-avila

@danny-avila danny-avila commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Repository instruction discovery (#226) is opt-in: a worker advertises AGENTS.md/CLAUDE.md only when its librechat-code run command carries --repository-instructions. Workers started without that flag advertise nothing, so LibreChat, which has injected advertised instructions into an attached agent's context since v0.8.8, has nothing to load. Agents then fall back to shell-reading AGENTS.md themselves, and in practice they print only the first 40 or so lines and miss rules further down.

Codex and Claude Code load these files without being asked. After this change the worker does too:

  • Discovery is on by default for every registered root, conversation worktree and linked-worktree lane.
  • A machine owner opts out with --no-repository-instructions or LIBRECHAT_CODE_REPOSITORY_INSTRUCTIONS=false. Any other value of the variable stops the worker at startup, the same contract as LIBRECHAT_CODE_DETACHED_COMMANDS.
  • --repository-instructions is still accepted and changes nothing, so existing unit files keep working.

Discovery, the 32 KiB cap, AGENTS.md-over-CLAUDE.md precedence, symlink refusal and the instructionSha256-checked read are unchanged.

-        repositoryInstructions: args.includes('--repository-instructions'),
+  const repositoryInstructions = repositoryInstructionsEnabled({
+    optOut: args.includes('--no-repository-instructions'),
+    enabled: process.env.LIBRECHAT_CODE_REPOSITORY_INSTRUCTIONS,
+  });

The one value is passed to root tools, conversation worktrees and linked-worktree lanes; before, each read the flag separately.

Rollout and version skew

  • LibreChat has accepted the instructions descriptor since v0.8.8, and Code API since feat: Discover Bounded Repository Instructions for Attached Workspaces #226. Older LibreChat validates workspace descriptors strictly, so a worker serving one should run with --no-repository-instructions. REPOSITORY-INSTRUCTIONS.md states this.
  • An older Code API that rejects the metadata already makes the worker retry registration without it.
  • A root with neither file now advertises instructions: []; LibreChat accepts the empty list.

Change type

  • New feature (default flip with an opt-out)
  • Documentation update

Testing

  • npm run build and npm test in packages/code: the new repositoryInstructionsEnabled cases and the updated CLI registration expectation (instructions: [] on a root without the file) pass. Nine tests fail locally only because this WSL host lacks trusted Bash 5.2 and jq and has a world-writable /mnt/c; none touches the changed files.

Checklist

  • Self-reviewed
  • Tests cover the default, the flag and the variable
  • Docs updated (packages/code/REPOSITORY-INSTRUCTIONS.md)

Workers now discover AGENTS.md (or CLAUDE.md) at each registered root without an opt-in flag, matching how Codex and Claude Code load repository instructions. Machine owners opt out with --no-repository-instructions or LIBRECHAT_CODE_REPOSITORY_INSTRUCTIONS=false; the former opt-in flag is accepted and has no effect.
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review e6ba716

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T15:50:07.917075Z e6ba716 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: e6ba716723

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review e6ba716 — second pass: focus on mixed-version behavior (older Code API / LibreChat receiving the now-default instruction metadata), the three executor paths (root tools, conversation worktrees, linked-worktree lanes), and the startup contract for LIBRECHAT_CODE_REPOSITORY_INSTRUCTIONS.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: e6ba716723

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review e6ba716 — final review: please do a complete final pass over this head, including the documentation change and whether any caller still depends on discovery being off by default.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: e6ba716723

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila merged commit ee6aa7d into main Dec 4, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant