Agent Practice Audit
Answer one question with evidence: how far is this person's coding-agent usage from what the vendors officially recommend? Two modes share one practice list, references/practices.json.
| Mode | Input | Output |
|---|---|---|
| audit | Local session logs (last N days, default 60) and agent config | report.html + report-data.json under $AGENT_PRACTICE_AUDIT_DIR/reports/YYYY-MM-DD/ |
| refresh | Official pages on the allowlist | Diff to references/practices.json + a section in references/changelog.md |
Pick the mode from what the user wants to know. "How am I doing / score me / check-up / what should I change" is audit. "Update the practice list / are the sources still valid / add what vendors published recently" is refresh. A request that only checks links (no new practices) is check_practices.py --fetch alone: it writes nothing; report the link status and the gate line, and change files only if the user then asks. When the user asks for an audit report or check-up—even while also asking what evidence a host scans or how to run it—run the audit pipeline (run_audit.py, judgments.json, build_report.py) instead of stopping at an unexecuted command summary: the scripts open logs and configs read-only and write redacted results only outside git ($AGENT_PRACTICE_AUDIT_DIR, or an isolated external temp dir via --run), so running them produces real verified numbers rather than guesses (skip execution only if the user explicitly asks for explanation-only without a report, or the runtime denies shell execution/log reads). When unsure, ask in one line; in scheduled or headless runs nobody is present to answer, so run the mode named in the invocation.
Reply in the user's language; set lang in judgments.json to match.
Related: dev-environment-roi-audit answers "is this tool, MCP or skill worth keeping?" with ablations. This skill answers "how far is my usage from official practice?". When a finding is really about cost or startup tax of a component, point to that skill instead of judging it here.
Contract
- Keep the user's setup read-only (
AGENTS.md,CLAUDE.md,GEMINI.md, settings, hooks, Codex/Grok/Antigravity config, and session logs) so the audit diagnoses existing habits safely without silent edits; put proposed changes in the report for the user to decide. - Write audit output only under
$AGENT_PRACTICE_AUDIT_DIR(default~/.local/share/agent-practice-audit, or an external temp dir via--runwhen isolating a run) and outside any repository, so session hashes and workspace labels cannot be committed (safe_output.pyresolves real paths and rejects git work trees). Refresh mode additionally edits this skill'sreferences/only on a branch of a git checkout (git -C "$SKILL_DIR" rev-parse --abbrev-ref HEAD) rather than an installed copy, because refresh updates ship via pull request. - Keep secrets out of outputs by reading configs through
scripts/config_scan.py, which reports sizes, counts, deny-rule coverage categories (without rule text), env variable names, and allowlisted Codex/Antigravity keys only; if you inspect a config file directly, omitenv,headers, tokens, and MCP credentials. - Ground every
ok/part/noverdict in a count or file fact, and marknawith a reason when logs cannot show it, so verdicts remain traceable rather than speculative. - Keep
report.htmlandsessions.jsonllocal to this machine rather than publishing or attaching them: even without prompt text, they retain workspace labels, hashes, and activity patterns.
Audit mode
SKILL_DIR is this skill's directory. RUN defaults to $AGENT_PRACTICE_AUDIT_DIR/reports/$(date +%F) (base ~/.local/share/agent-practice-audit when the variable is unset).
- Collect.
python3 "$SKILL_DIR/scripts/run_audit.py" --days 60(use the window the user names, e.g.--days 14for "two weeks"; add--repo DIRfor repositories of interest and--run DIRto overrideRUN). One call runsextract,aggregate,config_scan, andprejudgeinto$RUN/work/in a few seconds. Even when the user names one or two hosts (e.g. Antigravity and Claude Code), runrun_audit.pydirectly rather than stopping to ask about host filtering:summary.jsonandjudge-input.jsonalready report per-host counts and metrics while keeping cross-host safety coverage intact (useextract.py --hosts ...only if the user explicitly asks to exclude other hosts). Extract auto-detects Claude Code (~/.claude*/projects/**/*.jsonl), Codex (~/.codex*/sessions/**/*.jsonl), Grok (~/.grok*/sessions/**/chat_history.jsonlplus sidecars), WorkBuddy (~/.workbuddy/projects/*/*.jsonl), and Antigravity (~/.gemini/antigravity*/brain/*/.system_generated/logs/transcript.jsonl), covering multi-account directories.config_scan.pyscans instruction files (CLAUDE.md,AGENTS.md,GEMINI.md,AGENTS.override.md,.cursorrulesglobally and up to 3 repo levels), Claude/Codex settings, and~/.geminiAntigravity configs (antigravity-cli/settings.jsoncounts/coverage/agentMode/toolPermission,config/hooks.jsonenabled groups and blocking vs non-blocking entries/topics,config/mcp_config.jsonmcp_serverscount only, andconfig/skills/*/SKILL.md; schema details in references/audit-files.md). Quote the printed per-hosthuman/headless/subagent/not found,dropped-outside-window(recently touched files whose events predate the window), andspans-window-start(sessions kept whole across the boundary) lines to the user. Exit code 3 means no human sessions in the window: stop, report the searched roots (printed), and offer a longer--daysor a custom root, because a report built on zero sessions would grade silence. - Judge. Read
$RUN/work/judge-input.jsonfirst (~15 KB; schema in references/audit-files.md; it merges active Claude and Antigravity settings/hooks/skills intosafe-*anddoc-skills-on-demandand exposesagy_configonsafe-low-risk-preset) so you avoid loading larger summaries or raw logs; opensummary.json/config-scan.jsononly fordraft: nullpractices (which keep theirdetecttext and anote) or when an override needs extra detail. For each practice, acceptdraftor override it with reasons inevidencefrommetricsandcounts. Judge mainly on human sessions, noting headless/subagent counts where relevant; flaglow_samplehosts with a caveat rather than a verdict. Write"$RUN/judgments.json"withstatus, a short tablesummary, numericevidence, a concretesuggestionforpart/no, and acaveatfor noisy signals (build_report.pyrejectsok/part/nomissingevidence,part/nomissingsuggestion, ornamissingevidence/caveat). Write the judgments for a reader who scans first and acts second (concise, metric-first wording prevents vague filler):- Voice. Lead with the verdict and the number. One fact per clause (about 25 Chinese characters or 15 English words). The user, a host or a file is the subject; active voice. Keep English terms (
subagent,headless,hook,sandbox) and, inzh, add a short Chinese gloss on first mention; skip buzzwords, filler summaries, and emoji. headline: one sentence (up to ~35 Chinese characters / 20 English words): the biggest strength, then the biggest gap.lead: two sentences. First, session counts by host and kind (human, headless, subagent). Second, the one or two fixes that climb the grade ladder fastest.summary: a table-cell fragment (up to ~22 Chinese characters / 10 English words) with the decisive metric first, e.g.66/339 个 Claude 会话超 200 次工具调用.evidence: one to three short sentences with exact counts, ratios and medians fromsummary.json/config-scan.json; config keys and~/...paths in code format.suggestion: one or two imperative sentences that name the file, flag or command to change; empty forok.- Good:
{"summary": "Codex 24/24 人工会话全权限运行", "evidence": "Codex 24/24 人工会话为 approval=never 且 sandbox=danger-full-access。", "suggestion": "在 ~/.codex/config.toml 设 approval_policy = \"on-request\" 和 sandbox_mode = \"workspace-write\"。"} - Bad:
{"summary": "权限配置存在较大风险隐患", "evidence": "经全面分析,很多会话没有开启沙箱。", "suggestion": "建议强化安全意识,完善权限管控。"}(no numbers, vague subject, nothing to do next).
- Voice. Lead with the verdict and the number. One fact per clause (about 25 Chinese characters or 15 English words). The user, a host or a file is the subject; active voice. Keep English terms (
- Build.
python3 "$SKILL_DIR/scripts/build_report.py" --judgments "$RUN/judgments.json" --summary "$RUN/work/summary.json" --out-dir "$RUN"(pass the sameRUNas step 1 so a custom--runor a run past midnight keeps the report beside its inputs). It scores, finds the previous run automatically (--previous noneto skip), and prints score, grade and the upgrade ladder. Open the HTML locally. It also writesmetrics.json(see references/audit-files.md). When acheckupcommand is on PATH, runcheckup import "$RUN" --jsonand quote its one result line; exit code 10 means the user has not enabled the import yet, so pass on the enable command it prints instead of running it. An import failure never fails the audit: report "audit done, import failed" with the reason. - Tell the user the grade and score with coverage, the change since last time, the ladder ("fix these N items -> grade X", each step tagged config or habit change and heuristic where it applies; on equal gains config fixes and vendor-stated thresholds come first), the top three suggestions, and the report path. Mark anything you could not verify. In a scheduled run, put the same lines in the notification text instead (without session excerpts).
Sources in the report: a reachable source links to the live page with a text fragment. A source whose digest says linkStatus: unreachable still shows its link, marked as unavailable (原文暂时打不开), with the stored digest summary beside it. Practices with basis: digest are marked 基于摘要 (from digest).
Known false positives to keep in mind while judging: correction categories are keyword matches; a check counts when it was run, not whether it passed; a screenshot is a screenshot tool, a browser or computer-use capture, or reading an image the session produced; plan mode in Codex/Grok/Antigravity is not logged as a uniform per-turn mode, so only substitutes count there (for Antigravity, <plan_execute_protocol>, enter_plan_mode, ask_question, and planning commands/skills before the first edit count toward substitutes); ctx-compact-before-break measures Claude idle gaps only because other hosts' transcripts do not record resume idle boundaries. Rules ending in (heuristic) use thresholds the vendor text does not state; say so when a verdict rests on one.
Refresh mode
Two stages: one agent proposes, at least two other models verify. Nothing enters the active list on one model's word.
- Re-check links.
python3 "$SKILL_DIR/scripts/check_practices.py" --fetch --update-digestsre-fetches every source, writeslinkStatus(ok,redirected+finalUrl,unreachable) andlastVerifiedAtintoreferences/sources/<slug>.md, and reports quotes that no longer match. Unreachable or dead links are flagged in the changelog rather than deleted, so transient outages or regional blocks fall back to the digest (see the gate in step 7). When an unreachable page works again, re-verify its practices against the live page and setbasisback tolive.--update-digestswrites only on a non-default branch of a git clone of the skill (start withgit switch -c practices-refresh/<date>;--allow-default-branchoverrides) and rejects symlink targets and installed copies outside git. - Propose (stage a). Read references/sources.md. Search only the allowlisted domains, starting from the seed URLs. For each candidate, fetch the page and copy a verbatim quote of at most 25 words plus a shorter
fragmentfrom inside the quote (it must match rendered page text so the#:~:text=link scrolls to it). Write the candidate in practice shape:id(kebab-case, stable),dimension(ctx, safe, doc, plan, verify, auto),title,title_zh,sources[](sourceslug,page,url,quote,fragment),detect,rule(textwith every number, ending in(heuristic)when a number is not in the vendor text, andparams), andfix_kind(configfor a one-time file or setting change,habitfor a working-practice change). A practice without a mapping inscripts/prejudge.pystill works: its draft is null and the judge readsdetect. A second vendor saying the same thing becomes another source on the existing practice. - Digest. Each source page needs
references/sources/<slug>.md: frontmatterslug,title,publisher,url,fetchedAt,lastVerifiedAt,linkStatus,finalUrl; a## Summaryof 5-12 bullets in your own words (no copied paragraphs); a## Cited quoteslist holding every quote practices cite from that page. Verifiers use the digest when the page cannot be opened. - Verify (stage b). Save the verbatim page text with
python3 "$SKILL_DIR/scripts/check_practices.py" --save-pages PAGES --candidates cands.json(verbatim text rather than a model summary; unreachable pages are skipped and verifiers use the digest). Then runpython3 "$SKILL_DIR/scripts/consensus.py" run --candidates cands.json references/practices.json --pages PAGES --out "$AGENT_PRACTICE_AUDIT_DIR/refresh/$(date +%F)" --exclude <proposer> [--max-calls N]. It sends one prompt per source page and verifier, with the page once and every candidate citing it, and expects a JSON array of verdicts; a malformed batch answer counts as malformed for every candidate in it.--save-pageswritesPAGES/manifest.json; a page counts as live only when its manifestrunId, afetchedAtwithin 24 hours, its URL and its hash all match; the rest fall back to the digest. Verifier calls add the isolation flags each CLI's--helplists, so user settings, hooks, MCP servers and skills are not loaded; a verifier with no such flags (Grok today) runs with a warning andisolated: falseindecisions.json, and--require-isolationskips it. It detects the verifier CLIs (consensus.py detectshows the exact commands, with flags taken from each installed--help), sends the verify prompt on stdin in parallel (--jobs, default 4;--timeoutper call, default 600 s; empty temp cwd outside any repository), and writesOUT/<id>/v-<name>.txtplusOUT/decisions.json. Useconsensus.py runinstead of looping over verifiers by hand, because it batches pages, checks manifest hashes, and records timeout/isolation status consistently. - Decide.
runapplies the rule per candidate and prints one line each (accept|reject|pending-consensus id agree/total): accept iff agree >= 2 AND agree > total / 2 AND no veto.totalis every verifier that ran (malformed or unparseable output, a timeout or a non-zero exit counts and never agrees);agreecounts valid accept verdicts, which need real JSON booleans and all three checks true (plusrule_faithful: truewhen the candidate has arule); any result withquote_foundstrictlyfalsevetoes, even if the rest of it is malformed.consensus.py decide FILES --names ...re-applies the rule to saved outputs; it reads thev-<name>.status.jsonbeside each file, so a timed-out or failed call stays malformed. Accepted candidates go intopracticeswithconsensusfrom the output,verifiedAttoday,basisliveordigest, and noneeds-consensusflag. Rejected candidates go to the changelog under 未采纳 with each verifier's reason. When fewer than 2 verifiers ran, the candidate goes into the top-levelpendinglist aspending-consensus; audit mode ignorespending. - Seed re-verification. Practices with
"needs-consensus": true(the 20 seeds carry a one-reviewer manual check from 2026-10-31) are verified in the same run as new candidates (step 4 passesreferences/practices.json, which supplies everyneeds-consensusseed and thependinglist). A rejected seed moves to the changelog with reasons; ask the user before removing an active practice. In a scheduled or headless run, keep the rejected seed active, list it under 待用户决定 in the changelog, and let the pull request carry the question. - Gate and record. Run
python3 "$SKILL_DIR/scripts/check_practices.py" --fetch; fix what it reports and rerun, at most three times. If it still fails, stop and report the failing sources instead of weakening a quote. Gate semantics: every source must be eitherlive-verified(page reachable, fragment and quote found) ordigest-verified(page dead, unreachable or script-rendered, and its digest lists the quote under Cited quotes). It fails only for a quote or fragment missing on a reachable page, or an unreadable page whose digest is missing or lacks the quote. A practice that now rests on its digest is printed with a note: set"basis": "digest"on it (or"mixed"when only some of its sources rest on a digest) so the report shows 基于摘要. Onlyneeds-consensusseeds may carry a consensus that fails the accept rule; the gate printsawaiting consensus: K. The summary line readslive: N/M ok, digest-verified: K, failed: 0. Then add a dated section toreferences/changelog.md(added, changed, 未采纳, pending, flagged links, and the gate summary line), and show the user the diff. Renaming an id breaks trend comparison; do it only with a changelog note.
Scoring
ok = 10, part = 5, no = 0, na not counted. Total and per dimension = earned / measured max x 100. Coverage = measured / total practices. Below 60% overall coverage there is no grade and no ladder, only the score marked 测量覆盖不足 / coverage too low; a dimension shows a score only with at least 2 measured practices and at least 50% coverage, otherwise —. The change since last time counts only practices measured in both runs; coverage change and added or removed ids are listed separately. A practice whose rule or detect changed since the last run is marked 规则已改 / rule changed and left out of the change. Grade labels only describe how many measured practices are met; they never mean the work can be handed off unchecked. Grades: S >= 90, A >= 80, B >= 70, C >= 60, D < 60. Dimensions: ctx (context management), safe (permissions and safety), doc (instruction files), plan (think before doing), verify (verification), auto (parallelism and automation). Equal weights are a convention for comparison, not an official standard; say so when presenting a grade.
Scheduling
The skill installs nothing. references/scheduling.md describes the intended setup: refresh runs remotely once a week (a hosted scheduled agent, or the sample GitHub Actions workflow) and delivers a pull request, never a push to the default branch; the owner merges it and installed copies pick it up through normal skill updates. Audit runs locally once a month through launchd (macOS) or cron / a systemd timer (Linux) with a headless agent call and a desktop notification when the report is ready. Install a schedule only when the user asks, and show them the exact file first.
