Name the setting that did not come through

The instructions mark exactly two steps REQUIRED, and the two markers
sucker looks for are those two steps. So a failure can say which one is
missing — the custom prompt, the persona, or both — instead of sending
someone back to re-read a page they have already followed.

Truncation causes the same symptom, so it is still named, but second:
it only applies once the settings really are set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NX2SsmUqQftWTZAY4BDuFa
This commit is contained in:
Severian
2026-09-11 06:06:36 +08:00
parent bf74a85fec
commit a8b3669c17
3 changed files with 58 additions and 20 deletions
+7 -6
View File
@@ -9,7 +9,7 @@ import {
NO_CARD,
NO_GREETING,
TOO_FEW_MESSAGES,
TRUNCATED_CARD,
missingSetup,
userFacingMessage,
} from "@/lib/errors";
@@ -165,11 +165,12 @@ function extractCardData(messages: Message[]): ExtractedCard {
`Name extraction: user="${nameFromUser}", inferred="${inferredName}", tracking="${cleanTrackingName}", display="${displayName}"`
);
if (
!content.includes("<.>") ||
!content.includes("<UserPersona>.</UserPersona>")
) {
throw TRUNCATED_CARD;
// Each marker is one of the two REQUIRED steps in the instructions, so the
// error can name the one that did not arrive.
const hasPrompt = content.includes("<.>");
const hasPersona = content.includes("<UserPersona>.</UserPersona>");
if (!hasPrompt || !hasPersona) {
throw missingSetup(hasPrompt, hasPersona);
}
content = content.replace("<.>", "");