$npx -y skills add kweaver-ai/kweaver-dip --skill create-bknGuides creation of BKN (Business Knowledge Network) definition files following v2.0.1 spec. Covers network, object_type, relation_type, action_type, concept_group. Use when creating knowledge networks, BKN files, object types, relation types, action types, concept groups, or when
| 1 | # Create BKN |
| 2 | |
| 3 | Generate well-formed BKN directories (Markdown + YAML frontmatter) per v2.0.1. |
| 4 | |
| 5 | ## Works with kweaver-core |
| 6 | |
| 7 | **create-bkn** authors the `.bkn` tree; **kweaver-core** runs `kweaver auth login` and `kweaver bkn push` / `pull` after files exist. |
| 8 | |
| 9 | ## What is BKN |
| 10 | |
| 11 | BKN is Markdown + YAML frontmatter for schema; one file per definition under typed subfolders. Details (sections, required tables, types) live in [references/SPECIFICATION.llm.md](references/SPECIFICATION.llm.md). |
| 12 | |
| 13 | ## Directory layout |
| 14 | |
| 15 | ``` |
| 16 | {network_dir}/ |
| 17 | ├── SKILL.md |
| 18 | ├── network.bkn |
| 19 | ├── CHECKSUM # optional; SDK may generate |
| 20 | ├── object_types/ |
| 21 | ├── relation_types/ |
| 22 | ├── action_types/ |
| 23 | ├── concept_groups/ |
| 24 | └── data/ # optional CSV instance data |
| 25 | ``` |
| 26 | |
| 27 | ## Workflow |
| 28 | |
| 29 | 1. **Gather requirements** — objects, relations, actions, optional concept groups |
| 30 | 2. **Read spec** — [references/SPECIFICATION.llm.md](references/SPECIFICATION.llm.md) (format rules, sections, frontmatter types) |
| 31 | 3. **Pick templates** — copy/adapt from [assets/templates/](assets/templates/) (`network_type.bkn.template`, `object_type.bkn.template`, …) |
| 32 | 4. **Create `network.bkn`** — root file; align with Network Overview |
| 33 | 5. **Create `object_types/*.bkn`** — one file per object, `{id}.bkn` |
| 34 | 6. **Create `relation_types/*.bkn`** — one file per relation |
| 35 | 7. **Create `action_types/*.bkn`** — one file per action |
| 36 | 8. **Create `concept_groups/*.bkn`** — optional |
| 37 | 9. **Update `network.bkn`** — list all IDs in Network Overview |
| 38 | 10. **Add root `SKILL.md` in the BKN directory** — same folder as `network.bkn` (this is **not** the create-bkn skill file); agent-facing guide for that network (see [Delivered BKN: root SKILL.md](#delivered-bkn-root-skillmd)) |
| 39 | 11. **Review (MUST)** — cross-check [Validation checklist](#validation-checklist) and [Business rules placement](#business-rules-placement); fix IDs, cross-refs, headings |
| 40 | 12. **Validate (MUST)** — `kweaver bkn validate <dir>` (see [Validation](#validation)) |
| 41 | 13. **Import** (optional) — `kweaver bkn push <dir>` |
| 42 | |
| 43 | ## Import (kweaver CLI) |
| 44 | |
| 45 | Requires the `kweaver` CLI from `@kweaver-ai/kweaver-sdk` (`npm install -g @kweaver-ai/kweaver-sdk`; Node.js 22+). `push` uses `tar`; on macOS `COPYFILE_DISABLE=1` is set by the tool. |
| 46 | |
| 47 | - **Platform auth** — If you already have a valid token for the target platform (`kweaver auth status`), **do not** run `kweaver auth login` again. If not authenticated, run `kweaver auth login <platform-url>` first. |
| 48 | - **BKN validation** — If workflow step 12 (`kweaver bkn validate <dir>`) **already succeeded** for this directory, **do not** repeat validate before `push` unless you changed `.bkn` files. If you have **not** validated yet, run `validate` before `push`. |
| 49 | |
| 50 | ```bash |
| 51 | kweaver bkn push <dir> [--branch main] [-bd <business-domain>] |
| 52 | ``` |
| 53 | |
| 54 | `-bd` / `--biz-domain` is optional. If you omit it, the CLI resolves the business domain automatically (`KWEAVER_BUSINESS_DOMAIN` env, then saved platform config in `~/.kweaver`, otherwise `bd_public`). |
| 55 | |
| 56 | Export: `kweaver bkn pull <kn-id> [<dir>]`. More subcommands: `kweaver bkn --help` (see kweaver-core skill if loaded). |
| 57 | |
| 58 | ## Validation |
| 59 | |
| 60 | `kweaver bkn validate <dir>` — must pass before delivery or upload. It loads `network.bkn` and sibling `.bkn` files. Success prints counts; on failure fix `.bkn` files and re-run. |
| 61 | |
| 62 | ## Per-type reference |
| 63 | |
| 64 | | Kind | Spec (section) | Template | Example (k8s) | |
| 65 | |------|------------------|----------|---------------| |
| 66 | | Network | `knowledge_network` in spec | [assets/templates/network_type.bkn.template](assets/templates/network_type.bkn.template) | [references/examples/k8s-network/network.bkn](references/examples/k8s-network/network.bkn) | |
| 67 | | Object | `object_type` | [assets/templates/object_type.bkn.template](assets/templates/object_type.bkn.template) | [references/examples/k8s-network/object_types/pod.bkn](references/examples/k8s-network/object_types/pod.bkn) | |
| 68 | | Relation | `relation_type` | [assets/templates/relation_type.bkn.template](assets/templates/relation_type.bkn.template) | [references/examples/k8s-network/relation_types/pod_belongs_node.bkn](references/examples/k8s-network/relation_types/pod_belongs_node.bkn) | |
| 69 | | Action | `action_type` | [assets/templates/action_type.bkn.template](assets/templates/action_type.bkn.template) | [references/examples/k8s-network/action_types/restart_pod.bkn](references/examples/k8s-network/action_types/restart_pod.bkn) | |
| 70 | | Concept group | `concept_group` | [assets/templates/concept_group.bkn.template](assets/templates/concept_group.bkn.templ |