Skip to content

Commit 17bf6c0

Browse files
committed
OKGF v0.1: Open Knowledge and Governance Format
0 parents  commit 17bf6c0

34 files changed

Lines changed: 2525 additions & 0 deletions

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Thanks for contributing to OKGF. Keep PRs focused on one change. -->
2+
3+
## What and why
4+
5+
<!-- What does this change, and what problem does it solve? Link the issue if there is one. -->
6+
7+
## Checklist
8+
9+
- [ ] The change keeps OKGF a strict superset of OKF (governance stays in `x-okgf-*`; bundles remain
10+
valid OKF).
11+
- [ ] `python -m pytest tests/ -q` passes.
12+
- [ ] The example bundles still validate (`--strict`), and any new example passes the validator.
13+
- [ ] New or changed behaviour has a test.
14+
- [ ] No em/en dashes in Markdown or Python (CI rejects them).
15+
- [ ] Commits are signed off (`git commit -s`), per [CONTRIBUTING.md](../CONTRIBUTING.md) (DCO).

.github/workflows/conformance.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: conformance
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.11"
16+
- name: Install dependencies
17+
run: python -m pip install -r requirements-dev.txt
18+
- name: Validate example bundles (strict, with signature verification)
19+
run: |
20+
python tools/okgf_validate.py --strict \
21+
--pubkey examples/governed/ORG_PUBKEY.pem \
22+
examples/governed
23+
python tools/okgf_validate.py --strict examples/minimal
24+
- name: Run tests
25+
run: python -m pytest tests/ -q

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__pycache__/
2+
*.pyc
3+
.pytest_cache/

CODE_OF_CONDUCT.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Code of Conduct
2+
3+
OKGF is a project of the OneHill Foundation. We want participation to be a welcoming, harassment-free
4+
experience for everyone, regardless of background or identity.
5+
6+
## Our standards
7+
8+
Examples of behaviour that helps the community:
9+
10+
- Being respectful of differing viewpoints and experiences.
11+
- Giving and gracefully accepting constructive feedback.
12+
- Focusing on what is best for the project and its users.
13+
- Showing empathy toward other community members.
14+
15+
Examples of unacceptable behaviour:
16+
17+
- Harassment, insults, or derogatory comments, public or private.
18+
- Personal or political attacks.
19+
- Publishing others' private information without permission.
20+
- Other conduct that would reasonably be considered inappropriate in a professional setting.
21+
22+
## Scope
23+
24+
This applies in all project spaces (issues, pull requests, discussions, and any official channel) and when
25+
an individual is representing the project in public.
26+
27+
## Enforcement
28+
29+
Report unacceptable behaviour to **dev@onehill.org**. Reports are handled confidentially. Maintainers
30+
will review and respond, and may warn, remove content, or ban a participant for behaviour they judge
31+
inappropriate, threatening, or harmful.
32+
33+
## Attribution
34+
35+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
36+
version 2.1.

CONFORMANCE.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# OKGF Conformance
2+
3+
This document defines what it means for a page or bundle to conform to **OKGF v0.1**, and how to check
4+
it with the reference validator in [`tools/okgf_validate.py`](tools/okgf_validate.py). The normative rules
5+
live in [`SPEC.md`](SPEC.md); this file restates them as a checklist and describes the tooling.
6+
7+
## What conformance means
8+
9+
OKGF is a strict superset of [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog). A conformant
10+
OKGF artifact is therefore a conformant OKF artifact that additionally respects the governance rules.
11+
12+
### A conformant page
13+
14+
1. Has a `---`-delimited YAML frontmatter block that parses as a YAML mapping.
15+
2. Declares a non-empty `type` (the only OKF-required field).
16+
3. For every governance field present, the value is within range:
17+
- `x-okgf-scope` is one of `personal`, `team`, `org`
18+
- `x-okgf-review` is one of `draft`, `proposed`, `approved`
19+
- `x-okgf-tier` is one of `bronze`, `silver`, `gold`
20+
- `x-okgf-sources` is a list of strings (URIs)
21+
- `x-okgf-signature` is base64 that decodes to a 64-byte Ed25519 signature
22+
4. Preserves any unrecognized frontmatter keys (they are never an error).
23+
24+
Governance fields are **optional**. A page that omits all of them is a conformant (ungoverned) OKGF page.
25+
26+
### A conformant bundle
27+
28+
1. Contains a root `index.md` whose frontmatter declares `okf_version`.
29+
2. `log.md`, `index.md`, `principles.md`, and `schema.md` are reserved and are not validated as content
30+
pages.
31+
3. Every other `.md` file is a conformant page (above).
32+
33+
### Signature verification (optional)
34+
35+
`x-okgf-signature` is base64 Ed25519 over the UTF-8 bytes of:
36+
37+
```
38+
<type>\n<title>\n<x-okgf-scope>\n<x-okgf-review>\n<body>
39+
```
40+
41+
The verifying public key is distributed out of band. A present-but-invalid signature MUST be treated as
42+
untrusted (the validator reports it as an error when a key is supplied). An unsigned page is valid. When no
43+
key is supplied, the validator format-checks the signature and reports it as **unverified**, not trusted.
44+
45+
## Checking conformance
46+
47+
The reference validator needs Python 3.9+ and PyYAML. Signature verification additionally needs the
48+
`cryptography` package and a public key.
49+
50+
```sh
51+
# Validate pages and/or bundle directories (structure + governance ranges):
52+
python tools/okgf_validate.py examples/minimal examples/governed
53+
54+
# Also cryptographically verify signatures against an org public key:
55+
python tools/okgf_validate.py --pubkey examples/governed/ORG_PUBKEY.pem examples/governed
56+
57+
# Treat warnings (e.g. missing recommended OKF fields, unverified signatures) as failures:
58+
python tools/okgf_validate.py --strict examples/governed
59+
```
60+
61+
Exit status is `0` when there are no errors (and, under `--strict`, no warnings), otherwise `1`. A usage or
62+
environment problem (bad key, missing dependency) exits `2`.
63+
64+
### Errors vs warnings
65+
66+
- **Errors** are conformance violations: missing frontmatter, empty `type`, an out-of-range governance
67+
value, a malformed or cryptographically invalid signature, or a bundle whose `index.md` is missing or
68+
does not declare `okf_version`.
69+
- **Warnings** are advisory: a missing recommended OKF field (`title`, `description`, `timestamp`), an
70+
`okf_version` the validator does not recognize, or a signature that could not be verified because no key
71+
was supplied.
72+
73+
## Examples
74+
75+
The [`examples/`](examples/) directory ships two bundles that are held conformant by CI:
76+
77+
- `examples/minimal/` - the smallest valid bundle, OKF baseline with no governance.
78+
- `examples/governed/` - full governance: scoped/reviewed/tiered pages, provenance, and a real signed `org`
79+
promotion with its public key (`ORG_PUBKEY.pem`).

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Contributing to OKGF
2+
3+
Thanks for helping improve the Open Knowledge and Governance Format. OKGF is an open specification
4+
stewarded by the OneHill Foundation. This repo holds the spec, the conformance definition, examples, and
5+
the reference validator.
6+
7+
## What contributions look like
8+
9+
- **Spec clarifications or fixes** - wording, ambiguities, or errors in `SPEC.md` / `CONFORMANCE.md`.
10+
- **New or improved examples** - sample bundles under `examples/` that show a real pattern.
11+
- **Validator improvements** - bug fixes or checks in `tools/okgf_validate.py`, with tests.
12+
- **Proposed field or lifecycle changes** - larger changes to the governance model. Open an issue first
13+
(see below) so we can discuss before you write it.
14+
15+
Because OKGF is a superset of [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog), a change
16+
must not break OKF conformance.
17+
18+
## Proposing a change
19+
20+
1. **Open an issue** describing the problem or idea. For anything beyond a wording fix, agree on the
21+
direction in the issue before writing a PR.
22+
2. **Branch and make the change.** Keep PRs focused on one thing.
23+
3. **Run the checks locally:**
24+
```sh
25+
pip install -r requirements-dev.txt
26+
python -m pytest tests/ -q
27+
python tools/okgf_validate.py --strict examples/minimal
28+
python tools/okgf_validate.py --strict --pubkey examples/governed/ORG_PUBKEY.pem examples/governed
29+
```
30+
New or changed behaviour needs a test. New example bundles must pass the validator (CI enforces this).
31+
4. **Open a pull request** against `main`. CI runs the validator and the test suite on every PR.
32+
33+
## Style
34+
35+
- Plain ASCII in Markdown and Python: no em dashes or en dashes (use `-`). CI rejects them.
36+
- Match the surrounding tone: concise and direct.
37+
38+
## Sign your work (DCO)
39+
40+
Contributions are accepted under a **Developer Certificate of Origin (DCO)**: your contribution is
41+
licensed to the project under its outbound license (**Apache-2.0**; see `LICENSE`). There is no separate
42+
copyright assignment.
43+
44+
You certify the [DCO 1.1](https://developercertificate.org/) by adding a `Signed-off-by` line to each
45+
commit, matching your real name and email:
46+
47+
```
48+
Signed-off-by: Your Name <you@example.com>
49+
```
50+
51+
`git commit -s` adds it automatically. By signing off you state that you wrote the contribution or
52+
otherwise have the right to submit it under Apache-2.0.
53+
54+
## License of contributions
55+
56+
By contributing you agree that your contribution is licensed under **Apache-2.0**, the same license as the
57+
rest of this repository. Software that *implements* OKGF is licensed separately by its own project; that is independent of this spec's license.

GOVERNANCE.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# OKGF Governance
2+
3+
OKGF is an open specification stewarded by the **OneHill Foundation**. This document describes how the
4+
spec is maintained and versioned. It governs *this repository*; it is separate from the governance model
5+
that OKGF the format describes (scope / review / trust for knowledge bundles).
6+
7+
## Steward
8+
9+
The OneHill Foundation maintains the specification, publishes releases, and holds the trademark and
10+
copyright for the OKGF name and text. The Foundation's role is to keep OKGF open, stable, and faithful to
11+
its goal: portable knowledge with portable trust, built as a clean superset of OKF.
12+
13+
## Principles
14+
15+
- **Superset, not fork.** Every version of OKGF remains a strict superset of a published OKF version. A
16+
change that would break OKF conformance is out of scope.
17+
- **Additive and reserved.** Governance lives in the reserved namespace. Existing fields are
18+
not repurposed; new capability is added, not mutated, so older bundles stay valid.
19+
- **Optional by default.** Governance fields are optional. An ungoverned bundle is always conformant.
20+
- **Implementable and testable.** A normative change ships with the conformance definition and validator
21+
updates that let anyone check it.
22+
23+
## Versioning
24+
25+
OKGF uses a `MAJOR.MINOR` spec version (currently `0.1`), recorded in tagged releases and stamped by a
26+
bundle's `okf_version` in its root `index.md`.
27+
28+
- **Minor** version: backwards-compatible additions (new optional field, new allowed value, clarified
29+
wording). Existing conformant bundles stay conformant.
30+
- **Major** version: a change that could make a previously conformant bundle non-conformant. Avoided
31+
wherever possible; requires a migration note.
32+
33+
While OKGF is pre-1.0, minor versions may still refine field semantics; changes are announced on tagged
34+
releases.
35+
36+
## Decision process
37+
38+
- **Small changes** (wording, examples, validator fixes) are reviewed and merged by a maintainer via pull
39+
request.
40+
- **Normative changes** (fields, values, lifecycle, signature format) start as an issue for discussion,
41+
then a PR. The Foundation is the final arbiter and is responsible for keeping the spec coherent and the
42+
superset relationship intact.
43+
44+
## Relationship to implementations
45+
46+
Implementations are licensed and governed
47+
independently. This repo defines the format they target; it does not govern their code.

0 commit comments

Comments
 (0)