When you use Claude Code on a single repository, the workflow is straightforward: you open a session, the agent reads the project rules, and it gets to work. That breaks down once your product spans multiple repositories, such as backend, frontend, design system, and documentation.
At that point, you run into two separate problems at different scales:
- Across sessions, parallel agents need clear boundaries so they do not step on each other’s toes.
- Within each session, subtasks need to be matched to the right model without wasting resources or sacrificing quality.
session-hub handles the first problem; model-router handles the second. The sections below explain how both plugins are designed before you move on to the commands.
1. Why a single session is not enough
Section titled “1. Why a single session is not enough”session-hub starts from one technical detail of Claude Code: an agent loads instructions, skills, and agent definitions from the directory where it is launched.
If your product spans four repositories, opening a single session in the parent directory, spawning a plain subagent, or passing --add-dir will not work. In every case, the agent starts in the wrong context and misses each repository’s own rules. Each part of the product needs a session started inside its own repository.
Running multiple sessions in parallel immediately raises practical questions:
- Which files is each session allowed to modify?
- Who can it talk to when it is missing information?
- What happens if finishing its task requires a change in another repository?
Without explicit rules, sessions end up stepping on each other’s toes on the same files or passing unapproved side-channel requests to one another.
A second problem happens inside each session, and it is easier to miss. Without guidance, an agent tends to spawn every subagent with its own model and effort level. That pulls in the wrong direction at both ends: a simple file search burns through the most expensive model, while a difficult review can land on a lightweight model and come back needing rework. Because nothing records how those choices turn out, you have no way to tell what actually works.
2. Coordinating across repositories: hub, master, and child sessions
Section titled “2. Coordinating across repositories: hub, master, and child sessions”To run multiple sessions without losing control, session-hub splits the work into two roles. First, you turn the directory that holds your repositories into a hub.
Two kinds of sessions run inside the hub:
- The master is the session you open at the root of the hub. It acts as a coordinator: it organizes work, routes requests, and keeps track of the whole picture, but it never writes directly into repositories managed by other sessions.
- A child session is a full Claude Code session that the master launches inside a specific repository (or one of its worktrees). Because it starts in that directory, it loads all the instructions, skills, and conventions of that project.
This setup pays off when child sessions run in parallel. You do not have to delegate everything blindly: you can step straight into the child session for the repository you know best and drive it as usual, while the master moves the others forward and handles anything that crosses project boundaries. See Ways of working for concrete solo and team examples.

3. Hard boundaries: handoff, scope, and write root
Section titled “3. Hard boundaries: handoff, scope, and write root”Separate sessions are not enough if each one can still touch another session’s files. At launch, the master gives every child session a handoff, a brief that defines its written scope. The handoff specifies:
- its assigned goal and the first step to take
- what it may modify and what it may only read
- which sibling sessions exist
- the rules to follow when sending messages
That scope maps to a concrete filesystem boundary: the write root. It is the only directory where the child session may create or modify files, whether that is its own repository or a worktree the master created in an adjacent directory.
Written instructions alone are not enough to enforce that boundary, because a model can always lose track or get a path wrong. The scope guard is a hook that intercepts every file-modification attempt from a child session. Before letting a write through, it resolves the real path (following symlinks and any .. traversals) and checks that the target falls under the write root.
The guard fails closed: whenever it cannot prove that a write is allowed, it blocks the operation and explains why.
When a child session genuinely needs a change in another repository, it does not make the edit itself or ask a sibling session directly. Instead, it sends an out-of-scope message to the master. The master then decides how to proceed: ask you for confirmation if needed, forward the request to the relevant child session, spin up a new child session, or run a simple read itself.
4. Communicating without delegating authority: inter-session messages
Section titled “4. Communicating without delegating authority: inter-session messages”When multiple agents collaborate, the subtlest risk is unintended delegation: one session asks for something, and another treats the request as an order and performs an irreversible action. session-hub prevents this with two rules.
The first governs the channel and format. Child sessions talk only to the master, never to each other, using messages with a fixed prefix:
[<task> <repo>] <type>: <text>The <type> field states the kind of message up front: question, out-of-scope, pr, done, or abandoned. Messages from the master always start with [master].
The second rule is a core safety principle: messages carry information, never authorization. No session may merge, push, delete, or change settings just because another session asked it to. Approval for actions like those always comes from a human inside that session.
When Claude Code mods are enabled, the session-hub mod makes this rule even stronger: it technically enforces the master-only channel and prepends a reminder to every incoming message telling the agent that the message is information, not permission.
5. Picking the right model for each task
Section titled “5. Picking the right model for each task”Once cross-repository boundaries are in place, you still have to manage model choices inside each session. model-router helps the agent pick a model tier and effort level for every task delegated to a subagent.
Its main tool is a compact grid that works like a decision ladder. When assigning work, the agent checks four model tiers in ascending order:
haiku: mechanical, straightforward tasks that are easy to verify.sonnet: tasks whose expected outcome can be stated clearly in a single sentence.fable: broad, open-ended work where judgment matters most.opus: everything else, and any case where the agent is in doubt.
Alongside the model tier, four quick questions set the effort level (from low to xhigh), and six fixed task classes (such as read-search or review-debug) label the type of work.
To keep these choices visible, the agent prints a single line every time it spawns a subagent, showing what it picked and why:
🔀 opus ▰▰▰▱ high -> review with unknown cause, going up🔀 haiku ▰▱▱▱ low -> mechanical rename, easy to check
When a built-in subagent is launched with no model specified, a judge steps in: a single call to a fast model that classifies the task on the fly and assigns its tier, effort, and task class.
If the router or the judge hits an error, the launch goes ahead unchanged. The two plugins deliberately handle errors in opposite ways:
session-hub(through the scope guard) fails closed, because letting an unintended write slip through is far worse than a precautionary block.model-routerfails open, because a router that halts your work is worse than one that occasionally stays out of the way.
6. Measuring instead of guessing
Section titled “6. Measuring instead of guessing”A routing grid is only a hypothesis until you test it against real work, so model-router also tracks outcomes.
Every subagent launch counts as a task. Once the rework window closes (30 minutes after the subagent reports back by default, or at the end of the session), the system records the outcome: succeeded on the first pass, reworked, failed, or canceled.
From those outcomes, it computes three metrics broken down by task class, model tier, and effort:
- First-pass yield (FPY): how often the result was right the first time, with no follow-up fixes needed.
- Rework rate: how often the task required subsequent corrections.
- Cost per success: the actual cost of reaching a valid result, including any rework.
The data is stored locally in your Claude Code configuration directory, both globally and per project, and is time-weighted so older work gradually counts for less. For now, the router only collects and displays these metrics; automatic selection based on historical data is planned for a later release.
Glossary
Section titled “Glossary”| Term | Meaning |
|---|---|
| Hub | A directory grouping multiple git repositories, each with its own instructions, skills, and agents. |
| Master | The session opened at the root of the hub. It coordinates work and never writes into a child session’s repository. |
| Child session | A full Claude Code session started by the master inside a repository (or one of its worktrees) so it loads that project’s rules. |
| Handoff | The initial brief prepared by the master for each child session: role, goal, scope, references, sibling sessions, messaging rules, and first step. |
| Write root | The only directory where a child session may create or modify files. |
| Children record | A JSON file maintained by the master outside the hub that tracks every active child session. |
| Scope guard | The hook that blocks any file modification by a child session outside its write root; it fails closed whenever it cannot decide. |
| Mod | A module loaded by a plugin in Claude Code to customize its UI or behavior (panels, commands, tool hooks). Requires mods to be enabled. |
| Grid | The rule set used by model-router to pick model tier and effort level. |
| Task class | One of the six fixed labels describing the type of work, such as read-search or review-debug. |
| Judge | A single call to a fast model that classifies a subagent launched without a model and proposes its tier, effort, and task class. |
| First-pass yield (FPY) | The share of tasks completed successfully on the first attempt, with no rework. See model-router for how it is calculated and used. |
| Rework window | The interval after a subagent reports back (30 minutes by default, or until the session ends) during which redoing the work still counts as rework against that task. |