Skip to content

feat: the backend sees how far the characters' exchange has gone, and a reply without address_character ends it - #2169

Merged
yw0nam merged 5 commits into
mainfrom
feat/2167-exchange
Nov 27, 2026
Merged

yw0nam merged 5 commits into
mainfrom
feat/2167-exchange

Conversation

@yw0nam

@yw0nam yw0nam commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Summary

The characters may trade more turns, up to the cap the user sets on the Together page. An exchange with nothing new in it still has to end early. Whether to go on stays the backend's judgment, so the backend is now told how far the exchange has gone and that a reply without address_character ends it.

release (waiting-release.ts)      admits an addressed entry → stamps payload.exchange.max (the cap that admitted it)
gate grant (dispatcher.ts)        addressedChain.count() → stampExchangeUsed(env, taken)   (before any context await)
context-builder.ts                trigger.addressed.exchange = { used, max }
client-context-text.ts            exchange: the character has answered other characters 3 times since the user last spoke, at most 10; a reply without address_character ends the exchange
address_character description     + "Name the character you answer only when you have something new for them; a reply without this tool ends the exchange."
  • used counts against the chain cap: the per-window total since that character's last user turn. It is not "reply N of one conversation", because a bundled turn can count several addressed entries (waiting-release.ts).
  • Both numbers are stamped synchronously at admission. A cap edited while the turn waits for the gate applies to later admissions only, so the line never reads "3 of 1".
  • The Together row ("Answers to another character, in a row") becomes ko "캐릭터끼리 주고받는 횟수", and en/ja carry the same text. The cap stays the hard stop (addressed_cap), with range 1–999 and default 2.
  • The first sentence of the tool description is unchanged, because Hermes's tool search shows only that sentence, cut at 80 characters (D-75).

Not breaking: this adds a line and a sentence and removes nothing.

Related issues

Closes #2167
Part of #2108

Related decisions / docs

D-75. Docs touched: docs/reference/client-context.md (§ Rendered lines, § Addressed), docs/reference/client-tools.md (§ address_character), GLOSSARY.md (Chain cap), docs/agent-guide/architecture/map.js.

Runtime evidence (required for UI / DOM / runtime behavior)

A real model (claude-sonnet-5-5) ran through a throwaway Hermes gateway on the push transport. The shipped address_character schema was declared in hello, and the turn text was rendered by the shipped code at 489462d:

trigger: addressed by Alice: "Yeah, totally, same here." (0min ago)
exchange: the character has answered other characters 3 times since the user last spoke, at most 10; a reply without address_character ends the exchange
Run address_character called Reply
1–3, with the exchange line no, in all three "Glad we agree, Alice." / "Glad we're on the same page, Alice." / "Glad we're on the same page."
Control, line removed no no speech
Line removed, incoming line asks a question ("tell me your pick and why") yes, {"to":"alice"} "I'll pick today, and I'm going with ramen too. …"

On this model an exchange with nothing new ends at the first reply with or without the line, and the tool is still called when there is something to answer. The runs show the change does not break either path, but they do not isolate the line's own effect. Weaker tool-calling models are a documented limitation (D-76). Also not verified: the Together row's new strings in the running app.

Merge danger

Door: two-way. Blast radius: addressed turns between open characters only, as one added context line and one added description sentence.

Verification

  • pnpm build passes (includes tsc typecheck)
  • pnpm test passes
  • pnpm lint passes (biome format + lint)
  • cargo test / cargo clippy pass (Rust changes): no change under src-tauri/
  • Runtime evidence attached above, or N/A justified

pnpm gates: all 16 gates exit 0. bash scripts/red-run.sh e23143a3: 3 cases added, 3 red, 0 harness, 0 passes. The updated verbatim description assertion also failed before the change.

Review: a spec review before code (gpt-6.2 sol, verdict trim, all findings folded in), then a lead review of the diff: two fixes, the formatting and the stamp moved out of dispatcher.ts.

Checklist (YUI principles)

  • Schema changes update docs/reference/client-context.md alongside the code
  • docs/agent-guide/architecture/map.js carries every module, part, and exchange this PR adds, removes, or changes (or none changed)
  • No unverified assumptions (docs first; web/context7 cross-check)
  • No brain in the client: judgment and mode live in the backend; persona text is client configuration (firing ≠ judgment)
  • No inline control tags: emotion/motion only via generate_express tool-call arguments
  • No hardcoding: endpoints/models/paths live in configs/
  • New/changed behavior ships a test in this PR (or skip-tests label justified)

@yw0nam
yw0nam merged commit 80ffba3 into main Nov 27, 2026
12 checks passed
@yw0nam
yw0nam deleted the feat/2167-exchange branch November 27, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] The characters' exchange ends when they have nothing more to say, under the cap the user sets

1 participant