mcp-session-logging

A workflow for recording meaningful work sessions in an MCP server workspace. MCP, or Model Context Protocol, is a way for an agent to use connected tools and services.

In plain words
What is it for?
Use it to start a session turn, record discussion and work, review recent history, and mark the turn successful or failed.
Why use it?
It keeps an auditable record of the conversation, actions, decisions, and outcome without manually editing log files.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sharpninja/mcpserver/mcp-session-logging
Any agent
npx skills add sharpninja/McpServer --skill mcp-session-logging
Clone the repo
git clone --depth 1 https://github.com/sharpninja/McpServer

Made for: Claude Code, Codex.

Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,003 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00071 $0.02003
Opus 5 $0.00036 $0.01001
Sonnet 5 $0.00014 $0.00401
Haiku 4.5 $0.00007 $0.00200

Measured 2d ago against content hash ab43a43cc8cc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp-session-logging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mcp-session-logging/SKILL.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MCP Session Logging

Record every meaningful unit of work as an McpServer session-log turn using the mcpserver plugin workflow.sessionlog.* methods. A turn is begun before work starts, enriched with dialog, actions, and design decisions while work proceeds, and then completed (success) or failed (error). All session state is owned by the McpServer; you interact with it only through the plugin API.

When to Use

  • You are about to start work on a user message or task inside an McpServer workspace.
  • You finished a meaningful change (edit, commit, decision, requirement, blocker) and need to persist it.
  • You need to record reasoning, tool output, or a design decision for audit.
  • You are wrapping up or aborting work and must close the active turn.
  • You need to review recent session history before acting (queryHistory).

When Not to Use

  • Trivial read-only lookups that the parent turn already covers (do not open a new turn per file read).
  • TODO CRUD (use the TODO skill / workflow.todo.*), requirements (workflow.requirements.*), or GraphRAG work; those have their own skills.
  • Any situation where signature verification, /health, or nonce verification has failed: log MCP_UNTRUSTED and continue without the MCP server.

Inputs

  • The active marker file AGENTS-README-FIRST.yaml in the workspace root (API key, endpoints, base URL). Re-read it on any 401.
  • Your real agent identity in Pascal-Case (for example ClaudeCode, Copilot), used as the agent / sourceType prefix.
  • The current model name (for example claude-opus-4-8).
  • The user's prompt or task text (for queryTitle / queryText and for the request-id slug).

Critical Rules

  • NEVER read, edit, or write session-log files (or todo.yaml) directly with Read, Edit, Write, Grep, or shell. The plugin API is the only allowed interface.
  • Begin the turn BEFORE doing the work, not after.
  • Persist immediately after each meaningful change. Do not batch saves to the end.
  • Use your real Pascal-Case agent identity. Never use placeholder or misleading sourceType values.
  • Session id format: <Agent>-<yyyyMMddTHHmmssZ>-<suffix>; must start with the exact agent prefix (case-sensitive). Regex: ^[A-Z][A-Za-z0-9]*-\d{8}T\d{6}Z-[a-z0-9]+(?:-[a-z0-9]+)*$.
  • Request id format: req-<yyyyMMddTHHmmssZ>-<seq>-<slug-from-prompt> where yyyyMMddTHHmmssZ is the UTC time the turn begins, <seq> is a zero-padded 3-digit per-session counter (001, 002, ...), and <slug> is a lowercase kebab-case truncation (~40 chars) of the prompt with articles and filler dropped. Regex: ^req-\d{8}T\d{6}Z-[a-z0-9]+(?:-[a-z0-9]+)*$.
  • The requestId passed to beginTurn is the turn's identity; reuse that SAME requestId for appendDialog, appendActions, updateTurn, completeTurn, and failTurn so they bind to the turn.
  • Log design decisions twice: as an appendDialog item with category: decision, and as an appendActions action with type: design_decision.
  • A completed or failed turn is immutable (turn_immutable); make all updates before closing it.
  • No em-dashes in any logged text.

Read the full file on GitHub · 110 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 110 lines · 71 tokens per session scan A ab43a43cc8cc

Subscribe to this mod's changes

mcp-session-logging is a skill published in the GitHub repository sharpninja/McpServer (2 stars, last pushed 12d ago), licensed Apache-2.0. It adds 71 tokens to every session and 2,003 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.