Agents
Agents that code: changes to your repository
An agent clones a GitHub repository on the team computer, changes the code, runs the tests and opens a pull request for you to review and merge.
spools github code pull request repository
Before you start
Section titled “Before you start”You need an agent with Team computer (browser, terminal, files) enabled in Agent settings → Tools, on a plan that includes the computer (see Team computer). The agent reaches GitHub with a token of yours that it uses without seeing:
- On GitHub, create a fine-grained personal access token for the repository, with Contents and Pull requests set to Read and write (step by step in Create the GitHub token, below).
- In Neurothread, go to Settings → Secrets, select New secret, choose Token or API key, paste it in Token and type
GH_TOKENin Variable name. Select Save.
If the token isn’t saved, the agent asks for it with a form in the chat when it needs it.
Create the GitHub token
Section titled “Create the GitHub token”You do this once for each repository, or for several repositories with the same owner:
- On GitHub, select your profile picture → Settings → Developer settings → Personal access tokens → Fine-grained tokens, and then Generate new token. Or open this form, already filled in with the name and the permissions.
- Give it a name and choose an Expiration. When it expires, create another one and edit the secret.
- Under Resource owner, choose who owns the repository: your account or, if the repository belongs to an organization, the organization. A token only reaches the repositories of one owner.
- Under Repository access, select Only select repositories and pick the repository.
- Under Permissions → Repository permissions, set Contents and Pull requests to Read and write; Metadata stays read-only on its own. If the agent has to change files in
.github/workflows, set Workflows to Read and write too. - Select Generate token and copy it: GitHub only shows it once. Save it in Neurothread as described above.
If your organization doesn’t appear under Resource owner, it blocks fine-grained tokens. An owner can allow them: in the organization, go to Settings → Personal access tokens → Settings, open the Fine-grained tokens tab, choose Allow access via fine-grained personal access tokens and select Save. If the organization requires approval, the token stays pending until an owner approves it in Personal access tokens → Pending requests; tokens created by an owner are approved automatically.
When to use this
Section titled “When to use this”Use it for well-defined changes you would give a developer: fix a bug, add a small feature, write tests, update a dependency. The agent works on its own branch and hands you the change as a pull request: you decide what gets merged.
- Open the agent’s chat and describe the task, naming the repository, for example “In acme/shop, the cart total ignores the coupon. Fix it, add a test and open a pull request.”
- The agent clones the repository on the team computer, creates a branch, searches the code, changes only the lines it needs and runs the tests. You can follow it in the Computer panel and in the tools of its reply.
- When the tests pass, it pushes the branch, opens the pull request on GitHub and replies with its link.
- Review the pull request on GitHub. Ask for changes in the agent’s chat, and merge it yourself when it’s ready.
Worked example
Section titled “Worked example”You write “In acme/shop, the cart total ignores the coupon. Fix it, add a test and open a pull request.” The agent clones acme/shop, creates the branch fix/coupon-total, finds where the total is computed with a code search, changes those two lines without rewriting the rest of the file, adds a test and runs npm test. Then it pushes the branch, opens the pull request “Apply the coupon to the cart total” and replies with its link.
What happens next
Section titled “What happens next”The repository stays in the computer’s home (/home/agent/repos), so later conversations of the same team start from it. Each task gets its own folder in /home/agent/work (a git worktree on its own branch), so several agents of the team can work on the same repository at the same time without getting in each other’s way, and a ticket or pull request always goes back to its folder. Installed dependencies such as node_modules and .venv are not saved when the computer switches off; the agent installs them again when it needs them. Commits show “Neurothread agent” as their author, and the pull request is opened in your name because it uses your token.
Cost and limitations
Section titled “Cost and limitations”The model’s tokens are billed as usual, plus the computer’s time while it works. The model makes the biggest difference: on a long task a premium model can cost many times more than a cheap one. Each reply has a limited number of steps; for a bigger change, write “continue” or split it into smaller tasks.
The computer has git, ripgrep, Python 3 (dependencies go in a virtual environment), Node.js 24 with npm, and GitHub’s CLI. Other languages, databases or services have to be installed in its home, and it has no administrator access. The agent is told never to push to your main branch, but that is an instruction, not a lock: protect the main branch on GitHub so every change goes through a pull request, and give the token access only to that repository.
Troubleshooting
Section titled “Troubleshooting”- It can’t clone or push: check the secret in Settings → Secrets (variable
GH_TOKEN) and the token on GitHub: its Resource owner is the repository’s owner, it has access to that repository, Contents and Pull requests are set to read and write, and it hasn’t expired. A change in.github/workflowsalso needs Workflows. - It stopped before finishing: it used up the steps of a reply; write “continue”.
- The tests need a database or a key: tell the agent how to start the service, or save the key in Secrets.
- It changed something it shouldn’t: comment on the pull request or tell it in the chat. Nothing reaches your main branch until someone merges it.
