Problem and Background
A session with an AI coding agent evaporates the moment it ends. The decisions made that day, the points where you got stuck, how you resolved them, even the "next time let's do it this way" resolutions — all of it. Even if the conversation log remains, the raw text of tens of thousands of tokens is hard to search and hard to reuse.
/agent-memory-log is a slash command that solves this problem. When a session ends (more precisely, when the user wants it to), it summarizes the current session into a structured Markdown note and loads it into an Obsidian-based AgentMemory vault.
What It Records
Rather than the raw log, it records a summary organized into an epistemic hierarchy. The note has a fixed section structure.
- Work summary — 1–3 sentences on what was done in this session
- Changed files — the list of files actually touched
- Key decisions — why that approach was chosen
- Stuck points / resolutions — what was gained during debugging
- What was learned — knowledge to pass on to the next session
- Rule candidates to apply going forward — things worth promoting into a habit
The reason the sections are fixed is simple. Later, when you scan across multiple session notes mechanically (digest, promotion pipeline), you need to be able to predict where each thing lives.
What I Paid Attention to in the Design
Handling Same-Day Collisions
The note path is 10-sessions/claude/{date}-claude-{project}.md. If you save several sessions for the same project on the same day, the CLI creates a new file with a -2, -3, … suffix without touching the existing file (uniqueFilePath). There's no need to stash/mv/restore the previous session.
Manual Execution, Not a Hook
At first I auto-saved via a session-end hook, but now it runs only on explicit request. Not every session is worth recording, and auto-saving mass-produced noise notes, lowering the signal-to-noise ratio of the vault.
Position in the Pipeline
This command is the first stage of the [record → knowledge → writing] pipeline. The session notes and daily TILs accumulated here become the input to the next stage, /til-to-knowledge, where they are promoted into general-purpose knowledge documents with the project-specific circumstances stripped out.
What I Learned
The value of a record-keeping system is determined not by "the cost of writing" but by "the probability of being read again." Fixing the structure, defending against collisions, and not producing garbage — all three are mechanisms to raise the probability of being read again.