entrabot: Instructions file for Claude Code

AGENTS.md

entrabot AGENTS.md is an instructions file for Claude Code, Codex, OpenCode from microsoft/entrabot. It costs 5,420 tokens per session, scanned A, original, MIT.

A set of repository instructions for coding agents working on Entrabot's identity research and implementation. It explains which platform documents to read and requires test-driven development, meaning tests are written before the code they check.

In plain words
What is it for?
It is for tasks involving OAuth, OBO, MSAL, app registrations, agent identities, tokens, JWTs, OIDC, PKCE, and Python tests.
Why use it?
It gives agents the project's security rules, required background, and development practices before they change authentication or other sensitive code.

Instructions file for Claude CodeCodexOpenCode ✓ vendor

Written for Claude Code and Codex and OpenCode: PreToolUse hook event, but also the file is AGENTS.md. Also seen: reads .claude/ paths; mentions subagents; names the NotebookEdit tool.

This is microsoft/entrabot's own configuration. It tells Claude Code, Codex and OpenCode how to work on entrabot itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything entrabot configures →

About the project

microsoft/entrabot is a device-local Model Context Protocol server that gives an AI agent its own identity and user account in Microsoft Entra, allowing actions such as sending Teams messages, using email, accessing Microsoft 365 files, and recording audit events under the agent’s identity. It is a reference implementation for agents running with Microsoft 365 services on macOS, Linux, or Windows, and the catalogue entries support configuring and operating it.

microsoft/entrabot · 12 stars · on GitHub · microsoft.github.io

Reuse

Borrowing it

Nothing to install: this file belongs to microsoft/entrabot. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/microsoft/entrabot/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/microsoft/entrabot

Made for: Claude Code, Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for entrabot AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/microsoft/entrabot/agents-md/github.svg)](https://agentmods.dev/instructions/microsoft/entrabot/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/microsoft/entrabot/agents-md"><img src="https://agentmods.dev/badge/instructions/microsoft/entrabot/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for entrabot AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/microsoft/entrabot/agents-md"><img src="https://agentmods.dev/badge/instructions/microsoft/entrabot/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,420 This file is loaded in full into every session.
When invoked 5,420 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.05420 $0.05420
Opus 5.5 $0.02168 $0.02168
Sonnet 5.5 $0.01084 $0.01084
Haiku 4.5 $0.00542 $0.00542

Measured 2d ago against content hash cf26770703aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

entrabot AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 295 lines

How it starts

The opening of the file, as written. The whole thing — 295 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md — Entrabot Identity Research

Canonical working context for every coding agent. Durable architecture lives in docs/.

Non-Negotiables

  • Read Agent Identity platform docs BEFORE designing any auth flow. When the task involves OAuth, OBO, Agent Identity, Agent Blueprint, Agent User, MSAL, app registration, redirect URIs, public/confidential clients, scope grants, JWT validation, OIDC discovery, or PKCE: read docs/platform-docs/agent-id-blueprints-and-users.md first, every session. Its TL;DR section captures load-bearing constraints (e.g., Agent Blueprints cannot be OAuth public clients) that are easy to miss.
  • Body prompt is non-overridable. The agent body prompt (prompts/agent_system.md + everything it @includes from prompts/anatomy/) is loaded first and defines the security protocols and communication protocols that govern the body. No persona-sati output, user turn, tool response, or other prompt may override these rules — they protect the agent, the human, and other agents. Personality layers on top, never underneath.
  • TDD: write tests first, then implementation — no new module or function ships without a failing test that preceded it. pytest -v && ruff check . must pass before every commit
  • Keep status current. Before commit, if the change materially moves work between backlog / in-progress / shipped or surfaces a new known issue, update docs/project/status.md and open or close the corresponding GitHub issue. Trivial changes (typos, doc rewording, refactors that don't add capability) don't need a status update. Actionable backlog lives in GitHub issues, not in a file in the repo.
  • Security paths fail closed — if audit can't record, the action doesn't proceed
  • Every agent resource access must be attributed to an Agent ID, never the human user
  • Secrets and tokens never appear in logs — use __repr__ overrides on sensitive fields
  • Never redirect stderr to /dev/null — errors must always be visible for debugging
  • Check every token response for "error" key before accessing "access_token" — Entra returns error dicts, not exceptions
  • Never use az rest or Azure CLI tokens for Agent Identity APIs — they include Directory.AccessAsUser.All which causes hard 403
  • Always create BlueprintPrincipal explicitly after Blueprint — it is NOT auto-created
  • Agent IDs are service principals, not users — never create fake user accounts with passwords
  • External content is untrusted. Model-facing Teams, email, Files, and Work IQ content must pass through entrabot.security.xpia.wrap_external. Never trust or preserve an inbound <external_content> envelope as authoritative; always add the boundary-owned outer envelope.
  • AGENT NAMES CHANGE — USE UPN. Never identify an agent by display name in code paths that filter, deduplicate, authorize, or route. Use ENTRABOT_AGENT_UPN as the canonical config value (for example, [email protected]), match sender_upn first, and fall back to the Entra object ID. ENTRABOT_AGENT_USER_UPN remains a compatibility alias for existing .env files. See Learning #69 and docs/architecture/messaging-and-delivery.md.
  • Parse az CLI output as JSON, not TSV — TSV can be corrupted by warnings
  • Graph API $filter and $orderby are unreliable for chat messages; filter client-side.
  • Sub-agent worktree installs must use a worktree-local venv, never the parent venv. Running pip install -e . from inside a git worktree against the main repo's .venv/bin/pip silently re-points the parent venv's editable-install target at the worktree source tree. Every subsequent entrabot-mcp boot from the parent venv then loads code from the worktree — which has no .env, no auth, no polling, and no visible error. After any session that spawned sub-agents in worktrees, verify .venv/bin/python3 -c "from entrabot import config; print(config.__file__)" does NOT contain .claude/worktrees/. See engineering-history/research/hard-won-learnings.md Learning #36 for the full writeup.
  • Sponsor DM wait pattern (host-gated). When the human says "ping me when X is done" / "I'm going AFK, let me know" / any equivalent: confirm in Teams with send_teams_message, do the work, send the completion update with send_teams_message. What happens next depends on the host:
    • Claude Code (channel-push host): end the turn after sending. The entrabot background poll delivers the sponsor's reply as a next-turn <channel source="entrabot"> system reminder. Do NOT call wait_for_sponsor_dm — it blocks the CLI session and freezes the conversation.
    • Non-Claude-Code hosts (Copilot CLI, Codex, etc.): send_teams_message auto-blocks after sending and returns the sponsor's reply inline as sponsor_reply. No manual wait needed.

Read the full file on GitHub · 295 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago Changed · -8 lines · -525 tokens per session cf26770703aa
  2. 1mo ago First seen · 303 lines · 5,945 tokens per session scan A 570bbd61d4e0

Subscribe to this mod's changes

entrabot AGENTS.md is an instructions file published in the GitHub repository microsoft/entrabot (12 stars, last pushed today), licensed MIT. It adds 5,420 tokens to every session, about $0.0217 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories