chore(hq): daily sync 2026-02-16
This commit is contained in:
97
hq/workspaces/shared/skills/orchestrate/autonomous-mode.sh
Executable file
97
hq/workspaces/shared/skills/orchestrate/autonomous-mode.sh
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
# Autonomous / Vacation Mode Control
|
||||
# ONLY Antoine (CEO) can activate this.
|
||||
# Usage:
|
||||
# bash autonomous-mode.sh set <normal|autonomous|full-auto> [duration_days] [notes]
|
||||
# bash autonomous-mode.sh status
|
||||
set -euo pipefail
|
||||
|
||||
MODE_FILE="/home/papa/atomizer/dashboard/autonomous-mode.json"
|
||||
ACTION="${1:?Usage: autonomous-mode.sh set|status}"
|
||||
|
||||
case "$ACTION" in
|
||||
set)
|
||||
LEVEL="${2:?Specify level: normal, autonomous, or full-auto}"
|
||||
DURATION="${3:-0}" # days, 0 = indefinite until manually changed
|
||||
NOTES="${4:-}"
|
||||
|
||||
if [[ "$LEVEL" != "normal" && "$LEVEL" != "autonomous" && "$LEVEL" != "full-auto" ]]; then
|
||||
echo "❌ Invalid level: $LEVEL (must be: normal, autonomous, full-auto)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python3 -c "
|
||||
import json
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
level = '$LEVEL'
|
||||
duration = int('$DURATION')
|
||||
notes = '$NOTES'
|
||||
now = datetime.now(timezone.utc)
|
||||
|
||||
expires = None
|
||||
if duration > 0:
|
||||
expires = (now + timedelta(days=duration)).isoformat()
|
||||
|
||||
data = {
|
||||
'level': level,
|
||||
'activated_by': 'antoine',
|
||||
'activated_at': now.isoformat(),
|
||||
'expires_at': expires,
|
||||
'auto_approved_count': 0,
|
||||
'notes': notes or None
|
||||
}
|
||||
|
||||
with open('$MODE_FILE', 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
icons = {'normal': '🟢', 'autonomous': '🟡', 'full-auto': '🔴'}
|
||||
print(f'{icons[level]} Mode set to: {level}')
|
||||
if expires:
|
||||
print(f' Expires: {expires}')
|
||||
if notes:
|
||||
print(f' Notes: {notes}')
|
||||
|
||||
descriptions = {
|
||||
'normal': 'Manager escalates decisions, waits for CEO approval',
|
||||
'autonomous': 'Manager auto-approves routine work, escalates high-risk only',
|
||||
'full-auto': 'Manager approves everything, CEO reviews async when back'
|
||||
}
|
||||
print(f' Behavior: {descriptions[level]}')
|
||||
"
|
||||
;;
|
||||
status)
|
||||
python3 -c "
|
||||
import json
|
||||
from datetime import datetime, timezone
|
||||
|
||||
with open('$MODE_FILE') as f:
|
||||
data = json.load(f)
|
||||
|
||||
level = data.get('level', 'normal')
|
||||
icons = {'normal': '🟢', 'autonomous': '🟡', 'full-auto': '🔴'}
|
||||
print(f'{icons.get(level, \"⚪\")} Current mode: {level}')
|
||||
|
||||
if level != 'normal':
|
||||
activated = data.get('activated_at', 'unknown')
|
||||
expires = data.get('expires_at')
|
||||
count = data.get('auto_approved_count', 0)
|
||||
notes = data.get('notes', '')
|
||||
print(f' Activated: {activated}')
|
||||
if expires:
|
||||
exp = datetime.fromisoformat(expires)
|
||||
now = datetime.now(timezone.utc)
|
||||
remaining = max(0, (exp - now).total_seconds() / 3600)
|
||||
print(f' Expires in: {remaining:.1f} hours')
|
||||
else:
|
||||
print(f' Expires: manual deactivation only')
|
||||
print(f' Auto-approved: {count} items')
|
||||
if notes:
|
||||
print(f' Notes: {notes}')
|
||||
"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: autonomous-mode.sh set|status"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user