feat(ui): fold hidden prompt sections in chat history#407
Conversation
Add a CodeNomad-specific hidden prompt syntax for user messages so long planning and instruction blocks can stay out of the main chat flow without changing the text sent to the model. User messages now strip `<codenomad:hide>` markers before prompt submission, render hidden sections inside collapsed details blocks in the message history, and persist that display-only structure across optimistic message replacement and full app reloads. Validation: - npx tsx --test "packages/ui/src/lib/hidden-prompt-sections.test.ts" "packages/ui/src/stores/message-prompt-display.test.ts" - npm run typecheck --workspace @codenomad/ui - npm run build --workspace @codenomad/ui
|
I want you to perform the gatekeeper checks for latest PR state check for regressions |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/25568593846 Artifacts expire in 7 days. |
|
Understood request: perform gatekeeper checks for the latest PR state, looking for regressions and better implementations. Assumption: this is a review-only pass, not a request to patch the branch. Gatekeeper result: changes requested. Findings:
Additional quality notes:
Verification performed:
Oversized touched files to keep on the refactor radar:
Recommendation: do not merge until the stale override cleanup is fixed and the persistence strategy is either narrowed to metadata/ranges or explicitly accepted as storing full prompt bodies in localStorage. -- |
Use segment-length metadata instead of persisting the full original prompt body in localStorage so hidden prompt sections keep their collapsed display state without creating an extra long-lived copy of the prompt text. This also clears the persisted metadata when revert pruning removes user messages, keeping the side store aligned with message deletion paths and avoiding stale hidden-section leftovers. Validation: - npx tsx --test "packages/ui/src/lib/hidden-prompt-sections.test.ts" "packages/ui/src/stores/message-prompt-display.test.ts" - npm run typecheck --workspace @codenomad/ui - npm run build --workspace @codenomad/ui
|
Same review again please |
|
Understood request: repeat the gatekeeper review for the latest PR state. Assumption: review-only pass, no branch changes requested. Gatekeeper result: no blocking findings found in the latest state. What changed since the prior review:
Review notes:
Residual risks / suggestions, non-blocking:
Verification performed:
Oversized touched files to keep on the refactor radar:
Recommendation: acceptable to merge once CI confirms typecheck/build in a dependency-complete environment. -- |
|
@pascalandr Thanks for working on this, but not sure we should do it. It might confuse users. |
I'm not sure how it can confuse users, what do you mean ? |
I see that your are using codenomad:hide which is very explicit. My take is
|
|
Oh I see but this is not the use case here : #266 (comment) |
|
If we can do something without sending additional stuff to LLM then it could used. Maybe if needed, a codeblock with language hidden would be a better way, that way model would understand the codeblock and we can treat this codeblock specially and hide it. TBH, I see this as low value vs high effort and maintenance and not very keen on it. It all adds up in the markdown rendering logic which is a heavy computation part already. |
ok I'll keep this in mind and will go on only if the trade-off is worthwhile enough |
Summary
Fixes #266
Verification
npx tsx --test "packages/ui/src/lib/hidden-prompt-sections.test.ts" "packages/ui/src/stores/message-prompt-display.test.ts"npm run typecheck --workspace @codenomad/uinpm run build --workspace @codenomad/uiPossible follow-ups :
<codenomad:hide>...</codenomad:hide>