Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: custom prompt for reminders extraction

Louis Beaumont1e8214961131
diff --git a/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx b/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
index ba642d990..00ad4b219 100644
--- a/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
@@ -5,6 +5,7 @@ import { Card, CardContent } from "@/components/ui/card";
import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button";
+import { Textarea } from "@/components/ui/textarea";
import {
AlertCircle,
Bell,
@@ -36,6 +37,9 @@ export function AppleIntelligenceCard() {
const [isScanning, setIsScanning] = useState(false);
const [lastScanResult, setLastScanResult] = useState<string | null>(null);
const [reminderCount, setReminderCount] = useState(0);
+ const [customPrompt, setCustomPrompt] = useState("");
+ const [promptDirty, setPromptDirty] = useState(false);
+ const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
useEffect(() => {
setOs(platform());
@@ -110,6 +114,11 @@ export function AppleIntelligenceCard() {
if (status.authorizationStatus === "Denied") {
setAuthDenied(true);
}
+ if (status.authorized) {
+ invoke<string>("reminders_get_custom_prompt")
+ .then((p) => setCustomPrompt(p))
+ .catch(() => {});
+ }
} catch {}
}, []);
@@ -119,6 +128,19 @@ export function AppleIntelligenceCard() {
}
}, [aiStatus, checkRemindersStatus]);
+ // Auto-save custom prompt (debounced 1s)
+ const onCustomPromptChange = (value: string) => {
+ setCustomPrompt(value);
+ setPromptDirty(true);
+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);
+ saveTimeoutRef.current = setTimeout(async () => {
+ await invoke("reminders_set_custom_prompt", { prompt: value }).catch(
+ () => {}
+ );
+ setPromptDirty(false);
+ }, 1000);
+ };
+
// Authorize reminders
const authorizeReminders = async () => {
setIsAuthorizing(true);
@@ -170,7 +192,9 @@ export function AppleIntelligenceCard() {
items: { title: string }[];
contextChars: number;
error: string | null;
- }>("reminders_scan");
+ }>("reminders_scan", {
+ customPrompt: customPrompt || null,
+ });
if (result.error) {
setLastScanResult(result.error);
@@ -325,6 +349,14 @@ export function AppleIntelligenceCard() {
</Label>
</div>
+ <Textarea
+ value={customPrompt}
+ onChange={(e) => onCustomPromptChange(e.target.value)}
+ placeholder="e.g. focus on coding tasks and bugs · ignore social media · always set due date to tomorrow"
+ className="text-xs min-h-[36px] h-9 resize-none font-mono"
+ rows={1}
+ />
+
<div className="flex items-start gap-2 flex-wrap">
<Button
variant="outline"
diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
index 8b9e1b621..42fe93614 100644
--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
@@ -11,6 +11,18 @@ async openPermissionSettings(permission: OSPermission) : Promise<void> {
async requestPermission(permission: OSPermission) : Promise<void> {
await TAURI_INVOKE("request_permission", { permission });
},
+/**
+ * Reset a permission using tccutil and re-request it
+ * This removes the app from the TCC database and triggers a fresh permission request
+ */
+async resetAndRequestPermission(permission: OSPermission) : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reset_and_request_permission", { permission }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
async doPermissionsCheck(initialCheck: boolean) : Promise<OSPermissionsCheck> {
return await TAURI_INVOKE("do_permissions_check", { initialCheck });
},
@@ -28,19 +40,6 @@ async checkMicrophonePermission() : Promise<OSPermissionStatus> {
async checkAccessibilityPermissionCmd() : Promise<OSPermissionStatus> {
return await TAURI_INVOKE("check_accessibility_permission_cmd");
},
-/**
- * Reset a permission using tccutil and re-request it
- * This removes the app from the TCC database and triggers a fresh permission request
- */
-async resetAndRequestPermission(permission: OSPermission) : Promise<Result<null, string>> {
- try {
- await TAURI_INVOKE("reset_and_request_permission", { permission });
- return { status: "ok", data: null };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
async getEnv(name: string) : Promise<string> {
return await TAURI_INVOKE("get_env", { name });
},
@@ -591,6 +590,108 @@ async obsidianCancelSync() : Promise<Result<null, string>> {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
+},
+/**
+ * Check Reminders authorization + scheduler status (no popup).
+ */
+async remindersStatus() : Promise<Result<RemindersStatus, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_status") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Request Reminders permission (shows one-time macOS popup).
+ * Returns "granted", "denied", or an error message.
+ */
+async remindersAuthorize() : Promise<Result<string, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_authorize") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * List existing reminders in the "Screenpipe" list.
+ */
+async remindersList() : Promise<Result<ReminderItem[], string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_list") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Create a single reminder.
+ */
+async remindersCreate(title: string, notes: string | null, due: string | null) : Promise<Result<ReminderItem, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_create", { title, notes, due }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Scan recent activity and create reminders from action items.
+ * Optional custom_prompt appended to the AI instructions.
+ */
+async remindersScan(customPrompt: string | null) : Promise<Result<ScanResult, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_scan", { customPrompt }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Start the background scheduler (30-min interval). Persists across page navigation.
+ * Saves enabled=true to persistent store so it auto-starts on app relaunch.
+ */
+async remindersStartScheduler() : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_start_scheduler") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Stop the background scheduler. Saves enabled=false to persistent store.
+ */
+async remindersStopScheduler() : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_stop_scheduler") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Get the saved custom prompt.
+ */
+async remindersGetCustomPrompt() : Promise<Result<string, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_get_custom_prompt") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Save a custom prompt.
+ */
+async remindersSetCustomPrompt(prompt: string) : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reminders_set_custom_prompt", { prompt }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
}
}
@@ -668,6 +769,9 @@ export type PiCheckResult = { available: boolean; path: string | null }
export type PiImageContent = { type: string; source: PiImageSource }
export type PiImageSource = { type: string; mediaType: string; data: string }
export type PiInfo = { running: boolean; projectDir: string | null; pid: number | null; sessionId: string | null }
+export type ReminderItem = { identifier: string; title: string; notes: string | null; completed: boolean }
+export type RemindersStatus = { available: boolean; authorized: boolean; authorizationStatus: string; schedulerRunning: boolean; reminderCount: number }
+export type ScanResult = { remindersCreated: bigint; items: ReminderItem[]; contextChars: bigint; error: string | null }
export type SettingsStore =
/**
* Catch-all for fields added by the frontend (e.g. chatHistory, deviceId)
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 2b04a4bd1..466882df5 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9048,7 +9048,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.359"
+version = "2.0.362"
dependencies = [
"anyhow",
"async-stream",
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index c94255223..5be657ac7 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1106,6 +1106,8 @@ async fn main() {
reminders::reminders_scan,
reminders::reminders_start_scheduler,
reminders::reminders_stop_scheduler,
+ reminders::reminders_get_custom_prompt,
+ reminders::reminders_set_custom_prompt,
])
.typ::<SettingsStore>()
.typ::<OnboardingStore>()
@@ -1271,7 +1273,9 @@ async fn main() {
reminders::reminders_create,
reminders::reminders_scan,
reminders::reminders_start_scheduler,
- reminders::reminders_stop_scheduler
+ reminders::reminders_stop_scheduler,
+ reminders::reminders_get_custom_prompt,
+ reminders::reminders_set_custom_prompt
])
.setup(move |app| {
//deep link register_all
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/reminders.rs b/apps/screenpipe-app-tauri/src-tauri/src/reminders.rs
index fa37d1ba6..8fd999c37 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/reminders.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/reminders.rs
@@ -216,20 +216,43 @@ pub async fn reminders_create(
}
/// Scan recent activity and create reminders from action items.
+/// Optional custom_prompt appended to the AI instructions.
#[tauri::command]
#[specta::specta]
-pub async fn reminders_scan() -> Result<ScanResult, String> {
+pub async fn reminders_scan(custom_prompt: Option<String>) -> Result<ScanResult, String> {
#[cfg(target_os = "macos")]
{
- do_scan().await
+ do_scan(custom_prompt.as_deref()).await
}
#[cfg(not(target_os = "macos"))]
{
+ let _ = custom_prompt;
Err("only available on macOS".into())
}
}
+/// Get the saved custom prompt.
+#[tauri::command]
+#[specta::specta]
+pub async fn reminders_get_custom_prompt(app: AppHandle) -> Result<String, String> {
+ Ok(RemindersSettingsStore::get(&app)?
+ .map(|s| s.custom_prompt)
+ .unwrap_or_default())
+}
+
+/// Save a custom prompt.
+#[tauri::command]
+#[specta::specta]
+pub async fn reminders_set_custom_prompt(app: AppHandle, prompt: String) -> Result<(), String> {
+ let mut settings = RemindersSettingsStore::get(&app)?.unwrap_or(RemindersSettingsStore {
+ enabled: false,
+ custom_prompt: String::new(),
+ });
+ settings.custom_prompt = prompt;
+ settings.save(&app)
+}
+
/// Start the background scheduler (30-min interval). Persists across page navigation.
/// Saves enabled=true to persistent store so it auto-starts on app relaunch.
#[tauri::command]
@@ -241,8 +264,19 @@ pub async fn reminders_start_scheduler(
// Stop existing if any
reminders_stop_scheduler(state.clone()).await?;
- // Save to persistent store
- RemindersSettingsStore { enabled: true }.save(&app)?;
+ // Preserve custom_prompt, set enabled
+ let mut settings = RemindersSettingsStore::get(&app)?.unwrap_or(RemindersSettingsStore {
+ enabled: false,
+ custom_prompt: String::new(),
+ });
+ settings.enabled = true;
+ settings.save(&app)?;
+
+ let custom_prompt = if settings.custom_prompt.is_empty() {
+ None
+ } else {
+ Some(settings.custom_prompt.clone())
+ };
let handle_arc = state.scheduler_handle.clone();
@@ -256,7 +290,7 @@ pub async fn reminders_start_scheduler(
loop {
info!("reminders scheduler: running scan");
#[cfg(target_os = "macos")]
- match do_scan().await {
+ match do_scan(custom_prompt.as_deref()).await {
Ok(result) => {
if result.reminders_created > 0 {
info!(
@@ -318,6 +352,12 @@ pub async fn auto_start_scheduler(app: AppHandle, state: &RemindersState) {
}
}
+ let custom_prompt = if settings.custom_prompt.is_empty() {
+ None
+ } else {
+ Some(settings.custom_prompt.clone())
+ };
+
let handle_arc = state.scheduler_handle.clone();
let handle = tokio::spawn(async move {
info!("reminders scheduler: auto-started (30-min interval)");
@@ -327,7 +367,7 @@ pub async fn auto_start_scheduler(app: AppHandle, state: &RemindersState) {
loop {
info!("reminders scheduler: running scan");
#[cfg(target_os = "macos")]
- match do_scan().await {
+ match do_scan(custom_prompt.as_deref()).await {
Ok(result) => {
if result.reminders_created > 0 {
info!(
@@ -360,7 +400,7 @@ pub async fn auto_start_scheduler(app: AppHandle, state: &RemindersState) {
// ─── Scan implementation ────────────────────────────────────────────────────
#[cfg(target_os = "macos")]
-async fn do_scan() -> Result<ScanResult, String> {
+async fn do_scan(custom_prompt: Option<&str>) -> Result<ScanResult, String> {
use screenpipe_integrations::reminders::ScreenpipeReminders;
// 1. Check authorization
@@ -400,7 +440,7 @@ async fn do_scan() -> Result<ScanResult, String> {
info!("reminders scan: {} chars of context", context_chars);
// 4. Call Apple Intelligence
- let ai_response = call_ai_for_reminders(&context).await?;
+ let ai_response = call_ai_for_reminders(&context, custom_prompt).await?;
// 5. Parse action items
let action_items = parse_action_items(&ai_response);
@@ -595,7 +635,10 @@ Respond with ONLY this JSON format, no other text:
/// Call Apple Intelligence (via local /ai/chat/completions) to extract action items.
#[cfg(target_os = "macos")]
-async fn call_ai_for_reminders(context: &str) -> Result<String, String> {
+async fn call_ai_for_reminders(
+ context: &str,
+ custom_prompt: Option<&str>,
+) -> Result<String, String> {
// Truncate to fit context window (~10K chars max)
let context = if context.len() > 6000 {
&context[..6000]
@@ -603,16 +646,25 @@ async fn call_ai_for_reminders(context: &str) -> Result<String, String> {
context
};
+ // Build system prompt with optional custom instructions
+ let system_prompt = match custom_prompt {
+ Some(cp) if !cp.trim().is_empty() => {
+ format!("{}\n\nAdditional user instructions:\n{}", REMINDERS_PROMPT, cp.trim())
+ }
+ _ => REMINDERS_PROMPT.to_string(),
+ };
+
let client = reqwest::Client::new();
let do_request = |ctx: String| {
let client = client.clone();
+ let prompt = system_prompt.clone();
async move {
let resp = client
.post(format!("{}/ai/chat/completions", API))
.json(&serde_json::json!({
"messages": [
- {"role": "system", "content": REMINDERS_PROMPT},
+ {"role": "system", "content": prompt},
{"role": "user", "content": ctx}
]
}))
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
index d1a0658db..bf90c88f5 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -657,6 +657,8 @@ impl ObsidianSettingsStore {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RemindersSettingsStore {
pub enabled: bool,
+ #[serde(default)]
+ pub custom_prompt: String,
}
impl RemindersSettingsStore {