Set Up an OKF-KB (Knowledge Base)

Quick reference for initializing and using an OKF-KB.

Start with the self-contained OKFKB tutorial for the concepts, illustrations and a worked investigation. Use this page to look up fields and commands, the design rationale for trade-offs, and the agent-maintenance guide for ongoing workflows.

Quick setup

1. Initialize

mkdir my-kb
cd my-kb
okfkb init

Creates: index.md, log.md, and tier folders (findings/, concepts/, principles/, etc.).

2. Record a Finding

okfkb new-finding . --title "What was observed"

Creates findings/YYYY.MM.DD-HH.MM-<slug>.md with template frontmatter. Agent edits, then:

okfkb update .

3. Index

okf-schema index --path .

Regenerates index.md files. Run okfkb update . to regenerate indexes and also lint frontmatter, including links, backlinks, and computed derives_to. Authored derived_from and log.md remain unchanged.

4. Validate

okfkb validate .

Strictly checks required fields, timestamps, schema values, and link validity.

Add the Agent Workflows

Deploy the project-local capture and interactive consolidation skills:

okfkb install-skills --local-agents

This installs the complete four-skill family into .agents/skills/. Use --local-copilot for .github/skills/; an explicit destination names the skills directory itself. Two of the workflows are:

  • okfkb teaches the lifecycle, chooses the right knowledge type, routes empirical discoveries to okfkb-record-findings, and navigates from stable tiers to raw evidence.

  • okfkb-gardening performs an explicitly invoked, autonomous maintenance pass. It repairs graph mechanics, reconciles Finding lifecycles, consolidates stable knowledge, refreshes operational/planning layers, and runs checks discovered from the project’s AGENTS.md.

Gardening may update every KB layer except Principles. It reports Principle candidates with rationale and evidence; a human must explicitly agree before a Principle is created or changed.

Schema Reference

Findings: findings/YYYY.MM.DD-HH.MM-<slug>.md

Historical observations recorded by humans or agents. The body/claim is preserved by maintenance policy.

type: Finding
title: What was observed?
confidence: low | medium | high | confirmed
context: System state, configuration, environment
generated:
  at: 2026-07-04T14:30:00Z
  by: human:alice
tags: [domain, tags]
links: [findings/..., concepts/...]
backlinks: []  # Auto-computed
kb_status: active | contradicted | superseded
contradicted_by: [findings/...]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []

Concepts: concepts/<name>.md

Stable understanding promoted from converged findings.

type: Concept
title: Stable understanding
description: Concise explanation of the stable idea
derived_from: [findings/<extensionless-name>, findings/<extensionless-name>]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []
links: [concepts/..., principles/...]
backlinks: []
kb_status: active | deprecated

Hypotheses: hypotheses/<name>.md

Testable propositions.

type: Hypothesis
title: Proposition to test
description: Testable explanation of observations
derived_from: [findings/<extensionless-name>]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []
links: []
kb_status: proposed | under_test | confirmed | falsified

Experiments: experiments/<name>.md

Planned investigations.

type: Experiment
title: What are we testing?
description: Reusable procedure for testing the hypothesis
hypothesis: hypotheses/...
steps: [Prepare the target, Run the measurement, Capture the signals]
expected_signals: [Signal expected if true, Signal expected if false]
kb_status: proposed | active | retired | superseded
derived_from: [hypotheses/<extensionless-name>]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []

Principles: principles/<name>.md

Team-agreed standards (rarely created, high stakes).

type: Principle
title: Standard or policy we agree on
description: Human-agreed normative rule
rationale: Why this rule exists
authority: team
derived_from: [findings/<extensionless-name>]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []

Structures: structures/<name>.md

System composition patterns.

type: Structure
title: System composition or pattern
description: How the subject is composed or works
derived_from: [findings/<extensionless-name>]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []
links: [concepts/...]
kb_status: active | deprecated

Outcomes: outcomes/<name>.md

Planned deliverables.

type: Outcome
title: Project or deliverable
description: Planned result derived from stable knowledge
kb_status: planned | in_progress | done | cancelled
deliverable: Concrete artifact or result
derived_from: [concepts/<extensionless-name>]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []

Reference: reference/<name>.md

External sources.

type: Reference
title: Paper/link title
description: What this source contributes
authoritative_source: https://example.com/specification
schema_version: v2.1
# knowledge graph fields generated automatically — do not edit manually
derives_to: []
links: [concepts/..., findings/...]

Playbooks: playbooks/<name>.md

Operational how-to notes.

type: Playbook
title: How to do X
description: Reproducible workflow that produces a result
kb_status: active | deprecated | superseded
derived_from: [concepts/<extensionless-name>]
# knowledge graph fields generated automatically — do not edit manually
derives_to: []
links: []

Linking Your Documents

Author ordinary Markdown body links to connect related documents. For example, in concepts/pll-timing.md:

See the [source inspection](../findings/actual-generated-filename.md).

After update, generated metadata may look like the following; these are not arrays to maintain manually:

links:
  - findings/2026-07-03-root-cause.md
  - concepts/subsystem-behavior.md
  - principles/timeout-policy.md

Run okfkb update . to materialise links, backlinks, and reciprocal derives_to fields and regenerate indexes. Author derived_from; never edit the computed section.

Frontmatter Validation

okfkb validate .

Verifies:

  • Required fields present

  • Confidence values valid (low, medium, high, confirmed)

  • generated.at timestamps in ISO 8601 format

  • All links: point to existing files

  • kb_status: values match the type schema

Tips for Success

  1. Findings are immutable — once created, only update lifecycle fields (kb_status, contradicted_by, superseded_by)

  2. Link relevant evidence — the surrounding sentence should explain the relationship

  3. Index after batches — run okf-schema index after each editing session

  4. Use tags for filtering — tags help agents search by domain

  5. Review log.md regularly — keep it human-readable; summarize weekly changes

  6. Principles are rare — only for team consensus decisions

  7. Promotion requires judgment — consider evidence quality, independence, scope, counter-evidence, and reuse value rather than relying on a fixed count

  8. Garden after meaningful batches — explicitly invoke okfkb-gardening for autonomous consolidation and maintenance

  9. Principles remain human decisions — gardening proposes; people agree

Further Reading