Files
librefang-registry/plugins/README.md
T
Evan d43077afa9 fix(providers): remove ~anthropic, skip ~ prefixes in sync script (#69)
* fix(providers): remove ~anthropic, skip ~ prefixes in sync script

OpenRouter uses ~ prefixes for internal auto-routing aliases (e.g. ~anthropic).
These are not real providers — they already route through openrouter.toml.
The generated ~anthropic.toml was confusing (looked like a stale backup)
and redundant with the existing openrouter provider.

- Delete providers/~anthropic.toml
- Skip provider IDs starting with ~ in sync-pricing.py --create-missing

* fix(providers): remove morph, aider, kwaipilot

- morph: specialized code-editing/patching tool, not a general LLM provider
- aider: CLI meta-tool wrapper (base_url empty), redundant with claude-code/codex-cli/gemini-cli/qwen-code
- kwaipilot: Kwai internal coding assistant routed via OpenRouter, niche

* fix(sync): add morph/aider/kwaipilot to SKIP_PROVIDERS to prevent re-creation

* feat(sync): merge OpenRouter-only providers into openrouter.toml

Instead of generating standalone .toml files that just wrap the OpenRouter
endpoint, merge their models directly into openrouter.toml with the
standard 'openrouter/{provider}/{model}' ID convention.

- Add _build_model_fields() and _model_lines() helpers to deduplicate
  model rendering between standalone and merged paths
- Add merge_into_openrouter() that appends new models idempotently
- generate_provider_toml() now only runs for providers in PROVIDER_API
- --create-missing routes OpenRouter-only providers to merge_into_openrouter

* fix(providers): remove 14 OpenRouter-only standalone files

These providers have no direct public API and all route through
openrouter.ai/api/v1. Per the new sync-pricing.py policy, their models
will be merged into openrouter.toml on the next CI run instead of
living in separate files that just wrap the OpenRouter endpoint.

Removed: allenai, deepcogito, essentialai, inclusionai, inflection,
liquid, meituan, nex-agi, nousresearch, prime-intellect, relace,
switchpoint, tngtech, writer

* fix(providers): remove 7 niche providers with no driver support

No dedicated LLM driver code exists for these providers — they rely
purely on OpenAI-compatible passthrough with no special handling.
Removing them reduces registry noise; users can still reach them via
openrouter.toml if needed.

Removed: microsoft, ibm-granite, xiaomi, upstage, inception, aion-labs, arcee-ai

* fix(providers): remove ai21, chutes, venice

All three use ApiFormat::OpenAI with no special handling — pure passthrough.
No registry entry needed; users can reach them via openrouter.toml or by
adding a custom provider.

* docs(providers): rewrite README with full provider catalog and inclusion criteria

- List all 46 providers grouped by category with descriptions
- Document why each provider exists (direct API, unique endpoint, dedicated driver, local, CLI)
- Add inclusion criteria section explaining when to create standalone files vs merging into openrouter.toml
- Document sync script routing logic
- Update model counts: 49→46 providers, 339→232 models

* docs: add comprehensive READMEs for all registry sections + deepinfra provider

- agents/README.md: 32 agents across 7 categories with capability field reference
- channels/README.md: 44 channels across 5 categories with protocol reference table
- hands/README.md: 18 hands across 5 categories with HAND.toml format guide
- mcp/README.md: 33 MCP servers across 5 categories with transport/auth format
- plugins/README.md: 12 plugins with hook protocol documentation
- skills/README.md: 60 skills across 9 categories with SKILL.md format guide
- providers/deepinfra.toml: add DeepInfra serverless inference (5 models)
2026-04-24 00:02:33 +09:00

4.9 KiB

Plugins Registry

Plugins extend agent behavior through lifecycle hooks. They can inject memories into context before a turn, perform side-effect processing after a turn, or do both. Unlike skills (which add knowledge) or MCP servers (which add tools), plugins run as Python scripts that intercept the agent loop.

File Format

Each plugin lives in its own subdirectory:

plugins/
└── <plugin-name>/
    ├── plugin.toml          # required: plugin manifest
    ├── hooks/
    │   ├── ingest.py        # called on each incoming user message
    │   └── after_turn.py    # called after each completed agent turn
    └── requirements.txt     # Python dependencies (prefer stdlib-only)

plugin.toml format

name = "episodic-memory"         # must match directory name
version = "0.1.0"
description = "Episode-based memory segmentation and recall for cross-conversation context continuity"
author = "librefang"

[hooks]
ingest = "hooks/ingest.py"       # optional
after_turn = "hooks/after_turn.py" # optional

[i18n.zh]
name = "情景记忆"
description = "基于情景的记忆分段与召回,实现跨会话的上下文延续。"

Hook Protocol

Hooks communicate with the agent runtime via stdin/stdout JSON lines.

ingest hook

Receives the incoming user message and returns zero or more memory objects to inject into the agent's context for this turn:

stdin:  {"type": "ingest", "agent_id": "abc123", "session_id": "...", "message": "user message text"}
stdout: {"type": "ingest_result", "memories": [{"content": "Relevant fact from earlier session"}]}

after_turn hook

Receives the full turn transcript after the agent responds. Used for persistence (saving summaries, updating profiles, appending logs):

stdin:  {"type": "after_turn", "agent_id": "abc123", "session_id": "...", "messages": [...]}
stdout: {"type": "ok"}

Installing and Using Plugins

# List all available plugins
librefang catalog plugins

# Install a plugin globally
librefang plugin install episodic-memory

# Enable a plugin for a specific agent
librefang plugin enable episodic-memory --agent coder

# Disable a plugin for an agent
librefang plugin disable episodic-memory --agent coder

# List plugins active for an agent
librefang plugin list --agent coder

Hands can also declare an allowed_plugins list in HAND.toml, which restricts which installed plugins are active within that hand.

All Plugins (12 total)

Name Version Hooks Description
auto-summarizer 0.1.0 ingest, after_turn Maintains a running conversation summary to help agents handle long conversations without losing context
context-decay 0.1.0 ingest, after_turn Time-based memory decay with relevance scoring for natural context forgetting
conversation-logger 0.1.0 after_turn Logs all conversations to JSONL files for auditing, analytics, and debugging
episodic-memory 0.1.0 ingest, after_turn Episode-based memory segmentation and recall for cross-conversation context continuity
guardrails 0.1.0 ingest Safety filter that detects potentially harmful content patterns and injects warnings into agent context
keyword-memory 0.1.0 ingest Extracts keywords and named entities from user messages and returns them as contextual memories
mempalace-indexer 0.3.0 ingest, after_turn Auto-indexes conversations into MemPalace and recalls relevant memories — no API keys, no cloud
sentiment-tracker 0.1.0 ingest Analyzes user message sentiment and injects emotional context so agents can respond with appropriate tone
todo-tracker 0.1.0 ingest, after_turn Detects action items and tasks mentioned in conversations, persists them, and recalls them as context
topic-memory 0.1.0 ingest, after_turn Topic-aware memory recall with keyword clustering for cross-conversation context
user-profile 0.1.0 ingest, after_turn Persistent user profiling from conversation patterns for personalized agent responses

Note: the guardrails and mempalace-indexer plugins have no after_turn hook; conversation-logger has no ingest hook.

Hook Execution Order

For each agent turn, the runtime executes hooks in this order:

  1. All ingest hooks run (in plugin installation order) — memories are collected and merged
  2. Agent turn executes with the injected context
  3. All after_turn hooks run (in plugin installation order)

Adding a New Plugin

  1. Create plugins/<name>/plugin.toml with name, version, description, and [hooks].
  2. Add hook scripts under hooks/ for each declared hook.
  3. Keep hooks fast (under 500 ms) — they run synchronously on every turn.
  4. List Python dependencies in requirements.txt; prefer standard library where possible.
  5. Run python scripts/validate.py.
  6. Submit a PR.

See CONTRIBUTING.md for the full guide.