From b5c5cd7c94e1ae236fad6ed3d3b3b18a082ca7f7 Mon Sep 17 00:00:00 2001 From: axiomlogicnexus Date: Thu, 28 May 2026 18:56:48 +0200 Subject: [PATCH] Implement Phase 6R-M5 knowledge and notes --- .../HyperTwistContractLibrary.cpp | 60 +++ .../HyperTwistMemoryCoreLibrary.cpp | 488 ++++++++++++++++++ .../HyperTwistContractLibrary.h | 14 + .../HyperTwistMemoryCoreLibrary.h | 7 + .../HyperTwistMemory/HyperTwistMemoryTypes.h | 294 +++++++++++ ...oryPhase6RM5KnowledgeNotesContractTest.cpp | 202 ++++++++ ..._NOTES_IMPLEMENTATION_PACKET_2026-05-28.md | 137 +++++ ...AND_NOTES_PREPARATION_PACKET_2026-05-28.md | 121 +++++ ...PERTWIST_IMPLEMENTATION_PHASE_1_KICKOFF.md | 4 +- ...HASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md | 9 +- .../HyperTwist/ARCHITECTURE.md | 2 + .../HyperTwist/FEATURE_REGISTRY.md | 3 +- .../HyperTwist/PROVENANCE_AND_TRUST_MODEL.md | 3 +- .../HyperTwist/ROADMAP.md | 8 +- 14 files changed, 1346 insertions(+), 6 deletions(-) create mode 100644 UnrealHyperTwist/Source/UnrealHyperTwist/Tests/HyperTwistMemoryPhase6RM5KnowledgeNotesContractTest.cpp create mode 100644 docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_IMPLEMENTATION_PACKET_2026-05-28.md create mode 100644 docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_PREPARATION_PACKET_2026-05-28.md diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistBootstrap/HyperTwistContractLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistBootstrap/HyperTwistContractLibrary.cpp index 2a5e262..833decf 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistBootstrap/HyperTwistContractLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistBootstrap/HyperTwistContractLibrary.cpp @@ -3828,6 +3828,46 @@ FHyperTwistMemoryCognitiveConsolidationState ); } +FHyperTwistMemoryKnowledgeNotesState + UHyperTwistContractLibrary::MakeSampleTrainingMemoryKnowledgeNotesState() +{ + FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState(); + RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState); + + const FHyperTwistCoachBrief FollowUpBrief = MakeSampleTrainingCoachFollowUpBrief(); + const FHyperTwistTrainingCoachActionPlan FollowUpPlan = + UHyperTwistTrainingRepositoryLibrary::BuildCoachActionPlan( + FollowUpBrief, + MakeSampleTrainingCoachMemorySnapshot(), + TEXT("coach_follow_up_training_session_02"), + TEXT("2026-04-28T12:20:00Z"), + 0, + 0, + FString(), + FollowUpBrief.FocusCaseIds + ); + if (FollowUpPlan.IsStructurallyValid()) + { + RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertCoachActionPlan( + RepositoryState, + FollowUpPlan + ); + } + + const FString UserId = + HyperTwistContractLibraryInternal::ResolveSampleRepositoryUserId(RepositoryState); + if (UserId.IsEmpty()) + { + return FHyperTwistMemoryKnowledgeNotesState(); + } + + return UHyperTwistMemoryCoreLibrary::DeriveMemoryKnowledgeNotesState( + RepositoryState, + UserId, + TEXT("2026-04-28T12:40:00Z") + ); +} + FHyperTwistTrainingRepositoryIntegrityReport UHyperTwistContractLibrary::MakeSampleTrainingRepositoryIntegrityReport() { FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState(); @@ -4919,6 +4959,15 @@ FString UHyperTwistContractLibrary::SerializeMemoryCognitiveConsolidationStateTo ); } +FString UHyperTwistContractLibrary::SerializeMemoryKnowledgeNotesStateToJson( + const FHyperTwistMemoryKnowledgeNotesState& KnowledgeNotesState +) +{ + return HyperTwistContractLibraryInternal::SerializeStructToJson( + KnowledgeNotesState + ); +} + FString UHyperTwistContractLibrary::SerializeTrainingTimerExportPacketToJson( const FHyperTwistTrainingTimerExportPacket& TimerExportPacket ) @@ -5019,6 +5068,17 @@ bool UHyperTwistContractLibrary::DeserializeMemoryCognitiveConsolidationStateFro ); } +bool UHyperTwistContractLibrary::DeserializeMemoryKnowledgeNotesStateFromJson( + const FString& Json, + FHyperTwistMemoryKnowledgeNotesState& OutKnowledgeNotesState +) +{ + return HyperTwistContractLibraryInternal::DeserializeStructFromJson( + Json, + OutKnowledgeNotesState + ); +} + bool UHyperTwistContractLibrary::DeserializeTrainingTimerExportPacketFromJson( const FString& Json, FHyperTwistTrainingTimerExportPacket& OutTimerExportPacket diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistMemory/HyperTwistMemoryCoreLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistMemory/HyperTwistMemoryCoreLibrary.cpp index 4c48ae1..3c47b65 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistMemory/HyperTwistMemoryCoreLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistMemory/HyperTwistMemoryCoreLibrary.cpp @@ -1,5 +1,6 @@ #include "HyperTwistMemory/HyperTwistMemoryCoreLibrary.h" +#include "HyperTwistTraining/HyperTwistTrainingKnowledgeLibrary.h" #include "HyperTwistTraining/HyperTwistTrainingRepositoryLibrary.h" namespace HyperTwistMemoryCoreLibraryInternal @@ -3991,3 +3992,490 @@ FHyperTwistMemoryCognitiveConsolidationState return CognitiveState; } + +FHyperTwistMemoryKnowledgeNotesState + UHyperTwistMemoryCoreLibrary::DeriveMemoryKnowledgeNotesState( + const FHyperTwistTrainingRepositoryState& RepositoryState, + const FString& UserId, + const FString& ReferenceUtc + ) +{ + FHyperTwistMemoryKnowledgeNotesState KnowledgeNotesState; + if (UserId.IsEmpty()) + { + return KnowledgeNotesState; + } + + const FString ResolvedReferenceUtc = + HyperTwistMemoryCoreLibraryInternal::ResolveReferenceUtc(ReferenceUtc); + KnowledgeNotesState.UserId = UserId; + KnowledgeNotesState.ReferenceUtc = ResolvedReferenceUtc; + + const FHyperTwistMemoryLedgerState MemoryLedgerState = DeriveMemoryLedgerState( + RepositoryState, + UserId, + ResolvedReferenceUtc + ); + const FHyperTwistMemoryCognitiveConsolidationState CognitiveState = + DeriveMemoryCognitiveConsolidationState( + RepositoryState, + UserId, + ResolvedReferenceUtc + ); + const FHyperTwistTrainingKnowledgeReferenceBundle KnowledgeBundle = + UHyperTwistTrainingKnowledgeLibrary::MakeHypercubingKnowledgeReferenceBundle(); + + if (!KnowledgeBundle.IsStructurallyValid()) + { + return FHyperTwistMemoryKnowledgeNotesState(); + } + + TMap LedgerEntitiesById; + for (const FHyperTwistMemoryEntityDescriptor& Entity : MemoryLedgerState.Entities) + { + LedgerEntitiesById.Add(Entity.EntityId, Entity); + } + + const FHyperTwistMemoryLaneContract* KnowledgeLaneContract = + MemoryLedgerState.LaneContracts.FindByPredicate( + [](const FHyperTwistMemoryLaneContract& LaneContract) + { + return LaneContract.Lane == EHyperTwistMemoryLane::KnowledgeWiki; + } + ); + const FHyperTwistMemoryLaneContract* UserNotesLaneContract = + MemoryLedgerState.LaneContracts.FindByPredicate( + [](const FHyperTwistMemoryLaneContract& LaneContract) + { + return LaneContract.Lane == EHyperTwistMemoryLane::UserNotes; + } + ); + const FHyperTwistMemoryFeatureGate* KnowledgeGate = + MemoryLedgerState.FeatureGates.FindByPredicate( + [](const FHyperTwistMemoryFeatureGate& FeatureGate) + { + return FeatureGate.Lane == EHyperTwistMemoryLane::KnowledgeWiki; + } + ); + const FHyperTwistMemoryFeatureGate* UserNotesGate = + MemoryLedgerState.FeatureGates.FindByPredicate( + [](const FHyperTwistMemoryFeatureGate& FeatureGate) + { + return FeatureGate.Lane == EHyperTwistMemoryLane::UserNotes; + } + ); + const FHyperTwistMemoryEntityDescriptor* PolicyEntity = + MemoryLedgerState.Entities.FindByPredicate( + [](const FHyperTwistMemoryEntityDescriptor& Entity) + { + return Entity.RecordKind == TEXT("memory-policy-profile"); + } + ); + const FHyperTwistMemoryEntityDescriptor* LedgerContractEntity = + MemoryLedgerState.Entities.FindByPredicate( + [](const FHyperTwistMemoryEntityDescriptor& Entity) + { + return Entity.RecordKind == TEXT("memory-ledger-contract"); + } + ); + + if (KnowledgeLaneContract == nullptr + || UserNotesLaneContract == nullptr + || KnowledgeGate == nullptr + || UserNotesGate == nullptr + || PolicyEntity == nullptr + || LedgerContractEntity == nullptr) + { + return FHyperTwistMemoryKnowledgeNotesState(); + } + + auto AddKnowledgeObject = + [&](const FHyperTwistMemoryKnowledgeObject& KnowledgeObject) + { + if (!KnowledgeObject.IsStructurallyValid() + || KnowledgeNotesState.KnowledgeObjects.ContainsByPredicate( + [&KnowledgeObject]( + const FHyperTwistMemoryKnowledgeObject& ExistingKnowledgeObject) + { + return ExistingKnowledgeObject.ObjectId == KnowledgeObject.ObjectId; + })) + { + return; + } + + KnowledgeNotesState.KnowledgeObjects.Add(KnowledgeObject); + }; + + auto AddPromotionReview = + [&](const FHyperTwistMemoryKnowledgePromotionReview& PromotionReview) + { + if (!PromotionReview.IsStructurallyValid() + || KnowledgeNotesState.PromotionReviews.ContainsByPredicate( + [&PromotionReview]( + const FHyperTwistMemoryKnowledgePromotionReview& ExistingReview) + { + return ExistingReview.ReviewId == PromotionReview.ReviewId; + })) + { + return; + } + + KnowledgeNotesState.PromotionReviews.Add(PromotionReview); + switch (PromotionReview.Decision) + { + case EHyperTwistMemoryKnowledgePromotionDecision::Approved: + ++KnowledgeNotesState.ApprovedPromotionCount; + break; + case EHyperTwistMemoryKnowledgePromotionDecision::Deferred: + ++KnowledgeNotesState.DeferredPromotionCount; + break; + case EHyperTwistMemoryKnowledgePromotionDecision::Blocked: + ++KnowledgeNotesState.BlockedPromotionCount; + break; + default: + break; + } + }; + + auto MakeSyntheticKnowledgeProvenance = + [&]( + const FString& ParentEntityId, + const FString& RecordKind, + const FString& SourceLabel, + const bool bParentAuthoritative) + { + FHyperTwistMemoryProvenanceLink ProvenanceLink; + ProvenanceLink.ParentEntityId = ParentEntityId; + ProvenanceLink.ParentLane = EHyperTwistMemoryLane::KnowledgeWiki; + ProvenanceLink.ParentRecordKind = RecordKind; + ProvenanceLink.ParentReferenceUtc = ResolvedReferenceUtc; + ProvenanceLink.ParentSourceLabel = SourceLabel; + ProvenanceLink.bParentAuthoritative = bParentAuthoritative; + return ProvenanceLink; + }; + + auto ComposeSourceLabel = + [](const FHyperTwistTrainingSourceAttribution& SourceAttribution) + { + if (!SourceAttribution.SourceTrackId.IsEmpty()) + { + return FString::Printf( + TEXT("%s:%s"), + *SourceAttribution.SourceRepo, + *SourceAttribution.SourceTrackId + ); + } + + return SourceAttribution.SourceRepo; + }; + + auto InitializeKnowledgeObject = + [&]( + const FString& ObjectId, + const FString& ObjectKind, + const FString& Title, + const FString& Summary, + const FString& ScopeLabel, + const TArray& SourceRecordIds, + const TArray& Tags) + { + FHyperTwistMemoryKnowledgeObject KnowledgeObject; + KnowledgeObject.ObjectId = ObjectId; + KnowledgeObject.ObjectKind = ObjectKind; + KnowledgeObject.Title = Title; + KnowledgeObject.Summary = Summary; + KnowledgeObject.UserId = UserId; + KnowledgeObject.ReferenceUtc = ResolvedReferenceUtc; + KnowledgeObject.ScopeLabel = ScopeLabel; + KnowledgeObject.SourceRecordIds = SourceRecordIds; + KnowledgeObject.Tags = Tags; + return KnowledgeObject; + }; + + auto AppendAttributionKnowledgeObject = + [&]( + FHyperTwistMemoryKnowledgeObject& KnowledgeObject, + const FString& SourceId, + const FString& RecordKind, + const FHyperTwistTrainingSourceAttribution& SourceAttribution) + { + HyperTwistMemoryCoreLibraryInternal::AddUniqueProvenanceLink( + KnowledgeObject.ProvenanceLinks, + MakeSyntheticKnowledgeProvenance( + SourceId, + RecordKind, + ComposeSourceLabel(SourceAttribution), + true + ) + ); + }; + + for (const FHyperTwistTrainingKnowledgeTaxonomyNode& Node : KnowledgeBundle.TaxonomyNodes) + { + if (!Node.IsStructurallyValid()) + { + continue; + } + + FHyperTwistMemoryKnowledgeObject KnowledgeObject = InitializeKnowledgeObject( + FString::Printf(TEXT("memory-knowledge-object/taxonomy/%s/%s"), *UserId, *Node.NodeId), + TEXT("taxonomy-node"), + Node.Title, + Node.Summary, + TEXT("curated-reference"), + {Node.NodeId}, + Node.Tags + ); + AppendAttributionKnowledgeObject( + KnowledgeObject, + FString::Printf(TEXT("knowledge-source/taxonomy/%s"), *Node.NodeId), + TEXT("training-knowledge-taxonomy-node"), + Node.SourceAttribution + ); + AddKnowledgeObject(KnowledgeObject); + } + + for (const FHyperTwistTrainingNotationReferenceTerm& Term : KnowledgeBundle.NotationTerms) + { + if (!Term.IsStructurallyValid()) + { + continue; + } + + FHyperTwistMemoryKnowledgeObject KnowledgeObject = InitializeKnowledgeObject( + FString::Printf(TEXT("memory-knowledge-object/notation/%s/%s"), *UserId, *Term.TermId), + TEXT("notation-term"), + Term.DisplayTerm, + Term.Meaning, + TEXT("curated-reference"), + {Term.TermId}, + Term.Tags + ); + AppendAttributionKnowledgeObject( + KnowledgeObject, + FString::Printf(TEXT("knowledge-source/notation/%s"), *Term.TermId), + TEXT("training-knowledge-notation-term"), + Term.SourceAttribution + ); + AddKnowledgeObject(KnowledgeObject); + } + + for (const FHyperTwistTrainingProgressionStageReference& Stage : + KnowledgeBundle.ProgressionStages) + { + if (!Stage.IsStructurallyValid()) + { + continue; + } + + FHyperTwistMemoryKnowledgeObject KnowledgeObject = InitializeKnowledgeObject( + FString::Printf(TEXT("memory-knowledge-object/progression/%s/%s"), *UserId, *Stage.StageId), + TEXT("progression-stage"), + Stage.Title, + Stage.Summary, + TEXT("curated-reference"), + {Stage.StageId}, + Stage.Tags + ); + AppendAttributionKnowledgeObject( + KnowledgeObject, + FString::Printf(TEXT("knowledge-source/progression/%s"), *Stage.StageId), + TEXT("training-knowledge-progression-stage"), + Stage.SourceAttribution + ); + AddKnowledgeObject(KnowledgeObject); + } + + for (const FHyperTwistTrainingSoftwareReference& Reference : + KnowledgeBundle.SoftwareReferences) + { + if (!Reference.IsStructurallyValid()) + { + continue; + } + + FHyperTwistMemoryKnowledgeObject KnowledgeObject = InitializeKnowledgeObject( + FString::Printf(TEXT("memory-knowledge-object/software/%s/%s"), *UserId, *Reference.SoftwareId), + TEXT("software-reference"), + Reference.Title, + Reference.Summary, + TEXT("curated-reference"), + {Reference.SoftwareId}, + Reference.CapabilityTags + ); + for (const FString& PlatformTag : Reference.PlatformTags) + { + HyperTwistMemoryCoreLibraryInternal::AddUniqueString( + KnowledgeObject.Tags, + PlatformTag + ); + } + AppendAttributionKnowledgeObject( + KnowledgeObject, + FString::Printf(TEXT("knowledge-source/software/%s"), *Reference.SoftwareId), + TEXT("training-knowledge-software-reference"), + Reference.SourceAttribution + ); + AddKnowledgeObject(KnowledgeObject); + } + + for (const FHyperTwistTrainingLeaderboardEventReference& Event : + KnowledgeBundle.LeaderboardEvents) + { + if (!Event.IsStructurallyValid()) + { + continue; + } + + FHyperTwistMemoryKnowledgeObject KnowledgeObject = InitializeKnowledgeObject( + FString::Printf(TEXT("memory-knowledge-object/leaderboard/%s/%s"), *UserId, *Event.EventId), + TEXT("leaderboard-event"), + Event.Title, + Event.MetricLabel, + TEXT("curated-reference"), + {Event.EventId}, + Event.Tags + ); + AppendAttributionKnowledgeObject( + KnowledgeObject, + FString::Printf(TEXT("knowledge-source/leaderboard/%s"), *Event.EventId), + TEXT("training-knowledge-leaderboard-event"), + Event.SourceAttribution + ); + AddKnowledgeObject(KnowledgeObject); + } + + KnowledgeNotesState.CuratedReferenceObjectCount = + KnowledgeNotesState.KnowledgeObjects.Num(); + + for (const FHyperTwistMemoryCognitiveFact& Fact : CognitiveState.Facts) + { + FHyperTwistMemoryKnowledgePromotionReview PromotionReview; + PromotionReview.ReviewId = FString::Printf( + TEXT("memory-knowledge-review/%s/%s"), + *UserId, + *Fact.FactId + ); + PromotionReview.CandidateFactId = Fact.FactId; + PromotionReview.ProposedKnowledgeObjectId = FString::Printf( + TEXT("memory-knowledge-object/promoted/%s/%s"), + *UserId, + *Fact.FactId + ); + PromotionReview.UserId = UserId; + PromotionReview.ReferenceUtc = ResolvedReferenceUtc; + PromotionReview.Headline = Fact.Headline; + PromotionReview.ProvenanceLinks = Fact.ProvenanceLinks; + + if (!Fact.SupersededByFactId.IsEmpty()) + { + PromotionReview.Decision = + EHyperTwistMemoryKnowledgePromotionDecision::Blocked; + PromotionReview.ReasonLabel = + TEXT("Superseded cognitive facts cannot promote into curated knowledge until a newer reviewed conclusion stabilizes."); + PromotionReview.bNeedsManualReview = true; + } + else if (Fact.ContradictionIds.Num() > 0 || Fact.bRequiresReview) + { + PromotionReview.Decision = + EHyperTwistMemoryKnowledgePromotionDecision::Blocked; + PromotionReview.ReasonLabel = + TEXT("Contradicted or review-marked cognitive facts must remain reviewable instead of promoting silently."); + PromotionReview.bNeedsManualReview = true; + PromotionReview.BlockingContradictionIds = Fact.ContradictionIds; + } + else if (!Fact.bActive || Fact.ConfidenceScore < 70) + { + PromotionReview.Decision = + EHyperTwistMemoryKnowledgePromotionDecision::Deferred; + PromotionReview.ReasonLabel = + TEXT("Cognitive facts below the promotion threshold stay deferred until confidence and active posture are stronger."); + } + else + { + PromotionReview.Decision = + EHyperTwistMemoryKnowledgePromotionDecision::Approved; + PromotionReview.ReasonLabel = + TEXT("Stable high-confidence cognitive facts may promote into reviewable first-party knowledge."); + + FHyperTwistMemoryKnowledgeObject KnowledgeObject = InitializeKnowledgeObject( + PromotionReview.ProposedKnowledgeObjectId, + TEXT("promoted-cognitive-insight"), + Fact.Headline, + Fact.SummaryLine, + TEXT("promoted-memory-knowledge"), + {Fact.FactId}, + {Fact.FactFamily, TEXT("memory-promotion")} + ); + for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : Fact.ProvenanceLinks) + { + HyperTwistMemoryCoreLibraryInternal::AddUniqueProvenanceLink( + KnowledgeObject.ProvenanceLinks, + ProvenanceLink + ); + } + AddKnowledgeObject(KnowledgeObject); + } + + AddPromotionReview(PromotionReview); + } + + KnowledgeNotesState.bKnowledgeWikiEnabled = + KnowledgeGate->DefaultState != + EHyperTwistMemoryFeatureGateDefaultState::DisabledByDefault; + + KnowledgeNotesState.UserNotesPosture.UserId = UserId; + KnowledgeNotesState.UserNotesPosture.ReferenceUtc = ResolvedReferenceUtc; + KnowledgeNotesState.UserNotesPosture.GateId = UserNotesGate->GateId; + KnowledgeNotesState.UserNotesPosture.SettingsKey = UserNotesGate->SettingsKey; + KnowledgeNotesState.UserNotesPosture.bOwnershipJustified = + UserNotesLaneContract->bFirstPartyOwned; + KnowledgeNotesState.UserNotesPosture.bLaneEnabled = + UserNotesGate->DefaultState != + EHyperTwistMemoryFeatureGateDefaultState::DisabledByDefault; + KnowledgeNotesState.UserNotesPosture.bAcceptsUserAuthoredContent = + KnowledgeNotesState.UserNotesPosture.bOwnershipJustified + && KnowledgeNotesState.UserNotesPosture.bLaneEnabled; + KnowledgeNotesState.UserNotesPosture.bRequiresSeparateOwnerActivation = + !KnowledgeNotesState.UserNotesPosture.bAcceptsUserAuthoredContent; + + if (KnowledgeNotesState.UserNotesPosture.bAcceptsUserAuthoredContent) + { + KnowledgeNotesState.UserNotesPosture.Headline = + TEXT("User-authored note lane is active"); + KnowledgeNotesState.UserNotesPosture.SummaryLine = + TEXT("User-authored notes are explicitly owned, enabled, and may participate in the bounded memory lane."); + } + else + { + KnowledgeNotesState.UserNotesPosture.Headline = + TEXT("User-authored note lane remains separately gated"); + KnowledgeNotesState.UserNotesPosture.SummaryLine = + TEXT("User-authored notes stay disabled until explicit first-party ownership and activation are proven."); + } + + HyperTwistMemoryCoreLibraryInternal::TryAppendEntityProvenance( + LedgerEntitiesById, + PolicyEntity->EntityId, + TEXT("user-notes-policy"), + KnowledgeNotesState.UserNotesPosture.ProvenanceLinks + ); + HyperTwistMemoryCoreLibraryInternal::TryAppendEntityProvenance( + LedgerEntitiesById, + LedgerContractEntity->EntityId, + TEXT("user-notes-ledger"), + KnowledgeNotesState.UserNotesPosture.ProvenanceLinks + ); + + KnowledgeNotesState.bUserNotesLaneAvailable = + KnowledgeNotesState.UserNotesPosture.bOwnershipJustified + && KnowledgeNotesState.UserNotesPosture.bLaneEnabled + && KnowledgeNotesState.UserNotesPosture.bAcceptsUserAuthoredContent; + + if (!KnowledgeNotesState.IsStructurallyValid()) + { + return FHyperTwistMemoryKnowledgeNotesState(); + } + + return KnowledgeNotesState; +} diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistBootstrap/HyperTwistContractLibrary.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistBootstrap/HyperTwistContractLibrary.h index 29ca017..d96094b 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistBootstrap/HyperTwistContractLibrary.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistBootstrap/HyperTwistContractLibrary.h @@ -157,6 +157,9 @@ public: static FHyperTwistMemoryCognitiveConsolidationState MakeSampleTrainingMemoryCognitiveConsolidationState(); + UFUNCTION(BlueprintPure, Category = "HyperTwist|Memory") + static FHyperTwistMemoryKnowledgeNotesState MakeSampleTrainingMemoryKnowledgeNotesState(); + UFUNCTION(BlueprintPure, Category = "HyperTwist|Training") static FHyperTwistTrainingRepositoryIntegrityReport MakeSampleTrainingRepositoryIntegrityReport(); @@ -336,6 +339,11 @@ public: const FHyperTwistMemoryCognitiveConsolidationState& CognitiveConsolidationState ); + UFUNCTION(BlueprintPure, Category = "HyperTwist|Serialization") + static FString SerializeMemoryKnowledgeNotesStateToJson( + const FHyperTwistMemoryKnowledgeNotesState& KnowledgeNotesState + ); + UFUNCTION(BlueprintPure, Category = "HyperTwist|Serialization") static FString SerializeTrainingTimerExportPacketToJson(const FHyperTwistTrainingTimerExportPacket& TimerExportPacket); @@ -396,6 +404,12 @@ public: FHyperTwistMemoryCognitiveConsolidationState& OutCognitiveConsolidationState ); + UFUNCTION(BlueprintCallable, Category = "HyperTwist|Serialization") + static bool DeserializeMemoryKnowledgeNotesStateFromJson( + const FString& Json, + FHyperTwistMemoryKnowledgeNotesState& OutKnowledgeNotesState + ); + UFUNCTION(BlueprintCallable, Category = "HyperTwist|Serialization") static bool DeserializeTrainingTimerExportPacketFromJson(const FString& Json, FHyperTwistTrainingTimerExportPacket& OutTimerExportPacket); }; diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryCoreLibrary.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryCoreLibrary.h index 864087a..1cc6b5a 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryCoreLibrary.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryCoreLibrary.h @@ -40,4 +40,11 @@ public: const FString& UserId, const FString& ReferenceUtc ); + + UFUNCTION(BlueprintPure, Category = "HyperTwist|Memory") + static FHyperTwistMemoryKnowledgeNotesState DeriveMemoryKnowledgeNotesState( + const FHyperTwistTrainingRepositoryState& RepositoryState, + const FString& UserId, + const FString& ReferenceUtc + ); }; diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryTypes.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryTypes.h index c899ffa..c7b613e 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryTypes.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistMemory/HyperTwistMemoryTypes.h @@ -47,6 +47,15 @@ enum class EHyperTwistMemoryContextAssemblyProfile : uint8 MaxRetentionMode UMETA(DisplayName = "Max-Retention Mode") }; +UENUM(BlueprintType) +enum class EHyperTwistMemoryKnowledgePromotionDecision : uint8 +{ + None UMETA(DisplayName = "None"), + Approved UMETA(DisplayName = "Approved"), + Deferred UMETA(DisplayName = "Deferred"), + Blocked UMETA(DisplayName = "Blocked") +}; + UENUM(BlueprintType) enum class EHyperTwistMemoryContinuityGuardSeverity : uint8 { @@ -1515,3 +1524,288 @@ struct FHyperTwistMemoryCognitiveConsolidationState && bHasOpenCognitiveReview == bComputedOpenCognitiveReview; } }; + +USTRUCT(BlueprintType) +struct FHyperTwistMemoryKnowledgeObject +{ + GENERATED_BODY() + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ObjectId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ObjectKind; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString Title; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString Summary; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString UserId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ReferenceUtc; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + EHyperTwistMemoryLane Lane = EHyperTwistMemoryLane::KnowledgeWiki; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + EHyperTwistMemoryAuthorityKind AuthorityKind = + EHyperTwistMemoryAuthorityKind::Authoritative; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ScopeLabel; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray SourceRecordIds; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray Tags; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray ProvenanceLinks; + + bool IsStructurallyValid() const + { + if (ObjectId.IsEmpty() + || ObjectKind.IsEmpty() + || Title.IsEmpty() + || Summary.IsEmpty() + || UserId.IsEmpty() + || ReferenceUtc.IsEmpty() + || Lane != EHyperTwistMemoryLane::KnowledgeWiki + || AuthorityKind != EHyperTwistMemoryAuthorityKind::Authoritative + || ScopeLabel.IsEmpty() + || SourceRecordIds.Num() == 0 + || ProvenanceLinks.Num() == 0) + { + return false; + } + + for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks) + { + if (!ProvenanceLink.IsStructurallyValid()) + { + return false; + } + } + + return true; + } +}; + +USTRUCT(BlueprintType) +struct FHyperTwistMemoryKnowledgePromotionReview +{ + GENERATED_BODY() + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ReviewId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString CandidateFactId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ProposedKnowledgeObjectId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString UserId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ReferenceUtc; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString Headline; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + EHyperTwistMemoryKnowledgePromotionDecision Decision = + EHyperTwistMemoryKnowledgePromotionDecision::None; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ReasonLabel; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + bool bNeedsManualReview = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray BlockingContradictionIds; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray ProvenanceLinks; + + bool IsStructurallyValid() const + { + if (ReviewId.IsEmpty() + || CandidateFactId.IsEmpty() + || UserId.IsEmpty() + || ReferenceUtc.IsEmpty() + || Headline.IsEmpty() + || Decision == EHyperTwistMemoryKnowledgePromotionDecision::None + || ReasonLabel.IsEmpty() + || ProvenanceLinks.Num() == 0) + { + return false; + } + + for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks) + { + if (!ProvenanceLink.IsStructurallyValid()) + { + return false; + } + } + + return true; + } +}; + +USTRUCT(BlueprintType) +struct FHyperTwistMemoryUserNotesPosture +{ + GENERATED_BODY() + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString UserId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ReferenceUtc; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + EHyperTwistMemoryLane Lane = EHyperTwistMemoryLane::UserNotes; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString GateId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString SettingsKey; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString Headline; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString SummaryLine; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + bool bOwnershipJustified = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + bool bLaneEnabled = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + bool bAcceptsUserAuthoredContent = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + bool bRequiresSeparateOwnerActivation = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray ProvenanceLinks; + + bool IsStructurallyValid() const + { + if (UserId.IsEmpty() + || ReferenceUtc.IsEmpty() + || Lane != EHyperTwistMemoryLane::UserNotes + || GateId.IsEmpty() + || SettingsKey.IsEmpty() + || Headline.IsEmpty() + || SummaryLine.IsEmpty() + || ProvenanceLinks.Num() == 0) + { + return false; + } + + for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks) + { + if (!ProvenanceLink.IsStructurallyValid()) + { + return false; + } + } + + return bAcceptsUserAuthoredContent + ? (bOwnershipJustified && bLaneEnabled) + : true; + } +}; + +USTRUCT(BlueprintType) +struct FHyperTwistMemoryKnowledgeNotesState +{ + GENERATED_BODY() + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString UserId; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FString ReferenceUtc; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray KnowledgeObjects; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + TArray PromotionReviews; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + FHyperTwistMemoryUserNotesPosture UserNotesPosture; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + int32 CuratedReferenceObjectCount = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + int32 ApprovedPromotionCount = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + int32 DeferredPromotionCount = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + int32 BlockedPromotionCount = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + bool bKnowledgeWikiEnabled = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") + bool bUserNotesLaneAvailable = false; + + bool IsStructurallyValid() const + { + if (UserId.IsEmpty() + || ReferenceUtc.IsEmpty() + || KnowledgeObjects.Num() == 0 + || !UserNotesPosture.IsStructurallyValid()) + { + return false; + } + + for (const FHyperTwistMemoryKnowledgeObject& KnowledgeObject : KnowledgeObjects) + { + if (!KnowledgeObject.IsStructurallyValid()) + { + return false; + } + } + + for (const FHyperTwistMemoryKnowledgePromotionReview& PromotionReview : + PromotionReviews) + { + if (!PromotionReview.IsStructurallyValid()) + { + return false; + } + } + + const int32 ComputedPromotionCount = + ApprovedPromotionCount + DeferredPromotionCount + BlockedPromotionCount; + const bool bComputedUserNotesLaneAvailable = + UserNotesPosture.bOwnershipJustified + && UserNotesPosture.bLaneEnabled + && UserNotesPosture.bAcceptsUserAuthoredContent; + + return CuratedReferenceObjectCount >= 0 + && CuratedReferenceObjectCount <= KnowledgeObjects.Num() + && ComputedPromotionCount == PromotionReviews.Num() + && bKnowledgeWikiEnabled + && bUserNotesLaneAvailable == bComputedUserNotesLaneAvailable; + } +}; diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Tests/HyperTwistMemoryPhase6RM5KnowledgeNotesContractTest.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Tests/HyperTwistMemoryPhase6RM5KnowledgeNotesContractTest.cpp new file mode 100644 index 0000000..6fad798 --- /dev/null +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Tests/HyperTwistMemoryPhase6RM5KnowledgeNotesContractTest.cpp @@ -0,0 +1,202 @@ +// Copyright HyperTwist, Inc. All Rights Reserved. + +#include "Misc/AutomationTest.h" + +#include "HyperTwistBootstrap/HyperTwistContractLibrary.h" + +#if WITH_AUTOMATION_TESTS + +namespace HyperTwistMemoryPhase6RM5TestInternal +{ + const FHyperTwistMemoryKnowledgeObject* FindKnowledgeObjectByKind( + const FHyperTwistMemoryKnowledgeNotesState& KnowledgeNotesState, + const FString& ObjectKind + ) + { + for (const FHyperTwistMemoryKnowledgeObject& KnowledgeObject : + KnowledgeNotesState.KnowledgeObjects) + { + if (KnowledgeObject.ObjectKind == ObjectKind) + { + return &KnowledgeObject; + } + } + + return nullptr; + } +} + +IMPLEMENT_SIMPLE_AUTOMATION_TEST( + FHyperTwistMemoryPhase6RM5KnowledgeObjectsTest, + "HyperTwist.FirstParty.Memory.Phase6R.M5.KnowledgeObjects", + EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter +) + +bool FHyperTwistMemoryPhase6RM5KnowledgeObjectsTest::RunTest(const FString& Parameters) +{ + const FHyperTwistMemoryKnowledgeNotesState KnowledgeNotesState = + UHyperTwistContractLibrary::MakeSampleTrainingMemoryKnowledgeNotesState(); + + TestTrue( + TEXT("The Phase 6R-M5 knowledge and notes state must be structurally valid."), + KnowledgeNotesState.IsStructurallyValid() + ); + TestTrue( + TEXT("The M5 state must expose knowledge objects."), + KnowledgeNotesState.KnowledgeObjects.Num() > 0 + ); + TestTrue( + TEXT("The M5 state must keep the knowledge lane enabled."), + KnowledgeNotesState.bKnowledgeWikiEnabled + ); + TestTrue( + TEXT("The M5 state must expose curated reference objects."), + KnowledgeNotesState.CuratedReferenceObjectCount > 0 + ); + + const FHyperTwistMemoryKnowledgeObject* TaxonomyObject = + HyperTwistMemoryPhase6RM5TestInternal::FindKnowledgeObjectByKind( + KnowledgeNotesState, + TEXT("taxonomy-node") + ); + TestNotNull(TEXT("A taxonomy-node knowledge object must exist."), TaxonomyObject); + if (TaxonomyObject != nullptr) + { + TestEqual( + TEXT("Knowledge objects must stay in the knowledge/wiki lane."), + TaxonomyObject->Lane, + EHyperTwistMemoryLane::KnowledgeWiki + ); + TestTrue( + TEXT("Knowledge objects must preserve provenance links."), + TaxonomyObject->ProvenanceLinks.Num() > 0 + ); + } + + return true; +} + +IMPLEMENT_SIMPLE_AUTOMATION_TEST( + FHyperTwistMemoryPhase6RM5PromotionAndNotesTest, + "HyperTwist.FirstParty.Memory.Phase6R.M5.PromotionAndNotes", + EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter +) + +bool FHyperTwistMemoryPhase6RM5PromotionAndNotesTest::RunTest(const FString& Parameters) +{ + const FHyperTwistMemoryKnowledgeNotesState KnowledgeNotesState = + UHyperTwistContractLibrary::MakeSampleTrainingMemoryKnowledgeNotesState(); + + TestTrue( + TEXT("The Phase 6R-M5 knowledge and notes state must be structurally valid."), + KnowledgeNotesState.IsStructurallyValid() + ); + TestTrue( + TEXT("The M5 state must expose reviewable promotion flows."), + KnowledgeNotesState.PromotionReviews.Num() > 0 + ); + TestTrue( + TEXT("The M5 state must approve at least one stable promotion."), + KnowledgeNotesState.ApprovedPromotionCount > 0 + ); + TestTrue( + TEXT("The M5 state must keep at least one promotion blocked or deferred for review safety."), + KnowledgeNotesState.BlockedPromotionCount > 0 + || KnowledgeNotesState.DeferredPromotionCount > 0 + ); + TestFalse( + TEXT("The M5 state must not silently claim an active user-authored note lane."), + KnowledgeNotesState.bUserNotesLaneAvailable + ); + TestFalse( + TEXT("The user-notes posture must keep direct user-authored capture disabled."), + KnowledgeNotesState.UserNotesPosture.bAcceptsUserAuthoredContent + ); + TestEqual( + TEXT("The user-notes posture must stay bound to the user-notes lane."), + KnowledgeNotesState.UserNotesPosture.Lane, + EHyperTwistMemoryLane::UserNotes + ); + TestEqual( + TEXT("The user-notes posture must point at the canonical user-notes gate."), + KnowledgeNotesState.UserNotesPosture.GateId, + TEXT("memory-gate/user-notes") + ); + + const FHyperTwistMemoryKnowledgeObject* PromotedInsightObject = + HyperTwistMemoryPhase6RM5TestInternal::FindKnowledgeObjectByKind( + KnowledgeNotesState, + TEXT("promoted-cognitive-insight") + ); + TestNotNull( + TEXT("An approved promoted-cognitive-insight object must exist."), + PromotedInsightObject + ); + + return true; +} + +IMPLEMENT_SIMPLE_AUTOMATION_TEST( + FHyperTwistMemoryPhase6RM5SerializationRoundTripTest, + "HyperTwist.FirstParty.Memory.Phase6R.M5.SerializationRoundTrip", + EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter +) + +bool FHyperTwistMemoryPhase6RM5SerializationRoundTripTest::RunTest( + const FString& Parameters +) +{ + const FHyperTwistMemoryKnowledgeNotesState KnowledgeNotesState = + UHyperTwistContractLibrary::MakeSampleTrainingMemoryKnowledgeNotesState(); + TestTrue( + TEXT("The Phase 6R-M5 knowledge and notes state must be structurally valid."), + KnowledgeNotesState.IsStructurallyValid() + ); + + const FString Json = + UHyperTwistContractLibrary::SerializeMemoryKnowledgeNotesStateToJson( + KnowledgeNotesState + ); + TestFalse(TEXT("The serialized M5 JSON must not be empty."), Json.IsEmpty()); + TestTrue( + TEXT("The serialized M5 JSON must expose user-notes posture."), + Json.Contains(TEXT("UserNotesPosture")) + ); + + FHyperTwistMemoryKnowledgeNotesState RoundTrippedState; + TestTrue( + TEXT("The M5 JSON must deserialize cleanly."), + UHyperTwistContractLibrary::DeserializeMemoryKnowledgeNotesStateFromJson( + Json, + RoundTrippedState + ) + ); + TestTrue( + TEXT("The round-tripped M5 state must remain structurally valid."), + RoundTrippedState.IsStructurallyValid() + ); + TestEqual( + TEXT("The round-tripped M5 state must preserve knowledge object counts."), + RoundTrippedState.KnowledgeObjects.Num(), + KnowledgeNotesState.KnowledgeObjects.Num() + ); + TestEqual( + TEXT("The round-tripped M5 state must preserve promotion-review counts."), + RoundTrippedState.PromotionReviews.Num(), + KnowledgeNotesState.PromotionReviews.Num() + ); + TestEqual( + TEXT("The round-tripped M5 state must preserve approved-promotion counts."), + RoundTrippedState.ApprovedPromotionCount, + KnowledgeNotesState.ApprovedPromotionCount + ); + TestEqual( + TEXT("The round-tripped M5 state must preserve blocked-promotion counts."), + RoundTrippedState.BlockedPromotionCount, + KnowledgeNotesState.BlockedPromotionCount + ); + + return true; +} + +#endif diff --git a/docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_IMPLEMENTATION_PACKET_2026-05-28.md b/docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_IMPLEMENTATION_PACKET_2026-05-28.md new file mode 100644 index 0000000..d5edc5a --- /dev/null +++ b/docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_IMPLEMENTATION_PACKET_2026-05-28.md @@ -0,0 +1,137 @@ +# HyperTwist Phase 6R-M5 first-party knowledge and notes implementation packet + +Created on `2026-05-28` + +## Status + +- first-party HyperTwist packet +- bounded `Phase 6R-M5` implementation slice + +## Purpose + +This packet lands the bounded first-party knowledge-promotion and note-posture +seam under the canonical `Memory Lanes` doctrine. + +The landed slice is: + +- curated knowledge objects +- reviewable promotion flows +- explicit user-notes posture and gate-state truth + +It is not: + +- a broad memory federation packet +- a replay of `6R-M1`, `6R-M2`, `6R-M3`, or `6R-M4` +- unrestricted user-authored note capture +- a compact reducer/digest packet + +## Current authority basis + +This implementation packet stands on: + +- `docs/ops/HYPERTWIST_MEMORY_LANE_AUTHORITY_AND_PHASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md` +- `docs/ops/HYPERTWIST_CONTINUITY_LATTICE_AND_CONTEXT_ASSEMBLY_PROFILE_DOCTRINE_2026-05-23.md` +- `docs/ops/HYPERTWIST_IMPLEMENTATION_PHASE_1_KICKOFF.md` +- `docs/v6_5_deep_manual_pack/HyperTwist/ARCHITECTURE.md` +- `docs/v6_5_deep_manual_pack/HyperTwist/FEATURE_REGISTRY.md` +- `docs/v6_5_deep_manual_pack/HyperTwist/PROVENANCE_AND_TRUST_MODEL.md` +- `docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_PREPARATION_PACKET_2026-05-28.md` + +The preserved owners do not change: + +- first-party HyperTwist remains the top-level owner for current curated + knowledge and note-posture product surfaces +- the landed `Phase 6R-M1` ledger remains the provenance substrate beneath this + packet +- the landed `Phase 6R-M2` chronicle/continuity layer remains the current + history/open-work substrate beneath this packet +- the landed `Phase 6R-M3` recall/shared-context layer remains the current + explicit retrieval and scoped-sharing substrate beneath this packet +- the landed `Phase 6R-M4` cognitive-consolidation layer remains the current + reviewable derived-conclusion substrate beneath this packet +- the first-party training knowledge bundle remains the current curated + knowledge substrate beneath this packet +- the VectorShell memory doctrine remains the external synchronization + entrypoint and authority map, not a frozen imported implementation + +## Landed scope + +The current code now owns a bounded first-party knowledge-promotion and +note-posture seam through: + +- canonical knowledge-object, promotion-review, user-notes-posture, and + knowledge/notes state types in: + - `HyperTwistMemoryTypes.h` +- first-party knowledge/notes derivation from current training repository state + over the already-landed `6R-M1`, `6R-M2`, `6R-M3`, and `6R-M4` seams plus the + current first-party training knowledge bundle in: + - `UHyperTwistMemoryCoreLibrary` +- current bounded curated knowledge coverage for: + - taxonomy nodes + - notation terms + - progression stages + - software references + - leaderboard events +- current bounded promotion-review coverage over landed cognitive facts through: + - explicit `Approved`, `Deferred`, and `Blocked` decisions + - provenance-preserving promotion records + - no silent promotion of contradicted or superseded facts +- current explicit user-notes posture coverage through: + - gate id and settings-key truth + - ownership-justified truth + - lane-availability truth + - explicit non-availability when ownership is not justified +- sample contract helpers in: + - `UHyperTwistContractLibrary::MakeSampleTrainingMemoryKnowledgeNotesState()` + - `UHyperTwistContractLibrary::SerializeMemoryKnowledgeNotesStateToJson(...)` + - `UHyperTwistContractLibrary::DeserializeMemoryKnowledgeNotesStateFromJson(...)` +- focused automation coverage in: + - `HyperTwistMemoryPhase6RM5KnowledgeNotesContractTest.cpp` + +## Why this is still intentionally bounded + +This packet lands curated knowledge objects, reviewable promotion flow, and +explicit note-lane posture only. + +Still deferred: + +- active user-authored note capture and persistence while ownership remains + unjustified +- compact summaries or digest views +- reducer packets or reduced-context federation + +## Validation + +Build validation: + +- `UnrealHyperTwistEditor Win64 Development` + +Focused automation validation: + +- `HyperTwist.FirstParty.Memory.Phase6R.M5.KnowledgeObjects` +- `HyperTwist.FirstParty.Memory.Phase6R.M5.PromotionAndNotes` +- `HyperTwist.FirstParty.Memory.Phase6R.M5.SerializationRoundTrip` + +Observed: + +- `3` focused `Phase 6R-M5` automation tests succeeded + +Non-blocking warnings stayed limited to the existing Unreal headless/editor +noise, expected Python-stub regeneration noise, headless CEF/web-browser +warnings, benign asset-registry/cache journal chatter during editor startup, +and a surfaced EOS SDK config-token-expiry warning during long headless runtime. + +## Queue effect + +This packet consumes the current `Phase 6R-M5` implementation slice. + +Memory implementation is now live at the curated knowledge-promotion and +explicit note-posture layer through bounded knowledge objects, promotion +reviews, and gate/ownership truth over the landed `6R-M1` ledger, `6R-M2` +chronicle/continuity, `6R-M3` recall/shared-context, and `6R-M4` cognitive +consolidation seams. + +If later memory implementation continues: + +- the next clean move is `Phase 6R-M6` +- do not reopen `6R-M5` as one broad "memory packet" diff --git a/docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_PREPARATION_PACKET_2026-05-28.md b/docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_PREPARATION_PACKET_2026-05-28.md new file mode 100644 index 0000000..f157713 --- /dev/null +++ b/docs/arch/HYPERTWIST_PHASE6R_M5_FIRST_PARTY_KNOWLEDGE_AND_NOTES_PREPARATION_PACKET_2026-05-28.md @@ -0,0 +1,121 @@ +# HyperTwist Phase 6R-M5 first-party knowledge and notes preparation packet + +Created on `2026-05-28` + +## Status + +- first-party HyperTwist packet +- source-backed `Phase 6R-M5` preparation/control slice + +## Purpose + +This packet scopes the fifth bounded first-party memory implementation slice +under the canonical `Memory Lanes` doctrine. + +The granted slice is: + +- curated knowledge objects +- reviewable promotion flows +- explicit user-notes posture and gate-state truth + +It is not: + +- a broad memory federation packet +- a replay of `6R-M1`, `6R-M2`, `6R-M3`, or `6R-M4` +- unrestricted user-authored note capture +- a compact reducer/digest packet + +## Current authority basis + +This control pass stands on: + +- `docs/ops/HYPERTWIST_MEMORY_LANE_AUTHORITY_AND_PHASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md` +- `docs/ops/HYPERTWIST_CONTINUITY_LATTICE_AND_CONTEXT_ASSEMBLY_PROFILE_DOCTRINE_2026-05-23.md` +- `docs/ops/HYPERTWIST_IMPLEMENTATION_PHASE_1_KICKOFF.md` +- `docs/v6_5_deep_manual_pack/HyperTwist/ARCHITECTURE.md` +- `docs/v6_5_deep_manual_pack/HyperTwist/FEATURE_REGISTRY.md` +- `docs/v6_5_deep_manual_pack/HyperTwist/PROVENANCE_AND_TRUST_MODEL.md` +- `docs/arch/HYPERTWIST_PHASE6R_M1_FIRST_PARTY_MEMORY_CONTRACTS_AND_LEDGER_IMPLEMENTATION_PACKET_2026-05-28.md` +- `docs/arch/HYPERTWIST_PHASE6R_M2_FIRST_PARTY_CHRONICLE_AND_CONTINUITY_IMPLEMENTATION_PACKET_2026-05-28.md` +- `docs/arch/HYPERTWIST_PHASE6R_M3_FIRST_PARTY_RECALL_AND_SHARED_CONTEXT_IMPLEMENTATION_PACKET_2026-05-28.md` +- `docs/arch/HYPERTWIST_PHASE6R_M4_FIRST_PARTY_COGNITIVE_CONSOLIDATION_IMPLEMENTATION_PACKET_2026-05-28.md` +- `docs/VECTORSHELL_MEMORY_SYSTEM_IMPORT_AUTHORITY_FOR_HYPERTWIST_2026-05-25.md` + +The preserved owners do not change here: + +- first-party HyperTwist remains the live owner for current curated knowledge + and note-posture product seams +- the landed `Phase 6R-M1` ledger remains the provenance substrate beneath this + packet +- the landed `Phase 6R-M2` chronicle/continuity layer remains the current + open-work and history substrate beneath this packet +- the landed `Phase 6R-M3` recall/shared-context layer remains the current + explicit retrieval and scoped-sharing substrate beneath this packet +- the landed `Phase 6R-M4` cognitive-consolidation layer remains the current + derived-conclusion substrate beneath this packet +- the first-party training knowledge bundle remains the current curated + knowledge substrate beneath this packet +- the VectorShell memory doctrine remains the external synchronization + entrypoint and authority map, not a frozen imported implementation + +## Granted family + +The bounded `Phase 6R-M5` slice may land: + +1. curated knowledge objects over current first-party training knowledge + evidence +2. reviewable promotion decisions over landed `6R-M4` cognitive facts +3. explicit user-notes posture and gate-state truth only if ownership remains + justified +4. sample contract and JSON round-trip coverage for the `6R-M5` state + +The packet must stay out of: + +- active user-authored note capture when ownership is not justified +- compact summaries or digest views +- reducer packets or reduced-context federation + +## Proposed implementation shape + +Land the narrower first-party boundary through: + +- new memory types for: + - curated knowledge objects + - knowledge-promotion reviews + - user-notes posture + - bounded knowledge/notes state +- a memory-core derivation function over: + - current repository state + - the landed `6R-M1` ledger + - the landed `6R-M2` chronicle/continuity layer + - the landed `6R-M3` recall/shared-context layer + - the landed `6R-M4` cognitive-consolidation layer + - the first-party training knowledge bundle +- sample-contract helpers for: + - sample knowledge/notes derivation + - JSON serialization + - JSON deserialization +- focused automation in: + - `HyperTwistMemoryPhase6RM5KnowledgeNotesContractTest.cpp` + +## Validation target + +Validate with: + +- Unreal build for `UnrealHyperTwistEditor Win64 Development` +- focused automation: + - `HyperTwist.FirstParty.Memory.Phase6R.M5.KnowledgeObjects` + - `HyperTwist.FirstParty.Memory.Phase6R.M5.PromotionAndNotes` + - `HyperTwist.FirstParty.Memory.Phase6R.M5.SerializationRoundTrip` + +## Queue effect + +If this packet lands cleanly, HyperTwist memory no longer stops at explicit +derived cognitive consolidation. The bounded first-party knowledge-promotion +and note-posture layer becomes current product truth above `6R-M1`, `6R-M2`, +`6R-M3`, and `6R-M4`. + +If later memory implementation continues: + +- the next clean move is `Phase 6R-M6` +- do not reopen `6R-M5` as one broad memory packet diff --git a/docs/ops/HYPERTWIST_IMPLEMENTATION_PHASE_1_KICKOFF.md b/docs/ops/HYPERTWIST_IMPLEMENTATION_PHASE_1_KICKOFF.md index edae78b..5dc8c8e 100644 --- a/docs/ops/HYPERTWIST_IMPLEMENTATION_PHASE_1_KICKOFF.md +++ b/docs/ops/HYPERTWIST_IMPLEMENTATION_PHASE_1_KICKOFF.md @@ -230,7 +230,9 @@ When HyperTwist later returns to memory implementation: landed in current code - the bounded first-party `Phase 6R-M4` cognitive consolidation packet is now landed in current code -- if memory implementation continues, the next clean move is `Phase 6R-M5` +- the bounded first-party `Phase 6R-M5` knowledge and notes packet is now + landed in current code +- if memory implementation continues, the next clean move is `Phase 6R-M6` - do not open one broad "memory packet" - follow the lane map and packet order in `C:\HyperTwist\docs\ops\HYPERTWIST_MEMORY_LANE_AUTHORITY_AND_PHASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md` diff --git a/docs/ops/HYPERTWIST_MEMORY_LANE_AUTHORITY_AND_PHASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md b/docs/ops/HYPERTWIST_MEMORY_LANE_AUTHORITY_AND_PHASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md index c3615af..b8acbaa 100644 --- a/docs/ops/HYPERTWIST_MEMORY_LANE_AUTHORITY_AND_PHASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md +++ b/docs/ops/HYPERTWIST_MEMORY_LANE_AUTHORITY_AND_PHASE_IMPLEMENTATION_DOCTRINE_2026-05-21.md @@ -665,7 +665,12 @@ Current standing: - current live `6R-M4` surfaces cover provenance-backed cognitive facts, contradiction records, supersession links, and confidence-decay entries over the landed `6R-M1`, `6R-M2`, and `6R-M3` seams -- if memory implementation continues, the next clean move is `6R-M5` +- the bounded first-party `Phase 6R-M5` knowledge and notes packet is now + landed in current code +- current live `6R-M5` surfaces cover curated knowledge objects, reviewable + promotion decisions, and explicit user-notes posture/gate truth over the + landed `6R-M1`, `6R-M2`, `6R-M3`, and `6R-M4` seams +- if memory implementation continues, the next clean move is `6R-M6` ### `6R-M2` - chronicle and continuity packet @@ -702,6 +707,8 @@ Implement: - curated knowledge objects - reviewable promotion flows - user-authored note lane if and only if ownership remains justified +- explicit note-lane availability may remain false at landing time when + ownership is not justified ### `6R-M6` - derived memory and optional adjunct packet diff --git a/docs/v6_5_deep_manual_pack/HyperTwist/ARCHITECTURE.md b/docs/v6_5_deep_manual_pack/HyperTwist/ARCHITECTURE.md index 827d86f..fd74993 100644 --- a/docs/v6_5_deep_manual_pack/HyperTwist/ARCHITECTURE.md +++ b/docs/v6_5_deep_manual_pack/HyperTwist/ARCHITECTURE.md @@ -187,6 +187,8 @@ That means: landed seams - a live first-party `Phase 6R-M4` cognitive-consolidation layer over those landed seams +- a live first-party `Phase 6R-M5` knowledge-promotion and note-posture layer + over those landed seams - explicit provenance - explicit custody - two context-assembly profiles: diff --git a/docs/v6_5_deep_manual_pack/HyperTwist/FEATURE_REGISTRY.md b/docs/v6_5_deep_manual_pack/HyperTwist/FEATURE_REGISTRY.md index 4a51b66..cd4ef7d 100644 --- a/docs/v6_5_deep_manual_pack/HyperTwist/FEATURE_REGISTRY.md +++ b/docs/v6_5_deep_manual_pack/HyperTwist/FEATURE_REGISTRY.md @@ -292,11 +292,12 @@ repo. | First-party chronicle and continuity | Implemented now | landed first-party `Phase 6R-M2` packet | Current bounded chronicle events, grouped continuity sessions, resume packs, and repo-aware continuity guards are live above the landed `Phase 6R-M1` ledger seam. Recall/history search, scoped shared-context, cognitive extraction, knowledge/notes, and compact reducers stay deferred to later memory packets. | | First-party recall and shared context | Implemented now | landed first-party `Phase 6R-M3` packet | Current bounded explicit recall matches, history search, provenance drill-down, and revocable shared-context projections are live above the landed `Phase 6R-M1` ledger and `Phase 6R-M2` chronicle/continuity seams. Cognitive extraction, knowledge/notes, and compact reducers stay deferred to later memory packets. | | First-party cognitive consolidation | Implemented now | landed first-party `Phase 6R-M4` packet | Current bounded provenance-backed cognitive facts, contradiction records, supersession links, and confidence-decay entries are live above the landed `Phase 6R-M1`, `Phase 6R-M2`, and `Phase 6R-M3` seams. Knowledge/notes and compact reducers stay deferred to later memory packets. | +| First-party knowledge and notes posture | Implemented now | landed first-party `Phase 6R-M5` packet | Current bounded curated knowledge objects, reviewable promotion decisions, and explicit user-notes posture/gating are live above the landed `Phase 6R-M1`, `Phase 6R-M2`, `Phase 6R-M3`, and `Phase 6R-M4` seams. Active user-authored note capture and compact reducers stay deferred to later memory packets. | | Control-plane telemetry, replay-diagnostic, and rollout-governance reference grounding | Implemented now | `PostHog/posthog` retained boundary-sensitive lane + first-party current code | Current live `Control-Plane Telemetry and Replay Governance` reference side includes six rewritten first-party contract/reference targets grounded in `PostHog/posthog`: replay diagnostics, replay segmentation, feature governance, scheduled changes, early-access lifecycle, and explicit `MIT`-outside-`ee/` compliance-boundary notes. This does not displace the landed `Phase 4R-D` first-party owner lane, any replay-shell owner family, or the explicit enterprise-subtree exclusion boundary. | | Capture-history, vault, and replay-inspection reference grounding | Implemented now | `screenpipe/screenpipe` retained boundary-sensitive lane + first-party current code | Current live `Capture History, Replay, and Vault Support` reference side includes six rewritten first-party contract/reference targets grounded in `screenpipe/screenpipe`: event-capture, pipe-permission, persistence, vault-lifecycle, timeline-review, and explicit permissive-core-versus-`ee/` compliance-boundary notes. This does not displace the landed `Phase 4R-E` first-party owner lane, the broader replay shell, or the explicit enterprise-subtree exclusion boundary. | | Layered memory federation | Deep-source grounded retained | memory doctrine + VectorShell import entrypoint | Governing taxonomy exists; HyperTwist uses pointer-based synchronization to the current VectorShell memory canon rather than a frozen local fork. Lane widening remains future work and later superior evidence may revise only the exact affected lane or sub-slice. | | Continuity Lattice context assembly | Deep-source grounded retained | continuity-lattice doctrine + VectorShell import entrypoint | One federated substrate with two preset-backed, overrideable profiles: `Max-Retention Mode` and `Economic-Retention Mode`. This is not a second memory system, does not weaken lane authority or optional-assistive override control, and does not justify automatic whole-repo absorption when one continuity sub-slice changes owner. | -| User-authored note lane | Deep-source grounded retained | memory doctrine, owner unresolved | Do not describe as shipped. | +| User-authored note lane | Deep-source grounded retained | memory doctrine, owner unresolved | Explicit note-lane posture/gating is live through `Phase 6R-M5`, but active user-authored note capture still must not be described as shipped until ownership is justified. | | Compact memory views / reducers | Deep-source grounded retained | optional-assistive + memory doctrine | Must remain derived and optional. Do not copy donor code for any `R3` memory slice; import first-party VectorShell doctrine and code surfaces before bounded donor-derived adjuncts if broader adoption is later justified. | ### 10. Skills and optional assistive layer diff --git a/docs/v6_5_deep_manual_pack/HyperTwist/PROVENANCE_AND_TRUST_MODEL.md b/docs/v6_5_deep_manual_pack/HyperTwist/PROVENANCE_AND_TRUST_MODEL.md index f84abad..d98c7ac 100644 --- a/docs/v6_5_deep_manual_pack/HyperTwist/PROVENANCE_AND_TRUST_MODEL.md +++ b/docs/v6_5_deep_manual_pack/HyperTwist/PROVENANCE_AND_TRUST_MODEL.md @@ -102,10 +102,11 @@ and requires provenance to survive: - the landed bounded first-party `Phase 6R-M3` recall and shared-context packet - the landed bounded first-party `Phase 6R-M4` cognitive consolidation packet +- the landed bounded first-party `Phase 6R-M5` knowledge and notes packet - chronicle capture - continuity/resume packets - explicit recall and provenance drill-down -- broader knowledge promotion and note review beyond the landed `6R-M4` seam +- active user-authored note capture beyond the landed `6R-M5` seam - derived compact views Important continuity-profile reading: diff --git a/docs/v6_5_deep_manual_pack/HyperTwist/ROADMAP.md b/docs/v6_5_deep_manual_pack/HyperTwist/ROADMAP.md index e657066..09c0bea 100644 --- a/docs/v6_5_deep_manual_pack/HyperTwist/ROADMAP.md +++ b/docs/v6_5_deep_manual_pack/HyperTwist/ROADMAP.md @@ -147,8 +147,12 @@ Canonical discovery surfaces for roadmap interpretation: consumed - the bounded first-party `Phase 6R-M4` cognitive consolidation packet is now landed in current code -- if memory implementation continues, the next clean move is `Phase 6R-M5` knowledge and - notes rather than reopening `6R-M1`, `6R-M2`, `6R-M3`, or `6R-M4` as broad memory packets +- the generic first-party `Phase 6R-M5` knowledge and notes control pass is now consumed +- the bounded first-party `Phase 6R-M5` knowledge and notes packet is now landed in + current code +- if memory implementation continues, the next clean move is `Phase 6R-M6` derived memory + and optional adjunct rather than reopening `6R-M1`, `6R-M2`, `6R-M3`, `6R-M4`, or `6R-M5` + as broad memory packets - the generic source-backed `Phase 6R-R` shared classic-cube recognition multi-face correction/explanation control pass is now consumed - the bounded permissive `Phase 6R-R` shared classic-cube recognition multi-face