spec-drift

spec-drift is a skill for Claude Code, Codex from jrjsmrtn/tlx. It costs 63 tokens per session (948 once invoked), scanned A, original, MIT.

A check for drift between application code and its TLX formal specification. It compares source and specification history, re-extracts the current structure, and compares the result with the existing specification.

In plain words
What is it for?
Use it before releases, in continuous integration, during code review, or after refactoring to find specifications that need updating.
Why use it?
It flags specifications that may no longer describe the implementation after code changes or refactoring.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it before releases, in continuous integration, during code review, or after refactoring to find specifications that need updating.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jrjsmrtn/tlx/spec-drift
View source ↗ jrjsmrtn/tlx
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.

Any agent
npx skills add jrjsmrtn/tlx --skill spec-drift
Clone the repo
git clone --depth 1 https://github.com/jrjsmrtn/tlx

Made for: Claude Code, Codex.

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 spec-drift

README.md
[![agentmods](https://agentmods.dev/badge/skills/jrjsmrtn/tlx/spec-drift.svg)](https://agentmods.dev/skills/jrjsmrtn/tlx/spec-drift)
Your own site
<a href="https://agentmods.dev/skills/jrjsmrtn/tlx/spec-drift"><img src="https://agentmods.dev/badge/skills/jrjsmrtn/tlx/spec-drift.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 948 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00063 $0.00948
Opus 5 $0.00032 $0.00474
Sonnet 5 $0.00013 $0.00190
Haiku 4.5 $0.00006 $0.00095

Measured 8d ago against content hash 0365bf2de6ad, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

spec-drift 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 8d 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.

usage-rules/skills/spec-drift/SKILL.md · 123 lines

How it starts

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

Spec Drift Detection

Detect when implementation code has diverged from its formal TLX spec, so specs stay in sync with the codebase.

When to Use

  • Before a release — verify all specs are current
  • After a refactoring sprint — check if specs need updating
  • In CI — flag PRs that change source without updating specs
  • During code review — "did you update the spec?"

Step 1: Find Spec Files with Source References

Scan for spec files that declare a # Source: header:

grep -rl "# Source:" specs/ lib/specs/ test/specs/

For each spec file, extract:

  • The # Source: path (implementation file)
  • The # ADR: number (if present)
  • The spec module name

Step 2: Compare Timestamps

For each spec/source pair, check git modification dates:

# Last modification of source
git log -1 --format="%ai" -- lib/my_app/reconciler.ex

# Last modification of spec
git log -1 --format="%ai" -- specs/reconciler_spec.ex

If the source is newer than the spec, the spec may be stale.

Step 3: Re-Extract and Diff Structure

For stale specs, re-run the appropriate extractor and compare the extracted structure against the existing spec:

# Re-extract current structure
mix tlx.gen.from_gen_server MyApp.Reconciler --format codegen --output /tmp/current.ex

# Diff against existing spec
diff specs/reconciler_spec.ex /tmp/current.ex

Look for:

  • New states/fields: added in source but not in spec
  • Removed states/fields: deleted from source but still in spec
  • New callbacks/actions: new handle_call/cast/info clauses
  • Changed transitions: different field updates in return tuples

Step 4: Generate Drift Report

Present findings as a table:

Spec                          Source                          Status
──────────────────────────────────────────────────────────────────────
specs/reconciler_spec.ex      lib/my_app/reconciler.ex        ⚠ STALE
  Source modified: 2026-03-28    Spec modified: 2026-03-15
  Diff: +2 new handle_call clauses, +1 new field (retry_count)

specs/orchestrator_spec.ex    lib/my_app/orchestrator.ex      ✓ OK
  Source modified: 2026-03-10    Spec modified: 2026-03-12

specs/fleet_live_spec.ex      lib/my_app_web/fleet_live.ex    ⚠ STALE
  Source modified: 2026-03-25    Spec modified: 2026-03-01
  Diff: +3 new handle_event clauses
──────────────────────────────────────────────────────────────────────
Stale: 2/3    Up to date: 1/3

Read the full file on GitHub · 123 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. 8d ago First seen · 123 lines · 63 tokens per session scan A 0365bf2de6ad

Subscribe to this mod's changes

spec-drift is a skill published in the GitHub repository jrjsmrtn/tlx (10 stars, last pushed 1mo ago), licensed MIT. It adds 63 tokens to every session and 948 once invoked, about $0.0003 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.