RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Diff/ssdeanx-langgraph-dm-clinerules-langgraphjs ↔ ssdeanx-langgraph-dm-clinerules-subgraphs

Comparison

A · Cline rules · ssdeanx/langgraph-dmB · Cline rules · ssdeanx/langgraph-dm
What each file covers, counted
DimensionSharedOnly in AOnly in BOverlap
Sections0760%
Commands000—
Section tags0110%

What each file covers

Sections

0 shared · 7 only in A · 6 only in B
  • − LangGraph.js
  • − Overview
  • − Core Concepts
  • − Key Features
  • − Development Practices
  • − Deployment
  • − Relevant Files in this Project
  • + Subgraphs and Workflow Orchestration
  • + LangGraph Core Concept
  • + Key Components
  • + Designing Subgraphs
  • + Example Flows
  • + Persistence with Subgraphs

Commands

neither file has any

Section tags

0 shared · 1 only in A · 1 only in B
  • − architecture
  • + agent-behaviour

Line diff

+33 added−36 removed14 unchanged28.0% identical
ssdeanx/langgraph-dm · .clinerules/langgraphjs.md
@@ −1 @@
1---
2glob: "**/*.ts"
3description: "Langgraphjs Architecture"
4---
5# LangGraph.js
6 
7## Overview
8 
9LangGraph.js is a powerful library for building stateful, multi-actor AI applications with Large Language Models (LLMs). It allows you to model complex agent workflows as graphs, where nodes represent individual steps or agents and edges define the flow of information and control.
 
 
10 
11## Core Concepts
12 
13* **StateGraph:** The primary class for defining graph-based workflows. It manages the shared state that is passed between nodes.
14* **Nodes:** Functions or runnable components that perform specific tasks and update the graph's state.
15* **Edges:** Define transitions between nodes, which can be unconditional or conditional based on the current state.
16* **State:** A shared data structure (`AgentState`) that represents the current context of the application, updated by nodes and passed along edges.
17* **Checkpoints:** Snapshots of the graph's state saved at various points, enabling persistence, debugging, and human-in-the-loop interactions.
18* **Subgraphs:** The ability to embed one graph as a node within another, promoting modularity and hierarchical design.
19* **Command Primitive:** A mechanism for combining state updates and dynamic control flow within a single node.
20* **Streaming:** First-class support for streaming intermediate results and LLM tokens, enhancing user experience.
21* **Human-in-the-Loop (HIL):** Features like `interrupt()` and breakpoints allow human intervention for approvals, state editing, and dynamic input.
22 
23## Key Features
24 
25* **Controllability:** Fine-grained control over the application's flow through explicit node and edge definitions.
26* **Persistence:** Built-in mechanisms for saving and restoring graph state, supporting long-running conversations and fault tolerance.
27* **Modularity:** Encourages breaking down complex problems into smaller, reusable components (nodes and subgraphs).
28* **Tool Integration:** Seamlessly integrates with LangChain tools, allowing agents to interact with external systems.
29* **Observability:** Integrates with LangSmith for tracing, debugging, and monitoring of LLM applications.
 
 
 
 
30 
31## Development Practices
32 
33* **TypeScript:** Strongly typed development for improved code quality and maintainability.
34* **Testing:** Encourages comprehensive unit and integration testing of nodes, agents, and overall graph workflows.
35* **Error Handling:** Robust error handling for tool calls and model invocations.
 
 
36 
37## Deployment
38 
39LangGraph.js applications can be deployed in various ways, including self-hosted solutions or through the LangGraph Platform (Cloud, BYOC). The LangGraph CLI and SDK provide tools for building, running, and interacting with deployed applications.
40 
41## Relevant Files in this Project
42 
43* `src/agent/graph.ts`: Defines the main `StateGraph` and its nodes/edges, orchestrating the agent workflow.
44* `src/agent/state.ts`: Defines the `AgentState` interface and `AgentAnnotation` for managing the application's state.
45* `src/agent/supervisor.ts`: Implements the supervisor agent for routing between specialized agents.
46* `src/agent/react_agent.ts`: Implements the ReAct (Reasoning and Acting) agent.
47* `src/memory/`: Contains implementations for memory management, including MongoDB integration for checkpoints and vector stores.
48* `src/tools/`: Houses various tools used by the agents (e.g., `calculator`, `document_processing`, `exa`, `github`, `local_git`, `tavily`, `web_scraping`).
49* `package.json`: Lists LangGraph and LangChain related dependencies.
50 
ssdeanx/langgraph-dm · .clinerules/subgraphs.md
@@ +1 @@
1---
2glob: "**/*.ts"
3description: "Langgraph Subgraphs & Workflow Orchestration"
4---
5# Subgraphs and Workflow Orchestration
6 
7## LangGraph Core Concept
8 
9* This project heavily utilizes LangGraph's `StateGraph` to define and manage complex, multi-step AI agent workflows.
10* A "graph" represents the flow of control and data between different nodes (which are typically agents or tool calls).
11* Subgraphs allow you to reuse an existing graph as a node within another graph, promoting modularity and hierarchical organization.
12 
13## Key Components
14 
15* **Nodes:** Represent individual steps or agents in the workflow (e.g., `entryNode`, `supervisor`, `reactAgent`, `research_collectNode`). Each node takes the current `AgentState` as input and returns an updated state.
16* **Edges:** Define the transitions between nodes.
17 * **Normal Edges:** Unconditionally move from one node to another (e.g., `START` to `entry`, `chat` to `END`).
18 * **Conditional Edges:** Route to different nodes based on a decision function (e.g., `routeMessages` from `supervisor` to various agents). The routing function takes the `AgentState` and returns the name of the next node(s) or `END`.
19* **`AgentState`:** The central data structure that is passed and modified across all nodes in the graph, maintaining the conversation context and agent-specific data. Defined using `Annotation`.
20* **Supervisor:** A critical node responsible for intelligently routing the `AgentState` to the appropriate specialized agent or action based on the current context and goal.
21* **`Command` Primitive:** Allows combining state updates and control flow (routing) within a single node, useful for dynamic handoffs between agents.
 
 
22 
23## Designing Subgraphs
24 
25* **Modularity:** Complex workflows should be broken down into smaller, manageable subgraphs or sequences of nodes.
26* **Clear Responsibilities:** Each node and subgraph should have a clear, single responsibility.
27* **State Flow:** Pay close attention to how data flows through the `AgentState` between nodes to ensure necessary information is available at each step.
28* **Error Handling:** Design subgraphs to handle errors gracefully, potentially returning control to a supervisor for re-routing or error reporting.
29* **Routing Logic:** The `routeMessages` function (or similar conditional routing) is crucial for dynamic and intelligent workflow execution. Ensure its logic covers all necessary transitions and fallback scenarios.
30* **Communication:**
31 * If the parent graph and subgraph share schema keys (channels), the compiled subgraph can be added directly as a node.
32 * If schemas are different, define a node function that explicitly invokes the subgraph, transforming input state and output results to match the parent's schema. This prevents errors due to non-overlapping channels.
33* **Nesting:** Subgraphs can be nested to any level, allowing for highly complex hierarchical agent systems.
34 
35## Example Flows
36 
37* **General Conversation:** `entry` -> `supervisor` -> `chat` -> `END`
38* **Research Task:** `entry` -> `supervisor` -> `research_collect` -> `research_summarize` -> `research_report` -> `supervisor` (for final response)
39* **Documentation Task:** `entry` -> `supervisor` -> `draft_documentation` -> `finalize_documentation` -> `supervisor` (for final response)
40* **React Agent Task:** `entry` -> `supervisor` -> `react` -> `supervisor` (for tool execution or further action)
41* **Multi-agent Network:** Agents can communicate with each other in a many-to-many fashion, making decisions on which agent to call next (e.g., `travel_advisor` -> `sightseeing_advisor` -> `hotel_advisor`).
42 
43## Persistence with Subgraphs
44 
45* Checkpointers should be passed only when compiling the *parent* graph. LangGraph automatically propagates the checkpointer to child subgraphs, enabling persistence across nested levels.
46* State of subgraphs can be viewed and updated, facilitating human-in-the-loop interactions and debugging within nested workflows.
 
 
 
 
 
 
 
 
 
47 
@@ −1 +1 @@
11 ---
22 glob: "**/*.ts"
3−description: "Langgraphjs Architecture"
3+description: "Langgraph Subgraphs & Workflow Orchestration"
44 ---
5−# LangGraph.js
5+# Subgraphs and Workflow Orchestration
66  
7−## Overview
7+## LangGraph Core Concept
88  
9−LangGraph.js is a powerful library for building stateful, multi-actor AI applications with Large Language Models (LLMs). It allows you to model complex agent workflows as graphs, where nodes represent individual steps or agents and edges define the flow of information and control.
9+* This project heavily utilizes LangGraph's `StateGraph` to define and manage complex, multi-step AI agent workflows.
10+* A "graph" represents the flow of control and data between different nodes (which are typically agents or tool calls).
11+* Subgraphs allow you to reuse an existing graph as a node within another graph, promoting modularity and hierarchical organization.
1012  
11−## Core Concepts
13+## Key Components
1214  
13−* **StateGraph:** The primary class for defining graph-based workflows. It manages the shared state that is passed between nodes.
14−* **Nodes:** Functions or runnable components that perform specific tasks and update the graph's state.
15−* **Edges:** Define transitions between nodes, which can be unconditional or conditional based on the current state.
16−* **State:** A shared data structure (`AgentState`) that represents the current context of the application, updated by nodes and passed along edges.
17−* **Checkpoints:** Snapshots of the graph's state saved at various points, enabling persistence, debugging, and human-in-the-loop interactions.
18−* **Subgraphs:** The ability to embed one graph as a node within another, promoting modularity and hierarchical design.
19−* **Command Primitive:** A mechanism for combining state updates and dynamic control flow within a single node.
20−* **Streaming:** First-class support for streaming intermediate results and LLM tokens, enhancing user experience.
21−* **Human-in-the-Loop (HIL):** Features like `interrupt()` and breakpoints allow human intervention for approvals, state editing, and dynamic input.
15+* **Nodes:** Represent individual steps or agents in the workflow (e.g., `entryNode`, `supervisor`, `reactAgent`, `research_collectNode`). Each node takes the current `AgentState` as input and returns an updated state.
16+* **Edges:** Define the transitions between nodes.
17+ * **Normal Edges:** Unconditionally move from one node to another (e.g., `START` to `entry`, `chat` to `END`).
18+ * **Conditional Edges:** Route to different nodes based on a decision function (e.g., `routeMessages` from `supervisor` to various agents). The routing function takes the `AgentState` and returns the name of the next node(s) or `END`.
19+* **`AgentState`:** The central data structure that is passed and modified across all nodes in the graph, maintaining the conversation context and agent-specific data. Defined using `Annotation`.
20+* **Supervisor:** A critical node responsible for intelligently routing the `AgentState` to the appropriate specialized agent or action based on the current context and goal.
21+* **`Command` Primitive:** Allows combining state updates and control flow (routing) within a single node, useful for dynamic handoffs between agents.
2222  
23−## Key Features
23+## Designing Subgraphs
2424  
25−* **Controllability:** Fine-grained control over the application's flow through explicit node and edge definitions.
26−* **Persistence:** Built-in mechanisms for saving and restoring graph state, supporting long-running conversations and fault tolerance.
27−* **Modularity:** Encourages breaking down complex problems into smaller, reusable components (nodes and subgraphs).
28−* **Tool Integration:** Seamlessly integrates with LangChain tools, allowing agents to interact with external systems.
29−* **Observability:** Integrates with LangSmith for tracing, debugging, and monitoring of LLM applications.
25+* **Modularity:** Complex workflows should be broken down into smaller, manageable subgraphs or sequences of nodes.
26+* **Clear Responsibilities:** Each node and subgraph should have a clear, single responsibility.
27+* **State Flow:** Pay close attention to how data flows through the `AgentState` between nodes to ensure necessary information is available at each step.
28+* **Error Handling:** Design subgraphs to handle errors gracefully, potentially returning control to a supervisor for re-routing or error reporting.
29+* **Routing Logic:** The `routeMessages` function (or similar conditional routing) is crucial for dynamic and intelligent workflow execution. Ensure its logic covers all necessary transitions and fallback scenarios.
30+* **Communication:**
31+ * If the parent graph and subgraph share schema keys (channels), the compiled subgraph can be added directly as a node.
32+ * If schemas are different, define a node function that explicitly invokes the subgraph, transforming input state and output results to match the parent's schema. This prevents errors due to non-overlapping channels.
33+* **Nesting:** Subgraphs can be nested to any level, allowing for highly complex hierarchical agent systems.
3034  
31−## Development Practices
35+## Example Flows
3236  
33−* **TypeScript:** Strongly typed development for improved code quality and maintainability.
34−* **Testing:** Encourages comprehensive unit and integration testing of nodes, agents, and overall graph workflows.
35−* **Error Handling:** Robust error handling for tool calls and model invocations.
37+* **General Conversation:** `entry` -> `supervisor` -> `chat` -> `END`
38+* **Research Task:** `entry` -> `supervisor` -> `research_collect` -> `research_summarize` -> `research_report` -> `supervisor` (for final response)
39+* **Documentation Task:** `entry` -> `supervisor` -> `draft_documentation` -> `finalize_documentation` -> `supervisor` (for final response)
40+* **React Agent Task:** `entry` -> `supervisor` -> `react` -> `supervisor` (for tool execution or further action)
41+* **Multi-agent Network:** Agents can communicate with each other in a many-to-many fashion, making decisions on which agent to call next (e.g., `travel_advisor` -> `sightseeing_advisor` -> `hotel_advisor`).
3642  
37−## Deployment
43+## Persistence with Subgraphs
3844  
39−LangGraph.js applications can be deployed in various ways, including self-hosted solutions or through the LangGraph Platform (Cloud, BYOC). The LangGraph CLI and SDK provide tools for building, running, and interacting with deployed applications.
40− 
41−## Relevant Files in this Project
42− 
43−* `src/agent/graph.ts`: Defines the main `StateGraph` and its nodes/edges, orchestrating the agent workflow.
44−* `src/agent/state.ts`: Defines the `AgentState` interface and `AgentAnnotation` for managing the application's state.
45−* `src/agent/supervisor.ts`: Implements the supervisor agent for routing between specialized agents.
46−* `src/agent/react_agent.ts`: Implements the ReAct (Reasoning and Acting) agent.
47−* `src/memory/`: Contains implementations for memory management, including MongoDB integration for checkpoints and vector stores.
48−* `src/tools/`: Houses various tools used by the agents (e.g., `calculator`, `document_processing`, `exa`, `github`, `local_git`, `tavily`, `web_scraping`).
49−* `package.json`: Lists LangGraph and LangChain related dependencies.
45+* Checkpointers should be passed only when compiling the *parent* graph. LangGraph automatically propagates the checkpointer to child subgraphs, enabling persistence across nested levels.
46+* State of subgraphs can be viewed and updated, facilitating human-in-the-loop interactions and debugging within nested workflows.
5047  
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack