feat(memory): scope chat notes and preserve deletions on restore (#2069)

Keep personal notes private by default and require review before publishing shared notes. Restore backups and replay forgotten notes in one transaction, and retain the installed release when an unattended rollback could bring back forgotten notes.
This commit is contained in:
sam committed 2026-11-21 13:20:31 +11:00
1 parent 81bca2251e
commit 073959b4f9
39 files changed
+4792 -168

No files matched your search

+471
View File
@@ -603,6 +603,15 @@ components:
- name
- kind
type: object
CorrectInputBody:
additionalProperties: false
properties:
text:
description: The corrected note
type: string
required:
- text
type: object
CreateTokenInputBody:
additionalProperties: false
properties:
@@ -697,6 +706,15 @@ components:
- body
- created_at
type: object
DisabledInputBody:
additionalProperties: false
properties:
disabled:
description: Whether the note stops being read
type: boolean
required:
- disabled
type: object
DraftsTrigger:
additionalProperties: false
properties:
@@ -1946,6 +1964,90 @@ components:
- created_by
- created_at
type: object
MemoryNote:
additionalProperties: false
properties:
class:
type: string
created_at:
format: date-time
type: string
disabled:
type: boolean
id:
type: string
owner_id:
type: string
purpose:
type: string
scope:
type: string
shared_by:
type: string
state:
type: string
text:
type: string
version:
format: int64
type: integer
required:
- id
- class
- scope
- state
- purpose
- text
- version
- disabled
- created_at
type: object
MemoryNotes:
additionalProperties: false
properties:
notes:
items:
$ref: "#/components/schemas/MemoryNote"
type:
- array
- "null"
required:
- notes
type: object
MemoryVersion:
additionalProperties: false
properties:
published_at:
format: date-time
type: string
publisher_id:
type: string
purpose:
type: string
text:
type: string
version:
format: int64
type: integer
required:
- version
- text
- purpose
- publisher_id
- published_at
type: object
MemoryVersions:
additionalProperties: false
properties:
versions:
items:
$ref: "#/components/schemas/MemoryVersion"
type:
- array
- "null"
required:
- versions
type: object
PolicyInputBody:
additionalProperties: false
properties:
@@ -2070,6 +2172,16 @@ components:
- name
- expected_version
type: object
RollbackInputBody:
additionalProperties: false
properties:
version:
description: The published version to publish again
format: int64
type: integer
required:
- version
type: object
RunsActionTrail:
additionalProperties: false
properties:
@@ -2580,6 +2692,15 @@ components:
- admin_token_set
- sealing_identity_set
type: object
TextInputBody:
additionalProperties: false
properties:
text:
description: The note itself. A credential-shaped value is redacted, and a credential or a security override is refused.
type: string
required:
- text
type: object
Usage:
additionalProperties: false
properties:
@@ -4169,6 +4290,356 @@ paths:
summary: Accept an MCP server and the tools it may offer
tags:
- MCP servers
/api/memory/notes:
get:
operationId: list-memory-notes
parameters:
- description: The memory class, durable facts by default
explode: false
in: query
name: class
schema:
description: The memory class, durable facts by default
enum:
- working_context
- episodic_history
- enterprise_retrieval
- durable_fact
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNotes"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List the notes you may read
tags:
- Memory
post:
operationId: remember-memory-note
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/TextInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNote"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Remember a note for yourself
tags:
- Memory
/api/memory/notes/{id}:
delete:
operationId: forget-memory-note
parameters:
- description: The note's id
in: path
name: id
required: true
schema:
description: The note's id
format: uuid
type: string
responses:
"204":
description: No Content
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Forget one of your notes
tags:
- Memory
patch:
operationId: correct-memory-note
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CorrectInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNote"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Correct one of your notes
tags:
- Memory
/api/memory/notes/{id}/disabled:
post:
operationId: disable-memory-note
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/DisabledInputBody"
required: true
responses:
"204":
description: No Content
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Stop one of your notes being read, or resume it
tags:
- Memory
/api/memory/proposals:
get:
operationId: list-note-proposals
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNotes"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List notes waiting to be published
tags:
- Memory
post:
operationId: propose-shared-note
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/TextInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNote"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Propose a note for the whole organisation
tags:
- Memory
/api/memory/proposals/{id}/publish:
post:
operationId: approve-note-proposal
parameters:
- description: The note's id
in: path
name: id
required: true
schema:
description: The note's id
format: uuid
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNote"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Publish a proposed note
tags:
- Memory
/api/memory/shared:
get:
operationId: list-shared-notes
parameters:
- description: The memory class, durable facts by default
explode: false
in: query
name: class
schema:
description: The memory class, durable facts by default
enum:
- working_context
- episodic_history
- enterprise_retrieval
- durable_fact
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNotes"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List the notes published to the organisation
tags:
- Memory
post:
operationId: publish-shared-note
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/TextInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNote"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Publish a note to the whole organisation
tags:
- Memory
/api/memory/shared/{id}:
delete:
operationId: revoke-shared-note
parameters:
- description: The note's id
in: path
name: id
required: true
schema:
description: The note's id
format: uuid
type: string
responses:
"204":
description: No Content
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Revoke a shared note, published or proposed
tags:
- Memory
/api/memory/shared/{id}/rollback:
post:
operationId: roll-back-shared-note
parameters:
- in: path
name: id
required: true
schema:
format: uuid
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RollbackInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryNote"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Publish an earlier version of a shared note again
tags:
- Memory
/api/memory/shared/{id}/versions:
get:
operationId: list-note-versions
parameters:
- description: The note's id
in: path
name: id
required: true
schema:
description: The note's id
format: uuid
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/MemoryVersions"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List the published versions of a shared note
tags:
- Memory
/api/orgs:
get:
operationId: list-orgs