PreToolUse

A pre-tool check that runs a shell command before selected artifact, visualisation, and web-fetching tools are used.

In plain words
What is it for?
Use it to control calls that create or update artefacts, display visual widgets, or fetch information from the web.
Why use it?
It automatically approves those calls for the listed Memoforge workflows, so the agent does not stop for repeated permission checks.

Hook

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add hooks/gregmos/memoforge/pre-tool-use
Clone the repo
git clone --depth 1 https://github.com/gregmos/memoforge
Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

PreToolUse scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

"command": "python3 -c \"import json,sys,re; from urllib.parse import urlparse as p; A=frozenset('ada.gov aepd.es aki.ee artificialintelligenceact.eu autoriteprotectiondonnees.be autoriteitpersoonsgegevens.nl azop.hr bay
hooks/hooks.json · 40 lines

How it starts

The opening of the file, as written. The whole thing — 40 lines — stays where its author put it; the contents beside it link to each section on GitHub.

{
  "PreToolUse": [
    {
      "matcher": "mcp__cowork__(create_artifact|update_artifact|list_artifacts)",
      "hooks": [
        {
          "type": "command",
          "command": "python3 -c \"import json,sys; sys.stdout.write(json.dumps({'hookSpecificOutput':{'hookEventName':'PreToolUse','permissionDecision':'allow','permissionDecisionReason':'memoforge live-progress dashboard pre-approved'}}))\""
        }
      ]
    },
    {
      "matcher": "mcp__.*visualize.*__(show_widget|read_me)",
      "hooks": [
        {
          "type": "command",
          "command": "python3 -c \"import json,sys; sys.stdout.write(json.dumps({'hookSpecificOutput':{'hookEventName':'PreToolUse','permissionDecision':'allow','permissionDecisionReason':'memoforge visualize widgets pre-approved (Phase 1.5 mockup / Phase 2a + 6.6 elicitation / Phase 3 plan diagram / Phase 12 final dashboard / milestone trackers)'}}))\""
        }
      ]
    },
    {
      "matcher": "^WebSearch$",
      "hooks": [
        {
          "type": "command",
          "command": "python3 -c \"import json,sys; sys.stdout.write(json.dumps({'hookSpecificOutput':{'hookEventName':'PreToolUse','permissionDecision':'allow','permissionDecisionReason':'memoforge research WebSearch pre-approved (currency-checker + doctrinal-researcher heavy users)'}}))\""
        }
      ]
    },
    {
      "matcher": "^WebFetch$|^mcp__.*fetch$",
      "hooks": [
        {
          "type": "command",
          "command": "python3 -c \"import json,sys,re; from urllib.parse import urlparse as p; A=frozenset('ada.gov aepd.es aki.ee artificialintelligenceact.eu autoriteprotectiondonnees.be autoriteitpersoonsgegevens.nl azop.hr baylda.de bfdi.bund.de bis.org cen.eu cenelec.eu cisa.gov cnil.fr cnpd.public.lu cnpd.pt coe.int congress.gov courtlistener.com cppa.ca.gov cpdp.bg datatilsynet.dk datatilsynet.no datenschutz-berlin.de datenschutz.hessen.de datenschutzkonferenz-online.de dataprotection.gov.cy dataprotection.gov.sk dataprotection.

Read the full file on GitHub · 40 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 40 lines scan A 7068b6c34335

Subscribe to this mod's changes

PreToolUse is a hook published in the GitHub repository gregmos/memoforge (20 stars, last pushed 3mo ago), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.