
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
am-i-vibing
Advanced tools
Detect agentic coding environments and AI assistant tools. This library allows CLI tools and Node apps to detect when they're being executed by AI agents. This enables them to adapt by, for example, providing different output formats or logs.
Install as library:
npm install am-i-vibing
Run as CLI tool:
npx am-i-vibing
import { detectAgenticEnvironment } from "am-i-vibing";
const result = detectAgenticEnvironment();
console.log(`Detected: ${result.name} (${result.type})`);
Generating LLM-specific error messages or logs:
import { isAgent } from "am-i-vibing";
const agent = isAgent();
function handleError(error: Error) {
if (agent) {
console.info(`
# Error
<error_message>${error.message}</error_message>
<error_type>${error.name}</error_type>
<error_stack>${error.stack}</error_stack>
<note>Use the search_docs tool to find help for this error. If the tool is not available,
prompt the user to enable the MCP server followng the instructions at https://example.com/mcp</note>
`);
} else {
console.error("An error occurred:", error.message);
}
}
The library detects three main types of environments:
There may be false positives, such as if a user directly runs a command in an terminal opened by an AI tool, such as a Copilot terminal in VS Code.
import {
detectAgenticEnvironment,
isAgent,
isInteractive,
isHybrid,
} from "am-i-vibing";
// Full detection
const result = detectAgenticEnvironment();
console.log(`Detected: ${result.name} (${result.type})`);
console.log(`ID: ${result.id}`);
console.log(`Is agentic: ${result.isAgentic}`);
// Quick checks
if (isAgent()) {
console.log("Running under direct AI agent control");
}
if (isInteractive()) {
console.log("Running in interactive AI environment");
}
if (isHybrid()) {
console.log("Running in hybrid AI environment");
}
// Note: Hybrid environments return true for both isAgent() and isInteractive()
The library returns a DetectionResult
object with the following structure:
interface DetectionResult {
isAgentic: boolean; // Whether any agentic environment was detected
id: string | null; // Provider ID (e.g., "claude-code")
name: string | null; // Human-readable name (e.g., "Claude Code")
type: AgenticType | null; // "agent" | "interactive" | "hybrid"
}
Use the CLI to quickly check if you're running in an agentic environment:
# Basic detection
npx am-i-vibing
# ✓ Detected: Claude Code (agent)
# JSON output
npx am-i-vibing --format json
# {"isAgentic": true, "id": "claude-code", "name": "Claude Code", "type": "agent"}
# Check for specific environment type
npx am-i-vibing --check agent
# ✓ Running in agent environment: Claude Code
npx am-i-vibing --check interactive
# ✗ Not running in interactive environment
# Quiet mode (useful for scripts)
npx am-i-vibing --quiet
# Claude Code
# Debug mode (full diagnostic output)
npx am-i-vibing --debug
# {"detection": {"isAgentic": true, "id": "claude-code", "name": "Claude Code", "type": "agent"}, "environment": {...}, "processAncestry": [...]}
-f, --format <json|text>
- Output format (default: text)-c, --check <agent|interactive|hybrid>
- Check for specific environment type-q, --quiet
- Only output result, no labels-d, --debug
- Debug output with environment and process info-h, --help
- Show help message0
- Agentic environment detected (or specific check passed)1
- No agentic environment detected (or specific check failed)The --debug
flag provides comprehensive diagnostic information including:
--format json
)process.env
variablesThis is useful for troubleshooting detection issues and understanding the runtime environment.
npx am-i-vibing --debug
# {
# "detection": { ... },
# "environment": { ... },
# "processAncestry": [...]
# }
MIT
Copyright © 2025 Matt Kane
FAQs
Detect agentic coding environments and AI assistant tools
We found that am-i-vibing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.