Prompt log format and NUL fix
Follow-up to the generate-button prompt log (DONE 2026-09-27). Two problems, one pass:
NUL bytes pollute every prompt.
u:slurp(dc-eclectic) sized its character buffer byfile-length(bytes), then decoded; with UTF-8 multibyte content the undecoded tail stayed filled with NULs — 233 literal NUL characters rode every real Generate call's system prompt (plist-to-jsonescapes them as\u0000). Fixed at the source (2026-09-27):u:slurpnow trims to the decoded count. Data-ui's only obligation: reload dc-eclectic into the live image.Structure. The system prompt is two logical parts (reference
- examples) but rode as one undifferentiated blob in both the
JSON body and the org log. Part 2 now opens with a level-1
# Examplesmarkdown heading; the org log gains two level-2 children under* system-prompt(** Model Syntax Referencemarkdown block,** Examplesprose + one lisp block).
Plan: prompt-log-format-plan.org.
Summary (2026-09-28): Implemented per plan, no deviations.
lisp/model.lisp:generate-model-examples-prose(framing sentence, format-folded so no tilde residue),generate-model- example-blocks(concatenated;; ---blocks),generate-model- examples-text(part 2:# Examplesheading + prose + blocks),generate-model-system-prompt-parts(:reference / :examples);generate-model-system-promptsurvives as the joined string;generate-model-log-org/generate-model-log-prompttake the parts plist and render the two level-2 children (reference in a markdown block, prose outside + demos in one lisp block, both org-escaped — the logger regenerates prose/blocks itself so the log never depends on caller-supplied extras);generate-model- llm-callbuilds parts once, derives the joined body string, passes parts to the logger.- NUL fix verified live: dc-eclectic reloaded into the running
image (asdf force-load hit a stale-fasl compile error; plain
loadof both files worked),(count (code-char 0) (generate-model-system-prompt))→ 0. Parts lengths: reference 77,079 + examples 43,766 chars; joined length = sum + 1, no phantom bytes. - Logger smoke (temp dir): six level-1 headings, two level-2
children, both src blocks,
grep -c -P '\x00'→ 0; cleaned up. tests/generator-tests.lisp: log-write test asserts the two level-2 headings and the lisp block;carries-demosasserts# Examplesand NUL-freeness; newexamples-text-shapetest.tests/helpers.lisp: pure suite now runs inside a modelbank-test context (the log tests touch(model-name)).- Pinned demo set updated for
shopping.lisp(untracked LLM-generated demo added 2026-09-27, before this work) — flagged below. (run-generator-tests): 140/140 green.- Docs: deployment.md (log structure + NUL-fix note), hook-registry.md
and model-reference.md
:generate-modelrows.
- Slot
- 26000
- Status
- 60 Done
- Tags
- mvp, backend, ai
- Contributors
- Donnie