← Back to Blog🇮🇹 Leggi in Italiano

Using Claude Code as a Team: Sharing Context and Decisions Across Developers

When everyone runs their own Claude Code session, the project splits apart. Six practical measures with git, CLAUDE.md, worktrees and handoffs to stay aligned.

Claude Code was built as a single-developer tool, and it shows as soon as three people use it on the same repository. Each one opens their own session, explains the project in their own way, makes decisions together with the AI and leaves them in their own chat. A week later the code has three styles, two libraries doing the same job, and nobody remembers why authentication works the way it does.

This guide is the practical side of the problem: what to do starting tomorrow morning, with tools you already have (git, markdown files, pull requests). If you're after the market overview instead, meaning which tools exist to coordinate a team's agents and how they compare, I wrote that up in the article on team coordination for AI-assisted development. I won't repeat that comparison here.

What breaks when everyone has their own session

The cause is always the same: every Claude Code session starts with a fresh context window. What Claude knows about the project at the start is only what it finds written in the files it loads. Everything else, the explanation you gave yesterday, the library you ruled out, the constraint agreed in a meeting, lives in the conversation and dies there. In a team this produces four recurring problems:

  • Divergent assumptions: Anna told her session that dates are stored in UTC, Marco didn't. The two sessions write code consistent with two different projects.
  • Duplicated work: two people ask the AI to "add form validation" and get two different helpers in two different folders.
  • Lost decisions: choosing Postgres over MongoDB was discussed at length in a chat nobody else will ever see.
  • Conflicting edits: two sessions touch the same files, and the merge becomes the moment everything comes to light.

None of these is a flaw in the AI. It's the same problem teams already had, just faster: the AI produces code quickly, so divergence piles up quickly. It's also one of the reasons AI-generated code breaks as a project grows.

$ claude --worktree feature-authWiring knowledge graph... doneStarting MCP servers... done
01
Put the project CLAUDE.md in git

The first piece of shared context is the project CLAUDE.md, at the repository root (or in .claude/CLAUDE.md). The official documentation describes it exactly that way: instructions shared with the team through version control. Claude Code loads it at the start of every session, so it's the one place where you write something once and find it in every session of every teammate.

Three files with different roles, worth keeping apart:

FileWhere it livesWho sees it
CLAUDE.mdproject root, in gitthe whole team
CLAUDE.local.mdproject root, in .gitignoreonly you, on that project
auto memory~/.claude/projects/.../memory/only your machine

The last row is the one that surprises people most: the memory Claude writes on its own is local to the machine and isn't shared with teammates. If something has to apply to everyone, it goes in the CLAUDE.md in git, not left to auto memory. There's a dedicated guide on what to put in it and what to leave out: how to write a good CLAUDE.md.

02
Write decisions as versioned files

CLAUDE.md holds short rules. Decisions, with their reasoning, need more room and grow over time: put them all there and the file becomes long and expensive to load in every session (I cover this in the guide on how to cut context tokens). The simple fix is a docs/decisions/ folder with one markdown file per decision:

docs/decisions/0007-dates-in-utc.md

0007 Dates always stored in UTC

Status: accepted, 2026-11-12

Context: the back office has users in two time zones and the nightly reports were assigning the wrong business day.

Decision: the database stores UTC only, conversion to the user's time zone happens only in the interface.

Rejected: storing local time with the zone in a separate column, too easy to forget the second column.

In CLAUDE.md a single line is enough: "before changing architecture, read docs/decisions/". The advantage over the chat: the decision goes through code review like code does, it has an author and a date, and any session of any teammate can read it.

03
One session, one branch, one worktree

Two sessions working in the same folder step on each other even when they belong to the same person. The practical rule is one session per branch, and one branch per worktree. A git worktree is a second working copy of the same repository, on its own branch. Claude Code creates it directly:

terminal

claude --worktree feature-auth

Each session then works in an isolated copy and changes only meet at merge time, where you can see them. For a team the discipline to agree on is simple: whoever opens a session declares the branch in the ticket or the team channel, so two people don't ask the AI for the same thing at the same time.

04
Close every session with a handoff note

When you close a long session, ask Claude to write a handoff note before you leave. It isn't the chat history: it's five lines for whoever picks up the work, you tomorrow or a teammate.

prompt in Claude Code

Write to docs/handoffs/2026-11-20-auth.md what we did, what's still open, which files you touched and which decisions came up. If a decision is final, also propose the file in docs/decisions/.

The note goes on the branch together with the code. Whoever opens the pull request or picks up the branch finds the state of the work without having to ask, and their Claude Code session can read it like any other file.

05
Agree on rules for AI-generated pull requests

The pull request is where work from different sessions meets, so that's where the rules belong. Three are enough to start:

  • Say what the AI wrote: not to assign blame, but so the reviewer knows where to look more carefully.
  • Link the decision: if the PR applies or changes a decision, link the file in docs/decisions/. A PR that changes architecture without a written decision gets sent back.
  • Small PRs: the AI generates a lot of code fast, but human review stays slow. Three 200-line PRs beat one 600-line PR.

If Claude creates the PR with gh pr create, Claude Code links the session to the PR, and claude --from-pr followed by the number finds it again later. Useful when a reviewer asks "why is it done this way" and you want to pick up from the original session.

06
Review the shared rules together

A CLAUDE.md written by several people tends to collect contradictory rules. The official documentation is explicit: if two instructions contradict each other, Claude may pick one arbitrarily. Claude also treats these files as context, not enforced configuration: a constraint that must always hold needs a hook, not one more line.

One review every two weeks, half an hour, with one question per line: "is it still true, and do we actually follow it?". Changes to CLAUDE.md go through a PR like the rest of the code, so nobody changes everyone's rules without the others seeing it.

When files stop being enough

The six measures above work well for a small team and one project at a time. They start to strain in three situations: when decisions number in the hundreds and finding the right one requires already knowing where to look, when knowledge has to move between different projects, and when you need to know in real time what other people's sessions are doing.

For the first case a knowledge graph helps: decisions stay markdown files, but they become searchable by meaning and linked to each other. I've explained what a knowledge graph is for AI coding and how to give Claude Code persistent memory step by step. The connection to Claude Code goes through an MCP server, the protocol covered in the article on MCP and Claude Code.

For the third case, real-time coordination, you need a shared backend that every session can read and write. We built the Coordination MCP: an MCP server backed by a shared Supabase project, with queryable decisions, messages between teammates and team knowledge. It's a paid module, not part of the free VibeCoded Orchestrator. But order matters: a coordination layer on top of a team that doesn't yet have a shared CLAUDE.md and written decisions only coordinates the mess.

What to expect in practice

The change isn't technical, it's a habit: moving the important things out of the chat and into the repository's files. The first two weeks cost some discipline, especially writing the decision when you make it instead of putting it off. After that, the payoff shows up at two specific moments: when a teammate opens a session on a part of the code they don't know and the AI already starts from the right rules, and when a pull request arrives with the decision linked instead of with the question "but why?". If vibe coding for one person is speed, in a team it's speed plus alignment, and alignment gets written down.

Want to try it? The QuickStart installs the free, open source VibeCoded Orchestrator in about 10 minutes of active time.