Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This workspace is **github-agent-contracts** only.
- Edit no paths outside this repository.
- Do not request or embed credentials.
- Prefer Node 20 ESM scripts with zero dependencies.
- Load root `agent-policy.yml` through `scripts/load-agent-policy.mjs` and follow `skills/agent-policy/SKILL.md` before publication or GitHub writes. Missing or invalid policy denies all actions; never fall back to the example or a different role.
- Agents must not edit, create, replace, or delete `agent-policy.yml` to grant themselves rights, or modify the executor to bypass a denial. A human reviews and publishes active policy changes.
- App permissions, branch protection/environments, and policy are cumulative gates. The coder publisher requires `commit_branch` and `open_pr`, checks the reviewed default-branch policy, and has no merge/protected-push/deploy or role-override mode. Humans merge; no deploys.
- Follow `docs/ROLES.md`: use separate role Apps, and keep only the coder key on the WSL orchestration host. Never use merger/deploy credentials or a human token there.
- Agents must commit and publish through `node scripts/agent-pr.mjs`, never raw `git commit`, `git push`, or a separate `gh pr create`. Never commit as R4yHarris or use a human token as a fallback.
- Follow `skills/signed-bot-commit/SKILL.md`. App environment variables never authorize use of the signed-in human's identity, and missing App configuration means stop. Never merge or enable auto-merge.
- Invoke the helper only after authorization for commit, push, and a draft PR. A request to stop after writing files and testing means no publication. Humans may perform their own bootstrap commits.
Expand All @@ -18,5 +22,7 @@ This workspace is **github-agent-contracts** only.
Authorized publication example:

```bash
node scripts/load-agent-policy.mjs --role coder --capability commit_branch
node scripts/load-agent-policy.mjs --role coder --capability open_pr
node scripts/agent-pr.mjs --message "docs: clarify agent contracts" --model unknown --files README.md
```
16 changes: 16 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ Reusable conventions and small tools so Copilot, GitHub Agentic Workflows (`gh-a
- Do not grant agents `admin`, `delete`, or unscoped `repo` power in examples.
- Default writes on GitHub are **safe outputs only**: comments, labels, draft PRs — never force-push, never merge without a human.

## Capability policy

- Follow `skills/agent-policy/SKILL.md` and load root `agent-policy.yml` with `scripts/load-agent-policy.mjs` before publication or any GitHub write, including safe outputs. Missing or invalid policy denies every capability; never fall back to the example.
- App permissions, branch protection/environments, and the policy allow-list must all permit an action. A task prompt, available tool, App environment variable, or broader token does not override a denial.
- Agents must not create, edit, replace, or delete root `agent-policy.yml` to grant themselves rights. Humans review and publish policy changes. Do not bypass policy by changing the loader, publisher, or harness configuration.
- The publisher is fixed to coder and requires `commit_branch` plus `open_pr`, matching the reviewed default-branch policy. There is no role or policy-path override. Merge, protected pushes, and deploys are unsupported by the coder publisher; humans merge and deployments remain disabled.
- Use separate user/org-owned role Apps. The WSL orchestration host holds only the coder key, never merger/deploy keys or human fallback credentials. Follow `docs/POLICY.md` and `docs/ROLES.md`.

```bash
node scripts/load-agent-policy.mjs --role coder --capability commit_branch
node scripts/load-agent-policy.mjs --role coder --capability open_pr
```

## Agent publication

- Follow `skills/signed-bot-commit/SKILL.md` for all publishing. The security control is the required PR check plus protected branch, bot author, and trailers; an App installation supplies authentication, not a merge exemption.
Expand Down Expand Up @@ -56,6 +69,9 @@ node scripts/check-agent-trailers.mjs --message-file path/to/msg.txt
# Publication help only; this does not read a key or contact GitHub
node scripts/agent-pr.mjs --help

# Policy help only; no policy or credentials are read
node scripts/load-agent-policy.mjs --help

# Tests
node --test tests/*.test.mjs
```
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is community OSS for GitHub, not a GitHub replacement.
## Enable agent identity in 3 steps

1. **[Register App from manifest](docs/app-manifest.json).** Create an App owned by you or your organization, keep it private to that account, and choose **Only select repositories** during installation.
2. **Configure and copy.** Supply `GITHUB_APP_ID` and `GITHUB_APP_PRIVATE_KEY_PATH` outside git, then copy AGENTS.md, the signed-bot-commit skill, publisher, and check Action/workflow as listed in [ONBOARDING.md](docs/ONBOARDING.md). CI stores the key in the `GITHUB_APP_PRIVATE_KEY` secret.
2. **Configure and copy.** Supply `GITHUB_APP_ID` and `GITHUB_APP_PRIVATE_KEY_PATH` outside git, then copy AGENTS.md, the policy and commit skills, publisher/loader, and check Action/workflow as listed in [ONBOARDING.md](docs/ONBOARDING.md). A human installs the root capability policy. CI stores the key in the `GITHUB_APP_PRIVATE_KEY` secret.
3. **Protect and publish.** Require `check-agent-trailers`, disallow direct pushes to `main` and agent bypass, and reserve merges for humans. Tell the agent: "Use signed-bot-commit / scripts/agent-pr.mjs for all publish."

The manifest is a static template, not a hosted registration button. An owner-controlled manifest callback is a follow-on; placeholder URLs must be replaced before completing GitHub's flow. The [onboarding guide](docs/ONBOARDING.md) describes that boundary and the manual registration fallback.
Expand All @@ -27,6 +27,7 @@ Use it so Copilot, [GitHub Agentic Workflows](https://github.com/github/gh-aw),
| Contract | Where |
| --- | --- |
| Agent instructions | `AGENTS.md` |
| Default-deny capabilities | `examples/agent-policy.yml` + `docs/POLICY.md` |
| Copilot instructions | `.github/copilot-instructions.md` |
| Portable skills | `skills/*/SKILL.md` |
| Bot identity | `docs/github-app-agent-identity.md` |
Expand All @@ -53,6 +54,12 @@ See [HARNESSES.md](docs/HARNESSES.md) for the minimal integration in each runtim

Follow the [adoption guide](docs/adopt.md) and copy the [consumer workflow](examples/consumer-repo/.github/workflows/check-agent-trailers.yml). Reference the pinned public Action without copying scripts, or vendor the Action and both scripts together. No package registry or GitHub App credentials are needed for the trailer check.

## Capability policy

Hermes, Copilot, Claude Code, and Cursor share one human-owned root `agent-policy.yml`. The [example](examples/agent-policy.yml) allows coder branch commits, draft PRs, comments, and labels; merger and deploy allow-lists are empty. Missing policy denies publication, and agents must not edit policy to grant themselves rights.

Read [POLICY.md](docs/POLICY.md) for the three permission layers and human bootstrap, and [ROLES.md](docs/ROLES.md) for separate role Apps and a WSL host holding only the coder key. The coder publisher has no merge, protected-push, or deployment mode. No active root policy or hosted control plane is installed by this pack.

## Non-goals

- No self-hosted forge
Expand Down
9 changes: 9 additions & 0 deletions agent-policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 1
default: deny
roles:
coder:
allow: [commit_branch, open_pr, comment, label]
merger:
allow: []
deploy:
allow: []
14 changes: 11 additions & 3 deletions docs/HARNESSES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Harnesses

The common contract is [AGENTS.md](../AGENTS.md), which requires [signed-bot-commit](../skills/signed-bot-commit/SKILL.md) and [scripts/agent-pr.mjs](../scripts/agent-pr.mjs) for authorized publication. Use the consuming user's or organization's App from [ONBOARDING.md](ONBOARDING.md), never a shared maintainer App for private repositories.
The common contract is [AGENTS.md](../AGENTS.md), which requires [agent-policy](../skills/agent-policy/SKILL.md) first, then [signed-bot-commit](../skills/signed-bot-commit/SKILL.md) and [scripts/agent-pr.mjs](../scripts/agent-pr.mjs) for authorized publication. Use the consuming user's or organization's App from [ONBOARDING.md](ONBOARDING.md), never a shared maintainer App for private repositories.

Harness setup does not replace the required `check-agent-trailers` check, branch protection, bot authorship, or trailers. No harness may publish as the signed-in human, print credentials, or merge an agent PR. App environment variables do not themselves authorize publication.

Every harness reads the same human-owned root `agent-policy.yml` through [the loader](../scripts/load-agent-policy.mjs), not a harness-specific allow-list or cached fallback. Missing policy denies writes. No harness may edit policy to grant itself rights, change its assigned role, or deploy by default. [POLICY.md](POLICY.md) defines the shared capabilities; [ROLES.md](ROLES.md) defines operator-controlled role and key boundaries.

## Copilot

Use **AGENTS.md + .github/copilot-instructions.md only** as the Copilot configuration. The Copilot file points to the common repository rules, and those rules point to the commit skill and publisher. No custom agent mode, extra prompt file, or MCP server is required for publishing.
Expand All @@ -16,12 +18,18 @@ Keep [CLAUDE.md](../CLAUDE.md) as a short pointer to AGENTS.md. Claude Code read

## Hermes

Load AGENTS.md as repository instructions and [skills/signed-bot-commit/SKILL.md](../skills/signed-bot-commit/SKILL.md) as the publication skill using the installed runtime's supported mechanism. For GitHub issue, PR, or code reads, also follow the [GitHub MCP allowlist skill](../skills/github-mcp-allowlist/SKILL.md).
Load AGENTS.md as repository instructions, the agent-policy skill before writes, and [skills/signed-bot-commit/SKILL.md](../skills/signed-bot-commit/SKILL.md) for publication using the installed runtime's supported mechanism. For GitHub issue, PR, or code reads, also follow the [GitHub MCP allowlist skill](../skills/github-mcp-allowlist/SKILL.md). Safe-output handlers must enforce the shared policy in addition to their tool allowlists.

Use repository-scoped installation tokens supplied by a trusted launcher; never store tokens in repository MCP configuration. Keep default agent tools read-only and write-capable credentials in the approved publication context. No Hermes runtime changes are needed.

## Cursor

Load AGENTS.md as the project's instructions. If the installed version needs a project-rule pointer, point it at AGENTS.md rather than duplicating capability grants. Read the shared policy through the same loader and use the same coder publisher; enabling a Cursor tool or changing an agent mode does not override a policy denial.

Keep root policy changes human-owned. No Cursor-specific credential, role override, merge tool, or deploy capability is granted by this integration.

## Generic agents

If you honor **AGENTS.md**, you honor **signed-bot-commit**. Read the referenced skill and invoke the same helper after explicit authorization, regardless of whether your runtime has a native skill loader.
If you honor **AGENTS.md**, you honor **agent-policy** and **signed-bot-commit**. Read the referenced skills and invoke the same helper after policy checks and explicit authorization, regardless of whether your runtime has a native skill loader.

When the necessary instructions, App environment, or publishing tools are unavailable, stop and report the missing prerequisite. Do not fall back to raw Git, human credentials, or automatic merging. Humans review and merge.
7 changes: 6 additions & 1 deletion docs/ONBOARDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,21 @@ Copy these files into the consuming repository, preserving paths and merging exi

```text
AGENTS.md
skills/agent-policy/SKILL.md
skills/signed-bot-commit/SKILL.md
scripts/agent-pr.mjs
scripts/load-agent-policy.mjs
scripts/check-agent-trailers.mjs
scripts/check-pr-agent-trailers.mjs
examples/agent-policy.yml
.github/actions/check-agent-trailers/action.yml
.github/workflows/check-agent-trailers.yml
```

Use Node 20+, Git, and `gh` for publication. Adapt the workspace name and test command in the copied rules. Follow [HARNESSES.md](HARNESSES.md) for the small harness-specific pointers, and [adopt.md](adopt.md) for the pinned public-Action alternative and vendoring details. No private-package infrastructure or runtime dependency installation is needed.

A human must review [the policy example](../examples/agent-policy.yml), install it as root `agent-policy.yml`, and publish it on the default branch through the existing human review process. Include that reviewed version in the feature branch too. Keep merger and deploy allow-lists empty. The publisher requires coder `commit_branch` and `open_pr`, checks the default-branch policy, and refuses root-policy edits; there is no example fallback. See [POLICY.md](POLICY.md) and [ROLES.md](ROLES.md). Copy their guidance with the skills when adopting the pack.

For the local Action, land the Action and both checker scripts on the target branch before enabling the workflow, because it executes the base revision's trusted checker. A human bootstraps workflow changes: the App intentionally has no workflows-write permission. Keep human review on changes to the workflow, instructions, and publisher.

## 3. Protect the branch and publish
Expand All @@ -51,7 +56,7 @@ After a successful trial PR run, configure branch protection or a ruleset for `m

Tell the agent:

> Use signed-bot-commit / scripts/agent-pr.mjs for all publish. Never publish as the signed-in human, print tokens, or merge. Stop if App authentication is unavailable.
> Load agent-policy first, then use signed-bot-commit / scripts/agent-pr.mjs for all publish. Never grant yourself policy rights, publish as the signed-in human, print tokens, merge, or deploy. Stop if policy or App authentication is unavailable.

Authorize a specific feature-branch publication, then let the agent use the helper. Check the bot author/committer and trailers on the resulting commits. The helper creates a draft PR or reuses an existing open PR. **Humans review and merge.** Local commits do not independently authorize a push.

Expand Down
Loading
Loading