Skip to content

lautherf/p-llm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PLLM — PROLOG-LLM 自进化引擎

Prolog 自省 + LLM 调用,驱动知识库自我进化。

核心循环

自省 introspection ──→ LLM ──→ 解析 parse ──→ 验证 validate ──→ 采纳 adopt ──→ 保存 save
  分析 KB 状态         生成新规则    Prolog 代码    格式/语义检查    assert 到 KB    evolved.pl

目录结构

config.pl                  DeepSeek API 配置(key / url / model)
engine/
  load.pl                  模块加载
  runner.pl                入口(main / demo)
  introspection.pl         自省:谓词统计、类别、缺口、依赖
  llm_interface.pl         DeepSeek API 调用
  evolution.pl             进化循环 + 验证 + 持久化
knowledge/
  base.pl                  种子知识(59 个 Prolog 谓词 + LLM 领域知识)
  evolved.pl               进化成果(自动生成,下次启动自动加载)
tests/
  run_tests.pl             TDD 测试套件(plunit)
  test_introspection.pl    自省测试
  test_evolution.pl        进化引擎测试

使用

./test.sh          # 运行 16 个 TDD 测试
./run.sh           # 启动进化引擎(3 轮循环)
swipl -l engine/load.pl -g "runner:demo" -t halt   # 查看 KB 状态

种子知识领域

  • Prolog 语言:list / meta / introspection / dynamic_database / term / type / io / control 共 59 个核心谓词
  • LLM:DeepSeek / OpenAI 模型、API 端点、能力描述
  • 元规则:知识缺口检测、分类统计、进化前提

领域驱动设计

职责
knowledge/base.pl 领域实体 + 值对象 + 聚合根
introspection.pl 领域服务:自省分析
llm_interface.pl 领域服务:外部 API 通信
evolution.pl 领域服务:进化流程编排 + 仓储(持久化)

技术栈

  • SWI-Prolog 9.0.4(推理引擎 + HTTP client + JSON)
  • DeepSeek API(deepseek-v4-flash)
  • 零外部依赖,纯 Prolog 实现

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages