Skip to content
nnsayPublic

About

融合 Open Knowledge Format (OKF) 格式规范与 Karpathy LLM Wiki 理论的知识编译工具

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

okf-wiki

私有化知识库系统:融合 Open Knowledge Format (OKF) 格式规范与 Karpathy LLM Wiki 理论,以 LangChain (langgraph + deepagents) 为 Agent 工具链,面向文档与研究资料领域、组织级协作规模,全私有化部署、使用国产云 API、不依赖任何 Google 服务。

三者职责分明:

  • OKF--知识产物的格式规范(markdown + frontmatter bundle)
  • LLM Wiki--知识积累的工作流理论(ingest / query / lint 三操作,知识复利)
  • LangChain(langgraph + deepagents)--Agent 工具链

技术设计见 design/。

文档索引

快速开始

依赖 Python 3.12 + uv。复制 .env.example 为 .env 填 LLM 配置。

本地开发(推荐)

uv sync                        # 装依赖
uv run pytest                  # 跑测试(不依赖外部服务)
uv run okf-wiki --help         # CLI

# 端到端(开发时用 WIKI_BUNDLE_ROOT 指可写目录)
export WIKI_BUNDLE_ROOT=./wiki-bundle DATABASE_URL=sqlite:///./okf.db
uv run okf-wiki init-bundle demo
uv run okf-wiki ingest demo tests/fixtures/paper1_attention.md
uv run okf-wiki query  demo "Transformer 的核心机制?"
uv run okf-wiki lint   demo

# 导出 ingest 工作流结构图(无需 LLM 配置)
uv run okf-wiki graph ingest

全局安装

如果想把 okf-wiki 装成系统命令(不用每次 uv run):

uv tool install .
okf-wiki --help

升级或卸载:

uv tool upgrade okf-wiki   # 升级
uv tool uninstall okf-wiki # 卸载

代码结构

  • src/okf_wiki/ - 核心 lib
    • okf/ - OKF 格式工具:frontmatter(§4.1)、links(§5)、conformance(§9)
    • store/ - bundle.py 纯本地文件函数 + register_wiki(ADR-014)
    • models.py / db.py - sqlmodel 表(Bundle/Wiki/WikiSource,ADR-010 删业务 Folder 表,ADR-015 删版本链)+ SQLite
    • agents/ - 三工作流:ingest(deepagents)/ query / lint(langgraph)+ prompts(CONVENTIONS)
    • llm.py - ChatOpenAI 工厂(国产云兼容端点)+ MockLLM(测试)
    • cli.py - typer CLI(init-bundle/ingest/query/lint/graph)
  • tests/ - test_okf / test_store / test_e2e(MockLLM 跑通三工作流)+ fixtures

技术栈:Python 3.12 · uv · langchain[openai] · langgraph · deepagents · sqlmodel(SQLite)

License

MIT

About

融合 Open Knowledge Format (OKF) 格式规范与 Karpathy LLM Wiki 理论的知识编译工具

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages