Main Chain Unification — Optimization Implementation Record v1 (2026-07-06)
This document is the hands-on implementation record for Architectural Analysis and Main Chain Unification Plan_v1.md.
Status Grading: ✅ Implemented / ? Partially Implemented (Security Shell) / ⏳ Pending P1 / ❌ Not Done
I. P0-2 LLM Single Entry Point —— ✅ Completed
New Files
server/digital-staff/smart-llm-bridge.js
- Wraps the implemented SmartLLMRouter (multi-level fallback chain) into an LLMBrain-compatible interface.
- Exposes getSmartBrain(), returning a bridge instance containing chat / think / thinkJson / simulatedThinking.
- Automatically falls back to LLMBrain.getGlobalInstance() on failure, zero breaking changes.
Modified Files (Consolidating Direct Call Points)
| File | Before Change | After Change | Verification |
|---|---|---|---|
| server/routes/aml.js ×8 | new LLMBrain() | getSmartBrain() | node --check OK |
| server/core/health-patrol.js | new LLMBrain() | getSmartBrain() | node --check OK |
| server/core/object-modeler.js | new LLMBrain() | getSmartBrain() | node --check OK |
Residual (P1, not bare call)
- conversation-engine.js:78 / procurement-workflow-v3.js:16: Injected construction parameters for CapabilityRuntime are already within the unified path.
- llm-brain.js / test-llm-intent.js: Definitions and tests, ignore.
Effect
All "bare LLM calls bypassing SmartLLMRouter" have been unified → single metrics export: SmartLLMRouter.stats.
II. P0-3 Create Main Path Unified —— ? Safety shell installed.
Modified Files
server/routes/unified-create.js
- Insert a "Rule Pre-check Hook" after obtaining the SCSAI connection in handleCreate and before Step 1.
- Switch: Activated only when process.env.ENABLE_RULE_PRECHECK === 'true', default off (escape valve).
- When active, call /api/rule-engine/precheck from rule-engine. If duplicate is returned, block with 409; otherwise, only record ruleHits for audit.
- Any caught exceptions are skipped and do not block; existing direct connection behavior remains completely unchanged.
Honest Declaration ⏳
- /api/rule-engine/precheck (dual-database deduplication + writing hits to sciot_rule_hits) is not yet implemented in rule-engine.js.
- Belongs to P1 "Open Object OS Main Chain" scope; no fabrication of functionality this time.
- When the switch is turned on: no crash, no blocking, only takes the 'skip' branch because rule-engine has no precheck branch.
Supporting changes (frontend)
- Tested src/composables/useCapabilityCreate.js + useCreate.js: buildAML() → bomService._SCSAIApiRequest('ApplyItem', mainAml) directly connects to SCSAI.
- Frontend consolidation (changed to first call /api/rule-engine/create-post then applyAML) is P1, requires frontend-backend joint debugging, not modified this time.
III. P0-1 Employee count drift (12 vs 27) — ⏳ Document conclusion + deferred to P1
Confirmed
- Actual ID in local.yaml = 30 (including 3 LLM platform placeholders + auto-rotating employees)
- Actual business employees: 27, enabled:false only 3
- Plan document primarily promotes 12
Solution (to be implemented in P1)
- Add tier: standard|enterprise field to local.yaml
- Main narrative uses only 12 standard; the remaining 15 are downgraded to enterprise/internal profile.
- Scheduler loading filters by tier (requires modifying boss-scheduler loader).
IV. P0-4 'Five Dimensions' name-reality mismatch — ✅ Clarified at documentation level.
Confirmed
- In code, 'Five Dimensions' = data health check five-dimensional scoring: completeness/accuracy/timeliness/availability/security.
- Plan document conflates 'Five-Dimensional Object Marketplace' with 'Five-Dimensional Health Check' using the same term.
Solution
- Code side: Keep the "Five-Dimensional Scoring" naming unchanged (already a demonstrable capability)
- Proposal side: Rename "Five-Dimensional Object Trading Market" to "Six-Category Object Trading Market"
(Data / Model / Rule / Skill / Workflow / Digital Employee)
- To avoid naming conflicts in due diligence (no code changes required)
V. Uncompleted Items (Recorded explicitly to prevent AI from misreporting as completed)
| Item | Status | Reason |
|---|---|---|
| Frontend Create to use rule engine | ❌ | Requires frontend-backend integration, P1 |
| rule-engine precheck deduplication across dual databases | ❌ | Belongs to P1 open object OS main chain |
| Migrating 12 Workers to CapabilityRuntime | ❌ | P1 |
| Merging dual databases | ❌ | P1 |
| Cleaning up legacy index.js | ❌ | P1 |
| Implementation/Deletion of mtclaw leftarm handler | ❌ | P1 |
| Integrating self-evolution into main path | ❌ | P1 |
| Completing tests | ❌ | P2 |
| Multi-tenant isolation | ❌ | P2 |
VI. Rollback Instructions
- All P0 changes only modify requires/constructors, without deleting the original LLMBrain logic
- bridge failure automatically falls back to LLMBrain, no single point of risk
- The unified-create hook is disabled by default; set ENABLE_RULE_PRECHECK=false to restore original behavior
- For a full rollback: git revert involves 4 files + delete smart-llm-bridge.js
BossAgents