SCHEMA-FACTORY 是 simhacker/moollm 项目中的 schema 处理工具,面向 Gary Drescher 式 schema 机制,强调“确定性检查优先,LLM 其次”。它用 SCHEMA-SCHEMA.yml 规定合法 schema 的必填字段、类型、reliability 范围以及 context/result 非空等约束,并由 Python 完成校验与组合,LLM 只负责综合精炼。
主要操作通过 schema_tool.py 提供:lint 校验 YAML schema 并输出诊断;ingest 依据经验日志或观察到的转换更新 schema 集合与证据计数;compose 根据 schema 集合和目标状态生成动作链及理由;context 生成紧凑的 LLM 上下文包,可含 id、action、context、result、reliability、extended_context、extended_results 等字段,并支持 --focus 聚焦项。各操作分别发出 schema_lint、schema_ingest、schema_compose、context_generate 事件。
示例命令: python3 schema_tool.py lint examples/schema-example.yml python3 schema_tool.py compose --schemas examples/schema-example.yml --goal postgres-running python3 schema_tool.py context --schemas examples/schema-example.yml --goal pyvision-running python3 schema_tool.py ingest experience-log.yml --into my-schemas.yml
示例文件包括 examples/schema-example.yml 与 examples/henry-minsky-blocksworld.yml。它与 Drescher 的 schema-mechanism、实验设计、调试与规划等模块配合,适合需要受控 schema 校验、动作组合和 LLM 上下文生成的场景。限制方面,ingest 明确不调用 LLM,只做确定性更新;其余收费、平台与效果信息暂未提供。