feat(protocol): self-documenting schema and directive grammar#63
Open
c-ferrier wants to merge 1 commit into
Open
feat(protocol): self-documenting schema and directive grammar#63c-ferrier wants to merge 1 commit into
c-ferrier wants to merge 1 commit into
Conversation
edfa91c to
7d5bbcb
Compare
da277c0 to
4c65ad2
Compare
Re-architected the Lore Protocol from a property-based model to a generic, metadata-driven data engine. This transition unifies built-in and custom trailers into a single logical path where all data structures (LoreTrailers, CommitInput) are unified Record types mapped to readonly string arrays. By anchoring all protocol intelligence—including rebranding, case-normalization, validation, and merging rules—into a central Protocol service, the system achieves perfect structural symmetry while reducing specification changes to a single declarative step. Key Architectural Components: - Centralized Protocol Specification: Introduced an absolute Single Source of Truth (SSOT) in core-definitions.ts, enabling full protocol rebranding (e.g., to 'Fred-id') via a single constant change. - Strictly Hierarchical Import Structure: Established a clean, non-circular information flow from specification to types, constants, and services. - High-Fidelity Restoration: Faithfully preserved original design patterns (Strategy, Information Expert, Creator) and complex logic precision (multi-hint expiration, confirm-then-loop prompts) while implementing the flat data model. - Orthogonal Schema Model: Decoupled cardinality from validation rules, allowing for flexible definitions like multi-value enums and dynamic CLI flag registration. Lore-id: 1d3e207e Constraint: All trailer data must be stored internally as readonly string[] for structural uniformity Constraint: The Protocol service must remain the single source of truth for all protocol semantics Constraint: JSON output must derive structural keys from protocol metadata at the edge Constraint: Infrastructure constants and domain types must be derived from the core specification Rejected: Hardcoded property-based model | Rigid and required redundant maintenance for every new trailer Rejected: Class-based inheritance for trailers | Excessive complexity compared to metadata-driven dynamic Records Rejected: Loose utility refactoring | Initially clobbered multi-line logic; restored with faithful while-loop precision Directive: [until:2026-12] Monitor performance of dynamic Record access in large repositories (>10k atoms) Directive: [on:squash] Carry forward architecturalRationale constraints even when removing intermediate atom IDs Tested: 460 unit tests passed (expanded from 424 in main branch baseline) Tested: Verified rebranding capability via 'Fred Test' (Git trailers & JSON synchronization) Tested: Verified unified requiredness logic and case-insensitive CLI flag mapping Tested: Manual audit of structural fidelity for all core services against main Tested: Verified 1-step spec extension workflow via src/util/core-definitions.ts Confidence: high Scope-risk: moderate Reversibility: clean Assisted-by: Gemini:CLI [lore-protocol]
b7ff48d to
5d08d53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Transforms Lore from a static convention into a runtime-discoverable knowledge protocol. By formalizing Core and Custom trailer definitions with types, patterns, and operational directives, the CLI now acts as a schema registry for both humans and AI agents.
Key Architectural Shifts:
lore configcommand exposes the full protocol schema.[trigger:parameter]directives for operational rules.multivalue) from content validation (options,pattern), enabling complex types like multi-value enums.permissivemode for hybrid schema enforcement.Usage Examples (
.lore/config.toml)1. Multi-Value Enum (Select many from list)
Allows selecting multiple values from a fixed list.
2. Standardizing Attribution (
Co-authored-by)Enforce Git-standard formatting and provide automated squash instructions.
3. Mandatory Unique IDs (
Ticket-Id)4. Team-Specific Rules
🔍 Self-Documenting Core Protocol
The native Lore Protocol trailers (Lore-id, Confidence, etc.) now use this same orthogonal model and are discoverable via
lore config --core.Example of what an agent sees for
Lore-id: