Subgraph Composer

Subgraph Composer is an agent for Claude Code from TheLobbi/claude. It costs 21 tokens per session (5,066 once invoked), scanned A, original, MIT.

An agent for composing LangGraph subgraphs, which are smaller reusable workflows placed inside a larger graph. It focuses on modular design and the state shared across graph boundaries.

In plain words
What is it for?
Use it to design inline or compiled subgraphs, add a subgraph as a node, create nested workflows, and manage state boundaries between parent and child graphs.
Why use it?
It helps split complex workflows into understandable components without losing control over how data enters, leaves, and moves between them.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions Claude Code.

Part of the langgraph-architect plugin — 5 commands, 12 agents, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/thelobbi/claude/subgraph-composer
Clone the repo
git clone --depth 1 https://github.com/TheLobbi/claude

Made for: Claude Code.

Or install langgraph-architect, the plugin that ships this one along with the rest of its 5 commands, 12 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Subgraph Composer

README.md
[![agentmods](https://agentmods.dev/badge/agents/thelobbi/claude/subgraph-composer.svg)](https://agentmods.dev/agents/thelobbi/claude/subgraph-composer)
Your own site
<a href="https://agentmods.dev/agents/thelobbi/claude/subgraph-composer"><img src="https://agentmods.dev/badge/agents/thelobbi/claude/subgraph-composer.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,066 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00021 $0.05066
Opus 5 $0.00010 $0.02533
Sonnet 5 $0.00004 $0.01013
Haiku 4.5 $0.00002 $0.00507

Measured today against content hash d2be86ded445, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

Subgraph Composer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/plugins/langgraph-architect/agents/subgraph-composer.md · 785 lines

How it starts

The opening of the file, as written. The whole thing — 785 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Subgraph Composer Agent

Role

You are an expert in LangGraph subgraph composition and modular graph architecture. You specialize in designing reusable, composable graph components that maintain clean state boundaries while enabling complex nested workflows.

Expertise

1. Subgraph as Node Patterns

Core Concept:

from langgraph.graph import StateGraph, START, END

# Subgraph definition
def create_research_subgraph() -> StateGraph:
    """Reusable research subgraph"""
    subgraph = StateGraph(ResearchState)

    subgraph.add_node("search", search_node)
    subgraph.add_node("analyze", analyze_node)
    subgraph.add_node("summarize", summarize_node)

    subgraph.add_edge(START, "search")
    subgraph.add_edge("search", "analyze")
    subgraph.add_edge("analyze", "summarize")
    subgraph.add_edge("summarize", END)

    return subgraph

# Main graph using subgraph
main_graph = StateGraph(MainState)
research_graph = create_research_subgraph()

# Add subgraph as a node
main_graph.add_node("research", research_graph.compile())

Pattern Types:

  • Inline Subgraph: Directly embedded in parent graph
  • Compiled Subgraph: Pre-compiled and added as node
  • Conditional Subgraph: Different subgraphs based on conditions
  • Parallel Subgraphs: Multiple subgraphs executing concurrently

2. State Schema Alignment

State Transformation Strategies:

from typing import TypedDict, Annotated
from operator import add

# Parent state
class ParentState(TypedDict):
    query: str
    results: Annotated[list, add]
    metadata: dict

# Subgraph state (subset + extras)
class SubgraphState(TypedDict):
    query: str  # Shared field
    intermediate_results: list  # Subgraph-specific
    analysis: dict  # Subgraph-specific

# State mapper functions
def parent_to_subgraph(parent: ParentState) -> SubgraphState:
    """Transform parent state to subgraph input"""
    return {
        "query": parent["query"],
        "intermediate_results": [],
        "analysis": {}
    }

def subgraph_to_parent(subgraph: SubgraphState, parent: ParentState) -> ParentState:
    """Merge subgraph results back to parent"""
    return {
        **parent,
        "results": parent["results"] + [subgraph["analysis"]]
    }

Read the full file on GitHub · 785 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 785 lines · 21 tokens per session scan A d2be86ded445

Subscribe to this mod's changes

Subgraph Composer is an agent published in the GitHub repository TheLobbi/claude (21 stars, last pushed yesterday), licensed MIT. It adds 21 tokens to every session and 5,066 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.

Related

Other agents, from other repositories

cr-correctness

Reviews a supplied diff for introduced behavioral and contract defects. Use only when dispatched by the code-review skill.

srtab/daiv · 26 tokens

cr-custom-rules

Reviews a supplied diff against explicit repository rules from supplied rule sources. Use only when dispatched by the code-review skill with at least one rule source.

srtab/daiv · 34 tokens

orchestrator

Workflow orchestrator that analyzes plans and produces structured delegation plans for parallel agent execution. Use after a planner has created a task breakdown, to determine which agents should execute which tasks, in what order, and with what parallelism.

yu-iskw/llmops-demo-ts · 49 tokens

legal-compliance

Legal and compliance specialist that checks license compatibility, regulatory compliance, data privacy, and AI ethics. Use when reviewing dependencies, handling user data, or ensuring regulatory compliance.

yu-iskw/llmops-demo-ts · 37 tokens

researcher

Research specialist that searches the web, reads documentation, and gathers reliable information about libraries, APIs, specifications, and best practices. Use when a task requires understanding external documentation, library APIs, or industry standards before implementation.

yu-iskw/llmops-demo-ts · 46 tokens

security

Security specialist that performs security audits, identifies vulnerabilities, reviews for OWASP Top 10 issues, and ensures secure coding practices. Use proactively when reviewing security-sensitive code, especially AI agent input/output handling.

yu-iskw/llmops-demo-ts · 42 tokens