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

ai-commons

v0.2.13

Published

Shared Claude Code rules + dialog-saver hook for projects

Readme

ai-commons

Общие правила для AI-агентов + автосохранение Claude-диалогов. Поставляется как npm-зависимость и поддерживает четыре популярных таргета:

| Агент / стандарт | Файл в потребителе | Режим | |---|---|---| | Claude Code | CLAUDE.md | управляемый блок (@AGENTS.md import) | | OpenAI Codex / стандартный AGENTS.md | AGENTS.md | управляемый блок (встроенное содержимое) | | Cursor | .cursor/rules/ai-commons.mdc | весь файл принадлежит ai-commons |

В файлах с управляемым блоком (CLAUDE.md, AGENTS.md) содержимое между метками <!-- ai-commons:begin --> и <!-- ai-commons:end --> перезаписывается; всё остальное в файле — твоё, не трогается.

Дополнительно для Claude:

  • SessionStart-хук обновляет все три target-файла на каждом старте сессии.
  • Stop / SessionEnd-хук сохраняет диалог в .ai-dialogs/YYMMDD-HHII-<topic>.md. Папку коммить — в .gitignore не добавляется (и из старых установок чистится).

Установка в новый проект

cd my-new-project
npm init -y                                             # если package.json ещё нет
npm i -D /Users/os/okneigres-repos/ai-commons

postinstall всё настраивает автоматически. Запустить вручную:

npx ai-commons install      # идемпотентно: можно гонять сколько угодно раз
npx ai-commons uninstall    # снять блоки, хуки и Cursor-файл

Правила

Лежат в RULES.md — это публичный контракт, его содержимое targets.js копирует во все target-файлы потребителей. AGENTS.md в этом репо — заметки для работы над самим ai-commons, в потребителей не попадает.

Как обновить правила во всех проектах

  1. Правишь RULES.md здесь.
  2. git commit && git push (или просто коммит, если репо локальный).
  3. В каждом потребителе:
    • Claude: ничего делать не надо — SessionStart-хук подтянет новые правила в следующей сессии (для file:-зависимостей) или после npm update ai-commons (для опубликованных).
    • Codex / Cursor: npm install (или npx ai-commons install) — перепишет блоки и Cursor-файл.

Сохранение диалогов (только Claude)

После каждого Claude Stop (и при завершении сессии) хук пишет .ai-dialogs/YYMMDD-HHII-<topic>.md:

  • Timestamp — момент первой реплики пользователя в сессии.
  • <topic>ai-title из транскрипта Claude Code, fallback на первую пользовательскую реплику.
  • Файл переписывается на каждом Stop в пределах одной сессии (то есть всегда содержит полный диалог).
  • Thinking-блоки модели не сохраняются — только пользовательский текст, ответы ассистента, tool calls и их результаты.

.ai-dialogs/ коммитятся — installer не добавляет их в .gitignore (и убирает запись, если она осталась от установок <0.2.12).

Структура репо

ai-commons/
├── RULES.md                           — источник правды (правила), копируется в потребителей
├── AGENTS.md                          — заметки для работы над самим ai-commons
├── package.json                       — bin + postinstall
├── bin/ai-commons.js                  — CLI: install / uninstall
├── scripts/
│   ├── postinstall.js                 — npm-хук, запускает installer.install
│   ├── installer.js                   — установка/удаление в потребителе
│   ├── targets.js                     — список таргет-файлов (Claude/Codex/Cursor)
│   └── managed-block.js               — вставка/обновление блока в markdown
└── hooks/
    ├── ensure-rules-pointer.js        — SessionStart-хук (рефреш всех таргетов)
    └── save-dialog.js                 — Stop / SessionEnd-хук

Переменные окружения

  • AI_COMMONS_SKIP_POSTINSTALL=1 — отключить автоустановку (CI и т.п.).

Что не делается

  • permissions и env из settings.json потребителя не трогаются — только свой набор хуков (SessionStart / Stop / SessionEnd) мержится.
  • Старый формат Cursor (.cursorrules в корне) не поддерживается — только современный .cursor/rules/*.mdc.
  • Автосейв диалогов реализован только для Claude (у других агентов нет аналогичных hook'ов).