locklens AGENTS.md

A project guide for locklens, a tool that checks package lockfiles for known security vulnerabilities. It explains the project structure, supported package managers, and its command-line and MCP-server modes.

In plain words
What is it for?
Use it when changing local or remote repository auditing, lockfile detection, result formatting, CLI behavior, or automated tests.
Why use it?
It gives coding agents the context needed to find the audit logic, understand inputs, and work within the repository's conventions.

Instructions file for CodexOpenCode

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 instructions/barmplus/locklens/agents-md
Clone the repo
git clone --depth 1 https://github.com/BARMPlus/locklens

Made for: Codex, OpenCode.

Per session 2,164 This file is loaded in full into every session.
When invoked 2,164 The same file — it is already loaded in full.
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.02164 $0.02164
Opus 5 $0.01082 $0.01082
Sonnet 5 $0.00433 $0.00433
Haiku 4.5 $0.00216 $0.00216

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

Security

Grade A, and why

locklens AGENTS.md 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.

AGENTS.md · 264 lines

How it starts

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

AGENTS.md

本文件用于帮助后续接手本仓库的 Codex / Agent 快速理解项目结构、运行方式与当前约定。

项目定位

locklens 是一个基于 audit-ci 的 lockfile 审计工具,支持两种运行模式:

  • MCP Server
  • CLI / npx 直接调用

当前能力覆盖:

  • 本地项目目录审计
  • 远程 Git 仓库审计
  • npm / yarn / pnpm lockfile 检测
  • 统一格式的漏洞输出

当前技术栈

  • TypeScript
  • Node.js ESM
  • tsup 构建
  • tsx 运行手动联调脚本
  • prettier + eslint + lint-staged + husky
  • commitlint
  • @modelcontextprotocol/sdk
  • audit-ci

关键目录

  • src/client.ts
    • 单入口,负责 CLI 与 MCP 双模式
  • src/cli/
    • CLI 参数解析与执行
  • src/audit/
    • 审计核心实现
  • src/tests/
    • 手动联调入口,不是自动化测试
  • tests/cli/
    • 正式构建产物驱动的自动化 CLI 测试

审计核心结构

  • src/audit/service.ts
    • 审计总入口 runPackageAudit(...)
  • src/audit/lockfile.ts
    • lockfile 检测
  • src/audit/adapters/library-audit-adapter.ts
    • npm / pnpm 审计适配
  • src/audit/adapters/yarn-cli-audit-adapter.ts
    • Yarn 专用适配链路
  • src/audit/git-source/source-resolver.ts
    • source 解析:本地目录 / 远程仓库
  • src/audit/git-workspace/remote-workspace.ts
    • 远程仓库最小化工作区准备
  • src/audit/normalizers/
    • 审计结果归一化

当前输入模型

统一使用 source,不再使用 directory

  • 本地目录:source: "/path/to/project"
  • 远程仓库:source: "https://github.com/org/repo.git"git@host:group/repo.git

远程仓库协议规则

当前远程协议策略如下:

  1. github.com / gitlab.com / gitee.com

    • 用户传 HTTPS,会先执行一次非交互 ssh -T git@host 探测
    • 如果探测成功,则自动转换成 SSH 执行
    • 如果探测失败或无法明确判断,则继续按 HTTPS 执行
    • 用户传 SSH,则按 SSH 执行
  2. 其他域名

    • 如果用户传的是 HTTP(S),统一转换成 SSH
    • 目的是尽量避免内网 Git 服务触发交互式密码弹窗

远程 Git 执行要求:

  • 工具不接管交互认证
  • 只支持“本机 Git 已具备无交互访问能力”的仓库
  • 在真正执行 git clone 之前,会先做一次基于 Git 协议的 TCP 连通性预检查,不使用系统 ping
  • 远程连通性预检查默认超时为 5s,若主机不可达、DNS 失败或目标端口不通,会直接报错,不再进入 Git clone 阶段
  • 当前远程 provider 分为三类:
    • GitLab provider
      • 仅用于 gitlab.com
      • 仅使用 LOCKLENS_GITLAB_TOKEN
    • GitLab Self-Managed provider
      • 仅用于除 github.com / gitee.com / gitlab.com 外的其他 Git 域名
      • 当前默认把这些域名视为 GitLab 自建实例候选
      • 仅使用 LOCKLENS_GITLAB_PRIVATE_TOKEN
    • Git clone provider
      • 作为最终兜底路径,保持现有 Git clone 语义
  • TCP 连通性预检查是所有远程 provider 的统一前置校验,不属于某一个 provider 内部逻辑
  • LOCKLENS_GITLAB_TOKENLOCKLENS_GITLAB_PRIVATE_TOKEN 不混用,也不会交叉回退
  • Git 命令显式禁用交互提示
  • 远程最小工作区除了 package.json 与 lockfile 外,也会补齐常见包管理器配置文件:
    • .npmrc
    • .yarnrc.yml
    • .pnpmfile.cjs
  • 当前不考虑 monorepo / workspace 语义,因此不会额外拉取 pnpm-workspace.yaml 等工作区级配置文件
  • locklens 运行时临时资源统一使用 locklens-frontend-audit-* 前缀
  • 每次审计启动前都会尝试清理系统临时目录下超过 24 小时 的同前缀历史残留
  • 正常执行结束后仍会立即执行当前工作区 cleanup;启动前清理只是用于兜底异常退出后的遗留目录/文件

Read the full file on GitHub · 264 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 · 264 lines · 2,164 tokens per session scan A 0447ff885a9e

Subscribe to this mod's changes

locklens AGENTS.md is an instructions file published in the GitHub repository BARMPlus/locklens (83 stars, last pushed 3mo ago), licensed MIT. It adds 2,164 tokens to every session, about $0.0108 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.