Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .claude/commands/weekly-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ right, record a FINDING. Do not edit.
## Tools

Bash runs under a fixed allow list; anything else is denied, not asked.
Read files with Read, find them with Glob, search with Grep. In Bash, run one
command per call: no `cd`, no `&&` or `;`, no redirects (`2>&1`, `>`).
Read files with Read, find them with Glob, search with Grep. If Glob or Grep
is not in your tool list, use `find` and `grep -rn` in Bash instead; both are
allowed. `find` with `-exec`, `-ok`, `-delete` or `-fprint` is denied.
In Bash, run one command per call: no `cd`, no `&&` or `;`, no redirects
(`2>&1`, `>`).
The id hash in step 3 is the one allowed pipe. Keep `|`, `;` and `&` out of
arguments: `git log --format=%h|%cs|%s` is three piped commands, and is
denied. Separate fields with spaces or `%x09` instead:
Expand Down Expand Up @@ -87,6 +90,9 @@ say what it checked and found clean.
as running short. Only past that may you leave items unchecked, and the PR
body must name each one under *Not reached*. "Not reached" with fewer than
120 tool calls used is a failed run.
- A denied call is never a reason to leave an item unchecked. Read the
Tools section, rewrite the call in an allowed form (Read, `grep`, `find`,
`git show`) and carry on.
- Step 9 (stale images) runs every week, whatever the focus. It is not part
of the checklist and cannot be "not reached": do it before step 10.

Expand All @@ -102,8 +108,10 @@ everything on disk is in the doc, and everything in the doc is on disk.
- Every link to an ADR from a current-state document (`CLAUDE.md` lists
them): it does not cite a Superseded ADR as the current decision.
- Every ADR count in a README matches the number of files.
- The 15 newest ADRs: their Decision against the code and the changelog
entries dated after them.
- The 15 newest ADRs, every one of them: their Decision against the code
and the changelog entries dated after them. In *Coverage*, give each of
the 15 its own line: the ADR number, the Decision claim you checked, and
the file that bears it out or contradicts it. Fifteen lines, no sampling.
1. `ansible/`.
- Every role directory: listed in `ansible/README.md` (roles, tags, secret
variables) and used by a playbook.
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/weekly-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
run: echo ".lemmiwinks/" >> .git/info/exclude

- name: Run audit
id: audit
uses: anthropics/claude-code-action@4411a9e9b0283becf4b924f7bce360fd7756c78c # v1.0.290
env:
GH_TOKEN: ${{ github.token }} # gh issue list/create only
Expand Down Expand Up @@ -109,6 +110,7 @@ jobs:
"Bash(wc *)", "Bash(sort *)", "Bash(uniq *)",
"Bash(date *)", "Bash(printf *)", "Bash(sha256sum)",
"Bash(cut *)",
"Bash(grep *)", "Bash(find *)",
"Bash(python3 scripts/check_docs.py)",
"Bash(python3 scripts/check_docs.py *)",
"Bash(python3 scripts/check_close_keywords.py --text docs/audit/pr-body.md)",
Expand All @@ -123,11 +125,43 @@ jobs:
"Edit(**/*.png)", "Edit(**/*.jpg)", "Edit(**/*.jpeg)",
"Bash(sops *)", "Bash(git push *)", "Bash(git commit *)",
"Bash(git -C * push *)", "Bash(git -C * commit *)",
"Bash(curl *)", "Bash(wget *)"
"Bash(curl *)", "Bash(wget *)",
"Bash(find *-exec*)", "Bash(find *-ok*)",
"Bash(find *-delete*)", "Bash(find *-fprint*)",
"Bash(find *-fls*)"
]
}
}

# Which tools the session had, and the shape of each denied call: the
# command's first words and whether it held a shell operator. Never the
# whole command, since the job summary is public.
- name: Report tools and denials
if: always() && steps.audit.outputs.execution_file != ''
env:
EXEC_FILE: ${{ steps.audit.outputs.execution_file }}
run: |
set -euo pipefail
[ -f "$EXEC_FILE" ] || exit 0
jq -rs '
(if (.[0] | type) == "array" then .[0] else . end) as $m
| ($m | map(select(.type == "system" and .subtype == "init"))
| first | .tools // [] | join(", ")) as $tools
| ($m | map(select(.type == "result")) | last
| .permission_denials // []) as $d
| "### Tools and denials\n\nTools: \($tools)\n\nDenied calls: \($d | length)\n\n"
+ ($d | map(
.tool_name as $t
| (.tool_input.command // "") as $c
| ($c | split(" ") | map(select(. != ""))) as $w
| (if $w[0] == "git" and $w[1] == "-C" then $w[0:4] else $w[0:2] end
| join(" ")) as $head
| "- \($t)"
+ (if $c != "" then ": `\($head)`" else "" end)
+ (if ($c | test("[|;&<>]")) then " (shell operator)" else "" end)
) | join("\n"))
' "$EXEC_FILE" >> "$GITHUB_STEP_SUMMARY"

- name: Package doc changes
id: patch
run: |
Expand Down