Skip to content

afterdarksys/llmsecurity-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adllmsec - After Dark LLM Security CLI

Scan and secure your AI agent configurations with a simple command-line tool.

Features

Scan Agent Configs - Detect security issues in AGENTS.md, CLAUDE.md, soul.md, .cursorrules, aider.conf ✅ Security Rating - Get 0-100 security scores for your configs ✅ Multiple Formats - Export reports as JSON, YAML, TOML, or Markdown ✅ Local + Cloud Analysis - Fast local scanning + optional cloud-based deep analysis ✅ Template Generator - Create secure agent configs from templates ✅ Beautiful CLI - Colorful, informative output with progress indicators


Installation

via npm (Recommended)

npm install -g @afterdarksystems/adllmsec

via Homebrew (macOS/Linux)

brew install afterdarksystems/tap/adllmsec

Manual

git clone https://github.com/afterdarksystems/llmsecurity-cli
cd llmsecurity-cli/cli
npm install
npm link

Quick Start

1. Scan a Single File

adllmsec scan CLAUDE.md

2. Scan a Directory

adllmsec scan .
# Automatically finds and scans all agent config files

3. Export to JSON

adllmsec scan . --format json --out report.json

4. Get Security Rating

adllmsec rate .cursorrules

5. Create New Config

adllmsec create claude --out my-agent.md

Usage

Scan Command

adllmsec scan <file|directory> [options]

Options:

  • -f, --format <format> - Output format: console, json, yaml, toml, md (default: console)
  • -o, --out <filename> - Output filename for exports
  • --no-cloud - Disable cloud-based analysis (local only)

Examples:

# Scan current directory (console output)
adllmsec scan .

# Scan specific file
adllmsec scan AGENTS.md

# Export to JSON
adllmsec scan . -f json -o security-report.json

# Export to Markdown
adllmsec scan . -f md -o SECURITY.md

# Export to YAML
adllmsec scan .cursorrules -f yaml -o rules-scan.yaml

# Local-only scan (no API calls)
adllmsec scan . --no-cloud

Rate Command

Get a quick security rating (0-100) for a config file:

adllmsec rate <file>

Example:

adllmsec rate soul.md

📊 Security Rating for soul.md

Score: 85/100
Risk Level: LOW
Risks Found: 2

Create Command

Generate a new agent configuration from a template:

adllmsec create <type> [options]

Types:

  • claude - Claude Code agent configuration
  • cursor - Cursor IDE rules file
  • aider - Aider AI assistant configuration

Options:

  • -o, --out <filename> - Output filename

Examples:

# Create Claude config
adllmsec create claude

# Create Cursor rules with custom name
adllmsec create cursor -o .my-cursor-rules

# Create Aider config
adllmsec create aider -o aider.conf

Configure Command

Set up API key and preferences:

adllmsec configure

Supported Files

The CLI automatically detects and scans these file types:

File Type Description
AGENTS.md Multi-Agent System Agent definitions and configurations
CLAUDE.md Claude Code Claude Code agent settings
soul.md Soul AI Soul AI agent configuration
user.md User Profile User preferences and context
.cursorrules Cursor IDE Cursor IDE behavior rules
aider.conf Aider AI Aider assistant configuration
.aider.conf.yml Aider AI Aider YAML configuration
agents.json Generic JSON agent definitions
system.md System Prompt System-level prompts

Security Checks

The CLI performs these security checks:

1. Secret Exposure

  • OpenAI API keys (sk-...)
  • GitHub tokens (ghp_...)
  • Slack tokens (xoxb-...)
  • Google API keys (AIza...)
  • Bearer tokens
  • Hardcoded passwords

2. Prompt Injection Risks

  • "Ignore previous instructions" patterns
  • System role override attempts
  • ChatML/Llama injection markers
  • Jailbreak techniques

3. Excessive Permissions

  • Code execution flags
  • File write permissions
  • Network access enabled
  • Unrestricted capabilities

4. PII Exposure

  • Social Security Numbers
  • Email addresses
  • Credit card numbers
  • Personal identifiable information

Output Formats

Console (Default)

Beautiful, colorful output with:

  • File-by-file analysis
  • Risk severity indicators (color-coded)
  • Security score (0-100)
  • Line-by-line recommendations
  • Summary statistics

JSON

{
  "timestamp": "2026-02-21T12:00:00.000Z",
  "version": "1.0.0",
  "results": [
    {
      "file": "CLAUDE.md",
      "type": "Claude Code Configuration",
      "score": 95,
      "riskLevel": "safe",
      "risks": [],
      "recommendations": [
        "✓ No security issues detected"
      ]
    }
  ]
}

YAML

timestamp: '2026-02-21T12:00:00.000Z'
version: 1.0.0
results:
  - file: CLAUDE.md
    type: Claude Code Configuration
    score: 95
    riskLevel: safe
    risks: []
    recommendations:
      - ✓ No security issues detected

TOML

[scan]
timestamp = "2026-02-21T12:00:00.000Z"
version = "1.0.0"

[[results]]
file = "CLAUDE.md"
type = "Claude Code Configuration"
score = 95
riskLevel = "safe"

Markdown

# LLM Security Scan Report

**Date:** 2/21/2026, 12:00:00 PM
**Version:** 1.0.0

## Summary

- **Files Scanned:** 1
- **Total Risks:** 0

## Results

### CLAUDE.md

- **Type:** Claude Code Configuration
- **Score:** 95/100 (safe)
- **Size:** 512 bytes

**Recommendations:**

- ✓ No security issues detected

Environment Variables

Required

LLMSEC_API_KEY Your LLM Security API key (get from https://llmsecurity.dev/dashboard)

export LLMSEC_API_KEY=lsec_abc12345_dGhpcyBpcyBhIHNlY3JldA==

Optional

LLMSEC_API_URL API endpoint (default: https://llmsecurity.dev/api/v1)

export LLMSEC_API_URL=https://llmsecurity.dev/api/v1

Configuration File

Create ~/.llmsec/config.json:

{
  "api_key": "lsec_abc12345_...",
  "api_url": "https://llmsecurity.dev/api/v1",
  "default_format": "console",
  "cloud_analysis": true
}

Examples

Example 1: Scan Claude Code Directory

$ adllmsec scan /path/to/project

╔═══════════════════════════════════════════════════════╗
║         adllmsec - After Dark LLM Security            ║
║              AI Agent Config Scanner                  ║
║                   v1.0.0                              ║
╚═══════════════════════════════════════════════════════╝

✔ Found 3 config file(s). Analyzing...
✔ Scanned 3 file(s)

════════════════════════════════════════════════════════
  SCAN RESULTS
════════════════════════════════════════════════════════

📄 CLAUDE.md
   Type: Claude Code Configuration
   Score: 95/100 (SAFE)
   Size: 512 bytes, 24 lines

   💡 RECOMMENDATIONS:
     ✓ No security issues detected
     • Review agent permissions and capabilities
     • Implement least privilege principle

📄 .cursorrules
   Type: Cursor IDE Rules
   Score: 75/100 (LOW)
   Size: 1024 bytes, 48 lines

   ⚠ RISKS FOUND:
     [MEDIUM] Detected Ignore Instructions pattern
       Line 12: Review and sanitize user-provided content in prompts

   💡 RECOMMENDATIONS:
     • Use environment variables for sensitive configuration
     • Limit code execution permissions

📄 user.md
   Type: User Profile
   Score: 85/100 (LOW)
   Size: 256 bytes, 15 lines

   💡 RECOMMENDATIONS:
     ✓ No security issues detected

────────────────────────────────────────────────────────
SUMMARY
────────────────────────────────────────────────────────
Files Scanned: 3
Total Risks: 1
Average Score: 85/100
────────────────────────────────────────────────────────

Example 2: Export JSON Report

$ adllmsec scan . -f json -o security-scan.json

╔═══════════════════════════════════════════════════════╗
║         adllmsec - After Dark LLM Security            ║
║              AI Agent Config Scanner                  ║
║                   v1.0.0                              ║
╚═══════════════════════════════════════════════════════╝

✔ Scanned 3 file(s)

✓ Report saved to security-scan.json

Example 3: Create and Scan New Config

$ adllmsec create claude -o my-agent.md
✓ Created my-agent.md

Edit this file to customize your agent configuration.
Run 'adllmsec scan my-agent.md' to check for security issues.

$ adllmsec scan my-agent.md

📄 my-agent.md
   Type: Claude Code Configuration
   Score: 100/100 (SAFE)
   Size: 423 bytes, 20 lines

   💡 RECOMMENDATIONS:
     ✓ No security issues detected

Integration

CI/CD Pipeline

GitHub Actions:

name: LLM Security Scan

on: [push, pull_request]

jobs:
  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install adllmsec
        run: npm install -g @afterdarksystems/adllmsec

      - name: Scan agent configs
        run: adllmsec scan . -f json -o security-report.json
        env:
          LLMSEC_API_KEY: ${{ secrets.LLMSEC_API_KEY }}

      - name: Upload report
        uses: actions/upload-artifact@v3
        with:
          name: security-report
          path: security-report.json

      - name: Fail on critical issues
        run: |
          score=$(jq '.results[].score | select(. < 70)' security-report.json)
          if [ ! -z "$score" ]; then
            echo "Security score below threshold!"
            exit 1
          fi

Pre-commit Hook

.git/hooks/pre-commit:

#!/bin/bash

# Scan agent configs before commit
adllmsec scan . -f json -o /tmp/llmsec-scan.json

# Check for critical risks
critical=$(jq '.results[].risks[] | select(.severity == "critical")' /tmp/llmsec-scan.json)

if [ ! -z "$critical" ]; then
    echo "❌ Critical security issues found!"
    echo "Run 'adllmsec scan .' for details"
    exit 1
fi

echo "✅ Security scan passed"

Troubleshooting

API Key Not Working

# Verify API key is set
echo $LLMSEC_API_KEY

# Test with explicit key
LLMSEC_API_KEY=your-key adllmsec scan .

# Or use --no-cloud for local-only scanning
adllmsec scan . --no-cloud

No Files Found

# Check supported files
adllmsec scan . --verbose

# Scan specific file
adllmsec scan path/to/specific/file.md

Export Issues

# Ensure output directory exists
mkdir -p reports
adllmsec scan . -f json -o reports/scan.json

# Check write permissions
ls -la reports/

Contributing

We welcome contributions! See CONTRIBUTING.md


License

MIT License - see LICENSE


Support


Changelog

v1.0.0 (2026-02-21)

  • Initial release
  • Support for AGENTS.md, CLAUDE.md, soul.md, .cursorrules, aider.conf
  • Local + cloud analysis
  • JSON, YAML, TOML, Markdown export
  • Template generator
  • Security rating command

Made with ❤️ by After Dark Systems

About

After Dark LLM Security CLI - Scan and secure your AI agent configurations

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages