Skip to content

Commit 6490772

Browse files
committed
feat: add CLAUDE.md
Signed-off-by: yuluo-yx <yuluo08290126@gmail.com>
1 parent 0d276cb commit 6490772

File tree

1 file changed

+150
-0
lines changed

1 file changed

+150
-0
lines changed

CLAUDE.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# CLAUDE.md - AI Assistant Guide for Spring AI Alibaba
2+
3+
This file provides guidance for AI assistants working with the Spring AI Alibaba codebase.
4+
5+
## Project Overview
6+
7+
Spring AI Alibaba is a production-ready framework for building Agentic, Workflow, and Multi-agent applications. It is an implementation of the Spring AI framework tailored for Alibaba Cloud services and components. It provides a comprehensive ecosystem for developing AI-powered applications with built-in context engineering and human-in-the-loop support.
8+
9+
**Key Features:**
10+
11+
- Multi-Agent Orchestration with built-in patterns
12+
- Context Engineering with human-in-the-loop, context compaction, editing, model call limits
13+
- Graph-based workflow with conditional routing, nested graphs, parallel execution
14+
- A2A (Agent-to-Agent) support with Nacos integration
15+
- Rich model support (DashScope, OpenAI, DeepSeek) and MCP (Model Context Protocol)
16+
- One-stop visual agent platform
17+
18+
## Repository Structure
19+
20+
```
21+
spring-ai-alibaba/
22+
├── spring-ai-alibaba-agent-framework/ # Multi-agent framework (Sequential, Parallel, Routing, etc.)
23+
├── spring-ai-alibaba-graph-core/ # Runtime providing persistence, workflow orchestration, state mgmt
24+
├── spring-ai-alibaba-studio/ # Embedded UI for debugging agents visually
25+
├── spring-ai-alibaba-admin/ # One-stop Agent platform (visual dev, observability, MCP mgmt)
26+
├── spring-ai-alibaba-bom/ # Bill of Materials for dependency management
27+
├── spring-boot-starters/ # Spring Boot Starters
28+
│ ├── spring-ai-alibaba-starter-a2a-nacos/ # Nacos A2A communication
29+
│ ├── spring-ai-alibaba-starter-builtin-nodes/ # Built-in workflow nodes
30+
│ ├── spring-ai-alibaba-starter-config-nacos/ # Dynamic config with Nacos
31+
│ └── spring-ai-alibaba-starter-graph-observation/ # Observability
32+
├── examples/ # Example applications
33+
│ ├── chatbot/ # Chatbot example
34+
│ ├── deepresearch/ # Deep research agent example
35+
│ └── documentation/ # Documentation examples
36+
├── tools/ # Build and linting tools
37+
└── docs/ # Documentation
38+
```
39+
40+
## Build System
41+
42+
### Prerequisites
43+
44+
- **JDK**: 17 (Required by `java.version` property)
45+
- **Maven**: 3.6+
46+
- **Git**
47+
48+
### Common Build Commands
49+
50+
```shell
51+
# Build the entire project (skip tests)
52+
./mvnw -B package -DskipTests=true
53+
54+
# Build a specific module
55+
./mvnw -pl :spring-ai-alibaba-agent-framework -B package -DskipTests=true
56+
57+
# Clean project
58+
./mvnw clean
59+
60+
# Run tests
61+
./mvnw test
62+
63+
# Run linting checks (using Makefile)
64+
make lint
65+
make licenses-check
66+
```
67+
68+
## Architecture & Key Concepts
69+
70+
### Core Components
71+
72+
- **Agent Framework**: Built-in agents like `SequentialAgent`, `ParallelAgent`, `RoutingAgent`, `LoopAgent`, `SupervisorAgent`.
73+
- **Graph Core**: Underlying engine for stateful agents, supporting persistence (PostgreSQL, MySQL, Oracle, MongoDB, Redis, File).
74+
- **A2A (Agent-to-Agent)**: Enables agents to seek and communicate with each other using Nacos as a registry.
75+
- **Admin & Studio**: Provides visual tools for developing and debugging agent workflows.
76+
77+
### Technology Stack
78+
79+
- **Framework**: Spring Boot 3.5.x, Spring AI 1.1.x
80+
- **Cloud Integration**: Alibaba Cloud DashScope, Nacos (Service Discovery & Config)
81+
- **Observability**: Spring Cloud Observation (Micrometer/OpenTelemetry)
82+
83+
## Code Style & Conventions
84+
85+
### General Guidelines
86+
87+
- Follow **Spring AI** standard code formatting.
88+
- Use **Apache 2.0** license headers for all Java files.
89+
- **Java 17** features are encouraged (records, switch expressions, text blocks).
90+
- Avoid `System.out.println` - use SLF4J logging.
91+
- Use `final` for local variables and parameters where appropriate.
92+
- Use Lombok annotations (`@Data`, `@Slf4j`, etc.) to reduce boilerplate.
93+
94+
### Linting & Formatting
95+
96+
The project uses `make` for linting tasks:
97+
- `make codespell`: Checks for spelling errors.
98+
- `make yaml-lint`: Checks YAML file formatting.
99+
- `make licenses-check`: Verifies license headers.
100+
101+
### License Header
102+
103+
```java
104+
/*
105+
* Copyright 2025-2026 the original author or authors.
106+
*
107+
* Licensed under the Apache License, Version 2.0 (the "License");
108+
* you may not use this file except in compliance with the License.
109+
* You may obtain a copy of the License at
110+
*
111+
* https://www.apache.org/licenses/LICENSE-2.0
112+
*
113+
* Unless required by applicable law or agreed to in writing, software
114+
* distributed under the License is distributed on an "AS IS" BASIS,
115+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
116+
* See the License for the specific language governing permissions and
117+
* limitations under the License.
118+
*/
119+
```
120+
121+
## Testing
122+
123+
### Frameworks
124+
125+
- **JUnit 5** (`org.junit.jupiter`)
126+
- **Mockito**
127+
128+
### Running Tests
129+
130+
```shell
131+
# Run all tests
132+
./mvnw test
133+
134+
# Run a specific test class
135+
./mvnw -pl :<module-name> -Dtest=<TestClassName> test
136+
```
137+
138+
## Tips for AI Assistants
139+
140+
1. **JDK Version**: Project targets JDK 17. Use appropriate language features.
141+
2. **Spring Boot**: Uses Spring Boot 3.x. Be aware of `jakarta.*` namespace vs `javax.*`.
142+
3. **Dependencies**: Check `spring-ai-alibaba-bom` or parent pom for version management.
143+
4. **Makefile**: Use the Makefile in the root for project maintenance tasks (linting, license checks).
144+
5. **Structure**: When adding new features, prefer creating or updating modules within `spring-ai-alibaba-agent-framework` or `spring-boot-starters` depending on the scope.
145+
146+
## Important Links
147+
148+
- **Issues**: [https://github.com/alibaba/spring-ai-alibaba/issues](https://github.com/alibaba/spring-ai-alibaba/issues)
149+
- **Source**: [https://github.com/alibaba/spring-ai-alibaba](https://github.com/alibaba/spring-ai-alibaba)
150+
- **Contributing**: [CONTRIBUTING.md](CONTRIBUTING.md)

0 commit comments

Comments
 (0)