No description
  • TypeScript 51.5%
  • JavaScript 48.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-19 22:10:51 +08:00
.agents docs(memory): refresh the memory render 2026-09-19 22:10:51 +08:00
.codestable docs(codestable): record the v0.1.10 release evidence 2026-09-19 22:06:19 +08:00
docs docs(handoff): document the conservative knee threshold and its caps 2026-09-19 22:04:10 +08:00
extensions/project-context fix(handoff): anchor auto on the conservative knee curve 2026-09-19 22:04:04 +08:00
tests fix(handoff): anchor auto on the conservative knee curve 2026-09-19 22:04:04 +08:00
.gitignore fix(memory): close the residual risks of decoding, budgeting and the write lock 2026-09-15 22:22:12 +08:00
LICENSE docs: align the license attribution with dsh-project-context 2026-09-14 10:09:23 +08:00
README.md docs(handoff): document the conservative knee threshold and its caps 2026-09-19 22:04:10 +08:00

pi-project-context

pi coding agent 扩展:项目记忆与会话上下文——会话存档、MEMORY.md/CONTEXT.md consolidation、跨会话技能学习以及带摘要和 replay-safe 原文窗口的 handoff。

安装

pi install git:github.com/P02-1010751281/pi-project-context

本包没有 package.jsonpi 按约定发现 extensions/ 入口git 安装不需要 npm也没有运行时依赖。不要加回 package.json;含 manifest 的 git 包在安装/checkout 对齐时可能执行 npm install,未装 npm 的机器会让 pi 启动失败。

升级:仓库侧打新 tag再执行 pi install <source>@<new-ref>pi update --extensions 只对齐已经 pin 的 ref。

不要再往 ~/.pi/agent/extensions 部署副本。 pi 会同时加载两份实例,各自注册同名命令,导致命令改名为 auto-handoff:1/:2、斜杠命令失效、hooks 双跑。若残留旧的镜像目录(project-contextsession-contextmemoryautolearnauto-handoff_shared),删除后再 /reload

功能概览

能力 主要产物 说明
存档 session.jsonlsession.mdINDEX.md 逐轮增量写入,可导入历史 session
整理 memory.jsonlMEMORY.mdCONTEXT.md journal-backed 长期 memory 与当前工作态 context
沉淀 skills/<name>/SKILL.md 证据门禁后的项目技能,或 skill-candidates/
交接 新 session、HANDOFF.md 旧段摘要 + 最近原文 + replay-safe marker

项目状态默认位于 <project>/.agents/memory/。完整数据布局、恢复规则和源码模块见架构与数据模型

文档

最小配置

配置文件:<project>/.agents/memory/project-context.json

{
  "archiveEnabled": true,
  "autoConsolidate": true,
  "autoLearn": true,
  "handoffEnabled": true,
  "maxMemoryChars": 32000,
  "handoffAdaptive": true,
  "handoffThresholdRatio": 0.4,
  "handoffTargetTokens": 64000,
  "handoffKeepTokens": 20000
}

完整字段、命令和 flags 见配置与命令

验证

node tests/run-all.mjs
git diff --check

涉及 handoff、memory 写入或 compaction prompt 时,按 .agents/skills/pi-project-context-headless-rpc-handoff-validation/SKILL.md 使用 throwaway sandbox 做真实 RPC 验证provider 的 402/429/credits 错误只能记录为环境阻塞,不能算 handoff 通过。

许可证

MIT © 2026 呼啸山庄 (P02-1010751281),见 LICENSE