mnemion: Hook for Claude Code

.claude/settings.json

Stop is a hook for Claude Code from daniloc/mnemion. Its token cost is not measured, scanned B, a copy of SessionStart, MIT.

An automatic command hook that runs when the agent finishes replying. It calls a project script named `coherence-hook` with the `Stop` event.

In plain words
What is it for?
Use it for project-specific work that should happen after every agent response, such as checks or other actions implemented by the `coherence-hook` script.
Why use it?
It lets a project run its own end-of-response check or action without relying on someone to remember to start it manually.

Hook for Claude Code

Written for Claude Code: ${CLAUDE_PROJECT_DIR variable. Also seen: positional $N argument; mentions Codex.

This is daniloc/mnemion's own configuration. It tells Claude Code how to work on mnemion itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mnemion configures →

One of 8 entries in settings.json upstream. Installing this one merges just its entry into your config; the other 7 are separate, each on its own page.

Reuse

Borrowing it

Nothing to install: this file belongs to daniloc/mnemion. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/daniloc/mnemion/main/.claude/settings.json
Clone the repo
git clone --depth 1 https://github.com/daniloc/mnemion

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Stop

README.md
[![agentmods](https://agentmods.dev/badge/hooks/daniloc/mnemion/stop/github.svg)](https://agentmods.dev/hooks/daniloc/mnemion/stop)
Your own site
<a href="https://agentmods.dev/hooks/daniloc/mnemion/stop"><img src="https://agentmods.dev/badge/hooks/daniloc/mnemion/stop/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Stop

Your own site · 80×15
<a href="https://agentmods.dev/hooks/daniloc/mnemion/stop"><img src="https://agentmods.dev/badge/hooks/daniloc/mnemion/stop.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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 B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 38% copy Near-identical to another mod in the catalogue.
Security

Grade B, and why

Stop scanned grade B 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 today.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

"command": "root=\"${CLAUDE_PROJECT_DIR:-$PWD}\"; while [ \"$root\" != / ] && [ ! -f \"$root/.claude/settings.json\" ] && [ ! -f \"$root/.codex/hooks.json\" ]; do root=$(dirname \"$root\"); done; coherence=; for c in \"$
Origin

This is a copy

38% identical to SessionStart — 8 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/settings.json · 13 lines

How it starts

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

{
  "Stop": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "root=\"${CLAUDE_PROJECT_DIR:-$PWD}\"; while [ \"$root\" != / ] && [ ! -f \"$root/.claude/settings.json\" ] && [ ! -f \"$root/.codex/hooks.json\" ]; do root=$(dirname \"$root\"); done; coherence=; for c in \"${COHERENCE_HOME:+$COHERENCE_HOME/src/cli.ts}\" \"$root/mnemion-swift/node_modules/@posthog/coherence/dist/cli.js\" \"$root/mnemion-swift/node_modules/.bin/coherence\" \"$root/node_modules/@posthog/coherence/dist/cli.js\" \"$root/node_modules/.bin/coherence\"; do if [ -n \"$c\" ] && [ -f \"$c\" ]; then coherence=$c; break; fi; done; coherence() { if [ -z \"$coherence\" ]; then if [ \"$2\" = SessionStart ]; then printf '%s\\n' '{\"systemMessage\":\"Coherence is configured for this project but not installed, so its hooks do nothing this session; the agent has been told how to install it.\",\"hookSpecificOutput\":{\"hookEventName\":\"SessionStart\",\"additionalContext\":\"Coherence is configured for this project (its hooks are in the agent host settings) but is not installed, so they do nothing this session: no vocabulary, specs, journal or checks. If package.json already lists @posthog/coherence, the project install has not run here: run it with the package manager this project uses (npm ci, pnpm install, yarn install). Otherwise add it as a dev dependency (npm install -D @posthog/coherence, pnpm add -D @posthog/coherence, or yarn add -D @posthog/coherence), which changes package.json and the lockfile. Changing the project dependencies is for the user to decide: unless the user asked for Coherence in this session, tell them it is missing and ask before installing it. Once it is installed, npx --no -- coherence spec --check confirms it, and the hooks answer from their next event.\"}}'; fi; exit 0; fi; if ! command -v node >/dev/null 2>&1; then if [ \"$2\" = SessionStart ]; then printf '%s\\n' '{\"systemMessage\":\"Coherence was found but node is not on the PATH its hook

Read the full file on GitHub · 13 lines

Same file

What else settings.json configures

This page is one entry in a file that holds 8. Installing the file brings all of them; each is measured and scanned on its own page.

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. today Changed scan A → B 51e44bfa1064
  2. 16d ago Changed · +1 lines 4962733bfe0e
  3. 1mo ago First seen · 12 lines scan A b0af324d077e

Subscribe to this mod's changes

Stop is a hook published in the GitHub repository daniloc/mnemion (22 stars, last pushed today), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it B with 1 finding (reads agent configuration directories). It is 38% identical to SessionStart, differing in 8 lines, and is treated as a copy.