Skip to content

Interactive 2D wave optics simulator. Turn any image into a refractive scene, add sources, watch waves refract, diffract and interfere. Probes, intensity maps, video export.

C#

Notes: the timeline is finished; a hook that lets git change the repository only on the user's word

Alexander Graef162adf993015
diff --git a/.claude/hooks/git-guard.py b/.claude/hooks/git-guard.py
new file mode 100644
index 0000000..b66b6c7
--- /dev/null
+++ b/.claude/hooks/git-guard.py
@@ -0,0 +1,61 @@
+# Claude Code hooks (2026-10-16): the agent never commits on its own, and the user never jumps through a hoop.
+#
+# record (UserPromptSubmit) stores the user's latest message for this session.
+# guard (PreToolUse, Bash and PowerShell) lets a git command that changes the repository (commit, push,
+# reset, rebase, merge, tag, revert, cherry-pick, restore, clean, stash, checkout, am) run only when
+# the user's latest message asks for that very action by name ("commit", "push", ...), not negated
+# ("don't commit"). Anything else is denied, in every permission mode. Reads (status, diff, log) pass.
+#
+# The user's word is the permission, exactly as the rule was given: "commit" said for the change at hand.
+import json
+import os
+import re
+import sys
+import tempfile
+
+VERBS = "commit|push|reset|rebase|merge|tag|revert|cherry-pick|restore|clean|stash|checkout|am"
+GUARDED = re.compile(r"\bgit\b[^|;&\n]*\b(" + VERBS + r")\b")
+NEGATED = re.compile(r"\b(don'?t|do not|not|never|no|without|stop|instead of)\b(\W+\w+){0,2}\W+\b(commit|push|reset|rebase|merge|tag|revert|cherry-pick|restore|clean|stash|checkout|am)", re.I)
+
+
+def prompt_file(session):
+ return os.path.join(tempfile.gettempdir(), "claude-last-prompt-" + re.sub(r"[^\w-]", "_", session or "none") + ".txt")
+
+
+def main():
+ mode = sys.argv[1] if len(sys.argv) > 1 else "guard"
+ try:
+ data = json.load(sys.stdin)
+ except ValueError:
+ data = {}
+ session = data.get("session_id") or ""
+ if mode == "record":
+ with open(prompt_file(session), "w", encoding="utf-8") as f:
+ f.write(data.get("prompt") or "")
+ return
+ command = (data.get("tool_input") or {}).get("command") or ""
+ match = GUARDED.search(command)
+ if not match:
+ return
+ verb = match.group(1)
+ try:
+ with open(prompt_file(session), encoding="utf-8") as f:
+ prompt = f.read()
+ except OSError:
+ prompt = ""
+ asked = re.search(r"\b" + re.escape(verb) + r"\w*", prompt, re.I) is not None and not NEGATED.search(prompt)
+ if asked:
+ return # the user asked for it in their latest message: the command runs
+ print(json.dumps({
+ "hookSpecificOutput": {
+ "hookEventName": "PreToolUse",
+ "permissionDecision": "deny",
+ "permissionDecisionReason": (
+ "Blocked: 'git " + verb + "' changes the repository and the user's latest message does not ask for a "
+ + verb + ". The agent must not do this on its own; it runs only after the user asks for it by name."
+ ),
+ }
+ }))
+
+
+main()
diff --git a/.claude/settings.json b/.claude/settings.json
new file mode 100644
index 0000000..98d8f97
--- /dev/null
+++ b/.claude/settings.json
@@ -0,0 +1,29 @@
+{
+ "hooks": {
+ "UserPromptSubmit": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "python -I \"$CLAUDE_PROJECT_DIR/.claude/hooks/git-guard.py\" record",
+ "timeout": 10
+ }
+ ]
+ }
+ ],
+ "PreToolUse": [
+ {
+ "matcher": "Bash|PowerShell",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "python -I \"$CLAUDE_PROJECT_DIR/.claude/hooks/git-guard.py\" guard",
+ "timeout": 10,
+ "onFailure": "block",
+ "statusMessage": "Checking for a git command the user did not ask for"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/CLAUDE.md b/CLAUDE.md
index c2ef26b..1c3ddec 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1001,8 +1001,7 @@ cover them. Left: probe data as CSV (series per step, profiles per frame), an in
canvases, HEVC (Media Foundation has it on some machines). Author's point 10.
**Also open, smaller.** base64 vs BaseXML for the embedded image; the RAM-first frame store (numbers above);
-dropping the 9-point Laplacian (author's suggestion, user undecided); timeline event tracks, zoom and
-pan (roadmap).
+dropping the 9-point Laplacian (author's suggestion, user undecided).
## Roadmap
@@ -1016,17 +1015,10 @@ pan (roadmap).
order of value: probe data as CSV.
Store: ~~a RAM-first frame store with a budget~~ (done 2026-10-14, two tiers, no background spill
needed: the file takes the tail of a run that does not fit).
- Timeline, agreed 2026-10-09 (the scrub bar, in/out range, transport keys and the available-frames
- shading are done; these stay inside the preview pane, below the pictures):
- - **Event tracks** under the bar, one row per source and probe on the same time axis: a source
- draws a bar from its start to its end step (pulse envelope as a filled shape), a probe draws
- its start step as a flag; clicking selects the item in the Project tree, dragging a bar's
- edge changes its start/stop steps. Needs a scrollable track area and a collapse rule for
- many rows.
- - **Zoom and pan of the time axis**: Ctrl+wheel zooms around the cursor, Shift+wheel pans, a
- thin overview bar shows the visible window; needed once tracks exist, since 2500 steps at
- one pixel per frame do not fit.
- Deferred, possibly never: filmstrip thumbnails behind the bar (needs cached frames).
+ Timeline: the scrub bar, in/out range, transport keys and the available-frames shading are done and
+ **that is the timeline** (the user, 2026-10-16: it works, no need to complicate it). The event tracks, the
+ zoom and pan of the axis and the filmstrip thumbnails that an earlier session had planned for it are
+ dropped; do not resurrect them.
6. ~~Retire `Wave_Dude_2D`~~ (removed 2026-10-15 together with the VB source; the solution file still carries the old name).
## Rebrand and licensing (designed 2026-10-15, applied the same day)