Skip to content

feat(documents): add okf.<key> filter alias for OKF frontmatter extensions - #303

Open
shirshanka wants to merge 1 commit into
okf-agent-toolsfrom
okf-extension-filter-alias
Open

shirshanka wants to merge 1 commit into
okf-agent-toolsfrom
okf-extension-filter-alias

Conversation

@shirshanka

@shirshanka shirshanka commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #301. Review that one first; this PR only adds the commit on top.

What

Agents can filter OKF documents by any custom frontmatter key with okf.<key>:

okf.domain = finance
okf.x-domain = finance AND okf_type = guide
okf.audience IN (analysts, "analysts, engineers")
okf.x-team.lead = alice
okf.domain IS NOT NULL

The server side is datahub-project/datahub#21886, which indexes those keys as key=value entries in the okfExtensions field.

How it maps

  • okf.<key> = v (and IN) becomes okfExtensions IEQUAL ["<key>=v", "x-<key>=v"]. It's case-insensitive, like the other okf_* aliases.
  • Both spellings: OKF 0.3 prefixes custom keys with x- (x-domain), while earlier bundles use bare keys (domain). The index keeps keys as written, so okf.domain and okf.x-domain both send both spellings. This costs one extra value in the same criterion, and agents don't need to know which version a bundle uses.
  • != / NOT negates that condition.
  • IS NOT NULL becomes okfExtensions START_WITH ["<key>=", "x-<key>="], which finds documents that declare the key. IS NULL is its negation.
  • >, < and similar operators are rejected with a clear error, since values are stored as text. So are okf. and okf.x- without a key.
  • A list value matches only as its whole joined value (analysts, engineers), and a nested key uses dots (x-team.lead), as indexed by feat(okf): make OKF frontmatter extensions searchable and filterable datahub-project/datahub#21886.

The search_documents tool description and FILTER_DOCS describe okf.<key> and add an example. On a server without datahub-project/datahub#21886, the field doesn't exist and the filter matches nothing.

Tests

Local: make lint and uv run pytest (780 pass) are clean. The same alias for the DataHub CLI and agent context is datahub-project/datahub#21888. CHANGELOG updated.


🤖 Opened with cclaude on behalf of @shirshanka

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cclaude Opened from a cclaude box

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant