Skip to content
Development
Hook

Hooks

What lumin-repo-lens runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

From plugin
lumin-repo-lens
263 skills9 commands4 hooks

Claude Code

> /plugin marketplace add annyeong844/lumin-repo-lens
> /plugin install lumin-repo-lens@annyeong844-marketplace

What fires, and when

UserPromptSubmit

Fires before Claude sees each prompt you send. A plugin can use it to inject context, so the same instruction reaches the model every turn instead of only at session start.

  • node "${CLAUDE_PLUGIN_ROOT}/hooks/user-prompt-submit.mjs"

PreToolUse

  • Matches*node "${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use.mjs"

PostToolBatch

  • node "${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-batch.mjs"

Stop

  • node "${CLAUDE_PLUGIN_ROOT}/hooks/stop.mjs"
Read hooks/hooks.json

Where it lives

  • hooks/_runner-utils.mjsGitHub
    Read the script
    import { existsSync, readFileSync, writeFileSync } from 'node:fs';
    import path from 'node:path';
    import { fileURLToPath, pathToFileURL } from 'node:url';
    
    const __dirname = path.dirname(fileURLToPath(import.meta.url));
    const PLUGIN_ROOT = path.resolve(__dirname, '..');
    
    export function readJsonFromStdin() {
      let raw = '';
      try {
        raw = readFileSync(0, 'utf8');
      } catch {
        return null;
      }
      if (raw.trim().length === 0) return null;
      try {
        return JSON.parse(raw);
      } catch {
        return null;
      }
    }
    
    export function emitHookOutput(output) {
      if (!output || typeof output !== 'object' || Array.isArray(output)) return;
      writeFileSync(1, `${JSON.stringify(output)}\n`);
    }
    
    export async function importEngineModule(name) {
      const candidates = [
        path.join(PLUGIN_ROOT, '_lib', name),
        path.join(PLUGIN_ROOT, 'skills', 'lumin-repo-lens', '_engine', 'lib', name),
      ];
      for (const file of candidates) {
        if (!existsSync(file)) continue;
        return import(pathToFileURL(file).href);
      }
      throw new Error(`engine module not found: ${name}`);
    }
    
    export async function runHookMain(fn) {
      try {
        await fn();
      } catch {
        // Hooks are advisory. Unexpected failures must not block the host action.
      } finally {
        process.exitCode = 0;
      }
    }
    
  • hooks/post-tool-batch.mjsRunsGitHub
    Read the script
    #!/usr/bin/env node
    
    import {
      emitHookOutput,
      importEngineModule,
      readJsonFromStdin,
      runHookMain,
    } from './_runner-utils.mjs';
    
    await runHookMain(async () => {
      const payload = readJsonFromStdin();
      if (!payload) return;
    
      const { processPostWriteLite } = await importEngineModule('hook-post-write-lite.mjs');
      const result = processPostWriteLite(payload);
      emitHookOutput(result.output);
    });
    
  • hooks/pre-tool-use.mjsRunsGitHub
    Read the script
    #!/usr/bin/env node
    
    import {
      emitHookOutput,
      importEngineModule,
      readJsonFromStdin,
      runHookMain,
    } from './_runner-utils.mjs';
    
    const MUTATING_TOOLS = new Set(['Edit', 'Write', 'MultiEdit']);
    
    await runHookMain(async () => {
      const payload = readJsonFromStdin();
      if (!payload) return;
    
      const cwd = typeof payload.cwd === 'string' ? payload.cwd : process.cwd();
      const {
        getToolTargetPath,
        resolveAuditRoot,
        safeRepoPathForToolInput,
      } = await importEngineModule('hook-path-safety.mjs');
      const {
        safeSessionId,
        safeToolUseId,
      } = await importEngineModule('hook-id-safety.mjs');
      const { capturePreimage } = await importEngineModule('hook-preimage-store.mjs');
      const { drainDueEventReminders } = await importEngineModule('hook-event-drain.mjs');
    
      const auditRoot = resolveAuditRoot(cwd);
      if (!auditRoot) return;
      const sid = safeSessionId(payload);
    
      if (MUTATING_TOOLS.has(payload.tool_name)) {
        try {
          const targetPath = getToolTargetPath(payload.tool_name, payload.tool_input ?? {});
          const safe = safeRepoPathForToolInput(cwd, targetPath);
          if (safe.ok) {
            const tid = safeToolUseId({
              tool_use_id: payload.tool_use_id,
              tool_name: payload.tool_name,
              tool_input: payload.tool_input ?? {},
            });
            capturePreimage({ auditRoot, sid, tid, safe });
          }
        } catch {
          // Continue to drain reminders even when preimage capture cannot proceed.
        }
      }
    
      const drain = drainDueEventReminders(auditRoot, sid, {
        hookEventName: 'PreToolUse',
      });
      emitHookOutput(drain.output);
    });
    
  • hooks/stop.mjsRunsGitHub
    Read the script
    #!/usr/bin/env node
    
    import {
      importEngineModule,
      readJsonFromStdin,
      runHookMain,
    } from './_runner-utils.mjs';
    
    await runHookMain(async () => {
      const payload = readJsonFromStdin();
      if (!payload) return;
    
      const cwd = typeof payload.cwd === 'string' ? payload.cwd : process.cwd();
      const { resolveAuditRoot } = await importEngineModule('hook-path-safety.mjs');
      const { safeSessionId } = await importEngineModule('hook-id-safety.mjs');
      const { observeStopAcknowledgements } = await importEngineModule('hook-ack-observer.mjs');
    
      const auditRoot = resolveAuditRoot(cwd);
      if (!auditRoot) return;
      observeStopAcknowledgements(auditRoot, safeSessionId(payload), payload);
    });
    
  • hooks/user-prompt-submit.mjsRunsGitHub
    Read the script
    #!/usr/bin/env node
    
    import {
      emitHookOutput,
      importEngineModule,
      readJsonFromStdin,
      runHookMain,
    } from './_runner-utils.mjs';
    
    await runHookMain(async () => {
      const payload = readJsonFromStdin();
      if (!payload) return;
    
      const cwd = typeof payload.cwd === 'string' ? payload.cwd : process.cwd();
      const { resolveAuditRoot } = await importEngineModule('hook-path-safety.mjs');
      const { safeSessionId } = await importEngineModule('hook-id-safety.mjs');
      const { drainDueEventReminders } = await importEngineModule('hook-event-drain.mjs');
    
      const auditRoot = resolveAuditRoot(cwd);
      if (!auditRoot) return;
      const drain = drainDueEventReminders(auditRoot, safeSessionId(payload), {
        hookEventName: 'UserPromptSubmit',
      });
      emitHookOutput(drain.output);
    });
    

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

@annyeong844
Ships withlumin-repo-lens

🇰🇷 한국어로 읽으시려면 → README.ko.md · 🇬🇧 English continues below. The kind little buddy that says "this already exists" before you write it again. Your repo's companion for vibe-coding sessions.

Stars on GitHub

Momentum

stars in total
26
Star history of annyeong844/lumin-repo-lens on GitHub, a chart by star-history.com

More plugins that ship hooks.

superpowers

superpowers

A development methodology for coding agents that makes the agent brainstorm before building, follow plans, run parallel work and finish branches in a disciplined way. You get fewer skipped steps and more consistent results from your coding assistant.

15 skills1 hook311k
@obra@obra
Install Plugin
ponytail

ponytail

A Claude Code plugin with skills for auditing a whole repo, reviewing a change, listing deferred shortcut comments, and showing measured savings and a quick command reference.

6 skills10 hooks188k
@dietrichgebert@dietrichgebert
Install Plugin
agent-skills

agent-skills

Walks a software change from a written spec through design, testing, code review, CI/CD, and release, applying the matching engineering skill at each stage. Useful for developers using Claude Code on full development workflows.

25 skills+3117k
@addyosmani@addyosmani
Install Plugin
planning-with-files

planning-with-files

Persistent file-based planning for AI coding agents on long-running, multi-step tasks. It keeps task_plan.md, findings.md and progress.md on disk, so work can resume after /clear or context compaction.

6 skills+228k
@othmanadi@othmanadi
Install Plugin
gsd-core

gsd-core

A spec-driven development workflow for Claude Code that guides a project through planning, phases, milestone audits and fixes. Includes skills to generate tests from UAT criteria and to audit completed work.

72 skills+311k
@open-gsd@open-gsd
Install Plugin
superpowers-zh

superpowers-zh

Chinese-language skill pack for Claude Code that adds workflow guidance for brainstorming, TDD, debugging, and code review, plus Chinese conventions for commits, documentation, and domestic Git platforms like Gitee and Coding.net.

21 skills1 hook8.5k
@jnmetacode@jnmetacode
Install Plugin
socraticode

socraticode

Gives Claude Code semantic search, dependency graph and architecture context over a codebase, so an AI assistant can explore and understand a project's code. Includes skills for indexing a project and managing its file watching.

2 skills+33.4k
@giancarloerra@giancarloerra
Install Plugin
cocoindex-code

cocoindex-code

A lightweight code search engine that uses AST-based semantic search with local embeddings and incremental indexing. It helps Claude Code users find code faster and more efficiently.

1 skill1 MCP+13k
@cocoindex-io@cocoindex-io
Install Plugin

Questions about the hooks in lumin-repo-lens.

Which coding agents can use the hooks in lumin-repo-lens?
The hooks in lumin-repo-lens install in Claude Code and Cursor: each runs Claude Code hooks from .claude/settings.json, so copy the hooks there.