Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(ui): rebuild Profile as the file the assistant keeps on you

rubenluetke10-beepa2523f47b40d
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index f24d6674da..f7adcdc0c7 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1674,69 +1674,11 @@
},
"profile_view": {
"title": "Profil",
- "subtitle": "Dein USER.md, bekannte Personen und offene Memory-Reviews.",
- "people": "Personen",
- "reviews_count": "offene Reviews",
- "no_people": "Noch keine Personen.",
- "person_singular": "Person",
- "person_plural": "Personen",
- "review_singular": "Review",
- "review_plural": "Reviews",
- "review_open": "offen",
- "no_name_yet": "{name} weiß deinen Namen noch nicht. Sag ihm \"Ich heiße …\".",
+ "subtitle": "Was der Assistent über dich weiß, woher er es weiß und was er nie speichert.",
"reload_tooltip": "Neu laden",
- "fact_accepted": "{0} Fact(s) übernommen",
- "accepted": "Akzeptiert",
- "accept_tooltip": "Übernehmen",
- "reject_tooltip": "Verwerfen",
- "close_tooltip": "Schließen",
- "profile_not_ready": "Profil-System nicht bereit.",
- "reviews_disabled_title": "Review-Queue inaktiv",
- "reviews_disabled_body": "Der Fact-Curator dieser Session schreibt direkt ins Wiki-Vault und nutzt keine Review-Queue. Sobald ein Provider mit klassischer Memory-Integration läuft, erscheinen hier Kandidaten zur Freigabe.",
- "hero_eyebrow": "Wissensprofil",
- "hero_classification": "Wissensbasis",
- "hero_maintained_by": "Geführt von {name}",
- "hero_name_placeholder": "Wer bist du?",
- "hero_tagline": "Was {name} über dich gelernt hat — gesammelt aus euren Gesprächen, festgehalten in einem Buch.",
- "hero_completeness": "Profil erfasst",
"field_unknown": "noch nicht bekannt",
- "facts_ratio": "{0}/{1} Facts",
"no_user_hint": "{name} weiß deinen Namen noch nicht. Sag ihm einfach, wie du heißt — den Rest pickt sich der Curator nach und nach aus euren Gesprächen.",
- "section_knowledge": "Was {name} weiß",
- "section_knowledge_sub": "Aus euren Gesprächen gelernt — gruppiert, wie {name} über dich denkt.",
- "section_people": "Menschen, die {name} kennt",
- "section_reviews": "Wartet auf dein Okay",
"section_source": "Die Quelldatei",
- "stages": {
- "blank_page": "Ein leeres Blatt",
- "first_impressions": "Erste Eindrücke",
- "getting_acquainted": "Wir lernen uns kennen",
- "well_acquainted": "Gut bekannt",
- "trusted_company": "Vertraute Gesellschaft",
- "inner_circle": "Engster Kreis"
- },
- "stage_headline": {
- "blank_page": "Ein neues Blatt{0}.",
- "first_impressions": "Erste Eindrücke{0}.",
- "getting_acquainted": "{name} lernt dich gerade kennen{0}.",
- "well_acquainted": "{name} kennt dich schon ziemlich gut{0}.",
- "trusted_company": "{name} kennt dich richtig gut{0}.",
- "inner_circle": "{name} kennt dich in- und auswendig{0}."
- },
- "hero_sub": "Alles hier hat {name} nebenbei gelernt, aus echten Gesprächen — nie doppelt gefragt, nie geraten.",
- "entries_ratio": "{0} von {1} Dingen gelernt",
- "people_known": "{0} Personen",
- "person_known": "{0} Person",
- "ask_title": "Das würde {name} gern wissen",
- "ask_next": "Weiter",
- "ask_say_prefix": "Sag einfach",
- "more_to_learn": "{0} weitere offen",
- "hero_teach_intro": "Zwei Wege, {name} etwas über dich beizubringen",
- "hero_teach_voice": "Sag es einfach im Gespräch — {name} hört zu und schreibt es auf.",
- "hero_teach_file": "Oder schreib es selbst in die Quelldatei.",
- "hero_open_source": "Datei öffnen",
- "ask_empty_title": "Nichts mehr zu fragen",
- "ask_empty_body": "Jedes Feld auf dieser Seite hat eine Antwort. Was du neu erwähnst, kommt von allein dazu.",
"error_title": "Das Profil konnte nicht geladen werden",
"group_filled": "{0} von {1} bekannt",
"source_updated": "Aktualisiert {0}",
@@ -1751,62 +1693,6 @@
"field_add_placeholder": "Hinzufügen…",
"field_value_placeholder": "Wert…",
"field_saved": "Gespeichert",
- "review_confirm": "Stimmt",
- "review_strike": "Streichen",
- "questions": {
- "name": "Welcher Name soll auf die erste Seite?",
- "preferred_address": "Wie möchtest du angesprochen werden?",
- "pronouns": "Welche Pronomen passen zu dir?",
- "primary_language": "In welcher Sprache reden wir am liebsten?",
- "languages": "Welche Sprachen sprichst du noch?",
- "timezone": "Nach welcher Uhr läuft dein Tag?",
- "devices": "Welche Geräte nutzt du?",
- "directness": "Wie direkt darf ich mit dir sein?",
- "formality": "Förmlich oder locker — wie reden wir?",
- "verbosity": "Kurze Antworten oder das volle Bild?",
- "humor_types": "Welcher Humor kommt bei dir an?",
- "emoji_ok": "Gehören Emojis in unsere Chats?",
- "focus_mode": "Wie schützt du deinen Fokus?",
- "planning_horizon": "Planst du in Tagen, Wochen oder Jahren?",
- "top_values": "Wobei machst du keine Kompromisse?",
- "pet_peeves": "Was nervt dich zuverlässig?",
- "motivations": "Was treibt dich an?",
- "feedback_pref": "Wie soll ich dir unbequeme Wahrheiten sagen?"
- },
- "says": {
- "name": "{name}, ich heiße …",
- "preferred_address": "Nenn mich …",
- "pronouns": "Meine Pronomen sind …",
- "primary_language": "Lass uns Deutsch sprechen",
- "languages": "Ich spreche auch …",
- "timezone": "Meine Zeitzone ist …",
- "devices": "Ich arbeite an …",
- "directness": "Sei direkt mit mir",
- "formality": "Bleib locker",
- "verbosity": "Halte Antworten kurz",
- "humor_types": "Ich mag trockenen Humor",
- "emoji_ok": "Lass die Emojis weg",
- "focus_mode": "Stör mich nicht im Fokus",
- "planning_horizon": "Ich plane von Woche zu Woche",
- "top_values": "Mir ist am wichtigsten …",
- "pet_peeves": "Mich nervt, wenn …",
- "motivations": "Mich treibt an …",
- "feedback_pref": "Gib mir Feedback direkt"
- },
- "people_empty_title": "Noch keine Personen bekannt",
- "people_empty_body": "Wenn du {name} von Familie, Freund:innen oder Kolleg:innen erzählst, legt der Curator automatisch eine Datei unter data/workspace/people/ an.",
- "person_detail_hint": "Wähle links eine Person, um Details zu sehen.",
- "person_relationship": "Beziehung",
- "person_aliases": "Aliase",
- "person_no_aliases": "keine",
- "person_file_hint": "Beobachtungen und volle Notizen liegen in people/{0}.md.",
- "reviews_empty_title": "Nichts zu prüfen",
- "reviews_empty_body": "Alle extrahierten Facts hatten hohe Confidence und wurden direkt übernommen. Wird der Curator unsicher, landen Kandidaten hier.",
- "review_value": "Wert",
- "review_reason": "Grund",
- "review_subject_user": "Du",
- "raw_loading": "Lade USER.md…",
- "raw_empty": "(Datei leer — der Curator hat noch nichts geschrieben)",
"raw_edit": "Bearbeiten",
"raw_save": "Speichern",
"raw_saving": "Speichere…",
@@ -1819,10 +1705,8 @@
"avatar_upload": "Bild hochladen",
"avatar_change": "Bild ändern",
"avatar_remove": "Bild entfernen",
- "avatar_uploading": "Lade hoch…",
"avatar_uploaded": "Profilbild aktualisiert",
"avatar_removed": "Profilbild entfernt",
- "avatar_hint": "Klick auf den Rahmen, um ein Bild von dir hochzuladen.",
"clusters": {
"identity": {
"label": "Identität",
@@ -1864,7 +1748,42 @@
"pet_peeves": "Pet Peeves",
"motivations": "Motivationen",
"feedback_pref": "Feedback-Stil"
- }
+ },
+ "tab_file": "Die Akte",
+ "header_unnamed": "Noch ohne Namen",
+ "header_nothing_yet": "Noch nichts in der Akte",
+ "header_since": "seit {0}",
+ "header_conversations": "{0} Gespräche",
+ "header_entries": "{0} von {1} Einträgen",
+ "header_updated": "geändert {0}",
+ "gaps_show": "{0} offene Felder",
+ "gaps_hide": "Offene Felder ausblenden",
+ "source_show": "Woher das kommt",
+ "source_no_quote": "Ohne Zitat notiert.",
+ "source_learned": "gelernt am {0}",
+ "source_revisions": "{0} Einträge",
+ "portrait_title": "Wie {name} dich beschreibt",
+ "portrait_fits": "Trifft",
+ "portrait_misses": "Trifft nicht",
+ "portrait_harder": "Härter",
+ "portrait_thanks": "Notiert — das nächste Porträt berücksichtigt das.",
+ "portrait_written": "Porträt geschrieben.",
+ "portrait_rewrite": "Neu schreiben",
+ "portrait_write": "Porträt schreiben",
+ "portrait_empty_body": "{name} hat noch kein Porträt von dir geschrieben. Es entsteht aus deiner Aktivität, deiner Gedächtnisdatei und früheren Gesprächen.",
+ "rules_title": "Deine festen Regeln",
+ "rules_open": "{0} Zeilen in {1}",
+ "rules_empty_body": "Du hast {name} noch keine festen Anweisungen gegeben. Sie gelten in jedem Zug, zusätzlich zu dem, was er selbst herausfindet.",
+ "rules_write": "Regeln schreiben",
+ "never_title": "Wird nie gespeichert",
+ "never_body": "{name} lehnt diese Kategorien grundsätzlich ab, egal was ein Gespräch enthält.",
+ "wiki_title": "Im Wiki",
+ "wiki_facts": "{0} Fakten",
+ "wiki_links": "{0} Verweise",
+ "wiki_words": "{0} Wörter",
+ "wiki_open": "Wiki öffnen",
+ "wiki_empty_body": "Im Wiki gibt es noch keine Seite über dich. Sie entsteht, sobald deine Gespräche etwas hergeben.",
+ "wiki_needs_name": "Sag {name} deinen Namen, dann legt er im Wiki eine Seite über dich an."
},
"apikeys_view": {
"title": "API-Keys & Provider",
@@ -5324,7 +5243,12 @@
"profile": "Profil",
"open_profile": "Profil dieses Agenten öffnen",
"options": "Optionen",
- "options_hint": "Für die Steuerung dieses Agenten freigehalten.",
+ "options_hint": "Was du mit diesem Agenten machen kannst.",
+ "retire": "Agent ausmustern",
+ "retire_confirm": "Bestätigen — endgültig",
+ "retire_hint": "Archiviert diesen Agenten. Die Insel zeigt, was aus ihm wird.",
+ "retire_armed_hint": "Nochmal drücken. Das lässt sich nicht rückgängig machen.",
+ "retire_lead_blocked": "Der Lead führt die Society und kann nicht ausgemustert werden.",
"close": "Schließen",
"brain": "Gehirn",
"description": "Ständige Anweisungen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index d9dd8d96c4..bfa447ea6a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1707,69 +1707,11 @@
},
"profile_view": {
"title": "Profile",
- "subtitle": "Your USER.md, people you know, and pending memory reviews.",
- "people": "People",
- "reviews_count": "pending reviews",
- "no_people": "No people yet.",
- "person_singular": "Person",
- "person_plural": "People",
- "review_singular": "Review",
- "review_plural": "Reviews",
- "review_open": "open",
- "no_name_yet": "{name} doesn't know your name yet. Tell him \"My name is …\".",
+ "subtitle": "What the assistant knows about you, how it learned it, and what it never records.",
"reload_tooltip": "Reload",
- "fact_accepted": "{0} fact(s) merged",
- "accepted": "Accepted",
- "accept_tooltip": "Apply",
- "reject_tooltip": "Discard",
- "close_tooltip": "Close",
- "profile_not_ready": "Profile system not ready.",
- "reviews_disabled_title": "Review queue inactive",
- "reviews_disabled_body": "This session's fact curator writes straight to the wiki vault and doesn't use a review queue. Candidates show up here once a provider with the classic memory integration is running.",
- "hero_eyebrow": "Knowledge profile",
- "hero_classification": "Knowledge base",
- "hero_maintained_by": "Maintained by {name}",
- "hero_name_placeholder": "Who are you?",
- "hero_tagline": "What {name} has learned about you — gathered from conversation, kept in one book.",
- "hero_completeness": "Profile mapped",
"field_unknown": "not known yet",
- "facts_ratio": "{0}/{1} facts",
"no_user_hint": "{name} doesn't know your name yet. Just tell him what to call you — the curator picks up the rest from your conversations over time.",
- "section_knowledge": "What {name} knows",
- "section_knowledge_sub": "Learned from your conversations, grouped the way {name} thinks about you.",
- "section_people": "People {name} knows",
- "section_reviews": "Waiting for your OK",
"section_source": "The source file",
- "stages": {
- "blank_page": "A blank page",
- "first_impressions": "First impressions",
- "getting_acquainted": "Getting acquainted",
- "well_acquainted": "Well acquainted",
- "trusted_company": "Trusted company",
- "inner_circle": "Inner circle"
- },
- "stage_headline": {
- "blank_page": "A fresh page{0}.",
- "first_impressions": "First impressions{0}.",
- "getting_acquainted": "{name} is getting to know you{0}.",
- "well_acquainted": "{name} knows you quite well{0}.",
- "trusted_company": "{name} knows you really well{0}.",
- "inner_circle": "{name} knows you inside out{0}."
- },
- "hero_sub": "Everything here was learned in passing, from real conversations — never asked twice, never guessed.",
- "entries_ratio": "{0} of {1} things learned",
- "people_known": "{0} people",
- "person_known": "{0} person",
- "ask_title": "{name} would love to know",
- "ask_next": "Next",
- "ask_say_prefix": "Just say",
- "more_to_learn": "{0} more to learn",
- "hero_teach_intro": "Two ways to teach {name} about you",
- "hero_teach_voice": "Say it out loud in a conversation — {name} listens and writes it down.",
- "hero_teach_file": "Or write it into the source file yourself.",
- "hero_open_source": "Open the file",
- "ask_empty_title": "Nothing left to ask",
- "ask_empty_body": "Every field on this page has an answer. Anything new you mention gets added on its own.",
"error_title": "The profile could not be loaded",
"group_filled": "{0} of {1} known",
"source_updated": "Updated {0}",
@@ -1784,62 +1726,6 @@
"field_add_placeholder": "Add…",
"field_value_placeholder": "Value…",
"field_saved": "Saved",
- "review_confirm": "Confirm",
- "review_strike": "Strike out",
- "questions": {
- "name": "What name shall I write on the first page?",
- "preferred_address": "How would you like to be addressed?",
- "pronouns": "Which pronouns fit you?",
- "primary_language": "Which language shall we keep between us?",
- "languages": "Which other languages do you live in?",
- "timezone": "Which clock do your days run on?",
- "devices": "Which devices should I keep in mind?",
- "directness": "How blunt may I be with you?",
- "formality": "Formal or familiar — how do we talk?",
- "verbosity": "Short answers or the full picture?",
- "humor_types": "What kind of humor lands with you?",
- "emoji_ok": "Do emojis belong in our chats?",
- "focus_mode": "How do you guard your focus?",
- "planning_horizon": "Do you plan in days, weeks or years?",
- "top_values": "What do you refuse to compromise on?",
- "pet_peeves": "What reliably annoys you?",
- "motivations": "What gets you out of bed?",
- "feedback_pref": "How should I deliver hard truths?"
- },
- "says": {
- "name": "{name}, my name is …",
- "preferred_address": "Call me …",
- "pronouns": "My pronouns are …",
- "primary_language": "Let's speak German",
- "languages": "I also speak …",
- "timezone": "My timezone is …",
- "devices": "I work on …",
- "directness": "Be straight with me",
- "formality": "Keep it casual",
- "verbosity": "Keep answers short",
- "humor_types": "I like dry humor",
- "emoji_ok": "Skip the emojis",
- "focus_mode": "Don't interrupt my focus time",
- "planning_horizon": "I plan week by week",
- "top_values": "What I value most is …",
- "pet_peeves": "It drives me crazy when …",
- "motivations": "What drives me is …",
- "feedback_pref": "Give me feedback straight"
- },
- "people_empty_title": "No people known yet",
- "people_empty_body": "When you tell {name} about family, friends or colleagues, the curator automatically creates a file under data/workspace/people/.",
- "person_detail_hint": "Pick a person on the left to see details.",
- "person_relationship": "Relationship",
- "person_aliases": "Aliases",
- "person_no_aliases": "none",
- "person_file_hint": "Observations and full notes live in people/{0}.md.",
- "reviews_empty_title": "Nothing to review",
- "reviews_empty_body": "Every extracted fact was high-confidence and applied directly. When the curator is unsure, candidates land here.",
- "review_value": "Value",
- "review_reason": "Reason",
- "review_subject_user": "You",
- "raw_loading": "Loading USER.md…",
- "raw_empty": "(File empty — the curator hasn't written anything yet)",
"raw_edit": "Edit",
"raw_save": "Save",
"raw_saving": "Saving…",
@@ -1852,10 +1738,8 @@
"avatar_upload": "Upload photo",
"avatar_change": "Change photo",
"avatar_remove": "Remove photo",
- "avatar_uploading": "Uploading…",
"avatar_uploaded": "Profile picture updated",
"avatar_removed": "Profile picture removed",
- "avatar_hint": "Click the frame to upload a picture of yourself.",
"clusters": {
"identity": {
"label": "Identity",
@@ -1897,7 +1781,42 @@
"pet_peeves": "Pet peeves",
"motivations": "Motivations",
"feedback_pref": "Feedback style"
- }
+ },
+ "tab_file": "The file",
+ "header_unnamed": "No name on file",
+ "header_nothing_yet": "Nothing on file yet",
+ "header_since": "since {0}",
+ "header_conversations": "{0} conversations",
+ "header_entries": "{0} of {1} entries",
+ "header_updated": "updated {0}",
+ "gaps_show": "{0} open fields",
+ "gaps_hide": "Hide open fields",
+ "source_show": "Where this came from",
+ "source_no_quote": "Written without a quoted source.",
+ "source_learned": "learned {0}",
+ "source_revisions": "{0} entries",
+ "portrait_title": "How {name} describes you",
+ "portrait_fits": "Fits",
+ "portrait_misses": "Misses",
+ "portrait_harder": "Be harder",
+ "portrait_thanks": "Noted — the next portrait will take that into account.",
+ "portrait_written": "Portrait written.",
+ "portrait_rewrite": "Write it again",
+ "portrait_write": "Write the portrait",
+ "portrait_empty_body": "{name} has not written a portrait of you yet. It is drawn from your activity, your memory file and past conversations.",
+ "rules_title": "Your standing rules",
+ "rules_open": "{0} lines in {1}",
+ "rules_empty_body": "You have not given {name} any standing instructions yet. They apply on every turn, on top of what it works out on its own.",
+ "rules_write": "Write your rules",
+ "never_title": "Never recorded",
+ "never_body": "{name} refuses these categories outright, whatever a conversation contains.",
+ "wiki_title": "In the wiki",
+ "wiki_facts": "{0} facts",
+ "wiki_links": "{0} links",
+ "wiki_words": "{0} words",
+ "wiki_open": "Open the vault",
+ "wiki_empty_body": "The vault has no page about you yet. One is written once your conversations give it something to record.",
+ "wiki_needs_name": "Tell {name} your name and it will start a page about you in the vault."
},
"apikeys_view": {
"title": "API Keys & Providers",
@@ -5357,7 +5276,12 @@
"profile": "Profile",
"open_profile": "Open this agent's profile",
"options": "Options",
- "options_hint": "Held open for this agent's controls.",
+ "options_hint": "What you can do to this agent.",
+ "retire": "Retire agent",
+ "retire_confirm": "Confirm — this is final",
+ "retire_hint": "Archives this agent. The island shows what becomes of it.",
+ "retire_armed_hint": "Press again to retire. This cannot be undone.",
+ "retire_lead_blocked": "The lead runs the society and cannot be retired.",
"close": "Close",
"brain": "Brain",
"description": "Standing instructions",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index d07681ba5a..0687a5bc29 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1674,69 +1674,11 @@
},
"profile_view": {
"title": "Perfil",
- "subtitle": "Tu USER.md, personas que conoces y revisiones de memoria pendientes.",
- "people": "Personas",
- "reviews_count": "revisiones pendientes",
- "no_people": "Aún no hay personas.",
- "person_singular": "Persona",
- "person_plural": "Personas",
- "review_singular": "Revisión",
- "review_plural": "Revisiones",
- "review_open": "abierta",
- "no_name_yet": "{name} aún no sabe tu nombre. Dile \"Me llamo …\".",
+ "subtitle": "Lo que el asistente sabe de ti, cómo lo aprendió y lo que nunca guarda.",
"reload_tooltip": "Recargar",
- "fact_accepted": "{0} dato(s) fusionado(s)",
- "accepted": "Aceptado",
- "accept_tooltip": "Aplicar",
- "reject_tooltip": "Descartar",
- "close_tooltip": "Cerrar",
- "profile_not_ready": "El sistema de perfil no está listo.",
- "reviews_disabled_title": "Cola de revisión inactiva",
- "reviews_disabled_body": "El curador de datos de esta sesión escribe directamente en el vault del wiki y no usa una cola de revisión. Los candidatos aparecerán aquí cuando se ejecute un proveedor con la integración de memoria clásica.",
- "hero_eyebrow": "Perfil de conocimiento",
- "hero_classification": "Base de conocimiento",
- "hero_maintained_by": "Mantenido por {name}",
- "hero_name_placeholder": "¿Quién eres?",
- "hero_tagline": "Lo que {name} ha aprendido sobre ti — de tus conversaciones.",
- "hero_completeness": "Perfil mapeado",
"field_unknown": "aún no conocido",
- "facts_ratio": "{0}/{1} datos",
"no_user_hint": "{name} aún no sabe tu nombre. Solo dile cómo llamarte — el curador irá recogiendo el resto de tus conversaciones con el tiempo.",
- "section_knowledge": "Lo que {name} sabe",
- "section_knowledge_sub": "Aprendido de tus conversaciones, agrupado como {name} piensa en ti.",
- "section_people": "Personas que {name} conoce",
- "section_reviews": "Esperando tu visto bueno",
"section_source": "El archivo fuente",
- "stages": {
- "blank_page": "Una página en blanco",
- "first_impressions": "Primeras impresiones",
- "getting_acquainted": "Conociéndonos",
- "well_acquainted": "Buenos conocidos",
- "trusted_company": "Compañía de confianza",
- "inner_circle": "Círculo íntimo"
- },
- "stage_headline": {
- "blank_page": "Una página nueva{0}.",
- "first_impressions": "Primeras impresiones{0}.",
- "getting_acquainted": "{name} te está conociendo{0}.",
- "well_acquainted": "{name} ya te conoce bastante bien{0}.",
- "trusted_company": "{name} te conoce muy bien{0}.",
- "inner_circle": "{name} te conoce al dedillo{0}."
- },
- "hero_sub": "Todo esto {name} lo aprendió sobre la marcha, de conversaciones reales — nunca preguntado dos veces, nunca adivinado.",
- "entries_ratio": "{0} de {1} cosas aprendidas",
- "people_known": "{0} personas",
- "person_known": "{0} persona",
- "ask_title": "A {name} le encantaría saber",
- "ask_next": "Siguiente",
- "ask_say_prefix": "Solo di",
- "more_to_learn": "{0} más por aprender",
- "hero_teach_intro": "Dos formas de contarle a {name} quién eres",
- "hero_teach_voice": "Dilo en voz alta en una conversación — {name} escucha y lo anota.",
- "hero_teach_file": "O escríbelo tú mismo en el archivo fuente.",
- "hero_open_source": "Abrir el archivo",
- "ask_empty_title": "Nada más que preguntar",
- "ask_empty_body": "Todos los campos de esta página tienen respuesta. Lo nuevo que menciones se añade solo.",
"error_title": "No se pudo cargar el perfil",
"group_filled": "{0} de {1} conocidos",
"source_updated": "Actualizado {0}",
@@ -1751,62 +1693,6 @@
"field_add_placeholder": "Añadir…",
"field_value_placeholder": "Valor…",
"field_saved": "Guardado",
- "review_confirm": "Correcto",
- "review_strike": "Tachar",
- "questions": {
- "name": "¿Qué nombre escribo en la primera página?",
- "preferred_address": "¿Cómo quieres que te llame?",
- "pronouns": "¿Qué pronombres te quedan bien?",
- "primary_language": "¿En qué idioma hablamos?",
- "languages": "¿Qué otros idiomas hablas?",
- "timezone": "¿Con qué reloj corre tu día?",
- "devices": "¿Qué dispositivos usas?",
- "directness": "¿Qué tan directo puedo ser contigo?",
- "formality": "¿Formal o cercano — cómo hablamos?",
- "verbosity": "¿Respuestas cortas o el panorama completo?",
- "humor_types": "¿Qué tipo de humor te llega?",
- "emoji_ok": "¿Los emojis tienen lugar en nuestros chats?",
- "focus_mode": "¿Cómo proteges tu concentración?",
- "planning_horizon": "¿Planificas en días, semanas o años?",
- "top_values": "¿En qué no haces concesiones?",
- "pet_peeves": "¿Qué te molesta sin falta?",
- "motivations": "¿Qué te levanta de la cama?",
- "feedback_pref": "¿Cómo te digo las verdades incómodas?"
- },
- "says": {
- "name": "{name}, me llamo …",
- "preferred_address": "Llámame …",
- "pronouns": "Mis pronombres son …",
- "primary_language": "Hablemos en español",
- "languages": "También hablo …",
- "timezone": "Mi zona horaria es …",
- "devices": "Trabajo en …",
- "directness": "Sé directo conmigo",
- "formality": "Mantenlo informal",
- "verbosity": "Respuestas cortas, por favor",
- "humor_types": "Me gusta el humor seco",
- "emoji_ok": "Nada de emojis",
- "focus_mode": "No me interrumpas cuando estoy concentrado",
- "planning_horizon": "Planifico semana a semana",
- "top_values": "Lo que más valoro es …",
- "pet_peeves": "Me saca de quicio que …",
- "motivations": "Lo que me motiva es …",
- "feedback_pref": "Dame el feedback sin rodeos"
- },
- "people_empty_title": "Aún no hay personas",
- "people_empty_body": "Cuando le cuentas a {name} sobre tu familia, amistades o colegas, el curador crea automáticamente un archivo en data/workspace/people/.",
- "person_detail_hint": "Elige una persona a la izquierda para ver detalles.",
- "person_relationship": "Relación",
- "person_aliases": "Alias",
- "person_no_aliases": "ninguno",
- "person_file_hint": "Las observaciones y notas completas están en people/{0}.md.",
- "reviews_empty_title": "Nada que revisar",
- "reviews_empty_body": "Todos los datos extraídos tenían alta confianza y se aplicaron directamente. Cuando el curador duda, los candidatos aparecen aquí.",
- "review_value": "Valor",
- "review_reason": "Razón",
- "review_subject_user": "Tú",
- "raw_loading": "Cargando USER.md…",
- "raw_empty": "(Archivo vacío — el curador aún no ha escrito nada)",
"raw_edit": "Editar",
"raw_save": "Guardar",
"raw_saving": "Guardando…",
@@ -1819,10 +1705,8 @@
"avatar_upload": "Subir foto",
"avatar_change": "Cambiar foto",
"avatar_remove": "Eliminar foto",
- "avatar_uploading": "Subiendo…",
"avatar_uploaded": "Foto de perfil actualizada",
"avatar_removed": "Foto de perfil eliminada",
- "avatar_hint": "Haz clic en el marco para subir una foto tuya.",
"clusters": {
"identity": {
"label": "Identidad",
@@ -1864,7 +1748,42 @@
"pet_peeves": "Manías",
"motivations": "Motivaciones",
"feedback_pref": "Estilo de feedback"
- }
+ },
+ "tab_file": "El expediente",
+ "header_unnamed": "Todavía sin nombre",
+ "header_nothing_yet": "Aún no hay nada en el expediente",
+ "header_since": "desde {0}",
+ "header_conversations": "{0} conversaciones",
+ "header_entries": "{0} de {1} entradas",
+ "header_updated": "actualizado {0}",
+ "gaps_show": "{0} campos abiertos",
+ "gaps_hide": "Ocultar campos abiertos",
+ "source_show": "De dónde viene esto",
+ "source_no_quote": "Anotado sin cita.",
+ "source_learned": "aprendido el {0}",
+ "source_revisions": "{0} entradas",
+ "portrait_title": "Cómo te describe {name}",
+ "portrait_fits": "Acierta",
+ "portrait_misses": "No acierta",
+ "portrait_harder": "Más duro",
+ "portrait_thanks": "Anotado: el próximo retrato lo tendrá en cuenta.",
+ "portrait_written": "Retrato escrito.",
+ "portrait_rewrite": "Escribirlo de nuevo",
+ "portrait_write": "Escribir el retrato",
+ "portrait_empty_body": "{name} todavía no ha escrito un retrato tuyo. Se compone de tu actividad, tu archivo de memoria y conversaciones anteriores.",
+ "rules_title": "Tus reglas fijas",
+ "rules_open": "{0} líneas en {1}",
+ "rules_empty_body": "Todavía no le has dado instrucciones fijas a {name}. Se aplican en cada turno, además de lo que deduce por su cuenta.",
+ "rules_write": "Escribir tus reglas",
+ "never_title": "Nunca se guarda",
+ "never_body": "{name} rechaza estas categorías por principio, sea cual sea el contenido de una conversación.",
+ "wiki_title": "En el wiki",
+ "wiki_facts": "{0} hechos",
+ "wiki_links": "{0} enlaces",
+ "wiki_words": "{0} palabras",
+ "wiki_open": "Abrir el wiki",
+ "wiki_empty_body": "El wiki aún no tiene una página sobre ti. Se crea en cuanto tus conversaciones aporten algo.",
+ "wiki_needs_name": "Dile tu nombre a {name} y creará una página sobre ti en el wiki."
},
"apikeys_view": {
"title": "Claves API y Proveedores",
@@ -5324,7 +5243,12 @@
"profile": "Perfil",
"open_profile": "Abrir el perfil de este agente",
"options": "Opciones",
- "options_hint": "Reservado para los controles de este agente.",
+ "options_hint": "Lo que puedes hacer con este agente.",
+ "retire": "Retirar agente",
+ "retire_confirm": "Confirmar: es definitivo",
+ "retire_hint": "Archiva este agente. La isla muestra lo que ocurre con él.",
+ "retire_armed_hint": "Pulsa otra vez para retirarlo. No se puede deshacer.",
+ "retire_lead_blocked": "El líder dirige la sociedad y no puede retirarse.",
"close": "Cerrar",
"brain": "Cerebro",
"description": "Instrucciones permanentes",
diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
index 35355e8a1c..32627b9385 100644
--- a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
@@ -1,15 +1,14 @@
/**
- * Component tests for ProfileView's Review-Queue section.
+ * Component tests for the rebuilt Profile section.
*
- * Regression guard for the "red error badge for an intentionally-disabled
- * Curator" bug: the legacy Curator-Merger is soft-disabled by design
- * (`memory.legacy_curator.enabled = false`, since 2026-05-17), so
- * `GET /api/profile/reviews` returns HTTP 503. The backend contract
- * (`jarvis/ui/web/profile_routes.py` module docstring) requires the UI to
- * render a friendly empty-state for that 503 — NOT a destructive red badge.
+ * What these pin is the contract the redesign was built on: the page states
+ * facts and folds gaps (rather than printing "not known yet" eighteen times),
+ * every known fact can show the sentence it was learned from, and each rail
+ * card has a designed empty state instead of a dead box.
*
- * The top-level `ErrorState` already honored this; the nested `ReviewsSection`
- * did not. These tests pin the contract for the nested section.
+ * The three cards that were deleted are guarded too — the review queue, the
+ * people list and the "would love to know" prompt were all structurally unable
+ * to fill, and a later change should not quietly bring them back.
*/
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
@@ -17,25 +16,17 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ProfileView } from "@/views/ProfileView";
-// RawMarkdownSection subscribes to a WS client in a useEffect; null keeps the
-// effect a deterministic no-op in jsdom.
+// SourceCard subscribes to a WS client in a useEffect; null keeps the effect a
+// deterministic no-op in jsdom.
vi.mock("@/hooks/useWebSocket", () => ({
getWSClient: () => null,
}));
-function freshClient(): QueryClient {
- return new QueryClient({
- defaultOptions: {
- queries: { retry: false, gcTime: 0, staleTime: 0 },
- },
- });
-}
-
function renderWithClient(node: React.ReactNode) {
- const client = freshClient();
- return render(
- <QueryClientProvider client={client}>{node}</QueryClientProvider>,
- );
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },
+ });
+ return render(<QueryClientProvider client={client}>{node}</QueryClientProvider>);
}
interface RouteResult {
@@ -64,185 +55,209 @@ function installFetchMock(routes: Record<string, () => RouteResult>) {
}
throw new Error(`unexpected fetch ${url}`);
});
- (globalThis as unknown as { fetch: typeof fetch }).fetch =
- fetchMock as unknown as typeof fetch;
+ (globalThis as unknown as { fetch: typeof fetch }).fetch = fetchMock as unknown as typeof fetch;
return fetchMock;
}
+const RAW = `---
+identity:
+ name: Ruben
+---
+
+## Observations over time
+
+<!-- curator:observations:start -->
+- [2026-08-29] identity.primary_language: de — "always answer me in German"
+<!-- curator:observations:end -->
+
+## Do Not Record
+
+- Political or religious beliefs (echo-chamber risk)
+- MBTI type or similar pseudo-scientific labels
+`;
+
const PROFILE_OK = {
- user: { name: "Ruben", meta: {}, path: "data/workspace/USER.md" },
+ user: {
+ name: "Ruben",
+ meta: {
+ identity: { name: "Ruben", primary_language: "de", timezone: "Europe/Berlin" },
+ last_updated: "2026-08-29",
+ },
+ path: "data/workspace/USER.md",
+ },
people: [],
reviews_count: 0,
+ has_avatar: false,
};
-const RAW_OK = {
- content: "",
- path: "data/workspace/USER.md",
- mtime_ms: null,
- size_bytes: 0,
+const BASE_ROUTES: Record<string, () => RouteResult> = {
+ "/api/profile/raw": () => ({
+ body: { content: RAW, path: "USER.md", mtime_ms: 1, size_bytes: RAW.length },
+ }),
+ "/api/profile": () => ({ body: PROFILE_OK }),
+ "/api/board/personal/summary": () => ({
+ body: {
+ window_days: 30,
+ totals: { session_count: 491, first_day: "2026-08-03" },
+ window: {},
+ streak_days: 10,
+ longest_streak: 13,
+ },
+ }),
+ "/api/board/bio": () => ({ body: { text: null, generated_at: null } }),
+ "/api/settings/agent-instructions": () => ({
+ body: { content: "", exists: false, filename: "George.md", template: "", char_count: 0 },
+ }),
+ "/api/wiki/page/": () => ({ status: 404, body: { detail: "no such page" } }),
};
-const CURATOR_503_DETAIL =
- "The curator is not running in this session — possibly a mock brain or a " +
- "provider without memory integration.";
-
afterEach(() => {
cleanup();
vi.restoreAllMocks();
});
-describe("ProfileView — Review-Queue with a disabled Curator (503)", () => {
- it("renders a friendly disabled-state, not a destructive red badge", async () => {
- installFetchMock({
- "/api/profile/reviews": () => ({
- status: 503,
- body: { detail: CURATOR_503_DETAIL },
- }),
- "/api/profile/raw": () => ({ body: RAW_OK }),
- "/api/profile": () => ({ body: PROFILE_OK }),
- });
-
+describe("the file states facts and folds gaps", () => {
+ it("shows the known facts and never repeats 'not known yet' for the rest", async () => {
+ installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
- // The friendly, non-alarming disabled card appears.
- await waitFor(() => {
- expect(screen.getByTestId("reviews-disabled")).toBeDefined();
- });
+ await screen.findByText("Europe/Berlin");
- // The destructive red badge must NOT be rendered for an expected 503.
- expect(screen.queryByTestId("reviews-error")).toBeNull();
+ // Sixteen empty fields exist, and none of them is on the page yet.
+ expect(screen.queryByText("not known yet")).toBeNull();
+ });
+
+ it("counts the entries in the header instead of scoring the reader", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
- // The raw backend message is not surfaced verbatim as an error.
- expect(screen.queryByText(CURATOR_503_DETAIL)).toBeNull();
+ const count = await screen.findByTestId("dossier-count");
+ expect(count.textContent).toBe("3 of 18 entries");
+ // The old header asked "Who are you?" over a progress bar.
+ expect(screen.queryByRole("progressbar")).toBeNull();
});
-});
-describe("ProfileView — Review-Queue with a genuine server error (500)", () => {
- it("still renders the destructive badge for non-503 failures", async () => {
- installFetchMock({
- "/api/profile/reviews": () => ({ status: 500, body: { detail: "boom" } }),
- "/api/profile/raw": () => ({ body: RAW_OK }),
- "/api/profile": () => ({ body: PROFILE_OK }),
- });
+ it("puts the reader's name at the top, not a stage name", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
+
+ const header = await screen.findByTestId("dossier-header");
+ expect(header.textContent).toContain("Ruben");
+ // The board summary lands a tick later; the line grows rather than
+ // reserving a slot with a zero in it.
+ await waitFor(() => expect(header.textContent).toContain("491 conversations"));
+ expect(header.textContent).toContain("since");
+ });
+ it("opens a cluster's gaps on demand", async () => {
+ installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
- await waitFor(() => {
- expect(screen.getByTestId("reviews-error")).toBeDefined();
- });
- expect(screen.queryByTestId("reviews-disabled")).toBeNull();
+ const toggle = await screen.findByTestId("gaps-communication");
+ expect(toggle.textContent).toContain("5 open fields");
+ expect(screen.queryByText("Verbosity")).toBeNull();
+
+ fireEvent.click(toggle);
+ await screen.findByText("Verbosity");
});
});
-// Open knowledge matrix: the user found the "classified dossier" treatment
-// (diagonal-hatch redaction bars on unknown fields + a "Confidential" hero)
-// misleading — it read as information being withheld. These tests pin the
-// de-classified contract: empty fields are plainly readable, nothing is
-// concealed, and the secrecy framing is gone. PROFILE_OK has `meta: {}`, so
-// every cluster field is empty — the worst case for the old redaction bars.
-describe("ProfileView — open knowledge matrix (no concealment)", () => {
- it("renders unknown fields as readable text, never as a redaction bar", async () => {
- installFetchMock({
- "/api/profile/reviews": () => ({
- status: 503,
- body: { detail: CURATOR_503_DETAIL },
- }),
- "/api/profile/raw": () => ({ body: RAW_OK }),
- "/api/profile": () => ({ body: PROFILE_OK }),
- });
-
- const { container } = renderWithClient(<ProfileView />);
+describe("provenance", () => {
+ it("shows the date a fact was learned and the sentence behind it", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
- // The knowledge matrix renders unknown fields as the plain "not known yet"
- // label instead of a black hatch bar.
- await waitFor(() => {
- expect(screen.getAllByText("not known yet").length).toBeGreaterThan(0);
- });
+ const source = await screen.findByTestId("entry-source-primary_language");
+ expect(source.textContent).toContain("2026-08-29");
- // Core contract: empty fields must NOT be concealed behind a redaction bar.
- expect(container.querySelector(".dossier-redact")).toBeNull();
+ fireEvent.click(source);
+ await screen.findByText("always answer me in German");
});
- it("drops the classified-dossier framing from the hero", async () => {
- installFetchMock({
- "/api/profile/reviews": () => ({
- status: 503,
- body: { detail: CURATOR_503_DETAIL },
- }),
- "/api/profile/raw": () => ({ body: RAW_OK }),
- "/api/profile": () => ({ body: PROFILE_OK }),
- });
+ it("shows no date for a fact the audit trail never mentions", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
- const { container } = renderWithClient(<ProfileView />);
+ await screen.findByText("Europe/Berlin");
+ expect(screen.queryByTestId("entry-source-timezone")).toBeNull();
+ });
+});
- // The hero leads with a conversational, named headline — not a
- // classification strip.
- await waitFor(() => {
- expect(screen.getByText("A fresh page, Ruben.")).toBeDefined();
- });
+describe("the rail", () => {
+ it("offers to write the portrait when none exists", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
- // The secrecy signals are gone.
- expect(screen.queryByText("Confidential")).toBeNull();
- expect(container.querySelector(".dossier-hatch")).toBeNull();
+ const empty = await screen.findByTestId("portrait-empty");
+ expect(empty.textContent).toContain("has not written a portrait");
});
-});
-// The "Knows you" treatment: a blank profile must read as an invitation, not
-// as a wall of grey "not known yet" repetitions. These tests pin the pillars:
-// a named acquaintance stage instead of a bare percentage, ONE rotating
-// question card with a speakable prompt, and the knowledge wave.
-describe("ProfileView — the knows-you treatment for a blank profile", () => {
- function mockBlankProfile() {
+ it("renders the portrait and its feedback when one exists", async () => {
installFetchMock({
- "/api/profile/reviews": () => ({
- status: 503,
- body: { detail: CURATOR_503_DETAIL },
+ ...BASE_ROUTES,
+ "/api/board/bio": () => ({
+ body: { text: "Builds things at night.", generated_at: "2026-09-01T20:00:00Z" },
}),
- "/api/profile/raw": () => ({ body: RAW_OK }),
- "/api/profile": () => ({ body: PROFILE_OK }),
});
- }
+ renderWithClient(<ProfileView />);
+
+ const text = await screen.findByTestId("portrait-text");
+ expect(text.textContent).toBe("Builds things at night.");
+ expect(screen.getByRole("button", { name: "Fits" })).toBeTruthy();
+ });
- it("names the acquaintance stage instead of leading with a bare percent", async () => {
- mockBlankProfile();
+ it("quotes the never-recorded categories out of the file", async () => {
+ installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
- await waitFor(() => {
- expect(screen.getAllByText(/A blank page/).length).toBeGreaterThan(0);
- });
+ const list = await screen.findByTestId("never-stored");
+ expect(list.textContent).toContain("Political");
+ expect(list.textContent).toContain("MBTI type");
});
- it("shows one open question with a speakable prompt and rotates on Next", async () => {
- mockBlankProfile();
+ it("invites the wiki page rather than reporting a 404", async () => {
+ installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
- // The top-priority open field (name) surfaces as the current question…
- await waitFor(() => {
- expect(
- screen.getByText("What name shall I write on the first page?"),
- ).toBeDefined();
- });
- // …and carries the literal sentence the user can speak to Jarvis.
- expect(screen.getAllByText(/Just say/).length).toBeGreaterThan(0);
-
- // Clicking Next advances to the second-priority question.
- fireEvent.click(screen.getByTestId("ask-next"));
- await waitFor(() => {
- expect(
- screen.getByText("How would you like to be addressed?"),
- ).toBeDefined();
- });
+ const empty = await screen.findByTestId("wiki-empty");
+ expect(empty.textContent).toContain("no page about you yet");
+ });
+});
+
+describe("the dead cards stay deleted", () => {
+ it("renders no review queue, no people list and no ask prompt", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
+
+ await screen.findByTestId("dossier-header");
+ await waitFor(() => expect(screen.queryByTestId("never-stored")).not.toBeNull());
+
+ expect(screen.queryByTestId("ask-next")).toBeNull();
+ expect(screen.queryByTestId("reviews-disabled")).toBeNull();
+ expect(screen.queryByTestId("reviews-error")).toBeNull();
+ expect(screen.queryByText("Waiting for your OK")).toBeNull();
+ expect(screen.queryByText("No people known yet")).toBeNull();
});
- it("summarizes progress as one quiet text line, not metric tiles", async () => {
- mockBlankProfile();
+ it("never calls the review endpoint", async () => {
+ const fetchMock = installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
- // The open hero carries a single inline summary sentence…
- await waitFor(() => {
- expect(screen.getByText("0 of 18 things learned")).toBeDefined();
+ await screen.findByTestId("dossier-header");
+ const called = fetchMock.mock.calls.map((c) => String(c[0]));
+ expect(called.some((u) => u.includes("/api/profile/reviews"))).toBe(false);
+ });
+});
+
+describe("a profile the backend is not serving", () => {
+ it("treats 503 as a state, not a failure", async () => {
+ installFetchMock({
+ ...BASE_ROUTES,
+ "/api/profile": () => ({ status: 503, body: { detail: "Profile system not ready." } }),
});
- // …and the decorative waveform is gone for good.
- expect(screen.queryByTestId("knowledge-wave")).toBeNull();
+ renderWithClient(<ProfileView />);
+
+ await screen.findByText("No name on file");
+ expect(screen.queryByTestId("dossier-header")).toBeNull();
});
});
diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.tsx
index de357fbb3e..717f8b803c 100644
--- a/jarvis/ui/web/frontend/src/views/ProfileView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ProfileView.tsx
@@ -1,29 +1,33 @@
/**
- * ProfileView — what Jarvis knows about you, and the file it keeps it in.
+ * ProfileView — the file the assistant keeps on you.
*
- * Two tabs, because the view answers two different questions and mixing them
- * was the old layout's mistake: "what does it know about me" is a ledger of
- * fields, "what does the file say" is a document. They shared one screen as
- * three standing rails, which meant neither got a readable width and both were
- * permanently half-visible.
+ * The section answers one question: *what do you know about me, and how do you
+ * know it?* Everything on the page is either a fact, the receipt for a fact,
+ * or the boundary the assistant will not cross.
*
* ┌──────────────────────────────────────────────────────────────────┐
- * │ PageHeader — Profile · refresh · [ Knowledge | Source file ] │
+ * │ PageHeader — Profile · refresh · [ The file | Source ] │
* ├──────────────────────────────────────────────────────────────────┤
- * │ Identity card — portrait, address, stage, progress, people │
+ * │ Name · language · timezone · since · conversations 6 of 18 │
* ├───────────────────────────────────┬──────────────────────────────┤
- * │ Cluster cards, two columns │ Rail: the open question, │
- * │ every field, editable in place │ the review queue, the people │
+ * │ Entries — five sections, known │ How the assistant describes │
+ * │ facts listed, gaps folded into │ you · your standing rules · │
+ * │ one line, every entry showing │ what is never stored · the │
+ * │ the date it was learned │ long-form page in the wiki │
* └───────────────────────────────────┴──────────────────────────────┘
*
- * Below 1280 px the rail becomes a row under the ledger, and below 1024 px
- * everything is one column. The header never scrolls; the body below it does.
+ * Three cards were removed rather than restyled, because no styling makes an
+ * empty pipe full: the review queue (the legacy curator has been disabled
+ * since 2026-05-17, so it could never fill), the people list (it read
+ * `data/workspace/people/`, which is empty — Contacts owns people), and the
+ * "would love to know" prompt (it wrote to no endpoint; the gap expander in
+ * the ledger now fills fields for real).
*
* The raw-file query and its live WS subscription are held HERE rather than in
- * the source tab, so a Curator write still refreshes the ledger while the
- * reader is looking at the knowledge tab.
+ * the source tab, because both tabs need it: the source tab renders it, and
+ * the file tab parses its audit trail for provenance.
*/
-import { useState } from "react";
+import { useMemo, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { AlertTriangle, RefreshCw, UserCircle2 } from "lucide-react";
@@ -33,24 +37,26 @@ import { Button } from "@/components/ui/button";
import { EmptyState } from "@/components/ui/empty-state";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
-import { AskCard } from "@/views/profile/AskCard";
-import { IdentityCard } from "@/views/profile/IdentityCard";
-import { KnowledgeLedger } from "@/views/profile/KnowledgeLedger";
-import { PeopleCard } from "@/views/profile/PeopleCard";
-import { ReviewsCard } from "@/views/profile/ReviewsCard";
+import { DossierHeader } from "@/views/profile/DossierHeader";
+import { EntryLedger } from "@/views/profile/EntryLedger";
+import { NeverStoredCard } from "@/views/profile/NeverStoredCard";
+import { PortraitCard } from "@/views/profile/PortraitCard";
+import { RulesCard } from "@/views/profile/RulesCard";
import { SourceCard, useSourceDocument } from "@/views/profile/SourceCard";
+import { WikiCard } from "@/views/profile/WikiCard";
import { fetchJson, statusOf, type ProfileResponse } from "@/views/profile/api";
+import { parseObservations } from "@/views/profile/provenance";
-type TabId = "knowledge" | "source";
+type TabId = "file" | "source";
-/** The main grid: ledger left, rail right, and one column below 1280 px. */
-const SPLIT = "grid gap-5 xl:grid-cols-[minmax(0,1fr)_336px]";
-/** The rail: a row of cards under the ledger until it can stand beside it. */
-const RAIL = "grid gap-5 content-start sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-1";
+/** Entries left, rail right, and one column below 1280 px. */
+const SPLIT = "grid gap-5 xl:grid-cols-[minmax(0,1fr)_360px]";
+/** The rail: a row of cards under the entries until it can stand beside them. */
+const RAIL = "grid gap-5 content-start sm:grid-cols-2 xl:grid-cols-1";
export function ProfileView() {
const t = useT();
- const [tab, setTab] = useState<TabId>("knowledge");
+ const [tab, setTab] = useState<TabId>("file");
const { data, isLoading, error, refetch, isRefetching } = useQuery<ProfileResponse, Error>({
queryKey: ["profile"],
@@ -60,6 +66,8 @@ export function ProfileView() {
// Held at the root on purpose — see the module note.
const source = useSourceDocument();
+ const raw = source.data?.content ?? null;
+ const observations = useMemo(() => parseObservations(raw), [raw]);
const meta = (data?.user.meta ?? {}) as Record<string, unknown>;
@@ -87,7 +95,7 @@ export function ProfileView() {
tabs={
<TabBar
tabs={[
- { id: "knowledge", label: t("profile_view.section_knowledge") },
+ { id: "file", label: t("profile_view.tab_file") },
{ id: "source", label: t("profile_view.section_source") },
]}
active={tab}
@@ -102,15 +110,16 @@ export function ProfileView() {
{error && <ProfileErrorState error={error} onRetry={() => refetch()} />}
- {data && tab === "knowledge" && (
+ {data && tab === "file" && (
<div className="flex flex-col gap-5">
- <IdentityCard data={data} meta={meta} onOpenSource={() => setTab("source")} />
+ <DossierHeader data={data} meta={meta} />
<div className={SPLIT}>
- <KnowledgeLedger meta={meta} />
+ <EntryLedger meta={meta} observations={observations} />
<aside className={RAIL}>
- <AskCard meta={meta} />
- <ReviewsCard reviewsCount={data.reviews_count} />
- <PeopleCard people={data.people} />
+ <PortraitCard />
+ <RulesCard />
+ <NeverStoredCard raw={raw} />
+ <WikiCard name={data.user.name?.trim() || null} />
</aside>
</div>
</div>
@@ -135,29 +144,36 @@ export function ProfileView() {
function ProfileSkeleton({ label }: { label: string }) {
return (
<div role="status" aria-busy="true" aria-label={label} className="flex flex-col gap-5">
- <div className="rounded-lg border border-border bg-card p-5">
- <div className="flex items-center gap-5">
- <div className="h-14 w-14 shrink-0 animate-pulse rounded-full bg-secondary" />
- <div className="flex min-w-0 flex-1 flex-col gap-2">
- <div className="h-5 w-56 max-w-full animate-pulse rounded-md bg-secondary" />
- <div className="h-3 w-32 max-w-full animate-pulse rounded-full bg-secondary" />
- </div>
- <div className="hidden w-64 shrink-0 flex-col gap-2 sm:flex">
- <div className="h-3 w-40 animate-pulse rounded-full bg-secondary" />
- <div className="h-1.5 w-full animate-pulse rounded-full bg-secondary" />
- </div>
+ <div className="flex items-center gap-5 border-b border-border pb-5">
+ <div className="h-16 w-16 shrink-0 animate-pulse rounded-full bg-secondary" />
+ <div className="flex min-w-0 flex-1 flex-col gap-2">
+ <div className="h-6 w-56 max-w-full animate-pulse rounded-md bg-secondary" />
+ <div className="h-3 w-72 max-w-full animate-pulse rounded-full bg-secondary" />
</div>
+ <div className="hidden h-3 w-32 shrink-0 animate-pulse rounded-full bg-secondary sm:block" />
</div>
<div className={SPLIT}>
- <div className="grid gap-5 lg:grid-cols-2">
- {[0, 1, 2, 3].map((i) => (
- <SkeletonCard key={i} rows={4} />
+ <div className="rounded-lg border border-border bg-card">
+ {[0, 1, 2, 3, 4].map((i) => (
+ <div key={i} className="border-b border-border px-5 py-4 last:border-b-0">
+ <div className="h-4 w-32 animate-pulse rounded-md bg-secondary" />
+ <div className="mt-3 flex flex-col gap-2">
+ <div className="h-3 w-full animate-pulse rounded-full bg-secondary" />
+ <div className="h-3 w-2/3 animate-pulse rounded-full bg-secondary" />
+ </div>
+ </div>
))}
</div>
<div className={RAIL}>
{[0, 1, 2].map((i) => (
- <SkeletonCard key={i} rows={3} />
+ <div key={i} className="rounded-lg border border-border bg-card p-5">
+ <div className="h-4 w-28 animate-pulse rounded-md bg-secondary" />
+ <div className="mt-4 flex flex-col gap-2">
+ <div className="h-3 w-full animate-pulse rounded-full bg-secondary" />
+ <div className="h-3 w-4/5 animate-pulse rounded-full bg-secondary" />
+ </div>
+ </div>
))}
</div>
</div>
@@ -165,22 +181,6 @@ function ProfileSkeleton({ label }: { label: string }) {
);
}
-function SkeletonCard({ rows }: { rows: number }) {
- return (
- <div className="rounded-lg border border-border bg-card p-5">
- <div className="h-4 w-28 animate-pulse rounded-md bg-secondary" />
- <div className="mt-4 flex flex-col gap-3">
- {Array.from({ length: rows }, (_, i) => (
- <div key={i} className="flex items-center justify-between gap-8">
- <div className="h-3 w-24 animate-pulse rounded-full bg-secondary" />
- <div className="h-3 w-20 animate-pulse rounded-full bg-secondary" />
- </div>
- ))}
- </div>
- </div>
- );
-}
-
/**
* 503 means the profile subsystem is deliberately not running in this session
* (a mock brain, a provider without memory integration). That is a state, not
@@ -194,7 +194,7 @@ function ProfileErrorState({ error, onRetry }: { error: Error; onRetry: () => vo
return (
<EmptyState
icon={<UserCircle2 />}
- title={t("profile_view.hero_name_placeholder")}
+ title={t("profile_view.header_unnamed")}
description={t("profile_view.no_user_hint")}
actions={
<Button size="sm" variant="outline" onClick={onRetry}>
diff --git a/jarvis/ui/web/frontend/src/views/profile/AskCard.tsx b/jarvis/ui/web/frontend/src/views/profile/AskCard.tsx
deleted file mode 100644
index 721797dd84..0000000000
--- a/jarvis/ui/web/frontend/src/views/profile/AskCard.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * The open question — ONE at a time, with the sentence you can speak.
- *
- * A blank profile has eighteen holes in it. Listing them is a chore list; the
- * card asks a single question in priority order and hands over the literal
- * words to say, so filling the profile is a conversation rather than a form.
- * It is the only accent-washed object in the view, which is what makes it the
- * one thing the eye goes to when the profile is still thin.
- */
-import { useMemo, useState } from "react";
-import { ChevronRight, Mic, Sparkles } from "lucide-react";
-
-import { Button } from "@/components/ui/button";
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-import { EmptyState } from "@/components/ui/empty-state";
-import { useT } from "@/i18n";
-import { TOTAL_FIELDS, collectOpenQuestions } from "@/views/profile/ledger";
-
-export function AskCard({ meta }: { meta: Record<string, unknown> }) {
- const t = useT();
- const [idx, setIdx] = useState(0);
-
- const open = useMemo(() => collectOpenQuestions(meta, TOTAL_FIELDS), [meta]);
-
- if (open.length === 0) {
- return (
- <Card>
- <CardHeader className="pb-0">
- <CardTitle>{t("profile_view.ask_title")}</CardTitle>
- </CardHeader>
- <CardContent>
- <EmptyState
- className="max-w-none py-6"
- icon={<Sparkles />}
- title={t("profile_view.ask_empty_title")}
- description={t("profile_view.ask_empty_body")}
- />
- </CardContent>
- </Card>
- );
- }
-
- const q = open[idx % open.length];
-
- return (
- <Card className="border-accent/20 bg-accent-soft">
- <CardHeader className="flex-row items-center justify-between gap-3 pb-2">
- <span className="flex min-w-0 items-center gap-2 text-sm font-medium text-accent">
- <Sparkles aria-hidden className="h-4 w-4 shrink-0" />
- <span className="truncate">{t("profile_view.ask_title")}</span>
- </span>
- <span className="shrink-0 text-sm tabular-nums text-muted-foreground">
- {(idx % open.length) + 1}/{open.length}
- </span>
- </CardHeader>
-
- <CardContent>
- <p className="text-lg font-semibold text-foreground-strong">
- {t(`profile_view.questions.${q.field}`)}
- </p>
-
- <p className="mt-3 flex items-start gap-2 text-base text-muted-foreground">
- <Mic aria-hidden className="mt-0.5 h-4 w-4 shrink-0" />
- <span className="min-w-0">
- {t("profile_view.ask_say_prefix")}:{" "}
- <span className="text-foreground">“{t(`profile_view.says.${q.field}`)}”</span>
- </span>
- </p>
-
- <div className="mt-4 flex items-center justify-between gap-3">
- <span className="min-w-0 truncate text-sm text-muted-foreground">
- {t(`profile_view.clusters.${q.cluster}.label`)}
- </span>
- <Button
- type="button"
- size="sm"
- variant="outline"
- data-testid="ask-next"
- onClick={() => setIdx((i) => i + 1)}
- >
- {t("profile_view.ask_next")}
- <ChevronRight />
- </Button>
- </div>
- </CardContent>
- </Card>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx b/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx
new file mode 100644
index 0000000000..eef27f78ed
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx
@@ -0,0 +1,154 @@
+/**
+ * The portrait, and the whole upload control.
+ *
+ * The avatar bytes live under user_data_dir()/data and are served by
+ * GET /api/profile/avatar. A hidden <input type="file"> is .click()'d to open
+ * the OS picker; a cache-busting query param forces the <img> to reload after
+ * a replace or a delete. The portrait IS the control — click to pick a file,
+ * and a small remove badge appears on hover or keyboard focus once there is a
+ * picture to remove. There is no second "change picture" button anywhere.
+ *
+ * Lifted out of the old IdentityCard unchanged: the cache-busting and the
+ * same-file-again reset are both load-bearing and were correct.
+ */
+import { useRef, useState } from "react";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { Camera, Loader2, Trash2, UserCircle2 } from "lucide-react";
+
+import { IdentityAvatar } from "@/components/identity/IdentityAvatar";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { useEventStore } from "@/store/events";
+
+export function AvatarButton({
+ name,
+ hasAvatar,
+ size = "md",
+}: {
+ name: string | null;
+ hasAvatar: boolean;
+ /** `lg` is the dossier header; `md` keeps the old 56 px for anywhere else. */
+ size?: "md" | "lg";
+}) {
+ const t = useT();
+ const queryClient = useQueryClient();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const inputRef = useRef<HTMLInputElement | null>(null);
+ const [bust, setBust] = useState(0);
+
+ const upload = useMutation({
+ mutationFn: async (file: File) => {
+ const fd = new FormData();
+ fd.append("file", file);
+ const res = await fetch("/api/profile/avatar", { method: "POST", body: fd });
+ if (!res.ok) {
+ const body = (await res.json().catch(() => ({}))) as { detail?: string };
+ throw new Error(body.detail ?? `HTTP ${res.status}`);
+ }
+ return res.json();
+ },
+ onSuccess: () => {
+ setBust(Date.now());
+ pushToast("success", t("profile_view.avatar_uploaded"));
+ queryClient.invalidateQueries({ queryKey: ["profile"] });
+ },
+ onError: (err: Error) => pushToast("error", err.message),
+ });
+
+ const remove = useMutation({
+ mutationFn: async () => {
+ const res = await fetch("/api/profile/avatar", { method: "DELETE" });
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ return res.json();
+ },
+ onSuccess: () => {
+ setBust(Date.now());
+ pushToast("info", t("profile_view.avatar_removed"));
+ queryClient.invalidateQueries({ queryKey: ["profile"] });
+ },
+ onError: (err: Error) => pushToast("error", err.message),
+ });
+
+ const onFileChosen = (e: React.ChangeEvent<HTMLInputElement>) => {
+ const file = e.target.files?.[0];
+ // Reset so picking the *same* file again still fires onChange.
+ e.target.value = "";
+ if (file) upload.mutate(file);
+ };
+
+ const busy = upload.isPending || remove.isPending;
+ const box = size === "lg" ? "h-16 w-16" : "h-14 w-14";
+ const title = hasAvatar ? t("profile_view.avatar_change") : t("profile_view.avatar_upload");
+
+ return (
+ <div className="group/avatar relative shrink-0">
+ <input
+ ref={inputRef}
+ type="file"
+ accept="image/png,image/jpeg,image/webp,image/gif"
+ className="hidden"
+ aria-hidden="true"
+ tabIndex={-1}
+ onChange={onFileChosen}
+ />
+ <button
+ type="button"
+ onClick={() => inputRef.current?.click()}
+ disabled={busy}
+ title={title}
+ aria-label={title}
+ className={cn(
+ "relative flex items-center justify-center overflow-hidden rounded-full bg-secondary transition-colors",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:opacity-50",
+ box,
+ )}
+ >
+ {/* The person's own coloured mark, not a grey disc: this is the app's
+ own owner, and identity is one of the jobs colour is allowed. */}
+ {name ? (
+ <IdentityAvatar
+ name={name}
+ size="lg"
+ src={hasAvatar ? `/api/profile/avatar?t=${bust}` : null}
+ alt={t("profile_view.avatar_alt")}
+ />
+ ) : hasAvatar ? (
+ <img
+ src={`/api/profile/avatar?t=${bust}`}
+ alt={t("profile_view.avatar_alt")}
+ className="h-full w-full object-cover"
+ draggable={false}
+ />
+ ) : (
+ <UserCircle2 aria-hidden className="h-6 w-6 text-muted-foreground" />
+ )}
+
+ <span className="pointer-events-none absolute inset-0 flex items-center justify-center rounded-full bg-scrim/70 opacity-0 transition-opacity duration-200 group-hover/avatar:opacity-100 group-focus-visible/avatar:opacity-100">
+ <Camera aria-hidden className="h-4 w-4 text-foreground-strong" />
+ </span>
+
+ {busy && (
+ <span className="absolute inset-0 flex items-center justify-center rounded-full bg-scrim/70">
+ <Loader2 aria-hidden className="h-4 w-4 animate-spin text-foreground-strong" />
+ </span>
+ )}
+ </button>
+
+ {hasAvatar && (
+ <button
+ type="button"
+ onClick={() => remove.mutate()}
+ disabled={busy}
+ title={t("profile_view.avatar_remove")}
+ aria-label={t("profile_view.avatar_remove")}
+ className={cn(
+ "absolute -bottom-1 -right-1 rounded-full border border-border bg-card p-1 text-muted-foreground opacity-0 transition-opacity",
+ "hover:text-destructive focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/avatar:opacity-100",
+ )}
+ >
+ <Trash2 aria-hidden className="h-3 w-3" />
+ </button>
+ )}
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/DossierHeader.tsx b/jarvis/ui/web/frontend/src/views/profile/DossierHeader.tsx
new file mode 100644
index 0000000000..35cf1bfe48
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/DossierHeader.tsx
@@ -0,0 +1,99 @@
+/**
+ * The cover line of the file.
+ *
+ * A dossier opens by naming its subject, not by reporting how complete it is.
+ * So the name is the largest thing on the screen, the line under it is only
+ * facts that actually exist (a missing timezone leaves no gap and no dash),
+ * and the count sits quietly on the right in the mono face the rest of the
+ * page uses for anything countable.
+ *
+ * The old header led with "Who are you? · First impressions" over a progress
+ * bar — a question and a score, neither of which is information about the
+ * reader. What replaced it is the first line of the record itself.
+ */
+import { useMemo } from "react";
+import { CalendarDays } from "lucide-react";
+
+import { useBoardSummary } from "@/hooks/useBoard";
+import { useT } from "@/i18n";
+import { AvatarButton } from "@/views/profile/AvatarButton";
+import { clusterDataOf, type ProfileResponse } from "@/views/profile/api";
+import {
+ TOTAL_FIELDS,
+ countFilled,
+ displayAddress,
+ isEmptyValue,
+} from "@/views/profile/ledger";
+
+/** A YYYY-MM-DD or ISO stamp as a short local date; null when unparseable. */
+function shortDate(value: unknown): string | null {
+ if (typeof value !== "string" || !value.trim()) return null;
+ const d = new Date(value);
+ if (Number.isNaN(d.getTime())) return null;
+ return d.toLocaleDateString(undefined, { day: "numeric", month: "short", year: "numeric" });
+}
+
+export function DossierHeader({
+ data,
+ meta,
+}: {
+ data: ProfileResponse;
+ meta: Record<string, unknown>;
+}) {
+ const t = useT();
+ const board = useBoardSummary();
+
+ const name = data.user.name?.trim() || null;
+ const address = displayAddress(meta, name);
+ const filled = useMemo(() => countFilled(meta), [meta]);
+
+ const identity = clusterDataOf(meta, "identity");
+ const since = shortDate(board.data?.totals.first_day);
+ const sessions = board.data?.totals.session_count ?? 0;
+ const updated = shortDate(meta["last_updated"]);
+
+ // Only what is known appears. A dossier line with three dashes in it is the
+ // form we are getting away from.
+ const facts: string[] = [];
+ if (!isEmptyValue(identity["primary_language"])) facts.push(String(identity["primary_language"]));
+ if (!isEmptyValue(identity["timezone"])) facts.push(String(identity["timezone"]));
+ if (since) facts.push(t("profile_view.header_since").replace("{0}", since));
+ if (sessions > 0) {
+ facts.push(t("profile_view.header_conversations").replace("{0}", String(sessions)));
+ }
+
+ return (
+ <header
+ data-testid="dossier-header"
+ className="profile-rise flex flex-wrap items-center gap-x-5 gap-y-3 border-b border-border pb-5"
+ >
+ <AvatarButton name={name} hasAvatar={!!data.has_avatar} size="lg" />
+
+ <div className="min-w-0 flex-1 basis-72">
+ <h2 className="truncate font-display text-display text-foreground-strong">
+ {address ?? t("profile_view.header_unnamed")}
+ </h2>
+ <p className="mt-1 truncate text-meta text-muted-foreground">
+ {facts.length ? facts.join(" · ") : t("profile_view.header_nothing_yet")}
+ </p>
+ </div>
+
+ <div className="flex shrink-0 flex-col items-end gap-1">
+ <span
+ data-testid="dossier-count"
+ className="font-mono text-meta tabular-nums text-foreground"
+ >
+ {t("profile_view.header_entries")
+ .replace("{0}", String(filled))
+ .replace("{1}", String(TOTAL_FIELDS))}
+ </span>
+ {updated && (
+ <span className="flex items-center gap-1.5 text-micro text-foreground-faint">
+ <CalendarDays aria-hidden className="h-3 w-3" />
+ {t("profile_view.header_updated").replace("{0}", updated)}
+ </span>
+ )}
+ </div>
+ </header>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/EntryLedger.tsx b/jarvis/ui/web/frontend/src/views/profile/EntryLedger.tsx
new file mode 100644
index 0000000000..b011ff72d7
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/EntryLedger.tsx
@@ -0,0 +1,148 @@
+/**
+ * The entries — one file, five sections, and the gaps folded away.
+ *
+ * The old ledger listed all eighteen fields in five separate cards on the
+ * argument that "a blank field is as informative as a written one". On a
+ * profile the assistant has barely started, that produced sixteen rows of the
+ * same three words and five cards with nothing in the bottom two thirds. The
+ * page reported its own emptiness in more detail than it reported the reader.
+ *
+ * So: known facts are entries, and unknown fields collapse into one line per
+ * section that opens on click. The count stays visible on every section, so
+ * nothing is hidden — it is folded, and folding is what a file does with
+ * pages nobody has written yet.
+ *
+ * One card rather than five, because five boxes read as a dashboard and this
+ * is a document.
+ */
+import { useState } from "react";
+import { ChevronDown } from "lucide-react";
+
+import { Badge } from "@/components/ui/badge";
+import { Card } from "@/components/ui/card";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { clusterDataOf } from "@/views/profile/api";
+import { EntryRow } from "@/views/profile/EntryRow";
+import {
+ CLUSTER_FIELD_KEYS,
+ CLUSTER_ORDER,
+ clusterFilledCount,
+ isEmptyValue,
+ type ClusterId,
+} from "@/views/profile/ledger";
+import { historyFor, latestFor, type Observation } from "@/views/profile/provenance";
+
+export function EntryLedger({
+ meta,
+ observations,
+}: {
+ meta: Record<string, unknown>;
+ observations: readonly Observation[];
+}) {
+ return (
+ <Card className="profile-rise divide-y divide-border">
+ {CLUSTER_ORDER.map((cid, i) => (
+ <ClusterSection
+ key={cid}
+ cid={cid}
+ meta={meta}
+ observations={observations}
+ delayMs={60 + i * 40}
+ />
+ ))}
+ </Card>
+ );
+}
+
+function ClusterSection({
+ cid,
+ meta,
+ observations,
+ delayMs,
+}: {
+ cid: ClusterId;
+ meta: Record<string, unknown>;
+ observations: readonly Observation[];
+ delayMs: number;
+}) {
+ const t = useT();
+ const [showGaps, setShowGaps] = useState(false);
+
+ const data = clusterDataOf(meta, cid);
+ const fields = CLUSTER_FIELD_KEYS[cid];
+ const filled = clusterFilledCount(meta, cid);
+ const complete = filled === fields.length;
+
+ const known = fields.filter((key) => !isEmptyValue(data[key]));
+ const gaps = fields.filter((key) => isEmptyValue(data[key]));
+
+ const countLabel = t("profile_view.group_filled")
+ .replace("{0}", String(filled))
+ .replace("{1}", String(fields.length));
+
+ const row = (key: string) => (
+ <EntryRow
+ key={key}
+ cid={cid}
+ fieldKey={key}
+ value={data[key]}
+ latest={latestFor(observations, cid, key)}
+ history={historyFor(observations, cid, key)}
+ />
+ );
+
+ return (
+ <section
+ className="profile-rise px-5 py-4"
+ style={{ animationDelay: `${delayMs}ms` }}
+ aria-label={t(`profile_view.clusters.${cid}.label`)}
+ >
+ <div className="flex items-center justify-between gap-3">
+ <h3 className="text-title font-semibold text-foreground-strong">
+ {t(`profile_view.clusters.${cid}.label`)}
+ </h3>
+ <Badge
+ variant={complete ? "success" : "secondary"}
+ aria-label={countLabel}
+ title={countLabel}
+ className="tabular-nums"
+ >
+ {filled}/{fields.length}
+ </Badge>
+ </div>
+
+ {/* The rows keep a measure while the section header spans the card: a
+ fact set 1200 px wide has its two ends a hand-span apart, and the
+ empty right side then reads as margin rather than as a hole. */}
+ <div className="mt-2 max-w-reading">
+ {known.map(row)}
+
+ {gaps.length > 0 && (
+ <>
+ {showGaps && <div className="mt-1">{gaps.map(row)}</div>}
+ <button
+ type="button"
+ onClick={() => setShowGaps((v) => !v)}
+ aria-expanded={showGaps}
+ data-testid={`gaps-${cid}`}
+ className={cn(
+ "-mx-2 mt-1 flex w-[calc(100%+1rem)] items-center gap-1.5 rounded-md px-2 py-1.5",
+ "text-meta text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ )}
+ >
+ <ChevronDown
+ aria-hidden
+ className={cn("h-3.5 w-3.5 transition-transform", showGaps && "rotate-180")}
+ />
+ {showGaps
+ ? t("profile_view.gaps_hide")
+ : t("profile_view.gaps_show").replace("{0}", String(gaps.length))}
+ </button>
+ </>
+ )}
+ </div>
+ </section>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/EntryRow.tsx b/jarvis/ui/web/frontend/src/views/profile/EntryRow.tsx
new file mode 100644
index 0000000000..33cc04c7f5
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/EntryRow.tsx
@@ -0,0 +1,351 @@
+/**
+ * One entry in the file — the value, where it came from, and the editor.
+ *
+ * The disclosure is the point of the whole section. Every fact the assistant
+ * holds was written by one of three writers, each of which appends an audit
+ * line to USER.md saying what it wrote and which sentence it took it from
+ * (see provenance.ts). Opening a row shows that sentence. It is the only
+ * honest answer to "how do you know that about me?", and until now it was on
+ * disk with nothing reading it.
+ *
+ * The three editor shapes — text, a yes/no pair, removable chips — are lifted
+ * from the old KnowledgeLedger unchanged. They were right: the shape follows
+ * the field kind, and the field kind is pinned against the backend's
+ * _LIST_FIELDS / _BOOL_FIELDS by a parity test.
+ */
+import { useEffect, useRef, useState } from "react";
+import { Check, ChevronDown, Pencil, Plus, Quote, Trash2, X } from "lucide-react";
+
+import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { useEventStore } from "@/store/events";
+import { renderValue, useFieldEdit, type FieldOp } from "@/views/profile/api";
+import { fieldKind, isEmptyValue, type ClusterId } from "@/views/profile/ledger";
+import type { Observation } from "@/views/profile/provenance";
+
+/** A 32 px square icon control, sized for a 40 px row. */
+function RowIconButton({
+ icon: Icon,
+ onClick,
+ title,
+ variant = "ghost",
+ disabled,
+}: {
+ icon: typeof Check;
+ onClick: () => void;
+ title: string;
+ variant?: "default" | "ghost" | "outline";
+ disabled?: boolean;
+}) {
+ return (
+ <Button
+ type="button"
+ variant={variant}
+ size="icon"
+ className="h-8 w-8 shrink-0"
+ onClick={onClick}
+ title={title}
+ aria-label={title}
+ disabled={disabled}
+ >
+ <Icon />
+ </Button>
+ );
+}
+
+export function EntryRow({
+ cid,
+ fieldKey,
+ value,
+ latest,
+ history,
+}: {
+ cid: ClusterId;
+ fieldKey: string;
+ value: unknown;
+ /** The audit line that explains the value on screen, if there is one. */
+ latest: Observation | null;
+ /** Every audit line for this field, oldest first. */
+ history: readonly Observation[];
+}) {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const edit = useFieldEdit();
+ const kind = fieldKind(fieldKey);
+ const empty = isEmptyValue(value);
+ const label = t(`profile_view.fields.${fieldKey}`);
+
+ const [editing, setEditing] = useState(false);
+ const [open, setOpen] = useState(false);
+ const [draft, setDraft] = useState("");
+ const inputRef = useRef<HTMLInputElement | null>(null);
+
+ useEffect(() => {
+ if (editing) inputRef.current?.focus();
+ }, [editing]);
+
+ const busy = edit.isPending;
+
+ const startEdit = () => {
+ setDraft(kind === "scalar" && !empty ? String(value) : "");
+ setEditing(true);
+ };
+ const cancel = () => {
+ setDraft("");
+ setEditing(false);
+ };
+ const mutate = (
+ operation: FieldOp,
+ v?: unknown,
+ opts?: { keepOpen?: boolean; clearDraft?: boolean },
+ ) => {
+ edit.mutate(
+ { cluster: cid, field: fieldKey, operation, value: v },
+ {
+ onSuccess: () => {
+ pushToast("success", t("profile_view.field_saved"));
+ if (opts?.clearDraft) setDraft("");
+ if (opts?.keepOpen) inputRef.current?.focus();
+ else cancel();
+ },
+ },
+ );
+ };
+
+ const saveScalar = () => {
+ const v = draft.trim();
+ if (v) mutate("set", v);
+ else mutate("clear");
+ };
+ const addItem = () => {
+ const v = draft.trim();
+ if (v) mutate("append", v, { keepOpen: true, clearDraft: true });
+ };
+
+ // ------------------------------------------------------------------ editing
+ if (editing) {
+ return (
+ <div className="-mx-2 rounded-md bg-secondary px-2 py-2">
+ <p className="text-body font-medium text-foreground-strong">{label}</p>
+ <div className="mt-2">
+ {kind === "bool" ? (
+ <div className="flex flex-wrap items-center gap-2">
+ {([true, false] as const).map((b) => (
+ <Button
+ key={String(b)}
+ type="button"
+ size="sm"
+ variant={value === b ? "default" : "outline"}
+ disabled={busy}
+ onClick={() => mutate("set", b)}
+ >
+ {b ? t("profile_view.value_yes") : t("profile_view.value_no")}
+ </Button>
+ ))}
+ <span className="ml-auto flex items-center gap-1">
+ <RowIconButton
+ icon={X}
+ onClick={cancel}
+ title={t("profile_view.raw_cancel")}
+ disabled={busy}
+ />
+ {!empty && (
+ <RowIconButton
+ icon={Trash2}
+ onClick={() => mutate("clear")}
+ title={t("profile_view.field_clear")}
+ disabled={busy}
+ />
+ )}
+ </span>
+ </div>
+ ) : kind === "list" ? (
+ <div className="flex flex-col gap-2">
+ {!empty && (
+ <div className="flex flex-wrap gap-1">
+ {(value as unknown[]).map((item) => (
+ <Badge key={String(item)} variant="outline" className="pr-1 text-foreground">
+ {String(item)}
+ <button
+ type="button"
+ disabled={busy}
+ onClick={() => mutate("remove", String(item), { keepOpen: true })}
+ title={t("profile_view.field_remove_item")}
+ aria-label={`${t("profile_view.field_remove_item")}: ${String(item)}`}
+ className="rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
+ >
+ <X aria-hidden className="h-3 w-3" />
+ </button>
+ </Badge>
+ ))}
+ </div>
+ )}
+ <div className="flex items-center gap-1">
+ <Input
+ ref={inputRef}
+ value={draft}
+ disabled={busy}
+ onChange={(e) => setDraft(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") addItem();
+ if (e.key === "Escape") cancel();
+ }}
+ placeholder={t("profile_view.field_add_placeholder")}
+ className="h-8"
+ />
+ <RowIconButton
+ icon={Plus}
+ onClick={addItem}
+ title={t("profile_view.field_add")}
+ variant="default"
+ disabled={busy}
+ />
+ <RowIconButton
+ icon={Check}
+ onClick={cancel}
+ title={t("profile_view.raw_save")}
+ disabled={busy}
+ />
+ {!empty && (
+ <RowIconButton
+ icon={Trash2}
+ onClick={() => mutate("clear")}
+ title={t("profile_view.field_clear")}
+ disabled={busy}
+ />
+ )}
+ </div>
+ </div>
+ ) : (
+ <div className="flex items-center gap-1">
+ <Input
+ ref={inputRef}
+ value={draft}
+ disabled={busy}
+ onChange={(e) => setDraft(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") saveScalar();
+ if (e.key === "Escape") cancel();
+ }}
+ placeholder={t("profile_view.field_value_placeholder")}
+ className="h-8"
+ />
+ <RowIconButton
+ icon={Check}
+ onClick={saveScalar}
+ title={t("profile_view.raw_save")}
+ variant="default"
+ disabled={busy}
+ />
+ <RowIconButton
+ icon={X}
+ onClick={cancel}
+ title={t("profile_view.raw_cancel")}
+ disabled={busy}
+ />
+ {!empty && (
+ <RowIconButton
+ icon={Trash2}
+ onClick={() => mutate("clear")}
+ title={t("profile_view.field_clear")}
+ disabled={busy}
+ />
+ )}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+ }
+
+ // ------------------------------------------------------------------ resting
+ const hasSource = latest !== null;
+
+ return (
+ <div className="-mx-2">
+ {/* A file reads in columns: the field name in a fixed measure, the value
+ set immediately beside it. Pushing the value to the far edge of a
+ 1200 px card left the two ends of a fact a hand-span apart. */}
+ <div className="group grid min-h-10 grid-cols-[minmax(7rem,11rem)_minmax(0,1fr)_auto] items-center gap-3 rounded-md px-2 py-1 transition-colors hover:bg-secondary">
+ <span className="truncate text-body text-muted-foreground" title={label}>
+ {label}
+ </span>
+
+ <span className="flex min-w-0 items-center gap-2">
+ {kind === "list" && !empty ? (
+ <span className="flex min-w-0 flex-wrap gap-1">
+ {(value as unknown[]).map((item) => (
+ <Badge key={String(item)} variant="secondary" className="text-foreground">
+ {String(item)}
+ </Badge>
+ ))}
+ </span>
+ ) : empty ? (
+ <span className="text-body text-foreground-faint">
+ {t("profile_view.field_unknown")}
+ </span>
+ ) : (
+ <span className="text-body text-foreground [overflow-wrap:anywhere]">
+ {renderValue(t, value)}
+ </span>
+ )}
+ </span>
+
+ <span className="flex shrink-0 items-center gap-1">
+ {/* The signature: the date is a button, and the button is the file's
+ receipt for this line. No provenance means no marker — never an
+ invented one for a fact that predates the audit trail. */}
+ {hasSource && (
+ <button
+ type="button"
+ onClick={() => setOpen((v) => !v)}
+ aria-expanded={open}
+ data-testid={`entry-source-${fieldKey}`}
+ title={t("profile_view.source_show")}
+ className="flex shrink-0 items-center gap-0.5 rounded-sm px-1 font-mono text-micro tabular-nums text-foreground-faint transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {latest.date}
+ <ChevronDown
+ aria-hidden
+ className={cn("h-3 w-3 transition-transform", open && "rotate-180")}
+ />
+ </button>
+ )}
+
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ onClick={startEdit}
+ title={t("profile_view.field_edit")}
+ aria-label={`${t("profile_view.field_edit")}: ${label}`}
+ className="h-8 w-8 shrink-0 text-muted-foreground opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100"
+ >
+ {empty ? <Plus /> : <Pencil />}
+ </Button>
+ </span>
+ </div>
+
+ {open && hasSource && (
+ <div className="mb-1 ml-2 mr-2 rounded-md border-l-2 border-border-strong bg-secondary/60 px-3 py-2">
+ {latest.evidence ? (
+ <p className="flex gap-2 text-meta italic text-foreground">
+ <Quote aria-hidden className="mt-0.5 h-3 w-3 shrink-0 text-muted-foreground" />
+ <span className="[overflow-wrap:anywhere]">{latest.evidence}</span>
+ </p>
+ ) : (
+ <p className="text-meta text-muted-foreground">{t("profile_view.source_no_quote")}</p>
+ )}
+ <p className="mt-1.5 font-mono text-micro text-foreground-faint">
+ {t("profile_view.source_learned").replace("{0}", latest.date)}
+ {history.length > 1 &&
+ ` · ${t("profile_view.source_revisions").replace("{0}", String(history.length))}`}
+ </p>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/IdentityCard.tsx b/jarvis/ui/web/frontend/src/views/profile/IdentityCard.tsx
deleted file mode 100644
index 3e85df7a5f..0000000000
--- a/jarvis/ui/web/frontend/src/views/profile/IdentityCard.tsx
+++ /dev/null
@@ -1,248 +0,0 @@
-/**
- * The identity card — who Jarvis thinks you are, in one calm object.
- *
- * The portrait doubles as the upload control (there is no second "change
- * picture" button anywhere), the headline is how the app addresses you, and
- * the progress bar is the only place completeness is drawn. When nothing has
- * been learned yet the card does not go quiet: it names the two ways to teach
- * it, because an empty profile is a first-run state, not a failure.
- */
-import { useMemo, useRef, useState } from "react";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-import { Camera, FileText, Loader2, Mic, Trash2, UserCircle2 } from "lucide-react";
-
-import { Button } from "@/components/ui/button";
-import { Card } from "@/components/ui/card";
-import { IdentityAvatar } from "@/components/identity/IdentityAvatar";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-import { useEventStore } from "@/store/events";
-import type { ProfileResponse } from "@/views/profile/api";
-import {
- TOTAL_FIELDS,
- acquaintanceStage,
- countFilled,
- displayAddress,
-} from "@/views/profile/ledger";
-
-export function IdentityCard({
- data,
- meta,
- onOpenSource,
-}: {
- data: ProfileResponse;
- meta: Record<string, unknown>;
- /** Switches the view to the source-file tab — the second way to teach it. */
- onOpenSource: () => void;
-}) {
- const t = useT();
- const name = data.user.name?.trim() || null;
-
- const filled = useMemo(() => countFilled(meta), [meta]);
- const stage = acquaintanceStage(filled, TOTAL_FIELDS);
- const percent = Math.round((filled / Math.max(TOTAL_FIELDS, 1)) * 100);
-
- // Address the user the way they asked to be addressed ("Chef"), falling back
- // to their first name — warmer than the full legal name.
- const address = displayAddress(meta, name);
- const headline = address
- ? t(`profile_view.stage_headline.${stage.key}`).replace("{0}", `, ${address}`)
- : t("profile_view.hero_name_placeholder");
-
- const ratio = t("profile_view.entries_ratio")
- .replace("{0}", String(filled))
- .replace("{1}", String(TOTAL_FIELDS));
-
- const peopleLine =
- data.people.length === 1
- ? t("profile_view.person_known").replace("{0}", "1")
- : t("profile_view.people_known").replace("{0}", String(data.people.length));
-
- return (
- <Card className="profile-rise p-5">
- <div className="flex flex-wrap items-center gap-x-5 gap-y-4">
- <AvatarButton name={name} hasAvatar={!!data.has_avatar} />
-
- <div className="min-w-0 flex-1 basis-64">
- <h2 className="truncate text-xl font-semibold text-foreground-strong">{headline}</h2>
- <p className="mt-1 text-base text-muted-foreground">
- {t(`profile_view.stages.${stage.key}`)}
- </p>
- </div>
-
- <div className="flex min-w-0 flex-1 basis-64 flex-col gap-2 sm:max-w-xs">
- <div className="flex items-baseline justify-between gap-3">
- <span className="text-base tabular-nums text-foreground">{ratio}</span>
- <span className="text-sm tabular-nums text-muted-foreground">{peopleLine}</span>
- </div>
- <div
- role="progressbar"
- aria-valuemin={0}
- aria-valuemax={TOTAL_FIELDS}
- aria-valuenow={filled}
- aria-label={ratio}
- data-testid="profile-progress"
- className="h-1.5 w-full overflow-hidden rounded-full bg-secondary"
- >
- <div
- className="h-full rounded-full bg-accent transition-[width] duration-500"
- style={{ width: `${percent}%` }}
- />
- </div>
- </div>
- </div>
-
- {filled === 0 && (
- <div className="mt-5 border-t border-border pt-4">
- <p className="text-xs font-medium uppercase tracking-wide text-foreground-faint">
- {t("profile_view.hero_teach_intro")}
- </p>
- <div className="mt-3 flex flex-col gap-3 md:flex-row md:gap-8">
- <p className="flex min-w-0 flex-1 items-start gap-2 text-base text-foreground-secondary">
- <Mic aria-hidden className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <span>{t("profile_view.hero_teach_voice")}</span>
- </p>
- <p className="flex min-w-0 flex-1 items-start gap-2 text-base text-foreground-secondary">
- <FileText aria-hidden className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <span>
- {t("profile_view.hero_teach_file")}{" "}
- <Button variant="link" className="align-baseline" onClick={onOpenSource}>
- {t("profile_view.hero_open_source")}
- </Button>
- </span>
- </p>
- </div>
- </div>
- )}
- </Card>
- );
-}
-
-// ----------------------------------------------------------------------
-// AvatarButton — the portrait, and the whole upload control
-// ----------------------------------------------------------------------
-//
-// The avatar bytes live under user_data_dir()/data and are served by
-// GET /api/profile/avatar. A hidden <input type="file"> is .click()'d to open
-// the OS picker; a cache-busting query param forces the <img> to reload after
-// a replace or a delete. The portrait IS the control — click to pick a file,
-// and a small remove badge appears on hover or keyboard focus once there is a
-// picture to remove.
-
-function AvatarButton({ name, hasAvatar }: { name: string | null; hasAvatar: boolean }) {
- const t = useT();
- const queryClient = useQueryClient();
- const pushToast = useEventStore((s) => s.pushToast);
- const inputRef = useRef<HTMLInputElement | null>(null);
- const [bust, setBust] = useState(0);
-
- const upload = useMutation({
- mutationFn: async (file: File) => {
- const fd = new FormData();
- fd.append("file", file);
- const res = await fetch("/api/profile/avatar", { method: "POST", body: fd });
- if (!res.ok) {
- const body = (await res.json().catch(() => ({}))) as { detail?: string };
- throw new Error(body.detail ?? `HTTP ${res.status}`);
- }
- return res.json();
- },
- onSuccess: () => {
- setBust(Date.now());
- pushToast("success", t("profile_view.avatar_uploaded"));
- queryClient.invalidateQueries({ queryKey: ["profile"] });
- },
- onError: (err: Error) => pushToast("error", err.message),
- });
-
- const remove = useMutation({
- mutationFn: async () => {
- const res = await fetch("/api/profile/avatar", { method: "DELETE" });
- if (!res.ok) throw new Error(`HTTP ${res.status}`);
- return res.json();
- },
- onSuccess: () => {
- setBust(Date.now());
- pushToast("info", t("profile_view.avatar_removed"));
- queryClient.invalidateQueries({ queryKey: ["profile"] });
- },
- onError: (err: Error) => pushToast("error", err.message),
- });
-
- const onFileChosen = (e: React.ChangeEvent<HTMLInputElement>) => {
- const file = e.target.files?.[0];
- // Reset so picking the *same* file again still fires onChange.
- e.target.value = "";
- if (file) upload.mutate(file);
- };
-
- const busy = upload.isPending || remove.isPending;
-
- return (
- <div className="group/avatar relative shrink-0">
- <input
- ref={inputRef}
- type="file"
- accept="image/png,image/jpeg,image/webp,image/gif"
- className="hidden"
- aria-hidden="true"
- tabIndex={-1}
- onChange={onFileChosen}
- />
- <button
- type="button"
- onClick={() => inputRef.current?.click()}
- disabled={busy}
- title={hasAvatar ? t("profile_view.avatar_change") : t("profile_view.avatar_upload")}
- aria-label={hasAvatar ? t("profile_view.avatar_change") : t("profile_view.avatar_upload")}
- className="relative flex h-14 w-14 items-center justify-center overflow-hidden rounded-full bg-secondary transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:opacity-50"
- >
- {/* The person's own coloured mark, not a grey disc: this is the app's
- own owner, and identity is one of the jobs colour is allowed. */}
- {name ? (
- <IdentityAvatar
- name={name}
- size="lg"
- src={hasAvatar ? `/api/profile/avatar?t=${bust}` : null}
- alt={t("profile_view.avatar_alt")}
- />
- ) : hasAvatar ? (
- <img
- src={`/api/profile/avatar?t=${bust}`}
- alt={t("profile_view.avatar_alt")}
- className="h-full w-full object-cover"
- draggable={false}
- />
- ) : (
- <UserCircle2 aria-hidden className="h-6 w-6 text-muted-foreground" />
- )}
-
- <span className="pointer-events-none absolute inset-0 flex items-center justify-center rounded-full bg-scrim/70 opacity-0 transition-opacity duration-200 group-hover/avatar:opacity-100 group-focus-visible/avatar:opacity-100">
- <Camera aria-hidden className="h-4 w-4 text-foreground-strong" />
- </span>
-
- {busy && (
- <span className="absolute inset-0 flex items-center justify-center rounded-full bg-scrim/70">
- <Loader2 aria-hidden className="h-4 w-4 animate-spin text-foreground-strong" />
- </span>
- )}
- </button>
-
- {hasAvatar && (
- <button
- type="button"
- onClick={() => remove.mutate()}
- disabled={busy}
- title={t("profile_view.avatar_remove")}
- aria-label={t("profile_view.avatar_remove")}
- className={cn(
- "absolute -bottom-1 -right-1 rounded-full border border-border bg-card p-1 text-muted-foreground opacity-0 transition-opacity",
- "hover:text-destructive focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/avatar:opacity-100",
- )}
- >
- <Trash2 aria-hidden className="h-3 w-3" />
- </button>
- )}
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/views/profile/KnowledgeLedger.tsx b/jarvis/ui/web/frontend/src/views/profile/KnowledgeLedger.tsx
deleted file mode 100644
index 1a1aee7cbc..0000000000
--- a/jarvis/ui/web/frontend/src/views/profile/KnowledgeLedger.tsx
+++ /dev/null
@@ -1,353 +0,0 @@
-/**
- * The knowledge ledger — one card per cluster, every field on the page.
- *
- * Nothing is hidden behind a "show more": a blank field is as informative as a
- * written one, so all eighteen are listed and the unknown ones say "not known
- * yet" in plain words. That sentence is deliberate — an earlier version drew a
- * redaction bar there, which read as information being withheld rather than
- * information not yet given.
- *
- * Every row is editable in place. The pencil is quiet until the row is hovered
- * or the button is focused, and the editor's shape follows the field kind:
- * text, a yes/no pair, or removable chips for a list.
- */
-import { useEffect, useRef, useState } from "react";
-import { Check, Pencil, Plus, Trash2, X } from "lucide-react";
-
-import { Badge } from "@/components/ui/badge";
-import { Button } from "@/components/ui/button";
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-import { Input } from "@/components/ui/input";
-import { useT } from "@/i18n";
-import { useEventStore } from "@/store/events";
-import { clusterDataOf, renderValue, useFieldEdit, type FieldOp } from "@/views/profile/api";
-import {
- CLUSTER_FIELD_KEYS,
- CLUSTER_ORDER,
- clusterFilledCount,
- fieldKind,
- isEmptyValue,
- type ClusterId,
-} from "@/views/profile/ledger";
-
-export function KnowledgeLedger({ meta }: { meta: Record<string, unknown> }) {
- return (
- <div className="grid gap-5 lg:grid-cols-2">
- {CLUSTER_ORDER.map((cid, i) => (
- <ClusterCard key={cid} cid={cid} meta={meta} delayMs={60 + i * 40} />
- ))}
- </div>
- );
-}
-
-function ClusterCard({
- cid,
- meta,
- delayMs,
-}: {
- cid: ClusterId;
- meta: Record<string, unknown>;
- delayMs: number;
-}) {
- const t = useT();
- const data = clusterDataOf(meta, cid);
- const fields = CLUSTER_FIELD_KEYS[cid];
- const filled = clusterFilledCount(meta, cid);
- const complete = filled === fields.length;
- const countLabel = t("profile_view.group_filled")
- .replace("{0}", String(filled))
- .replace("{1}", String(fields.length));
-
- return (
- <Card className="profile-rise flex flex-col" style={{ animationDelay: `${delayMs}ms` }}>
- <CardHeader className="flex-row items-center justify-between gap-3 pb-2">
- <CardTitle>{t(`profile_view.clusters.${cid}.label`)}</CardTitle>
- <Badge
- variant={complete ? "success" : "secondary"}
- aria-label={countLabel}
- title={countLabel}
- className="tabular-nums"
- >
- {filled}/{fields.length}
- </Badge>
- </CardHeader>
- <CardContent>
- <dl>
- {fields.map((key) => (
- <FieldRow key={key} cid={cid} fieldKey={key} value={data[key]} />
- ))}
- </dl>
- </CardContent>
- </Card>
- );
-}
-
-// ----------------------------------------------------------------------
-// One field, read and written in place
-// ----------------------------------------------------------------------
-
-/** A 32 px square icon control, sized for a 40 px row. */
-function RowIconButton({
- icon: Icon,
- onClick,
- title,
- variant = "ghost",
- disabled,
-}: {
- icon: typeof Check;
- onClick: () => void;
- title: string;
- variant?: "default" | "ghost" | "outline";
- disabled?: boolean;
-}) {
- return (
- <Button
- type="button"
- variant={variant}
- size="icon"
- className="h-8 w-8 shrink-0"
- onClick={onClick}
- title={title}
- aria-label={title}
- disabled={disabled}
- >
- <Icon />
- </Button>
- );
-}
-
-function FieldRow({
- cid,
- fieldKey,
- value,
-}: {
- cid: ClusterId;
- fieldKey: string;
- value: unknown;
-}) {
- const t = useT();
- const pushToast = useEventStore((s) => s.pushToast);
- const edit = useFieldEdit();
- const kind = fieldKind(fieldKey);
- const empty = isEmptyValue(value);
- const label = t(`profile_view.fields.${fieldKey}`);
-
- const [editing, setEditing] = useState(false);
- const [draft, setDraft] = useState("");
- const inputRef = useRef<HTMLInputElement | null>(null);
-
- useEffect(() => {
- if (editing) inputRef.current?.focus();
- }, [editing]);
-
- const busy = edit.isPending;
-
- const startEdit = () => {
- setDraft(kind === "scalar" && !empty ? String(value) : "");
- setEditing(true);
- };
- const cancel = () => {
- setDraft("");
- setEditing(false);
- };
- const mutate = (
- operation: FieldOp,
- v?: unknown,
- opts?: { keepOpen?: boolean; clearDraft?: boolean },
- ) => {
- edit.mutate(
- { cluster: cid, field: fieldKey, operation, value: v },
- {
- onSuccess: () => {
- pushToast("success", t("profile_view.field_saved"));
- if (opts?.clearDraft) setDraft("");
- if (opts?.keepOpen) inputRef.current?.focus();
- else cancel();
- },
- },
- );
- };
-
- const saveScalar = () => {
- const v = draft.trim();
- if (v) mutate("set", v);
- else mutate("clear");
- };
- const addItem = () => {
- const v = draft.trim();
- if (v) mutate("append", v, { keepOpen: true, clearDraft: true });
- };
-
- // ------------------------------------------------------------------ resting
- if (!editing) {
- return (
- <div className="group -mx-2 flex min-h-10 items-center justify-between gap-4 rounded-md px-2 py-1 transition-colors hover:bg-secondary">
- <dt className="shrink-0 text-base text-muted-foreground">{label}</dt>
- <dd className="flex min-w-0 items-center justify-end gap-2">
- {kind === "list" && !empty ? (
- <div className="flex min-w-0 flex-wrap justify-end gap-1">
- {(value as unknown[]).map((item) => (
- <Badge key={String(item)} variant="secondary" className="text-foreground">
- {String(item)}
- </Badge>
- ))}
- </div>
- ) : empty ? (
- <span className="text-base text-foreground-faint">
- {t("profile_view.field_unknown")}
- </span>
- ) : (
- <span className="text-base text-foreground [overflow-wrap:anywhere]">
- {renderValue(t, value)}
- </span>
- )}
- <Button
- type="button"
- variant="ghost"
- size="icon"
- onClick={startEdit}
- title={t("profile_view.field_edit")}
- aria-label={`${t("profile_view.field_edit")}: ${label}`}
- className="h-8 w-8 shrink-0 text-muted-foreground opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100"
- >
- {empty ? <Plus /> : <Pencil />}
- </Button>
- </dd>
- </div>
- );
- }
-
- // ------------------------------------------------------------------ editing
- return (
- <div className="-mx-2 rounded-md bg-secondary px-2 py-2">
- <dt className="text-base font-medium text-foreground-strong">{label}</dt>
- <dd className="mt-2">
- {kind === "bool" ? (
- <div className="flex flex-wrap items-center gap-2">
- {([true, false] as const).map((b) => (
- <Button
- key={String(b)}
- type="button"
- size="sm"
- variant={value === b ? "default" : "outline"}
- disabled={busy}
- onClick={() => mutate("set", b)}
- >
- {b ? t("profile_view.value_yes") : t("profile_view.value_no")}
- </Button>
- ))}
- <span className="ml-auto flex items-center gap-1">
- <RowIconButton
- icon={X}
- onClick={cancel}
- title={t("profile_view.raw_cancel")}
- disabled={busy}
- />
- {!empty && (
- <RowIconButton
- icon={Trash2}
- onClick={() => mutate("clear")}
- title={t("profile_view.field_clear")}
- disabled={busy}
- />
- )}
- </span>
- </div>
- ) : kind === "list" ? (
- <div className="flex flex-col gap-2">
- {!empty && (
- <div className="flex flex-wrap gap-1">
- {(value as unknown[]).map((item) => (
- <Badge key={String(item)} variant="outline" className="pr-1 text-foreground">
- {String(item)}
- <button
- type="button"
- disabled={busy}
- onClick={() => mutate("remove", String(item), { keepOpen: true })}
- title={t("profile_view.field_remove_item")}
- aria-label={`${t("profile_view.field_remove_item")}: ${String(item)}`}
- className="rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
- >
- <X aria-hidden className="h-3 w-3" />
- </button>
- </Badge>
- ))}
- </div>
- )}
- <div className="flex items-center gap-1">
- <Input
- ref={inputRef}
- value={draft}
- disabled={busy}
- onChange={(e) => setDraft(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === "Enter") addItem();
- if (e.key === "Escape") cancel();
- }}
- placeholder={t("profile_view.field_add_placeholder")}
- className="h-8"
- />
- <RowIconButton
- icon={Plus}
- onClick={addItem}
- title={t("profile_view.field_add")}
- variant="default"
- disabled={busy}
- />
- <RowIconButton
- icon={Check}
- onClick={cancel}
- title={t("profile_view.raw_save")}
- disabled={busy}
- />
- {!empty && (
- <RowIconButton
- icon={Trash2}
- onClick={() => mutate("clear")}
- title={t("profile_view.field_clear")}
- disabled={busy}
- />
- )}
- </div>
- </div>
- ) : (
- <div className="flex items-center gap-1">
- <Input
- ref={inputRef}
- value={draft}
- disabled={busy}
- onChange={(e) => setDraft(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === "Enter") saveScalar();
- if (e.key === "Escape") cancel();
- }}
- placeholder={t("profile_view.field_value_placeholder")}
- className="h-8"
- />
- <RowIconButton
- icon={Check}
- onClick={saveScalar}
- title={t("profile_view.raw_save")}
- variant="default"
- disabled={busy}
- />
- <RowIconButton
- icon={X}
- onClick={cancel}
- title={t("profile_view.raw_cancel")}
- disabled={busy}
- />
- {!empty && (
- <RowIconButton
- icon={Trash2}
- onClick={() => mutate("clear")}
- title={t("profile_view.field_clear")}
- disabled={busy}
- />
- )}
- </div>
- )}
- </dd>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/views/profile/NeverStoredCard.tsx b/jarvis/ui/web/frontend/src/views/profile/NeverStoredCard.tsx
new file mode 100644
index 0000000000..99649171a7
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/NeverStoredCard.tsx
@@ -0,0 +1,50 @@
+/**
+ * The categories the assistant refuses to hold.
+ *
+ * A file about a person is only trustworthy if it says what it will not
+ * contain, and this one does — `## Do Not Record` has been in USER.md from
+ * the beginning, enforced by `_DO_NOT_RECORD` in
+ * `jarvis/plugins/tool/profile_update.py`, and shown to the reader nowhere.
+ *
+ * Quoted from the file rather than restated in code, so the page can never
+ * promise something the file no longer says. Neutral, not `fault`: a
+ * boundary the product keeps on purpose is not an error state.
+ */
+import { ShieldCheck } from "lucide-react";
+
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { useT } from "@/i18n";
+import { parseDoNotRecord, shortenCategory } from "@/views/profile/provenance";
+
+export function NeverStoredCard({ raw }: { raw: string | null | undefined }) {
+ const t = useT();
+ const categories = parseDoNotRecord(raw);
+
+ if (categories.length === 0) return null;
+
+ return (
+ <Card className="profile-rise">
+ <CardHeader className="pb-2">
+ <CardTitle className="flex items-center gap-2">
+ <ShieldCheck aria-hidden className="h-4 w-4 text-muted-foreground" />
+ {t("profile_view.never_title")}
+ </CardTitle>
+ </CardHeader>
+ <CardContent>
+ <p className="text-meta text-muted-foreground">{t("profile_view.never_body")}</p>
+ <ul data-testid="never-stored" className="mt-3 flex flex-col gap-1.5">
+ {categories.map((c) => (
+ <li
+ key={c}
+ title={c}
+ className="flex items-baseline gap-2 text-body text-foreground [overflow-wrap:anywhere]"
+ >
+ <span aria-hidden className="mt-1.5 h-1 w-1 shrink-0 rounded-full bg-muted-foreground" />
+ {shortenCategory(c)}
+ </li>
+ ))}
+ </ul>
+ </CardContent>
+ </Card>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/PeopleCard.tsx b/jarvis/ui/web/frontend/src/views/profile/PeopleCard.tsx
deleted file mode 100644
index 8fe6d668d5..0000000000
--- a/jarvis/ui/web/frontend/src/views/profile/PeopleCard.tsx
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * The people the curator has written a file for.
- *
- * A side-by-side list and detail pane does not fit a 340 px rail, so the
- * detail opens inside the row instead. One click selects AND expands — the
- * row-click doctrine the rest of the app follows, with the selected row
- * carrying the accent bar every selected row in this product wears.
- */
-import { useState } from "react";
-import { ChevronDown, Inbox, Users } from "lucide-react";
-
-import { Badge } from "@/components/ui/badge";
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-import { EmptyState } from "@/components/ui/empty-state";
-import { IdentityAvatar } from "@/components/identity/IdentityAvatar";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-import type { PersonSummary } from "@/views/profile/api";
-
-export function PeopleCard({ people }: { people: PersonSummary[] }) {
- const t = useT();
- const [openSlug, setOpenSlug] = useState<string | null>(null);
-
- return (
- <Card className="flex flex-col">
- <CardHeader className="flex-row items-center justify-between gap-3 pb-2">
- <CardTitle className="truncate">{t("profile_view.section_people")}</CardTitle>
- {people.length > 0 && (
- <Badge variant="secondary" className="shrink-0 tabular-nums">
- {people.length}
- </Badge>
- )}
- </CardHeader>
-
- <CardContent>
- {people.length === 0 ? (
- <EmptyState
- className="max-w-none py-6"
- icon={<Users />}
- title={t("profile_view.people_empty_title")}
- description={t("profile_view.people_empty_body")}
- />
- ) : (
- <ul className="flex flex-col">
- {people.map((p) => (
- <PersonRow
- key={p.slug}
- person={p}
- open={p.slug === openSlug}
- onToggle={() => setOpenSlug(p.slug === openSlug ? null : p.slug)}
- />
- ))}
- </ul>
- )}
- </CardContent>
- </Card>
- );
-}
-
-function PersonRow({
- person,
- open,
- onToggle,
-}: {
- person: PersonSummary;
- open: boolean;
- onToggle: () => void;
-}) {
- const t = useT();
-
- return (
- <li>
- <button
- type="button"
- onClick={onToggle}
- aria-expanded={open}
- className={cn(
- "-mx-2 flex w-[calc(100%+1rem)] items-center gap-3 rounded-md px-2 py-2 text-left transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- open ? "bg-secondary jarvis-nav-active" : "hover:bg-secondary",
- )}
- >
- <IdentityAvatar name={person.name} size="sm" />
- <span className="min-w-0 flex-1">
- <span
- className={cn(
- "block truncate text-base",
- open ? "text-foreground-strong" : "text-foreground",
- )}
- >
- {person.name}
- </span>
- <span className="block truncate text-sm text-muted-foreground">
- {person.relationship}
- </span>
- </span>
- <ChevronDown
- aria-hidden
- className={cn(
- "h-4 w-4 shrink-0 text-muted-foreground transition-transform",
- open && "rotate-180",
- )}
- />
- </button>
-
- {open && (
- <div className="py-3 pl-11 pr-1">
- <dl className="flex flex-col gap-2">
- <div className="flex items-baseline justify-between gap-3">
- <dt className="shrink-0 text-base text-muted-foreground">
- {t("profile_view.person_relationship")}
- </dt>
- <dd className="min-w-0 text-right text-base text-foreground [overflow-wrap:anywhere]">
- {person.relationship}
- </dd>
- </div>
- <div className="flex items-baseline justify-between gap-3">
- <dt className="shrink-0 text-base text-muted-foreground">
- {t("profile_view.person_aliases")}
- </dt>
- <dd className="min-w-0 text-right [overflow-wrap:anywhere]">
- {person.aliases.length === 0 ? (
- <span className="text-base text-foreground-faint">
- {t("profile_view.person_no_aliases")}
- </span>
- ) : (
- <span className="text-base text-foreground">{person.aliases.join(" · ")}</span>
- )}
- </dd>
- </div>
- </dl>
- <p className="mt-3 flex items-start gap-2 text-sm text-muted-foreground">
- <Inbox aria-hidden className="mt-0.5 h-3.5 w-3.5 shrink-0" />
- <span className="min-w-0 [overflow-wrap:anywhere]">
- {t("profile_view.person_file_hint").replace("{0}", person.slug)}
- </span>
- </p>
- </div>
- )}
- </li>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/views/profile/PortraitCard.tsx b/jarvis/ui/web/frontend/src/views/profile/PortraitCard.tsx
new file mode 100644
index 0000000000..bfdb9db524
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/PortraitCard.tsx
@@ -0,0 +1,140 @@
+/**
+ * What the assistant would say about you if asked.
+ *
+ * `GET /api/board/bio` has held an LLM-written prose portrait of the user —
+ * generated from board statistics, awareness episodes, mission history and
+ * the memory file — since it was built, with a three-way feedback loop that
+ * calibrates the next generation. Nothing in the product rendered it. On a
+ * page whose whole subject is "what does it know about me", it is the single
+ * most direct answer available, so it opens the rail.
+ *
+ * The feedback is not a rating. It is the one signal that changes how the
+ * next portrait is written, which is why the buttons say what they do to the
+ * text rather than how the reader feels about it.
+ */
+import { Loader2, RefreshCw, Sparkles } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { useBio, useBioFeedback, useBioRegenerate, type BioFeedbackKind } from "@/hooks/useBoard";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+
+/**
+ * The three signals the backend accepts. The strings are API contract values,
+ * matched by name in `jarvis/board/profile.py` — they are not display text and
+ * never reach the screen; the labels beside them come from the locale.
+ */
+const FEEDBACK: { kind: BioFeedbackKind; labelKey: string }[] = [
+ { kind: "trifft", labelKey: "profile_view.portrait_fits" }, // i18n-allow: API contract value
+ { kind: "trifft_nicht", labelKey: "profile_view.portrait_misses" }, // i18n-allow: API contract value
+ { kind: "haerter", labelKey: "profile_view.portrait_harder" }, // i18n-allow: API contract value
+];
+
+export function PortraitCard() {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const bio = useBio();
+ const regenerate = useBioRegenerate();
+ const feedback = useBioFeedback();
+
+ const text = bio.data?.text?.trim() || null;
+ const generatedAt = bio.data?.generated_at ?? null;
+
+ const sendFeedback = (kind: BioFeedbackKind) => {
+ if (!generatedAt) return;
+ feedback.mutate(
+ { bio_generated_at: generatedAt, kind },
+ {
+ onSuccess: () => pushToast("success", t("profile_view.portrait_thanks")),
+ onError: (err: Error) => pushToast("error", err.message),
+ },
+ );
+ };
+
+ const write = () =>
+ regenerate.mutate(
+ {},
+ {
+ onSuccess: () => pushToast("success", t("profile_view.portrait_written")),
+ onError: (err: Error) => pushToast("error", err.message),
+ },
+ );
+
+ return (
+ <Card className="profile-rise">
+ <CardHeader className="flex-row items-center justify-between gap-3 pb-2">
+ <CardTitle className="flex items-center gap-2">
+ <Sparkles aria-hidden className="h-4 w-4 text-muted-foreground" />
+ {t("profile_view.portrait_title")}
+ </CardTitle>
+ {text && (
+ <Button
+ type="button"
+ size="icon"
+ variant="ghost"
+ className="h-8 w-8 text-muted-foreground"
+ onClick={write}
+ disabled={regenerate.isPending}
+ title={t("profile_view.portrait_rewrite")}
+ aria-label={t("profile_view.portrait_rewrite")}
+ >
+ {regenerate.isPending ? <Loader2 className="animate-spin" /> : <RefreshCw />}
+ </Button>
+ )}
+ </CardHeader>
+
+ <CardContent>
+ {bio.isLoading ? (
+ <div role="status" aria-busy="true" className="flex flex-col gap-2">
+ <div className="h-3 w-full animate-pulse rounded-full bg-sheen/[0.06]" />
+ <div className="h-3 w-11/12 animate-pulse rounded-full bg-sheen/[0.06]" />
+ <div className="h-3 w-4/6 animate-pulse rounded-full bg-sheen/[0.06]" />
+ </div>
+ ) : text ? (
+ <>
+ <p
+ data-testid="portrait-text"
+ className="text-reading text-foreground [overflow-wrap:anywhere]"
+ >
+ {text}
+ </p>
+ <div className="mt-4 flex flex-wrap gap-2">
+ {FEEDBACK.map((f) => (
+ <Button
+ key={f.kind}
+ type="button"
+ size="sm"
+ variant="outline"
+ disabled={feedback.isPending || !generatedAt}
+ onClick={() => sendFeedback(f.kind)}
+ >
+ {t(f.labelKey)}
+ </Button>
+ ))}
+ </div>
+ </>
+ ) : (
+ // Not a failure: the portrait is written on demand and this box has
+ // never been asked. So it asks.
+ <div data-testid="portrait-empty">
+ <p className="text-body text-muted-foreground">
+ {t("profile_view.portrait_empty_body")}
+ </p>
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ className="mt-3"
+ onClick={write}
+ disabled={regenerate.isPending}
+ >
+ {regenerate.isPending ? <Loader2 className="animate-spin" /> : <Sparkles />}
+ {t("profile_view.portrait_write")}
+ </Button>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ReviewsCard.tsx b/jarvis/ui/web/frontend/src/views/profile/ReviewsCard.tsx
deleted file mode 100644
index 7405950074..0000000000
--- a/jarvis/ui/web/frontend/src/views/profile/ReviewsCard.tsx
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * The review queue — observations the curator is not confident enough to write
- * on its own.
- *
- * The one contract that must never regress: `GET /api/profile/reviews` answers
- * 503 when the legacy curator is soft-disabled, which is a DESIGNED state, not
- * a fault. It renders as a calm explanation; only a real failure gets the
- * destructive treatment. Both branches are pinned by ProfileView.test.tsx.
- */
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { AlertTriangle, Check, ChevronRight, RefreshCw, ShieldQuestion, X } from "lucide-react";
-
-import { Badge } from "@/components/ui/badge";
-import { Button } from "@/components/ui/button";
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-import { EmptyState } from "@/components/ui/empty-state";
-import { IdentityAvatar } from "@/components/identity/IdentityAvatar";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-import { useEventStore } from "@/store/events";
-import {
- fetchJson,
- renderValue,
- statusOf,
- type ReviewCandidate,
- type ReviewsResponse,
-} from "@/views/profile/api";
-
-export function ReviewsCard({ reviewsCount }: { reviewsCount: number }) {
- const t = useT();
- const queryClient = useQueryClient();
- const pushToast = useEventStore((s) => s.pushToast);
-
- const { data, isLoading, error, refetch, isRefetching } = useQuery<ReviewsResponse, Error>({
- queryKey: ["profile", "reviews"],
- queryFn: () => fetchJson<ReviewsResponse>("/api/profile/reviews"),
- retry: false,
- });
-
- const accept = useMutation({
- mutationFn: (idx: number) =>
- fetchJson<{ ok: boolean; applied: number }>(`/api/profile/reviews/${idx}/accept`, {
- method: "POST",
- }),
- onSuccess: (res) => {
- pushToast(
- "success",
- res.applied > 0
- ? t("profile_toast.fact_applied").replace("{0}", String(res.applied))
- : t("profile_view.accepted"),
- );
- queryClient.invalidateQueries({ queryKey: ["profile"] });
- queryClient.invalidateQueries({ queryKey: ["profile", "reviews"] });
- },
- onError: (err: Error) => pushToast("error", err.message),
- });
-
- const reject = useMutation({
- mutationFn: (idx: number) =>
- fetchJson<{ ok: boolean }>(`/api/profile/reviews/${idx}/reject`, { method: "POST" }),
- onSuccess: () => {
- pushToast("info", t("profile_view.reject_tooltip"));
- queryClient.invalidateQueries({ queryKey: ["profile"] });
- queryClient.invalidateQueries({ queryKey: ["profile", "reviews"] });
- },
- onError: (err: Error) => pushToast("error", err.message),
- });
-
- const pendingIdx: number | null = accept.isPending
- ? (accept.variables ?? null)
- : reject.isPending
- ? (reject.variables ?? null)
- : null;
-
- const items = data?.reviews ?? [];
-
- return (
- <Card className="flex flex-col">
- <CardHeader className="flex-row items-center justify-between gap-3 pb-2">
- <span className="flex min-w-0 items-center gap-2">
- <CardTitle className="truncate">{t("profile_view.section_reviews")}</CardTitle>
- {reviewsCount > 0 && (
- <Badge variant="accent" className="shrink-0 tabular-nums">
- {reviewsCount}
- </Badge>
- )}
- </span>
- <Button
- type="button"
- variant="ghost"
- size="icon"
- className="h-8 w-8 shrink-0 text-muted-foreground"
- onClick={() => refetch()}
- disabled={isRefetching}
- title={t("profile_view.reload_tooltip")}
- aria-label={t("profile_view.reload_tooltip")}
- >
- <RefreshCw className={cn(isRefetching && "animate-spin")} />
- </Button>
- </CardHeader>
-
- <CardContent>
- {isLoading && (
- <div className="flex flex-col gap-3" aria-hidden>
- {[0, 1].map((i) => (
- <div key={i} className="flex flex-col gap-2">
- <div className="h-3 w-4/5 animate-pulse rounded-full bg-secondary" />
- <div className="h-3 w-2/5 animate-pulse rounded-full bg-secondary" />
- <div className="h-8 animate-pulse rounded-md bg-secondary" />
- </div>
- ))}
- </div>
- )}
-
- {error &&
- (statusOf(error) === 503 ? (
- // The curator is intentionally not running in this session. An
- // expected state, so it reads as an explanation, not an alarm.
- <div data-testid="reviews-disabled">
- <EmptyState
- className="max-w-none py-6"
- icon={<ShieldQuestion />}
- title={t("profile_view.reviews_disabled_title")}
- description={t("profile_view.reviews_disabled_body")}
- />
- </div>
- ) : (
- <p
- data-testid="reviews-error"
- className="flex items-start gap-2 rounded-md border border-destructive/20 bg-destructive/[0.12] p-3 text-base text-destructive"
- >
- <AlertTriangle aria-hidden className="mt-0.5 h-4 w-4 shrink-0" />
- <span className="min-w-0 [overflow-wrap:anywhere]">{error.message}</span>
- </p>
- ))}
-
- {data && items.length === 0 && (
- <EmptyState
- className="max-w-none py-6"
- icon={<ShieldQuestion />}
- title={t("profile_view.reviews_empty_title")}
- description={t("profile_view.reviews_empty_body")}
- />
- )}
-
- {items.length > 0 && (
- <ul className="flex flex-col">
- {items.map((c, i) => (
- <ReviewRow
- key={c.idx}
- candidate={c}
- first={i === 0}
- pending={pendingIdx === c.idx}
- onAccept={() => accept.mutate(c.idx)}
- onReject={() => reject.mutate(c.idx)}
- />
- ))}
- </ul>
- )}
- </CardContent>
- </Card>
- );
-}
-
-/**
- * One candidate. The evidence quote leads, because that is the sentence the
- * user actually said and the only thing they can judge the claim by; the
- * cluster → field path and the two verdicts sit under it.
- */
-function ReviewRow({
- candidate,
- first,
- pending,
- onAccept,
- onReject,
-}: {
- candidate: ReviewCandidate;
- first: boolean;
- pending: boolean;
- onAccept: () => void;
- onReject: () => void;
-}) {
- const t = useT();
- // Who the observation is about — the coloured mark tells "about you" from
- // "about Anna" without reading the line.
- const subject = candidate.is_person
- ? (candidate.person_name ?? t("profile_view.review_subject_user"))
- : t("profile_view.review_subject_user");
-
- return (
- <li className={cn("py-4", !first && "border-t border-border")}>
- <div className="flex items-center gap-2">
- <IdentityAvatar name={subject} size="sm" />
- <span className="min-w-0 flex-1 truncate text-base text-foreground">{subject}</span>
- <span className="shrink-0 text-sm tabular-nums text-muted-foreground">
- {(candidate.confidence * 100).toFixed(0)}%
- </span>
- </div>
-
- {candidate.evidence && (
- <blockquote className="mt-3 border-l-2 border-border pl-3 text-base text-muted-foreground">
- “{candidate.evidence}”
- </blockquote>
- )}
-
- <div className="mt-3 flex flex-wrap items-center gap-1.5 text-sm text-muted-foreground">
- <span>{candidate.cluster}</span>
- <ChevronRight aria-hidden className="h-3 w-3" />
- <span className="text-foreground">{candidate.field}</span>
- <Badge variant="outline">{candidate.operation}</Badge>
- </div>
-
- <p className="mt-2 text-base">
- <span className="text-muted-foreground">{t("profile_view.review_value")}: </span>
- <span className="text-foreground [overflow-wrap:anywhere]">
- {renderValue(t, candidate.value) || t("profile_view.field_unknown")}
- </span>
- </p>
-
- {candidate.reason && (
- <p className="mt-1 text-sm text-muted-foreground">
- {t("profile_view.review_reason")}: {candidate.reason}
- </p>
- )}
-
- <div className="mt-3 flex gap-2">
- <Button
- size="sm"
- variant="default"
- className="flex-1"
- disabled={pending}
- onClick={onAccept}
- title={t("profile_view.accept_tooltip")}
- >
- <Check />
- {t("profile_view.review_confirm")}
- </Button>
- <Button
- size="sm"
- variant="outline"
- className="flex-1"
- disabled={pending}
- onClick={onReject}
- title={t("profile_view.reject_tooltip")}
- >
- <X />
- {t("profile_view.review_strike")}
- </Button>
- </div>
- </li>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/views/profile/RulesCard.tsx b/jarvis/ui/web/frontend/src/views/profile/RulesCard.tsx
new file mode 100644
index 0000000000..e4338106b3
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/RulesCard.tsx
@@ -0,0 +1,92 @@
+/**
+ * Your standing instructions to the assistant.
+ *
+ * These live in their own section and are edited there. They appear here
+ * because they belong to the same question the page answers: the profile is
+ * what the assistant worked out about you, and this is what you told it
+ * outright. Showing the first lines beside the inferred facts is the only
+ * place in the product where both halves of the record are visible at once.
+ *
+ * Read-only on purpose — one editor per file, and this file's editor is the
+ * section this card links to.
+ */
+import { ArrowRight, ScrollText } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { useAgentInstructions } from "@/hooks/useAgentInstructions";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+
+/** The opening of the file: enough to recognise, never the whole document. */
+function excerpt(content: string, maxLines = 4, maxChars = 220): string {
+ const lines = content
+ .split("\n")
+ .map((l) => l.trim())
+ .filter((l) => l && !l.startsWith("#"));
+ const head = lines.slice(0, maxLines).join(" ");
+ return head.length > maxChars ? `${head.slice(0, maxChars).trimEnd()}…` : head;
+}
+
+export function RulesCard() {
+ const t = useT();
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+ const { config, loading } = useAgentInstructions();
+
+ const content = config?.content?.trim() ?? "";
+ const has = !!config?.exists && content.length > 0;
+ const lineCount = has ? content.split("\n").filter((l) => l.trim()).length : 0;
+
+ return (
+ <Card className="profile-rise">
+ <CardHeader className="pb-2">
+ <CardTitle className="flex items-center gap-2">
+ <ScrollText aria-hidden className="h-4 w-4 text-muted-foreground" />
+ {t("profile_view.rules_title")}
+ </CardTitle>
+ </CardHeader>
+
+ <CardContent>
+ {loading ? (
+ <div role="status" aria-busy="true" className="flex flex-col gap-2">
+ <div className="h-3 w-full animate-pulse rounded-full bg-sheen/[0.06]" />
+ <div className="h-3 w-3/4 animate-pulse rounded-full bg-sheen/[0.06]" />
+ </div>
+ ) : has ? (
+ <>
+ <blockquote
+ data-testid="rules-excerpt"
+ className="border-l-2 border-border-strong pl-3 text-meta italic text-foreground [overflow-wrap:anywhere]"
+ >
+ {excerpt(content)}
+ </blockquote>
+ <Button
+ type="button"
+ variant="link"
+ className="mt-3 px-0"
+ onClick={() => setActiveSection("agent-instructions")}
+ >
+ {t("profile_view.rules_open")
+ .replace("{0}", String(lineCount))
+ .replace("{1}", config?.filename ?? "")}
+ <ArrowRight />
+ </Button>
+ </>
+ ) : (
+ <div data-testid="rules-empty">
+ <p className="text-body text-muted-foreground">{t("profile_view.rules_empty_body")}</p>
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ className="mt-3"
+ onClick={() => setActiveSection("agent-instructions")}
+ >
+ {t("profile_view.rules_write")}
+ </Button>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/WikiCard.tsx b/jarvis/ui/web/frontend/src/views/profile/WikiCard.tsx
new file mode 100644
index 0000000000..c692e6fb36
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/WikiCard.tsx
@@ -0,0 +1,131 @@
+/**
+ * The long-form page the wiki keeps about you.
+ *
+ * The profile front matter holds eighteen short fields; the vault holds a
+ * written entity page — summary, facts, relationships, and dated sources for
+ * each one — built by the wiki consolidator from actual conversations. It is
+ * by a wide margin the richest thing the system knows about the reader, and
+ * the profile section has never linked to it.
+ *
+ * Best-effort by design: the slug is derived from the user's name, so a
+ * profile with no name asks for nothing and a vault with no such page shows
+ * the invitation instead of an error. A 404 here is a state, not a fault.
+ */
+import { useQuery } from "@tanstack/react-query";
+import { ArrowRight, NotebookPen } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+
+interface WikiPage {
+ ok: boolean;
+ slug: string;
+ title: string;
+ body_md: string;
+ wikilinks: string[];
+ stats?: { words?: number };
+}
+
+/**
+ * The vault's own slug rules: lowercase, diacritics folded, everything that is
+ * not a letter or digit becomes a dash. "Renee Dubois" -> "renee-dubois".
+ */
+export function wikiSlug(name: string | null | undefined): string | null {
+ if (!name) return null;
+ const slug = name
+ .normalize("NFD")
+ .replace(/[\u0300-\u036f]/g, "") // combining marks, after NFD
+ .toLowerCase()
+ .replace(/[^a-z0-9]+/g, "-")
+ .replace(/^-+|-+$/g, "");
+ return slug || null;
+}
+
+/** Bullet lines under a `## Facts` heading — what the page actually asserts. */
+function countFacts(bodyMd: string): number {
+ const at = bodyMd.search(/^##\s+Facts\s*$/im);
+ if (at < 0) return 0;
+ const after = bodyMd.slice(at);
+ const next = after.search(/\n##\s+/);
+ const section = next > 0 ? after.slice(0, next) : after;
+ return section.split("\n").filter((l) => /^-\s+\S/.test(l.trim())).length;
+}
+
+export function WikiCard({ name }: { name: string | null }) {
+ const t = useT();
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+ const slug = wikiSlug(name);
+
+ const page = useQuery<WikiPage, Error>({
+ queryKey: ["profile", "wiki-page", slug],
+ enabled: !!slug,
+ retry: false,
+ staleTime: 60_000,
+ queryFn: async () => {
+ const res = await fetch(`/api/wiki/page/${encodeURIComponent(slug as string)}`);
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ return res.json();
+ },
+ });
+
+ const found = page.data?.ok ? page.data : null;
+ const facts = found ? countFacts(found.body_md ?? "") : 0;
+
+ return (
+ <Card className="profile-rise">
+ <CardHeader className="pb-2">
+ <CardTitle className="flex items-center gap-2">
+ <NotebookPen aria-hidden className="h-4 w-4 text-muted-foreground" />
+ {t("profile_view.wiki_title")}
+ </CardTitle>
+ </CardHeader>
+
+ <CardContent>
+ {page.isLoading ? (
+ <div role="status" aria-busy="true" className="flex flex-col gap-2">
+ <div className="h-3 w-2/3 animate-pulse rounded-full bg-sheen/[0.06]" />
+ <div className="h-3 w-1/2 animate-pulse rounded-full bg-sheen/[0.06]" />
+ </div>
+ ) : found ? (
+ <>
+ <p className="font-mono text-meta text-foreground" data-testid="wiki-slug">
+ {found.slug}.md
+ </p>
+ <ul className="mt-2 flex flex-col gap-1 text-meta text-muted-foreground">
+ {facts > 0 && (
+ <li className="tabular-nums">
+ {t("profile_view.wiki_facts").replace("{0}", String(facts))}
+ </li>
+ )}
+ {found.wikilinks.length > 0 && (
+ <li className="tabular-nums">
+ {t("profile_view.wiki_links").replace("{0}", String(found.wikilinks.length))}
+ </li>
+ )}
+ {!!found.stats?.words && (
+ <li className="tabular-nums">
+ {t("profile_view.wiki_words").replace("{0}", String(found.stats.words))}
+ </li>
+ )}
+ </ul>
+ <Button
+ type="button"
+ variant="link"
+ className="mt-3 px-0"
+ onClick={() => setActiveSection("memory")}
+ >
+ {t("profile_view.wiki_open")}
+ <ArrowRight />
+ </Button>
+ </>
+ ) : (
+ <p data-testid="wiki-empty" className="text-body text-muted-foreground">
+ {slug ? t("profile_view.wiki_empty_body") : t("profile_view.wiki_needs_name")}
+ </p>
+ )}
+ </CardContent>
+ </Card>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts b/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts
index afa0c7a68f..fa564771a4 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts
+++ b/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts
@@ -8,14 +8,11 @@
import { describe, expect, it } from "vitest";
import {
- ASK_PRIORITY,
BOOL_FIELD_KEYS,
CLUSTER_FIELD_KEYS,
CLUSTER_ORDER,
LIST_FIELD_KEYS,
TOTAL_FIELDS,
- acquaintanceStage,
- collectOpenQuestions,
countFilled,
displayAddress,
fieldKind,
@@ -65,11 +62,6 @@ describe("ledger field vocabulary", () => {
expect(TOTAL_FIELDS).toBe(18);
});
- it("ASK_PRIORITY covers every field exactly once", () => {
- const all = CLUSTER_ORDER.flatMap((cid) => CLUSTER_FIELD_KEYS[cid]);
- expect([...ASK_PRIORITY].sort()).toEqual([...all].sort());
- expect(new Set(ASK_PRIORITY).size).toBe(ASK_PRIORITY.length);
- });
});
// ----------------------------------------------------------------------
@@ -153,72 +145,10 @@ describe("countFilled", () => {
// acquaintanceStage — the named relationship depth
// ----------------------------------------------------------------------
-describe("acquaintanceStage", () => {
- it("maps 0 filled to the blank-page stage", () => {
- expect(acquaintanceStage(0, 18)).toMatchObject({ index: 0, key: "blank_page" });
- });
-
- it("maps the low band to first impressions", () => {
- expect(acquaintanceStage(1, 18).key).toBe("first_impressions");
- expect(acquaintanceStage(4, 18).key).toBe("first_impressions"); // 22%
- });
-
- it("maps the quarter band to getting acquainted", () => {
- expect(acquaintanceStage(5, 18).key).toBe("getting_acquainted"); // 27.8%
- expect(acquaintanceStage(8, 18).key).toBe("getting_acquainted"); // 44.4%
- });
-
- it("maps the half band to well acquainted", () => {
- expect(acquaintanceStage(9, 18).key).toBe("well_acquainted"); // 50%
- expect(acquaintanceStage(13, 18).key).toBe("well_acquainted"); // 72.2%
- });
-
- it("maps the upper band to trusted company", () => {
- expect(acquaintanceStage(14, 18).key).toBe("trusted_company"); // 77.8%
- expect(acquaintanceStage(17, 18).key).toBe("trusted_company"); // 94.4%
- });
-
- it("reserves the final stage for a complete ledger", () => {
- expect(acquaintanceStage(18, 18)).toMatchObject({ index: 5, key: "inner_circle" });
- });
-
- it("never crashes on a zero total", () => {
- expect(acquaintanceStage(0, 0).key).toBe("blank_page");
- });
-});
-
// ----------------------------------------------------------------------
// collectOpenQuestions — what the butler asks next
// ----------------------------------------------------------------------
-describe("collectOpenQuestions", () => {
- it("returns the top priorities for a blank ledger", () => {
- const top = collectOpenQuestions(EMPTY_META, 3);
- expect(top.map((q) => q.field)).toEqual(ASK_PRIORITY.slice(0, 3));
- // Every entry knows its cluster so the UI can label it.
- for (const q of top) {
- expect(CLUSTER_FIELD_KEYS[q.cluster]).toContain(q.field);
- }
- });
-
- it("skips fields that are already inked", () => {
- const fields = collectOpenQuestions(PARTIAL_META, 5).map((q) => q.field);
- expect(fields).not.toContain("name");
- expect(fields).not.toContain("primary_language");
- expect(fields).not.toContain("languages");
- expect(fields).not.toContain("formality");
- });
-
- it("respects the limit and returns nothing for a full ledger", () => {
- expect(collectOpenQuestions(EMPTY_META, 2)).toHaveLength(2);
- expect(collectOpenQuestions(fullMeta(), 5)).toHaveLength(0);
- });
-
- it("returns all 18 open questions for a blank ledger when uncapped", () => {
- expect(collectOpenQuestions(EMPTY_META, 99)).toHaveLength(18);
- });
-});
-
// ----------------------------------------------------------------------
// displayAddress — how the headline addresses the user
// ----------------------------------------------------------------------
diff --git a/jarvis/ui/web/frontend/src/views/profile/ledger.ts b/jarvis/ui/web/frontend/src/views/profile/ledger.ts
index 7695e6b441..ed6ab7c6b8 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ledger.ts
+++ b/jarvis/ui/web/frontend/src/views/profile/ledger.ts
@@ -1,11 +1,14 @@
/**
* Ledger logic — the pure math and vocabulary behind ProfileView.
*
- * ProfileView renders Jarvis' knowledge about the user as a kept ledger:
- * named acquaintance stages instead of a bare percentage, a prioritized list
- * of "still unwritten" questions, and a generative sigil whose geometry is
- * derived from which fields are inked. Everything here is side-effect free
- * and unit-tested in ledger.test.ts; the component stays thin.
+ * The vocabulary (which fields exist, and what shape each one is), the
+ * emptiness rules, and the fill counts the sections show. Everything here is
+ * side-effect free and unit-tested in ledger.test.ts; the components stay
+ * thin.
+ *
+ * The acquaintance stages and the prioritised question queue were removed
+ * with the ask card: the page states facts and folds gaps now, so a named
+ * stage ("First impressions") was a score standing where a fact belongs.
*/
export type ClusterId =
@@ -78,36 +81,6 @@ export const TOTAL_FIELDS: number = CLUSTER_ORDER.reduce(
0,
);
-/** The order in which the butler would ask — most identity-anchoring first. */
-export const ASK_PRIORITY: string[] = [
- "name",
- "preferred_address",
- "primary_language",
- "directness",
- "humor_types",
- "focus_mode",
- "top_values",
- "feedback_pref",
- "formality",
- "verbosity",
- "emoji_ok",
- "languages",
- "timezone",
- "planning_horizon",
- "pet_peeves",
- "motivations",
- "pronouns",
- "devices",
-];
-
-const FIELD_CLUSTER: Record<string, ClusterId> = (() => {
- const map: Record<string, ClusterId> = {};
- for (const cid of CLUSTER_ORDER) {
- for (const key of CLUSTER_FIELD_KEYS[cid]) map[key] = cid;
- }
- return map;
-})();
-
// ----------------------------------------------------------------------
// Emptiness + fill counting
// ----------------------------------------------------------------------
@@ -154,57 +127,6 @@ export function clusterFilledCount(
return filled;
}
-// ----------------------------------------------------------------------
-// Acquaintance stages — relationship depth with a name, not a bare percent
-// ----------------------------------------------------------------------
-
-export interface StageInfo {
- index: 0 | 1 | 2 | 3 | 4 | 5;
- /** i18n suffix under profile_view.stages.* */
- key:
- | "blank_page"
- | "first_impressions"
- | "getting_acquainted"
- | "well_acquainted"
- | "trusted_company"
- | "inner_circle";
-}
-
-export function acquaintanceStage(filled: number, total: number): StageInfo {
- if (total <= 0 || filled <= 0) return { index: 0, key: "blank_page" };
- const pct = (filled / total) * 100;
- if (pct >= 100) return { index: 5, key: "inner_circle" };
- if (pct >= 75) return { index: 4, key: "trusted_company" };
- if (pct >= 50) return { index: 3, key: "well_acquainted" };
- if (pct >= 25) return { index: 2, key: "getting_acquainted" };
- return { index: 1, key: "first_impressions" };
-}
-
-// ----------------------------------------------------------------------
-// Open questions — what the butler asks next
-// ----------------------------------------------------------------------
-
-export interface OpenQuestion {
- cluster: ClusterId;
- field: string;
-}
-
-export function collectOpenQuestions(
- meta: Record<string, unknown>,
- limit: number,
-): OpenQuestion[] {
- const open: OpenQuestion[] = [];
- for (const field of ASK_PRIORITY) {
- if (open.length >= limit) break;
- const cluster = FIELD_CLUSTER[field];
- if (!cluster) continue;
- if (isEmptyValue(clusterData(meta, cluster)[field])) {
- open.push({ cluster, field });
- }
- }
- return open;
-}
-
// ----------------------------------------------------------------------
// displayAddress — how the page addresses the user
// ----------------------------------------------------------------------
diff --git a/jarvis/ui/web/frontend/src/views/profile/provenance.test.ts b/jarvis/ui/web/frontend/src/views/profile/provenance.test.ts
new file mode 100644
index 0000000000..e912fcd18c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/provenance.test.ts
@@ -0,0 +1,142 @@
+import { describe, expect, it } from "vitest";
+
+import {
+ historyFor,
+ latestFor,
+ parseDoNotRecord,
+ parseObservations,
+ shortenCategory,
+} from "@/views/profile/provenance";
+
+const FILE = `---
+schema_version: 3
+identity:
+ name: Ruben
+---
+
+# About the user
+
+## Observations over time
+
+_Jarvis appends here when it learns something new. Format: \`[YYYY-MM-DD] <field>: <value> — "<evidence quote>"\`._
+
+<!-- curator:observations:start -->
+- [2026-08-29] identity.primary_language: de — "always answer me in German"
+- [2026-08-29] identity.timezone: Europe/Berlin — "I am in Berlin"
+- [2026-09-01] identity.primary_language: de — "manual edit via profile UI"
+- [2026-09-02] values.top_values: clarity — "I like things clear"
+- [2026-09-02] note: something free-form the merger wrote
+<!-- curator:observations:end -->
+
+## Do Not Record
+
+_Jarvis deliberately does NOT store any of the following categories:_
+
+- Political or religious beliefs (echo-chamber risk)
+- Health or mental-health diagnoses (GDPR Art. 9, breach of trust)
+- Relationship conflicts as triggers for later quotes
+- MBTI type or similar pseudo-scientific labels
+`;
+
+describe("parseObservations", () => {
+ it("reads date, cluster, field, value and evidence", () => {
+ const obs = parseObservations(FILE);
+ expect(obs[0]).toEqual({
+ date: "2026-08-29",
+ cluster: "identity",
+ field: "primary_language",
+ value: "de",
+ evidence: "always answer me in German",
+ });
+ });
+
+ it("skips lines whose label is not cluster.field", () => {
+ const obs = parseObservations(FILE);
+ expect(obs).toHaveLength(4);
+ expect(obs.some((o) => o.field === "note")).toBe(false);
+ });
+
+ it("ignores the Format: example in the section's own prose", () => {
+ // The prose sits ABOVE the start marker, so scoping to the markers is what
+ // keeps "<field>: <value>" from parsing as a fact.
+ const obs = parseObservations(FILE);
+ expect(obs.every((o) => o.date.startsWith("2026-"))).toBe(true);
+ });
+
+ it("parses a file with no curator markers at all", () => {
+ const obs = parseObservations('- [2026-01-02] values.motivations: building — "I like building"');
+ expect(obs).toHaveLength(1);
+ expect(obs[0].value).toBe("building");
+ });
+
+ it("accepts a line with no evidence quote", () => {
+ const obs = parseObservations("- [2026-01-02] work_style.focus_mode: deep-work");
+ expect(obs[0]).toMatchObject({ value: "deep-work", evidence: "" });
+ });
+
+ it("keeps an em dash that belongs to the value", () => {
+ const obs = parseObservations('- [2026-01-02] values.pet_peeves: Noise — Chaos — "too loud"');
+ expect(obs[0].value).toBe("Noise — Chaos");
+ expect(obs[0].evidence).toBe("too loud");
+ });
+
+ it("returns nothing for empty input", () => {
+ expect(parseObservations("")).toEqual([]);
+ expect(parseObservations(null)).toEqual([]);
+ expect(parseObservations(undefined)).toEqual([]);
+ });
+});
+
+describe("historyFor / latestFor", () => {
+ const obs = parseObservations(FILE);
+
+ it("collects every line for one field, oldest first", () => {
+ const h = historyFor(obs, "identity", "primary_language");
+ expect(h.map((o) => o.date)).toEqual(["2026-08-29", "2026-09-01"]);
+ });
+
+ it("returns the most recent line as the explanation", () => {
+ expect(latestFor(obs, "identity", "primary_language")?.date).toBe("2026-09-01");
+ });
+
+ it("returns null for a field the trail never mentions", () => {
+ expect(latestFor(obs, "identity", "pronouns")).toBeNull();
+ });
+});
+
+describe("parseDoNotRecord", () => {
+ it("reads the bullets out of the file rather than restating them", () => {
+ expect(parseDoNotRecord(FILE)).toEqual([
+ "Political or religious beliefs (echo-chamber risk)",
+ "Health or mental-health diagnoses (GDPR Art. 9, breach of trust)",
+ "Relationship conflicts as triggers for later quotes",
+ "MBTI type or similar pseudo-scientific labels",
+ ]);
+ });
+
+ it("stops at the next heading", () => {
+ const withTail = `${FILE}\n## Something else\n\n- not a category\n`;
+ expect(parseDoNotRecord(withTail)).toHaveLength(4);
+ });
+
+ it("returns nothing when the section is missing", () => {
+ expect(parseDoNotRecord("# About the user\n")).toEqual([]);
+ expect(parseDoNotRecord(null)).toEqual([]);
+ });
+});
+
+describe("shortenCategory", () => {
+ it("drops the bracketed rationale", () => {
+ expect(shortenCategory("Political or religious beliefs (echo-chamber risk)")).toBe(
+ "Political",
+ );
+ });
+
+ it("keeps a single-clause category whole", () => {
+ expect(shortenCategory("MBTI type")).toBe("MBTI type");
+ });
+
+ it("never returns an empty string", () => {
+ expect(shortenCategory("(only a reason)")).toBe("(only a reason)");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/profile/provenance.ts b/jarvis/ui/web/frontend/src/views/profile/provenance.ts
new file mode 100644
index 0000000000..f22fa9bae9
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/provenance.ts
@@ -0,0 +1,138 @@
+/**
+ * Where a fact came from — parsed out of USER.md's own audit trail.
+ *
+ * Every writer that touches the profile appends one line to the
+ * `## Observations over time` section (see
+ * `jarvis/memory/user_profile.py::append_observation`):
+ *
+ * - [YYYY-MM-DD] <cluster>.<field>: <value> — "<evidence>"
+ *
+ * That line is the answer to the only question a profile page is really
+ * asked: *how do you know that about me?* It is written by all three writers
+ * — the regex capture bridge, the `update_profile` tool and the view's own
+ * PATCH — so the trail is complete, and it has been on disk all along with
+ * nothing reading it.
+ *
+ * Parsed on the client rather than served: `GET /api/profile/raw` is already
+ * in the query cache (ProfileView holds it for the source tab), so this costs
+ * one regex pass and no round trip. Side-effect free, tested in
+ * provenance.test.ts.
+ */
+
+export interface Observation {
+ /** ISO date, exactly as written: YYYY-MM-DD. */
+ date: string;
+ cluster: string;
+ field: string;
+ /** The value as it was written that day — may since have changed. */
+ value: string;
+ /** The sentence the fact was taken from. Empty when the writer had none. */
+ evidence: string;
+}
+
+/**
+ * One observation line. The value is non-greedy so the optional evidence tail
+ * wins the em dash; a line whose label is not `<cluster>.<field>` (the free
+ * notes the curator's merger writes) is skipped rather than guessed at.
+ */
+const LINE =
+ /^-\s*\[(\d{4}-\d{2}-\d{2})\]\s+([a-z_]+)\.([a-z_]+):\s*(.*?)(?:\s+—\s+"([^"]*)")?\s*$/i;
+
+const OBSERVATIONS_START = "<!-- curator:observations:start -->";
+const OBSERVATIONS_END = "<!-- curator:observations:end -->";
+
+/**
+ * Every observation in the file, in the order it was written.
+ *
+ * Scoped to the curator's markers when they are present — the section's own
+ * prose contains a `Format:` example that would otherwise parse as a fact.
+ */
+export function parseObservations(raw: string | null | undefined): Observation[] {
+ if (!raw) return [];
+
+ const start = raw.indexOf(OBSERVATIONS_START);
+ const end = raw.indexOf(OBSERVATIONS_END);
+ const body =
+ start >= 0 && end > start ? raw.slice(start + OBSERVATIONS_START.length, end) : raw;
+
+ const out: Observation[] = [];
+ for (const line of body.split("\n")) {
+ const m = LINE.exec(line.trim());
+ if (!m) continue;
+ out.push({
+ date: m[1],
+ cluster: m[2].toLowerCase(),
+ field: m[3].toLowerCase(),
+ value: m[4].trim(),
+ evidence: (m[5] ?? "").trim(),
+ });
+ }
+ return out;
+}
+
+/** The observations for one field, oldest first. */
+export function historyFor(
+ observations: readonly Observation[],
+ cluster: string,
+ field: string,
+): Observation[] {
+ return observations.filter((o) => o.cluster === cluster && o.field === field);
+}
+
+/**
+ * The line that explains the value showing right now — the most recent one.
+ * `null` when the fact predates the audit trail (imported, or written before
+ * the observation section existed), which is why a row without provenance
+ * shows no date at all rather than an invented one.
+ */
+export function latestFor(
+ observations: readonly Observation[],
+ cluster: string,
+ field: string,
+): Observation | null {
+ const all = historyFor(observations, cluster, field);
+ return all.length ? all[all.length - 1] : null;
+}
+
+/**
+ * The categories the assistant refuses to store, read out of the file's own
+ * `## Do Not Record` section instead of being restated here.
+ *
+ * Hardcoding them would let the page promise something the backend no longer
+ * does. `_DO_NOT_RECORD` in `jarvis/plugins/tool/profile_update.py` is the
+ * enforcement; this section is its written form, and the page quotes it.
+ */
+export function parseDoNotRecord(raw: string | null | undefined): string[] {
+ if (!raw) return [];
+ const heading = raw.search(/^##\s+Do Not Record\s*$/im);
+ if (heading < 0) return [];
+
+ const after = raw.slice(heading);
+ const nextHeading = after.search(/\n##\s+/);
+ const section = nextHeading > 0 ? after.slice(0, nextHeading) : after;
+
+ const items: string[] = [];
+ for (const line of section.split("\n")) {
+ const m = /^-\s+(.*\S)\s*$/.exec(line.trim());
+ if (m) items.push(m[1]);
+ }
+ return items;
+}
+
+/**
+ * "Politics" out of "Political or religious beliefs (echo-chamber risk)".
+ *
+ * The full sentences are the promise; the chips are the glance. The rationale
+ * in brackets is what makes each line long, and it is exactly the part a chip
+ * does not need — it stays in the row's title attribute.
+ */
+export function shortenCategory(text: string): string {
+ const withoutReason = text.replace(/\s*\([^)]*\)\s*$/, "").trim();
+ // The connectives are English and German because the categories are
+ // written in whichever language the profile template shipped in.
+ const firstClause = withoutReason
+ .split(/\s+(?:or|as|und|oder)\s+/i) // i18n-allow: clause splitter, not display text
+ [0]
+ .trim();
+ return firstClause || withoutReason || text;
+}