session-watch
Watch a running Claude Code session by tailing its transcript JSONL and explain each event
in Japanese, with detailed re-explanation of technical terms every time they appear.
The user is observing another agent's work and needs to understand what is happening. They will
forget terms across events, so re-explanation is mandatory, not optional.
Workflow
Feedback Check
If feedback/log.md exists alongside this SKILL.md and has 5 or more entries, read the last
10 entries. If a pattern is apparent (the same issue appears in 3+ entries, or average rating
is below 3):
- Tell the user (in Japanese): 「過去のフィードバックで類似パターンを検出: [簡潔に]。
/my-skill-factory improve session-watch で改善できます。」
- Continue with normal execution.
Step 1: Identify the target session
Look at the user's invocation message for any of:
- A bare UUID (8-4-4-4-12 hex) — treat as explicit session ID.
- A path or
--cwd mention — treat that as the working directory to scan instead of $PWD.
- Otherwise → scan the current working directory's project transcript folder.
If a session ID was given
Locate the file:
find ~/.claude/projects -maxdepth 2 -name "<session-id>.jsonl" 2>/dev/null
If found → use it. If not found → tell the user the ID was not seen anywhere under
~/.claude/projects/ and stop.
If no session ID was given (default)
Encode the target cwd: replace every /, ., and _ with -. Example:
/Users/alice/code/foo → -Users-alice-code-foo; a worktree path like
/Users/alice/repo/.claude/worktrees/my_branch →
-Users-alice-repo--claude-worktrees-my-branch (note the doubled - where
/ is immediately followed by .). A single /-only substitution misses
the .claude/worktrees/... segment every worktree session lives under.
The transcript directory is ~/.claude/projects/<encoded>/.
List candidate sessions, ranked by recency:
ENC=$(echo "$PWD" | sed 's|[/._]|-|g')
DIR=~/.claude/projects/$ENC
# list files modified in the last 10 minutes, newest first
find "$DIR" -maxdepth 1 -name '*.jsonl' -mmin -10 -print0 \
| xargs -0 ls -lt 2>/dev/null
For each candidate, peek at the latest event to show context:
for f in <candidates>; do
echo "=== $(basename $f .jsonl) ==="
tail -1 "$f" | jq -r '
(.timestamp // "") + " | " +
(.type // "?") + " | " +
((.message.content // [])
| if type == "array" then
map(if .type == "text" then .text
elif .type == "tool_use" then "[" + .name + "]"
else "" end) | join(" ")
else (. | tostring) end)
| .[0:160]
'
done
Pick:
- 0 candidates → tell the user no session is currently active in this directory; suggest
either passing a session ID or
cd-ing to where the target session is running.
- 1 candidate → use it; mention the session ID and the slug/title for confirmation.
- 2+ candidates → invoke
AskUserQuestion with the candidate list (session ID + last
activity timestamp + last event one-liner). Note: one of these is likely THIS session
itself; do not auto-exclude — let the user pick.
Step 2: Start the monitor
Use the Monitor tool (load schema via ToolSearch if not already loaded). Default filter
captures execution-style tool calls, user-question tool calls, and assistant text:
tail -F -n 0 <session-file> 2>/dev/null | jq -c --unbuffered '
. as $r |
select($r.type == "assistant") |
($r.message.content // [])[]? |
. as $c |
if $c.type == "tool_use" and ($c.name | test("^(AskUserQuestion|Bash|Edit|Write|NotebookEdit|MultiEdit|Skill|Agent|mcp__)")) then
{ts: $r.timestamp, sc: $r.isSidechain, kind: "tool", name: $c.name, input: $c.input}
elif $c.type == "text" then
{ts: $r.timestamp, sc: $r.isSidechain, kind: "text", text: $c.text}
else empty end
'
Settings: persistent: true, timeout_ms: 3600000. Description should include the session
ID short form, e.g. Aliseのsession監視 (ec8dca3f...).
tail -F -n 0 starts from the END so you only observe NEW activity, not the historical replay.
After starting, tell the user: monitor task ID, what is being captured, and how to stop
("監視やめて" / "stop" → you call TaskStop with the task ID).
Step 3: Narrate each event
Each Monitor notification carries one event as compact JSON. For every event, produce a
Japanese explanation. The user wants depth, not translation.
Required style:
Lead with a tag showing source + kind:
[Alise:text] — assistant prose to the user
[Alise:Bash] / [Alise:Edit] / [Alise:Write] etc. — tool calls
- Replace
Alise with whatever name the user has used; if none, use the short session ID.
For tool calls: quote the command/path, then break down each part:
- Every CLI flag → name + what it does + why it might be used here.
- Every shell construct →
&&, ||, |, >, 2>&1, heredoc, command substitution etc.
— explain each one as it appears.
- Background flag (
run_in_background), timeouts → call them out.
- For
Edit / Write: summarize what changed and why (infer from diff if visible).
For assistant text: quote the original (in a blockquote), then translate the meaning
AND expand every technical term into a brief definition. Do not assume the user remembers
prior definitions.
Term re-explanation rule: explain the same technical term every time it appears.
The user has explicitly asked for this — they will forget across events. Examples of
terms that always need a one-liner: derivation, flake, overlay, home-manager,
nix-daemon, binary cache, synthetic.conf, GPG signing, heredoc, tee, 2>&1,
short SHA, --show-trace, etc.
Pick a brief gloss (1-2 sentences); do not lecture.
Notable side effects: if the event is destructive, network-touching, or modifies
shared state (push, deploy, kill, sudo, write outside repo), surface that explicitly
at the top of the explanation.
Sidechain marker: if sc: true, prefix the tag with [sub-agent] so the user
knows this came from one of Alise's spawned agents.
Truncation: events arrive truncated when long. If you see ...(truncated),
say so and reason about what the missing tail likely contained.
Do NOT send a PushNotification for routine events. Only push if the event is something the
user would want to act on right now from outside this chat (e.g., Alise asked them a direct
question, a destructive action just landed, a build they were waiting on finished).
Step 4: Filter adjustments
If the user asks to widen or narrow the filter (e.g., "Read/Grepも観たい", "テキストはいらない"),
TaskStop the current monitor and start a new one with an updated jq filter. Common variants:
- All tool calls (no filter on name) — drop the
test(...) clause.
- Tools only (no text) — drop the
elif $c.type == "text" branch.
- Include user messages — add a sibling clause for
$r.type == "user".
Step 5: Stop
When the user says any of "監視やめて" / "止めて" / "stop" / "監視終わり" / "もういい":
- Call
TaskStop with the task ID and confirm in Japanese.
- Invoke
session-recap: use the Skill tool with skill: "session-recap" and args
set to the watched session's full UUID. This produces summary.md + note.md capturing
the technical knowledge, terminology, and decisions from the watched session — kept as
a separate skill so the user can also invoke it standalone later.
- If the user explicitly says "no recap" / "recapいらない" / "サマリー不要" before or
during the stop, skip this and go straight to the Retrospective.
- Once
session-recap returns, surface its output paths to the user in one short
Japanese line.
- Then proceed to the Retrospective below (this records feedback on session-watch itself,
independent of the recap).
Retrospective
After the monitor is stopped (Step 5), reflect on the session:
Consider: were there mid-session corrections (filter widening/narrowing requested,
explanation style changes, missed events the user had to paste manually, terms the
user asked you to re-explain that should already have been covered)? Refused/redo?
Errors talking to Monitor or jq?
Ask the user (in Japanese): 「今回の監視のフィードバック (1-5の評価、気になった点、または何もなければEnter)」
If the user provides feedback OR if corrections/issues actually occurred during the run:
a. Create feedback/ directory next to this SKILL.md if it does not exist.
b. Read feedback/log.md (create with # Feedback Log header followed by a blank line
and the comment <!-- Append new entries at the top. Do not edit previous entries. -->
if it does not exist).
c. Prepend a new entry directly after the header block, using this format:
## <ISO-8601 timestamp>
- **Skill Version**: <version from this file's frontmatter>
- **Task**: <1-line description of what the user asked for>
- **Outcome**: success | partial-success | failure | error
- **Rating**: <N>/5 (or "—" if not provided)
- **Corrections**: <mid-session corrections, or "none">
- **Issues**: <specific problems, or "none">
- **User Note**: <user's verbatim feedback, or "—">
---
d. Save and confirm in one short Japanese sentence.
If the user skips AND no corrections or issues occurred, end without recording.
Behavior Scenarios
Scenario: Default — single session in cwd
Given the user invokes session-watch with no arguments
And exactly one Claude Code session is active in the current directory
When the skill runs Step 1
Then it picks that session, starts the monitor with the default filter,
and begins narrating events in Japanese with full term explanations.
Scenario: Multiple sessions in cwd
Given the user invokes session-watch with no arguments
And two or more sessions in the current directory have been active in the last 10 minutes
When the skill runs Step 1
Then it shows each candidate's session ID, last-activity time, and a one-line preview,
calls AskUserQuestion to let the user pick one, and starts the monitor on that one.
Scenario: Explicit session ID
Given the user invokes session-watch with a UUID in the message
When the skill runs Step 1
Then it locates that JSONL anywhere under ~/.claude/projects/ regardless of cwd,
and starts the monitor on that file.
Scenario: No active session
Given the user invokes session-watch with no arguments
And no session in cwd has activity within the last 10 minutes
When the skill runs Step 1
Then it tells the user no candidate was found and asks for a session ID
or a different cwd; it does NOT start a monitor.
Scenario: Stop monitoring
Given a monitor is running
When the user says "監視やめて" or any equivalent stop phrase
Then the skill calls TaskStop with the task ID, confirms in Japanese,
then invokes session-recap with the watched session ID,
reports the recap output paths, and finally runs the Retrospective.
Scenario: Stop monitoring, user opts out of recap
Given a monitor is running
When the user says "監視やめて、recapはいらない" or similar
Then the skill stops the monitor, skips the session-recap invocation,
and runs the Retrospective directly.
Scenario: Filter adjustment
Given a monitor is running with the default filter
When the user asks to also include Read/Grep events
Then the skill stops the current monitor and starts a new one with a widened jq filter,
reusing the same session file.
Scenario: Retrospective recorded after a run with corrections
Given the user widened the filter mid-run and asked you to re-explain a term you had not glossed
When the user stops the monitor
Then the skill asks for a 1-5 rating in Japanese, creates feedback/log.md if missing,
and prepends an entry capturing the corrections, the user's note, and the outcome.
Scenario: Retrospective skipped on a clean run
Given the run had no corrections, no issues, and the user provides no feedback
When the user stops the monitor
Then the skill ends without writing to feedback/log.md.
Scenario: Feedback Check surfaces a recurring pattern
Given feedback/log.md has 5+ entries and the same issue keyword appears in 3+ of the last 10
When the skill is invoked
Then it tells the user about the pattern and suggests /my-skill-factory improve session-watch,
then continues normally.
Notes and constraints
- Read-only. Never call
claude -p --resume <id> from within this skill. The skill
observes; it does not write to the watched session. If the user wants to actually message
the other session, that is a separate explicit request.
- No PushNotification spam. Default to silent narration. Only push for events that
change what the user would do right now.
- Sidechain events. Sub-agent activity is included by default. If the user finds it
noisy, offer to add a
select($r.isSidechain | not) clause.
- Truncated tool inputs. The transcript truncates large fields. Acknowledge truncation
when explaining and avoid claiming certainty about content past the cut.
- Self-watching. If the user invokes this skill in the same session they want to watch,
the resulting feedback loop is unsafe (every narration becomes a new event). Detect the
case (the picked session's most recent event mentions session-watch) and refuse with a
short explanation.
1---2name: session-watch3description: Watch another running Claude Code session in real time and narrate its activity in Japanese with detailed term-by-term explanations. By default targets a session active in the current working directory; if multiple are active, asks the user to pick. Can also target a specific session by ID. Read-only on the watched session. After the watch ends, invokes session-recap; any further chain (e.g. recap-to-notion for Notion sync) is configured by session-recap's own ~/.claude/session-recaps/.recap-config.json, not this skill. Use when the user says "session監視" / "監視して" / "別のClaudeを観察" / "他のセッションを見ていて" / "Aliseを観察" / "watch session" / "observe" / "observe claude" / "observe session" / "observe the session" / "Observe" / "/session-watch" / "セッションウォッチ" / "オブザーブ" / "他のセッション解説" / "別Claudeをモニタ".4---56# session-watch78Watch a running Claude Code session by tailing its transcript JSONL and explain each event9in Japanese, with detailed re-explanation of technical terms every time they appear.1011The user is observing another agent's work and needs to understand what is happening. They will12forget terms across events, so re-explanation is mandatory, not optional.1314## Workflow1516### Feedback Check1718If `feedback/log.md` exists alongside this SKILL.md and has 5 or more entries, read the last1910 entries. If a pattern is apparent (the same issue appears in 3+ entries, or average rating20is below 3):2122- Tell the user (in Japanese): 「過去のフィードバックで類似パターンを検出: [簡潔に]。`/my-skill-factory improve session-watch` で改善できます。」23- Continue with normal execution.2425### Step 1: Identify the target session2627Look at the user's invocation message for any of:2829- A bare UUID (8-4-4-4-12 hex) — treat as explicit session ID.30- A path or `--cwd` mention — treat that as the working directory to scan instead of `$PWD`.31- Otherwise → scan the current working directory's project transcript folder.3233#### If a session ID was given3435Locate the file:3637```bash38find ~/.claude/projects -maxdepth 2 -name "<session-id>.jsonl" 2>/dev/null39```4041If found → use it. If not found → tell the user the ID was not seen anywhere under42`~/.claude/projects/` and stop.4344#### If no session ID was given (default)45461. Encode the target cwd: replace every `/`, `.`, and `_` with `-`. Example:47 `/Users/alice/code/foo` → `-Users-alice-code-foo`; a worktree path like48 `/Users/alice/repo/.claude/worktrees/my_branch` →49 `-Users-alice-repo--claude-worktrees-my-branch` (note the doubled `-` where50 `/` is immediately followed by `.`). A single `/`-only substitution misses51 the `.claude/worktrees/...` segment every worktree session lives under.52532. The transcript directory is `~/.claude/projects/<encoded>/`.54553. List candidate sessions, ranked by recency:5657 ```bash58 ENC=$(echo "$PWD" | sed 's|[/._]|-|g')59 DIR=~/.claude/projects/$ENC60 # list files modified in the last 10 minutes, newest first61 find "$DIR" -maxdepth 1 -name '*.jsonl' -mmin -10 -print0 \62 | xargs -0 ls -lt 2>/dev/null63 ```64654. For each candidate, peek at the latest event to show context:6667 ```bash68 for f in <candidates>; do69 echo "=== $(basename $f .jsonl) ==="70 tail -1 "$f" | jq -r '71 (.timestamp // "") + " | " +72 (.type // "?") + " | " +73 ((.message.content // [])74 | if type == "array" then75 map(if .type == "text" then .text76 elif .type == "tool_use" then "[" + .name + "]"77 else "" end) | join(" ")78 else (. | tostring) end)79 | .[0:160]80 '81 done82 ```83845. Pick:85 - **0 candidates** → tell the user no session is currently active in this directory; suggest86 either passing a session ID or `cd`-ing to where the target session is running.87 - **1 candidate** → use it; mention the session ID and the slug/title for confirmation.88 - **2+ candidates** → invoke `AskUserQuestion` with the candidate list (session ID + last89 activity timestamp + last event one-liner). Note: one of these is likely THIS session90 itself; do not auto-exclude — let the user pick.9192### Step 2: Start the monitor9394Use the `Monitor` tool (load schema via ToolSearch if not already loaded). Default filter95captures execution-style tool calls, user-question tool calls, and assistant text:9697```bash98tail -F -n 0 <session-file> 2>/dev/null | jq -c --unbuffered '99 . as $r |100 select($r.type == "assistant") |101 ($r.message.content // [])[]? |102 . as $c |103 if $c.type == "tool_use" and ($c.name | test("^(AskUserQuestion|Bash|Edit|Write|NotebookEdit|MultiEdit|Skill|Agent|mcp__)")) then104 {ts: $r.timestamp, sc: $r.isSidechain, kind: "tool", name: $c.name, input: $c.input}105 elif $c.type == "text" then106 {ts: $r.timestamp, sc: $r.isSidechain, kind: "text", text: $c.text}107 else empty end108'109```110111Settings: `persistent: true`, `timeout_ms: 3600000`. Description should include the session112ID short form, e.g. `Aliseのsession監視 (ec8dca3f...)`.113114`tail -F -n 0` starts from the END so you only observe NEW activity, not the historical replay.115116After starting, tell the user: monitor task ID, what is being captured, and how to stop117("監視やめて" / "stop" → you call `TaskStop` with the task ID).118119### Step 3: Narrate each event120121Each Monitor notification carries one event as compact JSON. For every event, produce a122Japanese explanation. The user wants depth, not translation.123124Required style:1251261. **Lead with a tag** showing source + kind:127 - `[Alise:text]` — assistant prose to the user128 - `[Alise:Bash]` / `[Alise:Edit]` / `[Alise:Write]` etc. — tool calls129 - Replace `Alise` with whatever name the user has used; if none, use the short session ID.1301312. **For tool calls**: quote the command/path, then break down each part:132 - Every CLI flag → name + what it does + why it might be used here.133 - Every shell construct → `&&`, `||`, `|`, `>`, `2>&1`, heredoc, command substitution etc.134 — explain each one as it appears.135 - Background flag (`run_in_background`), timeouts → call them out.136 - For `Edit` / `Write`: summarize what changed and why (infer from diff if visible).1371383. **For assistant text**: quote the original (in a blockquote), then translate the meaning139 AND expand every technical term into a brief definition. Do not assume the user remembers140 prior definitions.1411424. **Term re-explanation rule**: explain the same technical term every time it appears.143 The user has explicitly asked for this — they will forget across events. Examples of144 terms that always need a one-liner: `derivation`, `flake`, `overlay`, `home-manager`,145 `nix-daemon`, `binary cache`, `synthetic.conf`, GPG signing, heredoc, `tee`, `2>&1`,146 short SHA, `--show-trace`, etc.147 Pick a brief gloss (1-2 sentences); do not lecture.1481495. **Notable side effects**: if the event is destructive, network-touching, or modifies150 shared state (push, deploy, kill, sudo, write outside repo), surface that explicitly151 at the top of the explanation.1521536. **Sidechain marker**: if `sc: true`, prefix the tag with `[sub-agent]` so the user154 knows this came from one of Alise's spawned agents.1551567. **Truncation**: events arrive truncated when long. If you see `...(truncated)`,157 say so and reason about what the missing tail likely contained.158159Do NOT send a `PushNotification` for routine events. Only push if the event is something the160user would want to act on right now from outside this chat (e.g., Alise asked them a direct161question, a destructive action just landed, a build they were waiting on finished).162163### Step 4: Filter adjustments164165If the user asks to widen or narrow the filter (e.g., "Read/Grepも観たい", "テキストはいらない"),166`TaskStop` the current monitor and start a new one with an updated jq filter. Common variants:167168- All tool calls (no filter on name) — drop the `test(...)` clause.169- Tools only (no text) — drop the `elif $c.type == "text"` branch.170- Include user messages — add a sibling clause for `$r.type == "user"`.171172### Step 5: Stop173174When the user says any of "監視やめて" / "止めて" / "stop" / "監視終わり" / "もういい":1751761. Call `TaskStop` with the task ID and confirm in Japanese.1772. **Invoke `session-recap`**: use the Skill tool with `skill: "session-recap"` and `args`178 set to the watched session's full UUID. This produces `summary.md` + `note.md` capturing179 the technical knowledge, terminology, and decisions from the watched session — kept as180 a separate skill so the user can also invoke it standalone later.181 - If the user explicitly says "no recap" / "recapいらない" / "サマリー不要" before or182 during the stop, skip this and go straight to the Retrospective.183 - Once `session-recap` returns, surface its output paths to the user in one short184 Japanese line.1853. Then proceed to the Retrospective below (this records feedback on session-watch itself,186 independent of the recap).187188### Retrospective189190After the monitor is stopped (Step 5), reflect on the session:1911921. Consider: were there mid-session corrections (filter widening/narrowing requested,193 explanation style changes, missed events the user had to paste manually, terms the194 user asked you to re-explain that should already have been covered)? Refused/redo?195 Errors talking to Monitor or jq?1961972. Ask the user (in Japanese): 「今回の監視のフィードバック (1-5の評価、気になった点、または何もなければEnter)」1981993. If the user provides feedback OR if corrections/issues actually occurred during the run:200 a. Create `feedback/` directory next to this SKILL.md if it does not exist.201 b. Read `feedback/log.md` (create with `# Feedback Log` header followed by a blank line202 and the comment `<!-- Append new entries at the top. Do not edit previous entries. -->`203 if it does not exist).204 c. Prepend a new entry directly after the header block, using this format:205206 ```markdown207 ## <ISO-8601 timestamp>208 - **Skill Version**: <version from this file's frontmatter>209 - **Task**: <1-line description of what the user asked for>210 - **Outcome**: success | partial-success | failure | error211 - **Rating**: <N>/5 (or "—" if not provided)212 - **Corrections**: <mid-session corrections, or "none">213 - **Issues**: <specific problems, or "none">214 - **User Note**: <user's verbatim feedback, or "—">215 ---216 ```217218 d. Save and confirm in one short Japanese sentence.2192204. If the user skips AND no corrections or issues occurred, end without recording.221222## Behavior Scenarios223224```gherkin225Scenario: Default — single session in cwd226 Given the user invokes session-watch with no arguments227 And exactly one Claude Code session is active in the current directory228 When the skill runs Step 1229 Then it picks that session, starts the monitor with the default filter,230 and begins narrating events in Japanese with full term explanations.231232Scenario: Multiple sessions in cwd233 Given the user invokes session-watch with no arguments234 And two or more sessions in the current directory have been active in the last 10 minutes235 When the skill runs Step 1236 Then it shows each candidate's session ID, last-activity time, and a one-line preview,237 calls AskUserQuestion to let the user pick one, and starts the monitor on that one.238239Scenario: Explicit session ID240 Given the user invokes session-watch with a UUID in the message241 When the skill runs Step 1242 Then it locates that JSONL anywhere under ~/.claude/projects/ regardless of cwd,243 and starts the monitor on that file.244245Scenario: No active session246 Given the user invokes session-watch with no arguments247 And no session in cwd has activity within the last 10 minutes248 When the skill runs Step 1249 Then it tells the user no candidate was found and asks for a session ID250 or a different cwd; it does NOT start a monitor.251252Scenario: Stop monitoring253 Given a monitor is running254 When the user says "監視やめて" or any equivalent stop phrase255 Then the skill calls TaskStop with the task ID, confirms in Japanese,256 then invokes session-recap with the watched session ID,257 reports the recap output paths, and finally runs the Retrospective.258259Scenario: Stop monitoring, user opts out of recap260 Given a monitor is running261 When the user says "監視やめて、recapはいらない" or similar262 Then the skill stops the monitor, skips the session-recap invocation,263 and runs the Retrospective directly.264265Scenario: Filter adjustment266 Given a monitor is running with the default filter267 When the user asks to also include Read/Grep events268 Then the skill stops the current monitor and starts a new one with a widened jq filter,269 reusing the same session file.270271Scenario: Retrospective recorded after a run with corrections272 Given the user widened the filter mid-run and asked you to re-explain a term you had not glossed273 When the user stops the monitor274 Then the skill asks for a 1-5 rating in Japanese, creates feedback/log.md if missing,275 and prepends an entry capturing the corrections, the user's note, and the outcome.276277Scenario: Retrospective skipped on a clean run278 Given the run had no corrections, no issues, and the user provides no feedback279 When the user stops the monitor280 Then the skill ends without writing to feedback/log.md.281282Scenario: Feedback Check surfaces a recurring pattern283 Given feedback/log.md has 5+ entries and the same issue keyword appears in 3+ of the last 10284 When the skill is invoked285 Then it tells the user about the pattern and suggests /my-skill-factory improve session-watch,286 then continues normally.287```288289## Notes and constraints290291- **Read-only.** Never call `claude -p --resume <id>` from within this skill. The skill292 observes; it does not write to the watched session. If the user wants to actually message293 the other session, that is a separate explicit request.294- **No PushNotification spam.** Default to silent narration. Only push for events that295 change what the user would do right now.296- **Sidechain events.** Sub-agent activity is included by default. If the user finds it297 noisy, offer to add a `select($r.isSidechain | not)` clause.298- **Truncated tool inputs.** The transcript truncates large fields. Acknowledge truncation299 when explaining and avoid claiming certainty about content past the cut.300- **Self-watching.** If the user invokes this skill in the same session they want to watch,301 the resulting feedback loop is unsafe (every narration becomes a new event). Detect the302 case (the picked session's most recent event mentions session-watch) and refuse with a303 short explanation.