Files
librefang-registry/plugins/README.md
T
Evan Hu afcb260554 feat: add 6 production-ready plugins
All plugins are stdlib-only Python with no external dependencies.

- auto-summarizer: extractive conversation summary for long context
  compression, persists per-agent summaries to disk
- conversation-logger: JSONL audit logs per agent with ISO 8601
  timestamps, auto-creates log directory tree
- guardrails: safety filter detecting PII (email, phone, SSN, CC),
  prompt injection patterns, and credential exposure via regex
- keyword-memory: extracts entities (emails, URLs, dates, technical
  terms like camelCase/snake_case/dotted identifiers) as memories
- sentiment-tracker: keyword-based sentiment scoring with intensifiers
  and negation handling, only injects context for non-neutral sentiment
- todo-tracker: detects action items via 7 task patterns, tracks
  completion, deduplicates, persists per-agent with 20-item FIFO limit
2026-03-21 02:51:58 +09:00

69 lines
2.2 KiB
Markdown

# Plugins
Plugin packages for LibreFang. Plugins extend agent behavior through lifecycle hooks -- they can inject memories, modify context, or perform side effects during conversations.
## Structure
```
plugins/
└── echo-memory/
├── plugin.toml # Plugin manifest
├── hooks/
│ ├── ingest.py # Called on user message
│ └── after_turn.py # Called after each turn
└── requirements.txt # Python dependencies
```
## plugin.toml Format
```toml
name = "plugin-name" # Must match directory name
version = "0.1.0"
description = "What this plugin does"
author = "author-name"
[hooks]
ingest = "hooks/ingest.py" # Receives user message, can return memories
after_turn = "hooks/after_turn.py" # Post-turn processing
```
## Hook Protocol
Hooks communicate via stdin/stdout JSON:
### ingest hook
```
stdin: {"type": "ingest", "agent_id": "...", "message": "user message"}
stdout: {"type": "ingest_result", "memories": [{"content": "..."}]}
```
### after_turn hook
```
stdin: {"type": "after_turn", "agent_id": "...", "messages": [...]}
stdout: {"type": "ok"}
```
## Current Plugins (7)
| Plugin | Hooks | Description |
|--------|-------|-------------|
| echo-memory | ingest, after_turn | Demo plugin that echoes user messages as recalled memories |
| auto-summarizer | ingest, after_turn | Running conversation summary for long context compression |
| conversation-logger | after_turn | Logs conversations to JSONL files for auditing and analytics |
| guardrails | ingest | Safety filter detecting PII, prompt injection, and credential exposure |
| keyword-memory | ingest | Extracts keywords and named entities as contextual memories |
| sentiment-tracker | ingest | Analyzes user sentiment and injects emotional context |
| todo-tracker | ingest, after_turn | Detects, persists, and recalls action items from conversations |
## Adding a New Plugin
1. Create `plugins/<name>/plugin.toml`
2. Add hook scripts in `hooks/`
3. List dependencies in `requirements.txt` (prefer stdlib-only)
4. Run `python scripts/validate.py`
5. Submit a PR
See [CONTRIBUTING.md](../CONTRIBUTING.md) for the full guide.