codex-log-guard
БесплатноБез исполняемых скриптовНе проверенDiagnose excessive Codex local SQLite diagnostic log writes with read-only evidence by default. Use when a user mentions logs_2.sqlite, logs_2.sqlite-wal…
от majiayu000★ 301 звезда на GitHubОб этом скилле
Codex Log Guard
Overview
Diagnose Codex persistent diagnostic logging from local evidence, then give a concise conclusion and the safest next action. Do not make the user choose from a command menu.
Operating Contract
Select one mode from the current user request:
diagnose_onlyis the default for check, inspect, explain, or verify requests. It is read-only.protectrequires an explicit request to stop or mitigate log writes. It may install and verifyblock_log_inserts, but it does not delete rows or vacuum files.cleanuprequires an explicit current request to reclaim disk space or clean up logs. It first installs protection when needed, creates and verifies a timestamped backup, and only then deletes log rows and vacuums.restorerequires an explicit request to resume diagnostic logging. It may drop only the knownblock_log_insertstrigger.
Generic wording such as "处理", "修一下", or "止血" selects protect, not cleanup. Prior approval does not carry into a later run. If the requested write mode is ambiguous, return the diagnose_only report and the exact proposed mutation without applying it.
Direct actions:
- Run local read-only file, SQLite schema, row, and open-process checks.
- Apply only the mutation authorized by the selected mode and verify its result.
Escalate before:
- Touching any database outside the two declared Codex log paths, deleting a backup, killing a process, or changing remote telemetry or credentials.
Evidence-backed pushback:
- Reject cleanup when protection is unverified, the backup check failed, or sampled row IDs still move. Cite the exact database path and failed command instead of treating file size as proof.
Feedback loop:
- When a new schema, active path, or false-success signal is confirmed more than once, update this Skill's diagnosis rules and a focused contract test before automating that case.
agents/openai.yaml contains discovery UI metadata only; it is not an operational instruction source.
Default Flow
When the user asks to "check", "看看", "诊断", or asks whether the local machine is affected:
- Inspect all candidate live database files and schemas:
~/.codex/logs_2.sqlite~/.codex/sqlite/logs_2.sqlite
- Identify which candidate database is currently held by Codex processes.
- Check whether
block_log_insertsalready exists on each candidate with alogstable. - Measure whether
logsis still being written usingCOUNT(*), MIN(id), MAX(id)samples. TreatMAX(id)orMIN(id)movement with stableCOUNT(*)as active churn, not necessarily disk growth. - Inspect low-level log volume with
TRACE/DEBUGcounts and top noisy targets. - Check which Codex processes currently hold each candidate database.
- Return a diagnosis with:
- current state: healthy / protected / affected historically / actively writing / actively growing on disk / missing database / blocked
- evidence: file sizes, trigger state, row/min-id/max-id samples, level distribution, active path
- recommended next action: do nothing / install trigger / cleanup later / cleanup now / restore logging
- Do not ask the user which command to run. Choose the diagnosis path from the evidence.
In protect mode:
- Install
block_log_insertsfirst. - Verify that
COUNT(*), MAX(id)stops growing. - Report the protected database path and fresh samples. Do not delete or vacuum rows.
In cleanup mode:
- Complete and verify protection first.
- Create a timestamped SQLite
.backupand require a non-empty file plus a successfulPRAGMA quick_checkresult. - Delete log rows, vacuum, and checkpoint the WAL.
- Report the backup path and final file sizes.
In restore mode:
- Drop
block_log_inserts. - Sample
COUNT(*), MAX(id)to confirm logging resumes or stays quiet.
Evidence Commands
Run direct shell/SQLite commands. Use only the needed subset for the user's request; do not paste a menu back to the user.
Inspect files:
for db in ~/.codex/logs_2.sqlite ~/.codex/sqlite/logs_2.sqlite; do
ls -lh "$db"* 2>/dev/null
du -h "$db"* 2>/dev/null
done
After lsof identifies the active candidate, validate the selected path in the
same shell command before running any later SQLite snippet:
: "${CODEX_LOG_DB:?set CODEX_LOG_DB to the verified active candidate}"
case "$CODEX_LOG_DB" in
"$HOME/.codex/logs_2.sqlite"|"$HOME/.codex/sqlite/logs_2.sqlite") ;;
*) echo "refusing unexpected Codex log database path" >&2; exit 2 ;;
esac
readonly db="$CODEX_LOG_DB"
Do not supply a default. If no active path can be proven, stay in
diagnose_only and report the ambiguity.
Check schema and trigger:
sqlite3 "$db" ".tables"
sqlite3 "$db" "PRAGMA table_info(logs);"
sqlite3 "$db" "SELECT name, tbl_name, sql FROM sqlite_master WHERE type='trigger' AND name='block_log_inserts';"
Sample writes and growth:
for i in 1 2 3; do
date '+%F %T'
sqlite3 "$db" "SELECT COUNT(*) AS rows, MIN(id) A
Установить codex-log-guard в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл codex-log-guard?
Diagnose excessive Codex local SQLite diagnostic log writes with read-only evidence by default. Use when a user mentions logs_2.sqlite, logs_2.sqlite-wal, block_log_inserts, SSD/TBW wear, or explicitly asks to protect, clean up, verify, or restore Codex diagnostic logging.
Как установить скилл codex-log-guard?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл codex-log-guard запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic