session-validate

session-validate is a command for Claude Code from ShaheerKhawaja/ProductionOS. It costs 36 tokens per session (1,047 once invoked), scanned A, original, MIT.

An end-of-session review command that records what happened during a coding session and looks for lessons to use later. It updates stored working patterns and suggests improvements for future sessions.

In plain words
What is it for?
Use it to review session metrics, commits, changed files, self-evaluations, and convergence notes, then extract patterns and create optimization ideas.
Why use it?
It prevents useful findings from being lost when a session ends and helps later runs learn from earlier results.

Command for Claude Code

Part of the productionos plugin — 4 skills, 41 commands, 11 agents shipped together

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 commands/shaheerkhawaja/productionos/session-validate
Clone the repo
git clone --depth 1 https://github.com/ShaheerKhawaja/ProductionOS

Made for: Claude Code.

Or install productionos, the plugin that ships this one along with the rest of its 4 skills, 41 commands, 11 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for session-validate

README.md
[![agentmods](https://agentmods.dev/badge/commands/shaheerkhawaja/productionos/session-validate.svg)](https://agentmods.dev/commands/shaheerkhawaja/productionos/session-validate)
Your own site
<a href="https://agentmods.dev/commands/shaheerkhawaja/productionos/session-validate"><img src="https://agentmods.dev/badge/commands/shaheerkhawaja/productionos/session-validate.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,047 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.00036 $0.01047
Opus 5 $0.00018 $0.00524
Sonnet 5 $0.00007 $0.00209
Haiku 4.5 $0.00004 $0.00105

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

Security

Grade A, and why

session-validate 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 5d 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.

.claude/commands/session-validate.md · 126 lines

How it starts

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

Session Validate — End-of-Session Self-Training

You are the Session Validator. After every ProductionOS session, you capture what happened, extract what was learned, and prepare the system to be better next time.

This is the feedback loop that makes ProductionOS compound. Without session validation, each run starts from zero. With it, run #N inherits all the wisdom of runs #1 through #N-1.

Step 0: Preamble

Before executing, run the shared ProductionOS preamble (templates/PREAMBLE.md).

Step 1: Capture Session Metrics

Read the session artifacts:

# Session analytics
cat ~/.productionos/analytics/skill-usage.jsonl | tail -50

# Active session markers
ls ~/.productionos/sessions/

# Git commits this session
git log --oneline --since="$(date -v-2H +%Y-%m-%dT%H:%M:%S)" 2>/dev/null || git log --oneline -20

# Self-eval results (if any)
ls .productionos/SELF-EVAL-*.md 2>/dev/null
cat .productionos/SELF-EVAL-*.md 2>/dev/null | tail -30

# Convergence data
cat .productionos/CONVERGENCE-LOG.md 2>/dev/null | tail -20

Compute:

SESSION METRICS:
  duration: {estimated from first/last analytics entries}
  commits: {count}
  files_changed: {count from git diff --stat}
  agents_dispatched: {count from skill-usage.jsonl}
  self_eval_score: {average from SELF-EVAL results}
  convergence_trajectory: {improving|stalled|declining}
  test_pass_rate: {from last bun test}
  cost_estimate: {from TOKEN-BUDGET.md or agent count * $0.75}

Step 2: Extract Lessons (standard + deep modes)

Dispatch the metaclaw-learner agent to analyze session artifacts:

Read agents/metaclaw-learner.md, extract its <role> and <instructions>.
Dispatch via Agent tool:
  prompt: "Analyze the session artifacts in .productionos/ and extract lessons. Focus on: what worked well, what failed, what patterns emerged, what should be done differently next time."
  run_in_background: false (wait for results)

The metaclaw-learner will:

  1. Read all .productionos/ artifacts from this session
  2. Extract structured lessons (trigger → lesson → rule)
  3. Write to ~/.productionos/instincts/project/{hash}/lessons.json
  4. Promote high-confidence patterns (>0.8) to global instincts

Read the full file on GitHub · 126 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. 5d ago First seen · 126 lines · 36 tokens per session scan A 2f64ff27eeb0

Subscribe to this mod's changes

session-validate is a command published in the GitHub repository ShaheerKhawaja/ProductionOS (8 stars, last pushed 4mo ago), licensed MIT. It adds 36 tokens to every session and 1,047 once invoked, about $0.0002 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.