Skip to content

Chunk 2 — Plugin skeleton + injection

import { Badge } from ‘@astrojs/starlight/components’;

Plugin hooks wired in ~/.claude/settings.json. SessionStart hook reads .wyren/memory.md and emits it as additionalContext. No distiller wired yet, no git sync yet — just the injection pipe.

FilePurpose
.claude-plugin/plugin.jsonPlugin metadata (name, version, author, repo)
hooks/hooks.jsonHook definitions — SessionStart + Stop → run-hook.cmd
hooks/run-hook.cmdWindows/Unix polyglot: finds node, runs .mjs hook
hooks/session-start.mjsReads memory.md + broadcast/, emits additionalContext
hooks/stop.mjsStub — increments watermark turn counter only
bin/wyren.mjsCLI: wyren init creates .wyren/ structure
lib/util.mjsShared readStdin + isMain helpers
Claude Code fires SessionStart
→ run-hook.cmd session-start
→ node hooks/session-start.mjs
→ reads .wyren/memory.md
→ reads .wyren/broadcast/* (skips .gitkeep)
→ emits JSON to stdout:
{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"..."}}
→ Claude receives memory as hidden context before first message

Plugin hooks are wired via install.sh / install.ps1 (see Install guide).

Terminal window
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/ssm-08/wyren/master/install.sh | sh
# Windows
iwr -useb https://raw.githubusercontent.com/ssm-08/wyren/master/install.ps1 | iex
Terminal window
wyren init
git add .wyren/memory.md .gitignore
git commit -m "chore: init wyren"
git push

Until Chunk 3 wires the distiller, edit .wyren/memory.md directly:

# Wyren Memory
## Decisions
- Use SQLite (rejected Postgres — too heavy)
## Live workarounds
- user_id hardcoded to 1 in /dashboard [session abc1, turn 3]

Every teammate’s next session starts with this context injected silently.

  • Plugin installs cleanly, hooks fire, injection works in a fresh Claude Code session.
  • Editing memory.md is reflected in the next session.
  • SessionStart hook completes in under 500ms.
  • 17 unit tests pass.

stop.mjs stub becomes real: spawns distiller.mjs detached after 5 turns. Tier 0 regex filter skips ~70% of triggers. Memory updates live during a session without any manual editing.

Chunk 3 detail →