Repository navigation
Trust Graph monorepo: pure Rust core with CLI, WebAssembly and Node wrappers - #15
Merged
Merged
Conversation
Adopt the "one Rust core, thin wrappers" architecture: the core never does I/O, and each wrapper handles input and output for its host. - Rename crates: trustgraph -> trustgraph-core, trust-cli -> trustgraph-cli (binary still `trust`). - Make the core pure: drop Keypair::generate and the random Holochain bucket (callers pass seeds/bytes), move the file-backed Store to the CLI, and drop getrandom and std::io errors. Record/Query stay in core. - Add trustgraph_core::api, a JSON-shaped API (camelCase) that every wrapper exposes one-to-one; the CLI's verify/convert now use it. - Add trustgraph-wasm (wasm-bindgen; @trustgraph/trustgraph-wasm) with web and Node builds, and trustgraph-node (napi-rs; @trustgraph/trustgraph) with napi's per-platform package layout. - Shared TypeScript types (bindings/trustgraph.d.ts), one JS smoke test run against the native addon and both wasm builds, and a benchmark. - Speed up lens ~2x: compute each agent's edges once, and skip content IDs when building the graph. 100k atoms: 0.78 s in wasm, 0.48 s native. - scripts/check-core-purity.sh fails CI if the core gains I/O in source or dependencies; wasm size budget of 1 MiB (now 547 KiB, 229 KiB gz). - CI: purity check, wasm package job (clippy for wasm32, build, smoke tests, tsc, benchmark), native addon job on Linux/macOS/Windows. - doc/architecture.md; README updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
harlantwood
pushed a commit
that referenced
this pull request
Oct 6, 2026
Reflect PR #15 (pure trustgraph-core with CLI, WebAssembly and Node wrappers): add it to what has shipped, make 'one pure core, thin wrappers' the first principle, fold 'Embed everywhere' into a new 'Release and publish' phase (npm per-platform packages, wasm package, Convex spike), and add the package-name and public/private npm decisions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
1 task done
Treat this repository as the home of every Trust Graph project: Rust first, TypeScript where it fits. - Cargo workspace members are now `crates/*`, so new crates join automatically. - Add a root npm workspace (`crates/trustgraph-node`, `packages/*`) with one root lockfile and `build:node`, `test:node` and `typecheck` scripts; TypeScript is pinned as a dev dependency instead of fetched by npx. - CI and Dependabot run npm from the root. - README is now the monorepo front page: what's in the repo, where new Rust crates and TypeScript packages go, and the language policy (protocol logic only in trustgraph-core; TypeScript calls it through the WebAssembly or native package, never re-implements it). - doc/architecture.md gains a "monorepo, Rust first" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
Replace the npm workspace with pnpm: pnpm-workspace.yaml (the Node binding crate plus packages/*), pnpm-lock.yaml instead of package-lock.json, and `packageManager: pnpm@12.9.1` so local and CI use the same version. CI installs with pnpm/action-setup and `pnpm install --frozen-lockfile`; docs use pnpm commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
- .nvmrc pins `lts/*` (Node 24 today); CI's setup-node reads it, so CI moves to each new LTS when it is promoted. - The root package.json asks for Node >= 24 for development. - The published packages declare Node >= 22, the oldest line still maintained (Node 20 reached end of life in April 2026); CI runs the smoke test on Node 22 to keep that promise. - Re-ran the benchmark on Node 24 and updated doc/architecture.md: lens on 100k atoms is now 0.54 s in WebAssembly, 0.43 s native. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
Drop the Holochain link-tag codec and everything built on it: the `holochain` module and `Value::to_holochain_string` in the core, `InvalidLinkTag`, `api::holochain_tags`, the `holochainTags` and `bucketFromBytes` bindings and their TypeScript types, and `trust convert --to holochain --bucket`. Tests and docs updated; the WebAssembly build shrinks to 538 KiB (225 KiB gzipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
Add a `random` cargo feature to trustgraph-core (off by default, on in the CLI, WebAssembly and Node wrappers) that provides Keypair::generate and api::generate_keypair, backed by getrandom: the OS RNG natively, crypto.getRandomValues in WebAssembly (getrandom's wasm_js feature). - New `generateKeypair()` in both npm packages and the TypeScript types; keypairFromSeed still works for callers who bring their own seed. - The CLI uses Keypair::generate and drops its own random module. - The purity check exempts only the feature-gated src/random.rs and verifies the gate; the default dependency tree still has no getrandom. CI also lints the core alone with default features. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
Supersedes Dependabot PRs #13 (checkout v5 -> v7) and #14, which would have changed the MSRV job's dtolnay/rust-toolchain@1.85 to @1.120: that ref is the Rust version under test, not an action version, so it is now ignored in dependabot.yml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
harlantwood
pushed a commit
that referenced
this pull request
Oct 7, 2026
…drafts Update the TL;DR, shipped table and Phase 0 for PR #15 (merged): monorepo layout, optional randomness, CI. Carry forward three ideas from the 2022-23 drafts #9 and #10: Reputon export (Phase 1), IPFS publishing (Phase 3), and lens value filters plus a per-hop falloff view (Phase 4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68
This was referenced Oct 7, 2026
Closed
harlantwood
added a commit
that referenced
this pull request
Oct 8, 2026
## Summary Adds `doc/plan/README.md`, the roadmap for the **Trust Graph monorepo**: the Rust core, the `trust` CLI, the WebAssembly and Node packages built on the core, and every future Trust Graph project. **Start with the TL;DR at the top.** It covers: - **What's shipped:** - [#11](#11): the CLI and protocol library - [#15](#15): the monorepo layout, a pure core with CLI, WebAssembly and Node wrappers, optional randomness, and CI - **Next phases:** - 0: Finish the monorepo. Bring in the protocol docs and the JSON-LD schema, archive the old repos, and rename this repo to `trustgraph/trustgraph`. - 1: Lock the v1 data format, and add Reputon export. - 2: Release and publish: npm, crates, cargo-dist, and a real Convex spike. - 3: Share over HTTPS, with IPFS as the next transport. - 4: UX, including lens value filters and an `--explain` view. - 5: Harden. - **Decisions for you:** - value range - JSON-LD context domain - package names - public or private npm - the existing `trustgraph/trustgraph` repo The rest of the doc covers: - design principles - a status table - each phase, with acceptance criteria - an open-decisions table - the 2022 TODO list, mapped to what's done It also picks up three ideas from the early drafts [#9](#9) and [#10](#10). Docs only. `master` is merged in, so the links to `doc/architecture.md` resolve. Merging this also makes the README's roadmap link work. ## Test plan - [x] Docs only; I checked links and anchors by hand --- **History:** this started as the first roadmap for the Rust CLI. It was revised as [#11](#11) and [#15](#15) shipped. At your request I removed Trustcraft and Holochain, and the roadmap now reflects everything merged so far. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68 --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This makes the repo the Trust Graph monorepo: Rust first, TypeScript where it fits. Inside it is one pure Rust core with three thin wrappers, so Convex is just another caller. Full write-up:
doc/architecture.md.Monorepo
crates/*, so new crates join automatically.crates/trustgraph-nodepluspackages/*.pnpm-lock.yaml, andpackageManager: pnpm@12.9.1.build:node,test:node,typecheck..nvmrcislts/*, which is Node 24 today.trustgraph-core. TypeScript calls the core through the WebAssembly or native package. It never re-implements signing, IDs or scoring.The core never does I/O
trustgraph→trustgraph-core,trust-cli→trustgraph-cli. The binary is stilltrust.Storelives in the CLI.RecordandQuerystay in the core.randomcargo feature is off by default and on in all three wrappers.Keypair::generateandgenerateKeypair(). They use the OS random number generator, orcrypto.getRandomValuesin WebAssembly.keypairFromSeedstill works.generateKeypairis the one non-deterministic function. Call it in a client or action, not inside a reactive query.scripts/check-core-purity.shfails CI if any of these happen:src/random.rs;getrandom,rand,tokio,libcor an HTTP client.One API, three wrappers
trustgraph_core::apiis a JSON-shaped API with camelCase names:generateKeypair,keypairFromSeed,parseAtom,atomId,canonicalAtom,toCredential,signAtom,verify,lens,rollup.trustgraph-wasmhas two builds, both made byscripts/build-wasm-package.sh:web/: initialized from the.wasmbytes withinitSync, nofetch.node/: for Node.trustgraph-nodeuses napi-rs with one package per platform, the same pattern as@resvg/resvg-js.bindings/trustgraph.d.ts, checked withtsc --strict.tests/js/smoke.mjs, runs against the native addon and both WebAssembly builds.CI
tsc, benchmark, and a 1 MiB size budgetactions/checkoutv7. This supersedes Dependabot #13.dtolnay/rust-toolchain. Its ref is the Rust version under test, which Dependabot misread in #14. Dependabot still covers cargo and npm/pnpm.Removed
Value::to_holochain_string, andtrust convert --to holochain.Performance (Node 24 LTS, Linux x86-64)
lens, 10k atomslens, 100k atomslensis about 2× faster than onmaster. It computes each agent's edges once and skips content IDs it doesn't need.Still open
externalPackagesinstalls from npm at deploy time.Test plan
cargo test --workspaceon Rust 1.99 and 1.85 (randomon): 64 core unit, 7 property, 3 doctests, 8 CLI unit, 12 CLI end-to-endcargo test -p trustgraph-corewith default features (no randomness): 61 unit testscargo clippy -D warnings(workspace, core alone, andwasm32-unknown-unknown);cargo doc -D warnings;cargo fmt --checkscripts/check-core-purity.shpasses. It also fails on a plantedstd::fscall or a removed feature gate.generateKeypair) passes on Node 24 against all three builds, and on Node 22 against the native addonpnpm install --frozen-lockfile,pnpm run build:node,pnpm run test:node,pnpm run typecheckMerge this before #12 (the roadmap), which links to
doc/architecture.md.History: this started as the CoreNexus architecture pass (a pure core with wrappers). At your request it grew to cover the monorepo setup, pnpm, the latest Node LTS, removing Holochain and opt-in randomness. Before merging, it also absorbed the two pending Dependabot CI updates.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UdKneRqUnsbv1t7NyvcT68