npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tomasznowak-dev/sdd-brain

v1.0.0

Published

Deterministic CLI for a spec-driven-development knowledge base (.context): local index, checksum-based drift detection, search and integrity repair for agents and humans.

Readme

sdd-brain

Deterministic CLI for a spec-driven-development knowledge base kept in .context/: research, plans, implementations, lessons and improvement suggestions that agents and developers accumulate while working on a project.

  • Cheap lookups. search and get return a few hundred tokens instead of a whole markdown index.
  • No merge conflicts. The index (.context/index.json) is local, git-ignored and rebuilt by git hooks. Only per-artifact files are committed.
  • Drift detection. Every artifact records checksums of the files (and optionally functions or methods) it documents. The CLI tells you right away whether the code still matches: fresh, stale, missing or unverified.
  • Integrity repair. A deterministic worklist plus a step-by-step loop for an agent.
  • Works for agents and humans. Zero runtime dependencies, Node ≥ 20, Windows, Linux and macOS.

Install

npm i -D @tomasznowak-dev/sdd-brain
npx sdd-brain init

init is safe to run repeatedly. It:

  1. Creates .context/{research,plans,implementations,lessons,improvement-suggestions}.
  2. Brownfield: if .context already exists, it backs it up to .context/.backups/context-<timestamp>.tar.gz and migrates legacy short.md, INDEX.md and single-file suggestions to meta.json. Baseline checksums come from git history, taken at the commit that last touched each artifact.
  3. Adds .context/index.json, .context/.config, .context/.cache/ and .context/.backups/ to .gitignore.
  4. Installs git hooks (post-checkout, post-merge, post-rewrite, pre-commit). It detects husky, lefthook and core.hooksPath, and appends between # sdd-brain start/end markers without overwriting your scripts.
  5. Adds sdd-brain hooks install to the project's prepare script, so teammates get the hooks on npm install.
  6. Writes the agent procedure: a block in AGENTS.md (Codex, Cursor, Copilot, Devin…), an import in CLAUDE.md and the Claude Code skill .claude/skills/sdd-brain/SKILL.md.

Options: --language <code>, --no-hooks, --no-agents, --no-prepare.

Knowledge-base language

Agents write in English by default unless told otherwise. init therefore sets the language of the knowledge base, and the file structure stays the same. Only the instructions change:

  • npx sdd-brain init --language pl (codes such as pl, en, de, or names like polski, German; auto = the language of each artifact / conversation).
  • Without the flag, brownfield projects get the language detected from the existing .context, greenfield projects get auto.
  • The language is stored in .context/.config and written into the committed AGENTS.md block, so every teammate's agent sees the same rule. It is also passed to help agent, help summaries and the summarizer subagent.
  • To change it later, run init --language <code> again. It only rewrites the managed blocks.

Layout

.context/
  <category>/<key>/full.md     # content (markdown)
  <category>/<key>/meta.json   # metadata + checksums – written by the CLI only
  index.json                   # local index (git-ignored)
  .config                      # local settings (git-ignored)

Artifact id = <category>/<key>, e.g. plans/custom-fields. The same key across categories forms a chain (research → plan → implementation → lesson).

meta.json:

{
  "schema": 1,
  "id": "implementations/jwt-removal",
  "title": "Remove JWT",
  "status": "active",
  "lifecycle": null,
  "summary": "≤200 characters – shown in search results",
  "description": "≤1000 characters – shown by get",
  "full": "full.md",
  "created": "2026-08-07",
  "updated": "2026-08-07",
  "branch": "feature/x",
  "files": [
    { "path": "src/Api/Api.php", "hash": "a1b2c3d4e5f60718", "commit": "<HEAD when hashed>",
      "symbols": [{ "name": "Api::init_jwt_stub", "hash": "…" }] }
  ],
  "refs": ["plans/jwt-removal"]
}
  • status: active | archived (code described is gone or superseded; statusNote says why).
  • lifecycle (suggestions only): new | in-progress | completed | descoped.
  • Checksums: SHA-256 of the content with the BOM stripped and CRLF/CR converted to LF, so Windows and Linux produce the same value. Shortened to 16 hex characters.
  • Research and implementation artifacts must record checksums. Plans list files without checksums. Lessons and suggestions may record them.

Commands

| Command | Purpose | |---|---| | search <phrase> [-c category] [-s active\|archived\|all] [-n N] [--json] | Ranked results: id \| status \| freshness \| summary | | get <id>… [--full] [--json] | Description, files with freshness (stale symbols), refs, chain | | which <file>… | Artifacts that document a file | | verify <id>… \| --all [--exit-code] | Per-file and per-symbol checksum comparison | | new <category> <key> --summary … [--title] [--description] [--file] | Create an artifact from a template | | meta add-file <id> <file> [--symbol S…] [--no-hash] | Track code; the CLI computes the checksums | | meta remove-file <id> <file> | Untrack code | | meta refresh <id> [--files …] [--drop-missing] | Re-checksum changed code, re-read refs from full.md, bump updated | | meta set <id> [--summary] [--description] [--title] [--status] [--note] [--lifecycle] [--branch] [--reviewed <flag\|all>] | Validated metadata edits; setting summary/description clears its review flag. Only status/lifecycle changes bump updated | | meta set-many [--file f] | Batch summary/description/title from JSON Lines on stdin (no shell quoting issues) | | hash <file> [--symbol S] [--list] \| --stdin | Raw checksums; --list shows detectable symbols | | index [--force] | Rebuild the local index (hooks do this automatically) | | migrate [--dry-run] [--keep-short] [--no-backup] | Convert a legacy .context | | repair [list] \| next \| done <id> [--force] \| skip <id> \| reset + [--only <kind>] [--batch N] | Integrity worklist and agent loop | | check [--strict] [--json] | Validate all meta.json files (exit code 1 on errors – use in CI) | | hooks install \| uninstall \| status | Manage git hooks | | precommit | Non-blocking warning for staged code whose artifacts were not updated | | stats [--export file] [--json] [--reset] | Estimated token savings | | help agent | The agent procedure (same content as the skill) | | help summaries | Self-contained instructions for a light model rewriting summaries |

Global option: --root <dir> (defaults to the git root of the current directory).

Symbols

Symbol names look like Class::method, Class.method, Outer::Inner::method, function or Class. Extraction is heuristic and dependency-free: strings and comments are masked, container blocks (class / interface / trait / enum / struct / namespace / impl / object literal) are located, and the member's body is matched by braces. The preceding docblock, attributes and decorators are included. Supported: PHP, JS/TS, Java, C#, Kotlin, Go (receiver methods), Rust (impl), C/C++, Swift, Dart, Scala and Python (by indentation). Unknown names are reported as unresolved, duplicates as ambiguous.

Freshness

| State | Meaning | |---|---| | fresh | All recorded checksums match the current code | | stale | At least one file changed since the artifact was written; get and verify show which symbols | | missing | A recorded file no longer exists (repair fixes renames with identical content automatically) | | unverified | No baseline checksum (e.g. migrated without git history) | | n/a | Nothing to compare (plans, artifacts without files) |

Typical agent workflow

npx sdd-brain search "taxonomy"            # 1. find candidates
npx sdd-brain get research/how-to-add-taxonomy
# read full.md only if active and relevant; stale → verify against the code
npx sdd-brain which src/Taxonomy.php       # 2. before editing a file
npx sdd-brain new implementation add-taxonomy --summary "…"   # 3. leave knowledge behind
npx sdd-brain meta add-file implementations/add-taxonomy src/Taxonomy.php --symbol Taxonomy::register
npx sdd-brain meta refresh implementations/add-taxonomy

Integrity pass:

npx sdd-brain repair          # worklist
npx sdd-brain repair next     # one item with exact steps
npx sdd-brain repair done <id>

Summaries after a migration

Summaries produced by migrate are mechanical excerpts of the old short.md (first sentences), so every migrated artifact is flagged review: summary. Writing a real summary needs understanding but no code, which makes it a good job for a light model (Haiku-class):

  • Claude Code: init installs the subagent .claude/agents/sdd-brain-summarizer.md (model: haiku).
  • Any other tool: give a cheap model the output of npx sdd-brain help summaries.

The light model loops over sdd-brain repair next --only summary --batch 10 (title, status, current summary and description per item) and saves each batch in one call:

npx sdd-brain meta set-many <<'EOF'
{"id": "research/example", "summary": "…"}
{"id": "plans/example", "summary": "…"}
EOF

Expect roughly 400 input + 60 output tokens per artifact.

Configuration (.context/.config, local)

{
  "language": "pl",
  "searchLimit": 15,
  "searchAttempts": 3,
  "summaryMax": 200,
  "descriptionMax": 1000,
  "titleMax": 120,
  "telemetry": true,
  "precommitWarnings": true,
  "subagent": { "enabled": false, "model": "haiku" }
}

language, searchAttempts and subagent are instructions for agents (printed by help agent). The CLI itself never calls a model.

Telemetry

search, get, which, verify and repair append {cmd, outBytes, baselineBytes} to .context/.cache/telemetry.jsonl. The baseline estimates what an agent would have read without the tool (a legacy markdown index, artifact files, code). sdd-brain stats shows the estimate (tokens ≈ bytes / 4). Nothing ever leaves the machine.

License

MIT