GolemBot

repository·main·Indexed 43 days ago

https://github.com/0xranx/golembot

A local-first AI agent orchestration layer that connects coding agent engines (such as Claude Code, Cursor, and Codex) to communication channels like Slack, Telegram, Discord, Feishu, DingTalk, WeCom, and WeChat. Version 0.49.2 provides a CLI for onboarding, a gateway for HTTP services, and support for over 13,000 skills via ClawHub. It includes templates for code review, customer support, data analysis, meeting notes, content operations, and research.

Tokens
87.3K
Snippets
281
Records
431
Agent score
55%

What's inside GolemBot

  1. Overview of supported Coding Agent CLIs

    main

    GolemBot integrates with several specialized Coding Agent CLIs. Each engine has unique invocation methods, output formats, and session management characteristics. The supported engines are:

    • Cursor Agent CLI: Uses the agent binary. Supports stream-json and includes a --stream-partial-output flag for deduplication.
    • Claude Code CLI: Uses the claude binary. Supports stream-json and handles mixed assistant/user events.
    • OpenCode CLI: Uses the opencode binary. Uses NDJSON parts and offers an HTTP Server API option.
    • Codex CLI: Uses the codex binary. Uses NDJSON and requires ChatGPT OAuth. Includes a --skip-git-repo-check flag.
  2. Overview of GolemBot Built-in Skills

    main

    GolemBot includes four core built-in skills that are automatically initialized during golembot init or golembot onboard. These skills define the fundamental capabilities of an assistant, such as personal assistance, IM optimization, multi-bot coordination, and proactive messaging.

    Available Built-in Skills:

    • general: A personal assistant for tasks like file management, script execution, and information retrieval.
    • im-adapter: Optimizes response formatting and tone for instant messaging platforms (Slack, Discord, Telegram, etc.).
    • multi-bot: Enables coordination and peer awareness when multiple bots run in the same fleet.
    • message-push: Allows the agent to proactively send messages to channels or users via API.
  3. Multi-Bot Group Chat Demo Overview

    main

    This demo showcases how multiple GolemBot instances can collaborate within a shared group channel using a mock group adapter. It demonstrates several advanced multi-agent patterns:

    • Group-scoped sessions: All bots share a single session key per room, identified by channelType:chatId.
    • smart mode: A bot (e.g., researcher) observes every message but only speaks when it has something valuable to add. If it has nothing to contribute, it outputs [PASS] to signal silence.
    • mention-only mode: A bot (e.g., coder) remains silent unless it is explicitly @mentioned in a message.
    • Multi-bot collaboration: Bots can @mention each other to hand off tasks.
    • maxTurns protection: A safety mechanism to prevent infinite loops in bot-to-bot conversations.
    • Group memory: Bots maintain persistent context using files located at memory/groups/<room>.md.
  4. File structure of the Data Analyst Template

    main

    The Data Analyst Template relies on the following directory structure to function:

    • data/: Contains the source data files (CSV, JSON, etc.) to be analyzed.
    • reports/: The destination directory where the assistant saves generated analysis reports.
    • skills/data-analysis/calc.py: A Python helper script used by the agent to perform statistical calculations.
  5. File structure of the Content Operations Assistant

    main

    The Content Operations Assistant template uses the following directory and file structure to manage its operations:

    • content/: Stores content drafts.
    • reports/: Stores operations briefings.
    • schedule.md: Manages the content publishing schedule.
    • competitors.md: Used for competitor monitoring.
  6. File structure of the Customer Support Bot Template

    main

    The Customer Support Bot Template consists of the following key files and directories:

    • faq.md: The primary knowledge base containing your FAQ content in Q&A format.
    • unanswered.md: An auto-generated log that tracks questions the bot was unable to answer.
    • skills/faq-support/: The directory containing the specific Skill definition used to power the customer support logic.
  7. Understand Discord chat behavior and message limits

    main

    GolemBot's interaction model on Discord depends on the chat type and mention status:

    Chat typeBehavior
    DMAlways responds
    Server channel @mention (@YourBot message)Detects mention, responds
    Server channel message without @mentionDepends on groupPolicy (default: mention-only, which ignores the message)

    Key Technical Details

    • Sessions: Each DM conversation and each server channel maintains its own independent session context.
    • Markdown: Discord natively supports Markdown. GolemBot sends responses as-is, and Discord renders formatting (bold, italic, code blocks, etc.) automatically.
    • Message Limits: If an AI response exceeds 2,000 characters, Discord messages are automatically split into chunks.
  8. Understand GolemBot core design principles

    main

    GolemBot is designed around several key architectural decisions that differentiate it from other AI frameworks:

    • Library-First: The core is an importable library (createAssistant). The CLI is merely a thin shell consumer.
    • Directory-Centric: The assistant is defined by its directory. The directory is the single source of truth for the workspace and the skill list.
    • Skill-as-Capability: Skills are not declared in a config file; any directory inside skills/ is automatically loaded. Skills can contain both Markdown (knowledge) and scripts (tools).
    • Delegated Intelligence: GolemBot does not manage context, tool scheduling, or decision-making. It delegates all such responsibilities to the underlying Coding Agent (the Engine).
    • Concurrency Safety: A single assistant instance allows only one chat() execution at a time to prevent workspace corruption, though multi-user isolation is supported via sessionKey in the HTTP service.
  9. Manage multi-user sessions with sessionKey

    main

    To isolate conversation history for different users, pass a sessionKey to the chat() method.

    • Different keys: Sessions run concurrently.
    • Same keys: Sessions are serialized (one must finish before the next starts).
    // Two users can chat simultaneously
    const task1 = assistant.chat('Task A', { sessionKey: 'user-alice' });
    const task2 = assistant.chat('Task B', { sessionKey: 'user-bob' });
  10. Implement a Custom Group Adapter

    main

    The demo uses a MockGroupAdapter which utilizes a shared Node.js EventEmitter (named GroupRoom) as a channel bus. Any adapter instance that joins the same room emitter will receive all messages and can broadcast replies.

    To move from a mock environment to a production environment, you should replace the MockGroupAdapter with a platform-specific adapter such as FeishuAdapter or SlackAdapter while maintaining the ability to join and broadcast to a shared room.

  11. Use the `general` skill for personal assistance

    main

    The general skill transforms the agent into a personal AI assistant.

    Capabilities:

    • Answering questions, brainstorming, and providing suggestions.
    • File operations: Reading and writing files to organize notes or manage tasks.
    • Automation: Executing scripts and commands.
    • Information retrieval and summarization.

    Persistent Memory: This skill uses a notes.md convention for cross-session memory. The agent reads this file at the start of a conversation and writes to it when important information is identified.

    Skill Management: The agent can autonomously search for and install community skills from ClawHub. If a user requests a capability the agent lacks, it will suggest relevant skills from ClawHub. All commands support the --json flag for structured output.