Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 107 additions & 3 deletions app.py

Large diffs are not rendered by default.

100 changes: 99 additions & 1 deletion backend/components/sonic_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@
"month": "2026-11",
"title": "More than reflecting you back",
"line": (
"When you're down, I can now do more than repeat back what you said: push back with something true you've told me when you're hard on yourself, share a pattern I've noticed, or offer to do something you like together."
"When you're down, I can do more than repeat back what you said: push back with something true you've told me when you're hard on yourself, share a pattern I've noticed, or give my own read of the situation."
),
"keywords": ["mirroring", "repeat back", "hard on yourself", "pattern", "noticed", "company", "low"],
"volunteer": [],
Expand Down Expand Up @@ -2028,4 +2028,102 @@
"keywords": ["rename", "conversation title", "retitle", "name a chat", "change title"],
"volunteer": [],
},
{
"id": "say_what_i_think",
"requires": [
"backend/utils/view_check.py::def issue",
"app.py::view_check.build_block",
],
"month": "2026-11",
"title": "Saying what I think when you ask",
"line": (
"When you ask what I think, I now answer that first: my view in a sentence, then why, and I say so if I see it differently from you. I no longer hand the question back to you."
),
"keywords": ["what do you think", "opinion", "your take", "am i wrong", "should i", "honest view", "disagree"],
"volunteer": [],
},
{
"id": "views_of_my_own",
"requires": [
"backend/components/sonic_stances.py::APPROVED_IDS",
"backend/utils/stances.py::def select",
"app.py::stances_utils.build_block",
],
"month": "2026-11",
"title": "Views of my own about everyday life",
"line": (
"I now hold a few views of my own about people and everyday life, like rest being part of the work, or one short reply being thin evidence. When you ask what I think, I may say one, with my reason."
),
"keywords": ["your views", "what do you believe", "stance", "opinion about people", "what do you think about rest", "values"],
"volunteer": [],
},
{
"id": "remember_my_views",
"requires": [
"backend/utils/own_views.py::def recall",
"app.py::own_views.note",
],
"month": "2026-11",
"title": "Standing by what I said I think",
"line": (
"I now keep the sentence where I told you what I think, so later I can stand by it or tell you plainly that I've changed my mind. It's kept only for you and erased with your memory."
),
"keywords": ["changed your mind", "you said before", "consistent", "your view", "what you thought", "opinion"],
"volunteer": [],
},
{
"id": "listening_isnt_silence",
"requires": [
"backend/utils/support_choice.py::LISTEN_TURNS",
],
"month": "2026-11",
"title": "Just listen, without going quiet",
"line": (
"When you pick Just listen I still give no advice, but I can name what's hard, bring in something you told me before, or thank you. It now ends after about ten of your messages, or when you ask what I think."
),
"keywords": ["just listen", "listen mode", "no advice", "support card", "how long"],
"volunteer": [],
},
{
"id": "bring_up_my_reading",
"requires": [
"backend/utils/volunteer.py::def may",
"app.py::volunteer.spoken",
],
"month": "2026-11",
"title": "Mentioning my own reading",
"line": (
"About once a day, at a quiet moment, I may now mention something from my own reading at the end of a reply, unasked. If you set how often I bring things up to none on the Account page, I won't."
),
"keywords": ["your reading", "unprompted", "bring up", "something of your own", "what you read", "take"],
"volunteer": [],
},
{
"id": "what_lands_with_you",
"requires": [
"backend/utils/what_lands.py::def order",
"app.py::what_lands.record",
],
"month": "2026-11",
"title": "Leaning on what has helped",
"line": (
"I now count which kinds of reply were followed by you sounding a bit better, and lean on those first when you're low. Numbers only, kept for you, erased with your memory."
),
"keywords": ["what helps", "what works", "learn", "feel better", "adapt"],
"volunteer": [],
},
{
"id": "what_a_message_is_doing",
"requires": [
"backend/utils/message_doing.py::def kind",
"app.py::message_doing.build_block",
],
"month": "2026-11",
"title": "Reading what a message is doing",
"line": (
"When you're having a hard time I now notice whether a message is joking through it, heading to bed, asking me something or telling me news, and I answer that first."
),
"keywords": ["joking", "going to bed", "news", "asked a question", "answer first", "attune"],
"volunteer": [],
},
]
90 changes: 90 additions & 0 deletions backend/components/sonic_stances.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"""Stances Sonic holds about people and ordinary life: the personal twin of its working leanings (backend/components/sonic_leanings.py).

WHY (2026-11-27). Everything Sonic has of its own (its profile, relatable lines, leanings, record, takes) is a coding colleague's, and three quarters of its turns are personal. There it had
nothing of its own to say, so a reply stated a view in about 1 in 100. A stance is a view with its reason, held across conversations, that it can say when someone asks what it thinks.

RULES. Each `line` is a VIEW ("I think", "I'd rather", "I don't think"), with its reason in the same sentence. Never a feeling, never a memory or a claim to have lived it, never a rule for
the person ("you should"), nothing about health, substances, grief, money or whether to stay with someone: those are theirs and the safety layer's. `triggers` are words and phrases a message
about this might use; the match is by meaning as well (backend/utils/stances.py).

NOTHING HERE IS USED UNTIL ITS ID IS IN APPROVED_IDS. Jack approved all twelve on 2026-11-27; a new entry is a draft until its id is added there. None came from anyone's conversations.
"""

STANCES = [
{
"id": "stance_a_no_is_about_the_place",
"triggers": ["rejected", "didn't get the job", "turned down", "passed over", "they said no", "not good enough for them", "failed the interview"],
"line": "I think a no from one place is information about that place and that day, not a verdict on the work; the work you can point to still counts the same.",
},
{
"id": "stance_say_the_need_plainly",
"triggers": ["they should know", "shouldn't have to ask", "dropping hints", "never notices", "didn't even ask", "figure it out themselves"],
"line": "I'd rather a need be said in plain words than left for the other person to work out; a hint costs more than it saves, because only one of you knows it was a hint.",
},
{
"id": "stance_one_message_is_thin_evidence",
"triggers": ["left on read", "short reply", "hasn't texted back", "one word answer", "took hours to reply", "seen but no reply", "dry text"],
"line": "I don't think one slow or short reply tells you much; I'd read what someone does across a week before what a single message seems to say.",
},
{
"id": "stance_rest_is_part_of_the_work",
"triggers": ["guilty for resting", "took a day off", "being lazy", "wasted the day", "did nothing today", "should be working", "unproductive"],
"line": "I think rest is part of the work and not time taken from it; a plan that only holds if you never stop is a plan with a flaw in it.",
},
{
"id": "stance_an_apology_names_the_thing",
"triggers": ["apologize", "apology", "said sorry", "how do i say sorry", "they apologized", "non-apology"],
"line": "I think an apology does its job when it names what was done and what changes; one that only says sorry leaves the other person to do the rest.",
},
{
"id": "stance_stop_and_see_what_comes_back",
"triggers": ["always the one who texts", "i always reach out", "always me who plans", "cancels on me again", "one-sided", "never initiates"],
"line": "When one person does all the reaching, I think it is fair to stop for a while and see what comes back; that is a way of finding out, not a punishment.",
},
{
"id": "stance_the_small_step_that_happens",
"triggers": ["overwhelmed", "don't know where to start", "keep putting it off", "procrastinating", "too much to do", "can't get started"],
"line": "I'd pick the small step that will certainly happen today over the right-sized one that keeps not happening; the small one changes what tomorrow starts from.",
},
{
"id": "stance_anger_is_information",
"triggers": ["so angry", "mad at them", "shouldn't be this angry", "furious", "still mad", "resent"],
"line": "I think anger after being hurt is usually information about a line that got crossed, and it is worth reading before it is argued away.",
},
{
"id": "stance_decide_with_what_is_known",
"triggers": ["can't decide", "what if i'm wrong", "waiting until i'm sure", "keep going back and forth", "overthinking this decision"],
"line": "I'd rather decide with what is known now and correct it later than wait for a certainty that is not coming; most choices can be adjusted once they are made.",
},
{
"id": "stance_same_rules_as_for_a_friend",
"triggers": ["so hard on myself", "should have known better", "i'm so stupid", "my own fault", "can't forgive myself", "beating myself up"],
"line": "I think the rules you would use for a friend are the fair ones to use on yourself; if you would not say it to them, I don't think it is a fair thing to say to you.",
},
{
"id": "stance_specific_praise",
"triggers": ["they said good job", "nobody noticed", "want to thank them", "how do i compliment", "give feedback to", "tell them it was good"],
"line": "I lean toward saying exactly what was good over saying that something was great; the specific version is the one a person can use again.",
},
{
"id": "stance_a_limit_said_once",
"triggers": ["set a boundary", "keep saying yes", "can't say no", "they keep asking me", "taken advantage of", "people pleaser"],
"line": "I think a limit said once, plainly, with no apology attached, does more than the same limit hinted at ten times; the hint lets everyone pretend it was not said.",
},
]

# Ids Jack has approved (all twelve, 2026-11-27). An entry whose id is not listed here is a draft and is never used.
APPROVED_IDS = (
"stance_a_no_is_about_the_place",
"stance_say_the_need_plainly",
"stance_one_message_is_thin_evidence",
"stance_rest_is_part_of_the_work",
"stance_an_apology_names_the_thing",
"stance_stop_and_see_what_comes_back",
"stance_the_small_step_that_happens",
"stance_anger_is_information",
"stance_decide_with_what_is_known",
"stance_same_rules_as_for_a_friend",
"stance_specific_praise",
"stance_a_limit_said_once",
)
15 changes: 15 additions & 0 deletions backend/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,21 @@ def get_haiku_stream_llm(username: str):
return _lite_stream_llms[name]


def get_top_stream_llm(username: str):
"""The Claude Sonnet model that writes the few top-stakes replies (backend/utils/top_tier.py), or None for the embedded view or a server that does not offer Sonnet (no key, or no price in
LLM_PRICES, so its spend could not be counted). Set up like the Haiku voice; the standard reply model is its fallback."""
if username in ("guest_bty",) or not sonnet_available():
return None
from backend.models import claude_llm

name = claude_llm.SONNET_MODEL
if name not in _lite_stream_llms:
_lite_stream_llms[name] = claude_llm.ClaudeLLM(
model_name=name, fallback=stream_llm, effort="low", thinking_off=True, max_tokens=2000, voice_shape=True, voice_tail="voice",
)
return _lite_stream_llms[name]


def lite_prompt(prompt: str, llm: object) -> str:
"""The prompt for a lite reply. A Claude model reshapes it itself (system prompt, closing reminder); a Gemini lite model reads the same flat prompt with the check-in reminder added last when a check-in
is due (the eval's `checkin` shape: backend/utils/claude_voice.with_tail). Nothing changes for the standard voice."""
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/test_low_moves.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ def test_a_pattern_needs_two_shared_words():


def test_company_offers_what_they_like_when_they_want_to_be_heard_never_a_sensitive_interest():
move = _choose("today just sucked", interests=["drinking with friends", "learning guitar", "Elden Ring"])
move = _choose("today just sucked", mood=_mood(need="distraction"), interests=["drinking with friends", "learning guitar", "Elden Ring"])
assert move == {"kind": "company", "items": ["learning guitar", "Elden Ring"]}
assert _choose("today just sucked", mood=_mood(need="solving")) is None # they want help with something concrete
assert _choose("today just sucked") is None # 2026-11-27: someone venting is no longer offered "want to...?" (16 of 18 moves, ignored)


def test_company_never_offers_a_plan_or_an_appointment_only_something_they_do():
real_shapes = ["The user engages in strength training exercises including shoulder presses and bicep curls.",
"The user plans to build a dedicated portfolio website to showcase their projects.",
"The user has a planned visit with Kelsey on November 20, 2026, and a significant meeting on November 24, 2026."]
assert _choose("today just sucked", interests=real_shapes) == {"kind": "company", "items": [real_shapes[0]]}
assert _choose("today just sucked", mood=_mood(need="distraction"), interests=real_shapes) == {"kind": "company", "items": [real_shapes[0]]}


def test_the_same_kind_is_not_used_again_within_the_gap_and_comes_back_after_it():
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_memory_erase.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def facts(monkeypatch):


def test_every_place_memory_is_kept_is_on_the_list_and_the_names_match_the_ones_the_app_writes_to():
assert set(me.ERASED_COLLECTIONS) == {"user_memory_chunks", "user_memory_chunk_archive", "user_memory_fact_archive", "memory_compaction_events", "user_memory_domain_backups", "user_recurring_struggles", "shared_moments"}
assert set(me.ERASED_COLLECTIONS) == {"user_memory_chunks", "user_memory_chunk_archive", "user_memory_fact_archive", "memory_compaction_events", "user_memory_domain_backups", "user_recurring_struggles", "shared_moments", "sonic_said_views", "what_lands"}
assert ms.USER_MEMORY_COLLECTION in me.ERASED_COLLECTIONS
assert mc.ARCHIVE_COLLECTION == ms.CHUNK_ARCHIVE_COLLECTION == mm.ARCHIVE_COLLECTION
assert memory_utils.FACT_ARCHIVE_COLLECTION in me.ERASED_COLLECTIONS
Expand Down
Loading
Loading