"use client"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { createClient, updateMeta } from "@/utils/supabase/client"; // "What should your plan know?": the money profile's notes, on the plan page too. The plan and the chat read it; // a cloud model gets it with bank and merchant names swapped for placeholders. export function PlanContext({ initial }: { initial: string }) { const router = useRouter(); const [text, setText] = useState(initial); const [state, setState] = useState<"idle" | "saving" | "saved" | "failed">("idle"); async function save() { setState("saving"); const sb = createClient(); const { data } = await sb.auth.getUser(); const profile = (data.user?.user_metadata?.profile ?? {}) as Record; const { error } = await updateMeta(sb, { data: { profile: { ...profile, notes: text.trim().slice(0, 1000) } } }); setState(error ? "failed" : "saved"); if (!error) router.refresh(); } return (
What should your plan know?

Anything your bank data can't show. broke ai reads it when it builds your plan and when you chat.