api-governance copilot-instructions.md

A set of coding instructions for checking changes to API and tool contracts before they are merged, deployed, published, or registered. These contracts describe interfaces such as OpenAPI, GraphQL, protobuf, AsyncAPI, MCP manifests, and agent tool schemas.

In plain words
What is it for?
Use it in repositories where contract files can change, especially to run the preflight check, interpret its action, handle approval or stop results, and require monitoring for monitored continuation.
Why use it?
It helps catch breaking interface changes and requires the full change set to be checked before releasing it.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/coderifts/api-governance/copilot-instructions
Clone the repo
git clone --depth 1 https://github.com/coderifts/api-governance

Made for: GitHub Copilot.

Per session 1,032 This file is loaded in full into every session.
When invoked 1,032 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.01032 $0.01032
Opus 5 $0.00516 $0.00516
Sonnet 5 $0.00206 $0.00206
Haiku 4.5 $0.00103 $0.00103

Measured yesterday against content hash 63e83e379e96, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-governance copilot-instructions.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 yesterday.

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.

copilot/.github/copilot-instructions.md · 46 lines

How it starts

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

CodeRifts instructions for GitHub Copilot

Call preflight_change_set before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).

Send the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.

Branch on execution_action only. Do not branch on decision and do not branch on safe_for_agent (not_for_control_flow_use_execution_action). Canonical execution_action values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.

An unrecognised execution_action is not permission: fail closed (halt or re-preflight). Well-known code: not_permission_fail_closed.

When execution_action is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path — deprecate-then-remove, an additive change, or a new version — rather than shipping the break.

CONTINUE_WITH_MONITORING requires a wired monitoring sink (monitoringSinkWired). It is not "proceed with caution" without monitoring.

Do not call preflight_change_set for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is verify_receipt — see the companion-tools rule).

If you already hold a chain receipt and only need authenticity/lifecycle: verify_receipt. If you need a past decision by id: get_decision_details. Neither replaces preflight for a new change set.

The CodeRifts MCP server exposes exactly three tools — preflight_change_set, verify_receipt, get_decision_details. Do not invent or assume others.

A receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call preflight_change_set with context.operation set to that operation — reusing a differently-scoped receipt is not permitted and will fail at the gate.

A stale or superseded receipt on a changed head requires a NEW preflight — verify_receipt cannot re-diff.

For mutating tools, put only the guarded version in the agent's tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours — this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.

CodeRifts reports a governance decision and execution_action; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.

To act (mutate a contract, merge, deploy, or publish): call preflight_change_set with preflight_mode authorize. Analyze is informational — risk only, may_execute is always false — and is not permission. Read execution_action on the decision_result envelope.

Before acting under a held receipt: call verify_receipt with the intended context (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.

Act only when currently_authorized is true (control_envelope.receipt_view.currently_authorized). A valid-looking token is not permission if currently_authorized is false or omitted.

Commit / CAS evidence is a separate measurement (commit_observation on GuardOutcome). It is not a substitute for authorize + currently_authorized. Production hosts that want the fail-closed conjunction lock it with profile: ENFORCING_STRICT on withCodeRifts.

If the host requests an execution grant (opt-in include_execution_grant), the grant is bound to operation + target + after-payload (scope_hash) and is short-lived — never reuse it after the after-payload changes.

Read the full file on GitHub · 46 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. yesterday First seen · 46 lines · 1,032 tokens per session scan A 63e83e379e96

Subscribe to this mod's changes

api-governance copilot-instructions.md is an instructions file published in the GitHub repository coderifts/api-governance (0 stars, last pushed yesterday), licensed MIT. It adds 1,032 tokens to every session, about $0.0052 per session on Opus 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.