插件目录 / Knowledge / dsh-session-analyst
dsh-session-analyst
已验证 · 实测可装 dmsobtl
功能简介
DSH插件:会话质量分析——工具成功率、token效率、冗余检测、回归对比
可用 — 实测通过,早期项目
DSH插件:会话质量分析——工具成功率、token效率、冗余检测、回归对比 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-session-analyst
Session quality analysis plugin for DeepSeek Harness.
Gives the agent (and you) structured insight into session behavior: tool success rates, token efficiency, redundant calls, error patterns, and regression detection.
Install
dsh plugin add dsh-session-analyst
Or add to your cordis.patch.yml:
- id: session-analyst
plugin: dsh-session-analyst
config:
redundantCallThreshold: 3
excessiveStepThreshold: 10
Tools provided
analyze_session
Parse a session log file (.jsonl or compressed .jsonl.zstd) and return quality metrics.
Agent: I'll analyze the session from the last run.
→ analyze_session({ path: "~/.dsh/sessions/abc123/session.jsonl" })
Returns:
{
"summary": {
"totalTurns": 5,
"totalSteps": 12,
"totalToolCalls": 8,
"totalErrors": 1,
"successRate": 0.875,
"avgStepsPerTurn": 2.4
},
"issues": [
{ "severity": "warning", "code": "REDUNDANT_TOOL_CALL", "message": "..." }
],
"tokenStats": { "efficiency": 0.12, ... },
"toolStats": { "byName": { "bash": { "count": 5, "errors": 1 }, ... } }
}
compare_sessions
Compare baseline vs current session to detect regressions.
Agent: Compare today's run against yesterday's baseline.
→ compare_sessions({ baseline: "./baseline.jsonl", current: "./today.jsonl" })
Returns:
{
"verdict": "regressed",
"regressions": [
{ "dimension": "Tool success rate", "baseline": "100%", "current": "75%", "changePercent": -25 }
],
"delta": { "stepsDelta": +3, "errorsDelta": +2, "tokenDelta": +1500 }
}
Analysis dimensions
| Dimension | What it detects |
|---|---|
| Tool success rate | Percentage of tool calls that return without error |
| Redundant calls | Same tool + same arguments called multiple times |
| Token efficiency | Ratio of output tokens to total consumed |
| Excessive steps | Turns with >10 steps (possible loop) |
| Error patterns | Tools with >50% error rate |
| Duration | Wall-clock time per turn |
Use cases
- Post-run diagnostics: Agent analyzes its own session after a task to identify inefficiencies
- Regression detection: Compare sessions before/after a prompt or skill change
- CI integration: Headless mode runs a task, then analyze_session checks quality gates
- Skill tuning: Identify which tools are being misused and refine system prompts
Standalone usage (without dsh)
The parser and analyzer are usable as a library:
import { parseSessionFile, analyzeSession, compareSessions } from 'dsh-session-analyst'
const session = await parseSessionFile('./session.jsonl')
const analysis = analyzeSession(session)
console.log(analysis.summary)
Development
npm install
npm test
License
MIT
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-session-analyst」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
Web profile:
dsh plugin --profile web add dsh-session-analyst Headless(CLI)profile:
dsh plugin --profile headless add dsh-session-analyst 包信息
npm:dsh-session-analyst · 版本 0.1.0 · 实测环境 dsh 0.1.0-rc.6
实测报告
端到端验证通过:dsh 0.1.0-rc.6 上 L1 安装 + L2 加载 + L3 运行问答。
使用场景
给 agent 一套记忆、知识库或检索层,让它不再跨会话丢上下文。
适合谁
跑长项目、想让 agent 记住决策、文档和偏好而不用每次重讲的人。
二次开发建议
记忆/检索后端是缝——插新存储、调蒸馏策略,或加引用与审计轨迹。