BossAgents System Architecture Overview

BossAgents System Architecture Overview

Version: v1.0 | Updated: 2026-05-30 | Scope: SCSAI PLM System


Table of Contents

  1. Design Philosophy
  2. Three-Tier Architecture Overview
  3. Configuration Layer: Rules, Templates, Prompts
  4. Base Digital Employee Capability Layer
  5. Business Digital Employee Layer
  6. Core Invocation Chain
  7. Data Flow Overview
  8. File Structure and Responsibilities
  9. API Route Summary
  10. Implementation Status and Optimization Roadmap

1. Design Philosophy

The BossAgents system adopts a three-tier architecture of "Rule-Driven + LLM-Enhanced + Layered Invocation":

配置层 (Configuration)
  规则(Rules) → 模板(Templates) → 提示词(Prompts)
        │              │                │
        └──────────────┼────────────────┘
                       │ 驱动
                       ▼
基础数字员工能力层 (Foundation Capabilities)
  Identify → Create → Repair → Optimize → Compare → Generate
        │
        │ 被调用
        ▼
业务数字员工层 (Business Staff)
  ECR审核员 → 供应商管家 → 成本优化师 → 数据书记员 → 系统运维师 → 内容生成师

核心原则:

  • Rules are deterministic logic, responsible for rapid judgment and standard operations.
  • Templates define data structures, ensuring consistent output formats.
  • Prompts are LLM interaction protocols, enabling AI to understand business context.
  • Business Digital Employees do not directly operate the underlying layers; instead, they accomplish tasks by invoking base capabilities and the rule engine.
  • The rule engine serves as the unified entry point; all validation/checking/repair operations are executed through it.

2. Three-Tier Architecture Overview

┌─────────────────────────────────────────────────────────────────────────────┐
│                          业务数字员工层 (Business Staff)                      │
│                                                                              │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐              │
│  │ DS-ECR-001      │  │ DS-VEN-001      │  │ DS-COST-001     │              │
│  │ ECR智能审核员    │  │ 供应商管家      │  │ 成本优化师      │              │
│  │                  │  │                  │  │                  │              │
│  │ 职责:            │  │ 职责:            │  │ 职责:            │              │
│  │ · 审核ECR变更   │  │ · 供应商质量分析 │  │ · BOM成本分析    │              │
│  │ · 风险评估      │  │ · 风险评估       │  │ · 降本建议       │              │
│  │ · 合规检查      │  │ · 改进建议       │  │ · 市场比价       │              │
│  │                  │  │                  │  │                  │              │
│  │ 调用:            │  │ 调用:            │  │ 调用:            │              │
│  │ · LLMBrain      │  │ · LLMBrain      │  │ · LLMBrain      │              │
│  │ · RuleEngine    │  │ · RuleEngine    │  │ · RuleEngine    │              │
│  │ · Identify      │  │ · Repair        │  │ · Optimize      │              │
│  │ · Validate      │  │ · Compare       │  │ · Compare       │              │
│  └────────┬────────┘  └────────┬────────┘  └────────┬────────┘              │
│           │                    │                    │                        │
│  ┌────────┴────────┐  ┌────────┴────────┐  ┌────────┴────────┐              │
│  │ DS-DATA-001     │  │ DS-SYS-001      │  │ DS-CONTENT-001  │              │
│  │ 数据书记员      │  │ 系统运维师      │  │ 内容生成师      │              │
│  │                  │  │                  │  │                  │              │
│  │ 职责:            │  │ 职责:            │  │ 职责:            │              │
│  │ · 数据录入/清洗 │  │ · 日志分析      │  │ · 报告生成      │              │
│  │ · 批量创建      │  │ · 性能监控      │  │ · 文档撰写      │              │
│  │ · 数据校验      │  │ · 自动修复      │  │ · 内容翻译      │              │
│  │                  │  │                  │  │                  │              │
│  │ 调用:            │  │ 调用:            │  │ 调用:            │              │
│  │ · Create        │  │ · Repair        │  │ · Generate      │              │
│  │ · Validate      │  │ · Identify      │  │ · Identify      │              │
│  │ · LLMBrain      │  │ · LLMBrain      │  │ · LLMBrain      │              │
│  └────────┬────────┘  └────────┬────────┘  └────────┬────────┘              │
│           │                    │                    │                        │
├───────────┼────────────────────┼────────────────────┼────────────────────────┤
│           ▼                    ▼                    ▼                        │
│  ┌─────────────────────────────────────────────────────────────────────┐    │
│  │                  基础数字员工能力层 (Foundation Capabilities)          │    │
│  │                                                                       │    │
│  │  ┌───────────────┐  ┌───────────────┐  ┌───────────────┐            │    │
│  │  │ 1. Identify   │  │ 2. Create     │  │ 3. Repair     │            │    │
│  │  │   识别能力     │  │   创建能力     │  │   修复能力     │            │    │
│  │  │                │  │                │  │                │            │    │
│  │  │ · 对象类型识别│  │ · 对象创建    │  │ · 数据修复    │            │    │
│  │  │ · 关键词匹配  │  │ · LLMGenerate     │  │ · 缺失值填充  │            │    │
│  │  │ · SCSAI查询    │  │ · 模板合并    │  │ · 格式修正    │            │    │
│  │  │ · 智能推荐    │  │ · 规则验证    │  │ · 规则校验    │            │    │
│  │  │                │  │ · SCSAI写入    │  │ · 批量修复    │            │    │
│  │  └───────┬───────┘  └───────┬───────┘  └───────┬───────┘            │    │
│  │          │                  │                  │                     │    │
│  │  ┌───────┴───────┐  ┌───────┴───────┐                                 │    │
│  │  │ 4. Optimize   │  │ 5. Compare    │  │ 6. Generate   │            │    │
│  │  │   优化能力     │  │   比对能力     │  │   生成能力     │            │    │
│  │  │                │  │                │  │                │            │    │
│  │  │ · 成本优化    │  │ · 数据比对    │  │ · 报告生成    │            │    │
│  │  │ · 质量改进    │  │ · 差异分析    │  │ · Content    │            │    │
│  │  │ · 流程优化    │  │ · 版本对比    │  │ · 代码生成    │            │    │
│  │  │ · 建议生成    │  │ · 供应商比较  │  │ · 翻译转换    │            │    │
│  │  └───────┬───────┘  └───────┬───────┘  └───────┬───────┘            │    │
│  │          │                  │                  │                     │    │
│  │          └──────────────────┼──────────────────┘                     │    │
│  │                             │                                        │    │
│  │              ┌──────────────┴──────────────┐                         │    │
│  │              │    UnifiedRuleEngine         │  ← 统一规则引擎        │    │
│  │              │    (server/core/rule-engine) │                         │    │
│  │              │                              │                         │    │
│  │              │  · 规则匹配 & 执行           │                         │    │
│  │              │  · 条件脚本 (JS)             │                         │    │
│  │              │  · 动作脚本 (JS)             │                         │    │
│  │              │  · 冲突策略                  │                         │    │
│  │              │  · 执行历史 & 统计           │                         │    │
│  │              └──────────────┬──────────────┘                         │    │
│  └─────────────────────────────┼─────────────────────────────────────────┘    │
│                                 │                                              │
├─────────────────────────────────┼──────────────────────────────────────────────┤
│                                 ▼                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐    │
│  │                     配置层 (Configuration)                            │    │
│  │                                                                       │    │
│  │  ┌──────────────────┐  ┌──────────────────┐  ┌──────────────────┐   │    │
│  │  │ Rules (规则)      │  │ Templates (模板)  │  │ Prompts (提示词)  │   │    │
│  │  │                   │  │                   │  │                   │   │    │
│  │  │ 存储:             │  │ 存储:             │  │ 存储:             │   │    │
│  │  │ sciot_rules_v2    │  │ sciot_templates   │  │ prompt_templates  │   │    │
│  │  │                   │  │                   │  │ sciot_prompts     │   │    │
│  │  │ 7个范围:          │  │ 定义:             │  │ sciot_business_   │   │    │
│  │  │ identify/create   │  │ · 对象属性结构   │  │ prompts           │   │    │
│  │  │ repair/optimize   │  │ · 字段默认值     │  │                   │   │    │
│  │  │ compare/validate  │  │ · 关系定义       │  │ 支持:             │   │    │
│  │  │ transform         │  │ · 验证规则       │  │ · 版本管理        │   │    │
│  │  │                   │  │                   │  │ · A/B测试         │   │    │
│  │  │ 来源:             │  │ 来源:             │  │ · 使用统计        │   │    │
│  │  │ · AML导入         │  │ · AML导入         │  │ · 规则关联        │   │    │
│  │  │ · SCSAI同步        │  │ · SCSAI同步        │  │                   │   │    │
│  │  │ · 手动创建        │  │ · 手动创建        │  │ 来源:             │   │    │
│  │  │ · 内置规则        │  │                   │  │ · 手动创建        │   │    │
│  │  └──────────────────┘  └──────────────────┘  └──────────────────┘   │    │
│  └─────────────────────────────────────────────────────────────────────┘    │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

数据源层 (External)
┌─────────────┐  ┌──────────────┐  ┌──────────────┐
│ SCSAI PLM    │  │ AML 定义文件  │  │ DeepSeek/GLM │
│ (实时查询)  │  │ (SCIOT/*.xml) │  │ (LLM 服务)   │
└──────┬──────┘  └──────┬───────┘  └──────┬───────┘
       │                │                 │
       └────────────────┼─────────────────┘
                        │
                        ▼
            ┌────────────────────┐
            │   BossAgents 系统   │
            └────────────────────┘

3. 配置层:规则、模板、提示词

3.1 数据库关系

sciot_rules_v2 (规则表)
├── id: 规则唯一标识
├── scope: 适用范围 (identify/create/repair/optimize/compare/validate/transform)
├── item_type_name: 目标对象类
├── severity: 严重程度 (error/warning/info/hint)
├── priority: 优先级 (P0/P1/P2/P3)
├── condition: 条件 JSON
├── condition_script: 自定义 JS 条件
├── action_type: 动作类型 (auto_fix/suggest/block/warn)
├── action_config: 动作配置 JSON
├── action_script: 自定义 JS 动作
├── prompt_template: 内联提示词 (向后兼容)
├── prompt_template_id ──────┐
├── conflict_strategy: 冲突策略 (first_match/merge/stop)
├── is_active: 是否启用
├── source: 来源 (builtin/manual/aml_import/SCSAI_sync)
└── tags: 标签数组

prompt_templates (提示词模板表)  ◄──── 关联
├── id: 模板唯一标识
├── name: 模板名称
├── version: 版本号
├── content: 提示词内容
├── scope: 适用能力
├── item_type_name: 目标对象类
├── parent_id: 父版本ID (A/B测试)
├── score: 评分
├── status: 状态 (active/archived/draft)
└── usage_count: 使用次数

sciot_templates (对象模板表)
├── id: 模板ID
├── item_type_name: 对象类名
├── properties: 属性定义 JSON
├── defaults: 默认值 JSON
├── relationships: 关系定义 JSON
└── generation_rules: 生成规则 JSON

sciot_rule_history (规则执行历史)
├── rule_id → sciot_rules_v2.id
├── scope: 执行范围
├── item_type: 对象类型
├── item_id: 对象ID
├── action: 执行动作
├── result: 执行结果
├── llm_called: 是否调用LLM
└── duration_ms: 执行耗时

3.2 规则的生命周期

Create → 激活 → 执行 → 统计 → Optimize/废弃
  │      │      │      │        │
  ▼      ▼      ▼      ▼        ▼
AML导入  API   RuleEngine  hit_count  禁用
SCSAI同步 启用/禁用  execute()  avg_duration 版本升级
手动创建         _recordHistory()  user_correction_count

4. 基础数字员工能力层

4.1 六大基础能力

| 能力 | Scope | 前端入口 | 核心流程 |

|------|-------|---------|---------|

| Identify | identify | StaffCapabilities → Identify Tab | Keyword Matching → SCSAI Query → LLM Intelligent Recommendation → Rule Engine Validation |

| Create | create | StaffCapabilities → Create Tab | LLM Generation → Rule Engine Validation (6.5 Steps) → Template Merging → SCSAI Write |

| Repair | repair | StaffCapabilities → Repair Tab | Data Diagnosis → Rule Matching → Automatic/Manual Repair → Result Verification |

| Optimize | optimize | StaffCapabilities → Optimize Tab | Data Analysis → Rule Engine → LLM Suggestions → Solution Generation |

| Compare | compare | StaffCapabilities → Compare Tab | Data Extraction → Difference Calculation → Rule Evaluation → Result Reporting |

| Generate | transform | StaffCapabilities → Generate Tab | Context Construction → Rule Guidance → LLM Generation → Format Validation |

4.2 Capability Implementation Files

FileResponsibility
server/core/rule-engine.js (1962 lines)Unified rule engine core, execution logic for 7 scopes
server/core/unified-schema.jsUnified Schema builder, merges SCSAI data and local definitions
server/aml-assembly-engine.jsAML Assembly Engine, LLM output → Template merging → Rule validation → SCSAI writing
server/routes/rule-engine.jsRule Engine API routes
server/utils/SCSAI-tools.jsSCSAI API tools, real-time data querying
src/views/StaffCapabilities.vue (3618 lines)Frontend six-capability interaction interface
src/views/RulesAndTemplates.vueFrontend rules/templates/prompts management interface

4.3 Rule Engine Execution Flow

1. 接收请求 (scope, context, options)
        │
2. 获取适用规则 (按 scope + item_type 过滤)
        │
3. 按优先级排序 (P0 > P1 > P2 > P3)
        │
4. 逐条执行规则:
   ├── _evaluateCondition(): 评估条件
   │   ├── 标准条件: field + operator + value
   │   ├── condition_script: 自定义JS函数
   │   └── LLM条件: 调用LLM判断
   │
   ├── _executeAction(): 执行动作
   │   ├── auto_fix: 自动修复
   │   ├── suggest: 生成建议
   │   ├── block: 阻断并返回错误
   │   └── warn: 警告但继续
   │
   ├── 冲突策略判断:
   │   ├── first_match: 首条匹配即停止
   │   ├── merge: 合并所有结果
   │   └── stop: 匹配后停止
   │
   ├── _recordHistory(): 记录执行历史
   └── _updateRuleStats(): 更新统计
        │
5. 返回执行结果

5. 业务数字员工层

5.1 六大业务数字员工

| ID | 名称 | 触发方式 | 核心调用 |

|----|------|---------|---------|

| DS-ECR-001 | ECR Intelligent Reviewer | Cron / API | LLMBrain.reviewEcrIntelligently() → RuleEngine(validate) |

| DS-VEN-001 | Vendor Steward | Cron / API | LLMBrain.analyzeVendorIntelligently() → RuleEngine(repair) |

| DS-COST-001 | Cost Optimizer | Cron / API | LLMBrain.optimizeBomCostIntelligently() → RuleEngine(optimize) |

| DS-DATA-001 | Data Clerk | Cron / API | Create capability → RuleEngine(create) → SCSAI write |

| DS-SYS-001 | System Operations Engineer | Cron / Event | Repair capability → RuleEngine(repair) → Auto-repair |

| DS-CONTENT-001 | Content Generator | API | Generate capability → LLMBrain → RuleEngine(validate) |

5.2 Business Digital Staff Implementation Files

FileResponsibility
server/digital-staff/index.js (1745 lines)Digital Staff Dispatcher, Cron scheduled task management
server/digital-staff/llm-brain.js (684 lines)LLM Brain, 6 business methods + rule engine integration
server/digital-staff/staff-manager.js (426 lines)Digital Staff Configuration Management, loadRulesAndPrompts()

5.3 LLMBrain Call Chain

业务数字员工 (Cron触发)
        │
        ▼
LLMBrain.xxxIntelligently(data)
        │
        ├── 1. _loadPromptFromRuleEngine(scope, context)
        │       ├── 获取适用规则 (按scope+item_type)
        │       ├── 取优先级最高的规则
        │       ├── 通过 prompt_template_id 加载模板
        │       ├── 或使用内联 prompt_template
        │       └── _interpolatePrompt() 变量替换
        │
        ├── 2. 如果规则引擎有提示词 → 使用规则引擎提示词
        │    如果规则引擎无提示词 → 使用硬编码fallback
        │
        ├── 3. this.thinkJson(systemPrompt, userMessage)
        │       └── OpenAI兼容API调用
        │
        └── 4. 返回结构化JSON结果

6. 核心调用链路

6.1 ECR审核完整链路

Cron触发 / API调用
        │
        ▼
DS-ECR-001: ECR智能审核员
        │
        ├── 1. 从SCSAI获取ECR数据 (SCSAI-tools.js)
        │
        ├── 2. LLMBrain.reviewEcrIntelligently(ecr)
        │       ├── _loadPromptFromRuleEngine('validate', {item_type:'ECR'})
        │       │     └── 从sciot_rules_v2获取ECR审核规则
        │       │     └── 从prompt_templates加载提示词
        │       │
        │       └── thinkJson(systemPrompt, userMessage)
        │             └── DeepSeek/OpenAI API
        │
        ├── 3. 规则引擎验证审核结果
        │       └── execute('validate', context)
        │
        └── 4. 返回审核决策 (approve/reject/escalate)

6.2 供应商分析完整链路

Cron触发
        │
        ▼
DS-VEN-001: 供应商管家
        │
        ├── 1. 从SCSAI获取供应商数据
        │
        ├── 2. LLMBrain.analyzeVendorIntelligently(vendor)
        │       ├── _loadPromptFromRuleEngine('repair', {item_type:'Vendor'})
        │       │     └── 获取供应商质量分析规则和提示词
        │       │
        │       └── thinkJson(systemPrompt, userMessage)
        │
        ├── 3. 规则引擎评估风险
        │       └── execute('repair', context)
        │
        └── 4. 生成改进建议报告

6.3 前端创建对象完整链路

StaffCapabilities.vue: runCreate()
        │
        ├── 1. 用户输入描述文本
        │
        ├── 2. LLM生成结构化数据
        │       └── fetch('/api/llm/chat')
        │
        ├── 3. 解析LLM输出为字段值
        │
        ├── 4. 加载模板 (sciot_templates)
        │       └── 获取属性定义、默认值
        │
        ├── 5. 模板合并
        │       └── LLM字段 + 模板默认值
        │
        ├── 6. 规则引擎验证 ← NEW (v2.0)
        │       └── POST /api/rule-engine/execute/create
        │       └── 检查 blocked → 拦截
        │       └── 收集 warnings/suggestions
        │
        ├── 7. 系统字段补全 (created_by, created_on, id...)
        │
        ├── 8. 生成标准AML格式
        │
        └── 9. SCSAI写入
                └── fetch('/api/SCSAI/write')

7. 数据流全景

┌──────────────────────────────────────────────────────────────────────┐
│                           数据流方向                                   │
│                                                                       │
│  SCSAI PLM ◄──────── write ──────────┐                                │
│     │                                │                                │
│     │ read (实时查询)                │                                │
│     ▼                                │                                │
│  ┌─────────────────┐                 │                                │
│  │ unified-schema  │                 │                                │
│  │ (合并SCSAI+本地) │                 │                                │
│  └────────┬────────┘                 │                                │
│           │                          │                                │
│           ▼                          │                                │
│  ┌─────────────────┐                 │                                │
│  │   LLM Brain     │                 │                                │
│  │ (智能分析)       │                │                                │
│  └────────┬────────┘                 │                                │
│           │                          │                                │
│           ▼                          │                                │
│  ┌─────────────────┐     ┌───────────┴────────┐                      │
│  │  Rule Engine    │────▶│ AML Assembly Engine │                      │
│  │ (规则验证)       │     │ (模板合并+格式转换)  │                      │
│  └────────┬────────┘     └──────────┬─────────┘                      │
│           │                         │                                 │
│           │          ┌──────────────┘                                 │
│           │          │                                                │
│           ▼          ▼                                                │
│  ┌─────────────────────────────┐                                     │
│  │      sciot_import.db        │                                     │
│  │  ┌───────────┐ ┌──────────┐ │                                     │
│  │  │ rules_v2  │ │templates │ │                                     │
│  │  ├───────────┤ ├──────────┤ │                                     │
│  │  │ prompts   │ │ history  │ │                                     │
│  │  └───────────┘ └──────────┘ │                                     │
│  └─────────────────────────────┘                                     │
│                                                                       │
│  SCIOT/*.xml ──── import ────▶ sciot_import.db                       │
│  (AML定义文件)                  (规则/模板/提示词)                     │
│                                                                       │
└──────────────────────────────────────────────────────────────────────┘

8. 文件结构与职责

bossagents/
├── server.js                          # 主服务器 (路由分发、LLM代理)
│
├── server/
│   ├── core/
│   │   ├── rule-engine.js             # ★ 统一规则引擎 (1962行)
│   │   │   - UnifiedRuleEngine类
│   │   │   - 7个scope的规则执行
│   │   │   - 条件/动作脚本引擎
│   │   │   - 冲突策略、缓存、统计
│   │   │
│   │   └── unified-schema.js          # ★ 统一Schema构建器
│   │       - 合并SCSAI实时数据+本地定义
│   │       - 字段分类(LLM/Auto/System)
│   │       - 生成结构化提示词
│   │
│   ├── digital-staff/
│   │   ├── index.js                   # ★ 数字员工调度器 (1745行)
│   │   │   - Cron定时任务
│   │   │   - 6个业务数字员工注册
│   │   │
│   │   ├── llm-brain.js              # ★ LLM大脑 (684行)
│   │   │   - LLMBrain类
│   │   │   - 6个业务分析方法
│   │   │   - 规则引擎集成 (v2.0)
│   │   │
│   │   └── staff-manager.js          # ★ 数字员工配置管理
│   │       - loadRulesAndPrompts()
│   │       - Digital StaffCRUD
│   │
│   ├── routes/
│   │   ├── rule-engine.js            # 规则引擎API路由
│   │   └── aml.js                    # AML相关API路由
│   │
│   ├── utils/
│   │   └── SCSAI-tools.js             # SCSAI API工具
│   │
│   ├── aml-assembly-engine.js        # AML装配引擎
│   │   - LLM输出→模板合并→规则验证→SCSAI写入
│   │
│   ├── sqlite-compat.js              # SQLite兼容层
│   │
│   └── data/
│       ├── sciot_import.db           # 主数据库 (规则/模板/提示词)
│       └── boss_tenants.db           # 租户数据库
│
├── src/                              # 前端Vue源码
│   ├── views/
│   │   ├── StaffCapabilities.vue     # ★ 基础能力界面 (3618行)
│   │   │   - 6大能力Tab
│   │   │   - runIdentify/runCreate/runRepair...
│   │   │   - 规则引擎API集成 (v2.0)
│   │   │
│   │   └── RulesAndTemplates.vue     # ★ 规则管理界面
│   │       - 规则CRUD编辑器
│   │       - 模板管理
│   │       - 提示词管理
│   │
│   └── utils/
│       └── SCSAI.js                   # SCSAI前端工具
│
├── docs/
│   ├── architecture-overview.md      # ★ 本文档:总体架构
│   └── rules-templates-prompts-system.md  # 规则/模板/提示词详细文档
│
├── SCIOT/                            # AML定义文件 (647个XML)
├── scripts/                          # 工具脚本
├── dist/                             # 前端构建产物
└── _release/                         # 发布目录

9. API 路由汇总

9.1 规则引擎 API

| 方法 | 路径 | 说明 |

|------|------|------|

| GET | /api/rule-engine/rules | Get rule list |

| GET | /api/rule-engine/rules/:id | Get a single rule |

| POST | /api/rule-engine/rules | Create a rule |

| PUT | /api/rule-engine/rules/:id | Update a rule |

| DELETE | /api/rule-engine/rules/:id | Delete a rule |

| POST | /api/rule-engine/rules/batch-toggle | Batch enable/disable |

| POST | /api/rule-engine/rules/batch-delete | Batch delete |

| POST | /api/rule-engine/execute/:scope | Execute rules (scope=identify/create/repair/optimize/compare/validate) |

| POST | /api/rule-engine/identify | Identify Execution (Convenience Interface) |

| POST | /api/rule-engine/execute/create | Create Verification Execution |

| POST | /api/rule-engine/import/aml | Import Rules from AML |

| POST | /api/rule-engine/import/json | Import Rules from JSON |

| POST | /api/rule-engine/sync/SCSAI | Sync Rules from SCSAI |

| POST | /api/rule-engine/export/json | Export Rules as JSON |

| GET | /api/rule-engine/stats | Rule Statistics |

| GET | /api/rule-engine/history | Execution History |

| GET | /api/rule-engine/prompt-templates | Prompt Template List |

| POST | /api/rule-engine/cache/clear | Clear Cache |

| GET | /api/rule-engine/cache/stats | Cache Statistics |

| GET | /api/rule-engine/scopes | Rule Scope Definitions |

9.2 Digital Staff API

MethodPathDescription
GET/api/digital-staff/listDigital Staff List
POST/api/digital-staff/triggerManually Trigger Digital Staff
GET/api/digital-staff/logsDigital Staff Execution Logs
GET/api/digital-staff/configDigital Staff Configuration

9.3 Basic Capability APIs

MethodPathDescription
POST/api/llm/chatLLM Chat Agent
POST/api/aml/assembleAML Assembly Execution
POST/api/aml/sciot/typesGet Object Type List
POST/api/SCSAI/querySCSAI Data Query
POST/api/SCSAI/writeSCSAI Data Write

10. Implementation Status and Optimization Roadmap

10.1 Completed (v2.0)

ModuleStatusDescription
Rule Engine Core✅ CompletedUnifiedRuleEngine, 7 scopes, conflict strategy, caching
Database Schema✅ Completedsciot_rules_v2, prompt_templates, sciot_rule_history
Rule Engine APIs✅ CompletedCRUD + execution + import/export + statistics
Front-end Rule Editor✅ Completedcondition_script, action_script, prompt_template_id, conflict_strategy
Front-end Capability Interface✅ CompletedrunIdentify calls rule engine, runCreate adds validation step
server.js DB Connection✅ CompletedRule engine API passes actual DB connection
LLMBrain Refactoring✅ Completed6 business methods load prompts from rule engine, hardcoded as fallback
Overall Architecture Document✅ CompletedThis document

10.2 To Be Optimized (P0-P3)

PriorityModuleOptimization Content
P0staff-manager.jsloadRulesAndPrompts() actually integrates into rule engine execution flow
P0digital-staff/index.jsPass rule context when Cron tasks trigger
P1Front-end Rule ListDisplay conflict_strategy, prompt_template_id columns
P1A/B TestingOperationalize parent_id/score in prompt_templates
P2Rule Health CheckAutomatically detect invalid rules, statistics on abnormal rules
P2Batch ExecutionOptimize rule engine batch execution
P3Rule MarketplaceRule sharing/import community templates
P3Rule VisualizationRule dependency graph, execution flow chart

10.3 Architecture Evolution Direction

当前 (v2.0)                     未来 (v3.0)
─────────────                    ─────────────
硬编码 fallback           →     全部从规则引擎加载
单一 LLM 提供者            →     多 LLM 提供者路由
本地 SQLite               →     分布式缓存 + 主从
手动 Cron                 →     事件驱动 + 工作流
单机部署                  →     微服务 + 消息队列

附录:关键术语

| 术语 | 英文 | 说明 |

|------|------|------|

| Rule | Rule | Deterministic judgment logic, containing conditions and actions |

| Template | Template | Object data structure definition, containing attributes and default values |

| Prompt | Prompt | LLM interaction protocol, defining AI's role and output format |

| Foundation Capability | Foundation Capability | 6 atomic operations: identify/create/repair/optimize/compare/generate |

| Business Digital Staff | Business Staff | AI agent for specific business scenarios, invoking foundation capabilities |

| Rule Engine | Rule Engine | Unified rule execution core, managing the matching and execution of all rules |

| AML | SCSAI Markup Language | XML definition format for the SCSAI PLM system |

| SCSAI | SCSAI Agent | Enterprise PLM platform |

| SCIOT | - | AML definition file directory, containing object class definitions |

| Scope | Rule Scope | Operation types to which the rule applies (identify/create/repair/optimize/compare/validate/transform) |

| Conflict Strategy | Conflict Strategy | Handling method when multiple rules are triggered (first_match/merge/stop) |

← 返回案例列表

Try 左帮右臂 Industrial Agent — your digital workforce

Available as a WeChat mini program, web app (ylxt.chat) and desktop client. Start from whichever fits your workflow.

🌐 Web App 💻 Desktop Download 📞 Call 189-8606-6876
WeChat mini program QR
Scan for the WeChat mini program
Share:
🤖 Try Now →
🤖
🎁