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

session-weaver

v1.1.2

Published

🧵 Session Weaver - 解决 AI 编程助手会话上下文丢失问题,实现跨会话、跨 AI 工具的上下文无缝交接

Downloads

498

Readme

Session Weaver

npm version

解决 AI 编程助手(Cursor/Claude/Kiro 等)会话上下文丢失问题,实现跨会话、跨 AI 工具的上下文无缝交接。

核心问题

  • AI 会话有 token 上限,长对话后上下文被截断
  • 新开会话时,AI 完全不知道之前做了什么
  • 切换不同 AI 工具时,项目上下文无法迁移
  • 踩过的坑、做过的决策无法持久化传递

功能特性(7 工具架构)

| 工具 | 功能 | |------|------| | load_context | 一键加载上下文(模块 + 会话 + 踩坑),自动设置当前模块 | | save_context | 一键保存进度(更新模块 + 创建会话 + 记录踩坑) | | list_modules | 查看所有项目或项目内模块概览 | | list_pitfalls | 查看踩坑记录,支持按项目/模块/标签过滤 | | delete_data | 删除会话、踩坑、模块或整个项目 | | export_handoff | 导出全量交接文档(Markdown + JSON) | | import_handoff | 导入交接文档重建完整项目 |

快速开始

通过 npm 安装

# 全局安装
npm install -g session-weaver

# 或使用 npx(无需安装,自动更新)
npx -y session-weaver

配置 MCP 客户端

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "session-weaver": {
      "command": "npx",
      "args": ["-y", "session-weaver"]
    }
  }
}

Cursor

编辑 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "session-weaver": {
      "command": "npx",
      "args": ["-y", "session-weaver"]
    }
  }
}

其他 MCP 客户端

{
  "mcpServers": {
    "session-weaver": {
      "command": "npx",
      "args": ["-y", "session-weaver"]
    }
  }
}

使用示例

加载上下文(开始工作)

{
  "project": "my-app",
  "module": "payment",
  "sessionsLimit": 5
}

返回:模块详情、最近会话、相关踩坑记录

保存进度(完成工作)

{
  "project": "my-app",
  "moduleUpdate": {
    "removeTodos": ["微信SDK接入"],
    "addDecision": {
      "description": "选用 Stripe 而非 Paddle",
      "reason": "更好的 API 文档"
    }
  },
  "session": {
    "note": "完成微信支付 SDK 接入",
    "codeState": {
      "modifiedFiles": ["src/payment/wechat.ts"]
    }
  },
  "newPitfall": {
    "problem": "微信回调验签失败",
    "solution": "使用微信支付平台证书,不是商户证书",
    "tags": ["wechat", "webhook"]
  }
}

一键完成:更新模块待办、创建会话、记录踩坑

查看全局概览

// 列出所有项目
{}

// 查看项目内模块
{
  "project": "my-app"
}

导出让其他 AI 接手

{
  "project": "my-app"
}

生成包含全量数据的 Markdown 文档(人类可读 + 机器可解析)

导入交接文档

{
  "handoffId": "handoff-xxx"
}

{
  "markdown": "# 🤖 AI 会话交接文档..."
}

数据存储

所有数据存储在 ~/.session-handoff/ 目录:

~/.session-handoff/
├── projects/
│   └── {project-name}.json    # 单文件 = 项目 + 模块 + 会话 + 踩坑
└── handoffs/
    └── {handoff-id}.md        # 交接文档

单文件结构

每个项目一个 JSON 文件:

{
  "project": "my-app",
  "currentModule": "payment",
  "modules": {
    "payment": {
      "name": "payment",
      "status": "active",
      "summary": "支付宝完成,微信待接入",
      "todos": ["退款接口"],
      "decisions": [...],
      "techStack": ["stripe", "alipay-sdk"]
    }
  },
  "sessions": [...],
  "pitfalls": [...]
}

特点:

  • 单文件原子写入(临时文件 + 重命名,保证数据完整性)
  • 无需数据库,纯 JSON 文件,可手动编辑
  • 易于备份和版本控制

上下文基于架构

传统方式:                  Session Weaver:
读取所有 session 文件   →   读取单文件
内存过滤排序            →   按模块预筛选
返回全部数据            →   返回精准上下文
AI 自行找关联           →   currentModule 自动记忆

技术栈

  • Node.js >= 18 / TypeScript
  • MCP SDK
  • nanoid (ID 生成)
  • zod (参数校验)

许可证

MIT

相关链接

  • npm: https://www.npmjs.com/package/session-weaver
  • MCP 协议: https://modelcontextprotocol.io