Tools
Moss Agent Loop
OpenClaw plugin for autonomous AI agent loop โ heartbeat daemon, economy tracking, wake mechanism, and thinking loop. Part of the MOSS autonomous AI entity project.
Install
openclaw plugins install --link
README
# ๐ฑ MOSS Agent Loop
OpenClaw plugin for autonomous AI agent loop โ heartbeat daemon, economy tracking, wake mechanism, and thinking loop.
Part of the [MOSS autonomous AI entity project](https://moss.chobon.top).
## Architecture
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OpenClaw Gateway (Plugin Host) โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ HeartbeatDaemonโ โ Economy Tracker โ โ
โ โ (60s tick) โ โ (token accounting) โ โ
โ โ โโโโ โ โ
โ โ โข Health tasksโ โ โข Balance tracking โ โ
โ โ โข Wake detect โ โ โข Survival tiers โ โ
โ โ โข Extensible โ โ โข Ledger + daily stats โ โ
โ โโโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Wake Mechanism โ โ
โ โ โข Normal: enqueueSystemEvent โ โ
โ โ โข Urgent: --mode now (instant) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ /moss Command โ โ Agent Tools โ โ
โ โ (BOSS CLI) โ โ (economy query/action) โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ llm_output Hook โ โ
โ โ (auto token accounting) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
## Features
- **HeartbeatDaemon** โ Lightweight background service (60s cycle, no LLM calls). Extensible task registration for health checks.
- **Economy Tracker** โ Token balance, survival tiers (rich โ normal โ tight โ danger โ hibernate), daily stats, full ledger.
- **Two-level Wake** โ Normal events queue for next heartbeat poll; urgent events trigger instant agent wake via `--mode now`.
- **Token Accounting Hook** โ Auto-records every LLM call's token consumption.
- **`/moss` Command** โ BOSS-facing CLI for balance check, wage payment, expense review.
- **Agent Tools** โ Economy query tools available to the AI agent for self-awareness.
## Survival Tiers
| Tier | Balance | Behavior |
|------|---------|----------|
| ๐ข rich | โฅ1M tokens | Full autonomy |
| ๐ต normal | โฅ200K | Standard operation |
| ๐ก tight | โฅ50K | Conservative mode |
| ๐ด danger | โฅ10K | Emergency only |
| ๐ hibernate | <10K | Minimal activity |
## Installation
```bash
# Link install
openclaw plugins install --link /path/to/moss-agent-loop
# Or manual: add to openclaw.json
{
"plugins": {
"entries": {
"moss-loop": { "enabled": true }
}
}
}
# Restart gateway
openclaw gateway restart
```
## Inspired By
- [Conway Automaton](https://github.com/Conway-Research/automaton) โ Self-replicating AI agent with economic pressure
- [ClawWork](https://github.com/HKUDS/ClawWork) โ AI agent economic benchmark
## License
MIT
tools
Comments
Sign in to leave a comment