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

@agentproto/knowledge-cascade

v0.2.3

Published

@agentproto/knowledge-cascade — a global knowledge pack shadowed by per-scope override/extend/whiteout, over plain file trees. Pure: zero runtime assumptions beyond a `node:fs`-backed FsPort adapter; every host wires its own layers.

Readme

@agentproto/knowledge-cascade

A global knowledge pack shadowed by per-scope override/extend/whiteout, over plain file trees.

Override/extend/remove is by path identity, not typed-item merging: a higher layer re-authoring entries/foo.md shadows the lower layer's copy (override), a new path is additive (extend), and entries/foo.md.whiteout removes it (remove). No entry bodies are parsed to resolve a mount — listing a directory never reads content.

The cascade mechanics (OverlayFs, StackResolver, buildOverlayFromStack, FsPort, MemFs, ReadOnlyFs) live in @agentproto/corpus and are re-exported here unchanged. This package adds a standalone-first surface on top:

  • DiskFs — a node:fs-backed FsPort, for mounting a directory as a cascade layer.
  • packFs({ root }) — mount a pack directory read-only (DiskFs wrapped in ReadOnlyFs).
  • mountCascade({ base, lens?, constraints? }) — compose a precedence-ordered stack of layers into one mounted overlay, without going through the LayerProvider/StackResolver dynamic-binding machinery (corpus's buildOverlayFromStack does the same thing from a resolved StackResolution, if a host wants dynamic per-request layer selection instead of a hand-configured stack).

Standalone-app wiring

An app with no backend/registry can ship a global pack inside its own bundle and keep local overrides in its per-app durable data plane:

import { packFs, mountCascade, DiskFs } from "@agentproto/knowledge-cascade"

// Global pack: read-only, ships inside the app bundle.
//   <appDir>/packs/core/entries/**.md
const globalPack = packFs({ root: `${appDir}/packs/core` })

// Local overrides: writable, lives in the app's data plane.
//   <dataDir>/knowledge/entries/**.md
const localOverrides = new DiskFs({ root: `${dataDir}/knowledge` })

const cascade = mountCascade({ base: localOverrides, lens: [globalPack] })

await cascade.readFile("entries/greeting.md") // local override if present, else the pack's

Semantics, walking entries/** over cascade:

| Local file | Effect | |---|---| | entries/greeting.md (same path as the pack) | override — shadows the pack's copy | | entries/local-only.md (new path) | extend — additive, alongside the pack's entries | | entries/policy.md.whiteout | remove — the pack's entries/policy.md disappears from the cascade |

Writes (writeFile/appendFile/lock) always target base — the packs stay pristine no matter how many scopes mount them.

For a non-shadowable floor (a policy pack no override should be able to shadow or whiteout), pass it as constraints instead of lens — it mounts above base, read-only, so neither an override nor a .whiteout can touch it:

const cascade = mountCascade({
  base: localOverrides,
  lens: [globalPack],
  constraints: [policyPack],
})

What this package does not do

  • No typed-item merging — override/extend/remove operates on plain paths, not AIP-18 Item/Schema content. That is the corpus curation layer's job, not the cascade's.
  • No recursive listing built on top of an app_data_* MCP tool — the app data plane is just files on disk (app_data_read/app_data_write are the agent-facing convenience, not the only access path); DiskFs reads the tree directly with node:fs.