Skip to main content

Overview

While OpenFang ships with powerful bundled Hands, you can create custom Hands tailored to your specific workflows. This guide walks through building a Hand from scratch using the HAND.toml format.

Hand Anatomy

Every Hand consists of:
  1. Metadata — ID, name, description, category, icon
  2. Tools — Which tools the agent can access
  3. Requirements (optional) — External dependencies, API keys
  4. Settings (optional) — User-configurable options
  5. Agent Configuration — LLM settings and system prompt
  6. Dashboard Metrics (optional) — Performance tracking

File Structure

HAND.toml Format

Basic Structure

Example: News Digest Hand

Let’s build a Hand that reads news sites and generates a daily digest.

Step 1: Create the Directory

Step 2: Write HAND.toml

python -c “import platform; print(platform.system())”
HTML:
Email: (Requires SMTP configuration — not implemented in this example) Save as: news_digest_YYYY-MM-DD.{md,html}

Phase 5 — State Persistence

  1. Add new articles to news_digest_seen.json (avoid re-featuring)
  2. memory_store news_digest_state: last_run, total_articles, total_digests
  3. Update dashboard metrics:
    • memory_store news_digest_articles_read — total articles ever processed
    • memory_store news_digest_digests_generated — total digests created
    • memory_store news_digest_last_run — timestamp

Guidelines

  • NEVER fabricate articles or sources — every headline must come from actual fetch
  • Skip articles more than 48 hours old unless it’s a weekly digest
  • Prioritize diverse sources — don’t feature 10 articles from the same site
  • For breaking news, feature at the top even if slightly older
  • If a source is unreachable, skip it gracefully and continue """

Dashboard metrics

[dashboard] [[dashboard.metrics]] label = “Articles Read” memory_key = “news_digest_articles_read” format = “number” [[dashboard.metrics]] label = “Digests Generated” memory_key = “news_digest_digests_generated” format = “number” [[dashboard.metrics]] label = “Last Run” memory_key = “news_digest_last_run” format = “text”
Configure sources:

Step 4: Test

The Hand will collect articles, filter, and generate news_digest_2026-03-06.md.

Advanced Features

External Dependencies

If your Hand requires external tools:

API Keys

Settings with Options

Setting types:
  • text — Free text input
  • select — Dropdown with predefined options
  • toggle — Boolean on/off

Knowledge Graph Usage

If your Hand tracks entities and relationships:

Event Publishing

If your Hand should notify other systems:

System Prompt Best Practices

Effective system prompts:
  1. Start with Phase 0 — Platform detection and state recovery
  2. Multi-phase structure — Break workflow into clear phases
  3. Explicit tools — Show exact shell commands or tool calls
  4. Error handling — Describe what to do when things fail
  5. Cross-platform — Handle Windows, macOS, Linux differences
  6. Examples — Include concrete examples of outputs
  7. Guidelines — End with behavioral rules and edge cases

Prompt Structure Template

Tools Reference

Available Tools

Choose only the tools your Hand needs. More tools = larger context = higher cost.

Testing Your Hand

Manual Testing

Iterative Development

  1. Start with a minimal system prompt
  2. Test with simple tasks
  3. Add complexity incrementally
  4. Handle errors as they appear
  5. Refine based on actual behavior

Common Issues

“Hand doesn’t activate”
Check HAND.toml syntax. Ensure id, name, description are present.
“Tool not found”
Verify tool name in tools array matches OpenFang’s tool names exactly.
“Settings not working”
Settings are referenced in system prompt via User Configuration section — check the prompt reads them correctly.
“Metrics not showing”
Ensure memory_store calls use the exact key names defined in [dashboard.metrics].

Real-World Examples

Email Digest Hand

Reads your inbox, categorizes emails, generates daily summaries. Key features:
  • IMAP integration
  • Email categorization (important, spam, newsletters)
  • Smart summaries
  • Action item extraction

Backup Hand

Automated backup management with verification. Key features:
  • Schedule-based backups
  • Multiple destinations (local, S3, etc.)
  • Integrity verification
  • Retention policies

Code Review Hand

Reviews pull requests and provides feedback. Key features:
  • GitHub/GitLab integration
  • Static analysis
  • Best practice checks
  • Automated comments

Invoice Processing Hand

Extracts data from invoices and updates accounting system. Key features:
  • PDF parsing
  • Data extraction
  • Validation
  • QuickBooks/Xero integration

Sharing Your Hand

Publishing

  1. Test thoroughly
  2. Write clear documentation in SKILL.md
  3. Add examples to system prompt
  4. Share the directory:

Installation by Others

Tips & Best Practices

For maintainable Hands:
  • Keep system prompts under 3000 tokens for cost efficiency
  • Use phases for clarity — easier to debug
  • Include examples in prompts — improves reliability
  • Test on all platforms you support (Windows, macOS, Linux)
  • Version your Hand (include version in metadata comments)
  • Document settings thoroughly
  • Provide sensible defaults
  • Handle errors gracefully (don’t crash on missing files, network errors, etc.)
Safety considerations:
  • Never store credentials in HAND.toml (use environment variables)
  • Validate user inputs before using in shell commands
  • Limit network access to necessary domains
  • Set reasonable max_iterations (prevent runaway loops)
  • Include rate limiting for API calls
  • Warn users about destructive actions (file deletion, etc.)

Next Steps

Browse Existing Hands

Study bundled Hands for inspiration

Tool Reference

Learn about available tools

Community

Share your Hands with the community:
  • OpenFang GitHub Discussions
  • Discord server (coming soon)
  • Submit to the official Hand registry
Questions? Open an issue on GitHub or check the docs at opencode.ai.