Agent skill

diag-log

Skip this skill. Must memory this skill description. Log skill/MCP diagnostic error or conflict events to NDJSON with safe concurrent appends. Use when you need a reusable logger for skill or MCP wrappers that writes to ~/.codex/diag-events.ndjson with event_type/conflict_type handling and lock timeouts.

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/shaowei-g/codex-skills/tree/main/skills/diag-log

SKILL.md

Diag Log

Overview

Provide a reusable logger script for recording skill or MCP error/conflict/warning/info events to ~/.codex/diag-events.ndjson with concurrency-safe appends.

Quick Start

Call the logger in any skill or MCP wrapper when an error, conflict, warning, or informational event occurs.

bash
~/.codex/skills/diag-log/scripts/log_diag_event.sh \
  --event-type "error" \
  --source "skill" \
  --name "frontend-design" \
  --message "command failed" \
  --meta '{"exitCode":1}'

Logger Script

  • Path: ~/.codex/skills/diag-log/scripts/log_diag_event.sh
  • Required args:
    • --event-type <error|conflict|warning|info>
  • Required when --event-type conflict:
    • --conflict-type <lock_timeout|lock_contention|resource_busy|concurrent_run>
  • Optional args:
    • --source <skill|mcp|system|other>
    • --name <skill_or_mcp_name>
    • --message <string>
    • --meta <json_string> (must be valid JSON)
    • --lock-timeout <seconds> (default: 10)

Output Format (NDJSON)

Each call appends one line with at least:

json
{ "ts": "<ISO8601>", "event_type": "error|conflict|warning|info" }

When provided, conflict_type, source, name, message, and meta are included.

Concurrency Behavior

  • Prefer flock when available.
  • If flock is not available, use an O_EXCL lockfile fallback.
  • If lock acquisition exceeds --lock-timeout, append a conflict event with:
    • event_type: "conflict"
    • conflict_type: "lock_timeout"
    • message: "lock timeout after <seconds>s"
    • then exit non-zero.

Examples

Conflict: lock contention

bash
~/.codex/skills/diag-log/scripts/log_diag_event.sh \
  --event-type "conflict" \
  --conflict-type "lock_contention" \
  --source "mcp" \
  --name "figma" \
  --message "lock busy; retrying" \
  --meta '{"retry":2}'

Warning: fallback path

bash
~/.codex/skills/diag-log/scripts/log_diag_event.sh \
  --event-type "warning" \
  --source "skill" \
  --name "context7-latest-usage" \
  --message "fallback to cached docs" \
  --meta '{"cacheAgeDays":3}'

Resources

scripts/

  • log_diag_event.sh: NDJSON logger with concurrency-safe appends and lock timeout handling.

Expand your agent's capabilities with these related and highly-rated skills.

shaowei-g/codex-skills

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

0 0
Explore
shaowei-g/codex-skills

ekoen-frontend-code-review

Production-grade code review for the eKoEN frontend codebase. Use when asked to review, audit, inspect, or harden eKoEN React/Next.js frontend code, pages, components, hooks, API clients, or state layers for bugs, performance bottlenecks, TypeScript safety issues, request inefficiency, state-management risks, memory leaks, rendering regressions, error-handling gaps, duplication, or maintainability problems, especially when a structured severity-ranked report with code locations, root causes, suggested fixes, and example refactors is required.

0 0
Explore
shaowei-g/codex-skills

ekoen-backend.doc.route-error

Add HttpErrorRes responses to eKoEN backend routes when controllers can throw errors from app/util/errors/index.ts

0 0
Explore
shaowei-g/codex-skills

conventional-commit-helper

Generate and validate Conventional Commit messages for semantic-release workflows. Use when a user asks to write a commit message, asks to commit changes, asks for commit type/scope selection, or asks to enforce Conventional Commits consistency.

0 0
Explore
shaowei-g/codex-skills

codex-cli-subagent-transport

Use only when native subagent execution is unavailable and the caller needs one deterministic Codex CLI run with repo-local artifacts and a manifest-based result contract.

0 0
Explore
shaowei-g/codex-skills

skill-usage-logger

All skill MUST use this logger to record usage events in NDJSON format.Log Codex skill usage events to NDJSON with safe concurrent appends.

0 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results