Skip to content

ihoooohi/TinyClaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyClaw

License Language Go Version

English | 中文


Project Overview

TinyClaw is a lightweight Go-based AI agent service. It provides:

  • Local CLI chat mode for direct interaction with an agent.
  • Feishu channel integration for message-driven gateway mode.
  • A shell execution tool with built-in dangerous-command guards.

The project is built on CloudWeGo Eino and currently uses an OpenAI-compatible model endpoint configured by environment variables.

Features

  • ReAct-style agent workflow powered by Eino.
  • Pluggable channel abstraction with Feishu implementation.
  • Gateway pipeline for inbound message -> agent generation -> outbound reply.
  • Command execution tool with denylist-based safety checks and timeout control.
  • Minimal runtime setup with environment-variable configuration.

Project Structure

TinyClaw/
├── cmd/
│   ├── main.go                      # Local CLI entry
│   ├── feishu_channel_test/         # Feishu channel connectivity test
│   └── feishu_gateway_test/         # Feishu gateway integration entry
├── internal/
│   ├── agent/                       # Agent construction (model + tools)
│   ├── channel/                     # Channel abstraction + Feishu implementation
│   ├── config/                      # Runtime config from environment variables
│   ├── gateway/                     # Message orchestration pipeline
│   └── tool/                        # Built-in tools (exec)
├── test/
│   └── agent_test.go                # Basic agent invocation tests
├── go.mod
└── go.sum

Requirements

  • Go 1.25.4 (from go.mod).
  • AI model endpoint variables:
    • TINYCLAW_API_KEY
    • TINYCLAW_BASE_URL
  • For Feishu mode only:
    • FEISHU_APP_ID
    • FEISHU_APP_SECRET

Quick Start

git clone https://github.com/ihoooohi/TinyClaw.git
cd TinyClaw
go mod tidy

export TINYCLAW_API_KEY="your-api-key"
export TINYCLAW_BASE_URL="https://your-openai-compatible-endpoint"

# Optional (required only for Feishu gateway mode)
export FEISHU_APP_ID="your-feishu-app-id"
export FEISHU_APP_SECRET="your-feishu-app-secret"

# 1) Run local CLI mode
go run ./cmd

# 2) Run Feishu gateway mode
go run ./cmd/feishu_gateway_test

How It Works (Core Flow)

  1. internal/config loads model config from environment variables.
  2. internal/agent builds a ReAct agent with an OpenAI-compatible chat model and the exec tool.
  3. In CLI mode, user input is sent directly to the agent and printed back.
  4. In Feishu gateway mode:
    • internal/channel/feishu receives Feishu events.
    • internal/gateway converts inbound events into agent messages.
    • The generated reply is sent back to Feishu chat.

Minimal Example

Local CLI mode:

go run ./cmd
# You: 请执行命令: pwd
# AI: <agent reply, possibly using exec tool>

Feishu connectivity check:

go run ./cmd/feishu_channel_test

License Note

This project is licensed under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages