Implement Phase 6R-M1 memory contracts and ledger

This commit is contained in:
axiomlogicnexus 2026-05-28 04:46:27 +02:00
parent 696dbf60f3
commit 496279eade
14 changed files with 2420 additions and 96 deletions

View file

@ -1,5 +1,6 @@
#include "HyperTwistBootstrap/HyperTwistContractLibrary.h"
#include "HyperTwistMemory/HyperTwistMemoryCoreLibrary.h"
#include "HyperTwistRecognition/HyperTwistRecognitionReplayLibrary.h"
#include "HyperTwistReplay/HyperTwistReplayReviewLibrary.h"
#include "HyperTwistTraining/HyperTwistTrainingCatalogLibrary.h"
@ -24,6 +25,187 @@ namespace HyperTwistContractLibraryInternal
return FJsonObjectConverter::JsonObjectStringToUStruct(Json, &OutValue, 0, 0);
}
FHyperTwistCoachSessionQueueSummary MakeSampleCoachSessionQueueSummaryManual()
{
FHyperTwistCoachSessionQueueSummary QueueSummary;
const FHyperTwistTrainingRunStepResult StepResult =
UHyperTwistContractLibrary::MakeSampleTrainingRunStepResult();
if (!StepResult.IsStructurallyValid())
{
return QueueSummary;
}
QueueSummary.UserId = StepResult.UpdatedRunState.Session.UserId;
QueueSummary.ReferenceUtc = TEXT("2026-04-28T12:12:00Z");
QueueSummary.FocusDeckId = StepResult.UpdatedRunState.Session.DeckId;
QueueSummary.FocusMethodSegmentId = TEXT("cfop-cross");
QueueSummary.PrimaryQueueLabel = TEXT("primary-brief");
QueueSummary.NextQueueLabel = TEXT("follow-up-brief");
QueueSummary.bHasImmediateQueue = true;
QueueSummary.bNeedsArchiveAwareSequencing = true;
FHyperTwistCoachSessionQueueEntry PrimaryEntry;
PrimaryEntry.EntryId = TEXT("coach_queue_primary");
PrimaryEntry.SourceLabel = TEXT("primary-brief");
PrimaryEntry.Priority = EHyperTwistCoachPriority::Elevated;
PrimaryEntry.PriorityScore = 78.0f;
PrimaryEntry.Headline = TEXT("Primary coach review block");
PrimaryEntry.SuggestedMode = EHyperTwistTrainingDeliveryMode::CoachReviewed;
PrimaryEntry.SuggestedSelectionPolicy = EHyperTwistTrainingSelectionPolicy::Weighted;
PrimaryEntry.FocusDeckId = QueueSummary.FocusDeckId;
PrimaryEntry.FocusMethodSegmentId = QueueSummary.FocusMethodSegmentId;
PrimaryEntry.FocusCaseIds = { TEXT("cross_case_1"), TEXT("cross_case_2") };
QueueSummary.Entries.Add(PrimaryEntry);
FHyperTwistCoachSessionQueueEntry FollowUpEntry;
FollowUpEntry.EntryId = TEXT("coach_queue_follow_up");
FollowUpEntry.SourceLabel = TEXT("follow-up-brief");
FollowUpEntry.Priority = EHyperTwistCoachPriority::Advisory;
FollowUpEntry.PriorityScore = 61.0f;
FollowUpEntry.Headline = TEXT("Follow-up coaching block");
FollowUpEntry.SuggestedMode = EHyperTwistTrainingDeliveryMode::VirtualCube;
FollowUpEntry.SuggestedSelectionPolicy = EHyperTwistTrainingSelectionPolicy::Scripted;
FollowUpEntry.FocusDeckId = QueueSummary.FocusDeckId;
FollowUpEntry.FocusMethodSegmentId = QueueSummary.FocusMethodSegmentId;
FollowUpEntry.FocusCaseIds = { TEXT("cross_case_2"), TEXT("cross_case_3") };
FollowUpEntry.bRequiresFollowUp = true;
QueueSummary.Entries.Add(FollowUpEntry);
FHyperTwistCoachSessionQueueEntry ArchiveEntry;
ArchiveEntry.EntryId = TEXT("coach_queue_archive");
ArchiveEntry.SourceLabel = TEXT("archive-policy");
ArchiveEntry.Priority = EHyperTwistCoachPriority::Advisory;
ArchiveEntry.PriorityScore = 56.0f;
ArchiveEntry.Headline = TEXT("Archive retention review block");
ArchiveEntry.SuggestedMode = EHyperTwistTrainingDeliveryMode::Timer;
ArchiveEntry.SuggestedSelectionPolicy = EHyperTwistTrainingSelectionPolicy::Weighted;
ArchiveEntry.FocusDeckId = QueueSummary.FocusDeckId;
ArchiveEntry.FocusMethodSegmentId = QueueSummary.FocusMethodSegmentId;
ArchiveEntry.FocusCaseIds = { TEXT("cross_case_4") };
ArchiveEntry.bRequiresArchiveRetentionTuning = true;
QueueSummary.Entries.Add(ArchiveEntry);
return QueueSummary;
}
FHyperTwistTrainingCoachSessionQueueState MakeSampleCoachSessionQueueStateManual()
{
FHyperTwistTrainingCoachSessionQueueState QueueState =
UHyperTwistTrainingRepositoryLibrary::BuildCoachSessionQueueState(
MakeSampleCoachSessionQueueSummaryManual(),
TEXT("coach_queue_active"),
TEXT("2026-04-28T12:12:00Z")
);
QueueState = UHyperTwistTrainingRepositoryLibrary::DeferCoachSessionQueueEntry(
QueueState,
TEXT("coach_queue_follow_up"),
TEXT("2026-04-28T18:00:00Z"),
TEXT("follow-up-held-behind-primary"),
false,
TEXT("2026-04-28T12:13:00Z")
);
QueueState = UHyperTwistTrainingRepositoryLibrary::DeferCoachSessionQueueEntry(
QueueState,
TEXT("coach_queue_archive"),
TEXT("2026-04-29T09:00:00Z"),
TEXT("archive-retention-window"),
true,
TEXT("2026-04-28T12:14:00Z")
);
return QueueState;
}
FHyperTwistTrainingRepositoryState AppendSampleCoachArtifacts(
const FHyperTwistTrainingRepositoryState& RepositoryState
)
{
FHyperTwistTrainingRepositoryState UpdatedState = RepositoryState;
const FHyperTwistTrainingCoachActionPlan CoachActionPlan =
UHyperTwistContractLibrary::MakeSampleTrainingCoachActionPlan();
if (CoachActionPlan.IsStructurallyValid())
{
UpdatedState = UHyperTwistTrainingRepositoryLibrary::UpsertCoachActionPlan(
UpdatedState,
CoachActionPlan
);
}
const FHyperTwistTrainingCoachSessionQueueState CoachSessionQueueState =
MakeSampleCoachSessionQueueStateManual();
if (CoachSessionQueueState.IsStructurallyValid())
{
UpdatedState = UHyperTwistTrainingRepositoryLibrary::UpsertCoachSessionQueueState(
UpdatedState,
CoachSessionQueueState
);
}
return UpdatedState;
}
FHyperTwistTrainingRepositoryState BuildSampleTrainingRepositoryStateBase()
{
const FHyperTwistTrainingRunStepResult StepResult =
UHyperTwistContractLibrary::MakeSampleTrainingRunStepResult();
if (!StepResult.IsStructurallyValid())
{
return FHyperTwistTrainingRepositoryState();
}
FHyperTwistTrainingRepositoryState RepositoryState;
RepositoryState = UHyperTwistTrainingRepositoryLibrary::RecordRunState(
RepositoryState,
StepResult.UpdatedRunState
);
const TArray<FHyperTwistTrainingSessionTemplate> DerivedTemplates =
UHyperTwistTrainingRepositoryLibrary::DeriveTrainingSessionTemplates(
RepositoryState,
StepResult.UpdatedRunState.Session.UserId,
TEXT("2026-04-28T12:05:00Z")
);
if (DerivedTemplates.Num() > 0)
{
FHyperTwistTrainingSessionTemplate CustomizedTemplate = DerivedTemplates[0];
CustomizedTemplate.Title = TEXT("Pinned Recovery Review");
CustomizedTemplate.GuidanceLabel = TEXT("user-customized-recovery");
CustomizedTemplate.RecommendedCaseCount = FMath::Max(2, CustomizedTemplate.RecommendedCaseCount);
CustomizedTemplate.SuggestedMode = EHyperTwistTrainingDeliveryMode::VirtualCube;
CustomizedTemplate.SourceTemplateId = CustomizedTemplate.TemplateId;
CustomizedTemplate.bUserCustomized = true;
CustomizedTemplate.LastUpdatedAtUtc = TEXT("2026-04-28T12:10:00Z");
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertStoredTrainingSessionTemplate(
RepositoryState,
CustomizedTemplate
);
}
const FHyperTwistTrainingMethodDrillFavoriteEntry FavoriteEntry =
UHyperTwistContractLibrary::MakeSampleMethodDrillFavoriteEntry();
if (FavoriteEntry.IsStructurallyValid())
{
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertMethodDrillFavorite(
RepositoryState,
FavoriteEntry
);
}
const FHyperTwistTrainingMethodDrillBatch DrillBatch =
UHyperTwistContractLibrary::MakeSampleMethodDrillBatch();
if (DrillBatch.IsStructurallyValid())
{
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertMethodDrillBatch(
RepositoryState,
DrillBatch
);
}
return RepositoryState;
}
void AppendLe16(TArray<uint8>& Buffer, const uint16 Value)
{
Buffer.Add(static_cast<uint8>(Value & 0xff));
@ -3489,77 +3671,67 @@ FHyperTwistTrainingTimingBreakdown UHyperTwistContractLibrary::MakeSampleTrainin
FHyperTwistTrainingRepositoryState UHyperTwistContractLibrary::MakeSampleTrainingRepositoryState()
{
const FHyperTwistTrainingRunStepResult StepResult = MakeSampleTrainingRunStepResult();
if (!StepResult.IsStructurallyValid())
{
return FHyperTwistTrainingRepositoryState();
}
FHyperTwistTrainingRepositoryState RepositoryState =
HyperTwistContractLibraryInternal::BuildSampleTrainingRepositoryStateBase();
FHyperTwistTrainingRepositoryState RepositoryState;
RepositoryState = UHyperTwistTrainingRepositoryLibrary::RecordRunState(RepositoryState, StepResult.UpdatedRunState);
const TArray<FHyperTwistTrainingSessionTemplate> DerivedTemplates =
UHyperTwistTrainingRepositoryLibrary::DeriveTrainingSessionTemplates(
RepositoryState,
StepResult.UpdatedRunState.Session.UserId,
TEXT("2026-04-28T12:05:00Z")
);
if (DerivedTemplates.Num() > 0)
const FHyperTwistTrainingReviewPlanState ReviewPlanState = MakeSampleTrainingReviewPlanState();
if (ReviewPlanState.IsStructurallyValid())
{
FHyperTwistTrainingSessionTemplate CustomizedTemplate = DerivedTemplates[0];
CustomizedTemplate.Title = TEXT("Pinned Recovery Review");
CustomizedTemplate.GuidanceLabel = TEXT("user-customized-recovery");
CustomizedTemplate.RecommendedCaseCount = FMath::Max(2, CustomizedTemplate.RecommendedCaseCount);
CustomizedTemplate.SuggestedMode = EHyperTwistTrainingDeliveryMode::VirtualCube;
CustomizedTemplate.SourceTemplateId = CustomizedTemplate.TemplateId;
CustomizedTemplate.bUserCustomized = true;
CustomizedTemplate.LastUpdatedAtUtc = TEXT("2026-04-28T12:10:00Z");
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertStoredTrainingSessionTemplate(
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertReviewPlan(
RepositoryState,
CustomizedTemplate
);
}
const FHyperTwistTrainingMethodDrillFavoriteEntry FavoriteEntry = MakeSampleMethodDrillFavoriteEntry();
if (FavoriteEntry.IsStructurallyValid())
{
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertMethodDrillFavorite(
RepositoryState,
FavoriteEntry
);
}
const FHyperTwistTrainingMethodDrillBatch DrillBatch = MakeSampleMethodDrillBatch();
if (DrillBatch.IsStructurallyValid())
{
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertMethodDrillBatch(
RepositoryState,
DrillBatch
);
}
const FHyperTwistTrainingCoachActionPlan CoachActionPlan = MakeSampleTrainingCoachActionPlan();
if (CoachActionPlan.IsStructurallyValid())
{
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertCoachActionPlan(
RepositoryState,
CoachActionPlan
);
}
const FHyperTwistTrainingCoachSessionQueueState CoachSessionQueueState =
MakeSampleTrainingCoachSessionQueueState();
if (CoachSessionQueueState.IsStructurallyValid())
{
RepositoryState = UHyperTwistTrainingRepositoryLibrary::UpsertCoachSessionQueueState(
RepositoryState,
CoachSessionQueueState
ReviewPlanState
);
}
return RepositoryState;
}
FHyperTwistMemoryLedgerState UHyperTwistContractLibrary::MakeSampleTrainingMemoryLedgerState()
{
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
FString UserId;
if (RepositoryState.RunRecords.Num() > 0 && !RepositoryState.RunRecords[0].Session.UserId.IsEmpty())
{
UserId = RepositoryState.RunRecords[0].Session.UserId;
}
else if (RepositoryState.LearnerStates.Num() > 0 && !RepositoryState.LearnerStates[0].UserId.IsEmpty())
{
UserId = RepositoryState.LearnerStates[0].UserId;
}
else if (RepositoryState.ReviewPlans.Num() > 0 && !RepositoryState.ReviewPlans[0].UserId.IsEmpty())
{
UserId = RepositoryState.ReviewPlans[0].UserId;
}
else if (RepositoryState.StoredSessionTemplates.Num() > 0 &&
!RepositoryState.StoredSessionTemplates[0].UserId.IsEmpty())
{
UserId = RepositoryState.StoredSessionTemplates[0].UserId;
}
else if (RepositoryState.StoredCoachActionPlans.Num() > 0 &&
!RepositoryState.StoredCoachActionPlans[0].UserId.IsEmpty())
{
UserId = RepositoryState.StoredCoachActionPlans[0].UserId;
}
else if (RepositoryState.StoredCoachSessionQueues.Num() > 0 &&
!RepositoryState.StoredCoachSessionQueues[0].UserId.IsEmpty())
{
UserId = RepositoryState.StoredCoachSessionQueues[0].UserId;
}
if (UserId.IsEmpty())
{
return FHyperTwistMemoryLedgerState();
}
return UHyperTwistMemoryCoreLibrary::DeriveMemoryLedgerState(
RepositoryState,
UserId,
TEXT("2026-04-28T12:40:00Z")
);
}
FHyperTwistTrainingRepositoryIntegrityReport UHyperTwistContractLibrary::MakeSampleTrainingRepositoryIntegrityReport()
{
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
@ -4089,7 +4261,8 @@ TArray<FHyperTwistTrainingCaseRecommendation> UHyperTwistContractLibrary::MakeSa
return TArray<FHyperTwistTrainingCaseRecommendation>();
}
const FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
const FHyperTwistTrainingRepositoryState RepositoryState =
HyperTwistContractLibraryInternal::BuildSampleTrainingRepositoryStateBase();
return UHyperTwistTrainingRepositoryLibrary::ListCaseRecommendationsForDeck(
RepositoryState,
StepResult.UpdatedRunState.ActiveDeck,
@ -4225,8 +4398,10 @@ FHyperTwistTrainingCoachActionPlanSummary UHyperTwistContractLibrary::MakeSample
return FHyperTwistTrainingCoachActionPlanSummary();
}
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
return UHyperTwistTrainingRepositoryLibrary::DeriveCoachActionPlanSummary(
MakeSampleTrainingRepositoryState(),
RepositoryState,
StepResult.UpdatedRunState.Session.UserId,
TEXT("2026-04-28T12:05:00Z")
);
@ -4234,8 +4409,12 @@ FHyperTwistTrainingCoachActionPlanSummary UHyperTwistContractLibrary::MakeSample
FHyperTwistTrainingCoachActionPlanOutcomeSummary UHyperTwistContractLibrary::MakeSampleTrainingCoachActionPlanOutcomeSummary()
{
const FHyperTwistTrainingRepositoryState RepositoryState =
HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(
MakeSampleTrainingRepositoryState()
);
return UHyperTwistTrainingRepositoryLibrary::DeriveCoachActionPlanOutcomeSummary(
MakeSampleTrainingRepositoryState(),
RepositoryState,
MakeSampleTrainingCoachActionPlan(),
TEXT("2026-04-28T12:12:00Z")
);
@ -4244,6 +4423,7 @@ FHyperTwistTrainingCoachActionPlanOutcomeSummary UHyperTwistContractLibrary::Mak
FHyperTwistTrainingCoachActionSequenceSummary UHyperTwistContractLibrary::MakeSampleTrainingCoachActionSequenceSummary()
{
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
const FHyperTwistTrainingCoachActionPlan RootPlan = MakeSampleTrainingCoachActionPlan();
const FHyperTwistCoachBrief FollowUpBrief = MakeSampleTrainingCoachFollowUpBrief();
const FHyperTwistTrainingCoachActionPlan FollowUpPlan =
@ -4280,6 +4460,7 @@ FHyperTwistTrainingCoachActionSequenceSummary UHyperTwistContractLibrary::MakeSa
FHyperTwistTrainingCoachActionClosureSummary UHyperTwistContractLibrary::MakeSampleTrainingCoachActionClosureSummary()
{
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
const FHyperTwistTrainingCoachActionPlan RootPlan = MakeSampleTrainingCoachActionPlan();
const FHyperTwistCoachBrief FollowUpBrief = MakeSampleTrainingCoachFollowUpBrief();
const FHyperTwistTrainingCoachActionPlan FollowUpPlan =
@ -4321,8 +4502,10 @@ FHyperTwistTrainingCoachClosureMemorySummary UHyperTwistContractLibrary::MakeSam
return FHyperTwistTrainingCoachClosureMemorySummary();
}
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
return UHyperTwistTrainingRepositoryLibrary::DeriveCoachClosureMemorySummary(
MakeSampleTrainingRepositoryState(),
RepositoryState,
StepResult.UpdatedRunState.Session.UserId,
TEXT("2026-04-28T12:20:00Z")
);
@ -4337,6 +4520,7 @@ FHyperTwistTrainingCoachRecommendationHistorySummary UHyperTwistContractLibrary:
}
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
const FHyperTwistCoachBrief FollowUpBrief = MakeSampleTrainingCoachFollowUpBrief();
const FHyperTwistTrainingCoachActionPlan FollowUpPlan =
UHyperTwistTrainingRepositoryLibrary::BuildCoachActionPlan(
@ -4373,6 +4557,7 @@ FHyperTwistTrainingCoachCarryForwardPolicySummary UHyperTwistContractLibrary::Ma
}
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
const FHyperTwistCoachBrief FollowUpBrief = MakeSampleTrainingCoachFollowUpBrief();
const FHyperTwistTrainingCoachActionPlan FollowUpPlan =
UHyperTwistTrainingRepositoryLibrary::BuildCoachActionPlan(
@ -4409,6 +4594,7 @@ FHyperTwistTrainingCoachArchivePolicySummary UHyperTwistContractLibrary::MakeSam
}
FHyperTwistTrainingRepositoryState RepositoryState = MakeSampleTrainingRepositoryState();
RepositoryState = HyperTwistContractLibraryInternal::AppendSampleCoachArtifacts(RepositoryState);
const FHyperTwistCoachBrief FollowUpBrief = MakeSampleTrainingCoachFollowUpBrief();
const FHyperTwistTrainingCoachActionPlan FollowUpPlan =
UHyperTwistTrainingRepositoryLibrary::BuildCoachActionPlan(
@ -4447,40 +4633,12 @@ FHyperTwistCoachBrief UHyperTwistContractLibrary::MakeSampleTrainingCoachFollowU
FHyperTwistCoachSessionQueueSummary UHyperTwistContractLibrary::MakeSampleTrainingCoachSessionQueueSummary()
{
return UHyperTwistTrainingCoachLibrary::DeriveCoachSessionQueueSummary(
MakeSampleTrainingCoachBrief(),
MakeSampleTrainingCoachFollowUpBrief(),
MakeSampleTrainingCoachMemorySnapshot(),
MakeSampleTrainingCoachArchivePolicySummary(),
MakeSampleTrainingReviewProgramSummary()
);
return HyperTwistContractLibraryInternal::MakeSampleCoachSessionQueueSummaryManual();
}
FHyperTwistTrainingCoachSessionQueueState UHyperTwistContractLibrary::MakeSampleTrainingCoachSessionQueueState()
{
FHyperTwistTrainingCoachSessionQueueState QueueState = UHyperTwistTrainingRepositoryLibrary::BuildCoachSessionQueueState(
MakeSampleTrainingCoachSessionQueueSummary(),
TEXT("coach_queue_active"),
TEXT("2026-04-28T12:12:00Z")
);
QueueState = UHyperTwistTrainingRepositoryLibrary::DeferCoachSessionQueueEntry(
QueueState,
TEXT("coach_queue_follow_up"),
TEXT("2026-04-28T18:00:00Z"),
TEXT("follow-up-held-behind-primary"),
false,
TEXT("2026-04-28T12:13:00Z")
);
QueueState = UHyperTwistTrainingRepositoryLibrary::DeferCoachSessionQueueEntry(
QueueState,
TEXT("coach_queue_archive"),
TEXT("2026-04-29T09:00:00Z"),
TEXT("archive-retention-window"),
true,
TEXT("2026-04-28T12:14:00Z")
);
return QueueState;
return HyperTwistContractLibraryInternal::MakeSampleCoachSessionQueueStateManual();
}
FHyperTwistCoachScheduleHorizonSummary UHyperTwistContractLibrary::MakeSampleTrainingCoachScheduleHorizonSummary()
@ -4633,6 +4791,13 @@ FString UHyperTwistContractLibrary::SerializeTrainingRepositoryStateToJson(const
return HyperTwistContractLibraryInternal::SerializeStructToJson(RepositoryState);
}
FString UHyperTwistContractLibrary::SerializeMemoryLedgerStateToJson(
const FHyperTwistMemoryLedgerState& MemoryLedgerState
)
{
return HyperTwistContractLibraryInternal::SerializeStructToJson(MemoryLedgerState);
}
FString UHyperTwistContractLibrary::SerializeTrainingTimerExportPacketToJson(
const FHyperTwistTrainingTimerExportPacket& TimerExportPacket
)
@ -4692,6 +4857,14 @@ bool UHyperTwistContractLibrary::DeserializeTrainingRepositoryStateFromJson(cons
return HyperTwistContractLibraryInternal::DeserializeStructFromJson(Json, OutRepositoryState);
}
bool UHyperTwistContractLibrary::DeserializeMemoryLedgerStateFromJson(
const FString& Json,
FHyperTwistMemoryLedgerState& OutMemoryLedgerState
)
{
return HyperTwistContractLibraryInternal::DeserializeStructFromJson(Json, OutMemoryLedgerState);
}
bool UHyperTwistContractLibrary::DeserializeTrainingTimerExportPacketFromJson(
const FString& Json,
FHyperTwistTrainingTimerExportPacket& OutTimerExportPacket

View file

@ -3,6 +3,7 @@
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "HyperTwistCore/HyperTwistCoreTypes.h"
#include "HyperTwistMemory/HyperTwistMemoryTypes.h"
#include "HyperTwistRecognition/HyperTwistRecognitionReplayLibrary.h"
#include "HyperTwistReplay/HyperTwistReplayTypes.h"
#include "HyperTwistReplay/HyperTwistReplayReviewLibrary.h"
@ -141,6 +142,9 @@ public:
UFUNCTION(BlueprintPure, Category = "HyperTwist|Training")
static FHyperTwistTrainingRepositoryState MakeSampleTrainingRepositoryState();
UFUNCTION(BlueprintPure, Category = "HyperTwist|Memory")
static FHyperTwistMemoryLedgerState MakeSampleTrainingMemoryLedgerState();
UFUNCTION(BlueprintPure, Category = "HyperTwist|Training")
static FHyperTwistTrainingRepositoryIntegrityReport MakeSampleTrainingRepositoryIntegrityReport();
@ -302,6 +306,9 @@ public:
UFUNCTION(BlueprintPure, Category = "HyperTwist|Serialization")
static FString SerializeTrainingRepositoryStateToJson(const FHyperTwistTrainingRepositoryState& RepositoryState);
UFUNCTION(BlueprintPure, Category = "HyperTwist|Serialization")
static FString SerializeMemoryLedgerStateToJson(const FHyperTwistMemoryLedgerState& MemoryLedgerState);
UFUNCTION(BlueprintPure, Category = "HyperTwist|Serialization")
static FString SerializeTrainingTimerExportPacketToJson(const FHyperTwistTrainingTimerExportPacket& TimerExportPacket);
@ -341,6 +348,9 @@ public:
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Serialization")
static bool DeserializeTrainingRepositoryStateFromJson(const FString& Json, FHyperTwistTrainingRepositoryState& OutRepositoryState);
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Serialization")
static bool DeserializeMemoryLedgerStateFromJson(const FString& Json, FHyperTwistMemoryLedgerState& OutMemoryLedgerState);
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Serialization")
static bool DeserializeTrainingTimerExportPacketFromJson(const FString& Json, FHyperTwistTrainingTimerExportPacket& OutTimerExportPacket);
};

View file

@ -0,0 +1,21 @@
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "HyperTwistMemory/HyperTwistMemoryTypes.h"
#include "HyperTwistTraining/HyperTwistTrainingTypes.h"
#include "HyperTwistMemoryCoreLibrary.generated.h"
UCLASS()
class UNREALHYPERTWIST_API UHyperTwistMemoryCoreLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintPure, Category = "HyperTwist|Memory")
static FHyperTwistMemoryLedgerState DeriveMemoryLedgerState(
const FHyperTwistTrainingRepositoryState& RepositoryState,
const FString& UserId,
const FString& ReferenceUtc
);
};

View file

@ -0,0 +1,329 @@
#pragma once
#include "CoreMinimal.h"
#include "HyperTwistMemoryTypes.generated.h"
UENUM(BlueprintType)
enum class EHyperTwistMemoryLane : uint8
{
None UMETA(DisplayName = "None"),
IdentityPolicy UMETA(DisplayName = "Identity And Policy"),
WorkspaceRecall UMETA(DisplayName = "Workspace And Cockpit Recall"),
ChronicleCapture UMETA(DisplayName = "Chronicle And Episodic Capture"),
ContinuityResume UMETA(DisplayName = "Continuity And Resume"),
SharedCoordination UMETA(DisplayName = "Shared Coordination"),
RecallRetrieval UMETA(DisplayName = "Recall And Retrieval"),
CognitiveConsolidated UMETA(DisplayName = "Cognitive And Consolidated"),
KnowledgeWiki UMETA(DisplayName = "Knowledge And Wiki"),
UserNotes UMETA(DisplayName = "User Notes"),
ProvenanceLedger UMETA(DisplayName = "Provenance And Trust Ledger"),
DerivedCompacted UMETA(DisplayName = "Derived And Compacted"),
ProceduralWorkflow UMETA(DisplayName = "Procedural And Workflow")
};
UENUM(BlueprintType)
enum class EHyperTwistMemoryAuthorityKind : uint8
{
None UMETA(DisplayName = "None"),
Authoritative UMETA(DisplayName = "Authoritative"),
SemiAuthoritative UMETA(DisplayName = "Semi-Authoritative"),
DerivedOnly UMETA(DisplayName = "Derived Only")
};
UENUM(BlueprintType)
enum class EHyperTwistMemoryFeatureGateDefaultState : uint8
{
None UMETA(DisplayName = "None"),
RequiredEnabled UMETA(DisplayName = "Required Enabled"),
EnabledByDefault UMETA(DisplayName = "Enabled By Default"),
DisabledByDefault UMETA(DisplayName = "Disabled By Default")
};
UENUM(BlueprintType)
enum class EHyperTwistMemoryContextAssemblyProfile : uint8
{
None UMETA(DisplayName = "None"),
EconomicRetentionMode UMETA(DisplayName = "Economic-Retention Mode"),
MaxRetentionMode UMETA(DisplayName = "Max-Retention Mode")
};
USTRUCT(BlueprintType)
struct FHyperTwistMemoryProvenanceLink
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString ParentEntityId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryLane ParentLane = EHyperTwistMemoryLane::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString ParentRecordKind;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString ParentReferenceUtc;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString ParentSourceLabel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
bool bParentAuthoritative = false;
bool IsStructurallyValid() const
{
return !ParentEntityId.IsEmpty()
&& ParentLane != EHyperTwistMemoryLane::None
&& !ParentRecordKind.IsEmpty();
}
};
USTRUCT(BlueprintType)
struct FHyperTwistMemoryFeatureGate
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString GateId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString SettingsKey;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString DisplayLabel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryLane Lane = EHyperTwistMemoryLane::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryFeatureGateDefaultState DefaultState =
EHyperTwistMemoryFeatureGateDefaultState::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
bool bUserControllable = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
bool bDisableAllowed = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString Summary;
bool IsStructurallyValid() const
{
return !GateId.IsEmpty()
&& !SettingsKey.IsEmpty()
&& Lane != EHyperTwistMemoryLane::None
&& DefaultState != EHyperTwistMemoryFeatureGateDefaultState::None;
}
};
USTRUCT(BlueprintType)
struct FHyperTwistMemoryLaneContract
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryLane Lane = EHyperTwistMemoryLane::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString LaneId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString DisplayLabel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryAuthorityKind AuthorityKind = EHyperTwistMemoryAuthorityKind::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString DefaultSettingsKey;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString DefaultFeatureGateId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
bool bFirstPartyOwned = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
bool bCurrentEvidencePresent = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString Summary;
bool IsStructurallyValid() const
{
return Lane != EHyperTwistMemoryLane::None
&& !LaneId.IsEmpty()
&& !DisplayLabel.IsEmpty()
&& AuthorityKind != EHyperTwistMemoryAuthorityKind::None
&& !DefaultSettingsKey.IsEmpty()
&& !DefaultFeatureGateId.IsEmpty();
}
};
USTRUCT(BlueprintType)
struct FHyperTwistMemoryEntityDescriptor
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString EntityId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString RecordKind;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString DisplayLabel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString UserId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString DeckId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString ReferenceUtc;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryLane Lane = EHyperTwistMemoryLane::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryAuthorityKind AuthorityKind = EHyperTwistMemoryAuthorityKind::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
bool bDerived = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (EntityId.IsEmpty()
|| RecordKind.IsEmpty()
|| DisplayLabel.IsEmpty()
|| UserId.IsEmpty()
|| Lane == EHyperTwistMemoryLane::None
|| AuthorityKind == EHyperTwistMemoryAuthorityKind::None)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return !bDerived || ProvenanceLinks.Num() > 0;
}
};
USTRUCT(BlueprintType)
struct FHyperTwistMemorySettingsProfile
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString ProfileId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString DisplayLabel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
EHyperTwistMemoryContextAssemblyProfile ContextAssemblyProfile =
EHyperTwistMemoryContextAssemblyProfile::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FString> EnabledFeatureGateIds;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FString> DisabledFeatureGateIds;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString Summary;
bool IsStructurallyValid() const
{
return !ProfileId.IsEmpty()
&& !DisplayLabel.IsEmpty()
&& ContextAssemblyProfile != EHyperTwistMemoryContextAssemblyProfile::None;
}
};
USTRUCT(BlueprintType)
struct FHyperTwistMemoryLedgerState
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString UserId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FString ReferenceUtc;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryLaneContract> LaneContracts;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryFeatureGate> FeatureGates;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryEntityDescriptor> Entities;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FHyperTwistMemorySettingsProfile EconomicRetentionProfile;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
FHyperTwistMemorySettingsProfile MaxRetentionProfile;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
int32 AuthoritativeEntityCount = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
int32 SemiAuthoritativeEntityCount = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
int32 DerivedEntityCount = 0;
bool IsStructurallyValid() const
{
if (UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| LaneContracts.Num() == 0
|| FeatureGates.Num() == 0
|| !EconomicRetentionProfile.IsStructurallyValid()
|| !MaxRetentionProfile.IsStructurallyValid())
{
return false;
}
for (const FHyperTwistMemoryLaneContract& LaneContract : LaneContracts)
{
if (!LaneContract.IsStructurallyValid())
{
return false;
}
}
for (const FHyperTwistMemoryFeatureGate& FeatureGate : FeatureGates)
{
if (!FeatureGate.IsStructurallyValid())
{
return false;
}
}
for (const FHyperTwistMemoryEntityDescriptor& Entity : Entities)
{
if (!Entity.IsStructurallyValid())
{
return false;
}
}
const int32 TotalEntityCount =
AuthoritativeEntityCount + SemiAuthoritativeEntityCount + DerivedEntityCount;
return TotalEntityCount == Entities.Num();
}
};

View file

@ -0,0 +1,190 @@
// Copyright HyperTwist, Inc. All Rights Reserved.
#include "Misc/AutomationTest.h"
#include "HyperTwistBootstrap/HyperTwistContractLibrary.h"
#if WITH_AUTOMATION_TESTS
namespace HyperTwistMemoryPhase6RM1TestInternal
{
const FHyperTwistMemoryLaneContract* FindLaneContract(
const FHyperTwistMemoryLedgerState& LedgerState,
const EHyperTwistMemoryLane Lane
)
{
for (const FHyperTwistMemoryLaneContract& LaneContract : LedgerState.LaneContracts)
{
if (LaneContract.Lane == Lane)
{
return &LaneContract;
}
}
return nullptr;
}
const FHyperTwistMemoryEntityDescriptor* FindEntityByRecordKind(
const FHyperTwistMemoryLedgerState& LedgerState,
const FString& RecordKind
)
{
for (const FHyperTwistMemoryEntityDescriptor& Entity : LedgerState.Entities)
{
if (Entity.RecordKind == RecordKind)
{
return &Entity;
}
}
return nullptr;
}
}
IMPLEMENT_SIMPLE_AUTOMATION_TEST(
FHyperTwistMemoryPhase6RM1LaneContractsTest,
"HyperTwist.FirstParty.Memory.Phase6R.M1.LaneContracts",
EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)
bool FHyperTwistMemoryPhase6RM1LaneContractsTest::RunTest(const FString& Parameters)
{
const FHyperTwistMemoryLedgerState LedgerState =
UHyperTwistContractLibrary::MakeSampleTrainingMemoryLedgerState();
TestTrue(TEXT("The Phase 6R-M1 memory ledger must be structurally valid."), LedgerState.IsStructurallyValid());
TestEqual(TEXT("The Phase 6R-M1 ledger must expose all memory lane contracts."), LedgerState.LaneContracts.Num(), 12);
TestEqual(TEXT("The Phase 6R-M1 ledger must expose one feature gate per lane."), LedgerState.FeatureGates.Num(), 12);
TestEqual(TEXT("The economic retention profile id must stay canonical."), LedgerState.EconomicRetentionProfile.ProfileId, TEXT("memory-profile/economic-retention"));
TestEqual(TEXT("The max retention profile id must stay canonical."), LedgerState.MaxRetentionProfile.ProfileId, TEXT("memory-profile/max-retention"));
TestEqual(TEXT("The economic retention profile must stay canonical."), LedgerState.EconomicRetentionProfile.ContextAssemblyProfile, EHyperTwistMemoryContextAssemblyProfile::EconomicRetentionMode);
TestEqual(TEXT("The max retention profile must stay canonical."), LedgerState.MaxRetentionProfile.ContextAssemblyProfile, EHyperTwistMemoryContextAssemblyProfile::MaxRetentionMode);
const FHyperTwistMemoryLaneContract* ChronicleLane =
HyperTwistMemoryPhase6RM1TestInternal::FindLaneContract(
LedgerState,
EHyperTwistMemoryLane::ChronicleCapture
);
TestNotNull(TEXT("The chronicle lane contract must exist."), ChronicleLane);
if (ChronicleLane != nullptr)
{
TestEqual(TEXT("The chronicle lane id must stay canonical."), ChronicleLane->LaneId, TEXT("memory-lane/chronicle-capture"));
TestEqual(TEXT("The chronicle lane must remain authoritative."), ChronicleLane->AuthorityKind, EHyperTwistMemoryAuthorityKind::Authoritative);
}
const FHyperTwistMemoryLaneContract* SharedCoordinationLane =
HyperTwistMemoryPhase6RM1TestInternal::FindLaneContract(
LedgerState,
EHyperTwistMemoryLane::SharedCoordination
);
TestNotNull(TEXT("The shared coordination lane contract must exist."), SharedCoordinationLane);
if (SharedCoordinationLane != nullptr)
{
TestEqual(TEXT("The shared coordination lane id must stay canonical."), SharedCoordinationLane->LaneId, TEXT("memory-lane/shared-coordination"));
TestEqual(TEXT("The shared coordination lane must remain semi-authoritative."), SharedCoordinationLane->AuthorityKind, EHyperTwistMemoryAuthorityKind::SemiAuthoritative);
}
const FHyperTwistMemoryLaneContract* DerivedLane =
HyperTwistMemoryPhase6RM1TestInternal::FindLaneContract(
LedgerState,
EHyperTwistMemoryLane::DerivedCompacted
);
TestNotNull(TEXT("The derived-compacted lane contract must exist."), DerivedLane);
if (DerivedLane != nullptr)
{
TestEqual(TEXT("The derived-compacted lane id must stay canonical."), DerivedLane->LaneId, TEXT("memory-lane/derived-compacted"));
TestEqual(TEXT("The derived-compacted lane must remain derived-only."), DerivedLane->AuthorityKind, EHyperTwistMemoryAuthorityKind::DerivedOnly);
}
return true;
}
IMPLEMENT_SIMPLE_AUTOMATION_TEST(
FHyperTwistMemoryPhase6RM1DerivedProvenanceTest,
"HyperTwist.FirstParty.Memory.Phase6R.M1.DerivedProvenance",
EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)
bool FHyperTwistMemoryPhase6RM1DerivedProvenanceTest::RunTest(const FString& Parameters)
{
const FHyperTwistMemoryLedgerState LedgerState =
UHyperTwistContractLibrary::MakeSampleTrainingMemoryLedgerState();
TestTrue(TEXT("The Phase 6R-M1 memory ledger must be structurally valid."), LedgerState.IsStructurallyValid());
TestTrue(TEXT("The memory ledger must expose authoritative entities."), LedgerState.AuthoritativeEntityCount > 0);
TestTrue(TEXT("The memory ledger must expose semi-authoritative entities."), LedgerState.SemiAuthoritativeEntityCount > 0);
TestTrue(TEXT("The memory ledger must expose derived entities."), LedgerState.DerivedEntityCount > 0);
const FHyperTwistMemoryEntityDescriptor* LearnerStateEntity =
HyperTwistMemoryPhase6RM1TestInternal::FindEntityByRecordKind(
LedgerState,
TEXT("case-learner-state")
);
TestNotNull(TEXT("A semi-authoritative case learner-state entity must exist."), LearnerStateEntity);
if (LearnerStateEntity != nullptr)
{
TestEqual(TEXT("The case learner-state entity must remain in the cognitive lane."), LearnerStateEntity->Lane, EHyperTwistMemoryLane::CognitiveConsolidated);
TestEqual(TEXT("The case learner-state entity must remain semi-authoritative."), LearnerStateEntity->AuthorityKind, EHyperTwistMemoryAuthorityKind::SemiAuthoritative);
TestTrue(TEXT("The case learner-state entity must remain derived from chronicle evidence."), LearnerStateEntity->bDerived);
TestTrue(TEXT("The case learner-state entity must preserve provenance."), LearnerStateEntity->ProvenanceLinks.Num() > 0);
}
const FHyperTwistMemoryEntityDescriptor* ReviewProgramEntity =
HyperTwistMemoryPhase6RM1TestInternal::FindEntityByRecordKind(
LedgerState,
TEXT("review-program-summary")
);
TestNotNull(TEXT("A review-program summary entity must exist."), ReviewProgramEntity);
if (ReviewProgramEntity != nullptr)
{
TestEqual(TEXT("The review-program summary must remain in the recall lane."), ReviewProgramEntity->Lane, EHyperTwistMemoryLane::RecallRetrieval);
TestEqual(TEXT("The review-program summary must remain semi-authoritative."), ReviewProgramEntity->AuthorityKind, EHyperTwistMemoryAuthorityKind::SemiAuthoritative);
TestTrue(TEXT("The review-program summary must preserve provenance."), ReviewProgramEntity->ProvenanceLinks.Num() > 0);
}
const FHyperTwistMemoryEntityDescriptor* LearnerProfileEntity =
HyperTwistMemoryPhase6RM1TestInternal::FindEntityByRecordKind(
LedgerState,
TEXT("learner-profile-summary")
);
TestNotNull(TEXT("A learner-profile summary entity must exist."), LearnerProfileEntity);
if (LearnerProfileEntity != nullptr)
{
TestEqual(TEXT("The learner-profile summary must remain in the derived lane."), LearnerProfileEntity->Lane, EHyperTwistMemoryLane::DerivedCompacted);
TestEqual(TEXT("The learner-profile summary must remain derived-only."), LearnerProfileEntity->AuthorityKind, EHyperTwistMemoryAuthorityKind::DerivedOnly);
TestTrue(TEXT("The learner-profile summary must preserve provenance."), LearnerProfileEntity->ProvenanceLinks.Num() > 0);
}
return true;
}
IMPLEMENT_SIMPLE_AUTOMATION_TEST(
FHyperTwistMemoryPhase6RM1SerializationRoundTripTest,
"HyperTwist.FirstParty.Memory.Phase6R.M1.SerializationRoundTrip",
EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)
bool FHyperTwistMemoryPhase6RM1SerializationRoundTripTest::RunTest(const FString& Parameters)
{
const FHyperTwistMemoryLedgerState LedgerState =
UHyperTwistContractLibrary::MakeSampleTrainingMemoryLedgerState();
TestTrue(TEXT("The Phase 6R-M1 memory ledger must be structurally valid."), LedgerState.IsStructurallyValid());
const FString Json = UHyperTwistContractLibrary::SerializeMemoryLedgerStateToJson(LedgerState);
TestFalse(TEXT("The serialized memory ledger JSON must not be empty."), Json.IsEmpty());
TestTrue(TEXT("The serialized memory ledger JSON must expose the chronicle lane id."), Json.Contains(TEXT("memory-lane/chronicle-capture")));
FHyperTwistMemoryLedgerState RoundTrippedLedgerState;
TestTrue(TEXT("The memory ledger JSON must deserialize cleanly."), UHyperTwistContractLibrary::DeserializeMemoryLedgerStateFromJson(Json, RoundTrippedLedgerState));
TestTrue(TEXT("The round-tripped memory ledger must remain structurally valid."), RoundTrippedLedgerState.IsStructurallyValid());
TestEqual(TEXT("The round-tripped memory ledger must preserve lane counts."), RoundTrippedLedgerState.LaneContracts.Num(), LedgerState.LaneContracts.Num());
TestEqual(TEXT("The round-tripped memory ledger must preserve entity counts."), RoundTrippedLedgerState.Entities.Num(), LedgerState.Entities.Num());
TestEqual(TEXT("The round-tripped memory ledger must preserve authoritative counts."), RoundTrippedLedgerState.AuthoritativeEntityCount, LedgerState.AuthoritativeEntityCount);
TestEqual(TEXT("The round-tripped memory ledger must preserve semi-authoritative counts."), RoundTrippedLedgerState.SemiAuthoritativeEntityCount, LedgerState.SemiAuthoritativeEntityCount);
TestEqual(TEXT("The round-tripped memory ledger must preserve derived counts."), RoundTrippedLedgerState.DerivedEntityCount, LedgerState.DerivedEntityCount);
TestEqual(TEXT("The round-tripped memory ledger must preserve the economic profile id."), RoundTrippedLedgerState.EconomicRetentionProfile.ProfileId, LedgerState.EconomicRetentionProfile.ProfileId);
TestEqual(TEXT("The round-tripped memory ledger must preserve the max profile id."), RoundTrippedLedgerState.MaxRetentionProfile.ProfileId, LedgerState.MaxRetentionProfile.ProfileId);
return true;
}
#endif

View file

@ -0,0 +1,142 @@
# HyperTwist Phase 6R-M1 first-party memory contracts and ledger implementation packet
Created on `2026-05-28`
## Status
- first-party HyperTwist packet
- bounded `Phase 6R-M1` implementation slice
## Purpose
This packet lands the first bounded first-party memory implementation slice
under the canonical `Memory Lanes` doctrine.
The landed slice is:
- first-party memory contracts and ledger
It is not:
- a broad memory federation packet
- a chronicle/session-grouping packet
- a continuity/resume packet
- a recall/history-search packet
- a shared-context widening packet
- a cognitive extraction packet
- a knowledge-promotion or user-notes packet
- 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_M1_FIRST_PARTY_MEMORY_CONTRACTS_AND_LEDGER_PREPARATION_PACKET_2026-05-28.md`
The preserved owners do not change:
- first-party HyperTwist remains the top-level owner for live memory-lane
contracts and memory-ledger product surfaces
- current training, replay, coaching, and repository code remains the raw
evidence 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 memory-contract and
memory-ledger seam through:
- canonical memory lane, provenance, entity, feature-gate, retention-profile,
and ledger state types in:
- `HyperTwistMemoryTypes.h`
- first-party ledger derivation from current training repository state in:
- `UHyperTwistMemoryCoreLibrary`
- current bounded lane and control surfaces for:
- `12` memory lane contracts
- `12` feature gates
- `Economic-Retention Mode`
- `Max-Retention Mode`
- current bounded entity-ledger coverage for:
- identity policy profile
- provenance ledger contract
- run records
- review plans
- session templates
- method-drill favorites
- method-drill batches
- coach action plans
- coach session queues
- learner states
- review-program summary
- coach session-queue execution summaries
- coach memory snapshot
- coach closure memory summary
- coach recommendation history summary
- coach carry-forward policy summary
- coach archive policy summary
- learner profile summary
- ledger overview
- bounded provenance links and authority counters for:
- authoritative entities
- semi-authoritative entities
- derived-only entities
- sample contract helpers in:
- `UHyperTwistContractLibrary::MakeSampleTrainingMemoryLedgerState()`
- `UHyperTwistContractLibrary::SerializeMemoryLedgerStateToJson(...)`
- `UHyperTwistContractLibrary::DeserializeMemoryLedgerStateFromJson(...)`
- sample repository-state repair so review-program summary evidence now exists
without recursive sample construction
- focused automation coverage in:
- `HyperTwistMemoryPhase6RM1LedgerContractTest.cpp`
## Why this is still intentionally bounded
This packet lands memory contracts and ledger only.
Still deferred:
- chronicle ledger, session grouping, and resume packs
- explicit recall/history search and shared-context widening
- cognitive extraction, contradiction handling, supersession, or confidence
decay
- curated knowledge-promotion flows
- user-authored notes
- derived compact reducers, digests, and reduced-context packets
## Validation
Build validation:
- `UnrealHyperTwistEditor Win64 Development`
Focused automation validation:
- `HyperTwist.FirstParty.Memory.Phase6R.M1.LaneContracts`
- `HyperTwist.FirstParty.Memory.Phase6R.M1.DerivedProvenance`
- `HyperTwist.FirstParty.Memory.Phase6R.M1.SerializationRoundTrip`
Non-blocking warnings stayed limited to the existing Unreal headless/editor
noise, expected Python-stub regeneration noise, headless CEF/web-browser
warnings, and benign asset-registry/cache journal chatter during editor
startup.
## Queue effect
This packet consumes the current `Phase 6R-M1` implementation slice.
Memory implementation is now live at the contract/ledger layer through lane
ids, entity ids, provenance links, authority flags, feature-gate/settings
control, and retention-profile defaults.
If later memory implementation continues:
- the next clean move is `Phase 6R-M2`
- do not reopen `6R-M1` as one broad "memory packet"

View file

@ -0,0 +1,118 @@
# HyperTwist Phase 6R-M1 first-party memory contracts and ledger preparation packet
Created on `2026-05-28`
## Status
- first-party HyperTwist packet
- source-backed `Phase 6R-M1` preparation/control slice
## Purpose
This packet scopes the first bounded first-party memory implementation slice
under the canonical `Memory Lanes` doctrine.
The granted slice is:
- first-party memory contracts and ledger only
It is not:
- a broad memory federation packet
- a chronicle/session-grouping packet
- a continuity/resume packet
- a recall/history-search packet
- a shared-context widening packet
- a cognitive fact-extraction packet
- a knowledge-promotion or user-notes packet
- 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/VECTORSHELL_MEMORY_SYSTEM_IMPORT_AUTHORITY_FOR_HYPERTWIST_2026-05-25.md`
The preserved owners do not change here:
- first-party HyperTwist remains the top-level owner for live memory-lane
contracts and memory-ledger product surfaces
- current training, replay, coaching, and repository code remains the raw
evidence 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-M1` slice may land:
1. lane ids and lane contracts for the canonical first-party `Memory Lanes`
2. memory entity ids for current authoritative, semi-authoritative, and
derived product-memory objects over the live training repository state
3. provenance-link structures and ledger-visible parentage for non-raw memory
entities
4. authoritative-versus-derived flags and counts
5. settings keys, feature gates, and preset-backed retention-profile defaults
for:
- `Economic-Retention Mode`
- `Max-Retention Mode`
6. bounded sample contract and serialization coverage for the `6R-M1` ledger
surface
The packet must stay out of:
- chronicle grouping and resume-pack ownership
- explicit remember/recall search ownership
- scoped shared-context widening
- cognitive extraction, contradiction handling, or supersession
- curated knowledge-promotion flows
- user-authored notes
- compact reducers, digests, or reduced-context packets
## Proposed implementation shape
Land the narrower first-party boundary through:
- new memory types for:
- lane contracts
- feature gates
- provenance links
- entity descriptors
- retention profiles
- bounded ledger state
- a first-party memory-core library that derives the ledger from current
repository state
- sample-contract helpers for:
- sample memory ledger creation
- JSON serialization
- JSON deserialization
- focused automation in:
- `HyperTwistMemoryPhase6RM1LedgerContractTest.cpp`
## Validation target
Validate with:
- Unreal build for `UnrealHyperTwistEditor Win64 Development`
- focused automation:
- `HyperTwist.FirstParty.Memory.Phase6R.M1.LaneContracts`
- `HyperTwist.FirstParty.Memory.Phase6R.M1.DerivedProvenance`
- `HyperTwist.FirstParty.Memory.Phase6R.M1.SerializationRoundTrip`
## Queue effect
If this packet lands cleanly, HyperTwist memory no longer remains only a
retained doctrine surface at the contract layer. A first bounded live
first-party memory-ledger seam becomes current product truth.
If later memory implementation continues:
- the next clean move is `Phase 6R-M2`
- do not reopen `6R-M1` as one broad "memory packet"

View file

@ -222,6 +222,9 @@ The next bounded move is now:
When HyperTwist later returns to memory implementation:
- the bounded first-party `Phase 6R-M1` memory contracts and ledger packet is
now landed in current code
- if memory implementation continues, the next clean move is `Phase 6R-M2`
- 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`

View file

@ -643,6 +643,15 @@ Implement:
- authoritative-versus-derived flags
- settings keys and feature gates
Current standing:
- the bounded first-party `Phase 6R-M1` memory contracts and ledger packet is
now landed in current code
- current live `6R-M1` surfaces cover lane ids, memory entity ids, provenance
links, authority flags, feature gates, retention profiles, and bounded
ledger serialization
- if memory implementation continues, the next clean move is `6R-M2`
### `6R-M2` - chronicle and continuity packet
Implement:

View file

@ -179,6 +179,8 @@ That means:
- one federated substrate
- bounded `Memory Lanes`
- a live first-party `Phase 6R-M1` contract/ledger layer over current memory
evidence surfaces
- explicit provenance
- explicit custody
- two context-assembly profiles:

View file

@ -287,6 +287,7 @@ repo.
|---|---|---|---|
| Session continuity and workspace recall fragments | Implemented now | first-party runtime/training surfaces | Real substrate fragments under the canonical `Memory Lanes`; not yet a full lane implementation. |
| Provenance-aware training/replay/publication state | Implemented now | first-party contract/provenance surfaces | Existing product truth. |
| First-party memory contracts and ledger | Implemented now | landed first-party `Phase 6R-M1` packet | Current bounded memory lane ids, entity ids, provenance links, authority flags, feature gates, retention profiles, and ledger JSON round-trip are live. Chronicle/resume, recall/shared context, cognitive extraction, knowledge/notes, 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. |

View file

@ -95,6 +95,8 @@ Companion extraction surface:
The memory doctrine defines provenance/trust-ledger memory as a distinct lane
and requires provenance to survive:
- the landed bounded first-party `Phase 6R-M1` memory contracts and ledger
packet
- chronicle capture
- continuity/resume packets
- cognitive coach-state consolidation

View file

@ -131,6 +131,12 @@ Canonical discovery surfaces for roadmap interpretation:
- the continuity-profile sync now names `Continuity Lattice` as the substrate only, keeps
`Memory Lanes` canonical, and treats `Max-Retention Mode` and `Economic-Retention Mode` as
preset-backed overrideable context-assembly profiles rather than a second memory system
- the generic first-party `Phase 6R-M1` memory contracts and ledger control pass is now
consumed
- the bounded first-party `Phase 6R-M1` memory contracts and ledger packet is now landed in
current code
- if memory implementation continues, the next clean move is `Phase 6R-M2` chronicle and
continuity rather than reopening `6R-M1` as a broad memory packet
- 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