Skip to main content

Introduction

In this page you’ll learn how to configure those items:
  1. Get GHES to push events (ex: “new PR created”) to Cosmos via webhooks
  2. Configure a Cosmos Daemon on a VM (where the GHES local repos will be cloned locally)
  3. Get Cosmos to interact with GHES via the gh cli
  4. Deploy your first Cosmos PR experts and v1.0 software factory
Below is the flow showing how a PR deep code reviewer expert will automatically trigger when a PR is created: Below is a high level architecture diagram of the components at play: Image

Prerequisites

To configure the one-time connectivity between Cosmos and GHES: Cosmos
  • must be an admin to create a Augment service account and webhooks
GHES
  • 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)
Your infra

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): Image
  • Enter Description: GHES + <url-to-your-GHES-instance> > Click on Create
Screenshot 2026 09 07 At 9 15 29 AM You’ll obtain a Webhook URL and a Secret token. Copy them and click on Done: Image

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
Image Image You should see a banner confirming the hook has been created and a test payload has been sent: Image Now go back to Cosmos and check that Cosmos received the event: cosmos.augmentcode.com > Settings > Automations > Events Log. You should see your event with source “Webhook · Github”: Screenshot 2026 09 06 At 12 30 01 PM Click on the event to inspect the test payload: Screenshot 2026 09 06 At 12 31 02 PM At this point GHES will automatically notify Cosmos whenever a PR is created/updated/commented on ✅

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)
Now, this service account needs to be granted access to the GHES repos in scope, either at the enterprise level, or at the organization level, or per repo. If per repo: ask a human repo owner to navigate to the repo > Settings tab > Collaborators > Add people > invite the service account. The repo owner should now see the service account as a collaborator: Image As you’re signed-in using that GHES service account user, click on your avatar top right > Settings > Developer settings > Personal access tokens > Fine-grained tokens > Generate new token, with those details:
  • 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
  • Click on Generate token
Screenshot 2026 09 06 At 3 56 23 PM You should see this popup: Screenshot 2026 09 06 At 4 02 38 PM Click on Generate token, you’ll see your PAT token value. Copy it you’ll need it later: Screenshot 2026 09 06 At 4 03 05 PM

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
Click on Add: Screenshot 2026 09 06 At 7 46 57 PM Screenshot 2026 09 06 At 7 48 49 PM Click on Add API Token > token name: token01 > Click on Add: Screenshot 2026 09 06 At 7 52 39 PM Click on Download JSON: Screenshot 2026 09 06 At 7 50 28 PM You’ll obtain a session.json, it will be used to authenticate the Cosmos daemon pool later on.

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: Configure the pool with:
  • 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
Then click on Create Pool: Screenshot 2026 09 06 At 7 57 22 PM You’ll get the confirmation that the pool has been created, note the pool-id: Screenshot 2026 09 06 At 7 58 17 PM Go back to your list of environments, you should see your pool (with no daemon online yet): Screenshot 2026 09 06 At 7 59 48 PM

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
  • gh cli 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:
Verify the installation
You should get:
Install NVM
Refresh the terminal profile
Install the latest Long-Term Support (LTS) version of Node & NPM
Verify the node install
You should get:

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 the gh cli: make sure you’re in your root folder, install the gh cli using this command (source https://cli.github.com/):
Verify the version, run:
You should get:
Then authenticate the gh cli against your GHES instance, run:
Then verify gh is properly authenticated, run:
You should see:
text

Start the daemon

cd into ~/workspace/ Run
Paste in there the content of session.json you retrieved earlier when creating the Augment service account. Then CTRL-O + RETURN to save the file and CTRL-X + RETURN to exit Install Auggie
Start the Cosmos daemon using the Augment service account and attach the daemon to the pool, run:
That will start the daemon, you should see this:
Note in your daemon logs:
  • “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…”
You can now see the daemon running from Cosmos: cosmos.augmentcode.com > Settings > Environments: Screenshot 2026 09 07 At 7 18 46 AM Click on the pool. Note that 1 daemon is online, and you can see the VM IP/name under Connected daemons. Top right you can set this pool as default environment to run your agents: Screenshot 2026 09 07 At 7 19 04 AM

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 the gh 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: Screenshot 2026 09 07 At 7 24 37 AM Hover over Integrations and make sure “Github App” isn’t selected (that’s only for github.com): Screenshot 2026 09 07 At 7 25 32 AM Prompt the session with What are those repos about?, you should see a response powered by the Augment Context Engine that already made sense of your repos: Screenshot 2026 09 07 At 7 27 14 AM The connectivity between Cosmos (cloud) and your remote VM has been verified ✅ Now prompt the session with:
Screenshot 2026 09 07 At 7 29 27 AM Observe that the Cosmos session was able to use the 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 Screenshot 2026 09 07 At 7 43 58 AM Go to Cosmos cosmos.augmentcode.com > New Session > Select Cosmos Advisor > Make sure your GHES daemon pool is selected as environment, then edit and prompt with:
You should see this before submitting: Screenshot 2026 09 07 At 9 30 14 AM
In the prompt you explicitly asked “Make sure the experts are shared with <YOUR-EMAIL> as owner” as by default the owner would be the Augment service account you authenticated the daemon pool with
You should see this after submitting: Screenshot 2026 09 07 At 8 39 54 AM
Advisor will also recommend experts you should consider, as it did above for the Code Review Memory Manager. In a separate session you could also ask Advisor “what are all the experts you could help me deploy for my software factory”
Your experts are now deployed, you can see them under cosmos.augmentcode.com > Settings > Experts > All tab: Screenshot 2026 09 07 At 8 13 43 AM When you click on an expert > Share expert you can see Advisor applied the permissions you requested: Screenshot 2026 09 07 At 8 48 41 AM The experts are ‘stitched’ together under cosmos.augmentcode.com > Settings > Automations > All tab. You can expand the first Deep Code Reviewer (GHES) automation and observe the high level events this expert will react to: Screenshot 2026 09 07 At 8 50 18 AM
You can instruct Advisor to update your experts and use other native integrations (ex: Jira/Atlassian) as often you’ll want to author PRs based on a ticket

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:
or, if you already deployed your experts with the native Jira integration:
Screenshot 2026 09 07 At 8 59 32 AM You should see this: Screenshot 2026 09 07 At 9 05 27 AM The PR Author created the PR, and downstream the PR Risk Analyzer, Deep Code Reviewer, PR Fixer and Pair Reviewer will trigger automatically. The PR Author is a powerful orchestrator that will handle all that for you, and keep tabs on the comments, CI statuses etc. Click on the PR link that the PR Author created, and you’ll see all the code producing experts at play to get the PR ready for a final review: Screenshot 2026 09 07 At 9 13 48 AM
When you start the PR author manually/interactively as you did earlier, it may author the PR in draft. Switch it to ready for review to observe the experts at play. Your PR author can also be invoked via automation and other expert like Project Builder
Congratulations, you’ve deployed your first experts and v1 software factory code producing loop with GHES! 🎉