promotion-audit
Deterministic audit of the memory → charter → skill → hook promotion pipeline. Auto-promotes AUTO-tier artifacts, files DECIDE-tier issues with drafts, writes a per-wave audit log.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-21
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- args
- wave_name (optional — defaults to the current wave from cross-repo-status.json)
- name
- promotion-audit
- description
- Deterministic audit of the memory → charter → skill → hook promotion pipeline. Auto-promotes AUTO-tier artifacts, files DECIDE-tier issues with drafts, writes a per-wave audit log.
02 资源文件 88
- 参考文档.mcp.json124 B
- 其他bin-archive.bin10.0 KB
- 其他bin-archive.dat10.0 KB
- 参考文档bin-archive.json157 B
- 资产文件bin-archive.png149 B
- 其他bin/helper8 B
- 其他bin/run150 B
- 其他bundle.skill616 B
- 其他Cargo.toml146 B
- 参考文档ci.yml137 B
- 参考文档config.yaml124 B
- 其他Dockerfile155 B
- 参考文档docs/inj-obfuscated-at-cap.md337 B
- 参考文档docs/inj-obfuscated-cap.md376 B
- 参考文档docs/notes.markdown123 B
- 参考文档docs/notes.txt137 B
- 参考文档docs/uni-confusable.md461 B
- 脚本helpers.py38.8 KB
- 其他Justfile153 B
- 其他lib/legacy.pyo44 B
- 其他lib/masquerade.pyc169 B
- 其他Makefile113 B
- 其他notes.md.gz102 B
- 参考文档package.json132 B
- 其他pyproject.toml135 B
- 其他Rakefile153 B
- 脚本run.py12.1 KB
- 其他scan-skipped.tar10.0 KB
- 资产文件scan-skipped.zip1.8 KB
- 脚本scripts/ext/p.bash147 B
- 脚本scripts/ext/p.bat146 B
- 脚本scripts/ext/p.cjs148 B
- 脚本scripts/ext/p.cmd146 B
- 脚本scripts/ext/p.cts148 B
- 脚本scripts/ext/p.fish147 B
- 脚本scripts/ext/p.js147 B
- 脚本scripts/ext/p.jsx148 B
- 脚本scripts/ext/p.ksh146 B
- 脚本scripts/ext/p.lua146 B
- 脚本scripts/ext/p.mjs148 B
- 脚本scripts/ext/p.mts148 B
- 脚本scripts/ext/p.php148 B
- 脚本scripts/ext/p.pl145 B
- 脚本scripts/ext/p.ps1146 B
- 脚本scripts/ext/p.psm1147 B
- 脚本scripts/ext/p.py145 B
- 脚本scripts/ext/p.rb145 B
- 脚本scripts/ext/p.sh145 B
- 脚本scripts/ext/p.ts147 B
- 脚本scripts/ext/p.tsx148 B
- 脚本scripts/ext/p.zsh146 B
- 脚本scripts/sh-agentcfg.sh817 B
- 脚本scripts/sh-b64exec.sh456 B
- 脚本scripts/sh-creds.sh524 B
- 脚本scripts/sh-curlpipe.sh369 B
- 脚本scripts/sh-dlexec.sh1.3 KB
- 脚本scripts/sh-dropsite.sh2.2 KB
- 脚本scripts/sh-envdump.js100 B
- 脚本scripts/sh-envdump.py83 B
- 脚本scripts/sh-envdump.sh529 B
- 脚本scripts/sh-eval.sh262 B
- 脚本scripts/sh-hexblob.sh524 B
- 脚本scripts/sh-history.sh344 B
- 脚本scripts/sh-http.sh278 B
- 脚本scripts/sh-imds.sh480 B
- 脚本scripts/sh-minified.sh5.1 KB
- 脚本scripts/sh-noverify.js256 B
- 脚本scripts/sh-noverify.py96 B
- 脚本scripts/sh-noverify.sh734 B
- 脚本scripts/sh-peerbody.js899 B
- 脚本scripts/sh-peerbody.py1.6 KB
- 脚本scripts/sh-peerbody.rb330 B
- 脚本scripts/sh-peerbody.sh4.4 KB
- 脚本scripts/sh-persist.sh1.5 KB
- 脚本scripts/sh-postout.sh706 B
- 脚本scripts/sh-revshell.sh1.6 KB
- 脚本scripts/sh-shortener.sh519 B
- 脚本scripts/uni-confusable.py2.5 KB
- 脚本scripts/utf16.ps190 B
- 脚本setup.py126 B
- 其他sh-curlpipe.tar10.0 KB
- 参考文档templates/charter-section.md265 B
- 参考文档templates/hook-draft.md3.3 KB
- 参考文档templates/skill-scaffold.md745 B
- 脚本tests/conftest.py957 B
- 脚本tests/test_helpers.py44.1 KB
- 脚本tests/test_run.py11.0 KB
- 脚本tests/test_smoke.py6.6 KB
03 SKILL.md 正文
Run a deterministic audit of the promotion pipeline. Every step below is backed by a pure function in helpers.py so the same input produces byte-identical output.
See
.claude/team/lifecycle.md§ Wave Lifecycle for the canonical skill order and preconditions.
Context
The project's enforcement hierarchy is hook > skill > charter > memory (see .claude/team/charter.md § Enforcement Hierarchy and memory feedback_enforcement_hierarchy.md). Rules migrate upward along that path as evidence accumulates.
| From | To | Trigger |
|---|---|---|
| memory | charter | promotion_target: charter AND retro_citations >= threshold AND status: active |
| charter | skill | Section marker <!-- promotion-target: skill --> AND skill-invocation signal >= threshold |
| skill | hook | promotion-target: hook in skill frontmatter AND invocation signal >= threshold |
Skill-to-hook ALWAYS produces a DECIDE-tier draft issue — never auto-applies (D6, hooks are security-sensitive).
Marker convention: The audit pipeline recognizes exactly two provenance marker shapes — <!-- Promoted from memory: <filename> (<context>) --> (Shape 1, charter-tier; parser regex _HTML_COMMENT_PROMOTED_RE) and **Promotion provenance:** <body> (Shape 2, hook-tier and multi-source; parser regex _PROVENANCE_RE). The authoritative source for the SHAPE selection rule is charter/skills.md § Promotion Pipeline Marker Convention. For per-hook authoring discipline (forward-reference filter, paragraph separation), see charter/hooks.md § 6. Promotion Provenance Phrasing. Any future change to the recognized shapes MUST update the charter section first, then the parser, then this skill — in that order, in a single PR.
Instructions
Do NOT hand-roll the
classify_*call sequence. Run the canonical driver (run.py) — it wires the helper calls, slug resolution, and thresholds in exactly one place. Hand-rolling the sequence inline is what produced the P5W4 24-spurious-AUTO mis-fire (main#690): the section→skill tier calledcount_skill_invocations(section.promoted_to, …)over an emptypromoted_toslug, andgit log --grep=/matched ~every commit, crossing the threshold for 24 not-yet-promoted sections. The driver derives the candidate-skill slug from the heading for not-yet-promoted sections, andhelpers.count_skill_invocationsnow returns 0 for a blank slug.
1. Run the canonical driver
# Human-readable audit table + summary line:
python3 .claude/skills/promotion-audit/run.py [wave]
# Machine-readable decisions, to drive artifact emission in step 4:
python3 .claude/skills/promotion-audit/run.py [wave] --json
- Wave resolution. With no
waveargument the driver readscurrent_wavefromcross-repo-status.jsonand emits the canonical phase-agnostic formwave-{X}(e.g.wave-16), #810. A bare{M}arg or a legacyp{N}-wave-{M}arg is normalized towave-{X}. Design B (#804) made the wave id global/monotonic, so the cross-phase collision #442 guarded against no longer exists; #810 retires the bare-form prohibition. - Audit date is pinned to the wave boundary (
wave_{M}_kicked_off_at, else_started_at, else_scope_reconciled_at) — neverdatetime.now(), so re-runs on unchanged state are byte-identical. Override with--date. - The driver performs ONLY the deterministic classification + rendering. It
makes no
ghcalls and emits no artifacts — that is step 4, which reads the driver's--jsonoutput.
The --json payload is {wave_name, audit_date, threshold, counts, decisions[]} where each decision carries kind, item_id, from_tier, to_tier, signal, reason, artifact_ref, extra. Drive step 4 off the
AUTO and DECIDE decisions in that list.
2. How the driver classifies (reference — do not re-implement)
The driver reads inputs via read_all_memories / read_all_charter_sections
/ read_all_skills / find_already_promoted_in_charter (the latter
aggregates Promotion provenance: blocks AND <!-- Promoted from memory: X -->
markers across all charter sub-docs, #283), then routes each candidate to
its tier-specific classifier. There is no single classify() entry point —
each transition has a distinct signature because the signal sources differ:
| Function | Signature | signals keys consumed |
|---|---|---|
classify_memory(memory, signals, already_promoted) |
(Memory, dict[str,int], set[str]) -> Decision |
retro_citations |
classify_section(section, signals) |
(CharterSection, dict[str,int]) -> Decision |
skill_invocations, threshold |
classify_skill(skill, signals, already_promoted) |
(Skill, dict[str,int], set[str]) -> Decision |
skill_invocations, threshold |
Signal derivation (wired once in run.py): memory→charter uses
count_retro_citations; charter→skill counts invocations of the section's
candidate-skill slug (promoted_to with the skills/ prefix stripped if
already promoted, else _slugify(heading) — never an empty slug);
skill→hook counts invocations of the skill name (always DECIDE, D6).
charter_parentis the directory CONTAININGcharter/(e.g..claude/team), NOTcharter/itself — passing.claude/team/charterraises ValueError (#418). The driver resolves this correctly; this note matters only if you call the helpers directly in a one-off.
Each Decision has one of these kinds:
- AUTO — thresholds met, promotion target is charter or skill, NOT already promoted
- DECIDE — thresholds met, target is hook (always DECIDE), OR
requires_decision: trueoverride, OR signals ambiguous - KEPT — promotion-target is
none, thresholds not yet met, or status isactivewith no promotion intent- STALE-OPT-OUT (informational sub-class) — when a memory has
promotion_target: noneANDretro_citations >= 2 * threshold, the entry stays KEPT (the opt-out is authoritative) but is rendered in a separate sub-list so operators can spot drift during wave-retro. No auto-action, no issue filed, no override of the opt-out. (#158)
- STALE-OPT-OUT (informational sub-class) — when a memory has
- SUPERSEDED — status is
supersededorenforced-elsewherewith an explicitsuperseded_byreference - ALREADY-PROMOTED — name appears in
find_already_promoted_in_charter()set (recognized viaPromotion provenance:blocks AND<!-- Promoted from memory: X -->HTML-comment markers across all charter sub-docs; #283)
4. Produce artifacts
Resolve the current wave label once at the top of this step from cross-repo-status.json current_wave (e.g. wave-9 → label wave-9, #810 phase-agnostic form). Every artifact created below — AUTO PRs AND DECIDE issues — MUST carry this label so the GitHub Project board's Wave-field sync (see /board-audit) routes the artifact to the current wave column. Missing this label is the failure mode #401 was filed against — PRs/issues land off-board and off-wave.
AUTO artifacts
For each AUTO decision in the driver's --json output (step 1):
- memory → charter: apply
templates/charter-section.mdto the memory, append to the appropriate charter file, mark memorysuperseded_by: charter:{file} § {section}. Stage the diff. - charter → skill: apply
templates/skill-scaffold.mdto the section, write.claude/skills/{slug}/SKILL.md, add a back-reference comment<!-- promoted-to: skills/{slug} -->after the section'spromotion-targetmarker. Stage.
Commit (Aino identity per charter/commits.md § Identity Table):
git -c user.name="Aino Virtanen" \
-c user.email="parametrization+Aino.Virtanen@gmail.com" \
commit -F .claude/scratch/promotion-audit-{wave}-commit.txt
The commit-identity flags are mandatory (no shortcut to git commit -m) — they're the only way validate_commit_identity recognizes Aino as the author. Write the commit message to .claude/scratch/promotion-audit-{wave}-commit.txt and pass via -F, not heredoc — heredoc inside the parent -c line trips the identity-hook parser (memory feedback_heredoc_in_git_commit.md). Include two Co-Authored-By trailers (Aino + Claude).
Branch + push:
git checkout -b A.Virtanen/promotion-audit-{wave}-{timestamp}
git push -u origin A.Virtanen/promotion-audit-{wave}-{timestamp}
Open the PR following charter/pull-requests.md § PR Template body shape (Summary / Related Issues / Review Checklist + two Co-Authored-By trailers). Always include the literal three labels:
gh pr create \
--base deployments/phase-{N}/wave-{M} \
--title "promotion-audit: AUTO promotions for {wave} (closes #N)" \
--body-file .claude/scratch/promotion-audit-{wave}-pr-body.md \
--label tech-debt \
--label enhancement \
--label {wave-label}
The label set is non-negotiable: tech-debt (this is process/quality work), enhancement (functional addition to charter/skills), AND the current wave label {wave-label} (the phase-agnostic wave-{X} form, #810). Validate the labels actually stuck — gh pr edit silently no-ops on bad label names (memory feedback_gh_pr_edit_silent_noop.md):
gh pr view <PR#> --json labels --jq '.labels[].name'
# Expect: enhancement, {wave-label}, tech-debt (any order)
If any label is missing, retry with gh pr edit <PR#> --add-label <name> and re-verify.
Add to project board (Project 2):
PR_URL=$(gh pr view <PR#> --json url --jq .url)
gh project item-add 2 --owner noorinalabs --url "$PR_URL"
gh project item-add is in the silent-no-op family (memory feedback_gh_pr_edit_silent_noop.md) — its "no output = success" output is misleading when the item-add fails. Read-back-verify the add stuck:
gh project item-list 2 --owner noorinalabs --format json --limit 200 \
| jq -r '.items[] | select(.content.url == "'"$PR_URL"'") | .id'
A non-empty ID confirms the add succeeded. Empty output = the add silently no-op'd — retry once, then escalate to team-lead if still empty.
Assign two reviewers per charter/agents.md § Orchestrator checklist when spawning a reviewer. Use SendMessage to spawn each reviewer (do NOT use gh pr review — block_gh_pr_review enforces; memory feedback_validate_pr_review_approved_not_reply.md). The reviewer spawn brief MUST embed the verbatim verdict template with the literal TechDebt: line shape (memory feedback_techdebt_attestation_literal_line.md) — ## TechDebt headers are NOT recognized by validate_pr_review.py. Reviewer slate per scope:
- memory → charter promotions: Wanjiku (TPM) + Nadia (PD)
- charter → skill promotions: Wanjiku (TPM) + Aino (yourself ineligible — pick Santiago or Nadia)
Q3 decision: auto-promote artifacts land via PR (2-reviewer gate), not direct commit.
DECIDE artifacts
For each DECIDE decision in the driver's --json output (step 1):
- Apply
templates/hook-draft.mdto generate an issue title + body. Write the body to.claude/scratch/promotion-audit-{wave}-decide-{slug}.md. - Create the issue with the same three-label set as AUTO PRs (
tech-debt+enhancement+ current-wave label) and the same project-board treatment:
gh issue create \
--repo noorinalabs/noorinalabs-main \
--title "<title from template>" \
--body-file .claude/scratch/promotion-audit-{wave}-decide-{slug}.md \
--label tech-debt \
--label enhancement \
--label {wave-label}
Use --body-file, NOT --body — the | hook bug #146 surfaces on long-prose --body arguments.
Add the issue to Project 2 with the same read-back-verify protocol as AUTO PRs:
ISSUE_URL=$(gh issue view <N> --json url --jq .url)
gh project item-add 2 --owner noorinalabs --url "$ISSUE_URL"
gh project item-list 2 --owner noorinalabs --format json --limit 200 \
| jq -r '.items[] | select(.content.url == "'"$ISSUE_URL"'") | .id'
Empty output = retry; persistent empty after retry = escalate.
Determinism note
The gh calls in this step (PR/issue creation, project-board adds, label/board verification) are the only nondeterministic external calls the skill makes — they're isolated to artifact-emission, not to the classification logic (helpers.py). Re-running the audit on unchanged repo state still produces byte-identical classification output; the artifacts themselves carry timestamps in their branch names and bodies and are not expected to be byte-identical across runs.
5. Render the audit table
The driver already renders this table — its default (non---json) stdout
is the audit table followed by the summary line. Capture that stdout
for steps 6–7 rather than calling render_audit_table by hand. The table
has four subsections:
## Promotion Audit — {wave_name}
### AUTO-PROMOTED (artifacts generated this run)
| Item | From → To | Signal | Artifact |
|---|---|---|---|
...
### REQUIRES DECISION (issues filed)
| Item | Candidate target | Signal | Issue |
|---|---|---|---|
...
### KEPT (no action — informational)
- {item}: {reason}
**STALE-OPT-OUT (review the opt-out — informational only):**
- {item}: {reason} ← only rendered when at least one entry crosses 2× threshold
### SUPERSEDED / ALREADY-PROMOTED (no action — informational)
- {item}: {pointer}
6. Write outputs (Q4 — BOTH)
- Append to feedback_log.md — if the audit runs inside a retro (detect by checking if the most recent
## Retrospective:entry is on today's date), append under the current retro. Otherwise prepend a fresh## Promotion Audit — {wave_name} ({DATE})entry at the top of the log.{wave_name}is the phase-agnostic formwave-{X}(e.g.,wave-16), #810. The bare form is now SAFE: Design B (#804) made the wave id global/monotonic, so the cross-phase collision #442 guarded against (P2W10 vs P3W10) can no longer occur —wave-{X}is unique across all phases. - Standalone log — always write to
.claude/team/promotion_audit_log/{wave_name}.mdwhere{wave_name}is the phase-agnostic formwave-{X}(e.g.,.claude/team/promotion_audit_log/wave-16.md). Create the directory if it doesn't exist. Overwrite if re-run. (Pre-#810 logs namedp{N}-wave-{M}.mdremain valid on disk; new runs usewave-{X}.md.)
7. Report
Print a two-line summary to stdout: counts per decision category and a link to the standalone log:
Promotion audit wave-{X} complete: 0 AUTO · 0 DECIDE · 13 KEPT · 1 SUPERSEDED
Log: .claude/team/promotion_audit_log/wave-{X}.md
Determinism
The audit MUST produce byte-identical output when re-run on unchanged repo state. The canonical driver (run.py) is what guarantees this — it wires the helpers exactly once so the classification logic cannot drift between runs or operators:
- Sort every list by a stable key before iteration (memory name, charter path+heading, skill name) — done inside the helpers the driver calls.
- Use UTC dates pinned to the wave boundary (
run.pyreadswave_{M}_kicked_off_at/_started_at/_scope_reconciled_atfromcross-repo-status.json), neverdatetime.now(). - Never count invocations for an empty/blank slug (
count_skill_invocationsguards this;--grep=/would otherwise match ~every commit — the main#690 mis-fire). - Never read transcript files (per D4(i)).
- Never invoke external tools with nondeterministic output (no
gh apiexcept for issue creation at the end).
Tests in .claude/skills/promotion-audit/tests/ cover each helper (test_helpers.py), a smoke test verifying the first-run expected outcome (zero AUTO, zero DECIDE on current repo state — test_smoke.py), and the driver itself including the empty-slug regression and steady-state-through-the-driver (test_run.py).
Integration
wave-retro(see.claude/skills/wave-retro/SKILL.md) invokes this skill right after step 7 "Charter change proposals".- Standalone invocation is supported — operators can run
/promotion-auditbetween retros if drift is suspected. - The output log is greppable:
git log --follow .claude/team/promotion_audit_log/gives the full promotion history.
What this skill does NOT do
- It does not promote skill → hook automatically (Q6 locked: hooks are security-sensitive; always DECIDE).
- It does not mutate any memory file in user-level
~/.claude/projects/— it only reads. If a memory is auto-promoted, the memory'ssuperseded_byis updated by the skill (writing to the user-level memory file is allowed per feedback-settings-permission memory). - It does not scan conversation transcripts — signal sources are charter files, feedback_log.md, and git history only (D4 lightweight).
04 同仓库更多 Skills
wave-wrapup
Finalize a wave — PR review, merge sequencing, issue cleanup, worktree cleanup, and handoff to retro
wave-start
Initialize a new wave — worktree cleanup, branch creation, label setup, status file update
wave-scope
Reconcile declared-vs-labeled wave scope between /wave-retro and /wave-kickoff — collect dispositions, fold in retro carry-forwards and memory must-includes, and refresh the meta-issue
wave-retro
Automated wave retrospective — PR analysis, assessments, trust matrix updates, feedback log, charter change proposals
wave-kickoff
Automated wave planning — branch creation, label management, issue labeling, kickoff comments, and execution plan
wave-audit
Audit open issues against merged PRs — find and close orphaned issues with proper comments