Protocol5 wiki

C# code standards for Protocol5 implementation work

These standards apply to new Protocol5 JustAnIota converter code and guide future UAI .NET implementation work. They are intentionally practical: readable types, stable interfaces, testable logic, repository abstraction, and public evidence for behavior.

Required rules

Baseline C# standards

Explicit types
Use explicit interface or concrete types. Do not use var in new JustAnIota C# files.
Interfaces first
Consumers depend on facade, service, repository, and adapter interfaces rather than concrete storage or AI providers.
POCO DTOs
Request and response objects stay simple, serializable, and free of repository, SQL, HTTP, or UI dependencies.
Automated tests
Every behavior slice gets unit or contract tests before it is treated as an implementation rule.

Facade

Keep the public surface narrow

External projects should call a facade such as IJustAnIotaConverterFacade. The facade coordinates logic and repositories, but callers never need to know whether the result came from SQL Server, LM Studio, or a cache.

Logic

Business rules stay out of repositories

Normalization, Unicode scalar handling, grapheme grouping, approximate weighting, score thresholds, and private-use rejection belong in logic services that can be tested without a database.

Repository

Storage is behind contracts

ADO.NET repositories implement interfaces with SQL Server vector commands, but application logic uses repository contracts and POCO values. Storage mechanics do not leak up the stack.

Quality

Tests define the contract

Contract tests should cover facade behavior, database-only mode, private-use rejection, SQL schema expectations, and source-style rules such as the JustAnIota no-var requirement.

Current enforcement

Rules already under test

RuleCurrent enforcementWhy it matters
No varJustAnIotaContractTests scans the new project source.Types remain visible in code review and in plain text tools.
Database-only gist modeFacade tests convert and round-trip from the public seed registry without an embedding provider.The seeded registry and later populated database can answer basic meaning queries without live AI.
No private-use symbolsLogic tests reject private-use scalar input for IOTA-1.Private-use profiles would become a hidden agreement and defeat the experiment.
SQL vector architectureSchema tests require vector columns, DiskANN index declarations, provenance fields, and no-private-use constraints.The repository keeps the SQL Server vector plan explicit and reviewable.
LM Studio adapterContract tests parse an OpenAI-compatible embedding response behind IEmbeddingProvider.Local AI remains optional and replaceable behind the same facade.

UAIX boundary: these are Protocol5 implementation standards. They do not define the normative UAI standard, which remains on UAIX.