Skip to content

feat(platform): establish the portable Ontology Runtime and trusted execution contract #328

Description

@PeterGuy326

schemaVersion: requirement-record.v2
revision: R2
status: needs-design
priority: P1
productOwner: pending maintainer decision
technicalOwner: pending cross-repository assignment
userOutcome: >
An operator can ask a RoleWeave employee to inspect a bounded business object,
reach a traceable decision, and propose or execute a controlled action with
evidence, policy enforcement, idempotency, and trusted readback.
parent: #37
dependencies:

North star

RoleWeave is moving from multi-Agent demonstrations to a domain-neutral,
open-source trusted execution platform for enterprise Agents.

The platform lets an Agent work with bounded business objects, evidence,
policies, and actions without directly depending on raw database schemas or
unrestricted external tools.

The open-source core is not a domain-specific business application, BI system,
general-purpose ontology editor, graph database, or Palantir replacement.
Business solutions are delivered as optional domain packs and enterprise
adapters on top of the platform.

User outcome

An operator can ask a RoleWeave employee to:

  1. inspect a bounded business object or relationship;
  2. resolve its semantic context and source evidence;
  3. produce a traceable decision or hypothesis;
  4. propose a controlled action with explicit preconditions;
  5. obtain the required policy or human approval;
  6. execute the action idempotently; and
  7. inspect the exact readback and terminal receipt.

A multi-Agent conversation alone is not evidence of a trusted execution
platform.

Product boundary

Area Owner Boundary
Portable employee, position, connector, permission, approval, and execution contracts digital-employee Provider-neutral runtime contracts and validation
Workbench presentation, local orchestration, task/turn navigation, and receipt inspection roleweave User-facing operation and evidence navigation
Source occurrences, locators, scoped recall, and source provenance context Source-level evidence and constrained retrieval
Durable memory, archival, correction, lifecycle, and recall policy mem Long-term memory authority
Business meanings, metrics, rules, mappings, and action-risk policy Domain pack / enterprise owner Domain-owned semantics and acceptance

No repository may introduce a second source of truth for sessions, permissions,
approvals, durable memory, raw source occurrences, or execution receipts.

Execution model

The normative execution path is:

source ingest
  -> normalization and semantic binding
  -> Ontology Runtime
  -> typed query / function / action API
  -> Agent / Workbench / Skill / MCP
  -> policy and approval evaluation
  -> idempotent execution
  -> exact readback
  -> execution receipt

The Agent is responsible for intent understanding, planning, explanation, and
delegation. The Ontology Runtime is responsible for bounded business meaning
and deterministic operational state.

The Agent must not directly control arbitrary SQL, database writes, or
unrestricted external APIs.

Ontology Runtime scope

The Ontology Runtime is a portable contract and runtime seam, not a mandated
storage engine.

The minimum model includes:

  • business objects and stable object references;
  • relationships;
  • semantic bindings;
  • derived state;
  • lifecycle and expiry;
  • typed queries and functions;
  • business actions;
  • source evidence;
  • version and digest checks;
  • policy and permission context; and
  • execution events and receipts.

The first implementation must not require a graph database or a new enterprise
data platform. Storage and source adapters remain replaceable.

Core contracts

BusinessObjectRef

A bounded reference to a business object, relationship, metric, event, or
derived state. It preserves source identity, scope, time, version, digest, and
permission context where applicable. It must not contain an unbounded raw source
payload.

EvidenceRef

A reference to source evidence supporting a claim or decision. It preserves a
source locator, source type, time range, revision or digest, provenance, and
access scope.

DecisionRecord

A bounded conclusion, hypothesis, or recommendation. It records confidence or
uncertainty, evidence references, semantic bindings, timestamp, and originating
turn or task.

ActionProposal

A proposed action that has not necessarily executed. It records action type,
target, intent, expected effect, preconditions, required permission, approval
policy, idempotency key, target version or digest, expiry, and originating
decision.

ExecutionReceipt

A record of what actually happened. It records actor and position, effective
permission, target identity and version, action and idempotency identities,
start and terminal states, external identifiers, exact readback, failure or
indeterminate reason, and originating turn or task.

indeterminate must never be rendered as succeeded.

Requirements

REQ-001 — Stable semantic references

Define versioned contracts for business objects, relationships, metrics,
events, derived state, and evidence. References must preserve scope,
provenance, time, and version information.

REQ-002 — Ontology Runtime boundary

Define minimum runtime behavior for object and relationship resolution, derived
state, lifecycle transitions, typed queries and functions, action discovery,
and source/version invalidation.

REQ-003 — Decision-to-action contract

Define a versioned contract connecting DecisionRecord to ActionProposal.
Target, intent, expected effect, preconditions, policy, approval, expiry, and
idempotency must be explicit.

REQ-004 — Fail-closed execution

An action must not execute unless effective permission is present, required
approval is satisfied, the target is still valid, the proposal has not expired,
and the idempotency identity is preserved.

Retries must reuse the same idempotency identity.

REQ-005 — Trusted execution state machine

Define and enforce:

proposed -> approved -> running
                         -> succeeded | failed | cancelled | indeterminate

No client-side inference may convert failed or indeterminate into succeeded.

REQ-006 — Workbench traceability

The RoleWeave workbench must allow an operator to inspect semantic context,
source evidence, decision, action proposal, policy result, execution state,
readback, and final receipt from the task or turn timeline.

Parallel, relay, and handoff flows must preserve these references without
silently widening permissions or re-running an action.

REQ-007 — Cross-repository ownership

Portable contracts belong in digital-employee. RoleWeave owns local
orchestration, presentation, and receipt navigation. context and mem retain
ownership of source occurrences and durable memory.

No direct database coupling may bypass these boundaries.

REQ-008 — Domain neutrality

The core must not hard-code one organization's business vocabulary, one
vendor's data model, graph database assumptions, or unattended Agent autonomy.

Business semantics, metrics, rules, mappings, and action policies are supplied
by a domain pack or enterprise adapter.

Acceptance criteria

AC-001 — R2 decision and ownership

Record an accepted decision that freezes the glossary, repository ownership,
technical pilot, product owner, technical owner, domain-pack policy, and
revisit trigger.

Platform acceptance, technical-pilot acceptance, and business-domain acceptance
must remain separate.

AC-002 — Contract examples

Publish bounded examples for:

  1. a read-only semantic analysis; and
  2. a write-capable action proposal.

Examples must include evidence, semantic binding, uncertainty, permission,
approval, idempotency, target version, and readback.

AC-003 — Safety invariants

Add executable tests proving that:

  • unauthorized actions cannot execute;
  • missing approval blocks execution;
  • retries preserve idempotency;
  • stale targets invalidate proposals;
  • expired proposals cannot execute; and
  • indeterminate execution is never reported as success.

AC-004 — Deterministic read-only proof

Using the GitHub operations pilot from #302, demonstrate:

source -> semantic binding -> object / relationship
       -> derived state -> evidence-backed result

This proof must not claim live business impact.

AC-005 — Controlled write proof

Demonstrate one low-risk write-capable path:

action proposal -> policy / approval -> idempotent execution
                -> exact readback -> execution receipt

A contract example or mock execution is not equivalent to live external
execution. The verification level must be stated explicitly.

AC-006 — Existing contract reconciliation

Document what is reused, extended, or intentionally unchanged from #327,
#143, workflow-handoff-v1, existing permission and approval records, and the
GitHub operations proof.

AC-007 — Security and data boundary

Define workspace and tenant scope, actor identity, execution-time permission
re-evaluation, sensitive-field handling, retention and expiry, audit access,
source ownership, and public-repository exclusions.

Credentials, private chat content, and raw customer data must not enter the
public contract or examples.

AC-008 — Evidence ledger

Every implementation PR must record the consumed Issue revision, exact commit
and PR head, test commands and results, CI status, independent review status,
security and scope checks, known limitations, and product acceptance status.

Design complete, implemented, CI-green, reviewed, merged, and product-accepted
are separate states.

Issue lifecycle and governance

The intended lifecycle is:

needs-design -> ready -> in-progress -> product-review -> accepted

Any semantic change must first be recorded as an append-only
requirement-decision comment. The Issue body then advances to a new revision,
and every implementation PR must state which revision it consumes.

A green CI run or a merged PR does not by itself close this Issue. Product
acceptance requires the evidence ledger and an explicit decision on the current
revision.

Technical pilot and domain packs

The technical pilot is the GitHub operations path from #302.

Any business domain may later be validated as an optional domain pack, but no
single domain is a committed core vocabulary or a prerequisite for the
domain-neutral platform.

Users and organizations must be able to bring their own business objects,
metrics, rules, evidence mappings, and action policies through the same
portable contracts.

Current evidence

As of 2026-09-18:

Non-goals

This Issue does not include:

  • a general-purpose ontology editor;
  • a graph database;
  • a data warehouse or BI replacement;
  • a Palantir clone;
  • a universal enterprise ontology;
  • unrestricted Agent autonomy;
  • unattended scheduling or automatic routing;
  • replacement of context or mem;
  • direct database access from RoleWeave; or
  • business ROI claims before a separately approved pilot.

Delivery sequence

  1. Accept the R2 decision and assign owners.
  2. Merge the portable semantic and execution contract.
  3. Merge bounded examples and executable safety tests.
  4. Deliver the deterministic read-only proof.
  5. Deliver one controlled low-risk write proof.
  6. Split runtime implementation into repository-owned child Issues.
  7. Validate one domain pack separately from core platform acceptance.
  8. Measure execution success, readback completeness, duplicate-action rate,
    indeterminate rate, approval latency, operator correction rate, and relevant
    token/tool-result cost.

Definition of done

This Issue may move to an accepted design state only when:

  • R2 ownership and boundaries are accepted;
  • the glossary and contracts are versioned;
  • the examples are present;
  • safety invariants are executable;
  • the technical pilot is explicitly selected;
  • implementation gaps are split into child Issues; and
  • no design, CI, merge, or business-acceptance claim is overstated.

Runtime implementation, live external execution, domain-pack validation, and
business outcomes require separate Issues and evidence.

Non-normative references

Activity

  1. PeterGuy326 commented on Sep 18, 2026

    @PeterGuy326
    ContributorAuthor

    R1 clarification: platform boundary versus business-domain acceptance

    This requirement has two deliberately different layers:

    • RoleWeave open-source core is a domain-neutral trusted execution platform. It must not hard-code one organization's business vocabulary as the universal product scope.
    • Business domains bring their own scenario packs and acceptance criteria. The platform standardizes how their business semantics, metrics, rules, evidence and actions are defined, versioned, governed and executed.
    • Other users and organizations use the same portable contracts without inheriting a fixed industry or business vocabulary.

    Responsibility boundaries:

    Area Primary owner Product contract
    Business semantics, metrics and rules Business domain owner Business defines the meaning, formula, scope, thresholds and acceptance
    Platform capability Open-source team Standard contracts/configuration, validation, runtime, permissions, approvals, idempotency, audit, readback and workbench surfaces
    Scenario capability Open-source team + business domain Co-create the scenario pack, workflow, mappings, evaluations and operator experience
    Data capability Business provides the source and ownership Business provides source data, access and quality definition; the platform ingests/stores it through a standard contract with provenance and scope

    Action policy is also business-configured:

    • automatic execution;
    • human approval before execution;
    • or forbidden.

    The platform does not decide the business risk policy by itself. It enforces the configured policy at execution time, re-checks effective permissions, preserves idempotency, and records the exact readback/indeterminate outcome.

    This clarification refines REQ-006 and AC-001: R2 must distinguish platform acceptance, technical-pilot acceptance, and a business domain's own acceptance. A domain scenario is evidence for the platform, not a hard-coded dependency of the open-source product.

  2. PeterGuy326 commented on Sep 18, 2026

    @PeterGuy326
    ContributorAuthor

    R2 增量:从业务语义契约升级为 Ontology Runtime

    结合最近对个推 AIBI 和 OntoFlow 相关材料的研究,补充一个平台边界判断:

    RoleWeave 的开源核心不是经营决策产品,也不是通用 Ontology 编辑器,而是 domain-neutral 的企业 Agent 可信执行平台。业务语义不能只停留在 BusinessObjectRef / EvidenceRef 的描述合同,还需要一个最小的 Ontology Runtime seam,让业务对象能够被查询、计算、推进状态并提出受控行动。

    新增设计判断

    • Ontology Runtime 至少需要覆盖:对象与关系、派生状态、生命周期、查询/函数、业务 Action、事件/回执、版本与失效。
    • 推荐运行链路为:
    source ingest
      -> normalization / semantic binding
      -> ontology runtime
      -> typed query / function / action API
      -> Agent / Workbench / Skill / MCP
      -> policy / approval / idempotency / execution / readback
    
    • Agent 负责理解意图、规划和解释,但不应成为每次 SQL/API 操作的控制平面;Agent 应通过类型化的语义查询和 Action 合同使用 Ontology Runtime。
    • 不在本 Issue 内建设图数据库、Palantir 替代品或全量企业本体。存储实现保持可插拔,技术 proof 可以基于现有跨仓库契约、事件/回执和最小本地实现。
    • 外部写操作继续必须满足权限重检、审批策略、幂等键、目标版本校验、精确回读;indeterminate 不能被客户端猜成 succeeded。
    • 任一业务域都可以作为可选 domain pack,但不能进入 RoleWeave 核心的固定业务词汇。

    参考材料:https://mp.weixin.qq.com/s/qy1OOT0_wbq15Rw_iuEWrQ

    R2 需要补充的验收点

    1. glossary/boundary 中新增并定义 OntologyRuntime、DerivedState、Lifecycle、BusinessAction;
    2. 发布一个最小的只读 semantic-runtime proof:source -> binding -> object/relation -> derived state -> evidence;
    3. 发布一个低风险 write-capable proof:action proposal -> approval/policy -> idempotent execution -> exact readback receipt;
    4. 明确 RoleWeave、digital-employee、context、mem 分别拥有的运行时边界,不能引入第二套数据/会话/权限真相源。

    本评论是设计增量,不代表实现、CI、合并或业务验收已经完成。

  3. waterbro-8 commented on Sep 18, 2026

    @waterbro-8
    Collaborator

    进展回填(R2 增量之后)

    冯浩然要求:在 Issue/PR 回填实际进展和验证证据。下面按 已做到 / 未做到 分开,不把设计评论当成实现。

    已提交的代码

    PR: 将在本评论后附上(docs/328-ontology-runtime-r2)。

    产物 路径
    术语表 + 边界 + 台账 docs/design/ontology-runtime-r2.md
    只读 proof 示例 examples/github-ops/semantic/read-only-analysis.v1.json
    可写 proof 示例(squash-merge 合同,不是真 merge) examples/github-ops/semantic/write-pr-merge.v1.json
    合同 + 状态机 packages/shared/src/semantic-runtime.ts
    AC-003 测试 apps/server/test/semantic-runtime.test.ts

    对照验收

    ID 状态 证据
    AC-001 glossary/owners/pilot 未冻结 文档是提案;产品负责人尚未在本 Issue 点名 owner / 试点拍板
    AC-002 示例载荷 仓库内完成 上述两个 JSON
    AC-003 安全不变量 单测已写 未批准不可执行、幂等键、目标版本 stale、indeterminate ↛ succeeded;CI 未在本环境跑过
    AC-004 端到端可跟随 未 live 只有合同轨迹;没有对真实 PR 走 proposal→approval→gh merge→readback
    AC-005 与 #327/#143/handoff 设计对账完成 文档 §3:reuse 记忆窗口与 Handoff,不改 turn/approval 真相源
    AC-006 试点度量 未测 指标已列,全部 NOT MEASURED
    AC-007 安全边界 写进文档 合同禁止凭据/私聊/原始客户字段;并诚实记录 #302 的 policy 不执行缺口
    R2 OntologyRuntime 等四个词 已定义 文档 §2
    R2 只读 / 可写 proof 合同级 不是运行时存储,也不是新 MCP

    现成可 reuse、本切片故意没重写的

    • #302 examples/github-ops 三个岗位 + apps/server/test/example-github-ops.test.ts(已合 main)
    • packages/shared/src/workflows.ts Task/Handoff 状态机(indeterminate 终态不可复活)
    • docs/design/workflow-handoff-v1.md
    • 审批事件与 turn readback(docs/evidence/issue-25)

    下一步(需要产品拍板后才能算 AC-001 完成)

    1. 在本 Issue 写 requirement-decision:productOwner / technicalOwner / 技术 proof 确认仍是 github-ops / Sales 仍是 dogfood 而非核心词汇。
    2. CI 跑绿本 PR 的 semantic-runtime 测试。
    3. 另开实现切片:只读绑定视图;再开低风险 write(幂等 merge + 精确 readback)。不要在本 PR 里做 Palantir。

    本评论不是合并、不是业务验收。

  4. waterbro-8 commented on Sep 18, 2026

    @waterbro-8
    Collaborator

    对应 PR:#344 (Refs #328)。

  5. waterbro-8 commented on Sep 18, 2026

    @waterbro-8
    Collaborator

    R1 design decision is in #346 (ADR-0009 + docs/design/trusted-execution-v1.md). No runtime change. Technical proof remains the GitHub ops path from #302; Sales Workbench is not committed.

  6. waterbro-8 commented on Sep 18, 2026

    @waterbro-8
    Collaborator

    验证证据回填(R2 合同切片)

    冯浩然要求:在 Issue/PR 回填实际进展和验证证据。下面是命令级证据,不是设计评论复述。对应 PR:#344

    本轮做了什么

    提交 作用
    b6acbca glossary/合同/github-ops 示例 + AC-003 纯函数测试
    5d267c0 把 dist/semantic-runtime.js 写入桌面打包 allowlist

    首轮 CI(b6acbca)失败,原因是本切片新增共享模块后漏了 SHARED_RUNTIME_FILES:

    packages/shared/dist/index.js imports unpackaged dist/semantic-runtime.js
    

    Job: https://github.com/bytefolk/roleweave/actions/runs/35301940106/job/105466205625

    本地(Node v24.20.0)

    npm ci --ignore-scripts
    npm run build
    node --test --test-timeout=120000 apps/server/dist/test/semantic-runtime.test.js
    
    ✔ #328 AC-003: action cannot run without approval
    ✔ #328 AC-003: retries reuse the same idempotency identity
    ✔ #328 AC-003: target version change invalidates the proposal
    ✔ #328 AC-003: indeterminate never becomes succeeded
    ✔ #328 AC-002: committed github-ops semantic examples stay parseable
    ℹ tests 5  pass 5  fail 0
    

    GitHub Actions(head 5d267c02)

    verify run: https://github.com/bytefolk/roleweave/actions/runs/35302429962

    Check 结果
    Node 24 / ubuntu-latest (npm run check) pass https://github.com/bytefolk/roleweave/actions/runs/35302429962/job/105467661920
    Node 24 / macos-14 pass
    Unpacked staging smoke macOS arm64 / Windows x64 pass
    Unsigned installers macOS arm64 / Windows x64 pass
    Layout parity pass
    CodeQL / Dependency review / OpenSSF Scorecard pass

    Ubuntu 日志同一 5 条全部 ✔;该 job 的 server suite 为 tests 513 / pass 511(其余 skip)。

    PR 评论:#344 (comment)

    对照验收(未把设计当成实现)

    ID 状态 证据
    AC-001 glossary/owners/pilot 未冻结 文档是提案;产品负责人尚未在本 Issue 点名拍板
    AC-002 示例载荷 仓库内完成 + CI 解析 examples/github-ops/semantic/*.v1.json;CI parseable ✔
    AC-003 安全不变量 单测绿 + CI 绿 上列 5 条;ubuntu npm run check
    AC-004 端到端可跟随 未 live 只有合同轨迹;没有对真实 PR 走 proposal→approval→gh pr merge→readback
    AC-005 与 #327/#143/handoff 设计对账完成 docs/design/ontology-runtime-r2.md §3
    AC-006 试点度量 未测 指标已列,全部 NOT MEASURED
    AC-007 安全边界 写进文档 合同禁止凭据/私聊/原始客户字段
    R2 四词 / 只读+可写 proof 合同级 不是运行时存储,也不是新 MCP

    明确不声称

    下一步(需要别人拍板/评审)

    1. 在本 Issue 写 requirement-decision:productOwner / technicalOwner / 技术 proof 确认仍是 github-ops / Sales 仍是 dogfood 而非核心词汇。
    2. CODEOWNER 审 docs(platform): record Ontology Runtime R2 contract for trusted execution (#328) #344
    3. 另开实现切片:只读绑定视图;再开低风险 write(幂等 merge + 精确 readback)。不要在本 PR 里做 Palantir。
  7. changed the title [-]feat(platform): define the business semantic contract for trusted Agent execution[/-] [+]feat(platform): establish the portable Ontology Runtime and trusted execution contract[/+] on Sep 18, 2026
  8. waterbro-8 commented on Sep 18, 2026

    @waterbro-8
    Collaborator

    #344 已 squash-merge 到 main(ecc0294b)。

    这只落地了 Ontology Runtime R2 合同切片(glossary/contract 文档 + AC-003 纯函数 + github-ops 语义示例)。Issue #328 本身不要关。

    仍未完成:

    • AC-001:产品负责人尚未点名 owner / 试点
    • AC-004:还没有对真实 PR 走 proposal → approval → gh pr merge → exact readback
    • AC-006:试点指标全部 NOT MEASURED
    • 可移植合同尚未 pin 到 digital-employee
  9. waterbro-8 commented on Sep 18, 2026

    @waterbro-8
    Collaborator

    记录门禁,避免把 #344 的技术合入当成 #328 产品验收。

    不关本 issue,不开运行时实现,直到 AC-001 记名决策落地。

  10. waterbro-8 commented on Sep 24, 2026

    @waterbro-8
    Collaborator

    关单审计 HOLD(不关闭)

    精确缺口:productOwner/technicalOwner/lastDecisionAt 仍 pending(AC-001)。#344 只是 R2 文档契约。缺 live「对象→决策→审批→幂等执行→readback」。@PeterGuy326 先记名 owner,再谈关单。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions