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

@costrict/cosknow

v1.0.2

Published

Knowledge base command toolkit for AI agents

Downloads

386

Readme

CosKnow

CI npm Version npm Downloads

English | 简体中文

CosKnow is a knowledge-base command toolkit for AI agents. It breaks the knowledge generation workflow into reusable Markdown commands, prompt templates, and local utilities, so you can inspect, render, install, and validate those assets through a CLI.

The repository currently provides two main layers:

  • Command assets: reusable knowledge-base command templates under commands/
  • Runtime tooling: CLI, installer, template rendering, and document linting under src/

Use Cases

  • Prepare an installable knowledge command set for AI agents
  • Inspect command descriptions, arguments, and dependencies locally
  • Pre-render prompts or command templates to reduce manual replacement work
  • Install the command set into Roo Code or a custom directory
  • Run basic lint checks against generated knowledge documents

Built-in Commands

| Command | Description | | --- | --- | | kb-pre | Project pre-analysis | | kb-init | Full knowledge-base generation (multi-agent coordination) | | kb-eval | Knowledge quality evaluation (multi-agent mode) | | kb-optimize | Knowledge quality repair based on evaluation results | | kb-update | Incremental knowledge update based on Git diffs |

Directory Structure

CosKnow/
├── commands/        # Knowledge command templates
├── prompts/         # Prompt templates that can be rendered independently
├── linter/          # Knowledge document linting script
├── src/             # CLI and library code
├── scripts/         # Release scripts
├── test/            # bun:test suites
└── docs/            # Plans and troubleshooting notes

Requirements

  • Node.js 18+
  • Bun 1.3+ (required for development, testing, and builds)
  • An npm-compatible package registry

The published CLI prefers Bun when available. If Bun is not installed, it falls back to Node.js and runs the compiled output under dist/.

Quick Start

1. Install dependencies

bun install

2. List available commands

bun run dev list

3. Show details for a specific command

bun run dev show kb-pre

4. Render a command template

bun run dev render kb-pre --output ./doc/kb-pre-report.md

5. Render a prompt template

bun run dev prompt "01-仓库概览.md" --输出目录 ./doc/kb

6. Install the command set into Roo Code

bun run dev install --target roo-commands

7. Install the command set into a custom directory

bun run dev install --path ./.cosknow/commands --only kb-pre,kb-init

8. Lint a generated knowledge document

bun run dev lint ./doc/kb/仓库概览.md --project-dir .

CLI Usage

cosknow list
cosknow show <name>
cosknow render <name> [--key value...]
cosknow prompt <template> [--key value...]
cosknow lint <file> --project-dir <dir>
cosknow install --path <dir> [--only cmd1,cmd2]
cosknow install --target roo-commands
cosknow uninstall --path <dir>
cosknow installed

Subcommands

  • list: list all command templates
  • show: inspect command metadata, including arguments, dependencies, and related prompts
  • render: render placeholders in a command body
  • prompt: render a template from prompts/
  • lint: check common document issues such as broken paths and Mermaid snippets
  • install: copy command templates and resources into a target directory
  • uninstall: remove files tracked by the CosKnow installation manifest
  • installed: show detected installation targets

Use As a Library

import { createRegistry, install } from '@costrict/cosknow'

const registry = createRegistry()

console.log(registry.listCommands().map((command) => command.name))

const rendered = registry.renderPrompt('01-仓库概览.md', {
  输出目录: './doc/kb',
})

console.log(rendered)

await install({
  target: 'custom',
  output: './.cosknow/commands',
  only: ['kb-pre', 'kb-init'],
})

The main exported APIs include:

  • createRegistry() / clearCache()
  • install() / uninstall()
  • render()
  • resolveTarget() / BUILT_IN_TARGETS
  • loadCommand() / loadPrompt()

Installation Targets

Built-in installation targets are defined in src/targets.ts:

  • roo-commands: installs to ~/.roo/commands
  • custom: installs to the output directory passed by the caller

The installer also copies:

  • Markdown templates under prompts/
  • linter/kb-linter.js
  • the .cosknow-manifest.json installation manifest

Development Commands

bun run dev        # Run the CLI
bun test           # Run tests
bun run build      # Build dist/
npm run release    # Choose a version, generate changelog, build, publish, tag, push, and create a GitHub Release

Notes

  • Variable replacement for render and prompt uses placeholder names from the templates, not the display names shown by the command help. For example, the kb-pre template expects --output, not --output-path.
  • install --target roo-commands writes resources into ~/.roo/commands.
  • npm run release now publishes to npm, creates a Git tag, pushes it, and creates a GitHub Release with generated notes.
  • By default, the script checks gh --version and gh auth status before publishing. If gh is missing or not logged in, it stops before any release side effects happen.
  • If you want to publish without creating a GitHub Release, run SKIP_GITHUB_RELEASE=1 npm run release.

License

No standalone license file is declared in the repository yet. If you plan to publish it externally, add an explicit license policy first.