No project description provided
Project description
Unique User Memory
Persistent per-user memory for Unique AI agents.
unique_user_memory stores a compact Markdown profile for each user and updates it after every agent turn. The profile is loaded before the next turn so the assistant can remember stable user context such as communication preferences, work context, expertise, recent topics, and open follow-ups.
What It Does
The package provides:
UserMemoryConfig- Pydantic configuration for the consolidation model, profile token budget, and memory folder.load_user_memory(...)- resolves the user's private memory folder, downloadsmemory.md, and enforces the configured token budget.UserMemoryPostprocessor- runs after the assistant response, consolidates the latest turn into the profile, and uploads the updatedmemory.md.
The memory file is intentionally small and structured. It is rewritten as a full Markdown profile rather than appended to as an event log.
Lifecycle
- The orchestrator enables memory when
space.allow_user_memoryis true. load_user_memory(...)resolves the pre-provisioned root folder, ensures a private child folder for the current user, and downloads/user-memory/<user_id>/memory.mdif it exists.- The loaded memory text is passed into the agent context for the current turn.
UserMemoryPostprocessorruns after the assistant response.- The package asks the configured language model to either return
NOOPor a complete rewritten profile. - If the profile changed,
memory.mdis uploaded back to the user's folder with ingestion skipped and the content hidden from chat.
Storage Model
Memory is stored in Unique content as Markdown:
/<root_folder>/<user_id>/memory.md
By default, root_folder is user-memory. The root folder must already exist. The package creates the per-user child folder when needed.
Profile Format
Profiles contain YAML frontmatter followed by fixed Markdown sections:
---
user_id: user_123
schema_version: 1
last_updated: 2026-06-17T12:00:00+00:00
turn_count: 1
---
# User Memory
## Identity
_(empty)_
## Communication Preferences
- Prefers concise answers with concrete examples.
## Work Context
_(empty)_
## Skills & Expertise
_(empty)_
## Recent Topics
_(empty)_
## Open Questions / Follow-ups
_(empty)_
The consolidation prompt preserves the schema, keeps bullets short, and returns NOOP when a turn has no durable user facts.
Configuration
Memory is activated by the orchestrator when space.allow_user_memory is true. UserMemoryConfig only configures how active memory is consolidated and stored.
from unique_user_memory import UserMemoryConfig
config = UserMemoryConfig(
max_tokens=2000,
root_folder="user-memory",
)
| Field | Default | Description |
|---|---|---|
language_model |
DEFAULT_GPT_4o |
Model used to consolidate the latest turn into the profile. |
max_tokens |
2000 |
Maximum profile size. Must be between 500 and 8000 tokens. |
root_folder |
user-memory |
Root KB folder that contains per-user memory folders. |
Integration
Typical orchestration code loads memory before the agent loop and registers the postprocessor for the same turn:
from unique_user_memory.user_memory import load_user_memory
from unique_user_memory.user_memory_postprocessor import UserMemoryPostprocessor
user_memory_state = await load_user_memory(
event=event,
config=config.agent.services.user_memory_config,
logger=logger,
)
if user_memory_state is not None:
user_memory_text = user_memory_state.text
postprocessor_manager.add_postprocessor(
UserMemoryPostprocessor(
config=config.agent.services.user_memory_config,
event=event,
state=user_memory_state,
logger=logger,
)
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unique_user_memory-2026.28.0.dev4.tar.gz.
File metadata
- Download URL: unique_user_memory-2026.28.0.dev4.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28c59b7cabaaa9ecef9400385e587fd7f8ff24c2ac2b63c53658d79dbd8128a1
|
|
| MD5 |
540b7370ce09d02e7d98c0b7a165b790
|
|
| BLAKE2b-256 |
1c4c6f584d9e50e721d7c308183f8621d2dd17ada48424ff9e36283ba1c87892
|
File details
Details for the file unique_user_memory-2026.28.0.dev4-py3-none-any.whl.
File metadata
- Download URL: unique_user_memory-2026.28.0.dev4-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31ba74ac360fd75fe19f919ac8b8cdfbf0fa492465d23ef3189c1c5d25ceef78
|
|
| MD5 |
9f7dd4ddc2900bcd5577004302a041d8
|
|
| BLAKE2b-256 |
6bee741f0b97a1d6ec9519ca00f7d259559378bc7ec809b05d5a179ead6d2310
|