| name | mercury-agent-deployment |
| description | Deploy and configure Mercury Agent, a soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access |
| triggers | ["set up mercury agent","configure ai agent with telegram","deploy mercury with daemon mode","install mercury agent cli","configure second brain memory","set up mercury permissions","create mercury agent skill","schedule mercury agent tasks"] |
Mercury Agent Deployment
Skill by ara.so — AI Agent Skills collection.
Mercury is a soul-driven AI agent framework with permission-hardened tools, token budgets, multi-channel access (CLI + Telegram), persistent memory (Second Brain), and 24/7 daemon mode. It runs TypeScript-based agents with 31 built-in tools, extensible skills, and SQLite-backed memory.
Installation
Quick Start (npx)
npx @cosmicstack/mercury-agent
Global Installation
npm i -g @cosmicstack/mercury-agent
mercury
First run triggers setup wizard for:
- Agent name
- LLM provider (OpenAI, Anthropic, etc.)
- Optional Telegram bot integration
- Permission defaults
Core Commands
Daemon & Service Management
mercury up
mercury start
mercury start -d
mercury restart
mercury stop
mercury logs
mercury status
mercury service install
mercury service status
mercury service uninstall
Configuration
mercury doctor
mercury doctor --platform
mercury setup
mercury status
mercury upgrade
Telegram Access Management
mercury telegram list
mercury telegram approve <code|id>
mercury telegram reject <id>
mercury telegram remove <id>
mercury telegram promote <id>
mercury telegram demote <id>
mercury telegram reset
Configuration Files
All runtime data in ~/.mercury/:
~/.mercury/
├── mercury.yaml # Main config
├── .env # API keys
├── permissions.yaml # Tool capabilities
├── token-usage.json # Budget tracking
├── schedules.yaml # Scheduled tasks
├── soul/ # Personality files
│ ├── soul.md
│ ├── persona.md
│ ├── taste.md
│ └── heartbeat.md
├── skills/ # Installed skills
├── memory/
│ ├── short-term/ # Conversation JSON
│ ├── long-term/ # Extracted facts (JSONL)
│ ├── episodic/ # Event log (JSONL)
│ └── second-brain/ # SQLite + FTS5
└── logs/
Example mercury.yaml
agentName: Mercury
soul:
path: ~/.mercury/soul
providers:
- type: openai
model: gpt-4o
apiKeyEnv: OPENAI_API_KEY
- type: anthropic
model: claude-3-5-sonnet-20241022
apiKeyEnv: ANTHROPIC_API_KEY
channels:
telegram:
enabled: true
tokenEnv: TELEGRAM_BOT_TOKEN
persistence: ~/.mercury/telegram.json
permissions:
defaultMode: ask
filesystem:
read: ask
write: ask
delete: ask
shell:
execute: ask
blocklist:
- sudo
- rm -rf /
- mkfs
- dd if=
budget:
daily: 200000
warningThreshold:
Example .env
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
SPOTIFY_CLIENT_ID=...
SPOTIFY_CLIENT_SECRET=...
MERCURY_SPOTIFY_ART=1
SECOND_BRAIN_ENABLED=false
In-Chat Commands
These work in both CLI and Telegram without consuming tokens:
/help
/status
/tools
/skills
/budget
/budget override
/budget reset
/budget set <n>
/permissions
/view
/stream
/code agent <task>
/ws exit
/tasks
/memory
/unpair
Built-in Tools
Filesystem Tools
read_file({ path: "package.json" })
write_file({ path: "config.json", content: "{...}" })
create_file({ path: "new.ts", content: "export ..." })
edit_file({ path: "app.ts", operations: [...] })
list_dir({ path: "src/" })
delete_file({ path: "temp.txt" })
send_file({ path: "report.pdf" })
Shell Tools
run_command({ command: "npm install" })
cd({ path: "/path/to/project" })
approve_command({ command: "git push" })
Git Tools
git_status()
git_diff({ staged: true })
git_log({ limit: 10 })
git_add({ files: ["src/app.ts"] })
git_commit({ message: "feat: add feature" })
git_push()
Web Tools
fetch_url({ url: "https://api.example.com/data" })
Messaging Tools
send_message({
channel: "telegram",
content: "Build complete!"
})
Scheduler Tools
schedule_task({
name: "morning-standup",
cron: "0 9 * * *",
task: "Send standup reminder"
})
schedule_task({
name: "reminder",
delay_seconds: 900,
task: "Check deployment status"
})
list_scheduled_tasks()
cancel_scheduled_task({ name: "morning-standup" })
Skill Management Tools
install_skill({ name: "web-search" })
list_skills()
use_skill({
name: "web-search",
query: "latest TypeScript features"
})
Creating Custom Skills
Skills are markdown files in ~/.mercury/skills/<skill-name>/SKILL.md:
Example: GitHub Integration Skill
mkdir -p ~/.mercury/skills/github-pr-review
~/.mercury/skills/github-pr-review/SKILL.md:
---
name: github-pr-review
description: Review GitHub pull requests and provide feedback
triggers:
- "review this pull request"
- "check github pr"
- "analyze code changes"
---
# GitHub PR Review Skill
## Prerequisites
```bash
# Install GitHub CLI
brew install gh # macOS
# or: sudo apt install gh # Linux
# Authenticate
gh auth login
Usage
When user requests PR review:
- Fetch PR diff:
gh pr diff <number>
- Analyze changes for:
- Code quality
- Security issues
- Breaking changes
- Test coverage
- Post review:
gh pr review <number> --comment -b "feedback"
Example Flow
gh pr list
gh pr diff 123
gh pr review 123 --approve -b "LGTM! Great work on error handling."
gh pr review 123 --request-changes -b "Please add tests for the new endpoint."
Best Practices
- Always check CI status before review
- Look for security vulnerabilities in dependencies
- Verify backward compatibility
- Check for adequate test coverage
### Install Custom Skill
```bash
# Mercury auto-detects skills in ~/.mercury/skills/
# Or install programmatically:
mercury # Start agent
# In chat:
# User: "Install the github-pr-review skill"
# Mercury uses: install_skill
Second Brain Memory System
Mercury's persistent memory system with automatic extraction and recall.
Memory Types
- identity — Core facts about user (name, role, location)
- preference — User preferences (tools, coding style, communication)
- goal — Objectives and targets
- project — Active projects and context
- habit — Recurring patterns and routines
- decision — Important choices made
- constraint — Limitations and boundaries
- relationship — People and connections
- episode — Significant events
- reflection — Patterns and insights
Memory Lifecycle
Memory Commands
/memory
/memory search AI
/memory pause
/memory resume
/memory clear
SECOND_BRAIN_ENABLED=false
memory:
secondBrain:
enabled: false
Memory Data Structure
{
type: "preference",
content: "User prefers TypeScript over JavaScript for new projects",
confidence: 0.95,
importance: 0.8,
durability: "durable",
scope: "active",
extractedAt: "2026-05-16T10:30:00Z",
lastAccessedAt: "2026-05-16T10:30:00Z"
}
Permission System
Permission Modes
/permissions
permissions:
defaultMode: ask
Permission Configuration
~/.mercury/permissions.yaml:
filesystem:
read: ask
write: ask
delete: ask
scopes:
- path: ~/projects/safe-dir
read: allow
write: allow
shell:
execute: ask
blocklist:
- sudo
- rm -rf /
- mkfs
- dd if=
- "> /dev/"
allowlist:
- npm
- git
- node
messaging:
send: allow
git:
read: allow
write: ask
web:
fetch: ask
Scope Approval
Telegram Integration
Bot Setup
- Create bot with @BotFather
- Get token from BotFather
- Add to
~/.mercury/.env:
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
- Enable in
mercury.yaml:
channels:
telegram:
enabled: true
tokenEnv: TELEGRAM_BOT_TOKEN
persistence: ~/.mercury/telegram.json
First-Time Pairing
mercury up
/start
mercury telegram approve TG-ABC123
Multi-User Access
mercury telegram list
mercury telegram approve <user-id>
mercury telegram reject <user-id>
mercury telegram promote <user-id>
mercury telegram demote <user-id>
mercury telegram remove <user-id>
Telegram Features
Token Budget Management
Budget Configuration
budget:
daily: 200000
warningThreshold: 0.7
Budget Commands
/budget
/budget override
/budget reset
/budget set 300000
Auto-Concise Mode
{
"2026-05-16": {
"used": 150000,
"limit": 200000,
"requests": 42
}
}
CLI Workspace Mode
Keyboard Shortcuts
Ctrl+P
Ctrl+X
Esc / Ctrl+Q
Ctrl+V
Code Agent Delegation
/code agent implement user authentication with JWT
Daemon Mode Production Setup
Systemd (Linux)
mercury service install
sudo loginctl enable-linger $USER
systemctl --user status mercury-agent
systemctl --user restart mercury-agent
systemctl --user stop mercury-agent
journalctl --user -u mercury-agent -f
LaunchAgent (macOS)
mercury service install
launchctl list | grep mercury
launchctl unload ~/Library/LaunchAgents/org.cosmicstack.mercury-agent.plist
launchctl load ~/Library/LaunchAgents/org.cosmicstack.mercury-agent.plist
mercury logs
Task Scheduler (Windows)
mercury service install
schtasks /query /tn "MercuryAgent"
mercury service status
mercury service uninstall
Crash Recovery
Common Patterns
Morning Standup Automation
mercury
Project Context Persistence
File Scope Workflow
Multi-Channel Notifications
send_message({
channel: "telegram",
content: "Deployment to production successful!"
})
Troubleshooting
Agent Not Responding
mercury status
mercury logs
mercury restart
mercury stop
mercury up
Telegram Bot Not Working
cat ~/.mercury/.env | grep TELEGRAM_BOT_TOKEN
mercury telegram reset
Permission Errors
cat ~/.mercury/permissions.yaml
mercury doctor
nano ~/.mercury/permissions.yaml
Token Budget Exceeded
/budget
/budget reset
/budget set 500000
/budget override
Memory Database Issues
/memory
/memory clear
echo "SECOND_BRAIN_ENABLED=false" >> ~/.mercury/.env
mercury restart
Service Won't Start on Boot
sudo loginctl enable-linger $USER
launchctl list | grep mercury
schtasks /query /tn "MercuryAgent"
mercury service uninstall
mercury service install
High Memory Usage
ps aux | grep mercury
rm -rf ~/.mercury/memory/short-term/*.json
mercury restart
Skill Not Loading
/skills
ls -la ~/.mercury/skills/
mercury
mkdir -p ~/.mercury/skills/my-skill
nano ~/.mercury/skills/my-skill/SKILL.md
Resources