REST API for managing shared, persistent memories intended for GPT Actions and other API clients.
This service stores memory entries in a JSON file, exposes CRUD endpoints, and protects requests using the NuciAPI authorization.
- Overview
- Features
- Architecture
- Requirements
- Configuration
- Run Locally
- API
- Data Storage
- Logging
- Development Notes
- Release
- License
GPT Memory Store is an ASP.NET Core Web API application that provides:
- Create memory records
- Read one or all memory records
- Update existing memory records
- Delete memory records
Memories are persisted to a file-based JSON repository and can be shared across sessions, users, or agents depending on how you deploy and secure the API.
- Lightweight JSON file persistence (no database required)
- Clean CRUD controller at route
/Memories - API Key based authorization via NuciAPI
- Structured operation logging through NuciLog
The project is organized in layers:
Api/Controllers: HTTP endpointsApi/Requests: request DTOsApi/Responses: response DTOsService: domain service and business logicDataAccess/DataObjects: persistence data modelConfiguration: strongly typed app settingsLogging: operation and key definitions for structured logs
On startup:
- Configuration objects are bound from
appsettings.json. - Services and repositories are registered in DI.
- The memory store file is created automatically if missing.
- Middleware pipeline enables exception handling, routing, and authorization.
- .NET SDK 10.0 (target framework is
net10.0) - Linux, macOS, or Windows
Check SDK version:
dotnet --versionMain settings are defined in appsettings.json:
{
"securitySettings": {
"apiKey": "[[GPT_MEMORY_STORE_API_KEY]]"
},
"dataStoreSettings": {
"memoryStorePath": "Data/memories.json"
},
"nuciLoggerSettings": {
"logFilePath": "logfile.log",
"isFileOutputEnabled": true
}
}Settings reference:
securitySettings.apiKey: shared secret used by NuciAPI authorization.dataStoreSettings.memoryStorePath: path to the JSON store file.nuciLoggerSettings.logFilePath: output log file path.nuciLoggerSettings.isFileOutputEnabled: toggles file logging.
Important:
- Replace the placeholder API key with a strong secret before deploying.
- The service creates the target directory and initializes the JSON store with
[]when the file does not exist.
Restore and build:
dotnet restore
dotnet buildRun:
dotnet runOptional custom URL:
dotnet run --urls "http://127.0.0.1:5081"All endpoints are protected by NuciAPI authorization (NuciApiAuthorisation.ApiKey(...)).
When calling the API from custom clients, include the required authentication data expected by your NuciAPI setup (API key). Using the NuciAPI.Client NuGet package is the most reliable approach.
Unauthenticated requests return 403 Forbidden.
Logical memory model exposed by responses:
{
"id": "f95bc067-a568-414d-99dc-2663a01926e8",
"createdDateTime": "2026-03-16T08:28:16.0238073+02:00",
"updatedDateTime": "2026-03-16T08:29:40.6566852+02:00",
"content": "Test memory",
"source": "Test",
"confidence": 0.5
}Field notes:
id: generated GUID by default on create.createdDateTime: set at creation time.updatedDateTime: null until updated.confidence: decimal score (for example0.0to1.0by convention).
Base route: /Memories
| Method | Route | Description |
|---|---|---|
POST |
/Memories |
Create a new memory |
GET |
/Memories |
Retrieve all memories |
GET |
/Memories/{id} |
Retrieve one memory by id |
PUT |
/Memories |
Update an existing memory |
DELETE |
/Memories/{id} |
Delete memory by id |
Note: The details shown below are illustrative. Use your exact headers and values in real calls.
Create:
curl -X POST "http://127.0.0.1:5000/Memories" \
-H "Content-Type: application/json" \
-H "Authorization: [[GPT_MEMORY_STORE_API_KEY]]"
-d '{
"content": "The user prefers concise technical answers.",
"source": "profile-sync",
"confidence": 0.95
}'Get all:
curl -X GET "http://127.0.0.1:5000/Memories" \
-H "Authorization: [[GPT_MEMORY_STORE_API_KEY]]"Get by id:
curl -X GET "http://127.0.0.1:5000/Memories/f95bc067-a568-414d-99dc-2663a01926e8" \
-H "Authorization: [[GPT_MEMORY_STORE_API_KEY]]"Update:
curl -X PUT "http://127.0.0.1:5000/Memories" \
-H "Content-Type: application/json" \
-H "Authorization: [[GPT_MEMORY_STORE_API_KEY]]"
-d '{
"id": "f95bc067-a568-414d-99dc-2663a01926e8",
"content": "The user prefers concise technical answers and code-first guidance.",
"source": "profile-sync",
"confidence": 0.97
}'Delete:
curl -X DELETE "http://127.0.0.1:5000/Memories/f95bc067-a568-414d-99dc-2663a01926e8" \
-H "Authorization: [[GPT_MEMORY_STORE_API_KEY]]"The repository is file based (JsonRepository<GptMemoryDataObject>), using the path from dataStoreSettings.memoryStorePath.
Persistence format example (Data/memories.json):
[
{
"date": null,
"createdTimestamp": "2026-03-16T08:28:16.0238073+02:00",
"updatedTimestamp": "2026-03-16T08:29:40.6566852+02:00",
"content": "Test memory",
"source": "Test",
"confidence": 0.5,
"id": "f95bc067-a568-414d-99dc-2663a01926e8"
}
]The service logs operation lifecycle events for:
CreateMemoryGetMemoriesGetMemoryUpdateMemoryDeleteMemory
Each operation writes started/success/failure events with useful context keys (id, source, confidence, count, and more).
PUT /MemoriespreservescreatedDateTimefrom the existing record and updatesupdatedDateTimeto the current time.POST /Memoriescurrently ignores any incomingidfield and generates a new GUID from the domain model default.- Static file middleware is enabled. If
wwwrootis missing, startup may log a warning, but API endpoints continue to work.
This repository includes release.sh, which delegates to an external .NET release script:
./release.sh v1.0.0Licensed under GNU GPL v3. See LICENSE for details.