Skip to content

feat: Introduce Ontogeny — a self-improving operational ontology platform built on HugeGraph - #380

Open
simon824 wants to merge 10 commits into
mainfrom
ontogeny
Open

simon824 wants to merge 10 commits into
mainfrom
ontogeny

Conversation

@simon824

@simon824 simon824 commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Purpose of the PR

Introduce Ontogeny — a self-improving operational ontology platform — as proposed and discussed in #376. This PR lands Step 1 (M0, structure merge) of the three-step merge plan; Steps 2–3 (GraphRAG functional merge, ML/graph-compute deep merge) will follow as normal feature PRs.

What Ontogeny is, in one line: it models an enterprise's business nouns (objects, properties, links) and verbs (actions, functions, policies) as declarative, Git-native YAML, compiles them into strongly-typed tables and a HugeGraph graph projection, and serves them to applications, analytics and AI agents through one governed API (five-stage Action runtime, Cedar-subset policy with default-deny + markings, immutable audit, transactional outbox, and a governed RSI self-evolution loop).

Main Changes

  • The Ontogeny platform (all additions, nothing upstream touched):
    • server/ontogeny/ — the Python kernel: 11-kind DSL + validators, registry & compiled snapshots, sync engine, five-stage action runtime, Cedar-subset policy engine, query engine, sandboxed functions, RSI loop (telemetry + evolve), graph projection, agent session governance (MCP surface at /mcp), extension host
    • extensions/ — pluggable implementations: llm-ollama (LLM gateway), graph-hugegraph (projection store), agent-builtin-llm (reference agent engine)
    • web/ — React 19 + TypeScript console (bilingual EN/zh-CN)
    • domains/product-manufacturing/ — showcase domain package (also the test golden package)
    • docs/zh/ + docs/en/ — bilingual architecture & usage docs with UI screenshots; merge plan at docs/hugegraph-ai-merge-plan.md
  • M0 structure merge (per the merge plan §1): upstream main (9922568) merged via subtree into third_party/, preserving upstream history and authorship — zero code changes, zero import coupling, zero dependency wiring; repo-root machinery files that only function at a repository root (.asf.yaml, .github/, .gitattributes, .licenserc.yaml, .pre-commit-config.yaml) were pruned from the vendored copy and its unique .gitignore entries were merged (scoped) into the root .gitignore; the full curation record is in THIRD_PARTY.md
  • Provenance & compliance: THIRD_PARTY.md (source, merged point, sync policy), upstream attribution line appended to NOTICE, vendored LICENSE kept under third_party/
  • Engineering gates: third_party added to ruff extend-exclude; new third-party-smoke CI workflow (presence + LICENSE + zero import coupling); no changes to pyproject.toml dependencies or uv.lock

Merge-plan status & what is NOT here yet

Step Status
1. Structure merge (M0) this PR
2. Functional merge (M1/M2) — [graphai] extra, GraphRAG Q&A (ask_graph), text-to-ontology proposals follow-up PR
3. Deep merge (M3/M4) — ML semantic search, graph compute, RSI ↔ graph signals TODO

Ground rules held across all steps: no second governance channel (LLM calls go through the platform gateway; writes go through the Action runtime), anti-corruption layer (server/ never imports third_party/ packages), graph queries return IDs assembled back through the engine so markings always apply.

Verifies this pull request

  • backend pytest green (456 tests); frontend vitest green (241) + build; E2E 8/8
  • zero import coupling: git grep -n "hugegraph_llm|hugegraph_ml" -- server extensions tests → zero hits
  • uv.lock carries zero new dependencies (diff empty vs main)
  • git merge-tree dry-run: merging ontogeny into main is conflict-free
  • THIRD_PARTY.md / NOTICE / vendored LICENSE in place; third-party-smoke workflow green

Related to #376

Ontogeny (an Apache HugeGraph subproject) models an enterprise's nouns
(objects, properties, links) and verbs (actions, functions, permissions)
as declarative YAML in Git, compiled into strongly-typed object tables and
one unified API shared by apps, analytics and AI agents. Writes go through
a five-stage Action runtime (params -> rules -> Cedar policy -> effects ->
immutable audit) with side effects on a transactional outbox; an RSI loop
improves the model itself inside the governance track (the LLM proposes,
deterministic evals select, promotion follows T0-T3 tiers).

Docs: docs/README.md (中文) · docs/en/README.md (English)
Merge plan with hugegraph-ai: docs/hugegraph-ai-merge-plan.md
- bilingual docs split into docs/zh/ and docs/en/ with language-matched
  screenshots; etymology of the name told in both READMEs
- console defaults to English (saved preference still wins)
- chore: untrack .zcodeignore (local tooling config)
- four screenshots paired with the sections they illustrate: the
  Overview architecture board (intro), the ontology canvas (Git-native
  modeling), the dashboard's ontology-model section (quick start) and
  the audit stream plus the agent-console popup (MCP/governance)
- section headings stripped of emoji; badge anchors fixed
- documentation section now points at both docs/zh and docs/en
Merge upstream main (9922568) into third_party/ preserving upstream
history and authorship; zero code changes, zero import coupling,
zero dependency wiring -- per docs/hugegraph-ai-merge-plan.md §1.
Ontogeny-owned root files are kept as-is.
- THIRD_PARTY.md registers source, merged point (main@9922568) and the
  sync policy (no direct edits under third_party/)
- NOTICE gains the upstream attribution line
- ruff extend-exclude += third_party (upstream code is not held to our
  lint rules; uv.lock carries zero new dependencies)
- third-party-smoke workflow: presence + LICENSE + zero import coupling
Deleted as root-only machinery: .asf.yaml, .github/ (issue templates +
upstream CI), .gitattributes (source-packaging rules), .licenserc.yaml,
.pre-commit-config.yaml. Upstream .gitignore entries unique to the
vendored tree merged into the root .gitignore, scoped to third_party/.
Content files (LICENSE, NOTICE, README, workspace pyproject.toml) and
all code stay byte-for-byte.
Copilot AI balanced review requested due to automatic review settings October 10, 2026 00:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Action-state bugs, inaccurate function contracts, altered project attribution, and removed compliance gates must be resolved.

10 open findings
What changed in this PR

Introduces the Ontogeny operational-ontology platform, its React console and manufacturing example, while vendoring HugeGraph AI components for future integration.

Changes:

  • Adds Ontogeny’s governed ontology, action, policy, agent, projection, and evolution layers.
  • Adds the web console, extensions, example domain, tests, and bilingual documentation.
  • Vendors HugeGraph AI under third_party/ with provenance and smoke checks.
File Description
server/​ontogeny/​** Core platform services and public package APIs.
extensions/​** Ollama, HugeGraph, and built-in agent adapters.
domains/​product-manufacturing/​** Manufacturing ontology, actions, policies, functions, and agents.
web/​src/​** React console entry points, components, and agent styling.
web/​*.json, web/​*.ts, web/​index.html Frontend build, type-check, and integration-test configuration.
web/​README.md, web/​.gitignore, web/​.oxlintrc.json Frontend guidance and tooling configuration.
docs/​en/​**, docs/​zh/​** Bilingual quick-start documentation.
third_party/​** Vendored HugeGraph AI source, tests, deployment assets, and documentation.
THIRD_PARTY.md Vendored-source provenance and synchronization policy.
NOTICE, LICENSE Root licensing and attribution changes.
.github/​workflows/​third-party-smoke.yml Vendored-tree presence and coupling checks.
.github/​workflows/​check-dependencies.yml Removes dependency and license checks.
.github/​workflows/​sync.yml, .github/​workflows/​labeler.yml, .github/​workflows/​auto-pr-comment.yml Removes existing repository automation.
.github/​pull.yml, .github/​labeler.yml, .github/​ISSUE_TEMPLATE/​config.yml Removes repository maintenance configuration.
.pre-commit-config.yaml, .gitattributes Removes local validation and release-export rules.
.dockerignore Defines the Ontogeny container build context.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread domains/product-manufacturing/actions/complete-operation.yaml
Comment thread NOTICE
Comment thread domains/product-manufacturing/actions/add-bom-line.yaml
Comment thread domains/product-manufacturing/actions/assign-operation.yaml
Comment thread domains/product-manufacturing/actions/record-inspection.yaml
Comment thread domains/product-manufacturing/functions/capacity-check.yaml
Comment thread domains/product-manufacturing/functions/material-availability.yaml
Comment thread domains/product-manufacturing/functions/order-yield.yaml
Comment thread server/ontogeny/core/__init__.py
Comment thread web/tsconfig.node.json Outdated
- complete-operation refuses CANCELLED operations; assign-operation is
  QUEUED-only; record-inspection rejects negative defect counts;
  add-bom-line constrains scrap_rate to [0,1] (null defaults to 0)
- new contract test covers all four hardened rules end to end
- core/__init__ imports lint before exporting it via __all__
- tsconfig.node covers vitest.integration.config + tests-integration;
  the e2e helper's json typing fixed accordingly
- upstream NOTICE merged into the root NOTICE (attribution verbatim),
  vendored copy removed; THIRD_PARTY.md curation record updated

Function returns stay declared as string: the DSL type vocabulary has no
union/object shape, and the three functions return success/failure unions
that a struct declaration would misrepresent
'draws one directed, selectable edge per link type' touched __ooG6 after
waiting only for the flow container — the fake canvas registers a few
ticks later once the domain loads, so the CI runner read .cfg off
undefined. Same guard as clickNode, scoped to the edge under test.
@simon824

Copy link
Copy Markdown
Member Author

cc @imbajin @bitflicker64

Resolution per the standing strategy:
- .github/workflows/{hugegraph-llm,hugegraph-python-client,ruff}.yml:
  take main's 1.8.0 versions — upstream release CI stays functional for
  the root modules after the eventual ontogeny -> main merge
- pyproject.toml: keep ontogeny's manifest (M0 zero-wiring rule); the
  upstream 1.8.0 workspace changes stay recorded in the subtree copy
- rename detection carried main's deltas on the nine touched files into
  their third_party/ copies, so the vendored snapshot picks up the
  release fixes for exactly the files upstream touched

Verified: zero import coupling unchanged; merging this branch into main
is a fast-forward (7729a1e is an ancestor) — conflict-free by construction.
hugegraph-llm.yml, hugegraph-python-client.yml and ruff.yml came back at
the root via the 1.8.0 conflict resolution, but they build/test upstream
modules that live under third_party/ on this branch — they can never pass
here and stay red on every push. Removed per the THIRD_PARTY.md curation
principle; restoring them adapted to the merged layout belongs to
merge-plan steps 2-3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants