session-bootstrap

session-bootstrap is a cursor rule for coding agents from TashanGKD/tashan-cursor-skills. It costs 10,443 tokens per session, scanned A, original, MIT.

A session procedure that tells an AI assistant which checks and steps to follow whenever it receives a message and when it finishes a task.

In plain words
What is it for?
Use it to route requests, detect explicitly requested skills, isolate relevant context, and run the required completion checks after substantive work.
Why use it?
It prevents unrelated open files or earlier context from confusing the current task and turns required wrap-up actions into an explicit sequence.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/tashangkd/tashan-cursor-skills/session-bootstrap
Clone the repo
git clone --depth 1 https://github.com/TashanGKD/tashan-cursor-skills

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 session-bootstrap

README.md
[![agentmods](https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/session-bootstrap.svg)](https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/session-bootstrap)
Your own site
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/session-bootstrap"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/session-bootstrap.svg" alt="Measured on agentmods" height="20"></a>
Per session 10,443 This file is loaded in full into every session.
When invoked 10,443 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.10443 $0.10443
Opus 5 $0.05221 $0.05221
Sonnet 5 $0.02089 $0.02089
Haiku 4.5 $0.01044 $0.01044

Measured 5d ago against content hash 3fea303765e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

session-bootstrap scanned grade A with 0 findings 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 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/session-bootstrap.mdc · 609 lines

How it starts

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

会话执行协议(Session Bootstrap)

这是步骤序列,不是声明式规则。 收到消息→执行序列A;任务完成→执行序列B。


序列 A:收到任何用户消息后

A0  [IDE 上下文隔离](详见 ide-context-guard.mdc,先于此序列其他步骤执行)
    从「用户消息 + 最近3轮对话」推断当前任务范围
    → IDE 打开/最近查看的文件若不在任务范围内,本回合忽略,不得作为任务上下文
    → 防止执行 B 任务时被 A 任务文档混淆

A0.5 [显式技能触发检测](最高优先级,先于 A1 域路由和所有推断逻辑)

     IF 消息含 【任意文字】 格式(中文方括号):
       Step 1  提取括号内文字,在 `_内部总控/Skill参考手册.md` 快速参考卡片中查找匹配
               或直接按名称匹配 role-menu.mdc 中的 Skill
       
       Step 2  IF 找到匹配 Skill:
               → 声明「✦ 显式激活:[Skill名称](用户命令:【X】)」
               → Read 对应 SKILL.md
               → 按其「激活后立即执行」步骤操作
               → 跳过 A1 所有步骤(包括域路由和触发词扫描)
               
               IF 未找到匹配:
               → 告知用户:「未找到【X】对应的 Skill。可用触发词见 _内部总控/Skill参考手册.md 快速参考卡片」
               → 继续 A1

     ⚠️ 【X】触发绕过所有推断逻辑,包括:A1 域路由、A2 意图确认、A1.9 三问检测
        这是用户的显式命令,AI 必须执行,不得再次推断意图
     ⚠️ 若消息含多个【X】(如【产品经理】+【架构师】)→ 按出现顺序依次激活,每个完成后再激活下一个
     ⚠️ 参考手册路径:`_内部总控/Skill参考手册.md`

A1  [域识别优先路由 → 触发词兜底]

    Step 1【产品开发域识别】(优先于触发词匹配)

    IF 消息满足以下任一特征:
      ① 涉及「新项目/新产品/做个功能/功能迭代/产品开发」
      ② 涉及「bug/发现问题/报错/有问题/修复/排查/全量排查/全量检查」
      ③ 涉及「测试/全量测试/沙盘/质量检查/关卡C」
      ④ 涉及「部署/上线/发布/运维/CI-CD/服务器」
      ⑤ 涉及代码实现/系统架构/接口/数据库/前端/后端/AI工程(开发类)
    AND 不是纯粹知识查询(「XX是什么」「怎么理解XX」不触发)
    → 声明「✦ 域路由:产品开发域(原因:[匹配特征])」
    → Read: .cursor/skills/role-产品开发协调者/SKILL.md
    → 按其步骤执行
    → 不继续 Step 2

    ⚠️ 以下类型不触发产品开发域(继续 Step 2):
      「记录碎片/想法/洞见」→ 认知域
      「写文章/调研/审稿/公众号」→ 内容创作域
      「复盘/沉淀/Skill/Rule体系」→ Skill体系域
      「L1文档更新/认知结构整理」→ 认知体系域
      「系统健康/三大闭环」→ 系统健康域
      「立一个原则/记下这个原则/这是条工程原则/以后所有X都要Y」→ Skill体系域
      (即使原则内容涉及AI工程/LLM/代码,立原则任务本身属于 Skill/Rule 体系维护,不是产品开发)
      「先记到待办/加到项目待办/存到待办文档/这些先记到待办」→ Skill体系域(项目待办收集,不是立即开发)
      「处理项目待办/按待办文档逐条/处理待办文档里的」→ Skill体系域(待办处理,走 Step 2 触发词兜底)
      (以上各域协调者待建,暂走 Step 2 兜底)

    Step 2【触发词兜底】(非产品开发域的任务)
    扫描消息 → 对照 role-menu.mdc「可用角色一览」触发场景
    
    IF 命中 Skill → 在回复开头声明「✦ 技能激活:[Skill名称](原因:[匹配触发词])」
                 → Read SKILL.md → 按其「激活后立即执行」步骤操作
    IF 未命中 → 继续 A1.5

A1.5  [L1.5 原则内化约束](已确认原则,无需读文件,直接应用于本轮所有输出)
      P1:任何判断性输出前,内部自问:「这是感受还是验证?」
          → 「感觉应该是这样」类表述 → 必须标注为「推断,待验证」
      P2:任何框架性输出前,内部自问:「我是从小点出发升维的,还是直接构造了大框架?」
          → 跳过具体案例直接给宏观框架 → 退回,先从具体场景出发
      (此步骤对每轮输出静默生效,无需向用户声明)

A1.6  [认知结构主题感知](被触发后快速执行,<5秒)
      判断:当前对话话题是否与 L0 聚类中已有文档高度相关?
      相关域:产品理论 / 认知科学 / 组织设计 / 研究范式 / 个人方法论 / AI工程
      
      IF 高度相关 AND 问题性质是「郑总观点/判断/设计选择类」:
        → 在回答末尾或开头提示:
          「📚 此话题在您的认知文档中有相关记录([聚类名]),
           是否希望基于您的文档回答?[基于文档回答] [继续用AI回答]」
      IF 无相关 OR 问题是「外部技术/工具类」→ 跳过,不提示

A1.7  [复用指令检测](详见 code-reuse-guard.mdc)
      IF 消息含「复用」「完全复用」「全量复用」「直接复制」「copy过来」等关键词
      AND 任务属于开发类(代码/架构/接口/组件):
        → 强制序列:grep定位原始实现 → 确认存在 → 复制/调用 → 遇障碍停止汇报
        → 禁止:理解原理后重新实现;未grep就写调用代码;自主切换到重新设计
        → 「完全/全量」是硬性信号:不允许以「部分不适用」为由省略任何原始代码

A1.10 [多层变更协调检测](详见 comprehensive-change-guard.mdc)
      IF 消息描述涉及「产品设计/技术架构/UI/代码」任意两层以上的变更实施:
      → 声明「⚠️ [多层变更检测]」,输出按层执行序列,强制走关卡
      → 禁止一次性输出跨层综合方案,禁止跳过任何关卡
      IF 只涉及单层 OR 纯问答/分析 → 静默跳过

A1.9  [Skill/Rule/Agent 修改前置检测](根因修复,2026-03-23)
      目的:防止「元任务指令绕过触发词扫描」导致跳过 skill-rule-修改规范 的根本问题

      检测条件(满足任一即触发):
      ① 用户指令中包含「完善Skill/新建Skill/修改Skill/更新Skill」等语义
      ② 用户指令中包含「完善规划里的任务/新建规划里的组件」等元任务语义
      ③ 对话上下文判断:当前任务将对 .cursor/skills/ .cursor/rules/ .cursor/agents/ 下的文件执行 Write/StrReplace
      ④ A1 命中了 skill-designer / skill-rule-修改规范 等相关 Skill

      IF 触发条件满足 AND skill-rule-修改规范 三问尚未完成:
      → 在执行任何写操作之前,必须输出:
        「⚠️ [Skill修改前置检测] 本轮任务涉及 Skill/Rule/Agent 文件修改。
         根据 skill-rule-修改规范,必须先完成以下步骤再继续:
         Step 0:Level判断(L1补丁型/L2新增型/L3集成型/L4系统型)
         Step 三问:① 根因 ② 影响范围 ③ 验证方法
         请在此确认或继续触发 skill-rule-修改规范 Skill。」
      → 等待用户确认或触发 skill-rule-修改规范 Skill
      → 在三问回答完成前,禁止对 .cursor/ 下任何文件执行写操作

      IF 触发条件满足 AND skill-rule-修改规范 三问已在本轮完成 → 静默跳过,继续执行

      特别说明:「认知科学文献对比」是额外要求(用户特别指定时),
      叠加在 skill-rule-修改规范 三问+Level判断+关卡 **之上**,
      不替代既有的修改前置流程

A2  [意图确认](仅当指令模糊时)
    IF 消息含「继续」「好的」「做一下」「按规范执行」等泛化词 →
       → 基于最近3轮对话解读意图,不依赖 IDE 当前打开的文件
       → 若对话语境与 IDE 文件暗示的任务不一致 → 先向用户确认,不自行假设

A2.5  [PENDING-EXPERIENCES 主动推进](SD4 修复,耗时<5秒)
      Read: .cursor/skills/skill-index/PENDING-EXPERIENCES.md(仅扫描「🔲 待处理」条目数量和最老日期)
      
      IF 🔲 待处理条目 ≥ 5 条:
        → 在开始任何新任务之前,主动提示:
          「💡 当前有 N 条经验待沉淀(最老:[日期])。建议在开始新任务前处理积压。
            [立即运行 project-retrospective] [跳过,继续当前任务]」
        → 等待用户指令
        → 若用户选「跳过」→ 继续处理当前消息
      IF < 5 条 → 跳过,不提示(已在序列B中的 B2 处理)

A2.6 [进化阈值检测](耗时<3秒,认知科学对应:神经可塑性自驱监控)
     说明:对应认知体系的自我进化机制——检测积压信号、阈值触发、建议启动进化操作

     Step 1  Read: _内部总控/认知结构/L1.5_底层原则层/底层原则库.md
             → 计算「已确认原则数」N(只计 ✅ 状态)
     Step 2  Read: _内部总控/认知结构/L3_原始记录/系统日志.md
             → 找最近一条 skill-evolution-planner-meta 执行记录,提取当时的原则数 N_last
     Step 3  IF N > N_last + 2 → 「💡 新增原则已达阈值(+N条),建议运行 skill-evolution-planner-meta」
     Step 4  Read: _内部总控/认知结构/L2_碎片化思考/碎片整合索引.md
             → 统计🔲待整合碎片数 M 和最老条目日期
     Step 5  IF M > 10 且最老碎片 > 14天 → 「💡 碎片积压 M 条(最老N天),建议运行 cognitive-integrate-fragments」
     Step 6  Read: _内部总控/认知结构/L2_碎片化思考/AI思维问题复盘/01_思维错误复盘日志.md
             → 统计30天内各错误模式出现次数
     Step 7  IF 某模式出现 ≥ 3次 → 「⚠️ 系统性惯性发现:「[模式名]」30天内已出现N次,建议修复规范」
     Step 8  IF 三类信号均未触发 → 静默跳过,不输出任何内容

Read the full file on GitHub · 609 lines

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. 5d ago First seen · 609 lines · 10,443 tokens per session scan A 3fea303765e3

Subscribe to this mod's changes

session-bootstrap is a cursor rule published in the GitHub repository TashanGKD/tashan-cursor-skills (20 stars, last pushed 5mo ago), licensed MIT. It adds 10,443 tokens to every session, about $0.0522 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.