Table of Contents

Class MemoryService

Namespace
JD.AI.Core.Memory
Assembly
JD.AI.Core.dll

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

public sealed class MemoryService : IMemoryService
Inheritance
MemoryService
Implements
Inherited Members

Constructors

MemoryService()

public MemoryService()

Properties

MemoryRoot

The root memory directory (~/.jdai/memory/).

public string MemoryRoot { get; }

Property Value

string

Methods

AppendToDailyLogAsync(string, string, CancellationToken)

Appends a single entry to the daily log for the current UTC date. Entries are written to memory/{projectId}/memory/YYYY/MM/yyyy-MM-dd.md.

public Task AppendToDailyLogAsync(string projectId, string entry, CancellationToken ct = default)

Parameters

projectId string
entry string
ct CancellationToken

Returns

Task

GetDailyLogAsync(string, DateTimeOffset, CancellationToken)

Reads the daily log for a specific date. Returns null if the file does not exist.

public Task<string?> GetDailyLogAsync(string projectId, DateTimeOffset logDate, CancellationToken ct = default)

Parameters

projectId string
logDate DateTimeOffset
ct CancellationToken

Returns

Task<string>

GetMemoryContentAsync(string, CancellationToken)

Reads the long-term memory file for a project. Returns an empty string if the file does not exist.

public Task<string> GetMemoryContentAsync(string projectId, CancellationToken ct = default)

Parameters

projectId string
ct CancellationToken

Returns

Task<string>

WriteMemoryContentAsync(string, string, CancellationToken)

Updates the long-term MEMORY.md file for a project.

public Task WriteMemoryContentAsync(string projectId, string content, CancellationToken ct = default)

Parameters

projectId string
content string
ct CancellationToken

Returns

Task