Log generate-button prompts to a shared directory
Each real :generate-model LLM call writes its full prompt
(system + user message) as one JSON file to
/data/k8s/data-ui/generate-log/, named
<app-name>-<record-name>-<timestamp>.json. Written at call time
on the real-call path only (tests stay silent), best-effort (a
logging failure never fails Generate), unconditional (no config
knob). /data/k8s/ placement keeps the production extension a
pure ops change (hostPath PV). Prompt content is user-data-class
(API key never rides the body).
Design agreed with Donnie 2026-09-27 (directory, filename shape, unconditional logging, origin-in-file trade-off).
Plan: generate-prompt-plan.org.
Implemented per plan (2026-09-27):
lisp/model.lisp:*generate-model-prompt-log-dir*,sanitize-name-component,generate-model-prompt-log-filename(compactdt:timestamp-stringminus separators), andgenerate-model-log-prompt(org-mode format viagenerate-model-log-org— one level-1 heading per field, the system prompt in a#+begin_src markdownblock withorg-escape-src-linescomma-escaping soC-c 'edits round-trip;ensure-directories-exist+u:spew,handler-case→pl:pdebug+ NIL — never signals).generate-model-llm-callgained arecord-nameargument and calls the logger after the override early-return, before the HTTP request;generate-model-asyncpasses(getf record :name).tests/generator-tests.lisp: unit tests forsanitize-name-component, the filename shape, andorg-escape-src-lines;generate-model-log-promptwrite test (temp dir viath-gen-temp-dir, never/data; asserts the org headings, src block, record-name/system/user, and not the API key); best-effort probe (dir under a file → NIL, no signal); override short-circuit test (integration suite; dir stays empty).(run-generator-tests): 128 checks, 0 fail.docs/hook-registry.md/docs/model-reference.md::generate-modelrows mention the prompt log.docs/deployment.mdEnvironments: new "Generate-button prompt log" subsection (shared dir, best-effort, production = hostPath PV, no env segment yet).
Notes:
- Format deviation from the plan (Donnie, same day): the log is
org-mode, not JSON — level-1 headings for the planned JSON
keys, system prompt in a markdown src block, filename
extension
.org. The escaping is load-bearing: model-reference.md's markdown bold runs (**) would otherwise read as org headings inside the block. models/shopping.lispis gone again (re-trashed after the previous session's restore; never in git). The pinned-demo-set test now pins the nine-model set without it — that pin was updated accordingly.- One JSON-format file landed in the log dir from a real staging
Generate (20260927T202447,
glm-5.3, 120 KB — the proof the JSON path worked end-to-end); it predates the org switch and is left in place. - Verification of no-stray-file behavior: default log dir gained nothing during the test run; the direct-call smoke produced a valid org file (headings, escaped src block) in a temp dir, then cleaned up.
- Out of scope per plan: environment segment (blocked on the "Instance knows its environment" item), response logging, retention, config knob.
- Slot
- 28500
- Status
- 60 Done
- Tags
- mvp, backend, ai
- Contributors
- Donnie