embeddenator 0.20.0-alpha.1

Sparse ternary VSA holographic computing substrate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# Component Architecture

**Version:** 0.20.0  
**Status:** Active  
**Last Updated:** January 4, 2026

## Overview

Embeddenator has been refactored into a **modular component architecture** with 6 independent library crates and 3 binary/tool crates. This architecture enables:

- **Granular dependency management** - Use only what you need
- **Independent versioning** - Components evolve at their own pace
- **Parallel development** - Teams work on isolated components
- **Reduced build times** - Incremental compilation per component
- **Clear API boundaries** - Explicit contracts between layers

## Architecture Diagram

```
embeddenator (core orchestrator v0.20.0)
├── embeddenator-vsa         → Sparse ternary VSA primitives
├── embeddenator-io           → Codebook, manifest, engram I/O
├── embeddenator-retrieval    → Query, shift-sweep, cosine similarity
├── embeddenator-fs           → FUSE filesystem integration
├── embeddenator-interop      → Python/FFI bindings
└── embeddenator-obs          → Observability, metrics, logging

embeddenator-testkit          → Shared testing utilities
embeddenator-contract-bench   → Performance benchmarking
embeddenator-workspace        → CLI wrapper for workspace operations
```

## Component Repositories

All components are hosted under the `tzervas` GitHub organization:

| Component | Repository | Version | Description |
|-----------|------------|---------|-------------|
| **embeddenator-vsa** | [tzervas/embeddenator-vsa]https://github.com/tzervas/embeddenator-vsa | v0.1.0 | Sparse ternary vector operations (bundle, bind, permute, cosine similarity) |
| **embeddenator-io** | [tzervas/embeddenator-io]https://github.com/tzervas/embeddenator-io | v0.1.0 | Serialization/deserialization for codebooks, manifests, engrams |
| **embeddenator-retrieval** | [tzervas/embeddenator-retrieval]https://github.com/tzervas/embeddenator-retrieval | v0.1.0 | Query engine with shift-sweep search and similarity metrics |
| **embeddenator-fs** | [tzervas/embeddenator-fs]https://github.com/tzervas/embeddenator-fs | v0.1.0 | FUSE filesystem for mounting engrams as virtual filesystems |
| **embeddenator-interop** | [tzervas/embeddenator-interop]https://github.com/tzervas/embeddenator-interop | v0.1.0 | Foreign Function Interface (FFI) for Python/C integration |
| **embeddenator-obs** | [tzervas/embeddenator-obs]https://github.com/tzervas/embeddenator-obs | v0.1.0 | Observability, metrics collection, structured logging |
| **embeddenator-testkit** | [tzervas/embeddenator-testkit]https://github.com/tzervas/embeddenator-testkit | v0.1.1 | Shared test utilities, fixtures, property-based testing harnesses |
| **embeddenator-contract-bench** | [tzervas/embeddenator-contract-bench]https://github.com/tzervas/embeddenator-contract-bench | v0.2.1 | Performance benchmarking suite with contract validation |

## Dependency Graph

```
embeddenator (core)
├── embeddenator-vsa (no deps)
├── embeddenator-io
│   └── embeddenator-vsa
├── embeddenator-retrieval
│   ├── embeddenator-vsa
│   └── embeddenator-io
├── embeddenator-fs
│   ├── embeddenator-vsa
│   ├── embeddenator-io
│   └── embeddenator-retrieval
├── embeddenator-interop
│   ├── embeddenator-vsa
│   └── embeddenator-io
└── embeddenator-obs (no deps)

embeddenator-testkit
├── embeddenator-vsa
└── embeddenator-io

embeddenator-contract-bench
├── embeddenator-vsa
├── embeddenator-io
└── embeddenator-retrieval
```

## Using Components

### As Git Dependencies (Production)

Components are consumed via **git tags** for stable releases:

```toml
[dependencies]
embeddenator-vsa = { git = "https://github.com/tzervas/embeddenator-vsa", tag = "v0.1.0" }
embeddenator-io = { git = "https://github.com/tzervas/embeddenator-io", tag = "v0.1.0" }
```

### As Path Dependencies (Local Development)

For **local development** with multiple components, use `[patch.crates-io]`:

```toml
# In embeddenator/Cargo.toml (or workspace root)
[patch.crates-io]
embeddenator-vsa = { path = "../embeddenator-vsa" }
embeddenator-io = { path = "../embeddenator-io" }
embeddenator-retrieval = { path = "../embeddenator-retrieval" }
embeddenator-fs = { path = "../embeddenator-fs" }
embeddenator-interop = { path = "../embeddenator-interop" }
embeddenator-obs = { path = "../embeddenator-obs" }
```

**Workflow:**
1. Clone all component repos into a common parent directory:
   ```bash
   mkdir ~/embeddenator-workspace
   cd ~/embeddenator-workspace
   git clone https://github.com/tzervas/embeddenator
   git clone https://github.com/tzervas/embeddenator-vsa
   git clone https://github.com/tzervas/embeddenator-io
   # ... etc for all components
   ```

2. Add `[patch.crates-io]` to your `Cargo.toml` (see above)

3. Develop across components with instant feedback:
   ```bash
   cd embeddenator-vsa
   # Make changes...
   cd ../embeddenator
   cargo build  # Uses local path, not git tag
   ```

4. Before committing:
   - Remove or comment out `[patch.crates-io]`
   - Verify builds work with git tag dependencies
   - Commit and push component changes first, then core

See [LOCAL_DEVELOPMENT.md](LOCAL_DEVELOPMENT.md) for detailed workflows.

## Versioning Strategy

### Core Orchestrator (embeddenator)
- **Semver:** Major.Minor.Patch (e.g., v0.20.0)
- **Release Cadence:** Feature-driven, ~monthly
- **Git Tags:** `v0.20.0`, `v0.21.0`, etc.
- **Breaking Changes:** Increments major version (0.x → 1.0 for stable)

### Components (embeddenator-*)
- **Semver:** Major.Minor.Patch (e.g., v0.1.0, v0.1.1)
- **Release Cadence:** Independent, as needed
- **Git Tags:** Per-repo tags (e.g., `v0.1.0` in embeddenator-vsa)
- **Compatibility:** Components maintain API stability within minor versions

### Tagging Workflow
1. **Update version in Cargo.toml:**
   ```bash
   cd embeddenator-vsa
   # Edit Cargo.toml: version = "0.1.1"
   cargo build --release  # Verify
   ```

2. **Commit and tag:**
   ```bash
   git add Cargo.toml
   git commit -m "Release v0.1.1: Fix cosine similarity precision"
   git tag -a v0.1.1 -m "v0.1.1: Precision improvements"
   git push origin main --tags
   ```

3. **Update consumers:**
   ```bash
   cd ../embeddenator
   # Edit Cargo.toml: tag = "v0.1.1"
   cargo update -p embeddenator-vsa
   cargo test --all
   git commit -am "Update embeddenator-vsa to v0.1.1"
   ```

See [VERSIONING.md](VERSIONING.md) for compatibility guarantees.

## CI/CD Integration

### Shared Workflows

All component repos use **centralized CI workflows** from [tzervas/.github-workflows](https://github.com/tzervas/.github-workflows):

```yaml
# .github/workflows/ci.yml (in each component repo)
name: CI
on: [push, pull_request]

jobs:
  ci:
    uses: tzervas/.github-workflows/.github/workflows/reusable-ci.yml@v1
    with:
      rust-version: '1.84'
      run-tests: true
      cache-key-prefix: 'embeddenator-vsa'
```

**Benefits:**
- **DRY principle** - Update CI logic once, propagate to all repos
- **Versioning** - Use `@v1` floating tag for automatic updates
- **Specialized actions** - FUSE setup, benchmark isolation, cargo caching
- **Consistency** - All repos build/test identically

### Docker Images (Core Only)

The **embeddenator core** provides multi-arch Docker images:

```bash
# Pull latest stable
docker pull ghcr.io/tzervas/embeddenator:latest

# Pull specific version
docker pull ghcr.io/tzervas/embeddenator:v0.20.0

# Architecture-specific
docker pull ghcr.io/tzervas/embeddenator:v0.20.0-amd64
docker pull ghcr.io/tzervas/embeddenator:v0.20.0-arm64
```

**Features:**
- Multi-stage Alpine builds (~15MB final image)
- Multi-arch manifests (amd64 + arm64)
- Automated Trivy security scanning
- Non-root user (embr:1000)
- GHCR integration with GitHub Packages

See [.docker/README.md](.docker/README.md) for building and deploying.

## Migration from Monolith

### Pre-v0.20.0 (Monolith)
```rust
// Single crate with all functionality
use embeddenator::vsa::SparseVec;
use embeddenator::io::codebook::Codebook;
use embeddenator::retrieval::query::QueryEngine;
```

### Post-v0.20.0 (Components)
```rust
// Import from dedicated crates
use embeddenator_vsa::SparseVec;
use embeddenator_io::codebook::Codebook;
use embeddenator_retrieval::query::QueryEngine;
```

### Breaking Changes
- **Module paths:** `embeddenator::module::*``embeddenator_module::*`
- **Cargo.toml:** Single dependency → Multiple component dependencies
- **Feature flags:** Top-level features removed (components have own features)

### Compatibility Shim
For gradual migration, use re-exports in `embeddenator` core:

```rust
// embeddenator/src/lib.rs
pub use embeddenator_vsa as vsa;
pub use embeddenator_io as io;
pub use embeddenator_retrieval as retrieval;

// Allows legacy code to work:
// use embeddenator::vsa::SparseVec; ✅
```

See [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md) for step-by-step instructions.

## Development Workflow

### Adding a New Component

1. **Create repository:**
   ```bash
   cd ~/Documents/projects
   cargo new --lib embeddenator-new-component
   cd embeddenator-new-component
   git init
   git remote add origin https://github.com/tzervas/embeddenator-new-component
   ```

2. **Add shared CI:**
   ```bash
   mkdir -p .github/workflows
   # Create ci.yml using shared workflow (see examples)
   git add .github/
   git commit -m "Add CI workflow"
   ```

3. **Implement and test:**
   ```bash
   cargo build
   cargo test
   cargo doc --no-deps
   ```

4. **Release:**
   ```bash
   git tag -a v0.1.0 -m "Initial release"
   git push origin main --tags
   ```

5. **Integrate into core:**
   ```bash
   cd ../embeddenator
   # Add to Cargo.toml with git tag
   cargo update -p embeddenator-new-component
   ```

### Cross-Component Changes

For changes spanning multiple components:

1. **Branch all affected repos:**
   ```bash
   cd embeddenator-vsa && git checkout -b feat/new-feature
   cd ../embeddenator-io && git checkout -b feat/new-feature
   cd ../embeddenator && git checkout -b feat/new-feature
   ```

2. **Use local path dependencies:**
   ```bash
   cd embeddenator
   # Add [patch.crates-io] for affected components
   ```

3. **Develop and test iteratively:**
   ```bash
   cargo test --all
   ```

4. **Release in dependency order:**
   ```bash
   # 1. Release vsa (no deps)
   cd embeddenator-vsa && git tag v0.1.1 && git push origin main --tags
   
   # 2. Update io to use vsa v0.1.1, release
   cd ../embeddenator-io
   # Edit Cargo.toml: embeddenator-vsa tag = "v0.1.1"
   git tag v0.1.1 && git push origin main --tags
   
   # 3. Update core to use new component versions
   cd ../embeddenator
   # Edit Cargo.toml: update all component tags
   cargo update
   git commit -am "Update components: vsa v0.1.1, io v0.1.1"
   ```

## Testing Strategy

### Unit Tests (Per Component)
Each component has its own test suite:
```bash
cd embeddenator-vsa
cargo test
```

### Integration Tests (Core)
Core repo tests component interactions:
```bash
cd embeddenator
cargo test --test integration
```

### Contract Tests (embeddenator-contract-bench)
Validate API contracts between components:
```bash
cd embeddenator-contract-bench
cargo bench
```

### E2E Tests (Core)
Full pipeline tests with real engrams:
```bash
cd embeddenator
cargo test --test e2e
```

## Performance Considerations

### Build Times
- **Monolith:** ~3-5 minutes full rebuild
- **Components:** ~30s per component, ~2 minutes core (with caching)
- **Incremental:** 5-10s for single-component changes

### Binary Size
- **Core:** ~8MB (release, stripped)
- **Components (static link):** No overhead (no dynamic linking)
- **Docker image:** ~15MB (Alpine + musl binary)

### Runtime Performance
- **Zero overhead:** Component boundaries compile to direct function calls
- **LTO:** Link-time optimization across component boundaries
- **Inlining:** Compiler inlines across crate boundaries with LTO

## Future Plans

### Roadmap
- [ ] **v0.21.0:** Incremental engram updates (ADR-014)
- [ ] **v0.22.0:** Advanced retrieval algorithms (semantic search, clustering)
- [ ] **v1.0.0:** API stability guarantee, production-ready
- [ ] **Post-1.0:** Plugin system for user-defined components

### Component Additions (Planned)
- **embeddenator-compression:** Adaptive sparsity and compression
- **embeddenator-distributed:** Multi-node query distribution
- **embeddenator-ml:** Machine learning integration (embeddings, classifiers)
- **embeddenator-gpu:** CUDA/OpenCL acceleration for VSA operations

## References

- [ADR-002: Multi-Agent Workflow System]adr/ADR-002-multi-agent-workflow-system.md - Original component extraction rationale
- [ADR-005: Hologram Package Isolation]adr/ADR-005-hologram-package-isolation.md - Component boundary design
- [Shared Workflows Repository]https://github.com/tzervas/.github-workflows - Centralized CI/CD
- [Docker Registry]https://github.com/tzervas/embeddenator/pkgs/container/embeddenator - Container images

## Support

- **Issues:** Report component-specific issues in their respective repos
- **Discussions:** Use [embeddenator/discussions]https://github.com/tzervas/embeddenator/discussions for cross-component questions
- **Security:** See [SECURITY.md]../SECURITY.md for vulnerability reporting