数据库原生架构Database-native Architecture

数据库不只是存储,而是 Agent 的数据面与控制面The Database Is Both the Agent Data Plane and Control Plane

受管 Agent 的核心身份、状态、执行与证据以数据库记录为权威事实源;关系、JSON、全文、向量、图、事务、权限、调度、备份恢复和高可用共同构成管理基础设施。Database records are the authoritative source for the core identity, state, execution, and evidence of governed Agents. Relational, JSON, full-text, vector, graph, transaction, authorization, scheduling, recovery, and high-availability capabilities form the management infrastructure.

问题根源Root Problem

文件适合起步,不适合作为企业控制面Files Are Fine to Start, Not to Govern an Enterprise

随着记忆和知识文件增多,定位与修改变得困难,重复加载增加 Token,且容易污染上下文。多人、多 Agent 并发写入还缺少事务、冲突控制、行级权限、统一审计和可靠恢复。As memory and knowledge files grow, retrieval and mutation become difficult, repeated loading consumes tokens, and irrelevant context contaminates prompts. Concurrent human and Agent writes also lack transactions, conflict handling, row-level access, unified audit, and reliable recovery.

问题Problem文件方式File Approach数据库方式Database Approach
检索Retrieval遍历、全量加载或额外索引Scanning, full loading, or extra indexes结构化过滤、全文、向量与图融合Structured, full-text, vector, and graph fusion
并发Concurrency覆盖、锁文件和冲突难处理Overwrite and lock-file conflicts事务、约束、锁和幂等Transactions, constraints, locks, and idempotency
安全Security目录和进程边界粗粒度Coarse directory and process boundaries身份、角色、行级策略和服务端授权Identity, roles, row policies, and server authorization
统一核心Unified Core

四层架构,数据库适配隐藏在共同契约之后Four Layers With Database Adapters Behind One Contract

体验与接入层Experience and Access

门户 · 管理面板 · SKILL.md · MCP · HTTP · CLIPortal · Dashboard · SKILL.md · MCP · HTTP · CLI

管理与治理层Management and Governance

主体 · 注册 · 策略 · 频道 · 关卡 · 审计Principal · Enrollment · Policy · Channel · Gate · Audit

持久执行层Durable Execution

任务计划 · 分支 · 循环 · 编译计划 · 图运行 · 租约Task Plan · Branch · Loop · Compiler Plan · Graph Run · Lease

数据库能力层Database Capability

SQL · JSON · 全文检索 · 向量 · 图 · 事务 · 调度器 · 高可用SQL · JSON · FTS · Vector · Graph · Transaction · Scheduler · HA

组织权威事实Authoritative Organization Facts

关系表负责正确性,图形负责理解与配置Relational Facts Enforce Correctness; Graphs Support Understanding

普通平台账号、Human Principal 与组织人员一一对应,注册审批在同一事务中建立账号和主组织。组织、主/兼职归属、直属/虚线/项目汇报、Agent 责任和有效期由关系表、约束、闭包表与历史表共同记录;受保护 bootstrap admin 是唯一不映射自然人的系统例外。画布按这些语义事实确定性排布,Property Graph 只能作为可重建投影,不能成为授权前置条件或越权来源。Each ordinary platform account maps one-to-one to a Human Principal and organization person, while registration approval creates the account and primary membership in one transaction. Relational tables, constraints, closure, and history record organizations, primary/secondary membership, direct/dotted/project reporting, Agent accountability, and validity; the protected bootstrap admin is the sole non-person system exception. The canvas deterministically lays out these facts, while Property Graph remains a rebuildable projection that cannot grant authority.

主组织闭包 ∩ 直属汇报 ∩ 安全域 ∩ 当前授权 ∩ 显式拒绝 ∩ 有效期primary organization closure ∩ direct reporting ∩ security domain ∩ current grant ∩ explicit deny ∩ validity
五信号融合检索Five-signal Retrieval

只把相关上下文送入模型Send Only Relevant Context to the Model

统一查询融合向量相似度、全文相关性、关系过滤、标签匹配和图邻接,仅 Top-N 结果进入 Prompt。v4.3.0 的可复现实验在 SQLite FTS5 Top-3 条件下将输入 Token 从 141,454 降至 4,601,减少 96.75%;它不代表延迟、质量、总体成本或客户收益。A unified query fuses vector similarity, full-text relevance, relational filters, tag matching, and graph neighborhoods, sending only Top-N results into the prompt. The v4.3.0 reproducible SQLite FTS5 Top-3 experiment reduced input tokens from 141,454 to 4,601, or 96.75%; it is not a latency, quality, total-cost, or customer-benefit claim.

向量 + 全文 + 关系过滤 + 标签 + 图边 → 排序后的 Top-N 上下文vector + full_text + relational_filter + tags + graph_edges → ranked Top-N context
工程范式演进Engineering Evolution

提示词 → 上下文 → 执行框架 → 循环 → 图Prompt → Context → Harness → Loop → Graph

Loop Engineering 先建立目标、执行、评估、调整和继续的闭环。Graph Engineering 位于 Loop 之上,使用版本化 Graph Definition、不可变 Graph Version、确定性 Compiler Plan、持久 Graph Run、Node Run、Checkpoint、Worker Lease、Event 和 Artifact 协调多个 Loop 与外部能力。Loop Engineering establishes a goal, execute, evaluate, adjust, and continue cycle. Graph Engineering sits above Loop, coordinating multiple Loops and external capabilities through versioned Graph Definitions, immutable Graph Versions, deterministic Compiler Plans, durable Graph Runs, Node Runs, Checkpoints, Worker Leases, Events, and Artifacts.

生产配置PRODUCTION PROFILE

稳定核心Stable Core

身份、任务、Loop、频道、审批、审计和恢复等当前生产建议能力。Identity, tasks, Loops, channels, approval, audit, recovery, and other production-recommended capabilities.

图预览GRAPH PREVIEW

实验协调层Experimental Coordination

显式启用,在受控环境验证,不宣称已成为稳定行业范式。Explicitly opt-in, validated in controlled environments, and not presented as settled industry consensus.

连续性Continuity

Agent 恢复与数据库高可用共同保护运行状态Agent Recovery and Database HA Protect Runtime State Together

Agent 核心状态在数据库中,进程或节点异常后,替代实例可以恢复身份并重建会话、工作区、任务和 Loop 上下文。数据库层再通过实际部署的主备、集群、故障转移、备份和时间点恢复保护状态底座。Core Agent state lives in the database. After process or node failure, a replacement instance can recover identity and rebuild sessions, workspaces, tasks, and Loop context. The database tier protects that state through the replication, clustering, failover, backup, and point-in-time recovery actually deployed.

边界Boundary

平台不承诺数据库永不不可用,也不替代数据库高可用设计。RPO/RTO、故障切换和恢复能力必须按客户所选数据库与实际拓扑验证。The platform does not promise the database is never unavailable and does not replace database HA design. RPO/RTO, failover, and recovery must be validated against the selected database and actual topology.