Skip to content

SPTVector Architecture Plan

Purpose-Built Vector Store for SmartPoints Technology

Date: 2026-02-15 Status: DRAFT — Pending Philippe's Review Source Repo: spt (v2.0.3, 98 Rust crates) Target Repo: sptvector (greenfield) Alignment: SmartPoints White Paper, Provisional Patent v7.0, US Patent 8,170,957 B2


1. Strategic Objectives

ObjectiveRationale
Rename all packages from Spt/spt/spt to spt/sptvector/sptIP separation, brand identity for SmartPoints Technology
Change .spt file extension to .sptPatent claims reference .spt actor containers
Add native Go supportNATS ecosystem is Go-native; Go SDK enables first-class NATS JetStream integration
Quantum-resistant crypto as defaultWhite paper mandates ML-DSA, ML-KEM/Kyber, SLH-DSA for all operations
Actor model for .spt filesEach container is an actor in the AIL identity graph with directed messaging
NATS protocol integrationSVS messaging backbone per white paper Section 3.2

2. Scope: What to Fork vs. What to Skip

Core Crates to Port (Priority 1 — ~20 crates)

These are essential for the SPT vector store and actor runtime:

spt Cratesptvector NamePurpose
spt-coresptvector-coreVector database engine (HNSW, storage, search)
spt-nodesptvector-nodeNode.js native bindings (NAPI-RS)
spt-wasmsptvector-wasmWebAssembly for edge/browser
spt-typesspt-typesSegment types, format constants, magic bytes
spt-wirespt-wireSerialization/deserialization (async tokio)
spt-cryptospt-cryptoPQC signing, encryption, witness chains
spt-runtimespt-runtimeContainer loading, MicroVM spawning
spt-storespt-storePersistent storage layer
spt-manifestspt-manifestManifest/metadata management
spt-cowspt-cowCopy-on-Write branching
spt-witnessspt-witnessTamper-evident audit trails
spt-clispt-cliCommand-line interface
spt-membershipspt-membershipVector membership filters
spt-deltaspt-deltaSparse delta patches
hnsw-rsspt-hnswHNSW index (or keep as dependency)
spt-graphsptvector-graphCypher/graph queries for identity graph
spt-distributedsptvector-distributedRaft consensus, replication

New SPT-Specific Crates (to create)

CratePurpose
spt-actorActor runtime — message handling, capability checks, lifecycle
spt-relationshipsPre-negotiated relationship management, directional terms
spt-discoveryDiscovery service for new relationship requests
spt-noiseNoise protocol extensions for asymmetric SLA negotiation
spt-natsNATS client integration (Rust side, via async-nats)
spt-identityDID/VC management, AIL graph integration

Go Package (new)

PackagePurpose
go/sptvectorGo module — NATS-native client for sptvector operations
go/sptvector/sptfile.spt file read/write in Go
go/sptvector/actorActor primitives in Go (receive/send via NATS)
go/sptvector/cryptoPQC wrappers (via circl or liboqs-go)
go/sptvector/natsNATS JetStream integration for actor messaging
go/sptvector/wireWire protocol (gRPC/protobuf for Rust<->Go interop)

Crates to Defer/Skip (Phase 1)

spt CrateReason to Defer
sptllmLLM inference — not core to actor model
ruqu-*Quantum coherence research — premature
rvdnaGenomics — domain-specific, not needed
spt-attention-* (40+)Attention mechanisms — research layer
spt-sonaSelf-optimizing neural — defer to Phase 3
spt-postgresPostgreSQL extension — defer
tiny-dancerFastGRNN — research

3. Renaming Strategy

File Extension

  • .spt -> .spt throughout all code, tests, docs, CLI flags
  • Magic bytes: "SPT\x1f\x8b" -> "SPTS\x1f\x8b" (4-byte magic preserved)

Rust Crates

  • All spt-* -> sptvector-*
  • All spt-* -> spt-*
  • All Spt* structs -> Sptvector* or Spt*
  • All spt_* module names -> spt_*
  • All SptHnsw*, SptLtra*, Spt* prefixes -> Spt*

npm Packages

  • @smartpointstech/* -> @sptvector/*
  • spt -> sptvector

Documentation

  • All references to "SPT" -> "SPTVector"
  • All references to "SPF" (legacy name) -> "SPT Format"
  • All spt.io domain references -> smartpoints.tech

4. .spt File Format Specification

Header (64 bytes)

Offset  Size    Field
0x00    4       Magic: "SPTS"
0x04    2       Version (u16)
0x06    4       Segment count (u32)
0x0A    8       Total size (u64)
0x12    32      Root hash (Blake3)
0x32    16      Actor DID hash (truncated)
0x42    2       Flags (discovery_enabled, ephemeral, etc.)

Segment Types (inherited from SPT + new)

rust
pub enum SegmentType {
    // Inherited from SPT (renumbered as needed)
    Vec           = 0x01,  // Vector embeddings
    Index         = 0x02,  // HNSW adjacency
    Manifest      = 0x05,  // Segment directory
    Quant         = 0x06,  // Quantization codebooks
    Meta          = 0x07,  // Key-value metadata
    Crypto        = 0x0C,  // PQC keys, signatures
    Kernel        = 0x0E,  // Embedded runtime (WASM/QEMU)
    Ebpf          = 0x0F,  // eBPF filters
    CowMap        = 0x20,  // COW cluster mapping
    Witness       = 0x0A,  // Audit trails

    // NEW: SPT Actor Segments
    ActorManifest = 0x30,  // DID, VCs, blueprint, discovery flag
    Relationships = 0x31,  // Pre-negotiated directional capabilities
    MessageQueue  = 0x32,  // Inbound directed vector buffer
    WitnessActor  = 0x33,  // Actor-specific message receipt logs
    NoiseState    = 0x34,  // Noise handshake state, PSKs
    IdentityGraph = 0x35,  // Local shard of AIL graph context
}

Crypto (default PQC)

  • Signatures: ML-DSA-65 (all segments, messages)
  • Key Exchange: ML-KEM-768 / Kyber (Noise handshakes)
  • Hash: SHAKE-256 + Blake3 (witness chains)
  • Stateless sigs: SLH-DSA-128s (long-term identity)
  • Hybrid fallback: Ed25519 + ML-DSA during transition

5. Actor Model Architecture

Core Trait

rust
#[async_trait]
pub trait SptActor: Send + Sync {
    /// Load from .spt file, verify PQC root, resolve AIL graph
    async fn load(path: &Path, ail: &AilClient) -> Result<Self>
    where Self: Sized;

    /// Handle inbound directed vector message
    async fn handle_message(&mut self, msg: DirectedVector) -> Result<Response>;

    /// Actor DID
    fn did(&self) -> &Did;

    /// Current relationships
    fn relationships(&self) -> &[Relationship];

    /// Request new relationship via discovery
    async fn discover(&self, proposal: RelationshipProposal) -> Result<Relationship>;
}

Message Flow

1. Sender creates DirectedVector (embedding + metadata + PQC signature)
2. NATS publishes to subject: spt.actor.{recipient_did}.in.{relationship_id}
3. Recipient actor receives, validates:
   a. Is sender_did in my RELATIONSHIPS segment?
   b. Does PQC signature verify against sender's pubkey in AIL?
   c. Is message type in negotiated allowed_types?
   d. If all pass -> process. Else -> silent drop + witness log.
4. Response via: spt.actor.{sender_did}.in.{reverse_relationship_id}

NATS Subject Scheme

spt.actor.{did}.in.{rel_id}           — Inbound directed messages
spt.actor.{did}.out.{rel_id}          — Outbound directed messages
spt.discovery.request                  — Relationship proposals
spt.discovery.response.{request_id}    — Discovery responses
spt.governance.{zone_id}.handshake     — Double-Handshake Protocol
spt.witness.{did}.log                  — Audit trail events

6. Go Package Design

Why Go

  • NATS server and reference client are Go
  • Go's concurrency model (goroutines) maps naturally to actor patterns
  • Go is the lingua franca for cloud-native infrastructure (K8s, Docker)
  • Enables SPT to ship a single binary that embeds NATS + sptvector

Architecture Options

OptionApproachProsCons
A: CGo/FFIGo calls Rust via C ABIFull Rust engine reuseCGo complexity, cross-compilation pain
B: Wire ProtocolGo speaks gRPC/protobuf to Rust serverClean separation, independent scalingExtra network hop, deployment complexity
C: Pure GoReimplement core in GoNo FFI, NATS-native, single binaryDuplicate effort, feature drift
D: Hybrid (recommended)Wire protocol for vector ops + pure Go for actor/NATS/cryptoBest of both worldsModerate complexity

Recommendation: Option D (Hybrid)

  • Go package handles: NATS messaging, actor lifecycle, .spt file I/O, Noise handshakes, PQC via circl (Cloudflare's Go PQC library)
  • Rust engine handles: HNSW indexing, vector search, quantization, heavy compute
  • Protocol: gRPC with protobuf over Unix socket or TCP
  • This gives us a Go binary that can embed NATS and talk to sptvector-core

Go Module Structure

go/
├── go.mod                    # module github.com/SmartPointsTech/sptvector/go
├── cmd/
│   └── sptd/                 # SPT daemon (NATS + sptvector server)
│       └── main.go
├── pkg/
│   ├── sptfile/              # .spt file format (read/write/validate)
│   │   ├── header.go
│   │   ├── segment.go
│   │   └── crypto.go
│   ├── actor/                # Actor runtime
│   │   ├── actor.go          # SptActor interface
│   │   ├── handler.go        # Message handler with capability checks
│   │   └── lifecycle.go      # Load, spawn, shutdown
│   ├── nats/                 # NATS integration
│   │   ├── client.go         # Subject-based pub/sub for actors
│   │   ├── discovery.go      # Discovery service
│   │   └── jetstream.go      # Durable streams for SLA logs
│   ├── noise/                # Noise protocol extensions
│   │   ├── handshake.go      # NK/XK patterns with directional terms
│   │   └── psk.go            # PSK management for relationships
│   ├── crypto/               # PQC wrappers
│   │   ├── mldsa.go          # ML-DSA signatures (via circl)
│   │   ├── mlkem.go          # ML-KEM key exchange
│   │   └── witness.go        # Witness chain (Blake3 + PQC)
│   ├── identity/             # DID/VC management
│   │   ├── did.go
│   │   └── vc.go
│   └── wire/                 # gRPC client to Rust engine
│       ├── proto/
│       │   └── sptvector.proto
│       └── client.go
└── internal/
    └── ail/                  # AIL graph client
        └── graph.go

7. Phased Roadmap

Phase 1: Fork, Rename, Build (Weeks 1-2)

Goal: Working sptvector repo with .spt files, all tests passing.

TaskDetailsEstimate
1.1 Fork spt to SmartPointsTech/sptvectorgh repo fork or clean copy of selected cratesDay 1
1.2 Select ~20 core crates, remove research cratesKeep core vector engine + SPT format cratesDay 1
1.3 Rename all Rust crates: spt-* -> sptvector-*, spt-* -> spt-*Cargo.toml, module names, importsDays 2-3
1.4 Change magic bytes, file extension .spt -> .sptspt-types, CLI, all testsDay 3
1.5 Rename structs/types: Spt* -> Spt*, Spt* -> Spt*Global search-replace with verificationDays 3-4
1.6 Update npm packages: @smartpointstech/* -> @sptvector/*package.json, TypeScript bindingsDay 4
1.7 cargo test --workspace — fix all breakagesIterative fix cycleDays 4-5
1.8 Update README, docs, license headersBrand as SmartPoints TechnologyDay 5
1.9 CI/CD: GitHub Actions for build/testAdapt from spt workflowsDay 5
1.10 Verify .spt file create/read/write works end-to-endIntegration testDay 5

Exit Criteria: cargo test passes, spt-cli creates and reads .spt files.

Phase 2: PQC Hardening + New Segments (Weeks 3-4)

Goal: .spt files have mandatory PQC and actor-specific segments.

TaskDetailsEstimate
2.1 Upgrade spt-crypto: ML-DSA-65 as default signatureReplace optional PQC with mandatoryDays 1-2
2.2 Add ML-KEM-768 for key exchangeIntegrate pqcrypto-mlkem or liboqs-rustDay 2
2.3 Implement new segment types: ActorManifest, Relationships, MessageQueue, WitnessActor, NoiseState, IdentityGraphExtend spt-typesDays 3-5
2.4 Wire serialization for new segmentsExtend spt-wireDays 5-6
2.5 Witness chain upgrade: SHAKE-256 + ML-DSAspt-witnessDay 7
2.6 Tests: PQC sign/verify round-trip, new segment I/OUnit + integrationDays 7-8

Exit Criteria: .spt files contain actor manifests and relationships with PQC.

Phase 3: Actor Runtime + NATS (Weeks 5-7)

Goal: .spt files load as actors, communicate via NATS with capability enforcement.

TaskDetailsEstimate
3.1 Implement SptActor trait in Rustspt-actor crateDays 1-3
3.2 Message validation pipeline: graph lookup -> PQC verify -> type checkCore security enforcementDays 3-5
3.3 NATS integration (async-nats): subject-based pub/subspt-nats crateDays 5-7
3.4 Discovery service: proposal -> Noise handshake -> relationship creationspt-discovery crateDays 7-9
3.5 Noise protocol extensions: NK/XK + PSK for directional termsspt-noise crateDays 9-11
3.6 Integration test: two actors negotiate, exchange directed vectorsEnd-to-end scenarioDays 11-12

Exit Criteria: Two .spt actors communicate via NATS with PQC-verified directed messaging.

Phase 4: Go Package (Weeks 8-10)

Goal: Go SDK for sptvector with NATS-native actor support.

TaskDetailsEstimate
4.1 Go module scaffolding: go.mod, package structurePer design in Section 6Day 1
4.2 .spt file reader/writer in Gopkg/sptfile — header, segments, validationDays 2-4
4.3 PQC in Go via circl (Cloudflare)ML-DSA, ML-KEM wrappersDays 4-5
4.4 NATS actor runtime in Gopkg/actor + pkg/natsDays 5-8
4.5 Noise handshake in Gopkg/noise using flynn/noise + PQCDays 8-9
4.6 gRPC wire protocol to Rust engineprotobuf schema + clientDays 9-11
4.7 sptd daemon: embeds NATS + sptvector servercmd/sptdDays 11-13
4.8 Go tests: actor lifecycle, NATS messaging, PQC verificationFull test suiteDays 13-14

Exit Criteria: Go binary creates .spt actors, communicates via embedded NATS.

Phase 5: AIL Integration + Production Hardening (Weeks 11-14)

Goal: Full identity graph, governance, and production readiness.

TaskDetailsEstimate
5.1 AIL graph overlay on sptvector's Raft consensusDAG-based identity storageWeek 11
5.2 Cypher queries for relationship resolutionsptvector-graphWeek 11
5.3 Control Zones + Double-Handshake ProtocolGovernance sidecar integrationWeek 12
5.4 Ephemeral memory: TTL shards + cryptographic zeroizationCognitive LayerWeek 12
5.5 Benchmarking: <100ms handshakes, 61us queries, 10K+ TPSPerformance validationWeek 13
5.6 Security audit: PQC verification, lateral movement testsRed team scenariosWeek 13
5.7 Documentation, examples, deployment guidesProduction readinessWeek 14

Exit Criteria: Patent prototype complete with benchmark data.


8. Key Technical Decisions

DecisionChoiceRationale
PQC Library (Rust)pqcrypto + liboqs-rustMost complete NIST PQC coverage
PQC Library (Go)cloudflare/circlProduction-proven, ML-DSA + ML-KEM
Actor Framework (Rust)Custom on tokioAvoid external dependency for core security primitive
Actor Framework (Go)Custom on goroutinesNATS-native, no framework overhead
NATS Client (Rust)async-natsOfficial async Rust client
NATS Client (Go)nats-io/nats.goReference implementation
Noise (Rust)snow crateMature Noise implementation
Noise (Go)flynn/noiseWell-maintained Go Noise
Wire ProtocolgRPC + protobufLanguage-agnostic, efficient, well-tooled
Graph QueriesCypher (retained from spt)Existing implementation, expressive for identity graphs
File FormatBinary, append-only (evolved from the original format)Crash-safe, progressive loading

9. Risk Register

RiskImpactLikelihoodMitigation
Renaming breaks subtle internal referencesMediumHighComprehensive grep + CI
PQC adds unacceptable latencyHighLowHardware accel (ANE/CUDA), hybrid fallbacks
Go<->Rust interop complexityMediumMediumClean gRPC boundary, integration tests
Scope creep from spt's 98 cratesHighHighStrict Phase 1 crate selection, defer research crates
NATS subject explosion with many actorsMediumMediumHierarchical subjects, JetStream partitioning
Noise PQC hybrid patterns not standardizedLowMediumFollow NIST + IETF drafts, modular design

10. Success Metrics

MetricTargetSource
Vector query latency<61us p50 (match spt)Benchmark suite
Handshake latency (PQC + Noise)<100ms end-to-endIntegration test
Throughput10,000+ TPSLoad test
PQC overhead<10ms per operationCrypto benchmarks
.spt boot time<125ms (self-booting actor)Runtime test
Go test coverage>80%CI
Rust test coverage>80% (core crates)CI
Lateral movementZero in Control Zone testsSecurity audit

Released under the MIT License.