prompttext

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package prompttext decides what part of a recorded user turn is a prompt somebody actually typed.

It lives on its own because two places need the same answer and they must not drift: the Claude Code adapter uses it at parse time to pick which record wins a turn, and the analytics read path uses it to choose which turn to show as "the prompt that produced this commit". Restating the rule in SQL for the second would give the product two definitions of the same thing, and the symptom of a disagreement is not an error — it is a commit page confidently captioned "/model".

Pure functions over strings, no I/O. Reviewed as data, like the price table.

Index

Constants

View Source
const AppMessageLead = "Your user sent this from the baum desktop app, in place of typing it in this terminal:"

AppMessageLead is how a message the baum desktop app sends to a Claude Code session opens, so the agent knows its user sent it: Claude Code tells its model that a message on its inbox came from another session. The person typed only what follows it.

Variables

This section is empty.

Functions

func IsBoilerplate

func IsBoilerplate(text string) bool

IsBoilerplate reports whether text is only wrapper constructs, and so describes no prompt a person actually typed.

func Preview

func Preview(text string, limit int) (preview string, truncated bool)

Preview is the stripped prose, cut to limit characters.

Characters, not bytes: a byte-wise cut splits a multi-byte rune and produces a replacement character in the middle of a word. The cut also backs up to the last space when one is near enough, because a preview ending mid-word reads as corruption rather than as truncation.

func Strip

func Strip(text string) string

Strip removes the wrapper constructs, leaving the prose around them, and the lead of a message the app sent (AppMessageLead), and writes each answer to an agent's question as the question quoted, then the answer, as a reply reads.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL