Agent skill
security-audit
Automated security posture check of the AI Harness system. Checks credentials, tokens, file permissions, git hygiene, heartbeat health, and configuration drift.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/security-audit-andersonsrepo-ai-harness
SKILL.md
Security Audit
Automated self-assessment of the AI Harness security posture.
Live System State
!ls -la bridges/discord/.env 2>/dev/null || echo "(no .env file)"
!ls -la bridges/discord/harness.db 2>/dev/null | awk '{print $1, $5, $9}'
!git status --short 2>/dev/null | head -20
!launchctl list | grep com.aiharness 2>/dev/null || echo "(no launchd agents)"
!sqlite3 bridges/discord/harness.db "SELECT provider, expires_at FROM oauth_tokens" 2>/dev/null || echo "(no oauth tokens)"
Check Modules
Parse $ARGUMENTS to determine scope. Default is full (all checks).
Credential Safety (credentials or full)
- OAuth token expiry: Query
oauth_tokenstable — check if anyexpires_atis within 7 days or already expired - Encryption key present: Check if
OAUTH_ENCRYPTION_KEYis set in.env(don't print the value, just confirm presence/absence) - Refresh token encryption: Query a token row — check if
refresh_tokenfield looks encrypted (contains:separators foriv:tag:ciphertextformat) vs plaintext - .env file permissions: Check
bridges/discord/.envhas restrictive permissions (should be 600 or 640, not world-readable) - No secrets in logs: Grep heartbeat log files for common secret patterns (API keys, tokens, passwords):
grep -ril "sk-\|Bearer \|password=" heartbeat-tasks/logs/ 2>/dev/null
Report: token status, encryption status, file permissions, any leaked secrets in logs.
Git Hygiene (git or full)
- No .env committed:
git ls-files | grep -i '\.env'— should return nothing - No credentials in tracked files:
git ls-files | xargs grep -l "sk-\|PRIVATE KEY\|password\s*=" 2>/dev/null— should return nothing - Gitignore coverage: Check that
.env,harness.db,*.state.json,.bot.pid,vault-embeddings.jsonare in.gitignore - No large binaries tracked:
git ls-files | xargs -I{} sh -c 'test -f "{}" && wc -c < "{}"' 2>/dev/null | sort -rn | head -5— flag files over 1MB - Uncommitted sensitive changes: Check
git diff --name-onlyfor any.env, credential, or key files
Report: pass/fail for each check with file paths if issues found.
Heartbeat Health (heartbeat or full)
- All configs have plists: Compare
heartbeat-tasks/*.json(excluding .state.json, .example, projects.json) against~/Library/LaunchAgents/com.aiharness.heartbeat.*.plist— flag any missing - All plists loaded: Check
launchctl list | grep com.aiharness— flag any with non-zero exit codes - Failure counts: Read all
.state.jsonfiles — flag any withconsecutive_failures > 0 - Stale tasks: Flag any task whose
last_runis more than 3x its schedule interval ago - Auto-paused tasks: Check all config JSONs for
"enabled": false— flag with reason
Report: task-by-task status table.
Configuration Drift (config or full)
- Agent tool restrictions match docs: Read
bridges/discord/agent-loader.tsand verify all agents listed in.claude/agents/have corresponding restriction entries (or are explicitly unrestricted) - MCP servers registered: Check
~/.claude/Config/mcp-config.json— verify vault, harness, projects, outlook, linkedin servers are registered - Global guardrails intact: Read
task-runner.tsforGLOBAL_DISALLOWED_TOOLS— verify rm -rf, force push, DROP, DELETE FROM, kill -9 are all blocked - Channel configs consistent: Query
channel_configstable — verify course channels haveeducationagent, project channels have valid agents - PID file stale: Check
.bot.pid— is the PID actually alive?
Report: pass/fail for each check.
Output Format
=== AI Harness Security Audit ===
Credentials:
OAuth tokens: OK (2 tokens, nearest expiry: 14 days)
Encryption key: OK (present in .env)
Token encryption: OK (iv:tag:ciphertext format)
.env permissions: OK (640)
Secrets in logs: OK (none found)
Git:
.env not tracked: OK
No credentials: OK
Gitignore: OK (5/5 patterns present)
Large files: OK (none over 1MB)
Heartbeat:
Plists present: OK (21/21)
All loaded: OK (21/21, exit 0)
Failures: OK (0 tasks with failures)
Stale tasks: WARN (daily-digest last ran 36h ago)
Config:
Agent restrictions: OK (9 agents, 4 restricted)
MCP servers: OK (5/5 registered)
Global guardrails: OK (6 rules intact)
Channel configs: OK (4 course channels → education)
PID file: OK (PID 12345 alive)
Overall: HEALTHY (1 warning)
For issues, list each with severity (CRITICAL/WARN/INFO) and suggested fix.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?