SessionStart injects raw JSON bundle: key list misses the engine's rendered_markdown field
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 88/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, nodejs
- Lĩnh vực
- tooling
Hướng nghiên cứu
Mở hooks/zcode-mem-hook.mjs và đọc summarizeContextBundle quanh L245-250, nơi danh sách khóa render được kiểm tra trước khi quay về JSON.stringify. Tái hiện bằng cách cung cấp cho nó đầu ra của nmem --json context --source-app zcode và xác nhận rằng đầu ra hiển thị JSON thô với một chuỗi rendered_markdown ở cấp cao nhất. Thêm payload.rendered_markdown vào đầu danh sách tra cứu và chạy lại hook để xác nhận rằng ngữ cảnh được chèn bắt đầu bằng render Markdown thay vì một bản dump JSON.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- nowledge-mem-zcode: 0.2.2 (installed via ZCode plugin marketplace)
- nmem CLI / engine: 0.10.119
- OS: macOS (darwin 25.6.0, arm64)
What happens
On SessionStart, the hook's injected additionalContext is the entire context bundle pretty-printed as raw JSON (truncated to MAX_CONTEXT_CHARS = 6000), instead of the human-readable render the engine already provides.
Root cause
summarizeContextBundle (hooks/zcode-mem-hook.mjs, L245-250 in 0.2.2):
const rendered = payload.markdown || payload.content || payload.context || payload.working_memory;
if (typeof rendered === "string" && rendered.trim()) return rendered.trim();
return JSON.stringify(payload, null, 2);
The engine's context bundle (nmem --json context --source-app zcode) carries the human-readable render under a key this list does not cover:
- top-level keys observed:
active_space, agent_profile, authorship, bundle_kind, compiled_hash, generated_at, kfs_roots, owner_profile, rendered_markdown, rule_stack, schema_version, warnings, working_memory rendered_markdown: string, ~11.7k chars — a finished Markdown render (first line# Nowledge Mem Context Bundle)working_memory: object, so it fails thetypeof rendered === "string"check
All four lookups miss → the fallback dumps the whole bundle as JSON.
The engine clearly intends this surface to be human-readable: nmem context without --json (help text: "Emit raw JSON instead of human-readable output") outputs the same rendered Markdown, line-identical to rendered_markdown apart from two blank lines.
Suggested fix (one line)
Add the engine's key to the lookup list:
const rendered = payload.rendered_markdown || payload.markdown || payload.content || payload.context;
(working_memory can stay last or be dropped from the string path — it is an object in current engine output.)
Local workaround in place
A companion hook injecting nmem context plain-mode output as session-start additionalContext (coexists with the official hook until this is fixed). Verified on 0.2.2 + nmem 0.10.119: official hook output is the 6000-char JSON dump; plain-mode output is the clean render.
Notes
- 0.2.2 release notes do not mention SessionStart / rendered_markdown, so this appears unreported.
- Side observation: the SessionStart matcher (
startup|clear|compact) does not coverresume, which the ZCode host also fires for SessionStart hooks.
- Ngôn ngữ chính
- JavaScript
- Star
- 3
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nowledge-co/zcode-plugin
-
UserPromptSubmit recall regex is English-only: Chinese prompts never trigger auto-recallCó thể đã có người làm @ThaddeusJiang đã nhận 3 ngày trước. Đang mởbug
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
nowledge-co/zcode-plugin#4 · 1 bình luận · 1 người được giao ·
-
Hooks silently not loaded from a local directory marketplace; ZCode 0.16.5 Stop transcript is assistant-only so stock sync always failsCó thể đã có người làm @ThaddeusJiang đã nhận 3 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
nowledge-co/zcode-plugin#2 · 2 bình luận · 1 người được giao ·
Tất cả issue của nowledge-co/zcode-plugin
Issue tương tự
-
Add: QudsunaTV.psĐang mởchannels:add check:passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
iptv-org/database#39416 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[TEXT] Flache Karte ist 2DĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
swisstopo/topo-swisseobrowser#48 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
discovery:other factory-active task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
vercel/ai#25068 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày