Cotton Agent is an independent intelligent daemon based on Node.js + TypeScript + Vercel AI SDK. It acts as an automated O&M AI or a humanoid NPC administrator by interfacing with server logs and RCON, without intruding into the server process lifecycle.
- Decoupled Architecture: Runs independently; server or agent crashes do not affect each other.
- Adaptive Command Dictionary: Automatically fetches valid server commands upon startup to prevent hallucinations.
- Agent Loop:
- Summarization: Compresses routine logs into concise situational memory to save tokens.
- Priority Interrupt: Immediately triggers high-reasoning responses for player mentions (
@agent) or fatal server errors.
- Player Memory [NEW]: Individual Markdown-based profiles for each player to track preferences and interaction history.
- Permission Scaling [NEW]: AI-driven player upgrades (Level C -> A) based on behavior and contributions (Max level A restricted).
The agent operates as a fully decoupled service:
- Log Tailer: Real-time monitoring of
latest.log. - Agent Loop: Core logic engine for state management.
- Tool System: Dynamic injection of RCON commands and file operations.
- Player Manager: Persistent storage of player profiles and memory.
Ensure RCON is enabled in server.properties:
enable-rcon=true
rcon.port=25575
rcon.password=your_secure_passwordgit clone https://github.com/EnderRomantice/cotton-agent.git
cd cotton-agent
pnpm installCopy .env.example to .env and fill in your credentials:
RCON_HOST=127.0.0.1
RCON_PORT=25575
RCON_PASSWORD=your_password
MC_LOG_PATH=/path/to/latest.log
OPENAI_API_KEY=sk-...pnpm start- Personality: Modify
src/prompts/SOUL.md. - Capabilities: Add new Vercel tools in
src/core/tools.ts. - Trigger Rules: Adjust interrupt logic in
src/core/agentLoop.ts. - Skills: Add
.mdinstructions tosrc/skills/to expand AI knowledge.
MIT