Skills used absolute paths (~/dev/claude/projects/claude-foundations/...) which get blocked by Claude Code's sandbox when running from other projects. Changed to relative paths (../claude-foundations/) with local-first fallback and inline defaults so skills work regardless of sandbox restrictions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
97 lines
3.6 KiB
Markdown
97 lines
3.6 KiB
Markdown
---
|
|
name: log
|
|
description: >
|
|
End-of-session logging. Captures key decisions, gotchas, open questions, and discussion
|
|
points into memory/log/ for later reflection. Run before ending a session to preserve
|
|
context. Fast and low-friction — just run /log.
|
|
allowed-tools: Read, Write, Glob, Bash(date *), Bash(ls *), Bash(cat *), Bash(find *), Bash(rm *), Bash(mkdir *)
|
|
---
|
|
|
|
# Session Log Skill
|
|
|
|
You are capturing key points from the current session into a structured log file.
|
|
|
|
## Pre-gathered context
|
|
|
|
### Current date and session timestamp
|
|
!`date +%Y-%m-%d`
|
|
!`date +%Y%m%d-%H%M%S`
|
|
|
|
### Existing log files
|
|
!`ls -1 memory/log/ 2>/dev/null || echo "No log directory yet"`
|
|
|
|
### Settings
|
|
!`cat settings.yaml 2>/dev/null || cat ../claude-foundations/settings.yaml 2>/dev/null || echo "No settings file found — using defaults: retention_days=7, warn_unreflected_days=14"`
|
|
|
|
### Reflection state (to check what has been reflected)
|
|
!`cat .reflection-state.json 2>/dev/null || echo "No reflection state yet"`
|
|
|
|
### Current MEMORY.md index
|
|
!`cat MEMORY.md 2>/dev/null || echo "No MEMORY.md found"`
|
|
|
|
## Instructions
|
|
|
|
Review the **full conversation history** in your context window and extract the key points worth preserving. Not every session needs a log — if the session was trivial (a typo fix, a quick question), say so and skip.
|
|
|
|
### Step 1: Create the log directory if needed
|
|
|
|
If `memory/log/` does not exist, create it with `mkdir -p memory/log/`.
|
|
|
|
### Step 2: Write the log file
|
|
|
|
Generate the filename as `memory/log/YYYY-MM-DD.<HHMMSS>.md` using the pre-gathered date and timestamp values.
|
|
|
|
Write the file using this format:
|
|
|
|
```markdown
|
|
# Session Log — YYYY-MM-DD
|
|
|
|
## Summary
|
|
<!-- 1-2 sentence overview of what was accomplished or discussed -->
|
|
|
|
## Decisions
|
|
<!-- Bulleted list of decisions made and brief rationale. Omit section if none. -->
|
|
- Decision: <what> — Rationale: <why>
|
|
|
|
## Gotchas Discovered
|
|
<!-- Symptom + fix format, tagged by topic area. Omit section if none. -->
|
|
- **[topic]** Symptom: <what happened> — Fix: <what resolved it>
|
|
|
|
## Open Questions
|
|
<!-- Things unresolved that need follow-up. Omit section if none. -->
|
|
- <question>
|
|
|
|
## Key Context
|
|
<!-- Important facts, configurations, or patterns worth remembering. Omit section if none. -->
|
|
- <fact>
|
|
|
|
## Process Notes
|
|
<!-- What went well, what was slow, what to do differently. Omit section if none. -->
|
|
- <note>
|
|
```
|
|
|
|
**Guidelines:**
|
|
- Omit empty sections entirely rather than leaving them blank
|
|
- The `[topic]` tag on gotchas should match existing memory topic names where possible (e.g., `[k8s]`, `[cilium]`, `[ansible]`, `[sops]`, `[helm]`). Use new tags for new topics.
|
|
- Keep entries concise — this is raw material for `/reflect-logs`, not a polished document
|
|
- Include enough context that each entry makes sense on its own without the full conversation
|
|
|
|
### Step 3: Prune old logs
|
|
|
|
After writing the log file, check for old logs that should be pruned:
|
|
|
|
1. Read `retention_days` and `warn_unreflected_days` from the settings (defaults: 7 and 14)
|
|
2. Read `.reflection-state.json` to know which logs have been reflected on
|
|
3. For each file in `memory/log/`:
|
|
- Parse the date from the filename (first 10 characters: `YYYY-MM-DD`)
|
|
- If **older than `retention_days`** AND **present in `.reflection-state.json`** → delete it and note the deletion
|
|
- If **older than `warn_unreflected_days`** AND **NOT in `.reflection-state.json`** → print a warning: `WARNING: <filename> is N days old and has NOT been reflected on. Run /reflect-logs.`
|
|
- Otherwise → leave it alone
|
|
|
|
### Step 4: Summary
|
|
|
|
Print a brief summary:
|
|
- Log file created (with path)
|
|
- Number of entries by section
|
|
- Any files pruned or warnings issued
|