# 80/20 Analysis: Gaps to v1.0 Readiness

## Executive Summary

**Goal**: Identify the 20% of work that delivers 80% of v1.0 readiness value.

**Critical Path**: 7 gaps that are blocking v1.0 release. Focus on these first.

## Top 7 Gaps (80% of v1 Value)

### 1. Receipt Canonicalization (URDNA2015 + SHA-256) ⚠️ CRITICAL
**Current**: SHA3-256 only  
**Required**: URDNA2015 canonicalization + SHA-256  
**Impact**: **HIGH** - Core requirement for receipts (Section 7.2)  
**Effort**: Medium (need URDNA2015 library + SHA-256)  
**Location**: `rust/knhk-lockchain/src/lib.rs`  
**80/20 Fix**: Add URDNA2015 canonicalization before SHA-256 hashing

### 2. AOT Compilation Guard ⚠️ CRITICAL
**Current**: Missing  
**Required**: AOT validation of IR before execution  
**Impact**: **HIGH** - Cannot enforce Chatman Constant at ingest (Section 1.2)  
**Effort**: Medium (new module, hook validation)  
**Location**: New module needed  
**80/20 Fix**: Basic IR validation that routes violations to cold path

### 3. Git Lockchain Integration ⚠️ CRITICAL
**Current**: In-memory Merkle trees only  
**Required**: Git-based immutable audit log  
**Impact**: **HIGH** - Core provenance requirement (Section 7.3)  
**Effort**: Medium (Git integration)  
**Location**: `rust/knhk-lockchain/src/lib.rs`  
**80/20 Fix**: Append receipts to Git repository, verify Merkle roots

### 4. OTEL Exporters ⚠️ HIGH
**Current**: Spans created but not exported  
**Required**: Export to OTEL collectors (OTLP/gRPC/HTTP)  
**Impact**: **MEDIUM** - Cannot observe production (Section 9.1)  
**Effort**: Low (use existing OTEL SDK exporters)  
**Location**: `rust/knhk-otel/src/lib.rs`  
**80/20 Fix**: Add OTLP exporter configuration

### 5. Real Connector Implementation (Kafka) ⚠️ HIGH
**Current**: Returns empty deltas  
**Required**: Fetch real Kafka messages  
**Impact**: **HIGH** - Cannot ingest real data (Section 5.2)  
**Effort**: Medium (rdkafka integration)  
**Location**: `rust/knhk-connectors/src/kafka.rs`  
**80/20 Fix**: Implement basic Kafka consumer with rdkafka

### 6. Cold Path SPARQL Engine (Minimal) ⚠️ MEDIUM
**Current**: Stub returning errors  
**Required**: Basic SPARQL query execution  
**Impact**: **MEDIUM** - Complex queries fail (Section 4.1)  
**Effort**: High (full SPARQL engine integration)  
**Location**: `erlang/knhk_rc/src/knhk_stubs.erl`  
**80/20 Fix**: Return routing to external SPARQL endpoint (stub with HTTP call)

### 7. O_sys Ontology (Basic) ⚠️ MEDIUM
**Current**: Hardcoded system logic  
**Required**: Hooks/guards defined as RDF  
**Impact**: **MEDIUM** - Violates ontology-driven requirement (Section 8)  
**Effort**: High (full O_sys implementation)  
**Location**: Missing  
**80/20 Fix**: Basic RDF file defining hook classes (knhk:Reflex, knhk:Hook)

## Lower Priority (20% of Value)

### 8-10. Erlang Stub Modules
- `knhk_unrdf`, `knhk_shapes`, `knhk_bus`, `knhk_repl`  
- **80/20**: Keep as stubs for v1, implement in v1.1

### 11. Schema Registry Real RDF Parsing
- **80/20**: Accept RDF strings, validate format, defer full parsing to v1.1

### 12. Invariant Registry Real SPARQL
- **80/20**: Accept SPARQL strings, defer execution to v1.1

### 13-15. Documentation & Examples
- **80/20**: Basic README examples, defer full guides to v1.1

## 80/20 Implementation Priority

**Week 1 (Core Blockers)**:
1. Receipt canonicalization (URDNA2015 + SHA-256)
2. AOT compilation guard
3. Git lockchain integration

**Week 2 (Integration)**:
4. OTEL exporters
5. Real Kafka connector
6. Cold path SPARQL stub (HTTP routing)

**Week 3 (Completeness)**:
7. Basic O_sys ontology RDF

**Defer to v1.1**:
- Full SPARQL/SHACL engine integration
- Real Salesforce connector
- Full O_sys implementation
- Erlang stub module implementations
- Comprehensive documentation

## Success Criteria

v1.0 is ready when:
- ✅ Receipts use URDNA2015 + SHA-256
- ✅ AOT guard validates IR before execution
- ✅ Lockchain commits to Git repository
- ✅ OTEL spans exported to collector
- ✅ Kafka connector fetches real messages
- ✅ Cold path routes to SPARQL endpoint
- ✅ Basic O_sys RDF defines hook classes

All other gaps can be addressed in v1.1+ without blocking v1.0 release.

