Skip to content

feat(core): OKF knowledge bundle reader — load and bind authored concepts #1864

Closed

Description

@lex00

Part of the OKF epic #1057. Implements the reader decided in #1059.

A project may carry an authored OKF bundle in knowledge/ beside chant.config.ts, overridable via a new knowledge?: { dir?: string } key on ChantConfigSchema (packages/core/src/config.ts). New module packages/core/src/okf-read.ts with two functions. loadOkfBundle(dir) parses every non-reserved .md using the existing splitFrontmatter from okf.ts, tolerant to the letter of the spec. bindConcepts(bundle, entities) resolves each concept's binds frontmatter key (one logical name or a list) against the names keying DiscoveryResult.entities and returns a map of entity name to bound concepts plus the list of unresolved bindings. The reader interprets exactly one key, binds. Structural-looking keys on authored concepts (name, lexicon, kind) are ignored, so authored and inferred knowledge cannot conflict at the fact level.

Acceptance criteria

  • loadOkfBundle skips index.md and log.md, passes through unknown type values and extra frontmatter keys, skips a file with unparseable frontmatter with a warning, and never rejects a bundle
  • binds accepts a single name or a list; a concept without binds loads as unbound and is legitimate
  • bindConcepts returns bound concepts per entity name plus unresolved bindings
  • convention directory used when config is silent; config override honored; a missing directory is not an error
  • reading back a bundle emitted by buildOkfBundle yields zero bindings (the emitter never writes binds)
  • unit tests covering the above

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions