liteflow
AGENTS.md3.9k starsChanged 4 months agoApache-2.0View on GitHub
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository. LiteFlow (v2.16.1) is a lightweight rules engine framework for complex component-based business orchestration. It uses a DSL to drive workflows with support for hot reload and 11 scripting languages. The project targets Java 8+ (up to JDK 25) and has 2000+ test cases. Official Documentation: https://liteflow.cc/pages/5816c5/ FlowExecutor → Chain → Condition Tree → Node Components Rules are defined in XML/JSON/YML: Declarative Component Pattern: Any Spring bean…
Trending
Quiet this year.thin dataabout the whole repository
Who's talking about dromara/liteflow
- Wechat-ggGitHub/Awesome-GitHub-Repo“【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎”GitHub · Jul 8, 2022 · 2 reactions
- feuyeux/hello-liteflow“Bump com.yomahub:liteflow-core from 2.11.2 to 2.12.1”GitHub · Jun 5, 2024
- GitHubDaily/GitHubDaily“【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎”GitHub · Jul 8, 2022
- CodingDocs/awesome-java“【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎”GitHub · Jul 8, 2022
- ruanyf/weekly“【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎”GitHub · Jul 8, 2022
The biggest 5 of 7 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 7
Talked about on GitHub (7 times).
On GitHub · 7
- Jul 8, 2022【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎 — Wechat-ggGitHub/Awesome-GitHub-Repo2 reactions
- Jun 5, 2024Bump com.yomahub:liteflow-core from 2.11.2 to 2.12.1 — feuyeux/hello-liteflow0 reactions
- Jul 8, 2022【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎 — GitHubDaily/GitHubDaily0 reactions · 1 comment
- Jul 8, 2022【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎 — CodingDocs/awesome-java0 reactions · 2 comments
- Jul 8, 2022【开源自荐】LiteFlow,轻量,快速,稳定可编排的组件式规则引擎 — ruanyf/weekly0 reactions
2 more on GitHub
- Jul 8, 2022【开源自荐】LiteFlow,灵动且强大的编排式规则引擎 — 521xueweihan/HelloGitHub0 reactions · 1 comment
- May 11, 2022文档可以写的easy一点么,好让初学者入门,文档看的我高血压都犯了。 — apache/shenyu0 reactions · 2 comments
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 96
All extend NodeComponent but have specialized behaviors:
- Distinctive: line 230
enableVirtualThread: Use virtual threads (JDK 21+)
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
Overview
LiteFlow (v2.16.1) is a lightweight rules engine framework for complex component-based business orchestration. It uses a DSL to drive workflows with support for hot reload and 11 scripting languages. The project targets Java 8+ (up to JDK 25) and has 2000+ test cases.
Official Documentation: https://liteflow.cc/pages/5816c5/
Commands
Build
# Build entire project (uses 'compile' profile by default, includes test modules)
mvn clean package -DskipTests
# Build with tests
mvn clean package
# Build specific module
mvn clean package -DskipTests -pl liteflow-core
# Build for release (production modules only, excludes tests)
mvn clean package -DskipTests -P releaseRun Tests
# Run all tests
mvn test
# Run tests for specific module (30+ test modules in liteflow-testcase-el/)
mvn test -pl liteflow-testcase-el/liteflow-testcase-el-springboot
# Run single test class
mvn test -pl liteflow-core -Dtest=FlowExecutorTest
# Run specific test method
mvn test -pl liteflow-core -Dtest=FlowExecutorTest#testExecuteOther Commands
# Dependency tree
mvn dependency:tree
# View module structure
ls liteflow-*/pom.xmlHigh-Level Architecture
Core Execution Model
FlowExecutor → Chain → Condition Tree → Node Components
- FlowExecutor: Entry point for executing workflows (
execute2Resp(chainId, param)) - FlowBus: Central metadata registry for all chains and nodes (thread-safe, supports hot reload)
- Chain: Named workflow composed of an EL expression that compiles to a Condition tree
- Slot/DataBus: Thread-safe context management using slot pooling (configurable
slotSize) - NodeComponent: Base class for all business logic components
Key Architectural Patterns
1. Two-Stage Parsing
Chains are built in two phases to handle circular dependencies:
- Phase 1: Register chain IDs (creates placeholder chains)
- Phase 2: Build complete condition trees with EL parsing
2. EL Expression Language
Uses QLExpress to parse declarative workflows. Example operators:
- THEN(a, b, c): Sequential execution
- WHEN(a, b, c): Parallel execution (async)
- IF(condition, trueNode, falseNode): Conditional branching
- SWITCH(selector).to(a, b, c): Multi-way branching
- FOR(count).DO(loop): Fixed-count loop
- WHILE(condition).DO(loop): Condition-based loop
- ITERATOR(iterator).DO(loop): Iterator-based loop
- RETRY(node).times(3).forException(Ex.class): Retry mechanism
- CATCH(node).DO(handler): Exception handling
- TIMEOUT(node).time(1000): Execution timeout (ms)
- PRE(a, b): Pre-conditions (always run before chain, even on error)
- FINALLY(a, b): Finally-conditions (always run after chain)
- AND(a, b), OR(a, b), NOT(a): Boolean logic for IF conditions
- node.tag("t"), .data("k","v"), .id("id"): Per-node modifiers
Rules are defined in XML/JSON/YML:
<chain name="myChain">
THEN(a, WHEN(b, c).maxWaitSeconds(5), IF(e, f, g));
</chain>3. Component Types
All extend NodeComponent but have specialized behaviors:
- NodeComponent: Standard synchronous component (
process()method) - NodeBooleanComponent: Returns boolean for IF conditions (
processBoolean()) - NodeSwitchComponent: Returns string for SWITCH routing (
processSwitch()) - NodeIteratorComponent: Provides iteration logic for ITERATOR construct
- NodeForComponent: Controls FOR loop behavior
- ScriptComponent: Script-based components (Groovy, JS, Python, etc.)
Declarative Component Pattern: Any Spring bean can become a component without extending base classes by using @LiteflowCmpDefine (class-level, specifies NodeTypeEnum) and @LiteflowMethod (method-level, maps to LiteFlowMethodEnum). This avoids class hierarchy constraints.
Component Lifecycle Hooks (override in NodeComponent subclasses or via @LiteflowMethod):
isAccess()– gate check before execution; returnfalseto skipbeforeProcess()/afterProcess()– pre/post hooks per componentonSuccess()/onError()– outcome callbacksisContinueOnError()– whether WHEN continues if this node failsisEnd()– signals chain should stop after this noderollback()– called in reverse order on failure
@FallbackCmp: Annotate a fallback component that activates when the primary component is not found or throws.
4. Slot-Based Context
Thread-safe execution context:
DataBus.offerSlot(chainId)acquires a slot from pool- Slot contains execution metadata, context beans, and step tracking
DataBus.releaseSlot(slotIndex)returns slot to pool- Pool size configurable via
slotSizeproperty
5. Parse Mode Strategies
Three modes (ParseModeEnum):
- PARSE_ALL_ON_START: Parse all chains at startup (default)
- PARSE_ONE_ON_FIRST_EXEC: Lazy parse each chain on first use (faster startup)
- PARSE_ALL_ON_FIRST_EXEC: Parse all chains on first any chain execution
Module Structure
Core Modules
- liteflow-core: Core engine (FlowExecutor, FlowBus, DataBus, Slot, Condition system, component model)
- liteflow-el-builder: Programmatic chain builder API using QLExpress
Rule Source Plugins (6 implementations in liteflow-rule-plugin/)
- liteflow-rule-zk: ZooKeeper configuration source
- liteflow-rule-sql: SQL database configuration source
- liteflow-rule-nacos: Nacos configuration center
- liteflow-rule-etcd: etcd configuration source
- liteflow-rule-apollo: Apollo configuration center
- liteflow-rule-redis: Redis configuration source
Rule-DB Modules (Publisher plus 6 implementations in the root-level liteflow-rule-db/ parent module)
- liteflow-rule-db-publisher: Backend-neutral publishing API and ServiceLoader contract
- liteflow-rule-db-sql: SQL-backed authoritative storage with change-log polling
- liteflow-rule-db-postgresql: PostgreSQL-backed authoritative storage with transactional publishing and change-log polling
- liteflow-rule-db-mongodb: MongoDB-backed authoritative storage with transactional publishing and change-log polling
- liteflow-rule-db-redis: Redis-backed authoritative storage with change-log polling
- liteflow-rule-db-etcd: etcd-backed authoritative storage with metadata watch
- liteflow-rule-db-zk: ZooKeeper-backed authoritative storage with metadata watch
Script Plugins (11 languages in liteflow-script-plugin/)
- liteflow-script-groovy: Groovy scripting
- liteflow-script-javascript: Rhino JavaScript (JSR223)
- liteflow-script-graaljs: GraalVM JavaScript
- liteflow-script-qlexpress: Alibaba QLExpress
- liteflow-script-python: Jython (Python on JVM)
- liteflow-script-lua: LuaJ
- liteflow-script-aviator: Aviator expression language
- liteflow-script-java: Janino (Java compiler)
- liteflow-script-javax: JSR223 standard Java compiler
- liteflow-script-javax-pro: Liquor-based Java compiler (enhanced)
- liteflow-script-kotlin: Kotlin scripting
Framework Integration
- liteflow-spring: Spring framework integration (component scanning, bean lifecycle, AOP)
- liteflow-spring-boot-starter: Spring Boot auto-configuration with
@ConfigurationProperties - liteflow-solon-plugin: Solon framework integration (lightweight alternative to Spring)
Testing Infrastructure
30+ test modules in liteflow-testcase-el/ organized by:
- Framework: springboot, springnative, solon, nospring
- Config Sources: zk, nacos, etcd, apollo, redis, sql
- Scripts: One module per language + multi-language scenarios
- Features: builder, declare, routechain, monitoring, timeout, etc.
Test pattern:
@SpringBootTest
@TestPropertySource(value = "classpath:/application.properties")
public class MyTest {
@Resource private FlowExecutor flowExecutor;
@Test
public void test() {
LiteflowResponse response = flowExecutor.execute2Resp("chainId", "arg");
Assertions.assertTrue(response.isSuccess());
}
}Important Design Patterns
SPI Pattern for Extensibility
Used extensively for:
ContextAware: Framework abstraction (Spring vs non-Spring)PathContentParser: Custom file path resolutionCmpAroundAspect: Global component lifecycle hooksDeclComponentParser: Declarative component parsing- Script executors for each language
Lifecycle Hooks
Multiple extension points:
PostProcessChainBuildLifeCycle: Before/after chain buildingPostProcessNodeBuildLifeCycle: Before/after node buildingPostProcessChainExecuteLifeCycle: Before/after chain executionPostProcessFlowExecuteLifeCycle: Before/after flow execution
Rollback Mechanism
Components implement rollback() for automatic rollback on failure (executed in reverse order via executeSteps deque).
Hot Reload Support
MonitorFilewatches rule files for changesreloadRule()refreshes without restart- Copy-on-write collections (unless
fastLoad=true) prevent concurrent modification
Metadata Caching
FlowBususes CopyOnWriteHashMap (or regular HashMap withfastLoad)- EL MD5 caching for expression reuse
- Chain caching configurable (
chainCacheEnabled,chainCacheCapacity)
Critical Configuration (LiteflowConfig)
- ruleSource: Rule file locations (supports XML, JSON, YML)
- parseMode: Parsing strategy (affects startup performance)
- slotSize: Context slot pool size
- enableMonitorFile: Hot reload of rule files
- supportMultipleType: Mix XML/JSON/YML rules
- whenMaxWaitTime: Timeout for WHEN parallel execution
- fastLoad: Disable CopyOnWrite for faster startup
- enableVirtualThread: Use virtual threads (JDK 21+)
Key File Locations
- Core engine:
liteflow-core/src/main/java/com/yomahub/liteflow/flow/ - FlowExecutor:
liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java - FlowBus:
liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java - Component base:
liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java - Condition system:
liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/ - EL parser:
liteflow-core/src/main/java/com/yomahub/liteflow/parser/el/
Important Conventions
- Naming: Components identified by
nodeId, chains bychainId - Thread Safety: Extensive ThreadLocal and concurrent collections
- Fail-Fast: Validation at parse time with detailed error messages
- Fluent APIs: Builder pattern for chain construction (EL builder)
- Namespaces: Chains can be organized into namespaces
- Versioning: Uses
${revision}placeholder (currently 2.16.1) via flatten-maven-plugin
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

