AGENT SKILL

ops-log-hygiene

Check bounded logs for explicitly restarted services, or run a full log-health audit when requested or when symptoms justify it. Use for crash-loop diagnosis, oversized logs, restart churn, or an explicit live-fleet log audit.

License 许可
GPL-3.0
最近更新
2026-11-15
Stars
★ 2
Forks
1

01 前言 Front Matter

name
ops-log-hygiene
description
Check bounded logs for explicitly restarted services, or run a full log-health audit when requested or when symptoms justify it. Use for crash-loop diagnosis, oversized logs, restart churn, or an explicit live-fleet log audit.

02 资源文件 1

03 SKILL.md 正文

Ops log hygiene

Routine restart proof is target-scoped. A full-fleet log/provenance audit is a separate diagnostic operation and is not automatic after every restart.

Choose the mode

Bounded post-restart check

Use after restarting named services:

  1. Resolve each exact log path from its plist.
  2. Confirm the current PID remains stable across the short check.
  3. Read only the last 20–30 stdout/error lines.
  4. Count repeated terminal errors in that bounded tail.
plutil -p "$HOME/Library/LaunchAgents/<label>.plist" | grep -E 'Standard(Out|Error)Path'
tail -n 25 <resolved-error-log>
tail -n 25 <resolved-error-log> | sort | uniq -c | sort -rn | head -1

Repeated fatal lines, a disappearing PID, or a non-zero launchd exit is a failed restart. Report it and diagnose that service; do not widen automatically to the whole fleet.

Full audit

Run only when the user asks for fleet/log health, a bounded check finds a symptom, log-maintenance code changed, or there is evidence of disk growth, crash loops, or channel churn. The audit may inspect every named in-scope service for caps, retained generations, launchd state, wrapper provenance, and a bounded recent churn window.

Provenance rules

Different consumer classes intentionally use different runtime sources:

  • Every managed com.mono-agent.* instance, including Personal Agent: its launchd command and instance wrappers must agree with the immutable managed runtime referenced by its plist. The checkout CLI version is not serving- process provenance.
  • Separate-product services: use the installed package graph and ./bin/agents versions from that product's own checkout; do not compare them to a mono-agent managed-runtime path.

A mismatch within one consumer is a finding. A difference between these consumer classes is not.

Log size audit

Managed mono-agent logs normally live under ~/.mono-agent/logs; separate-product logs normally live under that product's own log directory. Resolve paths from plists before trusting either convention.

For a full mono-agent audit, check active files and the three managed retained generations against the 5 MiB per-file cap:

if [ -d "$HOME/.mono-agent/logs" ]; then
  find "$HOME/.mono-agent/logs" -maxdepth 1 -type f \
    \( -name '*.log' -o -name '*.log.[123]' \) \
    -exec sh -c '
      for file do
        bytes=$(stat -f%z "$file")
        [ "$bytes" -gt 5242880 ] && echo "OVER CAP: $file ($bytes bytes)"
      done
    ' sh {} +
fi

An active file may briefly exceed the cap between maintenance passes. A retained file over cap, a missing helper, or a repeatedly oversized active file is an operations failure. Inspect the maintenance job; never truncate a live writer by hand.

Channel churn

Only when channel health is in scope, count a bounded recent window rather than scanning months of logs:

grep "$(date -u -v-1H +%Y-%m-%dT%H)" <resolved-log> | grep -c "channel degraded"
grep "$(date -u -v-1H +%Y-%m-%dT%H)" <resolved-log> | grep -c "scheduling restart"

Compare the rate with that service's recent baseline and report the exact window. Do not treat one self-healed timeout as a fleet incident.

Report format

For a bounded check, report only the named target, PID stability, tail size, and top repeated error count. For a full audit, add file sizes versus cap, correct consumer-specific provenance, and bounded churn counts. Sanitize tokens and never paste raw private log payloads.

04 同仓库更多 Skills

robertsreberski
robertsreberski/mono-agent

worktree-feature

Start isolated mono-agent work with diff-aware setup, keep only required dist fresh, and ship through a PR with safe cleanup. Use for tracked repository changes, multi-commit work, or before executing an implementation plan.

★ 2
robertsreberski
robertsreberski/mono-agent

verify-green

Select and run the smallest risk-based verification lane that proves a mono-agent change. Use before claiming a change works, before committing or opening a PR, or when asked to verify, run the gate, make it green, or check architecture.

★ 2
robertsreberski
robertsreberski/mono-agent

repo-hygiene-gc

Explicit bulk branch/worktree garbage collection using API-bound deletion proof. Use when asked to clean up the repository or run a deliberate maintenance sweep; ordinary PR cleanup belongs to worktree-feature.

★ 2
robertsreberski
robertsreberski/mono-agent

release-lockstep

Cut and registry-verify a lockstep npm release of all @mono-agent packages. Use when asked to release, publish to npm, cut vX.Y.Z, or bump the version. A release never implies consumer deployment.

★ 2
robertsreberski
robertsreberski/mono-agent

pi-upstream-recon

Investigate the vendored pi packages' real API surface (pi-ai and pi-agent-core) before hand-rolling anything, and run pi version bumps safely. Use before implementing runtime/provider/session behavior, when pi behavior is surprising, or when asked to "bump pi".

★ 2
robertsreberski
robertsreberski/mono-agent

new-package

Add a new @mono-agent package/adapter that passes the architecture gate on the first try (catalog entry, README sections, dependency categories, lockstep version). Use when creating any new package, or when check:architecture fails on catalog/README/boundary errors.

★ 2