process-list-monitoring
暂无简介
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-12
- Stars
- ★ 13
- Forks
- 2
03 SKILL.md 正文
/process-list-monitoring
When to Use
- Audit which processes an agent spawned during a session
- Detect unexpected child processes (cryptominers, reverse shells)
- Monitor CPU/RAM per process before triggering circuit breakers
- Build zombie-process detectors (see [[zombie-process-cleanup]])
Do NOT use for
- Real-time kernel-level tracing (use [[ebpf-runtime-tracing]] instead)
- Windows process management (API differs significantly)
Process snapshot
import psList from 'ps-list'
// Full snapshot
const procs = await psList()
// [{ pid, name, cmd, ppid, uid, cpu, memory }, ...]
// Filter by parent PID (find all children of current agent)
const agentPid = process.pid
const children = procs.filter(p => p.ppid === agentPid)
// High-CPU processes (> 80%)
const hotProcs = procs.filter(p => (p.cpu ?? 0) > 80)
if (hotProcs.length) {
console.error('[monitor] high-CPU:', hotProcs.map(p => `${p.name}(${p.pid})`))
}
Baseline + diff (detect unexpected spawns)
async function detectNewProcesses(
baselineMs = 0,
intervalMs = 2000
): Promise<void> {
const baseline = new Set((await psList()).map(p => p.pid))
setTimeout(async () => {
const current = await psList()
const newProcs = current.filter(p => !baseline.has(p.pid))
for (const p of newProcs) {
console.warn(`[monitor] NEW PROCESS: ${p.name} pid=${p.pid} cmd=${p.cmd}`)
}
}, intervalMs)
}
Bash equivalent (no Node dependency)
snapshot_pids() {
ps -eo pid,ppid,comm,pcpu,pmem --no-headers | sort -k4 -rn
}
# Find all descendants of a PID
descendants_of() {
local parent="$1"
ps -eo pid,ppid --no-headers | awk -v p="$parent" '$2==p{print $1}' \
| xargs -I{} bash -c "echo {}; descendants_of {}" 2>/dev/null
}
# Detect zombie processes (state=Z)
ps -eo pid,stat,comm | awk '$2~/^Z/{print "ZOMBIE:", $0}'
Anti-Fake-Pass Checklist
❌ ps-list called once at startup → misses processes spawned mid-session
❌ No ppid filtering → noisy list includes unrelated system processes
❌ cpu field not available on all platforms (macOS only with all:true option)
❌ No threshold check → monitoring loop itself consumes CPU
❌ Snapshot not taken before agent starts → no baseline for diff
04 同仓库更多 Skills
openai--sentry--sentry
Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.
ito-basket-compare
Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.
implementing-network-traffic-baselining
Build network traffic baselines from NetFlow/IPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly/daily traffic pattern profiling
detecting-evasion-techniques-in-endpoint-logs
Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.
implementing-microsegmentation-with-guardicore
Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.
ramdisk-tmpfs-patterns
暂无简介