Contract Definitions Ported to Kotlin
Issue #4 is complete. The architecture diagrams from Issue #3 now have corresponding Kotlin code. Total Recall is a running MCP server.
What Was Built
Domain Model (6 types)
mimis.gildi.memory.domain.model — the core vocabulary:
-
Memory — the aggregate root. Content, tier, metadata, salience score, claimed status.
-
Tier — enum:
IDENTITY_CORE,ACTIVE_CONTEXT,LONG_TERM,ARCHIVE. Each with its own decay semantics. -
Association — typed link between two memories with strength.
-
AssociationType — enum:
TEMPORAL,CAUSAL,THEMATIC,EMOTIONAL,PERSON. -
SalienceScore — score, last access, decay rate, claimed flag.
-
AssociationDirection — enum:
CREATE,STRENGTHEN,WEAKEN. -
WorkingMode — enum:
TASK,CONVERSATION,IDLE. -
SessionEndReason — enum:
EXPLICIT,TIMEOUT,CRASH.
Domain Messages (4 sealed hierarchies)
mimis.gildi.memory.domain.message — every message from the catalog, now type-safe:
-
Command — 7 sealed variants.
StoreCommand,ClaimCommand,AssociateCommand,ReclassifyCommand,ConsolidateCommand,ShutdownCommand,DecaySweep. -
Query — 2 sealed variants.
SearchQuery,ReflectQuery. -
Event — 17 sealed variants. Every state change in the system is a named, typed event.
-
Notification — 3 sealed variants.
BreakNotification,SessionAuditPrompt,TotalRecallAdvisory.
Port Interfaces (5 interfaces)
Inbound (mimis.gildi.memory.port.inbound):
-
MemoryPort — store, search, claim, associate, reclassify, reflect
-
LifecyclePort — session start, session end, state transition
Outbound (mimis.gildi.memory.port.outbound):
-
BackingServicePort — persist, retrieve, query, delete
-
NotificationPort — notify the connected mind
-
RelayPort — inter-instance messaging (future, interface ready)
MCP Server (10 tools)
The server runs on stdio and registers all 10 tools. All are teapot stubs — callable, accepting valid input, returning placeholder responses. The contract skeleton is complete; backing services are not yet wired.
Tools: store_memory, search_memory, claim_memory, session_start, session_end, state_transition, heartbeat, associate_memories, reclassify_memory, reflect.
What This Means
The design and the code now agree. Every port in the hexagonal diagram has a Kotlin interface. Every message in the catalog has a sealed class. Every tool in the MCP server maps to a domain command. No interface depends on an implementation — no Redis imports in port definitions.
What’s Next
Wire the backing services. Redis behind BackingServicePort. The teapot stubs become real operations. The tree grows.