Skip to content

🦞 Claw is a personal AI assistant you run on your own devices, but nano.

License

Notifications You must be signed in to change notification settings

hustcc/nano-claw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

nano-claw

🦞 Claw is a Ultra-Lightweight Personal AI Assistant you run on your own devices.

npm version TypeScript Node.js License

πŸ“– About

nano-claw is a TypeScript + Node.js implementation of nanobot, an ultra-lightweight personal AI assistant inspired by OpenClaw.

  • πŸͺΆ Ultra-Lightweight: Just ~4,500 lines of core TypeScript code
  • πŸ”¬ Research-Ready: Clean, readable code that's easy to understand and extend
  • ⚑️ Lightning Fast: Minimal footprint for faster startup and lower resource usage
  • πŸ’Ž Easy-to-Use: Simple configuration and intuitive CLI

πŸ—οΈ Architecture

nano-claw/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agent/          # 🧠 Core agent logic
β”‚   β”‚   β”œβ”€β”€ loop.ts     #    Agent loop (LLM ↔ tool execution)
β”‚   β”‚   β”œβ”€β”€ context.ts  #    Prompt builder
β”‚   β”‚   β”œβ”€β”€ memory.ts   #    Persistent memory
β”‚   β”‚   β”œβ”€β”€ skills.ts   #    Skills loader
β”‚   β”‚   β”œβ”€β”€ subagent.ts #    Background task execution
β”‚   β”‚   └── tools/      #    Built-in tools
β”‚   β”œβ”€β”€ skills/         # 🎯 Bundled skills (github, weather, etc.)
β”‚   β”œβ”€β”€ channels/       # πŸ“± Chat channel integrations
β”‚   β”œβ”€β”€ bus/            # 🚌 Message routing
β”‚   β”œβ”€β”€ cron/           # ⏰ Scheduled tasks
β”‚   β”œβ”€β”€ heartbeat/      # πŸ’“ Proactive wake-up
β”‚   β”œβ”€β”€ providers/      # πŸ€– LLM providers (OpenRouter, etc.)
β”‚   β”œβ”€β”€ session/        # πŸ’¬ Session management
β”‚   β”œβ”€β”€ config/         # βš™οΈ Configuration
β”‚   └── cli/            # πŸ–₯️ Command-line interface
└── package.json

✨ Features

Core Agent

  • Agent Loop: LLM and tool execution loop
  • Context Builder: Construct prompt context
  • Memory: Persistent conversation memory
  • Skills Loader: Dynamic skill loading from Markdown files
  • Subagent: Background task management
  • Tools: Built-in tools (shell, file operations, etc.)

LLM Providers

Support for multiple LLM providers:

  • OpenRouter (recommended, access to all models)
  • Anthropic (Claude)
  • OpenAI (GPT)
  • DeepSeek
  • Groq
  • Gemini
  • MiniMax
  • AiHubMix (API gateway, all models) ✨ NEW
  • Dashscope (Qwen)
  • Moonshot (Kimi)
  • Zhipu (GLM)
  • vLLM (local models)

Chat Channels

Support for multiple chat platforms:

  • Telegram βœ… Implemented
  • Discord βœ… Implemented
  • DingTalk / ι’‰ι’‰ βœ… Implemented
  • WhatsApp (config ready)
  • Feishu / 飞书 (config ready)
  • Slack (config ready)
  • Email (config ready)
  • QQ (config ready)
  • Mochat (config ready)

Note: Telegram, Discord, and DingTalk channel adapters are fully implemented. Additional channel adapters can be added by extending the BaseChannel class.

Other Features

  • Gateway Server: Central hub for channel management ✨ NEW
  • Message Bus: Event-driven message routing ✨ NEW
  • Cron Tasks: Schedule tasks with cron expressions
  • Heartbeat: Proactive wake-up mechanism ✨ NEW
  • Session Management: Multi-user, multi-channel session support ✨ ENHANCED
  • Subagent Tasks: Background task execution ✨ NEW
  • Configuration: JSON configuration files with Zod validation

πŸ“¦ Installation

npm install -g nano-claw

pnpm install -g nano-claw

yarn global add nano-claw

πŸš€ Quick Start

1. Initialize

nano-claw onboard

2. Configure (~/.nano-claw/config.json)

For OpenRouter (recommended):

{
  "providers": {
    "openrouter": {
      "apiKey": "sk-or-v1-xxx"
    }
  },
  "agents": {
    "defaults": {
      "model": "anthropic/claude-opus-4-5"
    }
  }
}

3. Chat

nano-claw agent -m "What is 2+2?"

πŸ”§ CLI Commands

  • nano-claw onboard - Initialize configuration
  • nano-claw agent -m "..." - Chat with agent (single message)
  • nano-claw agent - Interactive mode
  • nano-claw gateway - Start gateway server for channels ✨ NEW
  • nano-claw status - Show system status
  • nano-claw channels login - Login to channels (e.g., WhatsApp)
  • nano-claw cron add/list/remove - Manage scheduled tasks

πŸ‘¨β€πŸ’» Development

# Watch mode (auto-rebuild on changes)
npm run dev

# Lint code
npm run lint

# Format code
npm run format

# Run tests
npm run test

πŸ“š Examples & Guides

Comprehensive examples to help you get started and master nano-claw:

βš™οΈ Configuration

Configuration file location: ~/.nano-claw/config.json

See CONFIGURATION.md for detailed configuration options including:

  • All 11 LLM providers setup
  • Agent behavior customization
  • Tool execution security
  • Chat channel integrations
  • Environment variables

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

MIT License - see LICENSE file for details

About

🦞 Claw is a personal AI assistant you run on your own devices, but nano.

Topics

Resources

License

Contributing

Stars

Watchers

Forks