Zoria-Lind/dsh-behavior-enhancer ↗★ 8

@zoria-lind/dsh-behavior-enhancer

提供系统提示词约束与失败收敛等行为管理。 优化DSH工具调用行为与容错。适合需要提升大模型任务执行稳定性的用户。

包名
@zoria-lind/dsh-behavior-enhancer
兼容性
待验证
版本
1.2.3
许可证
MIT
最近更新
2026年10月2日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Zoria-Lind/dsh-behavior-enhancer

配置

- id: behavior-enhancer
  name: '@zoria-lind/dsh-behavior-enhancer'
  config:
    behaviorPrompt:
      enabled: true
      order: -98
      text: |        # 可整体替换;必须保持静态(禁时间戳/动态值)
        ## 工具调用行为纪律(本会话)
        - 先读后写
        - 批量操作前先验证
        - 失败立即收敛
        - 同类修改串行
        - 证据与诚实
        - 上下文已压缩时先查日志再回答
    parallelConvergence:
      enabled: true
      recoveryThreshold: 3     # 连续成功次数达到后恢复原并行度
      complexRatio: 0.6        # 上下文压力比(idle 测量),超阈值降档
      minParallel: 1
      defaultParallel: 10      # 读不到当前值时的 fallback(核心默认 10)
      contextWindowFallback: 1000000
    failureGuard:
      enabled: true
      maxFailures: 2
      followupMessage: '工具 {tool} 已连续失败 {count} 次。请停止重试,向用户说明失败原因并询问下一步。'
      blockFeedback: false     # 慎用:拦截错误结果正文,模型会看不到失败细节
      feedbackText: '该工具调用失败。请先分析失败原因并修正调用参数后再重试,不要原样重复。'
    postWriteCheck:            # v1.1 写后检查(默认开启)
      enabled: true
      writeTools: ['write', 'edit']
      checkExtensions: ['json', 'yaml', 'yml', 'js', 'mjs', 'cjs', 'ts', 'tsx', 'jsx', 'py', 'ps1', 'sh', 'toml', 'xml']
      maxFileBytes: 500000     # 超过该大小跳过检查(也跳过快照)
      keepBackups: 5           # 每文件保留的 .bak 快照份数
      askThreshold: 3          # ≥3 个问题才弹窗询问(1~2 个自动回滚)
      askTimeoutMs: 120000     # 询问超时,超时按 autoRollback 降级
      snapshotDir: '~/.dsh-memory/files'
      autoRollback: true       # 询问不可用/超时时自动回滚(fail-safe)
    memory_bridge:             # dsh-memory-bridge 联动占位节(阶段 3b 完成后开开关)
      enabled: false
      sync_on_check: true
      rollback_from_memory: true
      post_write_check: true