Strip all Hangman-Lab-specific content out of PrismFacet so it can be
reused by any project. Content (always router, pcexec-convention prompt,
fabric-chat-injector hook) moves to the new sibling plugin ClawPrompts.
Mechanism additions:
- `globalThis.__prismFacet` cross-plugin API installed at module-import
time (so consumers loaded before PrismFacet can still register):
.addRouter(name, resolveFn)
.addRule(router, key, { file })
- core/rule-store: tier rules into `persistent` (rules.json, mutated by
the prompt-rules admin tool) and `external` (in-memory, registered by
other plugins via the API). Persistent overrides external on conflict.
- core/router-loader: addExternalRouter() for programmatic registration
into the same map the file-based loader uses.
- index.ts: drops registerFabricChatInjector wiring, registerBeforePromptBuild
remains.
Removed (now shipped from ClawPrompts):
- plugin/routers/always.ts
- plugin/hooks/fabric-chat-injector.ts
- plugin/prompts/pcexec-convention.md
- plugin/rules.json: now `{}`; ClawPrompts registers its rule externally
What still lives in PrismFacet:
- before_prompt_build hook (the wiring between routers/rules and the
agent's system prompt)
- prompt-rules admin tool (lists + mutates persistent rules)
- file-based routersDir / rulesFile scanning (kept for operator ad-hoc
use; ClawPrompts uses the API instead)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New before_prompt_build hook that appends a "next action: workflow_start
chat" hint to the system prompt whenever the agent's turn was triggered
by a message in a fabric channel.
If Meridian (`globalThis.__meridian.getChatJournalForChannel`) reports
an existing chat journal for this (agentId, channelId), the hint
includes `from="<journal-id>"` so the agent resumes the conversation
file instead of starting a fresh one each turn.
Activation:
- ctx.agentId AND ctx.channelId present
- ctx.messageProvider in {fabric, '' (empty/omitted by gateway)}
TODO(phase-2): once Fabric exposes per-channel type info (DM / group /
triage) via a cross-plugin API, narrow this to xType === 'dm' only.
Today we fire on any fabric channel — chat workflow is a no-op outside
DMs, so the false positives are just prompt-text noise.
Dedup via WeakSet keyed on the event object (same pattern as the
existing before-prompt-build hook) so each turn injects at most once
even when multiple harness call sites trigger the hook.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 'always' router resolves to the constant key "always" for every
agent — pair with a rule like 'always:always → some-prompt.md' to
inject a prompt fragment unconditionally (no ego/role/position
lookup needed).
Bundle a site-specific prompt 'pcexec-convention.md' that tells every
agent: Hangman-Lab keeps site binaries at ~/.openclaw/bin (hf,
secret-mgr, ego-mgr, fabric-register, pcguard, lock-mgr, tea) — not
symlinked to /usr/local/bin — so they MUST be invoked via the pcexec
tool, not the codex built-in shell. Without this, agents would call
those CLIs directly and get 'command not found' (observed during the
2026-05-23 hf-wakeup runs on prod t2).
Register the binding in rules.json so it loads at gateway startup.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same class of bug as Meridian (zhi/Meridian#2), HarborForge.OpenclawPlugin
(zhi/HarborForge.OpenclawPlugin#6), and PaddedCell (already fixed in
787d88c). OpenClaw's plugin host requires that any tool registered via
`api.registerTool()` is also declared in `contracts.tools` in the
plugin manifest, or the tool is silently dropped from the agent's
available tool list. plugin doctor was warning:
prism-facet: plugin must declare contracts.tools before registering
agent tools
PrismFacet registers exactly one tool, `prompt_rules` (in
tools/prompt-rules.js). Declaring it in the manifest. Verified in sim
that with this change the warning disappears and the tool becomes
visible to agents.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PrismFacet is a generic framework — routers are registered by
consumers (e.g., ClawRoles), not bundled with the plugin.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dynamic system prompt injection plugin for OpenClaw.
Routes agent context through configurable routers, matches
against registered rules, and injects prompt files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>