Skip to content
mentoor

Set up a team's agent toolchain from zero

For engineers

First API call, choosing agent tools, git for several agents, parallel runs, a shared memory file and docs that agents read.

A team's agent toolchain works when each layer has one owner and one check: a key kept out of the repo, a tool matched to the work, a permission list, a shared memory file, a branch per agent and docs that change with the code.

The case

Tallow Labs is a six-person team that builds Ledger, an invoicing service. On Monday 7 December 2026 the lead, Priya Nair, decides that the team will use coding agents from the first day of the next sprint. Nobody has a setup yet. Some engineers have used Copilot for autocomplete. One has a personal Claude account. Ledger holds client invoices, so privacy terms matter.

This page follows the first week. It uses seven skills, one per step.

Step 1: make one API call the safe way

Before any agent, Priya writes a ten-line script that calls a model API, to learn what the tools do underneath. She creates a project key, stores it in an environment variable and installs the official SDK. The request carries a model id, a max_tokens limit and a list of messages. The API is stateless, so every request must resend the history it needs. In the response she reads the text, then stop_reason, then the token usage and the request id. A stop reason of max_tokens means the answer was cut off. Her first draft had the key in the file. She deletes it, revokes that key and creates a new one.

Step 2: pick tools by what they can touch

Tools differ in what they can read, run and change: autocomplete, chat, IDE agents, terminal agents and cloud agents. Ledger needs a tool that can run the local test suite, so the team picks a terminal agent as primary and an IDE assistant as the fallback. Before that, Priya reads each vendor's data-use terms against the client contract: training opt-outs, retention and zero-retention options. A plan's quota decides how many long runs a day the team can afford.

Step 3: first terminal session, with a short allow-list

An engineer starts the agent at the repository root and gives it a small task that ends in a passing test. Priya sets permissions so that reading, editing and npm test need no prompt, while git push, deletes and network calls always ask. She reads the first transcript line by line. The agent must show real test output, not just say the tests pass.

Step 4: one memory file for every tool

The agent forgets everything between sessions, so the repo gets an AGENTS.md with the exact build and test commands, the conventions an agent would get wrong and the folders it must not touch. Claude Code reads CLAUDE.md, so that file holds one line that imports AGENTS.md. There are no secrets, no pasted documentation and no temporary facts. Each rule is tested: run the same task with and without it and compare transcripts.

Step 5: git rules for many committers

Each agent works on its own branch in its own worktree. In a shared checkout, commits name explicit paths, never git add -A. After a bad reset --hard, the reflog still holds the lost commits. Branch protection on main stops force pushes.

Step 6: run agents in parallel, within review capacity

Three tasks touch the invoice type. Priya changes the shared type first and merges it. Only then do two agents start, each with its own files. She merges one branch at a time, runs the full tests after each merge and reads the combined diff. She runs only as many sessions as she can review.

Step 7: docs change in the same pull request

An agent that renames a setting must update the README in the same pull request. Priya asks agents to cite the source line for every claim in generated docs, and she checks a sample. Decisions go into short architecture decision records written by a person, with the agent drafting from meeting notes.

What goes wrong

  • A key reaches the repo history and stays there after the file is fixed.
  • The agent says "tests pass" after running one test file.
  • Two agents edit the same type and the merge hides a lost change.
  • The memory file fills with stale facts and the agent obeys them.
  • Generated docs describe a parameter that does not exist.

Before and after

Before: one shared checkout, three agents, git add -A, keys in a script, a 400-line memory file. After: one branch and worktree per agent, a ten-line memory file with real commands, an allow-list, and docs in each pull request.

Steps

  1. Make the first API call without leaking the key

    Skill: api-first-call

    Create a project key, export it as an environment variable and read it at runtime. Send a model id, a max_tokens limit and the messages. Read the text, then stop_reason, then usage and the request id. If a key ever appears in a commit, revoke it and issue a new one.

    first_call.py

    scripts/first_call.py

    import os, anthropicclient = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])msg = client.messages.create(    model=MODEL_ID,  # a pinned snapshot id    max_tokens=500,    messages=[{"role": "user", "content": "Summarise invoice INV-2041 in one line."}],)if msg.stop_reason == "max_tokens":    raise RuntimeError("answer truncated")print(msg.content[0].text, msg.usage, msg._request_id)
  2. Choose a primary and a fallback tool

    Skill: code-landscape

    Sort tools by what they can read, run and change. Check each vendor's data-use terms against the client contract first. Then compare repository fit, model access and cost, and name one primary tool and one fallback.

    Tool shortlist for Ledger
    KindCan readCan runCan change
    AutocompleteOpen fileNoCurrent line
    Chat assistantWhat you pasteNoNothing
    IDE agentWorkspaceSome tasksWorkspace files
    Terminal agentRepo and shellTests, build, gitRepo files
    Cloud agentHosted copy of the repoIn its sandboxA branch or pull request
  3. Run a first terminal session with an allow-list

    Skill: code-cli-agents

    Start the agent at the repository root with a small task that ends in a passing test. Allow reads, edits and the test command. Leave pushes, deletes and network calls on ask. Read the transcript and demand real command output.

    .claude/settings.json

    .claude/settings.json

    {  "permissions": {    "allow": ["Read", "Edit(src/**)", "Bash(npm test)", "Bash(npm run lint)"],    "ask": ["Bash(git push:*)", "Bash(rm:*)"]  }}
  4. Write one memory file that every tool reads

    Skill: harness-memory-files

    Put exact commands, conventions an agent would get wrong and no-go folders in AGENTS.md. Add a CLAUDE.md that only imports it. Leave out secrets, copied docs and temporary state. Test each rule by running a task with and without it.

    AGENTS.md and CLAUDE.md

    AGENTS.md

    # Ledger
    - Test: `npm test` (all), `npm test -- src/money` (one folder)
    - Lint: `npm run lint`
    - Money is stored as integer cents. Never use floats.
    - Do not edit `migrations/` or `vendor/`.
    - Architecture: see docs/code-map.md

    CLAUDE.md

    @AGENTS.md

  5. Give every agent its own branch and worktree

    Skill: eng-git

    Create one short-lived branch and one worktree per agent task. In a shared checkout, stage explicit paths only. Know the reflog recovery command and turn on branch protection for main.

    Worktree setup
    git worktree add ../ledger-rounding -b agent/roundinggit worktree add ../ledger-export -b agent/export# in a shared checkout:git add src/money/rounding.ts tests/rounding.test.tsgit commit -m "Round half-even in invoice totals"
  6. Split work by file area and merge in order

    Skill: code-parallel

    Freeze shared contracts first: change the shared type, merge it, then start the agents. Give each agent non-overlapping files. Merge one branch at a time, run the full tests after each merge and cap sessions at what one reviewer can check.

    Sprint 1 parallel plan

    Goal: Add PDF export and half-even rounding

    1. Priya: add `roundingMode` to `types/invoice.ts`, merge to main
    2. Agent 1 (src/money/**): implement half-even rounding
    3. Agent 2 (src/export/**): PDF export
    4. Merge agent 1, run all tests; merge agent 2, run all tests
    5. Priya reads the combined diff
  7. Update docs in the same pull request

    Skill: sdlc-docs

    A change that alters behaviour updates the README, API docs and examples in the same pull request. Ask agents to cite the source line for each documented claim and check a sample. A person owns each decision record.

    Docs change with the code

    README.md

    unchanged ## Configurationremoved - `LEDGER_ROUND` : rounding mode, default `half-up`added - `LEDGER_ROUNDING` : rounding mode, default `half-even`

Skills this scenario uses

Where to study