| name | feibot-ops |
| description | Standardize lifecycle operations for the local feibot gateway service via launchd. Supports multiple instances, listing all instances, and provides guidance on allowFrom configuration. |
Mybot Ops
Overview
Use this skill to run repeatable and safe lifecycle actions for feibot through one script.
launchd is the primary supervisor (auto-start on login + keepalive).
Supports multiple instances with different configurations.
Quick Start
/path/to/feibot-ops/scripts/manage.sh <command>
Commands:
list - List all feibot instances (running and installed)
start - Ensure launchd service is loaded and running
stop - Stop launchd service
restart - Restart gateway
status - Show launchd/process/log status
logs [N] - Tail last N log lines (default: 120)
install - Write plist and bootstrap launchd service
uninstall - Stop service, disable label, remove plist
CLI Options
-c, --config FILE Config file path
-r, --repo DIR Repository directory
-l, --label LABEL Launchd label (must be unique per instance)
-d, --run-dir DIR Runtime directory
-h, --help Show help
Examples
./scripts/manage.sh list
./scripts/manage.sh restart
./scripts/manage.sh -c /path/to/config.json status
./scripts/manage.sh -l ai.feibot.prod -c /prod/config.json restart
./scripts/manage.sh -r /path/to/feibot -c /path/to/config.json -l feibot-dev -d /path/to/run status
Creating a New Instance
When creating a new instance:
-
Create directory structure:
mkdir -p ~/botname/workspace ~/botname/sessions ~/botname/run
-
Create config.json with:
- Set
name to the bot's name (e.g., "suzy", "zoe")
- Configure Feishu channel (appId, appSecret)
- Set the model in
agents.defaults.model
- Use
allowFrom: [] for open access in testing, or a specific open_id list for restricted access (see below)
-
Create AGENTS.md in the workspace:
# Agent Instructions
You are a helpful AI assistant. Your name is <Bot Name>. Be concise, accurate, and friendly.
## Guidelines
- Always explain what you're doing before taking actions
- Ask for clarification when the request is ambiguous
- Use tools to help accomplish tasks
- `memory/MEMORY.md` is approved global context; `memory/HISTORY.md` is the searchable session index
-
Install and start:
./scripts/manage.sh -l ai.botname.gateway -c ~/botname/config.json -r /path/to/feibot -d ~/botname/run install
-
Configure allowFrom (see next section)
⚠️ Important: allowFrom Configuration
The allowFrom field in the Feishu channel config is special:
- It should contain Feishu user
open_id values.
- Empty list
[] means allow all.
- For restricted mode, collect IDs from logs after users send messages. IDs appear like:
Access denied for sender ou_xxxxxxxxxxxx on channel feishu
How to configure restricted allowFrom:
- Start the bot and have the user send a message
- Check the logs:
tail -f /path/to/run/gateway.log | grep "Access denied"
- Copy the
ou_xxx ID from the log
- Add it to the
allowFrom list in config.json
- Restart the bot
Example:
"allowFrom": [
"ou_6287aa1fb258625bd15f8f9789a04799",
"ou_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
]
Environment Contract
- Repository:
$REPO_DIR
- Config:
$CONFIG_FILE
- Runtime dir:
$RUN_DIR
- Pid file:
$RUN_DIR/gateway.pid
- Log file:
$RUN_DIR/gateway.log
- launchd label:
$LAUNCHD_LABEL
- launchd plist:
~/Library/LaunchAgents/$LAUNCHD_LABEL.plist
Rules
- Do not use
pkill -9 unless normal stop flow fails.
- Each instance must have a unique
LAUNCHD_LABEL.
- After
restart, confirm both launchd state and process existence.
- Remind users to choose
allowFrom mode explicitly: [] (open) or a restricted allow-list.
Output Contract
When responding to the user after running commands, always include:
- action executed
- resulting PID (if running)
- launchd state
- key log lines (startup or error)
- evidence references: exact log file path + timestamp(s) used