Agent skill

Claude Code Session Broker

by Arch1eSUN in Arch1eSUN/Arcgentic

A skill your agent uses when running Arcgentic V2 in Claude Code and fixed Planner, Developer, and Auditor role sessions must be coordinated through a broker.

MITAuto-check passedAgent Workflows

Install Claude Code Session Broker

skills CLI
$ npx skills add Arch1eSUN/Arcgentic --skill claude-code-session-broker -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Arch1eSUN/Arcgentic claude-code-session-broker --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Arch1eSUN/Arcgentic.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/claude-code-session-broker .claude/skills/claude-code-session-broker && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
claude-code-session-broker
GitHub stars
286
Token cost
~3.4k tokens
SKILL.md length
1,586 words
Files
1
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when running Arcgentic V2 in Claude Code and fixed Planner, Developer, and Auditor role sessions must be coordinated through a broker.

  • Works in 3 steps: Native tooling (tier 0) — if this… → Hook-backed broker (fallback) — use when… → Explicit copy-back (last resort) — when…
  • Running Arcgentic V2 in Claude Code and fixed Planner
  • SKILL.md covers Contract, Broker priority, Procedure — tier 0 (native… and Procedure — hook fallback, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Claude Code Session Broker is an agent skill from Arch1eSUN/Arcgentic. Use when running Arcgentic V2 in Claude Code and fixed Planner, Developer, and Auditor role sessions must be coordinated through a broker.

Its SKILL.md is about 3.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows. The repository describes itself as: Mechanical plan/dev/self-audit/external-audit gates for AI coding agents, with a configurable role-routing topology engine, an MCP-UI live status panel, and native-tooling Claude… The licence is MIT.

When your agent uses it

  • Running Arcgentic V2 in Claude Code and fixed Planner
  • Auditor role sessions must be coordinated through a broker

Example prompts

  • “/claude-code-session-broker”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Native tooling (tier 0) — if this session's own tool list includes
  2. Hook-backed broker (fallback) — use when tier 0's three tools are
  3. Explicit copy-back (last resort) — when neither of the above is

What it can do on your machine

Read from SKILL.md and the folder at commit 8539955. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • code.claude.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Claude Code Session Broker loads about 3.4k tokens when it runs. Until then it costs about 41 tokens; SKILL.md has 1,586 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~3.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Arch1eSUN/Arcgentic at commit 8539955, republished under its MIT licence (© Arch1eSUN). 1,586 words, ~3,419 tokens.

Download SKILL.mdSave it as .claude/skills/claude-code-session-broker/SKILL.md (or your agent's skills folder).
name
claude-code-session-broker
description
Use when running Arcgentic V2 in Claude Code and fixed Planner, Developer, and Auditor role sessions must be coordinated through a broker.

claude-code-session-broker

Use this skill for Claude Code V2 parity. Claude Code does not expose the same Codex thread tools to Arcgentic, so V2 parity is broker-backed: the broker keeps the same four-role state contract and uses native Claude Code tooling (subagents via Agent/SendMessage/ListAgents), hooks, or explicit copy-back, depending on what the host supports — see "Broker priority" below for the exact three transports and their order.

Relevant host capabilities:

Contract

V2 still has exactly five role identities:

  • Orchestrator
  • Planner
  • Developer
  • Test
  • Auditor

Do not create round-numbered role identities. Store round identity in state and prompt payloads.

Broker priority

Use the strongest available transport, checked in this order:

  1. Native tooling (tier 0) — if this session's own tool list includes Agent, SendMessage, and ListAgents, use them directly (see "Procedure — tier 0" below). For a first-time dispatch to a role (kind: "create"), dispatch is synchronous for a foreground Agent call (you get the role's output the moment the call returns — no external event to wait for) or notification-driven for a background Agent call (a task-notification arrives with the role's output when it finishes); either way, Agent's result carries a resumable agentId you record as the broker thread-id. For a repeat dispatch to a role that already has a recorded thread (kind: "reuse" — e.g. a needs_fix loop back to Developer), skip Agent entirely and use SendMessage against that already-recorded agentId instead; its reply arrives asynchronously, like a background Agent call's notification.
  2. Hook-backed broker (fallback) — use when tier 0's three tools are not present in this session (see "Procedure — hook fallback" below).
  3. Explicit copy-back (last resort) — when neither of the above is available: the role session returns RoleReturnSignal in its own output, and a human or the orchestrator manually runs arcgentic v2-return-signal with that JSON. No automation attempts this on its own; do not pretend it succeeded silently.

All three transports write the same state shape via the same CLI commands (v2-session-plan, v2-record-session, v2-dispatch-role, v2-return-signal) — only how the role's prompt gets delivered and its output gets collected differs.

Procedure — tier 0 (native tooling)

Check once per session, before dispatching anything: does your own tool list include Agent, SendMessage, and ListAgents? If yes, use this procedure. If no, skip to "Procedure — hook fallback" below.

  1. Get the dispatch plan:

    bash
    arcgentic v2-session-plan \
      --state .agentic-rounds/state.yaml \
      --host claude-code-broker \
      --user-request '<current user request>'
  2. If the JSON's orchestrator_status is sleeping, stop immediately — a role is already dispatched and pending; do not dispatch another.

  3. If orchestrator_status is active, read actions[0]. Its prompt field is the complete, ready-to-send role prompt (it already contains the arcgentic-role-return footer instructions — do not edit it, do not add or remove content). Its kind field is either "create" (no thread is recorded for this role yet) or "reuse" (this role already has a recorded thread from an earlier dispatch — e.g. Developer's needs_fix loop back to Developer, Auditor's audit_in_progress retry, or a new round's Planner dispatch after the previous round closed). reuse is normal, common V2 routing, not an edge case — branch on kind in step 4 below.

  4. Dispatch, branching on actions[0].kind:

    • kind: "create": before calling Agent, your own working directory must already be the target project root. Agent has no working-directory parameter of its own — a dispatched agent inherits your shell's cwd and has no other way to learn where the project is, so if the orchestrator's shell has not already cd'd into the project root, the role prompt's relative file paths (e.g. .agentic-rounds/state.yaml, docs/plans/...) will resolve against the wrong directory. (This does not apply to kind: "reuse" below — that dispatches via SendMessage to an already-running agent, which already has its own working directory from when it was first created.)

      • single-session-subagent mode: call the Agent tool with prompt = actions[0].prompt, run_in_background: false (foreground — you get the result directly in this same turn), and subagent_type: "general-purpose". Do NOT use arcgentic's own planner/developer/auditor/etc. agent types for this — an arcgentic-installed project ships those agent types (see agents/planner.md, agents/developer.md, agents/auditor.md at the repo root) and their names match the V2 role names, but they implement a different, incompatible V1/v0.2 contract (V1's planner agent produces "18/12/10-section handoff docs", not a V2 role-prompt/return-signal exchange). Dispatching a role through one of those types would run the wrong contract.
      • multi-session-subthread mode: call Agent with the same prompt but run_in_background: true.
      • Either way, Agent's return carries a real, resumable agentId — that is what you record as the broker thread-id in step 5, not actions[0].thread_id (for a create action that field is only a placeholder, not a real agent id).
    • kind: "reuse":

      • Do NOT call Agent — that would create a brand-new agent and orphan this role's existing context. actions[0].thread_id is already the real, previously-recorded agentId for this role.
      • Call SendMessage with to = actions[0].thread_id and message = actions[0].prompt.
      • SendMessage delivers asynchronously — it does not hand you the reply inline the way a foreground Agent call does. Treat this like a background dispatch: end your turn after step 6 and wait for the reply to arrive as a message from that agent.
  5. Record the session — kind: "create" only, using the agentId Agent returned as the broker thread-id:

    bash
    arcgentic v2-record-session \
      --state .agentic-rounds/state.yaml \
      --host claude-code-broker \
      --role <planner|developer|test|auditor> \
      --thread-id <agentId>

    kind: "reuse": skip this step. The role is already recorded from its earlier dispatch — that recorded thread is exactly why this action was reuse instead of create. Re-running v2-record-session with the same thread-id would be harmless/idempotent, but it records nothing new, so there is no reason to run it.

  6. Record the dispatch, using the thread-id from step 4 (the new agentId for create, or actions[0].thread_id for reuse):

    bash
    arcgentic v2-dispatch-role \
      --state .agentic-rounds/state.yaml \
      --host claude-code-broker \
      --role <planner|developer|test|auditor> \
      --thread-id <thread-id-from-step-4>

    This puts the Orchestrator to sleep waiting for this role's reply. In background mode (a multi-session-subthread create dispatch, or any reuse dispatch — those go through SendMessage, which is always asynchronous), end your turn here: you'll resume via the task-notification (background Agent) or the peer's reply message (SendMessage). In foreground mode (a single-session-subagent create dispatch via a foreground Agent call), continue directly to the next step in this same turn — you already have the role's output from step 4.

  7. Collect the role's output:

    • Foreground Agent call: its return value IS the role's output — continue directly to step 8 in the same turn, no waiting.
    • Background Agent call: wait for the task-notification. When it arrives, its content is the role's output. Do not poll ListAgents for completion — the notification is the completion signal.
    • SendMessage (reuse dispatch): wait for the agent's reply message. When it arrives, its content is the role's output — validate it for the footer exactly like a fresh Agent call's return value (step 8, next).
  8. Validate the output contains exactly one ```arcgentic-role-return ... ``` fenced JSON footer (or the ARCGENTIC_ROLE_RETURN ... END_ARCGENTIC_ROLE_RETURN marker form). If it's missing or malformed, use SendMessage to resume the same agent (by its agentId) with a corrective instruction: "Your last response was missing the required arcgentic-role-return footer. Re-send your summary with exactly one such footer, formatted as instructed." Repeat step 8 with the resumed agent's reply. This is the same fail-closed contract the hook fallback enforces via decision: block — here it's enforced by you, the orchestrator, checking directly, since there is no external hook watching this session.

  9. Record the signal, which wakes the Orchestrator:

    bash
    arcgentic v2-return-signal \
      --state .agentic-rounds/state.yaml \
      --signal-json '<the footer JSON from step 8>'
  10. Go back to step 1 and dispatch the next role.

Show full SKILL.md (389 more words)Show less

Procedure — hook fallback

Use this procedure only when tier 0's Agent/SendMessage/ListAgents are not available in this session.

  1. Install project-local Claude Code hooks once:

    bash
    arcgentic claude-code-broker install-hooks \
      --settings .claude/settings.local.json \
      --state .agentic-rounds/state.yaml

    The installed Stop/SubagentStop hook calls:

    bash
    arcgentic claude-code-broker handle-stop \
      --state .agentic-rounds/state.yaml

    The hook reads Claude Code's last_assistant_message, extracts the arcgentic-role-return footer, runs the same V2 return validation, updates .agentic-rounds/state.yaml, and writes a broker inbox record under .agentic-rounds/claude-code-broker/inbox/.

  2. Initialize or read V2 host state:

    bash
    arcgentic v2-session-plan \
      --state .agentic-rounds/state.yaml \
      --host claude-code-broker \
      --user-request '<current user request>'
  3. If orchestrator_status is sleeping, stop immediately. The broker is waiting for pending_role; do not dispatch another role.

  4. If orchestrator_status is active, create or resume only the single role context in actions, then record its broker id:

    bash
    arcgentic v2-record-session \
      --state .agentic-rounds/state.yaml \
      --host claude-code-broker \
      --role <planner|developer|test|auditor> \
      --thread-id <broker-session-id>
  5. Inject only that role's prompt. The developer does not receive auditor reasoning. The auditor does not receive developer chat transcript. The planner owns phase decisions.

  6. After injecting the role prompt, put the Orchestrator to sleep and end the Orchestrator turn:

    bash
    arcgentic v2-dispatch-role \
      --state .agentic-rounds/state.yaml \
      --host claude-code-broker \
      --role <planner|developer|test|auditor> \
      --thread-id <broker-session-id>
  7. Require every role turn to end with RoleReturnSignal JSON.

  8. Record the signal. This wakes the Orchestrator and clears the pending dispatch:

    bash
    arcgentic v2-return-signal \
      --state .agentic-rounds/state.yaml \
      --signal-json '<RoleReturnSignal JSON>'
  9. Re-run v2-session-plan --host claude-code-broker and dispatch the next role.

Hook guidance

When hooks are available, configure stop hooks to extract the role's final response and pass it back to the orchestrator as context. The hook must not invent a PASS/NEEDS_FIX outcome. It only transports the role's own RoleReturnSignal.

The bundled hook runtime uses official Claude Code Stop/SubagentStop input fields, especially last_assistant_message and stop_hook_active. If the Orchestrator is sleeping and the role output lacks a valid footer, the hook blocks once with a corrective reason. If stop_hook_active is already true, it does not block again, preventing hook recursion.

Fail-closed rules

  • If a role returns prose without valid RoleReturnSignal, do not advance.
  • If the broker cannot identify which role produced a signal, do not advance.
  • If the Orchestrator is sleeping, do not dispatch more work until the pending role returns.
  • If a role tries to rename itself outside the four fixed titles, reject it.
  • If Claude Code transport is unavailable, fall back to explicit copy-back rather than pretending automation succeeded.

© Arch1eSUN, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/claude-code-session-broker of Arch1eSUN/Arcgentic.

Open the folder on GitHubat commit 8539955

Compare with similar skills

Claude Code Session Broker next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Claude Code Session Broker compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Claude Code Session Broker this skillArch1eSUN/Arcgentic286—~3.4kAutomated safety check: PassMIT
MCP Server Builderanthropics/skills180k64 repos~2.3kAutomated safety check: PassApache-2.0
Hook Development for Claude Code Pluginsanthropics/claude-plugins-official38k11 repos~4.1kAutomated safety check: NotesApache-2.0
Using Superpowersfarm-fe/farm5.6k35 repos~1.4kAutomated safety check: PassMIT
Executing Plans Inlineobra/superpowers296k2 repos~5.1kAutomated safety check: PassMIT
Claude Code Agent Developmentanthropics/claude-plugins-official38k8 repos~2.8kAutomated safety check: PassApache-2.0

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 64 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • Hook Development for Claude Code Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.

    38k GitHub starsUsed in 11 repos~4.1k tokens
    Agent WorkflowsAuto-check: notes
  • Using Superpowers

    farm-fe/farm

    A skill your agent uses when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions

    5.6k GitHub starsUsed in 35 repos~1.4k tokens
    Agent WorkflowsAuto-check passed
  • Executing Plans Inline

    obra/superpowers

    Has the agent carry out an implementation plan itself, task by task in the current session, keeping a ledger, proving each step with a test and ending with one whole-branch review.

    296k GitHub starsUsed in 2 repos~5.1k tokens
    Agent WorkflowsAuto-check passed
  • Claude Code Agent Development

    anthropics/claude-plugins-official

    Official

    Explains how to write agents for Claude Code plugins: the markdown file with YAML frontmatter, trigger descriptions, model and color settings, and system prompt design.

    38k GitHub starsUsed in 8 repos~2.8k tokens
    Agent WorkflowsAuto-check passed
  • Skill Creator

    Azure/azqr

    Official

    Create new skills, modify and improve existing skills, and measure skill performance.

    795 GitHub starsUsed in 89 repos~8.2k tokens
    Agent WorkflowsAuto-check passed

More from Arch1eSUN/Arcgentic

All 19 skills in this repo
  • Audit Round

    Arch1eSUN/Arcgentic

    External-audit role for arcgentic rounds. An agent skill from Arch1eSUN/Arcgentic.

    286 GitHub stars~1.6k tokensUpdated 5 days ago
    Auto-check passed
  • Orchestrate Round

    Arch1eSUN/Arcgentic

    Main-session orchestrator for arcgentic rounds. An agent skill from Arch1eSUN/Arcgentic.

    286 GitHub stars~1.5k tokensUpdated 5 days ago
    Auto-check passed
  • Verify Gates

    Arch1eSUN/Arcgentic

    Runs the mechanical quality gates that the arcgentic state machine requires for state transitions.

    286 GitHub stars~653 tokensUpdated 5 days ago
    Auto-check passed
  • Arcgentic

    Arch1eSUN/Arcgentic

    A skill your agent uses when the user mentions Arcgentic, or wants substantial AI-written code taken through a gated plan → development → self-audit → external audit workflow with role handoffs and…

    286 GitHub stars~984 tokensUpdated 5 days ago
    Auto-check passed
  • Arcgentic

    Arch1eSUN/Arcgentic

    A skill your agent uses when the user says Arcgentic, asks to use Arcgentic, or wants an idea taken through a complete plan → development → self-audit → external audit workflow in Codex.

    286 GitHub stars~2.4k tokensUpdated 5 days ago
    Auto-check passed
  • Codex Thread Orchestration

    Arch1eSUN/Arcgentic

    A skill your agent uses when running Arcgentic V2 in Codex and the current thread must orchestrate fixed Planner, Developer, Test, and Auditor role threads.

    286 GitHub stars~4.6k tokensUpdated 5 days ago
    Auto-check passed

Categories

Questions about Claude Code Session Broker

What does Claude Code Session Broker do?

A skill your agent uses when running Arcgentic V2 in Claude Code and fixed Planner, Developer, and Auditor role sessions must be coordinated through a broker. Claude Code Session Broker is an agent skill from Arch1eSUN/Arcgentic. Use when running Arcgentic V2 in Claude Code and fixed Planner, Developer, and Auditor role sessions must be coordinated through a broker.

When should I use Claude Code Session Broker?

Claude Code Session Broker fits situations like: running Arcgentic V2 in Claude Code and fixed Planner; auditor role sessions must be coordinated through a broker.

How do I install Claude Code Session Broker in Claude Code?

Run `npx skills add Arch1eSUN/Arcgentic --skill claude-code-session-broker -a claude-code`. Or copy the skill folder (skills/claude-code-session-broker in Arch1eSUN/Arcgentic) into .claude/skills/claude-code-session-broker in your project. Claude Code loads it when a task matches its description.

How do I install Claude Code Session Broker in Codex?

Run `npx skills add Arch1eSUN/Arcgentic --skill claude-code-session-broker -a codex`. Or copy the skill folder (skills/claude-code-session-broker in Arch1eSUN/Arcgentic) into .agents/skills/claude-code-session-broker in your project. Codex loads it when a task matches its description.

Can I use Claude Code Session Broker in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Arch1eSUN/Arcgentic --skill claude-code-session-broker -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/claude-code-session-broker, .gemini/skills/claude-code-session-broker, .github/skills/claude-code-session-broker and .opencode/skills/claude-code-session-broker in your project.

What does Claude Code Session Broker need to run?

SKILL.md names no scripts, command-line tools or credentials: Claude Code Session Broker is instructions for the agent only.

Does Claude Code Session Broker access the network?

SKILL.md names 1 domain. As links in the text: code.claude.com. This is read from the text; nothing was executed.

Is Claude Code Session Broker safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Claude Code Session Broker use?

Claude Code Session Broker is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Claude Code Session Broker use?

About 3.4k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Claude Code Session Broker?

Skills that share tags, products or a category with Claude Code Session Broker: MCP Server Builder (anthropics/skills, 180k stars), Hook Development for Claude Code Plugins (anthropics/claude-plugins-official, 38k stars), Using Superpowers (farm-fe/farm, 5.6k stars) and Executing Plans Inline (obra/superpowers, 296k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Claude Code Session Broker?

Arch1eSUN (a GitHub user) maintains it in Arch1eSUN/Arcgentic, which has 286 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 2, 2026.

Source: Arch1eSUN/Arcgentic on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.