Skip to content

phainia/AEVITAS-old

Repository files navigation

AEVITAS

Personal AI assistant built on agentsdk-go, with architecture inspired by OpenClaw and earlier myclaw workflow patterns.

Features

  • CLI Agent - Single message or interactive REPL mode
  • Gateway - Full orchestration: channels + cron + heartbeat
  • Telegram Channel - Receive and send messages via Telegram bot
  • Feishu Channel - Receive and send messages via Feishu (Lark) bot
  • WeCom Channel - Receive inbound messages and send markdown replies via WeCom intelligent bot API mode
  • Multi-Provider - Support for Anthropic and OpenAI models
  • Cron Jobs - Scheduled tasks managed via WebSocket RPC gateway
  • WebSocket RPC - JSON-RPC over WebSocket for cron management (compatible with openclaw protocol)
  • Heartbeat - Periodic tasks from HEARTBEAT.md
  • Skills - Pluggable skill system (see skills/README.md)
  • Tool Progress - Per-call tool logging with parameters sent to Telegram in real time
  • Telegram Streaming UX - Two-slot display (tool calls + draft response) with live preview updates
  • Usage HUD - Unified /usage + auto-threshold notifications (30% / 50% / 80%) with context window bar

Quick Start

# Build
make build

# Interactive config setup
make setup

# Or initialize config and workspace manually
make onboard

# Set your API key
export AEVITAS_API_KEY=your-api-key

# Run agent (single message)
./aevitas agent -m "Hello"

# Run agent (REPL mode)
make run

# Start gateway (channels + cron + heartbeat + RPC)
make gateway

# Skills management
make skills-list              # List installed skills
make skills-install [name]    # Install skill(s) (with y/n confirmation)
make skills-update [name]     # Update skill(s) (with y/n confirmation)
make skills-uninstall <name>  # Uninstall a skill (with y/n confirmation)

Makefile Targets

Target Description
make build Build binary
make run Run agent REPL
make gateway Start gateway (channels + cron + heartbeat + RPC)
make onboard Initialize config and workspace
make status Show aevitas status
make setup Interactive config setup (generates ~/.aevitas/config.json)
make skills-list List installed skills
make skills-install [name] Install skill(s) (name or all)
make skills-update [name] Update skill(s) (name or all)
make skills-uninstall <name> Uninstall a skill (required)
make test Run tests
make test-race Run tests with race detection
make test-cover Run tests with coverage report
make docker-up Docker build and start
make docker-down Docker stop
make lint Run golangci-lint

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      CLI (cobra)                        β”‚
β”‚              agent | gateway | onboard | status          β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                  β”‚
       β–Ό                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent Mode  β”‚  β”‚              Gateway                  β”‚
β”‚  (single /   β”‚  β”‚                                       β”‚
β”‚   REPL)      β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚ Channel β”‚  β”‚ Cron β”‚  β”‚Heartbeatβ”‚  β”‚
       β”‚          β”‚  β”‚ Manager β”‚  β”‚      β”‚  β”‚         β”‚  β”‚
       β”‚          β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β””β”€β”€β”¬β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β”‚
       β”‚          β”‚       β”‚          β”‚           β”‚        β”‚
       β–Ό          β”‚       β–Ό          β–Ό           β–Ό        β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  agentsdk-go β”‚  β”‚  β”‚          Message Bus             β”‚  β”‚
β”‚   Runtime    │◄──  β”‚    Inbound ←── Channels          β”‚  β”‚
β”‚              β”‚  β”‚  β”‚    Outbound ──► Channels          β”‚  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                  β”‚                 β”‚                      β”‚
                  β”‚                 β–Ό                      β”‚
                  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                  β”‚  β”‚      agentsdk-go Runtime         β”‚  β”‚
                  β”‚  β”‚   (ReAct loop + tool execution)  β”‚  β”‚
                  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                  β”‚                                       β”‚
                  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                  β”‚  β”‚    WebSocket RPC Server           β”‚  β”‚
                  β”‚  β”‚  ws://0.0.0.0:18790              β”‚  β”‚
                  β”‚  β”‚  cron.list | cron.add | cron.run  β”‚  β”‚
                  β”‚  β”‚  cron.remove | cron.enable        β”‚  β”‚
                  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow (Gateway Mode):
  Telegram/Feishu/WeCom ──► Channel ──► Bus.Inbound ──► processLoop
                                                       β”‚
                                                       β–Ό
                                                Runtime.Run()
                                                       β”‚
                                                       β–Ό
                                        Bus.Outbound ──► Channel ──► Telegram/Feishu/WeCom

RPC Flow (Skill β†’ Cron):
  todoist cron-add/list/run ──► ws://127.0.0.1:18790 ──► cron.Service

Project Structure

cmd/aevitas/          CLI entry point (agent, gateway, onboard, status)
internal/
  bus/               Message bus (inbound/outbound channels)
  channel/           Channel interface + Telegram + Feishu + WeCom implementations
  config/            Configuration loading (JSON + env vars)
  cron/              Cron job scheduling with JSON persistence
  gateway/           Gateway orchestration (bus + runtime + channels + RPC)
  heartbeat/         Periodic heartbeat service
  rpc/               WebSocket RPC server + cron handlers
skills/              Skill packages (see skills/README.md)
docs/
  telegram-setup.md  Telegram bot setup guide
  feishu-setup.md    Feishu bot setup guide
  wecom-setup.md     WeCom intelligent bot setup guide
scripts/
  setup.sh           Interactive config generator
workspace/
  AGENTS.md          Agent system prompt
  SOUL.md            Agent personality

Configuration

Run make setup for interactive config, or copy config.example.json to ~/.aevitas/config.json:

{
  "agent": {
    "workspace": "~/.aevitas/workspace",
    "model": "claude-sonnet-4-5-20250929",
    "maxTokens": 8192,
    "temperature": 0.7,
    "maxToolIterations": 100,
    "historyLimit": 30,
    "autoRecall": true,
    "toolLog": {
      "enabled": true,
      "interval": 1
    },
    "compaction": {
      "enabled": true,
      "threshold": 0.8
    },
    "contextWindow": {
      "tokens": 200000,
      "warnRatio": 0.8,
      "hardMinTokens": 2000
    },
    "memoryFlush": {
      "enabled": true,
      "reserveTokensFloor": 20000,
      "softThresholdTokens": 4000
    },
    "tokenTracking": {
      "enabled": true
    },
    "guard": {
      "inputEnabled": true,
      "outputEnabled": true
    }
  },
  "provider": {
    "type": "anthropic",
    "apiKey": "your-api-key",
    "baseUrl": ""
  },
  "gateway": {
    "host": "0.0.0.0",
    "port": 18790
  },
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "your-bot-token",
      "allowFrom": ["123456789"],
      "proxy": ""
    },
    "feishu": {
      "enabled": false,
      "appId": "",
      "appSecret": "",
      "allowFrom": []
    },
    "wecom": {
      "enabled": false,
      "token": "",
      "encodingAESKey": "",
      "receiveId": "",
      "port": 9886,
      "allowFrom": []
    }
  },
  "tools": {
    "braveApiKey": "",
    "execTimeout": 60,
    "restrictToWorkspace": true
  }
}

Guard switches:

  • agent.guard.inputEnabled: run prompt exfiltration guard before model call
  • agent.guard.outputEnabled: redact outputs that appear to leak system prompt content
  • agent.tokenTracking.enabled: enable session/total token aggregation and token logs

Provider Types

Type Config Env Vars
anthropic (default) "type": "anthropic" AEVITAS_API_KEY, ANTHROPIC_API_KEY
openai "type": "openai" OPENAI_API_KEY

When using OpenAI, set the model to an OpenAI model name (e.g., gpt-4o).

Environment Variables

Variable Description
AEVITAS_API_KEY API key (any provider)
ANTHROPIC_API_KEY Anthropic API key
OPENAI_API_KEY OpenAI API key (auto-sets type to openai)
AEVITAS_BASE_URL Custom API base URL
AEVITAS_TELEGRAM_TOKEN Telegram bot token
AEVITAS_FEISHU_APP_ID Feishu app ID
AEVITAS_FEISHU_APP_SECRET Feishu app secret
AEVITAS_WECOM_TOKEN WeCom intelligent bot callback token
AEVITAS_WECOM_ENCODING_AES_KEY WeCom intelligent bot callback EncodingAESKey
AEVITAS_WECOM_RECEIVE_ID Optional receive ID for strict decrypt validation

Prefer environment variables over config files for sensitive values like API keys.

Channel Setup

Telegram

See docs/telegram-setup.md for detailed setup guide.

Quick steps:

  1. Create a bot via @BotFather on Telegram
  2. Set token in config or AEVITAS_TELEGRAM_TOKEN env var
  3. Run make gateway

Telegram behavior highlights:

  • Streamed replies use preview updates during generation and finalize after completion.
  • Tool progress is rendered in a dedicated tool-call block.
  • /usage uses the same HUD formatter as automatic usage notices.
  • Automatic usage notices are sent as standalone messages only when context usage crosses 30% / 50% / 80%.

Feishu (Lark)

See docs/feishu-setup.md for detailed setup guide.

Quick steps:

  1. Create an app at Feishu Open Platform
  2. Enable Bot capability
  3. Add permissions: im:message, im:message:send_as_bot
  4. Subscribe to event: im.message.receive_v1
  5. Set appId, appSecret in config
  6. Run make gateway (no webhook/domain needed in long connection mode)

WeCom

See docs/wecom-setup.md for detailed setup guide.

Quick steps:

  1. Create a WeCom intelligent bot in API mode and get token, encodingAESKey
  2. Configure callback URL: https://your-domain/wecom/bot
  3. Set token and encodingAESKey in both WeCom console and aevitas config
  4. Optionally set receiveId if you need strict decrypt receive-id validation
  5. Optional: set allowFrom to your user ID(s) as whitelist (if unset/empty, inbound from all users is allowed)
  6. Run make gateway

WeCom notes:

  • Outbound uses response_url and sends markdown payloads
  • response_url is short-lived (often single-use); delayed or repeated replies may fail
  • Outbound markdown content over 20480 bytes is truncated

Docker Deployment

Build and Run

docker build -t aevitas .

docker run -d \
  -e AEVITAS_API_KEY=your-api-key \
  -e AEVITAS_TELEGRAM_TOKEN=your-token \
  -p 18790:18790 \
  -p 9886:9886 \
  -v aevitas-data:/root/.aevitas \
  aevitas

Docker Compose

# Create .env from example
cp .env.example .env
# Edit .env with your credentials

# Start gateway
docker compose up -d

# View logs
docker compose logs -f aevitas

Security

  • ~/.aevitas/config.json is set to chmod 600 (owner read/write only)
  • .gitignore excludes config.json, .env, and workspace memory files
  • Use environment variables for sensitive values in CI/CD and production
  • Never commit real API keys or tokens to version control

Testing

make test            # Run all tests
make test-race       # Run with race detection
make test-cover      # Run with coverage report
make lint            # Run golangci-lint
Package Coverage
internal/bus 100.0%
internal/heartbeat 97.1%
internal/cron 94.4%
internal/config 91.2%
internal/channel 90.5%
internal/gateway 90.2%
cmd/aevitas 82.3%

Built-in Commands (Chat)

  • /start - Welcome message
  • /help - Show command/help overview
  • /skill list - List installed skills
  • /reset - Clear current session history
  • /restart - Restart gateway process (production mode)
  • /logs [lines|all] - Show gateway logs
  • /status - Show gateway status
  • /usage [total] - Show usage HUD (session or total)
  • /chatid - Show chat and sender IDs
  • /cleanup - Scan/clean temporary screenshot files

License

MIT

About

Advanced Evolutionary Virtual Intelligence with Temporal Awareness System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors