Skip to content

About

GitHub App identity + policy for Hermes, Claude Code, Copilot, and other agents so they do not commit as the human.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

github-agent-contracts

github-agent-contracts gives Hermes, Claude Code, GitHub Copilot, OpenClaw, Cursor, and Codex a user-owned GitHub App bot identity and a default-deny permission policy, separate from the human GitHub user.

Give agents their own identity in 3 steps

  1. Create your own GitHub App from docs/app-manifest.json. Your user or organization owns the App and its key; install it on selected repositories only. Follow ONBOARDING for registration and the two publisher environment variables. Keep the manifest scoped to the repository and task: if project management or environment orchestration is required, review the optional repository_projects, organization_projects, actions, deployments, environments, and variables scopes before installation.
  2. Define repository permissions in root agent-policy.yml. A human reviews and publishes the default-deny example. Coder can commit feature branches, open draft PRs, comment, and label; merge and deploy remain denied by default. See POLICY.
  3. Publish as the App bot with node scripts/agent-pr.mjs. Copy the required files from the onboarding guide, review and stage the changes, pass tests and policy gates, then run the authorized publication command:
node scripts/agent-pr.mjs --message "feat: add input validation"

Humans merge by default. Opt-in merging requires a human-published merger.merge grant plus explicit authorization for --merge-when-green, successful checks on the exact head SHA, and all required reviews. Coder merge alone is insufficient.

This is not a git host, not copilot[bot], not a personal access token (PAT), and not a maintainer-owned App to install on other people's private repositories. It is community OSS for GitHub, not a GitHub replacement.

ONBOARDING | POLICY | THREAT_MODEL | HARNESSES | ORCHESTRATION-MACHINE | AGENTS.md

Which approach fits?

Approach Identity and permissions Role
This pack Your GitHub App bot, repository-scoped installation tokens, root capability policy, and commit trailers A concrete identity and publishing contract shared by different agent harnesses
copilot[bot] GitHub-managed bot identity for supported Copilot activity Not a credential or user-owned App you can assign to Hermes or arbitrary agents
Personal access token Authenticates as the GitHub user that owns the token, including a separately managed machine user User-bound access, not an App-owned bot identity; no PAT fallback in this pack
gh-aw GitHub Actions workflows with declared permissions and safe outputs Agent workflow automation that can consume these contracts; not a replacement for the repository identity policy

What enforces the contract?

The control is required PR check + protected branch + bot author + trailers. The App authenticates GitHub operations. App permissions, branch protection/environments, and the policy must all allow an action; installing an App or adding a prompt does not replace these gates.

The publisher discovers the configured App's bot, sets both author and committer, appends AI-Agent and the actual AI-Model id, pushes an authorized feature branch, and creates a draft PR if none exists. Supply the model through --model or AI_MODEL; missing or placeholder values stop publication rather than inventing a model. It uses GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY_PATH from the environment, not a signed-in human's credentials. Missing configuration or denied policy means stop with changes uncommitted.

Humans own policy and workflow changes. Agents cannot grant themselves capabilities or publish .github/workflows/** through this helper. Never force-push, push main directly, squash, or self-approve. Deploy and direct protected-push implementations are out of scope.

Trailers and bot fields are claims, not cryptographic proof of who wrote the code. Git commits are currently unsigned; see the threat model before adopting this in a repository that requires signing.

Attach your agent

See HARNESSES for integration details. On a dedicated WSL/Hermes machine, keep only the coder App key, no human GitHub login, and merge disabled until a separate approved merger context is available; follow ORCHESTRATION-MACHINE. Policy does not select or switch App keys.

Use in another repo

Follow ONBOARDING for the complete file list and adopt.md for distribution options. Copy the consumer workflow with a pinned public Action, or vendor the composite Action with both checker scripts and their shared parser. No private-package infrastructure or App credentials are required for the read-only trailer check itself.

The manifest is a static template, not a hosted registration button. Its placeholder callback URLs need an owner-controlled receiver for GitHub's manifest flow; onboarding also documents the manual registration path. No hosted callback or control plane is provided.

Create an App owned by the consuming user or organization. The key holder can mint tokens for every installation of that App. The maintainer's r4yharris-agent-coder demo is for public playgrounds only, never private or production repositories. See the identity guide and role separation.

Check commit provenance

Node 20+ and Git are required; the scripts have no runtime dependencies. Publication also needs gh.

node scripts/check-agent-trailers.mjs --help
node scripts/check-agent-trailers.mjs --message-file path/to/message.txt --json
node --test tests/*.test.mjs

An agent commit has a blank-separated footer:

AI-Agent: your-app-slug
AI-Model: gpt-5

gpt-5 is an example; use the actual model id for each run. The check inspects messages containing AI-Agent: and GitHub noreply bot authors by default, and rejects missing or placeholder models. Unmarked human commits pass. --require, or the Action's require-on-all-commits: "true", requires trailers on every commit. See the trailer specification for parsing, exit codes, and limits.

The PR workflow uses the trusted base revision's checker with full history and read-only permissions. Bootstrap the Action and scripts before enabling the local workflow. Humans must configure required checks, reviews, and branch protection; the script does not configure them.

Optional run metadata (v0.2.0)

Harnesses can supply compact run information through the documented AI_* environment variables. The publisher adds one optional AI-Run trailer and upserts a tagged PR body pair; with no supplied optional metadata (but with the required model id), publishing and the default two-trailer check remain unchanged. --require-run opts into validation. METRICS.md specifies the format, human-only AI-Eval comments, and local JSONL export with export-agent-metrics.mjs. No analytics service, prompts, traces, or generated quality scores are added.

With gh-aw

The issue clarifier source illustrates permissions: read-all and a comment-only safe output. Approved output handlers must enforce the repository policy too. Keep Markdown sources uncompiled unless gh aw is already installed; no generated lockfile or agent runtime is required to use the identity contract.

Find and cite this pack

DISCOVERY.md lists the user questions this repository answers, harness attachment steps, suggested topics, and a citation snippet. Skill hubs can index the root SKILL.md; citation tools can use CITATION.cff.

License

MIT. See LICENSE.

About

GitHub App identity + policy for Hermes, Claude Code, Copilot, and other agents so they do not commit as the human.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages