okf 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.okf/capabilities/agent-skill.md +46 -0
  3. data/.okf/capabilities/graph-server.md +60 -0
  4. data/.okf/capabilities/index.md +20 -0
  5. data/.okf/capabilities/library-api.md +67 -0
  6. data/.okf/capabilities/linter.md +49 -0
  7. data/.okf/capabilities/read-views.md +84 -0
  8. data/.okf/capabilities/validator.md +40 -0
  9. data/.okf/cli.md +52 -0
  10. data/.okf/design/core-shell-split.md +58 -0
  11. data/.okf/design/index.md +10 -0
  12. data/.okf/design/ruby-floor.md +45 -0
  13. data/.okf/design/runtime-dependencies.md +44 -0
  14. data/.okf/design/server-trust-boundary.md +35 -0
  15. data/.okf/format/citations.md +33 -0
  16. data/.okf/format/cross-links.md +52 -0
  17. data/.okf/format/frontmatter.md +38 -0
  18. data/.okf/format/index.md +9 -0
  19. data/.okf/format/okf-format.md +43 -0
  20. data/.okf/index.md +18 -0
  21. data/.okf/log.md +9 -0
  22. data/.okf/model/bundle.md +38 -0
  23. data/.okf/model/concept.md +44 -0
  24. data/.okf/model/graph.md +44 -0
  25. data/.okf/model/index.md +8 -0
  26. data/.okf/overview.md +66 -0
  27. data/CHANGELOG.md +54 -0
  28. data/CODE_OF_CONDUCT.md +10 -0
  29. data/LICENSE.txt +201 -0
  30. data/NOTICE +10 -0
  31. data/README.md +276 -0
  32. data/exe/okf +6 -0
  33. data/lib/okf/bundle/folder.rb +94 -0
  34. data/lib/okf/bundle/graph.rb +118 -0
  35. data/lib/okf/bundle/linter/report.rb +56 -0
  36. data/lib/okf/bundle/linter.rb +416 -0
  37. data/lib/okf/bundle/reader.rb +60 -0
  38. data/lib/okf/bundle/validator/result.rb +35 -0
  39. data/lib/okf/bundle/validator.rb +131 -0
  40. data/lib/okf/bundle/writer.rb +137 -0
  41. data/lib/okf/bundle.rb +216 -0
  42. data/lib/okf/cli.rb +910 -0
  43. data/lib/okf/concept/file.rb +63 -0
  44. data/lib/okf/concept.rb +101 -0
  45. data/lib/okf/markdown/citations.rb +49 -0
  46. data/lib/okf/markdown/frontmatter.rb +55 -0
  47. data/lib/okf/markdown/links.rb +98 -0
  48. data/lib/okf/path.rb +34 -0
  49. data/lib/okf/server/app.rb +120 -0
  50. data/lib/okf/server/graph.rb +112 -0
  51. data/lib/okf/server/runner.rb +78 -0
  52. data/lib/okf/server/templates/graph.html.erb +803 -0
  53. data/lib/okf/skill/SKILL.md +133 -0
  54. data/lib/okf/skill/reference/APACHE-2.0.txt +202 -0
  55. data/lib/okf/skill/reference/SPEC.md +460 -0
  56. data/lib/okf/skill/reference/authoring.md +218 -0
  57. data/lib/okf/skill/reference/cli.md +196 -0
  58. data/lib/okf/skill/templates/concept.md +24 -0
  59. data/lib/okf/skill/templates/index.md +8 -0
  60. data/lib/okf/skill/templates/log.md +6 -0
  61. data/lib/okf/skill/templates/root-index.md +12 -0
  62. data/lib/okf/skill.rb +82 -0
  63. data/lib/okf/version.rb +5 -0
  64. data/lib/okf.rb +55 -0
  65. metadata +142 -0
@@ -0,0 +1,52 @@
1
+ ---
2
+ type: Format
3
+ title: Cross-links (spec §5)
4
+ description: Plain Markdown links between concepts that become the knowledge graph's directed edges.
5
+ resource: lib/okf/markdown/links.rb
6
+ tags: [format, links, graph, diagram]
7
+ timestamp: 2026-07-11T12:00:00Z
8
+ ---
9
+
10
+ # Overview
11
+
12
+ A cross-link is an ordinary Markdown link from one concept's body to another
13
+ concept file. `OKF::Markdown::Links` extracts them, and that is the whole edge
14
+ mechanism: the [graph](../model/graph.md) is *emergent* — you never declare it,
15
+ it arises from the links you write. Good linking is good knowledge modelling.
16
+
17
+ ```mermaid
18
+ flowchart LR
19
+ orders["orders.md"] -->|prose link| customers["customers.md"]
20
+ orders -->|prose link| refunds["refunds.md"]
21
+ refunds -->|prose link| customers
22
+ ```
23
+
24
+ Files are the nodes; the Markdown links in their bodies are the directed edges.
25
+ Nobody declared this graph — it fell out of three files linking each other.
26
+
27
+ # Untyped on purpose
28
+
29
+ A Markdown link asserts only "these two relate." The *kind* of relationship —
30
+ depends-on, supersedes, derived-from — lives in the **prose around the link**,
31
+ never in a made-up typed-edge syntax. Both a human and an agent already
32
+ understand a Markdown link, which is the point of the [dual audience](../overview.md).
33
+
34
+ # What counts as an edge
35
+
36
+ - **Bundle-relative links** (e.g. `/model/graph.md`) resolve to another concept
37
+ and become a directed edge. Absolute bundle-relative targets are preferred so
38
+ links survive file moves.
39
+ - **External links** — `http(s)://`, `mailto:` — are surfaced separately and are
40
+ *not* graph edges.
41
+ - A link to a concept that does not exist yet is **not an error** (§5.3): it is
42
+ not-yet-written knowledge, which consumers MUST tolerate and the
43
+ [linter](../capabilities/linter.md) surfaces as backlog demand.
44
+
45
+ The [graph server](../capabilities/graph-server.md) draws these edges; a
46
+ degree-0 concept (no links in or out) is a *loose* file the
47
+ [read views](../capabilities/read-views.md) flag.
48
+
49
+ # Citations
50
+
51
+ [1] [lib/okf/markdown/links.rb](https://github.com/serradura/okf-gem/blob/main/lib/okf/markdown/links.rb) — link extraction.
52
+ [2] [SPEC.md §5](https://github.com/serradura/okf-gem/blob/main/lib/okf/skill/reference/SPEC.md) — cross-links and tolerance of broken targets.
@@ -0,0 +1,38 @@
1
+ ---
2
+ type: Format
3
+ title: Frontmatter (spec §4)
4
+ description: The YAML header on every concept, parsed through the gem's single, hardened YAML gateway.
5
+ resource: lib/okf/markdown/frontmatter.rb
6
+ tags: [format, yaml, frontmatter]
7
+ timestamp: 2026-07-11T12:00:00Z
8
+ ---
9
+
10
+ # Overview
11
+
12
+ Every [concept](../model/concept.md) opens with a YAML frontmatter block delimited
13
+ by `---` lines. `OKF::Markdown::Frontmatter` parses it and is the inverse of
14
+ `Concept#to_markdown`. The only **required** key is
15
+ [`type`](../format/okf-format.md); `title`, `description`, `resource`, `tags`, and
16
+ `timestamp` are recommended, and producers may add any other keys — consumers
17
+ preserve unknown keys and never reject a document for having them.
18
+
19
+ # The one YAML gateway
20
+
21
+ All YAML in the gem flows through this one class. That is a deliberate security
22
+ and portability boundary, not an accident of layering:
23
+
24
+ - it uses `safe_load` — permitting `Date`/`Time`, forbidding aliases — so a
25
+ bundle can never execute arbitrary Ruby on load;
26
+ - it carries the Psych `<3.1` positional-argument shim, so the gem parses
27
+ identically on the old Ruby versions the [2.4 floor](../design/ruby-floor.md)
28
+ targets;
29
+ - `stringify_keys` lives here so the gem needs no ActiveSupport (see
30
+ [runtime dependencies](../design/runtime-dependencies.md)).
31
+
32
+ The rule is enforced by convention: `YAML.safe_load` / `YAML.load` appear
33
+ **nowhere else** in the codebase.
34
+
35
+ # Citations
36
+
37
+ [1] [lib/okf/markdown/frontmatter.rb](https://github.com/serradura/okf-gem/blob/main/lib/okf/markdown/frontmatter.rb) — the parser and the Psych shim.
38
+ [2] [SPEC.md §4](https://github.com/serradura/okf-gem/blob/main/lib/okf/skill/reference/SPEC.md) — concept documents and frontmatter.
@@ -0,0 +1,9 @@
1
+ # The format
2
+
3
+ What Open Knowledge Format v0.1 is — the substrate the gem reads, validates, and
4
+ serves. The gem operates on this format; it does not extend it.
5
+
6
+ * [OKF v0.1](okf-format.md) - portable knowledge as a directory of Markdown + YAML frontmatter files.
7
+ * [Frontmatter](frontmatter.md) - the YAML header on every concept (spec §4) and the gem's one YAML gateway.
8
+ * [Cross-links](cross-links.md) - plain Markdown links that become the knowledge graph's edges (spec §5).
9
+ * [Citations](citations.md) - the provenance convention that keeps a bundle trustworthy (spec §8).
@@ -0,0 +1,43 @@
1
+ ---
2
+ type: Format
3
+ title: Open Knowledge Format v0.1
4
+ description: Portable knowledge as a directory of Markdown files with YAML frontmatter that humans and agents both read.
5
+ resource: lib/okf/skill/reference/SPEC.md
6
+ tags: [okf, format, conformance]
7
+ timestamp: 2026-07-11T12:00:00Z
8
+ ---
9
+
10
+ # Overview
11
+
12
+ OKF is a bundle: a directory of UTF-8 Markdown files. Each non-reserved file is
13
+ one **concept** with two parts — a [YAML frontmatter block](frontmatter.md) and a
14
+ Markdown body. Knowledge is the files; the graph is
15
+ [how they link](cross-links.md). There is no schema registry, no runtime, no
16
+ SDK — the format is minimal on purpose, and the gem is what gives it leverage.
17
+
18
+ # Reserved files
19
+
20
+ Two filenames are reserved and are never concepts:
21
+
22
+ | File | Role | Constraint |
23
+ |------|------|------------|
24
+ | `index.md` | a directory listing for progressive disclosure | carries **no** frontmatter — except the bundle-root `index.md`, which may carry *only* `okf_version` |
25
+ | `log.md` | a dated change history, newest first | date headings are ISO `YYYY-MM-DD` |
26
+
27
+ # §9 conformance is narrow and tolerant
28
+
29
+ The spec makes only three conditions **hard**, and the
30
+ [validator](../capabilities/validator.md) fails a bundle on any of them:
31
+
32
+ 1. **§9.1** — every non-reserved `.md` file has a parseable frontmatter block;
33
+ 2. **§9.2** — every such block has a **non-empty `type`**;
34
+ 3. **§9.3** — every reserved file present is well-formed.
35
+
36
+ Everything else is soft guidance a consumer MUST tolerate: missing optional
37
+ fields, unknown [`type`](../model/concept.md) values, and **broken cross-links**.
38
+ Judging those is the [linter](../capabilities/linter.md)'s job, held separate on
39
+ purpose.
40
+
41
+ # Citations
42
+
43
+ [1] [SPEC.md](https://github.com/serradura/okf-gem/blob/main/lib/okf/skill/reference/SPEC.md) — the OKF v0.1 specification, authored by Google Cloud Platform, redistributed under Apache 2.0.
data/.okf/index.md ADDED
@@ -0,0 +1,18 @@
1
+ ---
2
+ okf_version: "0.1"
3
+ ---
4
+
5
+ # okf-gem capabilities
6
+
7
+ What the `okf` gem does over an Open Knowledge Format v0.1 bundle: read it,
8
+ validate it, lint it, serve it, and let an agent author it. Start here.
9
+
10
+ * [Overview](overview.md) - the gem at a glance: the five capabilities and the design ethos behind them.
11
+ * [Command line](cli.md) - the `okf` executable — the one layer that parses argv, prints, and exits.
12
+
13
+ # Areas
14
+
15
+ * [The format](format/) - what OKF v0.1 is — the Markdown + YAML frontmatter the gem operates on.
16
+ * [The model](model/) - the pure in-memory data structures: concept, bundle, graph.
17
+ * [Capabilities](capabilities/) - the five things the gem does: validate, lint, serve, the library, the skill.
18
+ * [Design constraints](design/) - the enforced boundaries that keep the gem light and honest.
data/.okf/log.md ADDED
@@ -0,0 +1,9 @@
1
+ # Update Log
2
+
3
+ ## 2026-07-12
4
+ * **Sync**: caught the bundle up with the CLI at 1.0.0 — documented the new `index` command (the §6 progressive-disclosure map, the read view that sees the reserved `index.md` layer), compact-by-default JSON with `--pretty`, and `--fields`/`--except` projection on the list views, in [read views](capabilities/read-views.md) plus the `index`-verb enumerations in the [CLI](cli.md), the [overview](overview.md), and the [capabilities](capabilities/) index listing.
5
+
6
+ ## 2026-07-11
7
+ * **Creation**: seeded the bundle documenting okf-gem's capabilities at version 0.1.0 — the [overview](overview.md), the [CLI](cli.md), and the [format](format/), [model](model/), [capabilities](capabilities/), and [design](design/) areas.
8
+ * **Update**: added Mermaid diagrams (tagged `diagram`) to five concepts — [overview](overview.md), the [core/shell split](design/core-shell-split.md), the [graph server](capabilities/graph-server.md), the [library API](capabilities/library-api.md), and [cross-links](format/cross-links.md).
9
+ * **Sync**: caught the bundle up with the CLI — documented the new `types` command, the cross-view `--type`/`--area`/`--tag` filters, and `tags --by type|area` in [read views](capabilities/read-views.md), the [CLI](cli.md) front end, the [graph](model/graph.md) indexes, and the [capabilities](capabilities/) index listing.
@@ -0,0 +1,38 @@
1
+ ---
2
+ type: Component
3
+ title: OKF::Bundle
4
+ description: The pure in-memory collection of concepts that validate, lint, and graph run over.
5
+ resource: lib/okf/bundle.rb
6
+ tags: [model, bundle, pure]
7
+ timestamp: 2026-07-11T12:00:00Z
8
+ ---
9
+
10
+ # Overview
11
+
12
+ `OKF::Bundle` is a set of [concepts](concept.md) held together in memory, with no
13
+ disk involved. It is the object the three judging capabilities operate on:
14
+ `#validate`, `#lint`, and `#graph` each hand the bundle to a dedicated pure
15
+ class and return a result. A bundle also carries the reserved files
16
+ (`index.md`, `log.md`) and — importantly — an `unparseable` list.
17
+
18
+ # Best-effort by construction
19
+
20
+ When a bundle is built from disk, files that fail to parse do not vanish and do
21
+ not abort the build: they are collected in `bundle.unparseable`. That is what
22
+ lets [graph](graph.md), the [server](../capabilities/graph-server.md), and the
23
+ [read views](../capabilities/read-views.md) render everything that *is* valid
24
+ while the [CLI](../cli.md) notes the skips on stderr — §9's best-effort posture,
25
+ made structural.
26
+
27
+ # Build it from data, not only from files
28
+
29
+ Because the bundle is pure, an embedding application can construct concepts
30
+ straight from its own records — no Markdown round-trip — and still get validate,
31
+ lint, and graph for free. This is the surface the
32
+ [library API](../capabilities/library-api.md) exposes to, say, a Rails store that
33
+ already holds knowledge as rows. It also feeds the shared `#catalog`, the data
34
+ behind every read view.
35
+
36
+ # Citations
37
+
38
+ [1] [lib/okf/bundle.rb](https://github.com/serradura/okf-gem/blob/main/lib/okf/bundle.rb) — the in-memory collection and its `#validate` / `#lint` / `#graph` entry points.
@@ -0,0 +1,44 @@
1
+ ---
2
+ type: Component
3
+ title: OKF::Concept
4
+ description: The pure in-memory model of a single OKF file — frontmatter, body, and a stable id.
5
+ resource: lib/okf/concept.rb
6
+ tags: [model, concept, pure]
7
+ timestamp: 2026-07-11T12:00:00Z
8
+ ---
9
+
10
+ # Overview
11
+
12
+ `OKF::Concept` is the atomic node: a `path`, a parsed
13
+ [`frontmatter`](../format/frontmatter.md) hash, and a Markdown `body`. It is
14
+ [pure](../design/core-shell-split.md) — it holds no file handle and does no I/O.
15
+ The on-disk counterpart is `OKF::Concept::File`, part of the
16
+ [library API](../capabilities/library-api.md).
17
+
18
+ # The id is the concept's identity
19
+
20
+ `#id` is the `path` minus `.md` (e.g. `model/graph.md` → `model/graph`). That id
21
+ is the concept's **stable identifier** across the whole system — it is the graph
22
+ node key, the link target, and the thing you name a concept for. Name a file for
23
+ what it *is*, not where it sits, because the id follows the path.
24
+
25
+ # What it derives from its own content
26
+
27
+ The concept parses its body on demand into the structural facts the rest of the
28
+ gem consumes:
29
+
30
+ - `#type`, `#title`, `#description`, `#resource`, `#tags`, `#timestamp` — typed
31
+ reads over the frontmatter;
32
+ - `#links` — the bundle-relative [cross-links](../format/cross-links.md) (edges);
33
+ - `#external_links` — URLs and `mailto:` (not edges);
34
+ - `#citations` — the [`# Citations`](../format/citations.md) entries;
35
+ - `#to_markdown` — the inverse of the frontmatter parser;
36
+ - `#lint` — the concept-scoped [lint](../capabilities/linter.md) checks in isolation.
37
+
38
+ A concept never decides conformance alone; a [bundle](bundle.md) does, because
39
+ some checks (duplicate titles, missing link targets) are only meaningful across
40
+ the set.
41
+
42
+ # Citations
43
+
44
+ [1] [lib/okf/concept.rb](https://github.com/serradura/okf-gem/blob/main/lib/okf/concept.rb) — the pure concept model.
@@ -0,0 +1,44 @@
1
+ ---
2
+ type: Component
3
+ title: OKF::Bundle::Graph
4
+ description: The in-memory knowledge graph — concepts as nodes, cross-links as directed edges, with type and tag indexes.
5
+ resource: lib/okf/bundle/graph.rb
6
+ tags: [model, graph, pure]
7
+ timestamp: 2026-07-11T21:40:00Z
8
+ ---
9
+
10
+ # Overview
11
+
12
+ `OKF::Bundle::Graph` turns a [bundle](bundle.md) into nodes and edges:
13
+ [concepts](concept.md) become nodes keyed by id, and bundle-relative
14
+ [cross-links](../format/cross-links.md) become directed edges. It is pure — it
15
+ carries no presentation concerns; sizing and colour belong to a renderer like
16
+ the [graph server](../capabilities/graph-server.md).
17
+
18
+ # Fidelity is a build option
19
+
20
+ The same graph ships at three weights, so a client downloads only what it needs
21
+ and fetches the rest on demand:
22
+
23
+ | Build | Node payload |
24
+ |-------|--------------|
25
+ | default (`body: true`) | id, type, title, description, tags, **body** |
26
+ | `body: false` | everything but the body |
27
+ | `minimal: true` | just id and title — the leanest payload to draw |
28
+
29
+ # Indexes come free at every weight
30
+
31
+ Regardless of node fidelity, the graph exposes two inverted indexes computed from
32
+ every concept:
33
+
34
+ - `type_index` — `{ type => [id, …] }`, so even a minimal client can colour nodes
35
+ by [`type`](concept.md);
36
+ - `tag_index` — `{ tag => [id, …] }`, so it can filter by tag.
37
+
38
+ Those indexes, plus `unlinked_ids` (degree-0 nodes), are what the
39
+ [read views](../capabilities/read-views.md) — `types`, `tags`, `stats`, `loose`
40
+ — are built from, and what their `--type`/`--area`/`--tag` filters match against.
41
+
42
+ # Citations
43
+
44
+ [1] [lib/okf/bundle/graph.rb](https://github.com/serradura/okf-gem/blob/main/lib/okf/bundle/graph.rb) — graph construction and the type/tag indexes.
@@ -0,0 +1,8 @@
1
+ # The model
2
+
3
+ The pure, in-memory data structures the gem builds a bundle out of — no disk, no
4
+ stdio. Everything else reads or renders these.
5
+
6
+ * [Concept](concept.md) - one file's worth of knowledge: frontmatter plus body, with a stable id.
7
+ * [Bundle](bundle.md) - a collection of concepts you validate, lint, and graph.
8
+ * [Graph](graph.md) - concepts as nodes, cross-links as edges, plus type and tag indexes.
data/.okf/overview.md ADDED
@@ -0,0 +1,66 @@
1
+ ---
2
+ type: Overview
3
+ title: okf-gem at a glance
4
+ description: A light Ruby gem that reads, validates, lints, and serves Open Knowledge Format v0.1 bundles.
5
+ tags: [okf, gem, overview, diagram]
6
+ timestamp: 2026-07-12T12:00:00Z
7
+ ---
8
+
9
+ # Overview
10
+
11
+ **okf-gem** — `okf` on RubyGems — operates on [OKF v0.1](format/okf-format.md)
12
+ bundles: directories of Markdown files with YAML frontmatter that humans and
13
+ agents both read from one source. It does not define new knowledge storage; it
14
+ gives you leverage over knowledge that already lives as Markdown.
15
+
16
+ ```mermaid
17
+ flowchart LR
18
+ skill["companion<br/>agent skill"] -. authors .-> bundle[("OKF v0.1 bundle<br/>Markdown + YAML")]
19
+ bundle --> model["pure model<br/>Concept · Bundle · Graph"]
20
+ subgraph cli ["okf CLI"]
21
+ validate["validate — legal? §9"]
22
+ lint["lint — well-curated?"]
23
+ server["server — explore"]
24
+ end
25
+ model --> cli
26
+ model --> library["library API<br/>embed in Ruby"]
27
+ ```
28
+
29
+ Over such a bundle the gem gives you five capabilities behind one
30
+ [command-line tool](cli.md):
31
+
32
+ | Capability | What it answers | Verb |
33
+ |------------|-----------------|------|
34
+ | [Conformance validator](capabilities/validator.md) | Is this a legal OKF bundle? (§9) | `validate` |
35
+ | [Curation linter](capabilities/linter.md) | Is it navigable, complete, fresh? | `lint` / `loose` |
36
+ | [Interactive graph server](capabilities/graph-server.md) | Can I explore it visually? | `server` |
37
+ | [Library API](capabilities/library-api.md) | Can my Ruby program use it? | (in-process) |
38
+ | [Companion agent skill](capabilities/agent-skill.md) | Can an agent author it? | `skill` |
39
+
40
+ Alongside those, a family of [read views](capabilities/read-views.md) —
41
+ `index`, `catalog`, `files`, `tags`, `stats`, `graph` — print the bundle at a
42
+ glance so an agent reads it without a browser.
43
+
44
+ # The two ideas it inherits from the format
45
+
46
+ - **Dual audience.** Every file serves a human skimming it *and* an agent
47
+ extracting from it, so bodies are structural Markdown and
48
+ [links](format/cross-links.md) are plain Markdown links — both readers already
49
+ understand them.
50
+ - **The graph is emergent.** Files are nodes, Markdown links are edges. You never
51
+ declare a graph; the gem [builds one](model/graph.md) from how concepts link.
52
+
53
+ # Design ethos
54
+
55
+ The gem is deliberately light so it runs on the Ruby an OS already ships. That
56
+ ethos is not incidental — it is enforced by [hard constraints](design/):
57
+ a [Ruby 2.4 floor](design/ruby-floor.md), exactly
58
+ [two runtime dependencies](design/runtime-dependencies.md), and a
59
+ [core/shell split](design/core-shell-split.md) that keeps all logic pure and
60
+ testable without disk. Everything else — no ActiveSupport, no build step, no
61
+ JavaScript toolchain — follows from those.
62
+
63
+ # Citations
64
+
65
+ [1] [README.md](https://github.com/serradura/okf-gem/blob/main/README.md) — the gem's own overview.
66
+ [2] [AGENTS.md](https://github.com/serradura/okf-gem/blob/main/AGENTS.md) — the maintainer guide.
data/CHANGELOG.md ADDED
@@ -0,0 +1,54 @@
1
+ # Changelog
2
+
3
+ ## [1.0.0] - 2026-07-12
4
+
5
+ Initial release.
6
+
7
+ - `OKF::Concept` / `OKF::Bundle`: pure in-memory model of an OKF v0.1 bundle,
8
+ buildable straight from data (no disk) with link, citation, and markdown
9
+ round-trip primitives.
10
+ - `OKF::Bundle::Validator`: the spec §9 conformance gate (hard errors) with the
11
+ spec's soft guidance reported as warnings — broken cross-links are tolerated,
12
+ as §5.3 requires.
13
+ - `OKF::Bundle::Linter`: advisory curation-quality report across reachability,
14
+ backlog, completeness, freshness, provenance, and hygiene, with `--json` as a
15
+ machine substrate.
16
+ - `OKF::Bundle::Graph`: the knowledge graph (nodes, edges, type/tag indexes) at
17
+ selectable fidelity.
18
+ - On-disk handles: `OKF::Bundle::Folder`, `OKF::Bundle::Reader`,
19
+ `OKF::Bundle::Writer` (atomic, validate-before-publish), and
20
+ `OKF::Concept::File`.
21
+ - `OKF::Server::App`: the interactive graph as a mountable Rack app — five views
22
+ (graph, catalog, files, tags, stats) with type/area/tag filtering throughout,
23
+ bodies fetched live from disk — served by a built-in WEBrick runner
24
+ (`okf server`).
25
+ - `okf` CLI: `validate`, `lint`, `loose`, and `graph`, plus the read views as
26
+ text — `index`, `catalog`, `files`, `tags`, `types`, `stats` — at full parity
27
+ with the browser: every list view narrows with `--type`/`--area`/`--tag`
28
+ (case-insensitive; the bundle root is area `(root)`, accepted as `root`), and
29
+ `tags --by type|area` regroups the tag index per concept dimension with
30
+ within-group counts — the tag-curation view. `server` boots the graph page;
31
+ `skill` installs the companion skill.
32
+ - `okf index`: a read view over the progressive-disclosure layer (spec §6) — one
33
+ entry per directory that holds concepts or carries an `index.md`, root first,
34
+ with its authored index body (frontmatter stripped), a type/tag rollup over the
35
+ concepts that live there, its child directories, and the concept listing. A
36
+ directory with concepts but no `index.md` has its listing synthesized (§6 permits
37
+ it) and is flagged. `--area` (repeatable), `--no-body`, and `--json`; advisory,
38
+ always exit 0. Backed by the pure `OKF::Bundle#directory_index`.
39
+ - JSON output is **compact by default** across every emitting verb (the
40
+ token-efficient machine substrate, matching the server); `--pretty` indents it
41
+ for reading and implies `--json`. JSON semantics are identical either way — only
42
+ whitespace differs — so any parser is unaffected.
43
+ - JSON property projection on the list views: `index`, `catalog`, and `files`
44
+ take `--fields a,b` (emit only these properties) or `--except a,b` (emit all but
45
+ these), so an agent never pays tokens for fields it will not read. The flags are
46
+ mutually exclusive, imply `--json`, match property names case-insensitively, and
47
+ reject an unknown name (exit 2) listing the valid ones; `okf index --no-body` is
48
+ shorthand for dropping the `body` field.
49
+ - Bundled companion agent skill (`okf skill <dest>`): SKILL.md carrying the
50
+ judgment (the CLI surface stays self-describing via `--help`) — including the
51
+ orient-before-you-read protocol and the CLI/judgment boundary — the OKF v0.1
52
+ spec, authoring and CLI references (tag-vocabulary curation, the SPEC-section
53
+ map, the closeout gate), and concept/index/log templates.
54
+ - Runs on Ruby >= 2.4 with two runtime dependencies: rack and webrick.
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "okf" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["rodrigo.serradura@gmail.com"](mailto:"rodrigo.serradura@gmail.com").
data/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Rodrigo Serradura
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.