Skip to content

feat: support AGENTS.local.md for per-operator instructions#193

Merged
ChrisRomp merged 3 commits intomainfrom
feat/agents-local-instructions
Apr 12, 2026
Merged

feat: support AGENTS.local.md for per-operator instructions#193
ChrisRomp merged 3 commits intomainfrom
feat/agents-local-instructions

Conversation

@ChrisRomp
Copy link
Copy Markdown
Owner

Summary

Adds support for AGENTS.local. a gitignored, per-operator file that injects local conventions into Copilot sessions via custom_instructions.md

Motivation

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: Extract loadLocalInstructions() helper; load AGENTS.local.md in normal sessions (create/resume) and inter-agent (ask_agent) sessions
  • AGENTS.md: Document the AGENTS.local.md pattern under "Local Instructions"
  • README.md: Update workspace features and /reload command description
  • docs/workspaces.md: Add AGENTS.local.md to workspace structure and new explanatory section
  • src/core/bridge-docs.ts: Update /help workspaces with AGENTS.local.md info
  • .gitignore: Exclude AGENTS.local.md

How it works

  1. buildSystemMessage() and inter-agent session setup both call loadLocalInstructions(workingDirectory)
  2. If AGENTS.local.md exists and is non-empty, its content is wrapped in <local_instructions> tags and appended to custom_instructions
  3. File is read synchronously with existsSync + readFileSync; TOCTOU gap handled by try/catch
  4. Reloaded on every new /reload config or /new picks up changessession

Testing

  • npm run cleanbuild
  • npm 683/683 passedtest
  • Manual: confirmed Loaded AGENTS.local.md from ... in debug logs after restart

ChrisRomp and others added 2 commits April 11, 2026 21:01
- 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>
Copilot AI review requested due to automatic review settings April 12, 2026 22:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 wire AGENTS.local.md into normal session create/resume and inter-agent ephemeral sessions.
  • Document AGENTS.local.md across README, workspace docs, bridge /help workspaces, and AGENTS.md.
  • Ignore AGENTS.local.md via .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

Comment thread src/core/session-manager.ts Outdated
Comment thread src/core/session-manager.ts Outdated
Comment thread README.md
- 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>
@ChrisRomp ChrisRomp merged commit d9ef2ec into main Apr 12, 2026
6 checks passed
@ChrisRomp ChrisRomp deleted the feat/agents-local-instructions branch April 12, 2026 22:58
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.

2 participants