demarkus-soul journal — 2026-06-01
Plugin knowledge-quality enforcement — opened plan, shipped item 1
Hashed out how the demarkus-memory Claude Code plugin can enforce a high-quality knowledge system rather than merely advise one. Core diagnosis: the infra layer is solid and deterministic, but the entire knowledge-quality layer (session-guidance, the soul-memory skill, tagging/routing rules) is advisory prose the model executes on best effort — nothing verifies it. The single most damaging hole: a tagless mark_publish is accepted silently by the server and becomes permanently invisible to mark_lookup, so the whole recall half rots invisibly.
Wrote the plan to /plans/plugin-knowledge-quality.md (7 items) and indexed it under Active Plans.
Item 1 implemented (pending Fritz commit): a publish tag-gate.
hooks/publish-gate.sh— one dispatcher wired on both PreToolUse and PostToolUse for the plugin's ownmark_publish(matchermcp__.*demarkus-memory__mark_publish). Tagless publish (orimportanceoutside [0,1]) →warn(default, PostToolUseadditionalContextnudge) /block(PreToolUse deny) /ask(PreToolUse ask).- Strictness via
configured_strictnessinlib.sh: envDEMARKUS_MEMORY_STRICTNESS→~/.demarkus/plugin-memory.strictnessfile →warn. Kept in its own file sosetup.shconf rewrites never clobber it. Always-on check, severity-only knob (not an opt-in capability). tests/publish-gate_test.sh, 14 cases, all green;knowledge-join_test.shstill 11/11.- Pins SERVER 0.17.13→0.17.14; plugin 0.3.0→0.4.0; session-guidance notes the gate.
Two correctness lessons worth keeping:
- The python3 fallback I first wrote used
python3 - <<EOF, which makes Python read the program from stdin and consume the payload —sys.stdinis then empty and the gate always fails open. Caught it because the isolated parser test returned the fail-open tuple for every case. (Then dropped python entirely — see #2.) - Fritz: no python, no jq, no external deps that may not be installed. Rewrote the parser as a pure-awk character-level JSON scanner (awk is already the engine behind
json_escape). It tracks string boundaries (honoring\escapes) and the object-key path, so an arbitrarybodyvalue containing literal"tags":"DECOY"and stray braces is correctly skipped — verified on stock BSD/usr/bin/awkand pinned by a decoy-body regression test.
Design decisions for later items also locked: per-project template aligns to the proven demarkus-soul structure (add debugging.md, guidelines.md, maintained per-project index.md, plans/ lifecycle); knowledge systems get a guaranteed root hub world holding the global template + policy at mark://root/.well-known/demarkus/, with the agent acting as courier to mirror declared strictness into local config the credential-less hook can read.
Pre-existing gap noted: the plugin's shell tests aren't run by any CI workflow.