SessionStart injects raw JSON bundle: key list misses the engine's rendered_markdown field
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, nodejs
- Domain
- tooling
Research direction
Open hooks/zcode-mem-hook.mjs and read summarizeContextBundle around L245-250, where the render key list is checked before falling back to JSON.stringify. Reproduce by feeding it the output of nmem --json context --source-app zcode and confirming the output shows raw JSON with a top-level rendered_markdown string. Add payload.rendered_markdown to the front of the lookup list and re-run the hook to confirm the injected context starts with the Markdown render instead of a JSON dump.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nowledge-co/zcode-plugin
-
UserPromptSubmit recall regex is English-only: Chinese prompts never trigger auto-recallPossibly taken @ThaddeusJiang claimed this 3 days ago. Openbug
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
nowledge-co/zcode-plugin#4 · 1 comment · 1 assignee ·
-
Hooks silently not loaded from a local directory marketplace; ZCode 0.16.5 Stop transcript is assistant-only so stock sync always failsPossibly taken @ThaddeusJiang claimed this 3 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
nowledge-co/zcode-plugin#2 · 2 comments · 1 assignee ·
All issues in nowledge-co/zcode-plugin
Similar issues
-
Add: QudsunaTV.psOpenchannels:add check:passed
Difficulty 1/5 Under an hour Newbie friendliness 66/100
iptv-org/database#39416 · 2 comments ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
swisstopo/topo-swisseobrowser#48 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
discovery:other factory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
vercel/ai#25068 · 4 comments ·
Maintainers usually reply within 1 day