How I Track What Codex and Claude Code Do on GitHub
One of the first commits in Desco added four lines to TEST.md. A coding agent made the change, and on GitHub the commit showed up under my name. It was only four lines, but what would I see when the agent gave me a change I actually needed to review?
I started Desco to learn AI engineering by doing. For this project, I want the coding agents to write the code. Part of what I want to learn is how to give them work, coordinate what they do, and decide what they’re allowed to do. Desco on GitHub
Before giving Claude Code and Codex bigger tasks, I wanted to be able to check a few things right in GitHub. Which account pushed the change? Which tool made it? What did I ask it to do, and what did it check before handing the work back to me?
I gave both tools a shared GitHub machine account and ran them in a Linux development container (dev container) on my Mac. The branch name and commit author tell me which tool made the change. The draft pull request (PR) gives me the task, the diff, and a record of what the agent says it checked. I review and merge from my own account.
Give the agents a GitHub account of their own
I used a separate Brave profile for the machine account. I kept both profiles open while setting things up, so I could see which account I was using before I clicked anything. Both tools share the machine account, so I manage their repository access in one place.
-
Create and secure the account. Sign up in the new browser profile with an email address you can verify. If your email provider supports plus addressing, you can use an alias like
myname+alias@mydomain.com. Under Settings → Password and authentication, enable two-factor authentication and save the recovery codes. -
Copy the machine account’s noreply address. In Settings → Emails, turn on Keep my email addresses private and copy the address GitHub shows you. It looks like
12345678+your-agent@users.noreply.github.com. You’ll use the number before the+and the username after it in the setup script. -
Give the account access to the test repository. From your personal account, open the repository’s Settings → Collaborators → Add people and invite the machine account. Accept the invitation in the other browser profile. If you’re starting from scratch, initialize the repository with a README so there’s a default branch to open PRs against.
- Create the
agentlabel. Back in your personal profile, open Issues → Labels → New label. I called mineagent, gave it the description “Opened by a coding agent” and the color#5319E7. I use it to find the agents’ PRs in the repository.
Authenticate the push and sign the commit
The personal access token (PAT) lets Git and the GitHub CLI act as the machine account over HTTPS. I use a separate SSH key to sign commits and register its public half with GitHub so it can verify the signatures.
I keep both credentials under ~/.agent-secrets on the host, outside the checkout. Run these commands on the host to create the directory and prepare the file Docker will read.
mkdir -p ~/.agent-secrets # Create the directory if it doesn't exist.
chmod 700 ~/.agent-secrets # Give only the owner access to the directory.
(umask 077 && touch ~/.agent-secrets/agent.env) # Create the file with owner-only permissions.
chmod 600 ~/.agent-secrets/agent.env # Limit read and write access to the owner, even if the file already existed.
On Windows, open your Windows Subsystem for Linux (WSL 2) shell from PowerShell with wsl and run the same commands there. That puts ~/.agent-secrets in your WSL home directory. I tested this setup on macOS.
In the machine account’s browser profile, open Settings → Developer settings → Personal access tokens → Tokens (classic). Generate a classic token with an expiration date and select the repo scope. I left workflow unchecked.
I used a classic token because my machine account is a collaborator on a personal repository I own. GitHub lists repository collaborators as a limitation of fine-grained tokens. The classic token can reach the repositories my machine account has access to, so I keep that list short.
Open ~/.agent-secrets/agent.env in a local editor and replace the placeholder below with your token. Docker passes it to the container as GH_TOKEN. When you rotate the token, update this file and recreate the container so it picks up the new value.
GH_TOKEN=PASTE_MACHINE_ACCOUNT_TOKEN_HERE
I generated a dedicated Ed25519 signing key on the host. I left the passphrase empty so the agents could sign commits without waiting for me to type it. The last command prints the public key you’ll register on GitHub.
ssh-keygen -t ed25519 -f ~/.agent-secrets/agent_ed25519 -N '' # Generate a signing key without a passphrase.
chmod 600 ~/.agent-secrets/agent_ed25519 # Restrict access to the private key to its owner.
cat ~/.agent-secrets/agent_ed25519.pub # Print the public key to register on GitHub.
In the machine account, go to Settings → SSH and GPG keys → New SSH key. Select Signing key as the key type, paste the line from the .pub file, and save it.
Run Claude Code and Codex in the same dev container
A dev container is a container set up with the runtimes and command-line tools you need to work on a project. You keep the configuration in the repository so you can recreate the environment on another machine.
For Desco, this gives Claude Code and Codex a shared Linux environment for their work. When an agent runs a build or a test, it uses the tools installed inside the container. Both agents use the machine account’s Git credentials there, and I use my personal GitHub account on my Mac.
VS Code reads .devcontainer/devcontainer.json to build and open the dev container. In this setup, it mounts my local checkout into the container, so the agents can edit the project files and I can see their changes in the same checkout on my Mac. VS Code’s Dev Containers overview
I started with Anthropic’s Claude Code dev container and added Codex to the same image. That gave me one checkout and one GitHub account to set up. Each tool still has its own login, stored in its own Docker volume.
On my Mac I use Docker Desktop, VS Code, and the Dev Containers extension. Run docker info on the host to check that you can reach Docker.
On Windows, use Docker Desktop with WSL 2 integration and the VS Code WSL extension. Open the project from WSL, keep the checkout and secrets under your WSL home directory, and run the host commands there. On Linux, you can use Docker Engine.
I push the setup files from the host using my personal GitHub account. If you already push over HTTPS from the host, you can keep using your existing login. Otherwise, install the GitHub CLI, run these commands on the host, and sign in as yourself in the browser.
gh auth login --hostname github.com --git-protocol https --web # Sign in to your personal account in the browser.
gh auth setup-git --hostname github.com # Configure Git to use GitHub CLI credentials.
gh auth status # Check which account is active.
Clone your repository over HTTPS. If you already have a checkout, use git remote -v to check both the fetch and push URLs. To switch the remote to HTTPS, run git remote set-url origin https://github.com/OWNER/REPO.git with your repository’s owner and name. If you’ve configured a separate push URL that still uses SSH, update it with git remote set-url --push origin https://github.com/OWNER/REPO.git.
Copy Anthropic’s starter
If your checkout has no .devcontainer directory yet, run this block from the repository root. It extracts the three starter files from the Anthropic revision I originally imported into Desco. If you already have a .devcontainer, run the block from a temporary directory so you can compare the files before merging.
claude_reference="$(mktemp -d)" # Create a temporary directory for the reference clone.
# Clone Claude Code without checking out its files.
git clone --filter=blob:none --no-checkout https://github.com/anthropics/claude-code.git "$claude_reference"
# Extract the starter .devcontainer directory from the specified commit.
git -C "$claude_reference" archive d945a61bc6346abce607252d5667df8a3bf0461a .devcontainer |
tar -xf -
The Dockerfile installs Claude Code and its tools. The devcontainer.json file tells VS Code how to start the container, and init-firewall.sh limits outbound traffic. I kept all three and added a fourth file to set up Git for the machine account.
Adapt the starter for both agents
From the root of your checkout, grab the Git setup script and workflow files from Desco. The commit hash gives you the version I’m describing here. Keep this terminal open so you’ll still have $desco_reference when you copy the files.
desco_reference="$(mktemp -d)" # Create a temporary directory for the reference clone.
git clone --no-checkout https://github.com/teopenna/desco.git "$desco_reference" # Clone Desco without checking out its files.
# Extract the setup and workflow files into the temporary directory.
git -C "$desco_reference" archive \
be571fa818f0fa03f9ecf8430f15f7bea6c2fb46 \
.devcontainer/setup-agent-git.sh .githooks/commit-msg .github/pull_request_template.md \
AGENTS.md CLAUDE.md |
tar -xf - -C "$desco_reference"
Dockerfile
I hit a permission error when Codex tried to save its login to a volume owned by root. To set up the right permissions for a new volume, add this before the first USER node line in the Dockerfile.
RUN mkdir -p /home/node/.codex && \
chown -R node:node /home/node/.codex
Codex can use the same Node.js image as Claude Code. Add ARG CODEX_VERSION=latest below ARG CLAUDE_CODE_VERSION=latest, then add the npm command below after the line that installs Claude Code. Desco’s Dockerfile
RUN npm install -g @openai/codex@${CODEX_VERSION}
devcontainer.json
Append the entries below to the existing runArgs and mounts arrays. Add CODEX_HOME to containerEnv, then add remoteEnv and postCreateCommand at the top level. Keep the starter’s firewall capabilities, Claude Code volume, and postStartCommand. Desco’s dev container configuration
{
"runArgs": [
"--env-file",
"${localEnv:HOME}/.agent-secrets/agent.env"
],
"mounts": [
"source=${localEnv:HOME}/.agent-secrets/agent_ed25519,target=/run/agent-secrets/agent_ed25519,type=bind,readonly",
"source=codex-config-${devcontainerId},target=/home/node/.codex,type=volume"
],
"containerEnv": {
"CODEX_HOME": "/home/node/.codex"
},
"remoteEnv": {
"SSH_AUTH_SOCK": ""
},
"postCreateCommand": "bash .devcontainer/setup-agent-git.sh"
}
Docker passes GH_TOKEN in from the env file and mounts the signing key read-only. The Codex login lives in a volume so it survives rebuilds. VS Code runs the Git setup script through postCreateCommand when it creates the container.
init-firewall.sh
In the for domain in list, add "api.openai.com", "auth.openai.com", and "chatgpt.com" after "api.anthropic.com". Put each quoted domain on its own line with a trailing backslash. I also changed both ipset add allowed-domains calls to ipset -exist add allowed-domains so the script can keep going if it sees the same IP address twice. Desco’s firewall script
setup-agent-git.sh
Copy the script into .devcontainer. It installs the signing key with owner-only permissions, sets the machine account’s Git identity and signing settings, and configures gh as the HTTPS credential helper. It also adds two Zsh functions to start the tools, ccl for Claude Code and cx for Codex. Desco’s Git setup script
cp -i "$desco_reference/.devcontainer/setup-agent-git.sh" .devcontainer/ # Copy the Git setup script.
Set AGENT_LOGIN and AGENT_ID from the noreply address you copied earlier. For 12345678+your-agent@users.noreply.github.com, use your-agent and 12345678, respectively.
In both launch functions, replace teopenna-agent in GIT_AUTHOR_NAME and GIT_COMMITTER_NAME with your machine account’s username. Keep the (claude) and (codex) suffixes so you can tell the tools apart in the commit history. Change the last command in cx to codex "$@" to use Codex’s default sandbox and approval behavior.
The functions also set AGENT_NAME, which the shared instructions use to pick the branch prefix.
Put the handoff instructions in the repository
I could tell which tool made a commit, but I still wanted to review its work without digging through the original chat. The PR template asks the agent to record the original task, which tool did the work, the instructions it got, what changed, what it checked, and any risks or follow-ups.
I put the workflow in AGENTS.md for Codex and added @AGENTS.md to CLAUDE.md so Claude Code reads the same file. That’s one set of instructions for me to maintain.
mkdir -p .github # Create the directory for the PR template.
cp -i "$desco_reference/AGENTS.md" "$desco_reference/CLAUDE.md" . # Copy the agent instructions to the repository root.
cp -i "$desco_reference/.github/pull_request_template.md" .github/ # Copy the PR template into .github.
Replace teopenna in AGENTS.md with your personal GitHub username. If you already have agent instructions, merge in the Git and GitHub workflow and add the import to your existing CLAUDE.md.
The shared instructions tell the agents to make a signed commit on a branch like agent/codex/42-fix-login-timeout, reference the issue if there is one, and open a draft PR with the agent label. I decide when to mark it ready and take care of the review and merge.
I also added a commit-msg hook to list my personal account as a co-author on agent commits. It checks the commit author’s email before adding the trailer. If you want the same attribution, copy the hook and update it with your details.
mkdir -p .githooks # Create the directory for Git hooks.
cp -i "$desco_reference/.githooks/commit-msg" .githooks/ # Copy the co-author attribution hook.
In the hook’s email check, replace teopenna-agent with your machine account’s username. In the Co-authored-by: trailer, use your own name and personal GitHub noreply address.
Then make the hook executable and tell Git where to find it. Git stores the hook path in the local config, so set it again in each new clone where you want the hook to run.
chmod +x .githooks/commit-msg # Make the hook executable.
git config --local core.hooksPath .githooks # Point this checkout's Git config to .githooks.
From the host, stage the dev container files, instructions, and PR template. If you copied the hook, run git add .githooks/commit-msg before checking the staged files and committing.
# Stage the dev container files, agent instructions, and PR template.
git add .devcontainer/Dockerfile .devcontainer/devcontainer.json \
.devcontainer/init-firewall.sh .devcontainer/setup-agent-git.sh \
AGENTS.md CLAUDE.md .github/pull_request_template.md
git diff --cached --stat # Review a summary of the staged changes.
git commit -m "Configure coding agent workflow" # Commit the setup files.
Push the setup from your own account. If the default branch is already protected, use your usual PR workflow to merge the files into it.
Rebuild, then check what the agents can reach
Before opening the container in VS Code, I changed two host user settings. Open Preferences: Open User Settings (JSON) from the Command Palette and add these entries to the existing settings.
{
"dev.containers.copyGitConfig": false,
"dev.containers.gitCredentialHelperConfigLocation": "none"
}
These settings control how the extension copies Git config and sets up its credential helper. VS Code can still expose a forwarded SSH agent socket even if SSH_AUTH_SOCK is empty in the terminal. Before I give either tool work, I check which GitHub account and Git identity it will use.
Run Dev Containers: Reopen in Container from the Command Palette, or Dev Containers: Rebuild Container if you already opened it. In a fresh terminal inside the container, check the user, token, and Git signing settings.
whoami # Check which user the container shell runs as.
test -n "$GH_TOKEN" && echo "Agent token is present" # Check that the token is set without printing it.
gh auth status # Check that GitHub CLI uses the machine account.
git config --show-origin --get user.email # Show the effective Git email and where it is set.
git config --get gpg.format # Check that Git uses SSH for signing.
git config --get commit.gpgsign # Check that Git signs commits by default.
ls -l ~/.ssh/agent_ed25519 # Inspect the private key's permissions.
I expect whoami to print node and gh auth status to show the machine account. Git should show the machine account’s noreply address, ssh for gpg.format, and true for commit.gpgsign. The private key should have -rw------- permissions.
If Git still shows your personal email, --show-origin tells you where it came from. The checkout’s local Git settings can override the container’s global config.
If startup fails, open Dev Containers: Show Container Log and look for the output from init-firewall.sh. If you edit the script, rebuild the container. The Dockerfile copies it into the image. Desco’s firewall script
You can repeat two of the firewall checks from the container terminal. The request to the GitHub API should succeed. The request to example.com should fail.
curl --connect-timeout 5 --max-time 10 -fsS https://api.github.com/zen # Check that the GitHub API is reachable.
curl --connect-timeout 5 --max-time 10 -fsS https://example.com -o /dev/null # Check that the firewall blocks example.com.
Run type ccl and type cx in the container to check that both functions are available. If you’re in Bash and the functions are missing, start zsh. That’s where the setup script installs them.
Run ccl and follow Claude Code’s sign-in prompts. Once you reach its prompt, you can exit. The login is stored in the volume mounted at /home/node/.claude.
For Codex, enable device code login in your ChatGPT security settings and run codex login --device-auth in the container. Open the URL it gives you in your browser and enter the code. Back in the container, run codex login status to check that it worked.
I got Permission denied (os error 13) because root owned my existing Codex volume. The Dockerfile sets the ownership for new volumes. To fix an existing volume, run docker ps on the host to find the container ID, then run docker exec -u root CONTAINER_ID chown -R node:node /home/node/.codex with that ID and try signing in again.
Require a review on the default branch and signatures on agent branches
I wanted GitHub to enforce two parts of the workflow. Agent branches need signed commits, and changes to the default branch need a review. I set these up as separate rulesets. On a private personal repository, you’ll need GitHub Pro.
-
Protect the default branch. From your personal account, go to Settings → Rules → Rulesets → New ruleset → New branch ruleset. Set enforcement to Active and choose Add a target → Include default branch. Select Require a pull request before merging, set the required approvals to
1, and enable dismissal of stale approvals. Enable Block force pushes and Restrict deletions. If you have status checks you want to enforce, add them here.If you’re the only human on the project, remember that PRs you open from your personal account need another eligible reviewer unless you configure an owner bypass. GitHub has a For pull requests only bypass option.
-
Require signed commits on agent branches. Create a second active branch ruleset. Leave the bypass list empty, select Add a target → Include by pattern, and enter
agent/**/*. Enable Require signed commits. Leave Restrict deletions unchecked if you want to delete agent branches once you’re done with them.I used
agent/**in Desco. GitHub reported that it matchedagent/setup-smoke-testand missedagent/codex/setup-smoke-test. The extra/*inagent/**/*makes the ruleset apply to nested branches. GitHub’s branch pattern syntax
You can ask GitHub which active rules apply to a branch name before the branch exists. Run this from the host with your repository’s owner and name in place of OWNER and REPO.
# List the rules that apply to the example agent branch.
gh api 'repos/OWNER/REPO/rules/branches/agent%2Fcodex%2Fsetup-smoke-test' \
--jq 'map(.type)'
Look for required_signatures in the array. If you get [], GitHub found zero active rules for that branch name. Open the signing ruleset and check that it’s Active, that the include pattern is agent/**/*, and that no exclude pattern matches the branch. Save any changes and run the same check again.
Before I give the agent a real task, I want to be able to answer these questions.
- Who pushed and opened the PR? In the repository’s Activity view, check that the machine account pushed the branch. Open the draft and check that the same account opened it and that the branch name and
agentlabel are there. To see all open agent PRs, filter the repository’s PR list withis:pr is:open label:agent. - Which tool made the commit? Run
git log -1 --format='%an <%ae>%n%b'and look for the machine account’s email, the(codex)suffix on the author name, and the co-author trailer if you enabled the hook. In the PR’s Commits tab, check for GitHub’s Verified badge. To check Claude Code, return to the default branch, startccl, and repeat withagent/claude/setup-smoke-test. That commit should have the(claude)suffix. - Do I have enough to review it? Compare the PR description with the original task, then open Files changed and check that the diff contains just the test file. For a real change, I’d mark the PR ready and manage the review from my personal account. For the smoke test, you can close the draft and delete the branch once you’ve checked it.
What would I do again on the next project? Open a tiny PR. The hook was already in the repository after PR #5, but it took another PR to see it add the co-author trailer. Next time I rebuild the container or rotate the token, I’ll start with a small change and follow it all the way to GitHub before giving the agents a bigger task.
As always, you can find the code on GitHub. Desco