SessionEnd

SessionEnd is a hook for Claude Code from sifxprime/kodelyth-ecc. Its token cost is not measured, scanned A, a copy of Stop, MIT.

A session-end hook that runs a Node.js script when an agent session finishes.

In plain words
What is it for?
Use it to trigger the referenced run-with-flags.js script at the end of a session.
Why use it?
It automates a final action at session close, so that action does not depend on remembering to run it manually.

Hook for Claude Code

Written for Claude Code: SessionEnd hook event.

Runs only inside a plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else, and the catalogue could not identify which plugin ships it.

One of 8 entries in hooks.json — they are configured in one file and arrive together.

Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

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 SessionEnd

README.md
[![agentmods](https://agentmods.dev/badge/hooks/sifxprime/kodelyth-ecc/session-end.svg)](https://agentmods.dev/hooks/sifxprime/kodelyth-ecc/session-end)
Your own site
<a href="https://agentmods.dev/hooks/sifxprime/kodelyth-ecc/session-end"><img src="https://agentmods.dev/badge/hooks/sifxprime/kodelyth-ecc/session-end.svg" alt="Measured on agentmods" 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 A 1 finding. Scan, not verified.
Origin 89% copy Near-identical to another mod in the catalogue.
Security

Grade A, and why

SessionEnd 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

"command": "node -e \"const fs=require('fs');const path=require('path');const {spawnSync}=require('child_process');const raw=fs.readFileSync(0,'utf8');const rel=path.join('scripts','hooks','run-with-flags.js');const hasR
Origin

This is a copy

89% identical to Stop — 122 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.

hooks/hooks.json · 17 lines

How it starts

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

{
  "SessionEnd": [
    {
      "matcher": "*",
      "hooks": [
        {
          "type": "command",
          "command": "node -e \"const fs=require('fs');const path=require('path');const {spawnSync}=require('child_process');const raw=fs.readFileSync(0,'utf8');const rel=path.join('scripts','hooks','run-with-flags.js');const hasRunnerRoot=candidate=>{const value=typeof candidate==='string'?candidate.trim():'';return value.length>0&&fs.existsSync(path.join(path.resolve(value),rel));};const root=(()=>{const envRoot=process.env.CLAUDE_PLUGIN_ROOT||'';if(hasRunnerRoot(envRoot))return path.resolve(envRoot.trim());const home=require('os').homedir();const claudeDir=path.join(home,'.claude');if(hasRunnerRoot(claudeDir))return claudeDir;for(const candidate of [path.join(claudeDir,'plugins','ecc'),path.join(claudeDir,'plugins','ecc@ecc'),path.join(claudeDir,'plugins','marketplace','ecc'),path.join(claudeDir,'plugins','kodelyth-ecc'),path.join(claudeDir,'plugins','kodelyth-ecc@kodelyth-ecc'),path.join(claudeDir,'plugins','marketplace','kodelyth-ecc')]){if(hasRunnerRoot(candidate))return candidate;}try{for(const slug of ['ecc','kodelyth-ecc']){const cacheBase=path.join(claudeDir,'plugins','cache',slug);for(const org of fs.readdirSync(cacheBase,{withFileTypes:true})){if(!org.isDirectory())continue;for(const version of fs.readdirSync(path.join(cacheBase,org.name),{withFileTypes:true})){if(!version.isDirectory())continue;const candidate=path.join(cacheBase,org.name,version.name);if(hasRunnerRoot(candidate))return candidate;}}}}catch{}return claudeDir;})();const script=path.join(root,rel);if(fs.existsSync(script)){const result=spawnSync(process.execPath,[script,'session:end:marker','scripts/hooks/session-end-marker.js','minimal,standard,strict'],{input:raw,encoding:'utf8',env:process.env,cwd:process.cwd(),timeout:30000});const stdout=typeof result.stdout==='string'?result.stdout:'';if(stdout)process.stdout.write(stdout);else process.stdout.write(raw);if(result.stderr)process.std

Read the full file on GitHub · 17 lines

Same file

What else hooks.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. 2d ago First seen · 17 lines scan A 65c19de4b8a0

Subscribe to this mod's changes

SessionEnd is a hook published in the GitHub repository sifxprime/kodelyth-ecc (11 stars, last pushed 4d 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 (runs shell commands). It is 89% identical to Stop, differing in 122 lines, and is treated as a copy.