JohnathonYe/auto-compact 预览 preview

JohnathonYe/auto-compact

Plugin插件 Native原生 ⭐ 2 MIT Sessions & Context会话与上下文

Project Overview项目介绍

dsh-auto-compact is a DeepSeek Harness plugin for session-level auto context compaction. It renders a threshold ring beside the input that shows live context usage, and each session can set its own threshold (1%–90%, default 50%). Compaction fires automatically at the pre-step hook and turn-stopping event when usage crosses the threshold, then the summary is injected and the session resumes. Thresholds persist under the dsh-auto-compact namespace in settings.yaml. Note: uninstall the legacy auto-compact package first to avoid double mounting.

dsh-auto-compact 是 DeepSeek Harness 的会话级自动上下文压缩插件。它在输入区右侧显示阈值圆环并实时显示上下文用量,每会话可独立设置 1%–90% 的压缩阈值(默认 50%),超阈值时在回合每步前与回合结束时自动触发 compact,摘要注入后继续;阈值持久化于 settings.yaml,自动模式可在 pre-step 与 turn-stopping 钩子中零侵入生效。注意:旧版包名 auto-compact 须先卸载再装新包,否则会双挂载。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:JohnathonYe/auto-compact

把 JohnathonYe/auto-compact 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-auto-compact

中文 · English

会话级自动上下文压缩插件(DeepSeek Harness / DSH)

自动压缩阈值面板

在输入区右侧显示一个阈值圆环:当前会话上下文用量实时显示,拖动滑杆设置该会话的压缩阈值(1%–90%,默认 50%)。每当用量超过阈值,插件自动触发上下文压缩(compact)——回合中每走一步之前检查一次,回合结束时再检查一次——压缩摘要注入上下文后会话自然继续,全程无需手动干预,也不发送任何「继续」消息。

特性

  • 🔴 会话级阈值:每个会话独立设置,互不影响(按 sessionId 持久化)
  • 📊 实时用量:与自带 ContextMeter 同源(useProjection("contextPressure")),面板打开即实时刷新,无需轮询
  • 🎚️ 1%–90% 细腻调节:步进 1%,适合精细控制(未设置时默认 50%)
  • 🤖 全自动:回合中每步前 + 回合结束自动检测 → 超阈值自动 compact → 摘要注入后自然继续
  • 🛡️ 零崩溃风险:所有检查都在 agent/pre-step(waterfall 中间件)与 agent/turn-stopping(串行事件)里做,全程 try/catch,绝不抛出
  • 💾 持久化:阈值存于插件自己的 JSON 文件($DSH_HOME/dsh-auto-compact.json,默认 ~/.dsh/dsh-auto-compact.json),重启不丢
  • 🧊 与内置安全网并存:DSH 自带的 compaction-basic(默认 80% 压力阈值)保留为兜底,互不干扰

安装

前置:已装好 DSH(dsh web 能正常运行),Node.js ≥ 20、pnpm ≥ 10。

从旧版 auto-compact 升级:旧包名是 auto-compact,新包名是 dsh-auto-compact。请先卸载旧包再装新版,避免双挂载(两个 Host 半、两个圆环):

npx -y --package @deepseek-ai/dsh dsh plugin --profile web remove auto-compact

一键安装(推荐,复制粘贴即可)

macOS / Linux(Windows 装 Git Bash 或 WSL 也可):

curl -fsSL https://raw.githubusercontent.com/JohnathonYe/auto-compact/main/scripts/install.sh | bash

脚本自动完成全部步骤:安装 npm 依赖 → 注册官方挂载(dsh.profile.bundles)→ 清理旧版残留的挂载行。你只需要:

  1. 跑上面这一条命令
  2. 重启 DSH(装完后脚本会提示命令;也可以加上 --restart 让它自动重启:curl ... | bash -s --restart)
  3. 强刷浏览器(macOS Cmd+Shift+R / Windows·Linux Ctrl+Shift+R),输入区右侧出现阈值圆环 ✅

脚本内部已自动处理:dsh 命令通常不在全局 PATH(DSH 一般经 npx 安装,直接敲 dsh 会报 command not found),脚本会自动改用 npx 调用,无需用户手动处理。

或者用

npx -y --package @deepseek-ai/dsh dsh plugin --profile web add dsh-auto-compact

装完同样需要重启 DSH + 强刷浏览器。

从本地 checkout 安装(npm 未发布时)

dsh-auto-compact 目前尚未发布到 npm,上面的 dsh plugin --profile web add dsh-auto-compact 需要可用的 npm 源。若你只想跑本地代码,直接把 checkout 链接进 profile:

git clone https://github.com/JohnathonYe/auto-compact.git
cd auto-compact
npx -y --package @deepseek-ai/dsh dsh plugin --profile web add "$PWD"

pnpm 会以 link: 方式把 profile 指向这份 checkout(改完代码重启 DSH 即生效,无需重装);包内声明的 dsh.bundle.patch 仍会被 CLI 协调进 dsh.profile.bundles。

更新 / 卸载

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-superlcm 下一个 Next slide-gauge-pygame →