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

pcl-context

v1.0.0

Published

Persistent Context Layer - 让 AI 记住你的一切

Readme

PCL - Persistent Context Layer

Persistent Context Layer (PCL) 是一个让 AI 助手记住上下文的工具,通过本地文件存储和 MCP 协议实现。

English Version | 中文版本

功能特性

  • 本地优先: 所有数据存储在 ~/.pcl/ 目录
  • 文件即数据库: 使用 YAML 和 Markdown 格式存储数据
  • MCP 协议支持: 与 Cursor、Claude 等 AI 工具集成
  • 版本控制: 自动 Git 提交跟踪变更
  • 上下文注入: 智能检索相关上下文供 AI 使用

安装

npm install -g pcl-context

快速开始

# 初始化 PCL
pcl init

# 设置用户信息
pcl set user.name "Your Name"
pcl set user.role "Developer"

# 创建项目上下文
pcl set -p my-project name "My Project"
pcl set -p my-project description "A sample project"
pcl set -p my-project tech_stack.frontend.[] "React"
pcl set -p my-project tech_stack.backend.[] "Node.js"

# 获取信息
pcl get -p my-project tech_stack

# 列出项目
pcl list projects

CLI 命令

基础命令

  • pcl init: 初始化 PCL
  • pcl set <path> <value>: 设置上下文字段
  • pcl get <path>: 获取上下文字段
  • pcl list [type]: 列出项目或记忆

项目管理

  • pcl project create <id> [options]: 创建新项目

上下文注入

  • pcl inject [query]: 智能上下文注入
  • pcl remember <text>: 保存记忆
  • pcl recall [query]: 检索记忆

版本控制 (Phase 3)

  • pcl history: 查看上下文变更历史
  • pcl diff [ref1] [ref2]: 查看差异对比
  • pcl rollback <ref>: 回滚到指定版本
  • pcl snapshot <name>: 创建命名快照

MCP 集成

  • pcl mcp: 启动 MCP 服务器 (stdio 模式)

架构

PCL 采用分层架构:

┌─────────────────────────────────────────────────────────────────┐
│                        用户交互层                                │
│  ┌──────────┐  ┌────────────┐  ┌──────────────────────────┐     │
│  │  CLI 工具 │  │  MCP Server │  │ AI 工具(Cursor/Claude等)│     │
│  │  (pcl)   │  │  (stdio)   │  │   via MCP Client         │     │
│  └────┬─────┘  └─────┬──────┘  └────────────┬─────────────┘     │
│       │              │                       │                   │
└───────┼──────────────┼───────────────────────┼──────────────────┘
        │              │                       │
        ▼              ▼                       ▼
┌─────────────────────────────────────────────────────────────────┐
│                      核心服务层(Core)                           │
│                                                                  │
│  ┌──────────────┐  ┌──────────────┐  ┌─────────────────────┐    │
│  │ ContextStore │  │ InjectionEng │  │ MemoryManager       │    │
│  │ 上下文存储管理 │  │ 上下文注入引擎 │  │ 跨会话记忆管理       │    │
│  └──────┬───────┘  └──────┬───────┘  └──────────┬──────────┘    │
│         │                 │                      │               │
│         ▼                 ▼                      ▼               │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │              SearchIndex(检索索引层)                     │   │
│  │         FlexSearch 全文索引 + 关键词/标签匹配              │   │
│  └──────────────────────────┬───────────────────────────────┘   │
│                              │                                   │
└──────────────────────────────┼──────────────────────────────────┘
                               │
                               ▼
┌─────────────────────────────────────────────────────────────────┐
│                      持久化层                                    │
│                                                                  │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────┐   │
│  │ FileStore    │  │ GitManager   │  │ ConfigManager        │   │
│  │ YAML/MD 文件  │  │ simple-git   │  │ config.yaml          │   │
│  │ ~/.pcl/      │  │ 自动提交/快照  │  │ 全局/项目配置          │   │
│  └──────────────┘  └──────────────┘  └──────────────────────┘   │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

技术栈

  • 运行时: Node.js 18+
  • 语言: TypeScript
  • 模块系统: ES Modules
  • 构建工具: tsup (基于 esbuild)
  • 依赖管理: npm

开发

安装依赖

npm install

构建项目

npm run build

运行测试

npm test

开发模式

npm run dev


## 开发

# 安装依赖
npm install

# 构建项目
npm run build

# 运行测试
npm test

# 开发模式
npm run dev

## 贡献

我们欢迎贡献!请查看 [CONTRIBUTING.md](CONTRIBUTING.md) 了解如何参与。

## 许可证

[MIT License](LICENSE)

## 隐私声明

PCL 是一个**本地优先**的工具:
- 所有数据存储在本地 `~/.pcl/` 目录
- 不会将任何数据发送到云端
- 完全开源,你可以审查所有代码
- 适用于对隐私有高要求的场景