Skip to content

kkfor30/kk-sessions / skills/kk-session-route

kk-session-route

Verified

新会话第一轮做会话归位:按工作区地图判断这次内容属于哪个分区和目录,建主题目录、切目录、按统一格式命名、归入侧栏分区。Claude Code 由启动钩子触发,先处理用户的请求、本轮结束前完成归位;Codex 的标题和分区由后台钩子自动完成,会话本身只负责把产物写到目标目录;用户说"路由一下""这个会话归到哪""重新归类"时也使用。支持 Claude Code 桌面端和 Codex 桌面端。不用于中途换话题时自动迁移;批量整理旧会话用 kk-session-tidy,首次生成地图用 kk-session-setup。

FileKindSize
SKILL.mdskill md9.0 KB
scripts/codex_route.pyscript28.3 KB
scripts/kit.pyscript979 B
scripts/restore.pyscript7.2 KB
scripts/session_start.pyscript1.8 KB
scripts/stop_check.pyscript2.8 KB
scripts/turn_hint.pyscript5.8 KB

scripts/session_start.py

View on GitHub
"""SessionStart 钩子(Codex):新会话开头给会话模型一段说明,代替写进全局指令。

标题和分区由 Stop 钩子 codex_route.py 在后台处理;这里只交代会话本身要做的事:
产物写进地图目录、提议新分区。之后每轮的 ⏳ 由 turn_hint.py 提醒。没有工作区地图时不输出。
JSON 按 ASCII 转义输出,避免 Windows 控制台代码页把中文弄乱。
"""
import json
import sys
from pathlib import Path

HINT = ("[kk-sessions] 本会话由 kk-sessions 管理:"
        "1)新会话的标题和侧栏分区由后台钩子在每轮结束后自动处理,不要自己改,也不要调用 move_thread_to_project。"
        "2)要产出文件的任务,动手前先读 ~/.agent-rules/workspace-map.md,按 kk-session-route 的「回答前」一节定分区和产物目录、"
        "没有就建目录和 README.md,产物一律写到该目录的绝对路径;会话所在文件夹不是该目录时,回复最后一句告诉用户产物在哪。"
        "3)这次是长期的新领域或新长期项目、和地图里所有分区都对不上时,回复末尾按 kk-session-route 的「新分区」一节提议新分区,"
        "用户同意后再更新地图、建目录、建分区并移入。"
        "4)之后每轮开头会有 [kk-sessions] 提醒说明怎么维护标题末尾的 ⏳,按提醒做;除此之外不改标题。")

try:
    source = json.loads(sys.stdin.read(1024 * 1024) or "{}").get("source")
except ValueError:
    source = None

# 恢复旧会话时不重复注入:说明只对新会话有用
if source != "resume" and (Path.home() / ".agent-rules" / "workspace-map.md").exists():
    print(json.dumps({"hookSpecificOutput": {"hookEventName": "SessionStart", "additionalContext": HINT}}))
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall