session-watcher
The Session Watcher server allows you to manage its lifecycle with three core tools:
Start the dashboard server (
start_watcher): Launches the Session Watcher dashboard server (or reuses an existing instance) and returns its URL.Stop the server (
stop_watcher): Shuts down the running managed server.Check server status (
watcher_status): Reports whether the server is currently running and provides its URL if it is.
Note: Only these three lifecycle management tools are available. Other tools mentioned in the README (e.g.,
rotate_session,get_bucket_summary,prepare_handoff,load_handoff) are not exposed in this server.
Adapter-ready integration for Hermes coding agent (pending implementation) to monitor session transcripts and provide restart recommendations.
Session Watcher
LLM context economics, in your terminal.
Session Watcher treats your prompt cache as inventory — it uses EOQ theory to measure whether the current context is still worth carrying, tracking restart pressure so you can decide when to hand off.
What it does
Session Watcher reads your Claude Code transcript in real time and answers one question: is this session still worth carrying?
Most context tools optimize how you consume tokens — Headroom compresses, /compact shrinks, RTK filters. Session Watcher tracks when the cost curve is drifting, giving you the data to decide. They compose: run any pruning strategy you like, SW measures the cost curve so you can decide when to hand off.
SW reads from the transcript, never writes to it. The dashboard and statusline are pure observers; MCP tools return data for you to act on. Metrics stay on your screen, not in the model's context window.
Related MCP server: OpenExp
How it works
Your coding agent (Claude Code)
│ writes session transcript
▼
┌──────────────────────────────────────────┐
│ Session Watcher (in-process MCP server) │
│ ─────────────────────────────────────── │
│ fold.js — tail JSONL, fold usage │
│ measure.js — B (context belief) │
│ rate-lamp — bill premium (br) + gate │
│ server.js — Express + SSE dashboard │
│ statusline — one-line shell client │
└──────────────────────────────────────────┘
│ dashboard · statusline · MCP
▼
Your browser / terminal status barCore model: B = cache_read_input_tokens (your context inventory). g = ΔL − ΔB (growth gap). x = L / B (position on the EOQ cost curve). br = mf × pp (bill premium — the percentage you're overpaying relative to optimal).
Lamp thresholds: green (br < 10%), amber (10–24%), red (≥ 25%). See the paper for the full derivation — EOQ inventory theory mapped to LLM prompt caching.
Quick Start
Requires Node.js ≥ 22.16.
# Try without installing — self-contained demo
npx -y @nomadop/session-watcher demo
# Replay your own transcript
npx -y @nomadop/session-watcher replay ~/.claude/projects/<project>/<session>.jsonlOpens a browser dashboard. The demo uses a pre-built anonymized session; replay uses your real transcript. Both are read-only — nothing is modified or uploaded.
Install
Plugin (recommended)
# 1. Add the marketplace (one-time)
claude plugin marketplace add nomadop/session-watcher
# 2. Install the plugin
claude plugin install session-watcher@session-watcherOr from within a Claude Code session:
/plugin marketplace add nomadop/session-watcher
/plugin install session-watcher@session-watcher
/reload-pluginsThis registers:
MCP tools — available in every session
SessionStart hook — auto-launches the dashboard server on each session
If you installed or updated in an already-running session, run /reload-plugins to activate.
Statusline
The plugin system does not yet support declaring a statusline. Add to your ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "<plugin-install-path>/dist/statusline.js"
}
}Find your plugin path with:
find ~/.claude/plugins/cache -path '*/session-watcher/*/dist/statusline.js' -printOr check via claude plugin details session-watcher@session-watcher.
Note: the plugin cache path changes on version update. After updating, re-run the command above and update your statusline path.
One compact line:
Context Buckets
The bucket panel shows exactly which files, skills, and tools are consuming your context budget. Each path carries a token count — check or uncheck to preview how the restart cost changes. The U-curve ghost line updates in real time as you toggle.
Handoff
When it's time to restart, handoff preserves the state you want to keep. Run /sw-handoff to prepare a package — selected paths, working summary, next task. Then /clear, and in the fresh session run /sw-load to restore. Only what you chose is rebuilt — less ramp-up, less waste.
MCP Tools
Server lifecycle
Tool | Description |
| Start (or reuse) the dashboard server; returns its URL |
| Stop the managed server |
| Report whether the server is running and its URL |
| Rotate to a new session ID |
Handoff workflow
Tool | Description |
| Return current context bucket structure (files, skills, tools) with metrics |
| Persist selected paths + summary as a handoff package; returns a semantic token |
| Load a handoff by token, free-text search, or auto-match for the current project |
Tools return data for you to decide on — only handoff injects context back into the model, and only the paths you explicitly selected.
Agent support
Session Watcher is agent-agnostic. The measurement pipeline only needs cache_read_input_tokens from each turn — it doesn't care which agent produced the transcript.
Agent | Driver | Status |
Claude Code | JSONL tail (native) | ✅ |
OpenCode | adapter-ready | pending |
OpenClaw | adapter-ready | pending |
Hermes | adapter-ready | pending |
Aider | adapter-ready | pending |
Adding a new agent requires implementing one interface: extract cache_read_input_tokens from the agent's session transcript. See lib/extract.js for the Claude Code reference driver. PRs welcome.
Paper
Context Is Inventory: A Rent-or-Buy Model for Prompt-Cached LLM Sessions Longju Cheng (2026) · DOI:
10.5281/zenodo.21236704
The paper derives the full theoretical specification: EOQ→LLM mapping, the 41.4% movable-cost bound, the ski-rental restart strategy, and measurements on 1,016 real session transcripts. See paper/paper.pdf.
Uninstall
claude plugin uninstall session-watcher@session-watcher
# Remove state directory (optional):
rm -rf ~/.session-watcherTest
npm test # unit + integration (node:test)
npx playwright test # E2E (requires running server)Citation
@unpublished{cheng2026context,
author = {Longju Cheng},
title = {Context Is Inventory: A Rent-or-Buy Model for Prompt-Cached LLM Sessions},
year = 2026,
doi = {10.5281/zenodo.21236704},
url = {https://doi.org/10.5281/zenodo.21236704},
note = {Preprint}
}Privacy
No remote telemetry.
Transcripts are read locally and never uploaded.
Local aggregate usage and handoff records are stored under
~/.session-watcher.No transcript prose or file contents are stored in telemetry.
Removing
~/.session-watcherdeletes all local state.
License
MIT
Available Tools
3 toolsstart_watcherARead-only
Start (or reuse) the Session Watcher dashboard server; returns its URL. Never returns metric values.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The annotation readOnlyHint: true suggests no state mutation, but the description says 'start' which implies a side effect (launching a server). This contradiction lowers transparency. The description does add that it never returns metric values, but does not explain reuse behavior or side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise and front-loaded, using a single sentence to convey all essential information with no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given zero parameters, no output schema, and only readOnlyHint annotation, the description is mostly complete: it states the return (URL) and what it does not return (metric values). However, it omits details on reuse behavior and whether starting creates a new process or reuses an existing one, leaving minor ambiguity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so schema coverage is 100%. The description provides no parameter details, which is acceptable as there are none. Baseline for 0 parameters is 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool starts or reuses a Session Watcher dashboard server and returns its URL, explicitly noting it never returns metric values. This differentiates from siblings like stop_watcher and watcher_status, which are distinct actions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage to obtain the watcher URL but lacks explicit guidance on when to use versus stop_watcher or watcher_status, nor does it mention prerequisites or context. Usage is implied rather than clearly directed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stop_watcherBRead-only
Stop the managed Session Watcher server.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Description claims 'Stop' (a mutation) while annotations set readOnlyHint=true, a direct contradiction. No additional behavioral traits disclosed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, front-loaded, no redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Missing details on behavior (e.g., confirmation, return value, side effects). The contradiction further reduces completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so schema covers everything. Description adds no extra meaning, which is acceptable; baseline for 0 parameters is 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action 'Stop' and the resource 'managed Session Watcher server', distinguishing it from siblings 'start_watcher' and 'watcher_status'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives; lacks context such as prerequisites or dependencies.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
watcher_statusARead-only
Report whether the Session Watcher server is running and its URL.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint: true, so the description adds value by specifying the output (status and URL) but does not disclose additional behavioral traits beyond that.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, no extraneous words, front-loaded with the key action and resource.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple with no parameters or output schema. The description fully covers its purpose and output, and sibling tools provide operational context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so schema coverage is 100%. The description needs no parameter explanation, achieving baseline for zero-parameter tools.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool reports whether the Session Watcher server is running and its URL, using a specific verb and resource. It distinguishes from sibling tools (start/stop) by focusing on status.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for checking server status, and siblings provide context for start/stop operations. However, it lacks explicit when-not or alternative guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v0.3.0- First observed
start_watcher - First observed
stop_watcher - First observed
watcher_status
TDQS
Each tool has a distinct purpose: starting, stopping, or checking status of the watcher server. No overlap or ambiguity.
All names use snake_case and follow a verb_noun or noun_noun pattern consistently, though 'watcher_status' is a noun phrase while the others are imperative verbs.
Three tools is within the typical 3-15 range and perfectly scoped for the server's purpose of managing a session watcher dashboard.
The tool set covers the full lifecycle of the watcher server: start, stop, and status check. No obvious gaps for the stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Shared memory for coding agents. Stop re-explaining your codebase every session.
Adaptive plan/build/review cycles for AI coding assistants, persisted across sessions.
Production-readiness for your AI coding agents.
Shared memory across AI dev tools: each session hands its context to the next, not starting cold.
Related MCP Servers
- AlicenseAqualityDmaintenanceStructured session journals for AI agents. Persistent memory across sessions -- no more repeating dead ends.864MIT
- AlicenseNot gradedqualityCmaintenanceQ-learning memory for Claude Code. Persistent memory that learns which context helps you get work done. Memories that lead to productive sessions (commits, PRs, tests) earn higher retrieval rank automatically. 16 MCP tools, hybrid BM25 + vector + Q-value scoring, local-first with Qdrant + FastEmbed.59MIT
- AlicenseNot gradedqualityCmaintenanceContext intelligence for AI coding sessions. 7 MCP tools to score, compare, compress, build, and scan prompts across 9 AI tools. Rule-based, <5ms/prompt, all analysis runs locally.46MIT
- AlicenseBqualityBmaintenancePersistent memory and session intelligence for AI coding assistants. Auto-tracks mistakes, decisions, and context via hooks. Mines your full session history for patterns, predictions, and cross-session search.2116MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nomadop/session-watcher'
If you have feedback or need assistance with the MCP directory API, please join our Discord server