plugins/tools/cortex/skills/cortex-session/SKILL.md
导入 claude code / cli transcript → 记忆/L4-流水账/sessions/, 同步关键事件 append 到 ledger。Triggers on "import session", "导入会话", "归档会话", Stop hook 自动触发.
npx skillsauth add lazygophers/ccplugin cortex-sessionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
解析 CLI transcript (claude code jsonl / 其他) → 写入 记忆/L4-流水账/sessions/<cli>/<YYYY-MM>/<sid>.md 摘要骨架; 同步 append 关键事件到 ledger/<date>.jsonl。
1. 解析 transcript_path (hook stdin / $CLAUDE_TRANSCRIPT_PATH / --transcript)
路径必在用户 home 内 (防 path injection); 不存在 → 退 1
2. 推导日期 → YYYY-MM 桶
3. 按 jsonl 逐行解析 (空/损坏行跳过)
4. 提取摘要: title (首条 user prompt) / tool 计数 / files_touched / errors
5. 写 session md (frontmatter + 时间线 body) — 已存且无 --since 跳过
6. append ledger jsonl (file_write / error / clarification 等关键事件)
frontmatter / body / ledger 格式详见 references/session-format.md。
| 文件 | 用途 |
|---|---|
| references/session-format.md | transcript 解析 + frontmatter schema + ledger jsonl 格式 + 输出示例 + 错误处理 |
| references/hook-integration.md | Stop hook stdin 协议 + --since 增量导入 + 幂等保证 |
development
Go 数据库规范——GORM Model 命名 ModelXxx、表名单数、枚举 uint8 + 常量、索引 idx_ 前缀 + deleted_at leading column、禁 time.Time 统一 int64 unix、禁指针/nullable 字段、TEXT/BLOB/JSON 禁 default、AutoMigrate 禁改主键。设计 DB model、写 GORM tag、建索引、做 migration 审查时触发。
development
Go HTTP API 规范——响应始终 200 + body code 字段、路由 /api/* 全 POST 单段 <Action><Model>、中间件逐路由注册禁 Group(prefix,mw...)、handler 仅返回 (rsp,error)、认证走 header。设计 HTTP API、写路由/handler/中间件时触发。
development
Go 项目结构规范——三层架构(API → Impl → State)、全局状态模式、internal/ 私有包、cmd/ 仅 main.go、go.work 多模块、禁止 Repository 接口和 DI 容器、struct 公共字段开头全 omitempty、handler var rsp 顶声明、禁 legacy migration。设计项目骨架、新建目录、组织包、做架构评审时触发。
development
Go 命名规范——Id/Uid 字段(非 ID)、IsActive/HasMFA 布尔前缀、CreatedAt 时间字段、接收者统一用 p、包名全小写无下划线、泛型类型参数描述性命名、集合字段 xxx_list 禁 xxxs 复数、Enum 0 值 XxxNil 禁 Unknown、禁 Status 统一 State、Set/Update 语义区分。定义结构体字段、函数、变量、包、接收者名、泛型、枚举时触发。