Motivation
Codemem excels at capturing and retrieving session memories, but it doesn't build a long-term understanding of the user themselves — their preferences, recurring patterns, and typical workflows. A user profile that evolves over time would complement the existing memory system by providing persistent context about who the user is and how they work, independent of any specific session or project.
Proposed Feature
A user profile learning system that:
-
Analyzes conversation patterns over time — periodically examines captured memories and session data to extract user preferences, recurring patterns, and common workflows.
-
Maintains a structured profile with three categories:
- Preferences —
category, description, confidence (0-1), evidence[] (memory IDs supporting it), lastUpdated
- Patterns — recurring behaviors with frequency tracking
- Workflows — multi-step sequences the user regularly follows, with
steps[] and frequency
-
Stores profile data in a dedicated table (e.g., user_profiles + user_profile_changelogs for version tracking) with profile_data as JSON, version, total_prompts_analyzed, and is_active fields.
-
Injects profile context alongside memory packs — when building a pack for prompt injection, include a concise summary of the user's profile so the AI agent can tailor its responses to known preferences.
-
Exposes profile via CLI and web viewer — codemem profile show / codemem profile update commands, and a profile tab in the web viewer.
Implementation Notes
- The observer model (already configurable via
observer_provider/observer_model) could be reused for profile extraction — run periodic profile analysis as a background job, similar to how raw events are processed.
- Profile updates should be versioned with a changelog (
change_type: added/updated/removed, change_summary, profile_data_snapshot) so users can review what changed and when.
- Confidence scoring per preference, backed by evidence (memory IDs), ensures transparency — users can see why a preference was inferred.
Reference
opencode-mem (tickernelz/opencode-mem) implements a similar feature in src/services/user-profile/user-profile-manager.ts with UserProfileData = { preferences, patterns, workflows } stored in a dedicated user-profiles.db. This could serve as a design reference.
Motivation
Codemem excels at capturing and retrieving session memories, but it doesn't build a long-term understanding of the user themselves — their preferences, recurring patterns, and typical workflows. A user profile that evolves over time would complement the existing memory system by providing persistent context about who the user is and how they work, independent of any specific session or project.
Proposed Feature
A user profile learning system that:
Analyzes conversation patterns over time — periodically examines captured memories and session data to extract user preferences, recurring patterns, and common workflows.
Maintains a structured profile with three categories:
category,description,confidence(0-1),evidence[](memory IDs supporting it),lastUpdatedsteps[]andfrequencyStores profile data in a dedicated table (e.g.,
user_profiles+user_profile_changelogsfor version tracking) withprofile_dataas JSON,version,total_prompts_analyzed, andis_activefields.Injects profile context alongside memory packs — when building a pack for prompt injection, include a concise summary of the user's profile so the AI agent can tailor its responses to known preferences.
Exposes profile via CLI and web viewer —
codemem profile show/codemem profile updatecommands, and a profile tab in the web viewer.Implementation Notes
observer_provider/observer_model) could be reused for profile extraction — run periodic profile analysis as a background job, similar to how raw events are processed.change_type: added/updated/removed,change_summary,profile_data_snapshot) so users can review what changed and when.Reference
opencode-mem (tickernelz/opencode-mem) implements a similar feature in
src/services/user-profile/user-profile-manager.tswithUserProfileData = { preferences, patterns, workflows }stored in a dedicateduser-profiles.db. This could serve as a design reference.