Introduction
In this page you’ll learn how to configure those items:- Get GHES to push events (ex: “new PR created”) to Cosmos via webhooks
- Configure a Cosmos Daemon on a VM (where the GHES local repos will be cloned locally)
- Get Cosmos to interact with GHES via the
ghcli - Deploy your first Cosmos PR experts and v1.0 software factory

Prerequisites
To configure the one-time connectivity between Cosmos and GHES: Cosmos- must be an admin to create a Augment service account and webhooks
- must have admin role to create a new user acting as service account
- must be an enterprise owner (and owner of the organizations that owns the repos) to add the service account as collaborator on repos
- allow inbound connections from other VMs on your VPC into GHES (inbound calls will come from within your network)
- must have the ability to deploy VMs in a VPC that has network connectivity to your GHES. Must enable outbound network connectivity to *.augmentcode.com (see https://docs.augmentcode.com/setup-augment/network-configuration)
Step 1 - Configure GHES to notify a Cosmos Webhook
Webhook receiver in Cosmos
Let’s create a new webhook in Cosmos (so Cosmos can listen to GHES events):- As an admin go to Cosmos cosmos.augmentcode.com > Settings > Webhooks > Create a webhook > Click on GitHub:

- Enter Description: GHES + <url-to-your-GHES-instance> > Click on Create


Webhook sender in GHES
GHES enterprise owners can create a global webhook to subscribe to events that occur within their enterprise (recommended). Alternatively you can create a global webhook per organization in your enterprise. Create a new webhook config in GHES (so GHES can POST to a given url when certain GHES events occur): as an Enterprise Owner, go to your GHES instance > click on your profile picture > click on Enterprise settings > Settings > Hooks > Add webhook > Add those details:- Payload URL: the webhook url provided by Cosmos
- Content-Type: application/json
- Secret token: the secret provided by Cosmos
- Enable SSL verification: keep it selected
- Which events would you like to trigger this webhook?: select Let me select individual events
- Select those events:
- Check runs
- Commit comments
- Issue comment
- Pull request review comments
- Pull requests
- Pull request reviews
- Pushes
- Statuses
- Workflow runs
- Active: keep it selected
- Click on Add webhook





Step 2 - Create a GHES Service Account
For headless automation and to start agentic workflows based on GHES events, you’ll create a dedicated GHES user acting as service account. Cosmos will use its access token to authenticate to GHES. Here we’ll assume you’ve configured SSO authentication for all your GHES users. Two steps to create your GHES dedicated service account user:- first, you need to provision the new user cosmos@yourcompanydomain.com in your identity provider (Okta, EntraID)
- then in a separate browser, authenticate to GHES as cosmos@yourcompanydomain.com: you’ll be redirected to SSO, and then back to GHES (your GHES account is automatically created when you sign in the first time)

- Token name: cosmos-token-01
- Resource owner: keep the selection as the GHES dedicated service account user cosmos@yourcompanydomain.com
- Expiration: pick the furthest date possible
- Repository access: select the repos where cosmos@yourcompanydomain.com was added as collaborator earlier.
- Permissions:
- Content:
Read and write - Issues:
Read and write - Metadata:
Read-only - Pull requests:
Read and write
- Content:
- Click on Generate token



Step 3 - Create a Augment service account
Before we start the websocket tunnel from your VM to Cosmos, you’ll need to create a dedicated Augment service account, which will be used to authenticate and start the tunnel. As an admin go to https://app.augmentcode.com > Global Settings > Service accounts > Add Service Account > Enter:- Account Name: Daemon-on-VM-to-access-GHES
- Description: Authenticate daemon pool from the VM that accesses GHES




Step 4 - Create a Cosmos daemon pool
Since you’ll be leveraging a VM to host your daemon, it’s important to think about uptime and resilience: your VM could loose network connectivity or have an outage. The best practice is to create a daemon pool and attach your daemons to that daemon pool. Then you can later have N daemons (1 per VM) all tied to the same daemon pool, and Cosmos will use that pool which will automatically route to the next available daemon. In this guide you’ll create 1 daemon pool and 1 daemon running in 1 VM, but you can extend that approach to spin up 2 more VMs (and their respective daemons) for max resilience. More VMs and daemons also mean scaling horizontally the number of Cosmos sessions running at a given time. Go to cosmos.augmentcode.com > Settings > Environments > Create an environment > Daemon Pool:
- Name: Team01-Pool-GHES
- Daemon connector: select the dedicated service account you created in the section earlier (Daemon-on-VM-to-access-GHES)
- Shared: toggle on
- Workspace behavior:
Isolated workspace



Step 5 - Configure your VM with local GHES repos, gh cli and Cosmos daemon
In this section you’ll configure a VM with the following:- locally cloned GHES repos
ghcli so Cosmos local agents can communicate to GHES- a Cosmos pool + daemon (to establish an outbound websocket tunnel from the VM to Cosmos)
Create the VM, with git and NVM/node
Create a new Linux VM (ex: Ubuntu x86_64) in a VPC that will be able to reach your GHES instance. Minimum config recommended: 4 vCPU, 16 GB RAM, 100 GB SSD. Then SSH onto the VM. Install git:Git clone your GHES repos locally
Create a local ~/workspace/ folder In that workspace folder create folders for your GHES organizations In the corresponding organization folders, git clone your repos (you need at a minimum an empty git repo with at least one commit for the git worktree configuration to be valid and for the agent to start) You should have a “2 layers” folder structure like this:- ~/workspace/<GHES-ORG-NAME-A>/<REPO-NAME-A>/.git
- ~/workspace/<GHES-ORG-NAME-A>/<REPO-NAME-B>/.git
- ~/workspace/<GHES-ORG-NAME-B>/<REPO-NAME-C>/.git
- ~/workspace/<GHES-ORG-NAME-B>/<REPO-NAME-D>/.git
Note: at this moment you have to own making sure that the git repos are locally cloned and are kept up to date regularly. In a future release, daemons will be able to handle that on your behalf - stay tuned
Install and authenticate the gh CLI
Install thegh cli: make sure you’re in your root folder, install the gh cli using this command (source https://cli.github.com/):
gh cli against your GHES instance, run:
gh is properly authenticated, run:
text
Start the daemon
cd into ~/workspace/ Run- “Launch dir is a non-git container; adopting N discovered git repo(s) as workspaces […]” ⇒ check that all your local git repos have been discovered under /workspace/
- “Git worktree support: supported”
- “Joining daemon pool: <YOUR-POOL-ID>”
- “Indexing enabled for workspace: […]”
- “Starting Auggie Daemon […]”
- “Connecting to Cosmos…”


Step 6 - Connectivity test
Now you’ll create a session in Cosmos (cloud) and verify it can connect to the VM (internal network), make sense of the local repos and from that VM reach out to GHES via thegh CLI.
Go to Cosmos cosmos.augmentcode.com > New Session.
Under the prompt, click on the dropdown list with the cloud icon > select Daemon > select your daemon pool:




gh cli to lookup the PR.
Step 7 - Create your Cosmos Experts
Now that connectivity is established, you can focus on creating your Cosmos experts. You’re now ready to deploy the yellow code producing loop of the v1.0 software factory there https://docs.nicopowered.com/cosmos-core-loops-software-factory





Step 8 - Test your PR author
Create a sample PR to test your PR author. Go to cosmos.augmentcode.com > New session > Select PR Author (GHES) and prompt with:

