SuperAPI AI 工具集

hns-lsel-curator

智能体与模型

查看项目

更新于 10-15 21:02

技能介绍

用途:该技能为 MoAI-ADK 的本地自进化循环(LSEL)提供机械式 drain 与聚类能力,填补此前仅有教义段落、无实际 drain 代码的空白。它只作用于用户自有表面,不触碰冻结的 Go applier(internal/harness/applier.go:22 的 write-flag 保持 false)。

主要能力:机械核心 drain.sh 读取 .moai/lessons-inbox.jsonl,按 companion offset 切片,先做 drain 侧严重度过滤(丢弃 tool_failure:Bash:UnknownFailure、tool_failure:Bash:SandboxViolation、任意 *:TimeoutError),再按 event_key 聚类并统计频次、首末出现时间与最多 3 条样本摘要;丢弃频次小于 2 的单例;以 importance = min(10, frequency) 打分;输出候选到 <state-dir>/clusters.json 并推进 offset。inbox 只追加、永不修改。若 inbox 未增长则写空候选并保持 offset 不变。

使用方式:drain.sh --inbox <path-to-lessons-inbox.jsonl> --state-dir <path-to-lsel-state>。所有 drain 应经由 session_drain.sh 包装器执行:session_drain.sh [--inbox <path>] [--state-dir <dir>],默认使用实际路径。包装器提供独占 drain 锁(争用即安全空操作)、覆盖前无条件归档 clusters.json 到 clusters-history/、单行状态与 fail-open。本地接线需在 .claude/settings.local.json 的 hooks.SessionStart 中加入 session_drain.sh 与 backlog_check.sh,各设 "timeout": 30。

M2 阶段:PROPOSE 读取 clusters-history/ 中最新归档(而非易失的 live clusters.json),先检索 ~/.claude/projects/<hash>/memory/ 下的 feedback_*.md 作为 retrieval_evidence,再在 .moai/state/lsel/proposals/<id>/ 生成 proposal.md、diff.patch、self-critique.md;proposal.md 含 8 个必填 YAML 键(proposal_id、target_surface、rationale、WHY-not-just-WHAT、prediction、verify_command、blast_radius、memory_type、retrieval_evidence、status)。self-critique 存在 UNRESOLVED 反对意见时 status 为 blocked。

限制:M1 不写 memory/,不执行 APPROVE/APPLY;不编辑冻结教义、CLAUDE.md、模板、保留 agent、moai-* 技能及冻结 Go applier;不新增 .moai/config/sections/ 文件,循环状态位于 .moai/state/lsel/;不调用 orchestrator 的用户门,缺失输入时返回结构化 blocker 报告。M2 仅生成影子提案,APPROVE/APPLY 属 M3 的 hns-lsel-applier 路径,且不接入已失效的 Tier-4 流程。CSA 强制门覆盖六类 blast radius(INVARANTS 内核、安全/校验例外带、高扇入引用、Bash 风险路径、permissions.allow 新增、execution-meta 文件),强制门不受 bother-cost 豁免。验证可运行 drain_test.sh 与 session_drain_test.sh。