sync-wb-nb — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited sync-wb-nb (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Keep a .wb and its paired .nb mirror in sync. We edit/test in the .wb (Wolfbook MCP); the .nb is the mirror we cannot run but the user opens in desktop Mathematica. Direction is always .wb → .nb (the .wb is authoritative; /nb-to-wolfbook handles the initial reverse conversion). Set the default pair via defaultWb/defaultNb at the top of sync-wb-nb.wls, or pass absolute paths as trailing args.
Two operations, one helper script (sync-wb-nb.wls, in this skill's directory):
replace/insert/verify/stability) — propagate ONE edited cell,preserving the rest of a hand-crafted .nb (its outputs, manual tweaks). This is the standing-rule after editing the main notebook.
.nb from the .wb so it opens in Mathematicalooking normal: syntax-coloured code, styled headings. Use it to create a fresh .nb (e.g. a new generated/*.wb) or after a wholesale rewrite. It overwrites the .nb, so never use it to patch one cell of a hand-crafted notebook.
.wb: snippet sync, immediately. Add to yourCLAUDE.md:
Always run/sync-wb-nbimmediately after editing or adding cells in any.wb.
.nb: regenerate.WLS=".claude/skills/sync-wb-nb/sync-wb-nb.wls" # path from project root
wolframscript -file "$WLS" regenerate "<abs wbPath>" "<abs nbPath>"What it produces, cell by cell from the .wb:
Cell[BoxData[…], "Input"] parsed by the front-end parser(FrontEndUndocumentedTestFEParserPacket), which is what makes Mathematica colour them (blue user symbols, green pattern vars, black built-ins). A plain Cell["string","Input"]` shows up all black — that was the bug this mode fixes.
Title/Section/Subsection/Subsubsection (by #/##/###/####)and Text styles, with **bold**/` code /t` markup stripped.
(* … *) comments → lifted into an adjacent Text cell (the box parser dropscomments, same as the snippet engine).
Hard-won rules baked into the mode (don't undo them):
Export["generated/x.nb"] lands in wolframscript's owncwd, not the project — the file silently doesn't change and you debug a ghost. The mode re-reads the exact path and asserts the file is a Notebook, contains BoxData, and has one coloured cell per code cell.
literal expression; MakeBoxes reassociates Times in product-numerator fractions (the stability hazard below) and would risk changing the maths on a whole-file rewrite.
.nb is open in Mathematica, the stale in-memory copymust be closed WITHOUT saving (or File ▸ Revert) — otherwise a save overwrites the rebuild.
regenerate is not /sync-wb-nb-incremental: it is the same skill's bulk path. Re-run it whenever the .wb changes (there is no cheaper incremental update for a generated/ notebook).
For the main hand-crafted .nb: backup, box conversion, stability gate, unique-target assertions, post-write verification with automatic restore — all in sync-wb-nb.wls. One Bash call per operation:
WLS=".claude/skills/sync-wb-nb/sync-wb-nb.wls" # path from project root
wolframscript -file "$WLS" stability "<snippet>" # is the .wb cell box-stable?
wolframscript -file "$WLS" replace "<wbSnippet>" ["<nbOldSnippet>"] # sync an edited cell
wolframscript -file "$WLS" insert "<wbSnippet>" "<nbAnchorSnippet>" # sync a new cell
wolframscript -file "$WLS" verify "<snippet>" # check a cell is in sync<snippet> selects the cell and must be a single token (a symbol name defined in thecell, e.g. "myFunction"): in box structures myFunc[x_ never matches — myFunc, [, x_ are separate strings.
replace takes a second snippet when the OLD .nb cell doesn't contain the new token(e.g. new code introduces newSymbol; locate the old cell by one of its own existing tokens).
insert needs a snippet of the .nb cell the new cell goes AFTER.<wbPath> <nbPath> (absolute paths) as trailing args.PASS: … = success. Exit 1 + FAIL: … = nothing (or a restored backup) on disk.Workflow per synced cell: stability → fix source if it fails → replace/insert → done (verification is built in). Report the PASS lines.
(* … *)comments, so a commented cell would differ between the two files. Notes go in a separate text cell or the workbook.
a*b/c)reassociates Times through FractionBox and breaks ===; atomic-numerator fractions are stable. Fix by assigning the numerator to a local (c2 = a*b; … c2/c), re-validate the maths numerically, then sync. The script refuses to write unstable code.
/tmp/sync-wb-nb-backup-*.nb)..nb cell must parse === the .wb code.Only the Wolfram kernel can convert code text to Input boxes (MakeBoxes or the front-end parser) and parse .nb box structures back; a Python splice would also leave the .nb's internal byte-offset cache stale. Import→modify→Export regenerates it correctly and preserves outputs.
Snippet modes:
ToString[boxes, InputForm, PageWidth -> Infinity] — defaultToString line-wraps and can split a token across a \ continuation, silently breaking StringContainsQ.
Position+Select(SameQ)+ReplacePart, never `nb /. oldCell ->new: a literal Cell as a /. LHS can silently fail to fire. UUID-anchored /.` rules are fine for insertion (the anchor cell is matched by its UUID option, not its body).
.wb cells (kind 1) are NOT touched by the snippet modes; mirror them manually asCell[text, "Subsection"/"Text"] matching neighbouring styles. (regenerate DOES handle them — it rebuilds the whole file.)
regenerate mode:
{BoxData[…], …}; take [[1]]. It yields the multi-line list-formBoxData[{box, "\n", box, …}] (the FE's native typed-input shape — it colours correctly); Import later normalises that to a single RowBox. So the faithfulness check must NOT compare held expressions of the two shapes — it just asserts every stored cell re-parses without $Failed.
(* *) comments (with the True flag too — tested), so comments arelifted to a Text cell.
General:
regenerate the absolute output path is load-bearing, not just convenient.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.