agent-awake

agent
Guvenlik Denetimi
Uyari
Health Uyari
  • License — License: NOASSERTION
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Gecti
  • Code scan — Scanned 7 files during light audit, no dangerous patterns found
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

Keep Windows awake while OpenAI Codex or Google Antigravity is working — let Windows sleep normally when idle.

README.md

Agent Awake Logo

Agent Awake

Keep Windows awake while AI agents are working — let Windows sleep normally when they are idle.

English · 简体中文

Windows x64 Rust MIT License Native Lightweight


Agent Awake is a lightweight, native Rust utility for Windows that accurately tracks active tasks in OpenAI Codex and Google Antigravity, prevents Windows automatic sleep only while an AI task is actually running, and optionally resumes unfinished tasks after model quota resets.

Disclaimer: Agent Awake is an independent open-source community project. It is not affiliated with, endorsed by, or an official product of OpenAI or Google.


Why Agent Awake?

Unlike generic "Always Awake" or mouse-jiggler tools:

  • Simply leaving Codex or Antigravity open never blocks Windows from sleeping.
  • Active reasoning, tool execution, local builds, and long-running SSH commands keep Windows awake — even when local CPU usage is near 0%.
  • Display turn-off, Windows lock screen, and manual sleep still work normally (uses PowerRequestSystemRequired only, never PowerRequestDisplayRequired).
  • No mouse jiggling, no synthetic keystrokes, no fake CPU/disk/network load.
  • Once all tracked tasks finish (after a 30-second verification grace period), the system power request is cleanly released so Windows returns to your original power plan.

Key Features

  • Precision Dual-Agent Task Detection: Combines official lifecycle Hooks, structured rollout logs (~/.codex/sessions/**/*.jsonl), read-only Antigravity local state DB (conversation_summaries.db + -wal via Windows built-in winsqlite3.dll), process-creation fingerprints, and optional stdio MCP leases.
  • Unified Windows Power Arbitration: Uses native PowerCreateRequest / PowerSetRequest / PowerClearRequest. One agent finishing never clears the wake lock while another agent is still active.
  • Quota-Exhaustion Desktop UIA Auto-Resume: Detects quota exhaustion, saves minimal non-sensitive task context, schedules wake-to-run recovery (or holds awake in opt-in Mode B) with 2–10 minute reset jitter, 24-hour wake horizon protection, and 401/403/429 circuit breaking, then safely continues verified Codex Desktop and Antigravity Desktop sessions via native Windows COM UI Automation (UIA) without touching writer locks, killing apps, or clicking blind screen coordinates.
  • Custom Temporary Wake Hold & Safe Log Clearing: Set a persistent 1–24 hour temporary system wake hold (still allowing display turn-off) with live countdown and automatic policy restoration, and clear rotated logs in one click with a confirmation dialog while preserving all settings and active tasks.
  • Modern Native Windows 11 UI + System Tray: Pure Rust Win32 + DWM + GDI+ interface (~1.2 MB executable, ~13 MB tray memory, 0% idle CPU) with dark & light themes, pastel frosted-glass agent cards, synchronized sleep policy controls, and a --legacy-ui fallback.
  • Zero Bloat & Local-Only Security: No Electron, no WebView2, no Python/Node runtime, zero network ports, zero telemetry, and current-user SDDL Named Pipe isolation.

Screenshots

Active Protection (Light & Dark Themes)

Light Theme (Active — Deep Hero + Pastel Frosted Agent Cards) Dark Theme (Active)
Light Active Dark Active

Idle State & Quota Recovery Waiting

Idle State (Sleep Allowed) Quota Exhausted (Auto-Resume Scheduled)
Light Idle Light Quota Waiting

How It Works

OpenAI Codex (Hooks + Rollout JSONL)  ──┐
                                        ├──► Unified Task Registry ──► Windows Power Manager
Google Antigravity (Hooks + DB + MCP) ──┘       (30s grace, PID        (PowerRequestSystemRequired
                                                 fingerprints)          only; allows display off)
                                                      │
                                        Quota Exhausted Event
                                                      ▼
                                        Resume Manager + Task Scheduler
                                        (Mode A: WakeToRun | Mode B: Hold Awake)
  1. Detection Priority: Official Hooks → Official local state DB / structured session logs → Optional MCP lease → Process-tree SSH/subtask verification.
  2. Anti-False-Positive: Background editor indexing, idle Language Servers, VPN/proxy apps (v2rayN, sing-box, Tailscale), and stale PIDs never trigger sleep prevention.
  3. Anti-False-Negative: Waiting on slow model responses or remote SSH commands with ~0% local CPU stays protected until an authoritative finish, cancel, or process-exit signal arrives.

Supported AI Agents

Client Task Detection & Anti-Sleep Quota-Recovery Auto-Resume Notes
OpenAI Codex Desktop Supported (Hooks + shared rollout logs) Supported (Native Windows UIA) Multi-factor target window & session verification, unambiguous Continue invocation, and 5–30s generation verification; never kills Desktop or modifies writer locks
OpenAI Codex CLI Supported (Hooks + rollout logs) Detection & wake tracking v0.2.1 unifies auto-resume on native Desktop UIA (no unattended CLI fork/resume)
Google Antigravity Desktop Supported (Hooks + conversation_summaries.db + -wal) Supported (Native Windows UIA) Verifies target window & session via Windows UIA accessibility tree; pauses cleanly into WAITING_FOR_UNLOCK if the screen is locked
Google Antigravity CLI (agy) Supported (Hooks + local DB) Detection & wake tracking Never passes --dangerously-skip-permissions

Download & Installation

Option A: Windows x64 Portable (Recommended for v0.2.1)

  1. Download Agent-Awake-v0.2.1-windows-x64-portable.zip and SHA256SUMS.txt from the GitHub Releases page.
  2. Verify the SHA-256 checksum in PowerShell:
    Get-FileHash .\Agent-Awake-v0.2.1-windows-x64-portable.zip -Algorithm SHA256
    
  3. Extract the archive and run agent-awake-app.exe.

SmartScreen Notice: Release binaries are not Authenticode-signed. Windows SmartScreen may show an "Unknown publisher" warning on first launch. You can verify SHA256SUMS.txt or build directly from source.

Option B: Per-User Install Script (Included in Portable ZIP)

# Copies binaries to %LOCALAPPDATA%\Programs\AgentAwake and adds to your user PATH
# Does NOT modify client Hooks or autostart unless you pass the opt-in switches
powershell -ExecutionPolicy Bypass -File .\install.ps1

# Optional opt-in switches:
powershell -ExecutionPolicy Bypass -File .\install.ps1 -InstallHooks -EnableAutostart -StartNow

To uninstall cleanly (removes only Agent Awake entries and preserves your original Hooks & backups):

powershell -ExecutionPolicy Bypass -File .\uninstall.ps1

First-Run Setup

  1. Launch agent-awake-app.exe (or right-click the tray icon to open the status window).
  2. Install official Hooks for instant lifecycle detection (existing configs are automatically backed up to *.agent-awake-backup before merging):
    agent-awake hooks install --agent all
    
  3. Important for OpenAI Codex: Open Codex CLI in a terminal (codex.exe) and run /hooks once to review and trust Agent Awake's Hook entries. (Do not type /hooks inside the Codex Desktop chat box.)
  4. Optional: Enable launch at Windows sign-in via the tray menu or:
    agent-awake autostart enable
    
  5. Verify active power requests in an Administrator PowerShell while a task is running:
    powercfg /requests
    
    You should see agent-awake-app.exe under SYSTEM: only — never under DISPLAY:.

Recommended Windows Sleep Settings

  • Keep your normal Windows sleep timeout (e.g., 15–60 minutes) and display-off timeout unchanged. Agent Awake never modifies your Windows power plan.
  • For Mode A (Energy-Saving Scheduled Wake) to wake your PC from sleep:
    1. Check supported sleep states with powercfg /a (classic S3 Standby provides the most reliable RTC timer wake; some S0 Modern Standby laptops restrict wake timers).
    2. In Windows Control Panel → Edit Power Plan → Change advanced power settings → Sleep → Allow wake timers, set to Enable.
    3. If your motherboard BIOS/UEFI disables RTC Wake or uses restrictive Modern Standby, switch to Mode B (Reliable Resume) from the tray menu or main window.

Codex & Antigravity Integration

  • Codex (~/.codex/hooks.json): Merges UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop, and SessionEnd non-destructively. Even before trusting Hooks, the built-in rollout log monitor tracks tasks and quota exhaustion.
  • Antigravity (~/.gemini/config/hooks.json): Adds a dedicated top-level agent-awake block (SessionStart, PreInvocation, PostToolUse, PostInvocation, Stop) without touching other hooks and intentionally omitting PreToolUse so tool permission prompts are never interfered with. Also monitors conversation_summaries.db and its -wal file read-only.
  • Optional MCP Server: Run agent-awake mcp if you want explicit tool-driven wake leases (keep_awake_acquire, keep_awake_heartbeat, keep_awake_release, keep_awake_status).

Auto-Resume & Honest Limitations

When a running task hits a model usage limit:

  1. Agent Awake extracts the real reset timestamp (rate_limits.*.resets_at or try again at ...) when available (with optional on-demand read-only Codex quota verification), applies 2–10 minute randomized jitter and a 24-hour wake horizon guard, or falls back to a configurable retry interval.
  2. It persists minimal context to %LOCALAPPDATA%\AgentAwake\pending_resumes.json (no tokens, cookies, or secrets) and enforces a cross-process scheduler mutex plus 401/403/ambiguous-429 circuit breaking and bounded transient-network backoff (1 / 3 / 5 min).
  3. Once unlocked and stabilized (30–60s after OS wake), the native Windows COM UIA engine locates and verifies the exact Codex Desktop or Antigravity Desktop session, invokes an unambiguous Continue button or safe empty-input submit, and verifies generation start within 5–30 seconds without duplicate sends.

Honest limitations:

  • Auto-resume cannot be guaranteed 100% across every desktop app update, hardware sleep state, or network condition.
  • Agent Awake never bypasses Windows lock screens: if the desktop session is locked at resume time, the task pauses safely in WAITING_FOR_UNLOCK until you sign back in.
  • If multiple matching sessions are ambiguous or the target app does not expose its UIA accessibility tree, Agent Awake refuses to guess or click blind screen coordinates (TARGET_UNVERIFIED / UIA_UNSUPPORTED).
  • Windows scheduled wake (<WakeToRun>true</WakeToRun>) depends on OS power policy and hardware RTC wake support.

Two Quota-Wait Modes

Mode Behavior While Waiting for Quota Best For
Mode A: Energy-Saving (Default) Releases the Windows wake lock so your PC can sleep normally, and creates a per-user \AgentAwake\Resume_* Windows Task Scheduler <WakeToRun> task to wake at the reset time Desktops & laptops supporting S3 / RTC wake
Mode B: Reliable Resume (Opt-in) Keeps the system awake during the quota wait (while still allowing display turn-off and lock screen) and resumes automatically once the timer expires Devices where BIOS/Modern Standby blocks RTC wake timers

Switch anytime from the main window, system tray menu, or CLI (agent-awake resume mode energy|reliable).


Usage & CLI Reference

  • Left-click tray icon: Open or restore the modern status window (closing the window hides it back to the tray).
  • Right-click tray icon: Pause/resume guard, 1-hour manual hold, toggle auto-resume, cancel/retry pending resumes, switch Mode A/B, toggle autostart, open log, or exit cleanly.
  • Classic UI fallback: Launch agent-awake-app.exe --legacy-ui if you ever prefer the classic Win32 status window.
agent-awake status [--json]
agent-awake hooks status|install|repair|uninstall [--agent codex|antigravity|all]
agent-awake pause on|off
agent-awake hold <1-24>h|<minutes>|off
agent-awake resume list|cancel|retry|enable|disable|mode energy|reliable
agent-awake uia-audit [--json]
agent-awake logs path|clear --yes
agent-awake autostart status|enable|disable
agent-awake scheduler list|clear
agent-awake diag
agent-awake shutdown

FAQ

Q: Why does agent-awake diag say powercfg /requests needs administrator privileges?
A: Windows 11 restricts reading powercfg /requests to elevated terminals, but Agent Awake itself does not require administrator privileges to call PowerCreateRequest / PowerSetRequest and prevent sleep normally.

Q: Will closing the status window stop sleep protection?
A: No. Closing the window hides it to the system tray. To exit completely and release all power requests, right-click the tray icon and choose Exit Agent Awake (or run agent-awake shutdown).

Q: Why is "Retry Resume Now" disabled?
A: It activates only when at least one auto-resumable pending task exists in the recovery queue.


Security & Privacy

  • 100% local: Zero listening network ports, zero cloud sync, zero analytics or telemetry.
  • Per-user IPC DACL: Named Pipe access is restricted to the current Windows user SID, LocalSystem, and Administrators.
  • No secret storage: Never reads or stores SSH keys, browser cookies, or API keys in pending_resumes.json or logs.
  • See SECURITY.md and docs/SECURITY_REVIEW.md for full details.

Building from Source

Requires Windows 10/11 x64 and Rust (stable, MSVC or x86_64-pc-windows-gnullvm):

git clone https://github.com/LiangOptics/agent-awake.git
cd agent-awake

cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
powershell -ExecutionPolicy Bypass -File .\scripts\build-release.ps1

Build artifacts and SHA256SUMS.txt are generated under dist/.


Contributing

Contributions focused on detection reliability, Windows power compatibility, and lightweight UX polish are welcome! Please read CONTRIBUTING.md before submitting a Pull Request.


Acknowledgments & License

Agent Awake integrates and adapts open-source work from two MIT-licensed projects — sincere thanks to their authors:

Licensed under the MIT License. See THIRD_PARTY_NOTICES.md for complete third-party crate and upstream license notices.

Yorumlar (0)

Sonuc bulunamadi