agentleFS
MicrosoftKnown publishermicrosoft/agent-governance-toolkit/agent-governance-opencode/AGENTS.md

agent-governance-toolkit / agent-governance-opencode

AGENTS.md6.4k starsChanged 2 months agoMITView on GitHub

Scope: this folder publishes @microsoft/agent-governance-opencode, the AGT governance plugin for OpenCode. OpenCode loads plugins in-process as async JS/TS functions. The plugin entry point is src/index.mjs, which: - caches a single loadPolicy() state per OpenCode process - maps AGT decisions (allow / review / deny) onto OpenCode's contract: - deny → throw new Error(...) from the hook - review → annotate output.args.__agt_review_reason - allow → return undefined - exposes agt_policy_status and agt_policy_check_text as both in-process custom tools and stdio MCP server…

  • Installs packages

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 1 mentionApr 2026: 7 mentionsMay 2026: 19 mentionsJun 2026: 4 mentionsJul 2026: 5 mentionsAug 2026: 14 mentionsSep 2026: 0 mentionsOct 2026: 3 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/agent-governance-toolkit repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/agent-governance-toolkit

The biggest 5 of 53 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 53

Talked about on GitHub, Bluesky and Hacker News (53 times).

On GitHub · 43

38 more on GitHub

On Bluesky · 8

3 more on Bluesky

On Hacker News · 2

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 1 is common, 0 are distinctive, and 2 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All three return { effect: "allow" | "review" | "deny", reason } (the output helper returns { redact, redactedOutput?, reason }).

    line 27
  2. Very specific:

    Default policy uses OpenCode's lowercase tool names (read, bash, webfetch, etc.) — do not copy Claude's PascalCase tool names verbatim

    line 46
  3. Common:

    Never log a redacted secret value.

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

OpenCode plugin — contributor instructions

Scope: this folder publishes @microsoft/agent-governance-opencode, the AGT governance plugin for OpenCode.

Architecture

OpenCode loads plugins in-process as async JS/TS functions. The plugin entry point is src/index.mjs, which:

  • caches a single loadPolicy() state per OpenCode process
  • maps AGT decisions (allow / review / deny) onto OpenCode's contract:
    • deny → throw new Error(...) from the hook
    • review → annotate output.args.__agt_review_reason
    • allow → return undefined
  • exposes agt_policy_status and agt_policy_check_text as both in-process custom tools and stdio MCP server tools (server/agt-mcp.mjs)

The core policy library (lib/policy.mjs) is shared with the Claude Code package and exposes both Claude-style hook helpers (kept for compatibility) and OpenCode-native helpers:

  • evaluateOpenCodePrompt(state, { prompt, sessionId })
  • evaluateOpenCodeTool(state, { tool, args, cwd, sessionId })
  • evaluateOpenCodeToolOutput(state, { tool, output, sessionId })

All three return { effect: "allow" | "review" | "deny", reason } (the output helper returns { redact, redactedOutput?, reason }).

Local commands

cd agent-governance-opencode
npm install
npm run check    # node --check on every .mjs + node --test
npm test         # tests only

Conventions

  • MIT license header on every new .mjs / .ts / .js file
  • Node engine >=22.0.0 (matches Claude Code package; OpenCode targets modern runtimes)
  • Version pinned to 3.6.0 to track the Claude Code package
  • @microsoft/agent-governance-sdk is pinned at 3.7.0
  • Default policy uses OpenCode's lowercase tool names (read, bash, webfetch, etc.) — do not copy Claude's PascalCase tool names verbatim
  • Fail-closed on every error path; never silently allow on policy load failure
  • Never log a redacted secret value; only the pattern category id

When to update what

  • New OpenCode tool name → add to config/default-policy.json allowedTools / reviewTools
  • New secret family to redact → add a pattern to SECRET_PATTERNS in lib/policy.mjs (bottom section) and add a test in test/policy.test.mjs
  • New plugin hook surface from OpenCode → wire it in src/index.mjs and add a shape assertion in test/plugin.test.mjs

Out of scope

  • Marketplace metadata: OpenCode does not have a Claude-style plugin marketplace, so there is no .opencode-plugin/marketplace.json
  • Modifying lib/audit.mjs or lib/poisoning.mjs here — those are shared surface-agnostic libs; coordinate with the Claude Code package if changed

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.