session-hardening

session-hardening is a skill for Claude Code from 0xNyk/lacp. It costs 65 tokens per session (397 once invoked), scanned C, original, MIT.

A set of automatic safeguards for coding-agent sessions, including checks before tools run, periodic tests, and useful project context at session start.

In plain words
What is it for?
Use it to block commands such as deleting everything or publishing without approval, run project tests after a chosen number of file changes, and show Git state, notes, and previous handoff information.
Why use it?
It helps prevent dangerous commands, unapproved publishing or data exposure, and unnoticed test failures while work is in progress.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event.

Part of the lacp-hardening plugin — 3 skills, 1 command shipped together

Good fit Use it to block commands such as deleting everything or publishing without approval, run project tests after a chosen number of file changes, and show Git state, notes, and previous handoff information.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/0xnyk/lacp/session-hardening
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 0xNyk/lacp --skill session-hardening
Clone the repo
git clone --depth 1 https://github.com/0xNyk/lacp

Made for: Claude Code.

Or install lacp-hardening, the plugin that ships this one along with the rest of its 3 skills, 1 command.

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-hardening

README.md
[![agentmods](https://agentmods.dev/badge/skills/0xnyk/lacp/session-hardening/github.svg)](https://agentmods.dev/skills/0xnyk/lacp/session-hardening)
Your own site
<a href="https://agentmods.dev/skills/0xnyk/lacp/session-hardening"><img src="https://agentmods.dev/badge/skills/0xnyk/lacp/session-hardening/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for session-hardening

Your own site · 80×15
<a href="https://agentmods.dev/skills/0xnyk/lacp/session-hardening"><img src="https://agentmods.dev/badge/skills/0xnyk/lacp/session-hardening.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 397 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 5 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.00065 $0.00397
Opus 5 $0.00032 $0.00198
Sonnet 5 $0.00013 $0.00079
Haiku 4.5 $0.00006 $0.00040

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

Security

Grade C, and why

session-hardening scanned grade C with 5 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 9d 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.

Sends data to an external URLlowData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

- Data exfiltration via `curl --data @.env`

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Asks for rootlowPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- `chmod 777` → suggests specific masks

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Downloads and executes remote codemediumSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

- `curl | python/node` download-first patterns

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Recursive force deletemediumDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

description: "Production hardening for agent sessions. Includes pretool guards (blocks rm -rf, co-author injection, publishing without approval, data exfiltration), continuous QA (runs tests every N file writes), and ses

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- `curl | python/node` download-first patterns
plugin/skills/session-hardening/SKILL.md · 46 lines

What it actually says

Session Hardening

This plugin provides three layers of production hardening:

Pretool Guard (PreToolUse)

Blocks dangerous operations before they execute:

  • rm -rf → suggests trash instead
  • Co-author injection in commits
  • npm/cargo/pip publish without approval
  • curl | python/node download-first patterns
  • chmod 777 → suggests specific masks
  • git reset --hard, git clean -f
  • Data exfiltration via curl --data @.env
  • Push to main on public repos

Continuous QA (PostToolUse)

Runs your project's test command at configurable intervals during work:

  • Detects test command from package.json, Makefile, Cargo.toml, pyproject.toml
  • Fires every N file writes (default: 10)
  • Injects failure feedback without blocking
  • Includes thinking prompt on failure (think mode)

Session Context (SessionStart)

Injects at every session start:

  • Git branch, recent commits, modified files
  • Focus brief (current problem, beliefs, decisions)
  • Handoff artifact from previous session
  • System health score
  • Self-Memory System context

Configuration

Env Var Default Purpose
LACP_EVAL_CHECKPOINT_ENABLED 0 Enable continuous QA
LACP_EVAL_CHECKPOINT_INTERVAL 10 Test every N writes
LACP_CONTEXT_MODE `` Active mode (tdd, debugging, sprint, etc.)
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. 9d ago First seen · 46 lines · 65 tokens per session scan C ed414ffda302

Subscribe to this mod's changes

session-hardening is a skill published in the GitHub repository 0xNyk/lacp (304 stars, last pushed 19d ago), licensed MIT. It adds 65 tokens to every session and 397 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 5 findings (sends data to an external url, asks for root, downloads and executes remote code). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-harness-fault-injection

Use when an agent workflow needs deterministic recovery evidence for sandbox, MCP/tool, worker, checkpoint, memory, or orchestration failures.

sickn33/agentic-awesome-skills · 34 tokens

oma-debug

Bug diagnosis and fixing specialist - analyzes errors, identifies root causes, provides fixes, and writes regression tests. Use for bug, debug, error, crash, traceback, exception, and regression work.

first-fluke/oh-my-agent · 42 tokens

oma-qa

Quality assurance specialist for security, performance, accessibility, comprehensive testing, and quality standard alignment. Use for test, review, security audit, OWASP, coverage, lint work, and ISO/IEC 25010 or ISO/IEC 29119-aligned QA recommendations.

first-fluke/oh-my-agent · 58 tokens

score-harness

5-dimension scorecard (0-100, grade A/B/C/F) for a scaffolded harness. Dimensions: Repo understanding (25%), Agent usefulness (25%), MCP safety (20%), Test coverage (15%), Publish readiness (15%). Emits a 6-field badges block (score + mcpRisk + 4 booleans) ready for the harness README. Exit 0 A/B, 1 C, 2 F.

ruvnet/metaharness · 0 tokens

gentle-ai

Use Gentle AI harness discipline for Pi work: clarify first, preserve OpenSpec artifacts, use strict TDD where available, delegate through subagents when useful, and protect review workload.

Gentleman-Programming/gentle-pi · 40 tokens

validate-harness

Release-readiness umbrella check for a scaffolded harness — runs doctor, witness verify, hardcoded-path scan, MCP server config, and GCP Secret Manager validation in one shot. Exits non-zero if any sub-check fails.

ruvnet/metaharness · 50 tokens