feat: support AGENTS.local.md for per-operator instructions#193
Merged
feat: support AGENTS.local.md for per-operator instructions#193
Conversation
- buildSystemMessage() reads AGENTS.local.md from working directory if present - Content is injected into custom_instructions alongside bridge instructions - Added AGENTS.local.md to .gitignore - Documented in AGENTS.md, README.md, docs/workspaces.md, and bridge-docs help - Renamed branch from docs/ to feat/ (includes code changes, not just docs) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract loadLocalInstructions() helper from buildSystemMessage() and also call it when building ephemeral inter-agent session system messages. This ensures operator-local conventions from AGENTS.local.md are respected in ask_agent calls, not just normal channel sessions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds support for an optional, gitignored AGENTS.local.md file to inject per-operator conventions into Copilot sessions via custom_instructions, without polluting the repo-wide AGENTS.md.
Changes:
- Add
loadLocalInstructions()and wireAGENTS.local.mdinto normal session create/resume and inter-agent ephemeral sessions. - Document
AGENTS.local.mdacross README, workspace docs, bridge/help workspaces, andAGENTS.md. - Ignore
AGENTS.local.mdvia.gitignore.
Show a summary per file
| File | Description |
|---|---|
| src/core/session-manager.ts | Loads and injects AGENTS.local.md into system/custom instructions for standard and inter-agent sessions. |
| src/core/bridge-docs.ts | Updates /help workspaces content to include AGENTS.local.md. |
| README.md | Mentions AGENTS.local.md in workspace features and updates /reload description. |
| docs/workspaces.md | Adds AGENTS.local.md to workspace structure and explains intended usage. |
| AGENTS.md | Documents the local-instructions pattern for operators. |
| .gitignore | Adds AGENTS.local.md to ignored files. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/6 changed files
- Comments generated: 3
- Extract loadLocalInstructions() as exported function for testability - Suppress ENOENT errors from TOCTOU gap, use structured logging for unexpected errors - Add unit tests (8 cases: undefined/empty/whitespace/missing dir/ content wrapping/trimming) - Update /help reload text to mention AGENTS.local.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for
AGENTS.local. a gitignored, per-operator file that injects local conventions into Copilot sessions viacustom_instructions.mdMotivation
Operator-specific conventions (push policies, branching rules, restart commands) don't belong in the repo's
AGENTS.md. This gives each operator a local file that's automatically loaded if present, with no impact when absent.Changes
src/core/session-manager.ts: ExtractloadLocalInstructions()helper; loadAGENTS.local.mdin normal sessions (create/resume) and inter-agent (ask_agent) sessionsAGENTS.md: Document theAGENTS.local.mdpattern under "Local Instructions"README.md: Update workspace features and/reloadcommand descriptiondocs/workspaces.md: AddAGENTS.local.mdto workspace structure and new explanatory sectionsrc/core/bridge-docs.ts: Update/help workspaceswithAGENTS.local.mdinfo.gitignore: ExcludeAGENTS.local.mdHow it works
buildSystemMessage()and inter-agent session setup both callloadLocalInstructions(workingDirectory)AGENTS.local.mdexists and is non-empty, its content is wrapped in<local_instructions>tags and appended tocustom_instructions/reload configor/newpicks up changessessionTesting
npm run cleanbuildnpm 683/683 passedtestLoaded AGENTS.local.md from ...in debug logs after restart