OpenLore: Command for Claude Code

.claude/commands/first-run-hardening.md

first-run-hardening is a command for Claude Code from clay-good/OpenLore. It costs 49 tokens per session (1,323 once invoked), scanned A, original, MIT.

A testing procedure for finding bugs in OpenLore’s first installation and first use on a clean repository. OpenLore is a command-line tool that gives coding agents persistent architectural information about codebases.

In plain words
What is it for?
Use it to build OpenLore, install and run the local version in a clean repository, exercise the real setup flow, and fix first-run failures.
Why use it?
It exposes problems that ordinary tests may miss, such as outdated commands, file-watcher limits, missing indexes, or broken options during a new user’s setup.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: reads .claude/ paths; mentions CLAUDE.md.

This is clay-good/OpenLore's own configuration. It tells Claude Code how to work on OpenLore itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything OpenLore configures →

Reuse

Borrowing it

Nothing to install: this file belongs to clay-good/OpenLore. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/clay-good/OpenLore/main/.claude/commands/first-run-hardening.md
Clone the repo
git clone --depth 1 https://github.com/clay-good/OpenLore

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/clay-good/openlore/first-run-hardening/github.svg)](https://agentmods.dev/commands/clay-good/openlore/first-run-hardening)
Your own site
<a href="https://agentmods.dev/commands/clay-good/openlore/first-run-hardening"><img src="https://agentmods.dev/badge/commands/clay-good/openlore/first-run-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 first-run-hardening

Your own site · 80×15
<a href="https://agentmods.dev/commands/clay-good/openlore/first-run-hardening"><img src="https://agentmods.dev/badge/commands/clay-good/openlore/first-run-hardening.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 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,323 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.00049 $0.01323
Opus 5 $0.00024 $0.00661
Sonnet 5 $0.00010 $0.00265
Haiku 4.5 $0.00005 $0.00132

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

Security

Grade A, and why

first-run-hardening 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 10d 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/first-run-hardening.md · 85 lines

How it starts

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

OpenLore first-run hardening pass

You are working in the OpenLore repo, a published npm CLI (openlore) that gives coding agents persistent architectural memory via static analysis + an MCP server. Your job: find and fix the bugs that break a NEW USER's first-run experience — the way earlier passes found "unknown command 'orient'", "--no-embed kills BM25", "watcher EMFILE on target/", and "install never builds the index".

If the user named a target repo or a specific area in their message ($ARGUMENTS), focus there; otherwise pick a clean repo as described below.

Method — dogfood, don't just unit-test

  1. BUILD FIRST so you test current code, not the published version: npm run build → drive node dist/cli/index.js, never bare openlore/npx openlore (those resolve the OLD published version). When comparing to published behavior, do it explicitly with npx --yes openlore@latest and label it.

  2. Pick a CLEAN sibling repo under the parent of this repo that does NOT already have openlore (check: no .openlore, no openspec/, no OpenLore block in CLAUDE.md). Prefer variety across runs — a Rust repo (huge target/), a big monorepo, a Python repo, a repo with a pre-existing .claude/settings.json. proxilion (Rust) and vaulytica (TS) are known-good.

  3. Run the REAL first-run flow as a user would, end to end, checking exit codes AND actual output of each step: openlore install # the one-command path

    then simulate the first agent session: run the SessionStart hook command verbatim

    from .claude/settings.json, plus a real orient --task query

    Also exercise: init → analyze → analyze --no-embed → analyze --force → orient (no task / with task / bad --limit) → install --no-analyze → install --dry-run → install --uninstall → mcp server over stdio (initialize → tools/call orient).

  4. Stress the edges that break in the field, not just happy paths:

    • Large/non-TS repos (build dirs: target/, node_modules/, dist/, .venv/, vendor/) → EMFILE, ENOSPC, multi-minute hangs, watching the wrong tree.
    • --json output must be PURE parseable JSON on stdout; all diagnostics/logs go to stderr. (Pipe 2>/dev/null and JSON.parse it.)
    • Idempotency / re-runs: running install or analyze twice must be a clean no-op, not a duplicate or a clobber.
    • Pre-existing user files (.claude/settings.json, CLAUDE.md, .gitignore): MERGE, never clobber. Verify with a repo that already has them.
    • process.cwd() vs explicit-dir handling; commander singletons leaking option state between parseAsync calls in tests.
    • Wrapper/skill paths (orient.sh, orient.ps1, orient-via-mcp.mjs) and graceful degradation against OLDER openlore versions that lack new flags.

Read the full file on GitHub · 85 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. 10d ago First seen · 85 lines · 49 tokens per session scan A 5a616b310bf1

Subscribe to this mod's changes

first-run-hardening is a command published in the GitHub repository clay-good/OpenLore (301 stars, last pushed yesterday), licensed MIT. It adds 49 tokens to every session and 1,323 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-30.