Left and Right Arms: An Open Object Operating System with Closed-Loop Linkage…

Left and Right Arms: An Open Object Operating System with Closed-Loop Linkage of Six Capabilities

Core Concept

The six capabilities (Identify, Create, Repair, Optimize, Compare, Generate) are not isolated actions but an end-to-end closed loop:

User says 'Create a part similar to a motor' -> Identify intent -> Retrieve dual databases -> Match and decide -> Create/Reuse -> Repair and complete -> Provide optimization suggestions -> Compare differences -> Generate output

Existing Code Base (Already Implemented)

ComponentFile PathExisting Capabilities
UnifiedRuleEngineserver/core/rule-engine.js (1473 lines)9-scope rule execution, rule CRUD, multi-level caching, rule factory pattern, _injectTypeContext auto-injection of property metadata
CapabilityRuntimeserver/core/capability-runtime.js (528 lines)Six-capability SDK encapsulation (identify/validate/repair/optimize/compare/generate), rule engine -> LLM fallback strategy
IntentEngineserver/core/intent-engine.js (744 lines)Intent recognition, natural language -> capability routing
Dual SQLite Databasesdatabase1.js + sciot_import.dbcore_runtime.db (enterprise private database, read/write) + sciot_import.db (standard library, 13,000+ industrial object definitions)
Frontend Object Creationsrc/composables/useCapabilityCreate.js (1761 lines)Full SCSAI object creation pipeline, metadata-driven filtering, extractItemId nested ID resolution, fallback pre-creation
PromptBuildersrc/utils/PromptBuilder.js (line 573)Metadata evaluator for shouldIncludeInPrompt, generation_rules priority strategy
sciot_rules_v2 tablerule-engine.js:241Safe execution of condition_script/action_script (vm sandbox), hit_count/user_correction_count statistics
sciot_rule_history tablerule-engine.js:264Rule execution history, duration_ms, llm_called, user_corrected flags

Task 1: Six-Capability Closed-Loop Workflow — Intelligent Object Creation and Reuse Based on Dual SQLite Databases

1.0 Roles and Responsibilities of the Dual SQLite Databases

| Database | File | Access Permissions | Purpose |

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

| Standard Library | server/data/sciot_import.db | Read-only | 13,000+ industrial object definitions, generic rules, attribute metadata, sequence configurations |

| Enterprise Private Library | server/data/core_runtime.db | Read-write | Enterprise-customized objects, rules, workflows, correction records, audit logs |

Replication mechanism: When copying from the standard library to the private library, record source = 'standard'. Subsequent enterprise modifications to the copy do not affect the standard library.

1.1 End-to-End Closed-Loop Process (Identify -> Retrieve -> Match -> Decide -> Create/Reuse -> Repair/Optimize -> Compare -> Generate)

Step 1: Identify Intent and Object Features (IntentEngine + Rule Engine)

Input: "Create a part similar to a motor, model M-123, power 5.5kW"

IntentEngine (intent-engine.js) extracts:

  • intent: create
  • item_type: Part
  • features: {name: "motor", model: "M-123", power: 5.5}

Rule engine takes priority, LLM as fallback.

Step 2: Retrieve Private Library (core_runtime.db) — Rule Engine Deterministic Matching

Add step 10 in _injectTypeContext(): Query existing objects in the private library.

// 10. 双库查重:先私有库后标准库
const privateDb = require('../database1').getDatabase();
const standardDb = compat.createDatabase(path.join(__dirname, '..', 'data', 'sciot_import.db'));

// 精确匹配(唯一键)
const kf = context._keyedField;
if (kf && properties[kf]) {
  // 先查私有库
  const privateExisting = privateDb.prepare(
    `SELECT id, name, ${kf} FROM sciot_objects WHERE item_type = ? AND ${kf} = ?`
  ).all(itemType, properties[kf]);
  if (privateExisting.length > 0) {
    context._matchResult = { source: 'private', action: 'reference', items: privateExisting };
  } else {
    // 再查标准库
    const stdExisting = standardDb.prepare(
      `SELECT * FROM sciot_properties WHERE item_type_name = ?`
    ).all(itemType);
    // ... 匹配逻辑
  }
}

// 模糊匹配(加权相似度)
if (!context._matchResult) {
  const similarityRule = { fields: ['name','specification','description'], weights: [0.5,0.3,0.2], threshold: 0.85 };
  // 规则引擎计算相似度
}

新增规则 builtin-create-pre-dedup(在 _loadBuiltinRules() 中):

{
  id: 'builtin-create-pre-dedup', scope: RULE_SCOPES.CREATE_PRE,
  action_script: `
    var match = context._matchResult;
    if (!match) return {modified: false};
    if (match.action === 'reference') return { action: 'reference', existing_id: match.items[0].id, message: '私有库已存在: ' + match.items[0].name };
    if (match.action === 'copy') return { action: 'copy', source_id: match.items[0].id, source: match.source, message: match.source === 'standard' ? '标准库中找到模板,复制到私有库' : '私有库中找到相似对象' };
    return {modified: false};
  `
}

Step 3: 检索标准库(sciot_import.db 只读)

If no match in private library, query the standard library. The standard library contains 13000+ industrial object definitions (sciot_properties, sciot_templates).

Query strategy: Same exact/fuzzy matching as with private library, but results are tagged with source: 'standard'.

Step 4: Decision Engine

| Scenario | Action | Rule Engine Return Value |

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

| Exact match in private library | Directly reference existing object | {action: 'reference', existing_id: 'xxx'} |

| Fuzzy match in private library (similarity >= 0.85) | Suggest similar objects, user selects to copy and modify | {action: 'suggest', candidates: [...]} |

| Standard Library Match | Copy standard library object to private library | {action: 'copy', source: 'standard', template_id: 'xxx'} |

| No Match Found | Call LLM to generate new object definition | {action: 'create'} |

Step 5: Create/Reuse (useCapabilityCreate.js)

  • Reference: Return existing object ID, no modifications
  • Copy & Modify: Copy attribute structure from a similar object or standard library template, allowing user to modify specific fields
  • Create New: Call creation node to insert a new object in the private library based on the definition generated by LLM

Step 6: Repair & Optimize (CapabilityRuntime.repair + optimize)

  • Repair Node: Rule engine automatically completes mandatory fields (e.g., generate material code based on sciot_sequences)
  • Optimize Node: Provide improvement suggestions (e.g., 'Cost can be optimized by 10%')

Step 7: Compare (CapabilityRuntime.compare)

After creation, automatically compare with historical versions or standard library templates, output a difference report.

Step 8: Generate (CapabilityRuntime.generate)

Generate object instance + natural language summary: 'Created part motor M-123, number PART-20260612-001'

1.2 Rule Engine and LLM Division of Labor

TaskExecutorReason
Exact Match (Unique Key)Rule EngineDeterministic logic, millisecond response
Similarity Calculation (Weighted Formula)Rule EngineConfigurable weights, adjustable by enterprises
Fuzzy Semantic Understanding ("similar motor")LLMRequires understanding the meaning of "similar"
Generate New Object DefinitionsLLMCreative work
Repair/Optimization SuggestionsRule Engine + LLMRule engine handles deterministic completion, LLM generates suggestion text

Task 2: Bidirectional Conversion Between Object Classes and n8n Workflows

2.1 Object Class -> n8n Node (Existing Foundation)

SCSAI-related nodes already exist in packages/@n8n/nodes-langchain/nodes/. Requirements:

  1. Add a new method exportAsN8nNode(itemType) in server/core/rule-engine.js:
  • Generate node's input parameters from sciot_properties
  • Generate node's execute logic from sciot_rules_v2
  • Generate item_properties processing chain from generation_rules
  1. Output format is standard n8n node description JSON (refer to SCSAIAI.node.json)

2.2 n8n Workflow -> Object Class (Reverse Export)

Add new server/core/workflow-to-schema.js:

  • Parse n8n workflow JSON
  • Extract input parameters from trigger node -> object properties
  • Extract transformation logic from action nodes -> rule scripts
  • Generate sciot_templates + sciot_properties + sciot_rules_v2 insert statements

2.3 Dynamic Node Registration

Utilize n8n's community node mechanism:

  • Generate standard n8n community node packages in the deploy/ directory
  • Dynamically register via npm install
  • Automatically generate and install corresponding nodes when adding new object classes

Task 3: Rule Self-Evolution Loop

3.1 User Correction Collection (Existing Infrastructure)

The sciot_rule_history table already has a user_corrected field (line 291). Requirements:

  1. Add a reportCorrection(ruleId, originalOutput, correctedOutput) method to each capability method in CapabilityRuntime
  2. Store to sciot_rule_history.user_corrected = 1 + add a new sciot_corrections table:
CREATE TABLE sciot_corrections (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  rule_id TEXT,
  item_type TEXT,
  scope TEXT,
  original_output TEXT,  -- JSON
  corrected_output TEXT,  -- JSON
  diff_summary TEXT,      -- LLM 生成的差异摘要
  pattern_detected TEXT,  -- 大模型识别的修正模式
  created_at TEXT DEFAULT (datetime('now','localtime'))
);

3.2 规则建议生成(大模型驱动)

新增 server/core/rule-evolution.js:

class RuleEvolution {
  // 定期分析 corrections 表,生成规则候选
  async analyzeCorrections(itemType, threshold = 5) {
    // 1. 查询 user_corrected=1 的记录(>= threshold 条)
    // 2. 用大模型总结修正模式
    // 3. Generate condition_script + action_script
    // 4. 存入 sciot_rule_candidates 表(待审批)
  }
  
  // 审批后激活规则
  async approveRule(candidateId) {
    // 从 candidates 表移入 sciot_rules_v2 表
    // 清除规则缓存
  }
}

3.3 规则效能监控

利用已有的 sciot_rules_v2.hit_count + avg_duration_ms + user_correction_count 字段:

  • Automatic Downgrade: Rules where user_correction_count / hit_count > 0.3 are automatically marked as is_active = 0
  • Optimization Recommendation: For rules with high hit_count but also high avg_duration_ms, suggest replacing LLM with deterministic scripts

Task 4: User Open Tools

4.1 Object Modeling Agent (Conversational Table Creation)

Add server/core/object-modeler.js:

class ObjectModeler {
  // 自然语言 -> JSON Schema
  async defineObject(naturalLanguageDesc) {
    // 1. LLM 解析自然语言为字段列表
    // 2. 推断数据类型(string/integer/list/item)
    // 3. 推断约束(required/unique/length)
    // 4. Generate sciot_properties 插入语句
    // 5. Generate sciot_templates 插入语句
    // 6. Generate generation_rules(item_properties、default_permission)
    // 7. 用户确认后执行插入
  }
}

4.2 规则可视化编辑器

前端新增 src/views/RuleEditor.vue:

  • Condition Builder: [Field] [Operator] [Value] dropdown selection
  • Action Builder: [Set Field] [To Value] / [Send Notification] / [Call LLM]
  • Advanced Mode: Directly edit condition_script / action_script
  • Call the saveRule() method of rule-engine.js via the /api/rules API

4.3 Workflow Orchestration

Utilize existing n8n integration (start-n8n-mysql.bat starts the full n8n instance):

  • Encapsulate BossAgents' six capabilities as n8n custom nodes
  • Each node internally calls the corresponding method of CapabilityRuntime
  • Users can drag, connect nodes to orchestrate cross-system workflows

Implement priority ranking

PriorityTaskEffortImpact
P0Task 1.1 Dual-DB Retrieval + Decision Engine3 daysResolve duplicate creation, enable intelligent reuse
P0Task 3.1 Correction Collection1 dayFoundation for self-evolution closed loop
P1Task 1.2 Copy-Modify Process2 daysObject reuse capability
P1Task 3.2 Rule Suggestions2 daysCore of self-evolution
P2Task 4.1 Object Modeling3 daysUser self-service extension
P2Task 2.1 Object -> Node2 daysWorkflow visualization
P3Task 4.2 Rule Editor3 daysUser-defined rules
P3Task 2.2 Workflow -> Object2 daysProcess as object

PPT Architecture Diagram (based on actual code)

[用户层]
  对象建模智能体 ── ObjectModeler.defineObject()
  规则可视化编辑器 ── RuleEditor.vue -> /api/rules
  n8n工作流画布 ── CapabilityRuntime 6能力节点

[核心引擎层]
  IntentEngine (意图识别) -> UnifiedRuleEngine (9 scope)
  CapabilityRuntime (6能力闭环联动)
  RuleEvolution (自进化) -> sciot_corrections (修正库)

[双SQLite数据层]
  sciot_import.db (标准库,只读,13000+工业对象)     core_runtime.db (企业私有库,可读写)
  sciot_properties (属性元数据)                     sciot_objects (企业对象实例)
  sciot_templates (对象模板)                         sciot_rules_v2 (企业自定义规则)
  sciot_sequences (编号序列)                        sciot_corrections (修正记录)

示例演示:Create「电机M-123」

用户输入:「创建一个类似电机的零件,型号M-123,功率5.5kW」

Execution Process:

  1. Recognition: Rule engine extracts type=Part, name=motor, model=M-123, power=5.5, intent=create
  2. Private Library Retrieval: Exact match for model='M-123' yields no results; fuzzy match for name like '%motor%' returns 'Motor M-100' (similarity 0.78), below threshold 0.85
  3. Standard library search: Found 'Motor Template' (similarity 0.72). System prompts: 'Motor template found in standard library. Copy and modify?'
  4. User confirms 'Yes'.
  5. Copy to private library: Copy the Part object definition from the standard library and generate a new object.
  6. Fix: Rule engine checks for missing required field 'Material Number' and auto-generates 'PART-20260612-001'.
  7. Optimize: Checks for empty cost field and prompts: 'Suggest adding cost information.'
  8. Compare: Compares with the standard library template and outputs a difference report.
  9. Generate: Returns object ID: 'Part Motor M-123 created, number PART-20260612-001'.

Speech script suggestion

'Judges, our six core capabilities are not isolated. Take object creation as an example—when a user says "create a part similar to a motor," the system doesn't blindly create a new one. It first searches the private library for existing items, then looks for templates in the standard library.

Our foundation is a dual SQLite database design: the standard library contains over 13,000 industrial object definitions, serving as the shared knowledge base for all enterprises; the private library hosts each enterprise's own objects, rules, and modification records.

If a similar item is found, the system recommends the user copy and modify it. This avoids data redundancy while fully leveraging the industrial knowledge in the standard library. Throughout the process, the rule engine and models work in synergy, making the user feel assisted by a business-savvy assistant.

More crucially, there's a self-evolution closed loop: every manual correction by the user is recorded by the system. When a certain number of similar corrections accumulate, the system automatically generates new rule candidates. Once confirmed by the administrator, the rules take effect immediately. This means the system grows smarter with use.

This is the ultimate form of an industrial agent—empowering every enterprise with its own, evolving team of AI employees.'

Through this mechanism, Zuobang Youbi enables efficient creation and reuse of any object, aligning with real-world enterprise workflows and demonstrating the platform's intelligence and openness.

← 返回案例列表

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 →
🤖
🎁