ReMe/reme-plugin/plugins/reme-service/hooks/active_events_check.py
huangsen ad6368fdf0
Some checks are pending
Pre-commit / run (ubuntu-latest) (push) Waiting to run
```
feat: add Claude Code marketplace plugin with service and expert tiers

Add comprehensive Claude Code marketplace plugin supporting two paradigms
for managing markdown vaults:

- reme-service: Service-tier plugin with high-level MCP tools
  (retrieve/remember/maintain) where reme2 internals handle R-M-W loop
- reme-expert: Expert-tier plugin where Claude Code agent runs R-M-W loop
  directly using raw memory_* primitives guided by reme protocol skill

Both plugins implement identical 4-phase work paradigm:
- Recall: Retrieve relevant context with ranking by relevance/proximity
- Log: Record event facts and raw materials via idempotent event-folder upsert
- Distill: Promote events to topic graph via R-M-W loop
- Maintain: Vault hygiene sweep with lint and decay operations

Include marketplace configuration, documentation, MCP server setup,
subagents (reme-distiller, reme-curator), hooks (PreCompact, SessionEnd,
Stop), and slash commands (/reme-distill, /reme-recall, /reme-clean).

Remove outdated plugin entries from gitignore.
```
2026-05-11 10:58:40 +08:00

35 lines
986 B
Python
Executable file

#!/usr/bin/env python3
"""Stop hook: warn if there are still events with status: active."""
import os
import re
import sys
from pathlib import Path
vault_path = os.environ.get("VAULT_PATH")
if not vault_path:
sys.exit(0)
events_dir = Path(vault_path) / "events"
if not events_dir.is_dir():
sys.exit(0)
active = 0
fm_re = re.compile(r"^---\s*$(.*?)^---\s*$", re.MULTILINE | re.DOTALL)
status_re = re.compile(r"^status:\s*active\s*$", re.MULTILINE)
for md in events_dir.rglob("*.md"):
try:
text = md.read_text(encoding="utf-8")
except Exception:
continue
fm_match = fm_re.search(text)
if fm_match and status_re.search(fm_match.group(1)):
active += 1
if active > 0:
sys.stderr.write(
f"⚠️ 流程合规:还有 {active} 个 active event 未 distill。"
f"建议调用 `remember(mode=distill, content=..., related_paths=[...])` "
f"把这些 active events 提炼到 topic 后再结束会话。\n",
)