Borrowing it
Nothing to install: this file belongs to airtaxi/LidGuard. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/airtaxi/LidGuard/master/.codex/skills/lidguard-session-runtime/SKILL.mdgit clone --depth 1 https://github.com/airtaxi/LidGuardWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/airtaxi/lidguard/lidguard-session-runtime)<a href="https://agentmods.dev/skills/airtaxi/lidguard/lidguard-session-runtime"><img src="https://agentmods.dev/badge/skills/airtaxi/lidguard/lidguard-session-runtime/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/airtaxi/lidguard/lidguard-session-runtime"><img src="https://agentmods.dev/badge/skills/airtaxi/lidguard/lidguard-session-runtime.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.02789 |
| Opus 5 | $0.00025 | $0.01394 |
| Sonnet 5 | $0.00010 | $0.00558 |
| Haiku 4.5 | $0.00005 | $0.00279 |
Grade A, and why
lidguard-session-runtime scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.
LidGuard Session Runtime
Process Exit Watcher
Hook stop events may be missed, so LidGuard also watches the agent process.
- Prefer a provided parent process id when hooks can supply one.
- Managed Codex, Claude Code, GitHub Copilot CLI, and OpenCode hooks should resolve a watched process id from the hook process ancestry on their start events when
WatchParentProcessis enabled. - Working directory must not be used to auto-resolve watched processes. Keep it only for status, logs, transcript fallback, and webhook payload metadata.
- If neither an explicit parent process id nor a hook ancestry owner process id is available, start or update the session with
process=none. - On Windows, open the target process with synchronize/query rights and wait with
WaitForSingleObject. - On Windows, read hook process ancestry with CsWin32/WDK
NtQueryInformationProcess(ProcessBasicInformation). - On Linux, read hook process ancestry with
/proc/<pid>/stat,/proc/<pid>/comm, and/proc/<pid>/cmdline. - On macOS, read hook process ancestry from
ps -axo pid=,ppid=,comm=,command=. - On Linux and macOS, use
Process.GetProcessById().WaitForExitAsync()for process exit watching. - Treat the first cleanup signal as authoritative; later stop/watchdog events for the same session should be harmless.
- If a provider launches a short-lived wrapper that exits before the real agent, prefer provider-specific process selection rather than broadening the generic resolver.
- Watched parent process exit and orphan cleanup are cancel cleanup paths, not provider-reported normal session ends. They must suppress
PostSessionEndand any newPreSuspendwebhook they would otherwise schedule, while preserving any pending suspend that was already scheduled or running.
Active Session Policy
- Keep session state ref-counted by active session.
- Attach provider name to
AgentProvider.Mcpsessions so multiple MCP-backed providers can reuse the same session identifier without colliding. - Track last activity timestamp, soft-lock state, soft-lock reason, and soft-lock timestamp per session.
- Keep shared platform keep-awake protection alive only while at least one active session is not soft-locked.
- When all remaining active sessions are soft-locked, treat the runtime as suspend-eligible even before those sessions emit stop events.
- Refresh a session's last activity timestamp on start/update and provider activity such as new tool execution.
- Clear that session's current soft-lock state on provider activity.
- Do not refresh last activity when setting a soft-lock; soft-locking represents waiting rather than autonomous work.
- Closed-lid PermissionRequest decision Ask marks the current provider session soft-locked with reason
closed_lid_permission_request_ask; it is cleared by the same provider activity, transcript activity, start/update, stop/remove, or cleanup paths as other soft-locks. - When a session reaches the configured inactive session timeout, transition it to soft-locked with reason metadata and apply the same suspend-eligibility handling as other soft-locked sessions.
- Pending provider work is not an unconditional exemption from the inactive session timeout. Deferred stops refresh the session's last activity, so still-live background work keeps renewing the timeout window. A session whose pending work shows no provider activity for the configured timeout is treated as abandoned: clear the pending work flag, log
session-pending-provider-work-abandoned, and route the session through the same timeout soft-locking path. A soft-locked session with pending work must also stay in the timeout timer so a lost completion notification can be abandoned the same way. Later provider activity from work that was abandoned in error resumes the session through the normal activity paths. Turning the inactive session timeout off (SessionTimeoutMinutes = off) disables this abandonment entirely, since no timeout monitor runs. - Do not auto-resolve watched processes from the working directory for any provider.
- Preserve an existing watched process for the same active session when a later start/update does not provide a new watched process id and
WatchParentProcessis still enabled. - Provider hook ancestry owner detection should accept Codex CLI, Codex App
app-server, Claude Code CLI/wrappers, GitHub Copilot CLI,gh ... copilot, OpenCode CLI, and provider-specific bun/node/npm/npx wrappers. - Back up optional lid action changes once to pending JSON, preserve any existing pending JSON, and restore only from that JSON after the last active session stops.
- While shared protection remains applied and the lid is closed, keep the Emergency Hibernation thermal monitor polling every 10 seconds and stop it automatically once protection is restored or disabled.
- Keep multiple stop signals for the same session from causing repeated cleanup side effects.
- Ask-before-sleep reply waiting reuses the pending suspend path: keep blocking-capable Stop hooks blocked only while the pending suspend cancellation token remains active. Wait through
postStopSuspendDelaySecondsbefore sending the follow-up webhook so immediately-following prompts can arrive first, then wait up toclosedLidStopFollowUpDelaySecondsfor the initial reply deadline. The notification dashboard may extend that deadline up to 5 minutes beyond the initial deadline, and managed provider hook timeout must bepostStopSuspendDelaySeconds + closedLidStopFollowUpDelaySeconds + 5 minutesso blocking-capable provider hooks remain alive for the whole supported extension window. Poll responses include the currentexpiresAtUtc; the runtime must trust that value and continue waiting up to it. When a reply arrives, restore the session as active instead of treating the provider stop as final cleanup. WithRepeatClosedLidStopFollowUp=true, later Stop hooks from the continued work may ask again without a fixed repeat limit. WithRepeatClosedLidStopFollowUp=false, the continued Stop must not wait throughpostStopSuspendDelaySecondsagain; it should proceed as an immediate suspend attempt. When the notification server returnsCanceled, stop waiting and reschedule the existing stop/suspend path with a0second delay. - OpenCode differs from blocking-capable Stop hooks: the managed plugin waits after
session.idle, consumes the continuation stdout, and sends the reply back into the same session withclient.session.prompt(). This simulates the same user experience but depends on OpenCode still having the session available. - If
closedLidStopFollowUpSoundis configured, play it once after the follow-up webhook start succeeds and the poll URL is valid, before polling starts. Log playback or volume override failures and keep waiting for replies.
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago Changed · +1 lines 387ecc0ade94
- 10d ago First seen · 85 lines · 50 tokens per session scan A dba7fa412888
lidguard-session-runtime is a skill published in the GitHub repository airtaxi/LidGuard (11 stars, last pushed 2d ago), licensed MIT. It adds 50 tokens to every session and 2,789 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
anti-sleep
Keep a Mac awake with caffeinate during long builds, downloads, or supervised automation runs.
community-research-insight
Extract structured insight briefs from community research transcripts or notes. Produces pain points, stakeholder needs, opportunity maps, risks, and follow-up questions. Requires human review before publication.
history-explorer
Inspect recent session conversation turns and meta-run history. Returns structured JSON summaries of turn counts, role distribution, tool usage, meta-skill executions, and co-occurrence patterns. Use this before running meta-skill-creator or when the user asks about recent history, past tool usage, or session activity.
senior-java
World-class Java and Spring Boot development skill for enterprise applications, microservices, and cloud-native systems. Expertise in Spring Framework, Spring Boot 3.x, Spring Cloud, JPA/Hibernate, and reactive programming with WebFlux. Includes project scaffolding, dependency management, security implementation, and…
summarize
Summarize, condense, or digest content into structured key points, details, and action items.
data-analyst
Connects to databases, runs SQL queries, and analyzes datasets using code to provide actionable business insights.