Back to news

Claude Code on multiple projects: how to never work in the wrong one

Running Claude Code across several projects only becomes safe when each project has a visible identity of its own. One session per directory is the floor, not the fix. What actually prevents you from acting in the wrong repository is telling projects apart at a glance: a distinct look per project, agents grouped by project, and warnings that name the project they belong to. Facts and threads cited here were checked on August 10, 2026.

Why aren't separate Claude Code sessions enough?

Separate sessions keep the model's context clean, but they do not protect the operator. In a thread on r/ClaudeAI from August 9, 2026 (the discussion, more than 30 replies as of August 10, 2026), the author asked how to run Claude Code on several projects without mixing them up. The community's first answer was the obvious one: open one session per project directory. The author then corrected the question in the comments: the fear was not the model mixing contexts, it was typing a prompt into the wrong repository while several similar projects were open, and the ask became how to make the setup more foolproof. One commenter described building a personal app with git worktrees and tmux just to manage that risk. The pain is real enough that people are building tools for it.

How do you know which project you are in at a glance?

Terminal tabs look identical: same font, same colors, same prompt. When three repositories share a stack and a naming convention, the only thing separating the right project from the wrong one is the current directory string, and nobody reads the full path before every prompt. What works is identity the eye catches before the brain reads: a different accent color per project, the project name visible next to every agent, and a workspace that opens already looking like the project it belongs to. If two projects look the same on screen, sooner or later an instruction lands on the wrong one.

How do you keep the right context when you switch projects?

Claude Code reads its instructions from the directory it runs in: CLAUDE.md, .env, credentials and MCP configuration all come from the working directory. That is exactly why the wrong-directory mistake is silent: the session in the wrong repository does not fail, it works normally, following the other project's rules. Practical checks: confirm the repository name in the first answer of a new session, keep accounts separated per project (billing and rate limits included), and treat any agent that cannot say which project it is in as a red flag. Our guide on how to keep track of multiple AI agents covers following the work itself.

Do similar codebases confuse the AI agent itself?

Less than they confuse you. The model only sees files inside the directory where the session runs; it does not reach across repositories on its own. In practice, confusion enters through the human door: a prompt written for project A sent to the session of project B, a file dragged from the wrong window, a terminal reused after lunch. That is why tooling for multi-project work should aim at the operator's eyes first, not at the model's context window.

When do git worktrees help, and when are they another problem?

Git worktrees isolate branches of the same project so several agents can edit code without stepping on each other. They do nothing for the multi-project problem, and they make it slightly worse: each worktree is one more directory that looks almost exactly like the others. If your risk is one agent overwriting another, worktrees are the answer, and our guide to git worktrees for AI coding agents includes what breaks. If your risk is acting in the wrong project, you need visible identity, not more copies.

What does CanvasCode do to keep projects apart?

CanvasCode organizes work as one canvas per project, with that project's agents grouped on it, and shipped per-project identity in three releases: v1.4.0 (June 4, 2026) added one account per project, v1.32.0 (July 9, 2026) added a browser start page per project, and v1.37.0 (July 17, 2026) added a color for each theme, so each canvas looks unmistakably like its project. Alerts and announcements name the project they come from. One honest limitation: CanvasCode protects what happens inside the app; a stray terminal opened outside it can still act on the wrong repository.