Concepts

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. Things change as soon as your product spans multiple repositories — for example, backend, frontend, design system, and documentation.

At that point, two distinct problems emerge at two different scales:

  1. Across sessions, you need clear boundaries so parallel agents do not step on each other's toes.
  2. Within each session, you need a way to match each subtask to the right model without wasting resources or sacrificing quality.

session-hub solves the first problem; model-router solves the second. This page walks you through the ideas behind both before moving on to the operational commands.

1. Why a single session is not enough

To understand how session-hub works, start with a technical detail of Claude Code: an agent loads instructions, skills, and agent definitions from the directory where it is launched.

If your product lives across four repositories, you cannot get by with opening a single session in the parent directory, using a plain subagent, or passing --add-dir: in every case, the agent starts from the wrong context and misses each repository's own rules. To work effectively on each part of the product, you need a session started inside that repository.

As soon as you run multiple sessions in parallel, though, very practical questions come up:

  • 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 overwriting the same files or passing unapproved side-channel requests to one another.

On top of that sits a second, quieter problem that happens inside every session. Left to itself, an agent tends to spawn every subagent with its own model and effort level. That creates a double imbalance: a trivial file search burns through the most expensive model, while a tricky review may land on a lightweight model and come back needing to be redone. And because nothing records how those choices turn out, nobody really knows what is working.

2. Bringing order across repositories: hub, master, and child sessions

To run multiple sessions without losing control, session-hub introduces a clean separation of roles. The starting point is turning the directory that holds your repositories into a hub.

Two kinds of sessions live inside the hub:

  • The master is the session you open at the root of the hub. Think of the master as a coordinator: it organizes work, routes requests, and keeps the big picture, edit-free — 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 automatically inherits all the instructions, skills, and conventions of that project.
You talk to the master session and work directly in one child session; the master starts one child per repository, each in its own terminal pane and write root, and a child that needs a change elsewhere asks the master. You one person Master session coordinates the children and keeps a record of them asks and decides works hands-on in the repository you know best starts each child and sends it [master] messages asks the master for a change in another repository pane 1 Child · api its own rules already loaded write root: api/ pane 2 Child · web its own rules already loaded write root: web/ pane 3 Child · docs its own rules already loaded write root: docs/ The children run in parallel, one per repository. They never message each other: every request goes through the master.
A hub at a glance: the master at the root and one child session per repository, each bound to its own write root.

The payoff of this layout shows 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 bridges anything that crosses project boundaries. On the Ways of working page, you will find concrete examples of this workflow both solo and in a team.

Herdr: the master session on the left, two child sessions on the right, each working in its own repository
What it looks like in practice, in Herdr: the master on the left, two child sessions on the right, working in parallel.

3. Hard boundaries: handoff, scope, and write root

Separate sessions are not enough if each one can still touch another session's files. That is why, at launch, the master gives every child session a handoff: a brief that defines its written scope. Inside it, the child finds:

  • 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 operating boundary maps to a concrete filesystem constraint: the write root. It is the only directory where the child session is allowed to create or modify files (either its own repository or a worktree created by the master in an adjacent directory).

Relying on written handoff instructions alone, however, would not provide real safety: a model can always lose track or get a path wrong. That is where the scope guard comes in — 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 it falls under the write root.

Its philosophy is simple and cautious: it fails closed. Whenever it cannot establish with certainty that an operation is allowed, it blocks the write and explains why.

The scope guard checks every file edit: outside a child it allows at once; in a child it blocks whenever it cannot decide, finds where the path really leads, allows the edit inside the write root and blocks it outside, telling the child to ask the master. With mods on, a best-effort check also watches the shell. The agent is about to edit a file Edit · Write · NotebookEdit Is this a child session? and are its guards turned on? Can the guard check this edit? a readable request, a valid write root, an absolute path, an answer within 7 s Find where the path really leads it follows links and “..” the way the file system does Is it inside the write root? the real path, compared with the real write root Allowed: the edit goes ahead yes yes yes Allowed at once outside a child, the guard never gets in the way Blocked, and it says why when it cannot decide, it blocks: the guard fails closed Blocked: outside the write root the child asks the master with an out-of-scope message instead no no no With mods on, a best-effort check also watches the shell. It denies redirections and commands such as tee, cp, mv, rm or sed -i when they would write outside the write root; targets in variables or globs are not judged. With mods off, only the handoff forbids writing through the shell.
Scope protection resolves the real path of every modification, following symlinks, and allows it only under the real write root. Anything it cannot verify is blocked.

What if a child session genuinely needs a change in another repository? It neither makes the edit itself nor asks a sibling session directly: instead, it sends an out-of-scope message to the master. The master then decides how to proceed — asking you for confirmation if needed, forwarding the request to the relevant child, spinning up a new child session, or performing a simple read itself.

The web child needs a change in api and asks the master; the master decides whether to pass it to the api child, start a child, ask you or do it itself, then tells the web child what will happen and records the request. A message is information, never authorization. Child · web Master Child · api You realizes it needs a new field in api asks the master [t42 web] out-of-scope is it wanted? is it master-only? does a live child own it? then one of these passes it on with a follow-up, or starts a child in api asks you to decide or does it itself, when the work is master-only or just a read tells it what will happen: wait, or carry on records the request and how it ended A message is information, never authorization. No session merges, pushes, deletes or changes settings because another session asked.
An out-of-scope request always goes up to the master, never sideways: if needed, the master checks with you and then routes the request to the child session responsible for that repository, starts a new one, or runs a read itself.

4. Communicating without delegating authority: inter-session messages

When multiple agents collaborate, the subtlest risk is unintended delegation: one session asks for something, another treats it as an order and performs an irreversible action.

session-hub eliminates this risk at the root with two rules.

The first covers the channel and format. Child sessions talk exclusively to the master, never to each other, using messages with a fixed prefix:

[<task> <repo>] <type>: <text>

The <type> field states the nature of the 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 enforces this rule at the technical level: it locks communication to the master-only channel and prepends an explicit reminder to every incoming message telling the agent that the message is information, not permission.

5. Picking the right model for each task

With cross-repository boundaries in place, you can look inside an individual session. This is where model-router comes in — the plugin that helps the agent pick the best-fit model and effort level for every task delegated to a subagent.

Its main tool is a compact grid that acts as a decision ladder. When assigning work, the agent evaluates four model tiers in ascending order:

  1. haiku — for mechanical, straightforward tasks that are easy to verify.
  2. sonnet — when the expected outcome can be stated clearly in a single sentence.
  3. fable — for broad, open-ended work where judgment makes the real difference.
  4. opus — for everything else, and whenever in doubt.

Alongside the model, four quick questions set the effort level (from low to xhigh), while six fixed task classes (such as read-search or review-debug) label the type of work.

model-router works like a dispatch desk: for every task handed to a helper, the grid picks a model and an effort, a quick judge decides only when no model was given, the helper works, and the outcome is measured. Models go from cheaper and quicker to dearer and deeper; effort goes from low to xhigh. 1 A task the agent hands work to a helper 2 The grid picks the model and the effort 3 A quick judge only when no model was given 4 Helper at work a subagent, on that model 5 Measured was it right the first time? what did it cost? for each start it writes one line, like this: 🔀 haiku ▰▱▱▱ low -> mechanical rename, easy to check Model: who does the work haiku sonnet opus fable cheaper and quicker dearer and deeper Effort: how hard it thinks low medium high xhigh max is never used
model-router as a dispatch desk: the grid picks model and effort for each task, a fast judge steps in only if no model was specified, and the final outcome is measured.

To keep these decisions transparent, the agent prints a single line every time it spawns a subagent. At a glance, you see what it chose and why:

🔀 opus ▰▰▰▱ high -> review with unknown cause, going up
🔀 haiku ▰▱▱▱ low -> mechanical rename, easy to check
Three Agent calls, each followed by the colored 🔀 line showing model, effort bar, effort, and reason
The same lines in the terminal: model in bold, colored by tier; bar and effort by level; reason in muted text. Demo data

Sometimes a built-in subagent is launched with no model specified. When that happens, 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.

What if the router or the judge hits an error? The launch goes ahead unchanged. This reflects a deliberate, mirrored design choice between the two plugins:

  • session-hub (scope guard) fails closed, because a security check that lets an unintended write slip through is far worse than a precautionary block.
  • model-router fails open, because a router that halts your work is worse than one that occasionally stays out of the way.

6. Measuring instead of guessing

A routing grid is a great starting point, but it remains a hypothesis until tested against real work. That is why model-router does more than route: it also tracks outcomes.

Every subagent launch is counted as a task. Once the rework window closes — by default 30 minutes after the subagent reports back, or at the end of the session — the system records how it went: succeeded on the first pass, reworked, failed, or canceled.

The mod appends events to events.jsonl in the Claude Code config folder; when a task's rework window closes its outcome is decided, compaction folds the outcomes into cells by class, tier and effort, for you and for each project, and the usage view and the report show first-pass yield, rework rate and cost per success. Nothing is written inside your repositories. 1 Events decision · spawn signal: write · tool-error prompt · stop · resume report · session-end recorded by the mod as they happen 2 events.jsonl an append-only log in the config folder 3 The rework window closes 30 minutes after the report, or when the session ends 4 Outcome success rework failure cancelled cancelled or risky tasks are not learned from 5 Compaction cells: class × tier × effort for you, and for each project a 30-day half-life ages them 6 What you see in /model-router and on the report page first-pass yield rework rate cost per success All of it lives under the Claude Code config folder (CLAUDE_CONFIG_DIR, else ~/.claude). Nothing is written inside your repositories, and nothing is sent anywhere.
From events to numbers: the mod appends events, compaction closes each task once the rework window expires, and outcomes roll up into task class × tier × effort cells, globally for you and per project.

From these outcomes, it computes three concrete 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 successful task: the true cost of reaching a valid result, including the price of any rework.

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

TermMeaning
HubA directory grouping multiple git repositories, each with its own instructions, skills, and agents.
MasterThe session opened at the root of the hub. It coordinates work and never writes into a child session's repository.
Child sessionA full Claude Code session started by the master inside a repository (or one of its worktrees) so it loads that project's rules.
HandoffThe initial brief prepared by the master for each child session: role, goal, scope, references, sibling sessions, messaging rules, and first step.
Write rootThe only directory where a child session may create and modify files.
Children recordA JSON file maintained by the master outside the hub that tracks every active child session.
Scope guardThe hook that blocks any file modification by a child session outside its write root; it fails closed whenever it cannot decide.
ModA module loaded by a plugin in Claude Code to customize its UI or behavior (panels, commands, tool hooks). Requires mods to be enabled.
GridThe rule set used by model-router to pick model tier and effort level.
Task classOne of the six fixed labels describing the type of work, such as read-search or review-debug.
JudgeA single call to a fast model that classifies a model-less subagent 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. How it is calculated and used by the router: model-router.
Rework windowThe 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.