Preferences
Intelligent preference learning from user interactions. Tracks patterns in choices, coding style, communication preferences, and more.
What Are Preferences?
Preferences capture learned patterns about how a user or team likes to work. Rather than requiring explicit configuration, Rekall observes interactions and detects preferences automatically: coding style conventions, communication tone, preferred tools, and decision-making patterns.
Each preference has a confidence score based on how many times the pattern has been observed. Preferences with low confidence are treated as tentative, while high-confidence preferences are applied reliably. Users can always override or correct any detected preference.
When to Use
- •Adapting agent behavior to individual user preferences
- •Learning coding style conventions (indentation, naming, patterns)
- •Tracking communication preferences (verbosity, formality, format)
- •Remembering tool and technology preferences
- •Building personalized experiences that improve over time
Quick Example
import Rekall from '@rekall/sdk';const rekall = new Rekall({ apiKey: 'rk_your_api_key' });// Manually set a preferenceawait rekall.preferences.set({category: 'coding_style',preference: 'Uses 2-space indentation in TypeScript files',confidence: 0.95,evidenceCount: 12,});// Query preferences by categoryconst prefs = await rekall.preferences.list({category: 'coding_style',minConfidence: 0.7,});for (const pref of prefs) {console.log(pref.preference, `(${pref.confidence * 100}% confident)`);}// Get all preferences for personalizationconst all = await rekall.preferences.list({ minConfidence: 0.5 });
Fields Reference
| Field | Type | Required | Description |
|---|---|---|---|
| category | string | Yes | Category grouping (e.g., "coding_style", "communication", "tools"). |
| preference | string | Yes | Natural language description of the preference. |
| confidence | number | No | Confidence score from 0.0 to 1.0. Defaults to 0.5 for manual entries. |
| evidence_count | number | No | Number of observations supporting this preference. |
Advanced Usage
Auto-Detection
Rekall automatically detects preferences from interactions. When the agent observes patterns (e.g., the user consistently chooses Python, prefers brief responses, or uses a particular naming convention), it creates preferences with appropriate confidence scores.
// Configure preference auto-detectionawait rekall.preferences.configure({autoDetect: true,categories: ['coding_style', 'communication', 'tools', 'workflow'],minObservations: 3, // Require 3 observations before creating a preferenceinitialConfidence: 0.6,});// Record an observation (the system uses this for detection)await rekall.preferences.observe({category: 'coding_style',observation: 'User used arrow functions instead of function declarations',context: { file: 'src/utils.ts', language: 'typescript' },});// Review auto-detected preferencesconst detected = await rekall.preferences.listDetected();for (const pref of detected) {console.log(pref.preference, pref.confidence, pref.evidenceCount);// Confirm or rejectawait rekall.preferences.confirm(pref.id);// or: await rekall.preferences.reject(pref.id);}
Confidence Scoring
Confidence increases with each confirming observation and decreases when the user acts contrary to the preference. The scoring formula:
| Evidence Count | Confidence Range | Behavior |
|---|---|---|
| 1-2 | 0.3 - 0.5 | Tentative. Not applied unless explicitly queried. |
| 3-5 | 0.5 - 0.7 | Moderate. Applied as soft suggestions. |
| 6-10 | 0.7 - 0.9 | Strong. Applied by default, user can override. |
| 10+ | 0.9 - 1.0 | Very strong. Consistently applied. |
Use Cases
Coding Style Adaptation
Learn the user's coding conventions: indentation, naming patterns, preferred patterns (functional vs OOP), import style, and comment style. Generate code that matches their style automatically.
Communication Preferences
Detect whether the user prefers brief or detailed responses, technical or simplified language, with or without code examples, and adjust accordingly.
Tool Preferences
Remember which tools, libraries, and frameworks the user prefers. When suggesting solutions, default to their preferred stack.
Workflow Patterns
Learn how the user likes to work: do they prefer reviewing changes before applying, do they want tests run automatically, do they prefer incremental or batch changes?
Best Practices
Respect user agency
Always allow users to override or correct detected preferences. Preferences should enhance the experience, not constrain it. When unsure, ask rather than assume.
- 1.Use meaningful categories. Group preferences logically: coding_style, communication, tools, workflow. Consistent categories make querying easier.
- 2.Do not over-detect. Set a reasonable min_observations threshold. One-off choices are not preferences.
- 3.Show detected preferences. Let users see what preferences have been learned and give them control to edit or delete.
- 4.Decay contradicted preferences. If a user consistently acts against a detected preference, reduce its confidence or remove it.
- 5.Apply confidence thresholds. Only apply preferences above a confidence threshold (e.g., 0.7) to avoid acting on noise.
