Sphere core protocol schemas, TypeScript reference packages, and an early reference node/runtime.
This repo exists to extract and stabilize the proven graph, identity, event, and adapter lessons from earlier Sphere prototypes so they can be reused by real applications.
Build the smallest useful Sphere core that can:
- define language-agnostic schemas for entities, identity links, edges, events, and commands;
- provide TypeScript reference types and validators;
- produce deterministic event hashes and verify event chains;
- replay events into queryable graph projections;
- expose a minimal local reference node;
- define adapter contracts informed by the legacy Discord integration.
Events are canonical history. Graph state is a projection. Platform integrations, such as Discord roles and channels, are adapter projections rather than Sphere protocol concepts.
specs/ Draft protocol specs, JSON Schemas, examples, and test vectors.
packages/ Reusable TypeScript packages close to protocol semantics.
apps/ Temporary reference node and CLI until split-worthy.
references/ Legacy implementation notes and migration maps.
docs/ Development and architecture notes for this repo.
The current implementation plan is based on earlier Sphere prototypes:
- a legacy Discord bot/runtime;
- an earlier graph-service prototype;
- an earlier web-app prototype.
See references/legacy-sources.md for the extraction stance. Do not copy old systems wholesale; extract concepts, tests, and migration fixtures deliberately.
corepack enable
corepack prepare pnpm@9.15.9 --activate
pnpm install
pnpm test
pnpm typecheck- Early applications can integrate these components today, primarily by source/workspace consumption inside a monorepo or direct repository checkout.
- The packages are still workspace/source packages today; npm publishing and semver release workflow are not set up yet.
apps/nodeandapps/demoare reference implementations, not production services.
- Architecture
- Reference Node API
- Events and Actions
- Node Runtime
- Testing
- Command Policy
- Authorization Roadmap
- Runtime Security Boundary
- Protocol Versioning
- Package Conventions
- Apps Overview
- Packages Overview
- Demo CLI
This repository is licensed under the MIT License.
The first kernel is implemented and test-covered:
- protocol types and JSON Schemas;
- runtime schema and action-payload validation;
- UUIDv7-compatible ID helpers;
- canonical JSON/XML serialization;
- deterministic SHA-256 event hashing;
- event hash-chain verification;
- replayable in-memory graph projection;
- in-memory and SQLite event stores;
- command-to-event helpers plus reference-node submission/read clients;
- minimal reference node API with memory/SQLite storage reporting, ranged event reads, and command acceptance;
- runnable reference node service entrypoint with graceful shutdown.
Near-term focus remains on tightening client ergonomics, auth/error boundaries, and core test/docs coverage before app-specific product work.