@ 方程式应用程序/ core-okf
概览
用于解析和制作的零依赖性库 开放知识格式 (OKF) v0. 1和 v 捆绑 此软件包提供了原始原始数据,用于与OKF前题,概念文档,以及索引/日志文件合作,与任何特定数据库或数据模型完全脱钩.
为了一个现成的 MemoryDump OKF 捆绑适配器,参见 OKF 向导 @equationalapplications/core-llm-wiki。 。 。 .
Llm-wiki互操作性简介(llm-wiki/1 财务报告和审定财务报表 llm-wiki/2,参见 docs/okf-profile.md遵守的固定装置 fixtures/。 。 。 .
GraphRAG 兼容性 : core-okf为数据库不可知. 能充电的适配器
llm_wiki_edges页:1traverseGraph()住在这里@equationalapplications/core-llm-wiki。见 GraphRAG 指南。 。 。 .
安装
npm install @equationalapplications/core-okf
API 参考
serializeFrontmatter 编号 : parseFrontmatter
制作和剖析 OKF 概念文档的 YAML 前题 .
const yaml = serializeFrontmatter({ type: 'fact', id: 'fact_123' });
const { frontmatter, rest } = parseFrontmatter(fileContent);
buildConceptDocument 编号 : parseConcept
将前题和下标正文合并为一个单字符串,或将已有的OKF文件分割成其组件.
const markdown = buildConceptDocument({ type: 'task', id: 'task_1' }, '# Buy groceries');
const { frontmatter, body } = parseConcept(markdown);
buildIndexMd 编号 : buildRootIndexMd
生成目录索引列表或根 OKF 目录表 .
const sections = [{ heading: 'Facts', entries: [{ path: 'facts/fact_123.md', title: 'Fact 123' }] }];
const dirIndex = buildIndexMd(sections);
const rootIndex = buildRootIndexMd('0.1', sections);
buildLogMd 编号 : parseLogMd
序列化仅按时间顺序附加的事件,或将它们重新描述为离散条目.
const log = buildLogMd([{ date: '2026-06-23', text: 'Observation made' }]);
const events = parseLogMd(logContent);
deriveEventId
计算 OKF 消费者给出的确定性 ID log.md 无行
<!-- id: … --> 注释(简介§7). 同一实体的同一行总是
相同的 id,所以在存储早先的复制时再次导入日志跳过它.
const id = deriveEventId({
entityId: 'demo',
date: '2026-07-05', // the heading text
eventType: 'observation',
summary: 'Linked to alpha',
occurrence: 0, // earlier id-less lines with the same date, type and summary
});
// 'evt_okf1_02dd42bf329719f258ab93b373f44506'
createEventIdDeriver({ entityId, date, eventType, summary }) 返回时
(occurrence) => id 以同样的结果,只将摘要散开一次。 用这个
当您需要很多一行事件时.
extractMarkdownLinks
剖析相对的平分平分交叉链接来映射知识图边.
const links = extractMarkdownLinks('See [preferences](facts/fact_abc.md) for more.');
// links: [{ text: 'preferences', path: 'facts/fact_abc.md' }]
莫诺雷波生态系统
| 软件包 | 目的 |
|---|---|
| @ 方程式应用程序/ core-llm-wiki | 持续的零星记忆 |
| @ 方程式应用程序/ expo- llm- wiki | 世博会/反应原生器的持久性瞬间记忆 |
| @ 方程式应用/ react-llm-wiki | Web 的持续的零星记忆 |
| @equental applications/prisma-outbox (英语) | 同步 SQLite 发件箱事件到 Prisma |
| @ 方程式应用程序/ 核心工具 | 双子座工具计划和能力注射器 |
| @ 方程式应用程序/ core-okf | 零依赖开放知识格式 (OKF) v0.1 + v0.2 原始人——剖析并生成可互通的知识捆. |
| @equationalapplications/schema-org-llm-wiki (英语) | Cured schema.org 温剂肿瘤特征表 |
| @equental应用程序/schema-software-org | 软件组织执行本体学表——17个节点类型,40个边缘,热剂超集,只数据 |
| @ 公式应用程序/ mcp- server | MCP 服务器向编码代理显示 SynapseTree 内存工具 |
OKF v0. 2 符合性
此软件包符合 OKF v0. 2 请检查url=值 (帮助)。为 v. 2: 新建助手
deriveTrustTier(verified)- 从'unverified' | 'machine-confirmed' | 'human-reviewed'。 。 。 .isStaleAfter(staleAfter, now)与绝对值相对应的 stalety 检查YYYY-MM-DD断取.parseVerifiedFlexible(value)- 接受一个阵列或一个空的{ by, at }测绘.extractFootnotes(body)编号 :serializeFootnotes(footnotes)- 逐字保留脚注归属.parseFlowMapping(text)编号 :parseFlowSequence(text)– 流量与地图价值筑巢的多为一等(没有被引用字符串以外的锚地/别名)进行剖析.
这个 serializeFrontmatter 函数释放出纯对象作为流映射和演员字符串(包含 / 或者说 :)通过 serializeActorString. 限制/假名扩展被拒绝 未引用 & 或者说 * 字符被视为不透明( 扫描中不包括引用的跨度, 所以 URL 查询字符串 类似 "https://x/a?p=1&q=2" 页:1.