Hubert-hwk/dsh-loop-doctor--packages-loop-doctor-tool-diagnose ↗★ 0
@hubert-hwk/dsh-loop-doctor-tool
The loop_doctor_diagnose model-facing tool: analyzes a session's SessionEvent log on demand and returns reviewable detour findings plus suggestions. 适合让代理自查自身会话绕路并获取建议,需人工复核后再应用。
설치
검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗
@deepseek-ai/dsh-loop-doctor-tool
中文 | English
The self-referential model-facing tool of the loop-doctor family: loop_doctor_diagnose.
Calling it without a sessionId diagnoses the calling agent's own session — the harness diagnosing its own harness. It runs the deterministic engine over the session's SessionEvent log, derives suggestions, verifies each by replay, and returns a compact JSON report:
{
"sessionId": "session-7",
"summary": "3 detour(s), 3 suggestion(s); apply only after human review.",
"signals": [
{ "kind": "retry-storm", "sub": "repeat:grep", "turn": 1, "metric": 4,
"metricUnit": "calls", "detail": "4 consecutive identical grep calls …",
"evidenceCount": 4, "evidenceSeqs": [2, 3, 4, 5] }
],
"suggestions": [
{ "id": "retry-storm:1:repeat:grep", "signalKind": "retry-storm",
"title": "Stop repeating identical calls", "target": "prompt",
"action": "Add a system-prompt rule …", "confidence": 0.8,
"fixPatternId": "retry-storm-repeat",
"replay": { "before": 3, "after": 2, "avoided": 1, "verified": true,
"simulated": false, "unit": "calls", "detail": "…" } }
]
}
- Evidence is projected as seqs only — locate the events in
session.eventsto audit a finding; the full evidence never rides into the model surface. exec.signalis honored, unknown sessions fail loud, and no change is ever applied — the tool returns a report for review.- Config forwards detector thresholds to the on-demand analysis.
See the family README for the demo and safety baseline.
Model Experience
The loop_doctor_diagnose report
What the model sees
A compact multi-line report in the tool result: one line per detour signal with its evidence count, and one line per suggestion with target, confidence, action, and an honest badge. Evidence rides as seqs only — full events never enter the model surface.
Report as the model receives it
Loop-doctor diagnosis for session main-session-…:
2 detour(s), 2 suggestion(s) (1 replay-verified); apply only after human review.
- [retry-storm/repeat:grep] turn 1: 4 consecutive identical grep calls (4 evidence events)
- suggestion [retry-storm-repeat] (prompt, 80%): Stop repeating identical calls — … [replay-verified]
Token effect
The report scales with detour count (a few lines per signal/suggestion); a clean session returns a one-line summary.
KV Cache effect
The tool result appends after the reusable request prefix; nothing before it changes, so existing KV-cache entries stay valid.
Known Limitations and Deferred Work
- Read-only. The tool returns a report; applying a fix is the apply plugin's job behind human review. A review-approval tool is deferred.
- Whole-session analysis. No turn-range or time-window scoping yet; long sessions analyze in one pass (bounded by the detector's evidence caps).
- No fix application from the tool. The model cannot self-apply; this is the safety boundary, kept deliberately.