Skip to content

feat(kernel): SentenceBuffer for streaming text chunking #1205

@crrow

Description

@crrow

Description

Add a SentenceBuffer utility that accumulates TextDelta chunks and emits complete sentences.

struct SentenceBuffer { buf: String }

impl SentenceBuffer {
    fn push(&mut self, delta: &str) -> Vec<String>;  // returns completed sentences
    fn flush(&mut self) -> Option<String>;             // drain remaining text
}

Splits on sentence-ending punctuation: 。!?.!?\n. No async, no I/O, no TTS dependency — pure text segmentation.

This is a reusable building block for any channel that wants sentence-level streaming (Telegram voice reply, future web voice channel, etc.).

Component

kernel (core runtime)

Alternatives considered

  • Character-level chunking: produces unnatural TTS prosody.
  • Full-response chunking: high latency (current behavior).
  • Sentence boundary is the information-theoretic lower bound for natural-sounding TTS chunks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:claudeOperations performed by ClaudecoreCore system changesenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions