[Open-source] From note assistant to personal intelligent entity, knowledge base is memory, tool is action
![[Open-source] From note assistant to personal intelligent entity, knowledge base is memory, tool is action](https://yy123.ink/api/img/1796366487802-z25u8k.jpeg)
1. Project Overview
Penling AI — Based on Spring AI's Personal Intelligent Entity
Evolve from a note-taking assistant to a personal intelligent entity. The knowledge base is memory, and the tool is action.
Based on Spring AI 2.0 + SpringBoot 4.1, this local multi-knowledge base AI note-taking assistant supports @Tool tool arrangement (automatic file reading and writing / note search), RAG semantic search (Ollama local vector), Feishu WebSocket two-way integration, DeepSeek / Zhifu / Sougou multi-model switching, scheduled report generation, task management, image recognition, zero external dependencies, java -jar one-step startup, all data stored locally without uploading to the cloud, perfect replacement for NotionAI.
2. Open Source License
Licensed under Apache-2.0
3. Screenshots
4. Feature Overview
Core positioning
Penling AI is apersonal intelligent entity systemnot a simple AI chat tool.
Its architecture revolves around a core concept:Knowledge base (RAG) as memory, tool (Tools) as action, AI autonomous arrangement of the two.
| Components |
Roles |
Implementation |
|
Knowledge base |
Long-term memory |
Markdown / JSON note files, semantic search |
| ️
Utility Collection |
Action ability |
File reading and writing, data set CRUD, Git operations, etc. |
|
AI arrangement |
Decision-making center |
Spring AI ChatClient + ToolCallingAdvisor |
|
Data set |
Structured memory |
SQLite table, schema customizable, conditional query |
AI can autonomously judge: ask 'my notes last week' → search knowledge base; ask 'bugs to be fixed' → query data set; ask 'generate daily report' → simultaneously search notes + query data → comprehensive output.
Functional Panorama
┌─────────────────────────────────────────────────────────────────┐│ PenlingAIPersonal intelligent entity system ││ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ AIArrangement layer │ ││ │ ChatClient + ToolCallingAdvisor (Spring AI 2.0) │ ││ │ User question →AIDecision → Call tool → Return result → Generate reply │ ││ └──────┬────────────────────┬──────────────────────────────┘ ││ │ │ ││ ┌──────▼──────────┐ ┌─────▼──────────────┐ ││ │ NoteTools │ │ DataTools │ ││ │ File operation tool │ │ Data set tool │ ││ │ │ │ │ ││ │ • readFile │ │ • listDatasets │ ││ │ • writeFile │ │ • searchRecords │ ││ │ • listDir │ │ • queryRecords │ ← Precise filtering by condition ││ │ • searchFiles │ │ • addRecord │ ││ │ • searchNotes │ │ • updateRecord │ ││ │ │ │ • deleteRecord │ ││ │ │ │ • getRecord │ ││ └──────┬──────────┘ └─────┬──────────────┘ ││ │ │ ││ ┌──────▼───────────────────▼──────────────┐ ││ │ Data source │ ││ │ ┌──────────────┐ ┌──────────────────┐ │ ││ │ │ Note files in knowledge base │ │ Data set (SQLite) │ │ ││ │ │ JSON/Markdown│ │ Client /Bug/Project, etc. │ │ ││ │ │ Unstructured memory │ │ Structured data │ │ ││ │ └──────────────┘ └──────────────────┘ │ ││ └──────────────────────────────────────────┘ ││ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ Business function │ ││ │ 💬 AIDialogue 📦 Data center 📊 Comprehensive daily report 🖼️ Image recognition │ ││ │ 📋 Task management ⏰ Reminder 🧩 Module 🤖AIGuidance │ ││ │ 📄 Note browsing 🏠 Home page dashboard ⚙️ Configuration 📖 Log │ ││ └───────────────────────────────────────────────────────────┘ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ Integration channel │ ││ │ 🌐 Web UI (Thymeleaf) 💬 FeishuWebSocket⏰ Scheduled task │ ││ └───────────────────────────────────────────────────────────┘ │└─────────────────────────────────────────────────────────────────┘
| Function |
Description |
Entrance |
|
AI dialogue |
Tool arrangement + semantic recall + continuous dialogue, separated by KB |
/chat |
|
Data Center |
Multi-data set management, schema definition, import and export, AI query |
/data |
|
Comprehensive daily report |
AI reads notes + queries data set, combined to generate daily report |
Home page / scheduled |
| ️
Image recognition |
Multi-modal analysis, result written to note library |
/image |
|
Task Management |
Dashboard view, separated by KB |
/kb/{id}/tasks |
| ⏰
Reminder system |
Scheduled reminder, Feishu push |
/kb/{id}/reminders |
|
Module / subject |
Custom business module, associated directory |
/kb/{id}/modules |
|
Note browsing |
File directory browsing + AI analysis |
/kb/{id}/browse |
|
AI guidance |
AGENTS.md + memory file editing |
/kb/{id}/ai-guide |
|
Home page dashboard |
Multi-knowledge base summary + daily report display |
/ |
| ⚙️
Configuration Management |
LLM / Knowledge base / System settings |
/config |
Function explanation
1. AI Tool Arrangement (Core Capability)
AI determines when to call tools through Spring AI's ToolCallingAdvisor without needing to write ReAct loops.
NoteTools — Knowledge Base File Operations
| Tools |
Function |
Trigger Scenarios |
| readFile |
Read Note Library Files |
AI needs to understand existing data |
| writeFile |
Write Files (Prevent Overwrite by Reading First) |
Create/Update Note Records |
| listDir |
List Directories |
Explore Note Library Structure |
| searchFiles |
Search by File Name |
Find Specific Files |
| searchNotes |
Search by Content |
Find Related Notes |
DataTools — Data Set Structured Operations
| Tools |
Function |
Trigger Scenarios |
| listDatasets |
List All Data Sets |
View Available Data |
| queryRecords |
Precise Query by Conditions |
"Unfixed Bugs" , "Quotation Stage Clients" |
| searchRecords |
Fuzzy Search by Keywords |
Full-Text Search When Specific Fields Are Uncertain |
| addRecord |
Add Records |
Record New Clients/New Bugs |
| updateRecord |
Update Records |
Modify Status/Follow-Up Information |
| deleteRecord |
Delete Records |
Remove Error Data |
| getRecord |
View Single Record Details |
Get Complete Record Information |
Typical Scenarios:
| You Say |
AI Executes |
Result |
| "Check Quotation Stage Clients" |
queryRecords("Clients", {"Stage":"Quotation"}) |
List Matching Clients |
| "Today's Unfixed Bugs" |
queryRecords("Bugs", {"Status":"Unfixed"}) |
List All Bugs |
| "Record: Visited ABC Company" |
addRecord("Clients", {...}) |
Write Data Sets |
| "Generate This Week's Report" |
Query Data Sets + Read Notes → Comprehensive Output |
Save + Reply |
2. Comprehensive Daily Report
Generated daily at 09:00, also supports manual triggering.
Workflows:
-
AI uses listDatasets + queryRecords to query task/Bug/project status in data sets -
AI uses searchNotes + readFile to read work records from note files -
Combining the two generates a complete daily report -
Optional push to Feishu cards
Features:
-
Non-structured data (notes) + structured data (data sets) fusion -
Customizable prompt word templates -
Daily report saved to SQLite, automatically clears records 7 days prior
3. Data Center (Data Set System)
Structured data management, independent of note files.
Core Design:
-
Records are divided into two parts: fixed fields (ID, type, status, creation time, update time) + dynamic fields (Schema definition) -
Schema is freely defined: field name, type, dropdown options -
Data is stored in SQLite, not in note library files
Function:
-
Data Set CRUD (name, description, schema) -
Record Insert, Update, Delete, Query -
Data Import: JSON, Excel -
AI-Assisted Query: queryRecords for Precise Filtering by Conditions
Usage Examples:
-
Create a "Customer Follow-up" Dataset with Fields: Company Name, Contact Person, Demand, Stage, Follow-up Time -
Create a "Bug Tracking" Dataset with Fields: Title, Project, Priority, Status -
Then Ask AI Directly: "Which Customers are in the Quotation Stage this Week?" and "Which High-Priority Bugs are There?"
4. Multiple Knowledge Base Systems
Manage Multiple Knowledge Bases (Work/Study/Project Etc.) in One Instance, with Complete Data Isolation
| Dimension |
Isolation Method |
| Chat History |
SQLite
kb_id
+ Vector Recall Limitation
kb_id |
| Module / subject |
SQLite
kb_id
Filter |
| AI Memory |
{notesDir}/AI/Memory/
Isolation |
| Task/Reminder |
{notesDir}/AI/Tasks/
+
{notesDir}/AI/Reminders/
Isolation |
| File Operations |
NoteTools Path Based on Current KB |
5. Feishu Integration
| Method |
Description |
| Webhook Push |
Daily Report Push, Reminder Push |
| WebSocket Long Connection |
Real-Time Two-Way Communication, AI Automatic Reply to Group Messages |
5. Tech Stack
Quick Start
Environment Requirements
| Components |
Requirements |
Description |
| JDK |
17+ |
|
| Maven |
3.8+ |
Only Compile Required |
| LLM API Key |
Mandatory |
DeepSeek / Sougou / Zhishu Etc. Compatible with OpenAI Format |
| Ollama |
Optional |
Local Semantic Search Acceleration (nomic-embed-text) |
Start
1. Compilemvn package -q# 2. Startupjava -jar target/ai-assistant-1.0.0.jar# 3. Open browser at http://localhost:6790Enter /config to configure LLM API Key + note library root directory
Environment variables (optional, with high priority over Web configuration)
export LLM_API_KEY=sk-xxxxxexport LLM_BASE_URL=https://api.deepseek.comexport LLM_MODEL=deepseek-chat
Supported LLMs
| Providers |
Base URL |
Example models |
| DeepSeek |
https://api.deepseek.com |
deepseek-chat |
| SenseNova from SenseTime |
https://token.sensenova.cn/v1 |
SenseChat |
| GLM from Zhishu |
https://open.bigmodel.cn/api/paas/v4 |
glm-4 |
| Ollama local |
http://127.0.0.1:11434/v1 |
qwen2.5 |
Technical Architecture
Tech Stack
| Category |
Technology |
| Backend Framework |
Spring Boot 4.1 |
| AI framework |
Spring AI 2.0 (ChatClient + @Tool + ToolCallingAdvisor) |
| LLM |
DeepSeek (OpenAI compatible protocol, switchable) |
| Embedded models |
Ollama (nomic-embed-text) |
| ORM |
MyBatis-Plus 3.5.16 |
| Database |
SQLite |
| Frontend |
Thymeleaf + native JS |
| IM integration |
Feishu OpenAPI SDK + WebSocket |
| Excel |
Apache POI 5.4.0 |
AI call chain
┌────────────────────────────┐│ LlmConfigResolver ││ Priority: Web > Environment variables │└──────────┬─────────────────┘│┌─────────────────────┼─────────────────────┐▼ ▼ ▼┌──────────┐ ┌──────────────────┐ ┌──────────────┐│LlmService│ │ NoteAssistantSvc │ │AgentAnalysis ││ Direct LLM connection │ │ Dialogue + tool arrangement │ │ Report/analysis generation │└──────────┘ └────────┬─────────┘ └──────┬───────┘│ │┌────────▼─────────┐ ││ ToolRegistry │ ││ Automatic discovery │ │└──┬───────┬──────┘ ││ │ │┌──────▼──┐ ┌──▼────────┐ ││NoteTools│ │DataTools │ ││ File operations │ │ Dataset operations │ │└─────────┘ └───────────┘ ││ │└─────────┬───────────┘▼┌────────────────────┐│ DeepSeekChatModel ││ (OpenAI compatible protocol) │└────────┬───────────┘▼LLM API (DeepSeek/SenseTime/Zhishu/Ollama)
Tool self-registration mechanism
ToolRegistry scans all @Component classes with @Tool methods through reflection, automatically registering them to ChatClient. To add a new tool:
-
Write a @Component class -
Add a @Tool method -
No need to modify any Service or Controller
Data storage
| Data types |
Storage locations |
Description |
| Business data |
Knowledge base notesDir |
JSON / Markdown, local file system |
| Chat records |
memory.db
(SQLite) |
sessions
+
messages
Tables |
| Dialogue vectors |
memory.db
(SQLite) |
turn_embeddings
Tables |
| Knowledge base |
memory.db
(SQLite) |
knowledge_bases
Tables |
| Module / subject |
memory.db
(SQLite) |
modules
Tables |
| Data set |
memory.db
(SQLite) |
data_center_datasets
+
data_center_records
Tables |
| Daily report |
memory.db
(SQLite) |
ai_analysis
Tables |
| Configuration |
config.json |
LLM credentials, Feishu configuration, global settings |
Project structure
src/main/java/com/laoqi/assistant/├── AssistantApplication.java # Startup entry│├── controller/ # Web controller│ ├── ChatController.java # AI dialogue (SSE streaming)│ ├── IndexController.java # Home page│ ├── ConfigController.java # Configuration page│ ├── KnowledgeBaseController.java # Knowledge base CRUD + daily report│ ├── DataSetController.java # Dataset REST API│ ├── DataPageV2Controller.java # Data center v2 page│ ├── DataCenterPageController.java # Data center v1 page│ ├── DataController.java # Data API│ ├── ImageRecognitionController.java # Image recognition│ ├── TaskController.java # Task management│ ├── ReminderController.java # Reminder management│ ├── ModuleController.java # Module system│ ├── AiGuideController.java # AI guide│ ├── LogController.java # Operation log│ ├── HelpController.java # Help page│ ├── CollectorController.java # Collector API│ ├── CollectorPageController.java # Collector page│ ├── HealthController.java # Health check│ └── GlobalModelAdvice.java # Global template variables│├── service/ # Business service│ ├── NoteAssistantService.java # AI dialogue composition (ChatClient + Tools)│ ├── AgentAnalysisService.java # Automatic analysis (daily report/analysis)│ ├── ReportService.java # Daily report generation│ ├── LlmService.java # LLM direct connection│ ├── LlmConfigResolver.java # LLM configuration parsing│ ├── ToolRegistry.java # Tool self-registration center│ ├── NoteTools.java # File operation tool│ ├── DataTools.java # Dataset operation tool│ ├── KnowledgeBaseService.java # Multi-knowledge base management│ ├── SessionService.java # Session management + semantic search│ ├── SchedulerService.java # Scheduled tasks│ ├── ReminderService.java # Reminder management│ ├── TaskService.java # Task management│ ├── ModuleService.java # Module system│ ├── ModuleDataService.java # Module data operation│ ├── ConfigService.java # Configuration read/write│ ├── TodoService.java # Pending task parsing│ ├── LogService.java # Operation log│ ├── FeishuService.java # Feishu push│ ├── FeishuLongConnectionService.java # Feishu long connection│ └── db/ # MyBatis-Plus DB service│├── datacenter/ # Data center module│ ├── DataSetService.java # Dataset core business│ ├── DataSetImportService.java # Data import│ ├── DataModuleService.java # Data module│ └── model/ # Data model│├── entity/ # MyBatis-Plus entity├── mapper/ # MyBatis-Plus Mapper├── model/ # POJO model└── util/ # Utility Classsrc/main/resources/└── templates/├── 2.0/ # v2 UI (current main interface)│ ├── layout.html│ ├── data.html│ ├── data-module.html│ └── ...└── 1.0/ # v1 interface├── layout.html└── ...
⚙️ Configuration reference
server:port: 6790app:config-dir: ${ASSISTANT_CONFIG_DIR:.}timezone: Asia/Shanghaispring:datasource:url: jdbc:sqlite:${ASSISTANT_CONFIG_DIR:.}/memory.dbai:ollama:base-url: http://127.0.0.1:11434embedding:options:model: nomic-embed-text
Data privacy
-
All data saved inLocalAbsolutely do not upload to the cloud -
LLM API only sends the current conversation content, does not transmit the complete note library -
Ollama search runs completely locally -
Open-source code, can be audited by yourself
6. Source Code Repository
Open-source project address:
https://gitee.com/qiliping/biling-ai-notes-assistant
Next steps