other
- Location
hooks/log-session.sh:10- Finding
Persistent Collection of Cross-Session Transcript and Memory Metadata
- Content
View full analysis
&2 exit 0 fi if ! touch "$LOG"; then printf '%s\n' 'agent-constraints: cannot create session log' >&2 exit 0 fi # 每次都收紧,不只在新建时:已存在的日志可能是更宽的权限建的。 if ! chmod 600 "$LOG"; then printf '%s\n' 'agent-constraints: cannot secure session log' >&2 exit 0 fi ``` `hooks/log-session.sh:49-55`: ```python print("\t".join([ field(datetime.datetime.now().isoformat(timespec="seconds")), field(event.get("cwd", "?")), field(event.get("reason", "?")), field(event.get("session_id", "?")), field(event.get("transcript_path", "?")), ])) ``` `hooks/README.md:53-66`: ```markdown 制表符分隔的五列:时间、工作目录、结束原因、session_id、transcript 路径。 **只记指针,不做内容提取。** transcript 的 JSONL 结构未公开,脚本里解析它会在版本变动时 静默失效。复盘时由 agent 去读这些文件更稳,也更聪明。 ## 另一个信号源:auto memory Claude Code 的 auto memory 本来就在记「你给 Claude 的纠正」,存在 `~/.claude/projects//memory/` 下,frontmatter 里 `type: feedback` 的那些文件。 这是**已经存在的、经过消化的**信号,比原始 transcript 好读。复盘时两个都看: - 会话日志 → 哪些会话值得回看,以及总量趋势 - auto memory 的 feedback 文件 → 已经被识别出来的纠正 ``` `SKILL.md:185-191`: ```markdown 约束的触发条件是「第二次犯同一个错」,这是**跨会话**的信号,所以不做实时判断,只做记录 + 定期复盘。记录机制的装法见 `hooks/README.md`。 建议节奏:每周,或每积累 15–20 个会话一次。**不要每个会话都做**——噪声大于信号。 1. **收集**。两个信号源都看: - `~/.claude/constraint-review.log`(SessionEnd hook 的记录)——哪些会话值得回看 - `~/.claude/projects//memory/` 下 `type: feedback` 的文件——auto memory 已经消化过的纠正 ``` ### Technical Analysis The optional `SessionEnd` hook creates a persistent index containing the working directory, session identifier, and transcript path for e ...[truncated 2532 chars]- Remediation
View remediation
