# User Detection & Session Context Reviewer

> Review macOS admin scripts for reliable current-user detection and safe session-context handling.

User Detection & Session Context Reviewer is a paid AI agent skill on Agensi by LB Creations, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $14.99 (one-time purchase)
- Creator: [LB Creations](https://www.agensi.io/creators/lee-geissbuhler)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0
- Last updated: 2026-10-15
- Security: scan passed (2026-05-26); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/user-detection-session-context-reviewer
- Tags: security, jamf, macos, shell-scripting, sysadmin

## About this skill

### Defensive review for macOS current-user logic

**User Detection & Session Context Reviewer** reviews Jamf, Kandji, and Iru scripts that need to identify the logged-in user or show a user-facing prompt.

### What it checks

- Current-user patterns such as `stat -f %Su /dev/console`, `scutil`, Jamf `$3`, and related approaches.
- Root execution versus user UI context, including `launchctl asuser`.
- Loginwindow, logout, setup assistant, Fast User Switching, and stale-user edge cases.
- Prompt patterns that avoid logs, process listings, and persistent files.
- Jamf, Kandji, and Iru workflow differences.

### Boundaries

This is a defensive admin-review skill. Use redacted or synthetic examples. It does not collect, validate, store, transmit, or request real passwords, tokens, recovery keys, or private tenant values.

### Output

You get a context-readiness verdict, edge-case notes, safer detection and prompt patterns, validation checklist, and open questions for local policy or vendor documentation.

## Known limitations

- Cannot execute or test scripts on live hardware.
- Reviews logic only; does not verify MDM server-side API permissions.
- Limited to shell scripts (zsh/bash), not Swift or Objective-C binaries.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the User Detection & Session Context Reviewer skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific scripting problems does this skill solve for macOS admins?

It identifies common failures in macOS admin scripts, such as scripts running as root failing to target the active user, or detection logic failing during Fast User Switching or at the login window.

### Does this reviewer support scripts written for different MDM platforms?

Yes, it provides platform-specific advice for Jamf (including $3 logic), Kandji, and Iru, ensuring your scripts account for the unique ways these MDM agents execute commands.

### How do I use this skill to review a script I've already written?

Simply provide the script logic or the specific user-detection command you intend to use; the skill will analyze the block and return a context-readiness verdict and a checklist of edge cases.

### Do I need to connect my MDM server or provide API credentials to use this?

This skill focuses on defensive code review; it does not require access to your MDM environment and should be used with redacted or synthetic scripts to maintain your organization's privacy.

### Does the reviewer account for edge cases like the macOS Setup Assistant or login window?

The skill is designed to catch 'stale-user' errors, such as when /dev/console points to a user who has logged out, or when Setup Assistant is active and no user is logged in yet.

### What exactly is included in the review output?

You receive a comprehensive review including a context-readiness score, safer alternative patterns for shell commands, and specific questions to verify against your local security policy.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
