Files
librefang-registry/hands
Evan 102b506b0b fix(agents,hands): per-agent/per-hand mcp_servers / skills allowlists (#87) (#92)
All 32 agent manifests and 17 hands shipped with empty mcp_servers /
skills lists, which the kernel interprets as "no filter" — every
globally-configured MCP server's tools and every installed skill get
injected into the prompt on every LLM call. On a typical instance (9
MCP servers, ~85 MCP tools + ~82 built-in tools) that's ~50k input
tokens per turn spent on definitions the agent never uses.

Changes
-------

32 agents/*/agent.toml:
  - mcp_servers: 1-4 per agent. memory wherever state persists across
    turns; fetch / exa-search / brave-search only where the prompt
    actually calls for web; git / github / filesystem on engineering
    agents; gmail / google-calendar / linear / jira on productivity
    agents whose prompts mention them.
  - skills: per-role allowlist driven by what the system_prompt names
    (e.g. coder → rust/python/typescript/git/shell-scripting; devops-
    lead → docker/kubernetes/terraform/ansible/ci-cd/helm/prometheus/
    sysadmin). Generalists (assistant) keep skills = [] (see "Open
    items" below).
  - skills_disabled = true on the four short-conversational agents
    (hello-world, recipe-assistant, health-tracker, home-automation).
    Their system prompts never instruct the LLM to consult any skill,
    so loading all 60 was pure waste. They also drop the explicit
    max_history_messages override and inherit the kernel default (60).
  - max_history_messages tiered by workload shape:
      60  short conversational (hello-world, recipe, health-tracker,
          home-automation) — inherits the rising kernel default
          (`DEFAULT_MAX_HISTORY_MESSAGES = 60`); no override needed.
      60  single-turn task agents (writer, translator, doc-writer,
          email-assistant, customer-support, sales-assistant, recruit-
          er, social-media, personal-finance, tutor, travel-planner,
          meeting-assistant, ops, devops-lead, planner) — explicit
          override at the same value to lock the cap if the kernel
          default moves again.
      80  multi-step / tool-heavy (coder, debugger, architect, code-
          reviewer, test-engineer, security-auditor, analyst, data-
          scientist, academic-researcher, researcher, legal-assistant)
      120 coordinators (assistant, orchestrator) — long multi-agent
          sessions where prompt-cache continuity is critical
    All values sit at or above the kernel default. Pinning lower
    would thrash the prompt cache (the failure mode #91 fixed for
    the creator hand by *raising* the cap, not lowering it).

17 hands/*/HAND.toml:
  - hand-level mcp_servers / skills now declared on every hand, so
    every [agents.*] inside inherits a sensible allowlist.
  - skills_disabled = true placed on each [agents.*] inside clip and
    creator (pure media pipelines that don't benefit from any skill).
    HandDefinitionRaw in librefang-hands does NOT have a top-level
    skills_disabled field — declaring it at the hand top level would
    be silently dropped by serde, so the setting must live on the
    AgentManifest of each sub-agent role.
  - devteam: expand existing mcp_servers = ["github"] to include
    memory / git / filesystem; populate skills with the expected
    dev-team expertise (replacing the placeholder skills = []).
  - wiki: replace placeholder mcp_servers = [] with [memory, fetch,
    filesystem]. Hand-level skills stays [].
  - lead: hand-level skills was originally [email-writer, writing-
    coach, interview-prep]; interview-prep is for job-interview
    preparation, not lead generation. Replaced with data-analyst
    (used by the qualification-scoring step in the prompt).

schema.toml: register mcp_servers / skills / max_history_messages on
the agent field schema so machine consumers (RegistrySchema in
librefang-types) see the new top-level fields. The
max_history_messages description now points at
librefang_runtime::agent_loop::DEFAULT_MAX_HISTORY_MESSAGES (60
today) by name, so the schema doesn't go stale when the constant
moves again.

agents/README.md: example block + "Adding a New Agent" checklist
mention the allowlists; max_history_messages example is shown
commented out with a prompt-cache caveat.

Open items
----------

`assistant` (the default user-facing agent) keeps `skills = []`
deliberately. It is the generalist entry point — capping its skill
surface at a small allowlist would defeat its "delegate to any
specialist" job. The trade-off is that this single agent still pays
the full skill-definition load on every turn; operators who want a
strict allowlist for `assistant` can override it after install.

Why not adopt PR #89's approach
-------------------------------

#89 covers similar ground but with three issues this PR avoids:

1. mcp_servers = ["_none"] sentinel. #89's body explicitly notes
   it's pending upstream librefang#4808 (mcp_disabled). Shipping a
   magic-string today means coming back later to clean it up. This
   PR uses real allowlists.
2. max_history_messages = 8 / 12 / 15 / 20. Far below today's
   kernel default (60) and #91's direction for long-workflow hands
   (80–120). Every turn that hits the cap invalidates the cached
   prompt prefix; the cost of cache misses exceeds the saving from
   shorter history. This PR uses 60–120.
3. Doubling max_llm_tokens_per_hour (coder 200k→500k, assistant
   300k→500k) widens the per-agent budget — the opposite direction
   from #87's "reduce per-call cost" goal. Left to the operator's
   instance-specific tuning.

Refs librefang/librefang-registry#87, librefang/librefang-registry#89
2026-05-12 09:30:21 +09:00
..

Hands Registry

Hands are pre-packaged capability bundles that compose agents, tools, skills, MCP servers, and plugins into a working application. Installing a hand gives you a complete, ready-to-use workflow — not just a single agent.

"You have many hands helping you."

A hand can contain one agent (single-agent) or multiple coordinated agents (multi-agent). Each agent in a multi-agent hand can have its own role-specific skills, model config, and capability restrictions.

File Format

Each hand lives in its own subdirectory:

hands/
├── researcher/
│   ├── HAND.toml          # required: hand definition
│   └── SKILL.md           # optional: shared reference knowledge for all agents
├── devteam/
│   ├── HAND.toml
│   ├── SKILL-pm.md        # optional: role-specific knowledge for PM agent
│   ├── SKILL-engineer.md  # optional: role-specific knowledge for Engineer agent
│   └── SKILL-qa.md        # optional: role-specific knowledge for QA agent

HAND.toml format

id = "researcher"
version = "1.1.1"
name = "Researcher Hand"
description = "Autonomous deep researcher — exhaustive investigation, cross-referencing, fact-checking, and structured reports"
category = "productivity"           # productivity | development | data | content | communication
icon = "lucide:flask-conical"

# Tools available to all agents in this hand
tools = [
  "shell_exec", "file_read", "file_write", "web_fetch", "web_search",
  "memory_store", "memory_recall", "knowledge_query", "event_publish",
]

# MCP servers all agents can use
mcp_servers = ["github"]

# Skills allowlist (empty = all available)
skills = []

# Plugin allowlist
allowed_plugins = ["todo-tracker", "auto-summarizer"]

# ─── Routing ──────────────────────────────────────────────────────────────────
[routing]
aliases = ["deep research", "investigate", "fact check"]    # exact activation phrases
weak_aliases = ["research", "look into"]                    # keyword hints

# ─── Configurable settings ────────────────────────────────────────────────────
[[settings]]
key = "research_depth"
label = "Research Depth"
description = "How exhaustive each investigation should be"
setting_type = "select"            # select | toggle | text
default = "thorough"

[[settings.options]]
value = "quick"
label = "Quick (5-10 sources, 1 pass)"

[[settings.options]]
value = "thorough"
label = "Thorough (20-30 sources, cross-referenced)"

# ─── Single-agent definition ──────────────────────────────────────────────────
[agent]
name = "researcher"
base = "researcher"               # inherits from agents/researcher/agent.toml

[agent.model]
system_prompt = """Custom prompt override..."""

# ─── Multi-agent definition (alternative to [agent]) ─────────────────────────
[agents.pm]
coordinator = true
base = "planner"                  # inherits from agents/planner/agent.toml
invoke_hint = "Task coordination and issue triage"

[agents.engineer]
base = "coder"
invoke_hint = "Implementation"

[agents.qa]
base = "test-engineer"
invoke_hint = "Quality assurance and validation"

# ─── Dashboard metrics ────────────────────────────────────────────────────────
[dashboard]
[[dashboard.metrics]]
label = "Reports Written"
memory_key = "metric_reports_written"
format = "number"

# ─── i18n ─────────────────────────────────────────────────────────────────────
[i18n.zh]
name = "研究员"
description = "自主深度研究员 — 详尽调查、交叉核实、事实核查与结构化报告"

Installing and Using Hands

# List all available hands
librefang catalog hands

# Install a hand
librefang hand install researcher

# Install with a specific agent name
librefang hand install researcher --name my-researcher

# List installed hands
librefang hand list

# Remove a hand
librefang hand remove my-researcher

All Hands (18 total)

Productivity

ID Name Category Description
researcher Researcher Hand productivity Autonomous deep researcher — exhaustive investigation, cross-referencing, fact-checking, and structured reports
strategist Strategist Hand productivity Autonomous strategy analyst — market research, competitive analysis, business planning, and strategic recommendations
wiki Wiki Hand productivity LLM-maintained personal knowledge base — builds an Obsidian-compatible wiki from raw sources with provenance tracking
browser Browser Hand productivity Autonomous web browser — navigates sites, fills forms, clicks buttons, and completes multi-step web tasks

Development

ID Name Category Description
devteam Dev Team development Autonomous software development team — PM triages issues, Engineer implements, QA validates
devops DevOps Hand development Autonomous DevOps engineer — CI/CD management, infrastructure monitoring, deployment automation, and incident response
apitester API Tester Hand development Autonomous API testing agent — endpoint discovery, request validation, load testing, and regression detection

Data

ID Name Category Description
analytics Analytics Hand data Autonomous data analytics agent — data collection, analysis, visualization, dashboards, and automated reporting
collector Collector Hand data Autonomous intelligence collector — monitors any target continuously with change detection and knowledge graphs
lead Lead Hand data Autonomous lead generation — discovers, enriches, and delivers qualified leads on a schedule
predictor Predictor Hand data Autonomous future predictor — collects signals, builds reasoning chains, makes calibrated predictions, and tracks accuracy
trader Trading Hand data Autonomous market intelligence and trading engine — multi-signal analysis, adversarial bull/bear reasoning, and strict risk management

Content

ID Name Category Description
clip Clip Hand content Turns long-form video into viral short clips with captions and thumbnails
creator Creator Hand content AI media studio — generates images, videos, music, and speech from text prompts

Communication

ID Name Category Description
linkedin LinkedIn Hand communication Autonomous LinkedIn manager — profile optimization, content creation, networking, and professional engagement
reddit Reddit Hand communication Autonomous Reddit manager — monitors subreddits, posts content, replies to threads, and tracks engagement
twitter Twitter Hand communication Autonomous Twitter/X manager — content creation, scheduled posting, engagement, and performance tracking

Data (additional)

ID Name Category Description
clip Clip Hand content Turns long-form video into viral short clips with captions and thumbnails

Resource Composition Summary

Resource How to compose Notes
Agent templates base = "coder" on [agents.*] Inherits prompt, model config, fallbacks from agents/coder/agent.toml
Tools tools = [...] at hand level All agents in the hand share these built-in tools
Skills skills = [...] at hand level Empty list means all available skills are allowed
MCP servers mcp_servers = [...] at hand level Agent interacts via MCP tools, not hardcoded API calls
Plugins allowed_plugins = [...] at hand level Empty list means all installed plugins are allowed
Per-agent knowledge SKILL-{role}.md files Different reference prompts per agent role
Per-agent capabilities [agents.*.capabilities] Fine-grained shell / network / memory per agent

Adding a New Hand

  1. Create hands/<name>/HAND.toml with at least id, name, description, and category.
  2. Add SKILL.md (shared) or SKILL-{role}.md (per-agent) files for reference knowledge.
  3. Use base = "agent-name" in each [agents.*] block to inherit from existing agent templates.
  4. Specify mcp_servers, skills, and allowed_plugins for resource composition.
  5. Ensure id matches the directory name.
  6. Run python scripts/validate.py.
  7. Submit a PR.

See CONTRIBUTING.md for the full guide.