Skip to content
AI & Agents
Hook

Hooks

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

From plugin
qiushi-skill
3.8k11 skills2 agents10 commands1 hook
Install
> /plugin marketplace add hughyau/qiushi-skill
> /plugin install qiushi-skill@qiushi-skill

Ships with qiushi-skill. Installing the plugin gets these hooks.

What fires, and when

SessionStart

Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.

  • Matchesstartup|clear|compact"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd" session-start
Read hooks/hooks.json

Where it lives

  • hooks/session-start.ps1GitHub
    Read the script
    [CmdletBinding()]
    param()
    
    Set-StrictMode -Version Latest
    $ErrorActionPreference = "Stop"
    [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
    
    function ConvertTo-AsciiJsonString {
        param([string]$Value)
    
        $builder = [System.Text.StringBuilder]::new()
        [void]$builder.Append('"')
    
        for ($i = 0; $i -lt $Value.Length; $i++) {
            $char = $Value[$i]
            $codePoint = [int][char]$char
    
            if ($codePoint -eq 34) {
                [void]$builder.Append('\"')
                continue
            }
    
            if ($codePoint -eq 92) {
                [void]$builder.Append('\\')
                continue
            }
    
            if ($codePoint -eq 8) {
                [void]$builder.Append('\b')
                continue
            }
    
            if ($codePoint -eq 12) {
                [void]$builder.Append('\f')
                continue
            }
    
            if ($codePoint -eq 10) {
                [void]$builder.Append('\n')
                continue
            }
    
            if ($codePoint -eq 13) {
                [void]$builder.Append('\r')
                continue
            }
    
            if ($codePoint -eq 9) {
                [void]$builder.Append('\t')
                continue
            }
    
            if ([char]::IsHighSurrogate($char) -and ($i + 1) -lt $Value.Length -and [char]::IsLowSurrogate($Value[$i + 1])) {
                [void]$builder.AppendFormat('\u{0:x4}\u{1:x4}', [int][char]$char, [int][char]$Value[$i + 1])
                $i++
                continue
            }
    
            if ($codePoint -lt 32 -or $codePoint -gt 126) {
                [void]$builder.AppendFormat('\u{0:x4}', $codePoint)
                continue
            }
    
            [void]$builder.Append($char)
        }
    
        [void]$builder.Append('"')
        $builder.ToString()
    }
    
    $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
    $pluginRoot = Split-Path -Parent $scriptDir
    $skillPath = Join-Path $pluginRoot "skills\arming-thought\SKILL.md"
    
    if (-not (Test-Path -LiteralPath $skillPath)) {
        throw "Missing skill file: $skillPath"
    }
    
    $armingThoughtContent = Get-Content -LiteralPath $skillPath -Raw -Encoding UTF8
    $sessionContext = @"
    <QIUSHI_SKILL>
    已加载 qiushi:arming-thought。请先遵守用户指令、项目约束和宿主平台规则,再在明确适用时把这份方法论作为补充的路由与校验框架。
    
    $armingThoughtContent
    
    </QIUSHI_SKILL>
    "@
    
    $sessionContextJson = ConvertTo-AsciiJsonString -Value $sessionContext
    
    if ($env:CURSOR_PLUGIN_ROOT) {
        @"
    {
      "additional_context": $sessionContextJson
    }
    "@
    } elseif ($env:CLAUDE_PLUGIN_ROOT) {
        @"
    {
      "hookSpecificOutput": {
        "hookEventName": "SessionStart",
        "additionalContext": $sessionContextJson
      }
    }
    "@
    } else {
        @"
    {
      "additional_context": $sessionContextJson
    }
    "@
    }
    

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.

Ships withqiushi-skill

语言: 简体中文 | English 🌟 "我们的同志在困难的时候,要看到成绩,要看到光明,要提高我们的勇气。" ✊ "世界上怕就怕'认真'二字。" 你的 AI 不应该是一个唯唯诺诺的工具。它应该是一个先看事实、再下判断的行动者。 「求是 Skill」是一个 AI Agent Skills 合集,从经典唯物辩证法与实践哲学中提炼出一条总原则和九大方法论工具,系统性地武装 AI 的大脑。不是口号,不是鸡汤,而是可操作的方法论集合。 每一条方法都有据可依、有迹可循,直接引用经典著作原文(详见各 skill 目录下的

Get the whole plugin