Create BKN
Generate well-formed BKN directories (Markdown + YAML frontmatter) per v2.0.1.
Works with the openbkn skill
create-bkn authors the .bkn tree; the openbkn skill runs openbkn auth login and openbkn bkn push / pull after files exist.
What is BKN
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.
Directory layout
{network_dir}/
├── SKILL.md
├── network.bkn
├── CHECKSUM # optional; SDK may generate
├── object_types/
├── relation_types/
├── action_types/
├── concept_groups/
└── data/ # optional CSV instance data
Workflow
- Gather requirements — objects, relations, actions, optional concept groups
- Read spec — references/SPECIFICATION.llm.md (format rules, sections, frontmatter types)
- Pick templates — copy/adapt from assets/templates/ (
network_type.bkn.template, object_type.bkn.template, …)
- Create
network.bkn — root file; align with Network Overview
- Create
object_types/*.bkn — one file per object, {id}.bkn
- Create
relation_types/*.bkn — one file per relation
- Create
action_types/*.bkn — one file per action
- Create
concept_groups/*.bkn — optional
- Update
network.bkn — list all IDs in Network Overview
- 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)
- Review (MUST) — cross-check Validation checklist and Business rules placement; fix IDs, cross-refs, headings
- Validate (MUST) —
openbkn bkn validate <dir> (see Validation)
- Import (optional) —
openbkn bkn push <dir>
Import (openbkn CLI)
Requires the openbkn CLI from @openbkn/bkn-sdk (npm install -g @openbkn/bkn-sdk; Node.js 22+). push uses tar; on macOS COPYFILE_DISABLE=1 is set by the tool.
- Platform auth — If you already have a valid token for the target platform (
openbkn auth status), do not run openbkn auth login again. If not authenticated, run openbkn auth login <platform-url> first.
- BKN validation — If workflow step 12 (
openbkn 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.
openbkn bkn push <dir> [--branch main]
Export: openbkn bkn pull <kn-id> [<dir>]. More subcommands: openbkn bkn --help (see the openbkn skill if loaded).
Validation
openbkn 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.
A capabilities: section in network.bkn never fails validation or push. Read capabilities.skipped and the warnings instead: an entry listed there binds on no platform, and a malformed section is ignored whole. After push, the answer's capabilities.skipped names what this platform could not resolve.
Per-type reference
| Kind |
Spec (section) |
Template |
Example (k8s) |
| Network |
knowledge_network in spec |
assets/templates/network_type.bkn.template |
references/examples/k8s-network/network.bkn |
| Object |
object_type |
assets/templates/object_type.bkn.template |
references/examples/k8s-network/object_types/pod.bkn |
| Relation |
relation_type |
assets/templates/relation_type.bkn.template |
references/examples/k8s-network/relation_types/pod_belongs_node.bkn |
| Action |
action_type |
assets/templates/action_type.bkn.template |
references/examples/k8s-network/action_types/restart_pod.bkn |
| Concept group |
concept_group |
assets/templates/concept_group.bkn.template |
references/examples/k8s-network/concept_groups/k8s.bkn |
Full rules and optional sections: references/SPECIFICATION.llm.md.
Naming conventions
- ID: lowercase, digits, underscores; file:
{id}.bkn under the matching folder
- Headings:
# network title, ## type block, ### section, #### logic property
- Frontmatter: at least
type, id, name (see spec for each type)
Business rules placement
Rules must sit in spec-defined places so import persists them. Full wording: references/SPECIFICATION.llm.md.
- Network-level — prose in
network.bkn right after # {title} (before structured sections like ## Network Overview)
- Type-level — prose in each type file after
## ObjectType: / ## RelationType: / … and before the first ###; never in frontmatter
- Property-level — in Data Properties table Description column
- No extra sections — do not add Markdown outside the standard sections; parsers may drop unparsed content on import
Validation checklist
Output rules
- Emit raw
.bkn content — do not wrap the whole file in a fenced markdown block
- Reuse IDs consistently across relations/actions
- IDs: lowercase + underscores; display text Chinese unless asked otherwise
- Keep heading order per spec
Examples
- references/examples/k8s-network/ — modular sample (objects, relations, actions, concept group)
Delivered BKN: root SKILL.md
When you build a knowledge network directory {network_dir}/, add {network_dir}/SKILL.md at the root (alongside network.bkn). Short overview + index tables with file paths (object | path | relation | path | action | path) so agents route to the right .bkn without scanning. Optional: topology sketch, usage scenarios. Example: references/examples/k8s-network/SKILL.md.
1---2name: create-bkn3description: Guides 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 user asks to model business knowledge in BKN format. When the openbkn skill is also loaded, use it to run the openbkn CLI (auth, bkn push) after files exist.4---56# Create BKN78Generate well-formed BKN directories (Markdown + YAML frontmatter) per v2.0.1.910## Works with the openbkn skill1112**create-bkn** authors the `.bkn` tree; the **openbkn** skill runs `openbkn auth login` and `openbkn bkn push` / `pull` after files exist.1314## What is BKN1516BKN 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).1718## Directory layout1920```21{network_dir}/22├── SKILL.md23├── network.bkn24├── CHECKSUM # optional; SDK may generate25├── object_types/26├── relation_types/27├── action_types/28├── concept_groups/29└── data/ # optional CSV instance data30```3132## Workflow33341. **Gather requirements** — objects, relations, actions, optional concept groups352. **Read spec** — [references/SPECIFICATION.llm.md](references/SPECIFICATION.llm.md) (format rules, sections, frontmatter types)363. **Pick templates** — copy/adapt from [assets/templates/](assets/templates/) (`network_type.bkn.template`, `object_type.bkn.template`, …)374. **Create `network.bkn`** — root file; align with Network Overview385. **Create `object_types/*.bkn`** — one file per object, `{id}.bkn`396. **Create `relation_types/*.bkn`** — one file per relation407. **Create `action_types/*.bkn`** — one file per action418. **Create `concept_groups/*.bkn`** — optional429. **Update `network.bkn`** — list all IDs in Network Overview4310. **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))4411. **Review (MUST)** — cross-check [Validation checklist](#validation-checklist) and [Business rules placement](#business-rules-placement); fix IDs, cross-refs, headings4512. **Validate (MUST)** — `openbkn bkn validate <dir>` (see [Validation](#validation))4613. **Import** (optional) — `openbkn bkn push <dir>`4748## Import (openbkn CLI)4950Requires the `openbkn` CLI from `@openbkn/bkn-sdk` (`npm install -g @openbkn/bkn-sdk`; Node.js 22+). `push` uses `tar`; on macOS `COPYFILE_DISABLE=1` is set by the tool.5152- **Platform auth** — If you already have a valid token for the target platform (`openbkn auth status`), **do not** run `openbkn auth login` again. If not authenticated, run `openbkn auth login <platform-url>` first.53- **BKN validation** — If workflow step 12 (`openbkn 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`.5455```bash56openbkn bkn push <dir> [--branch main]57```5859Export: `openbkn bkn pull <kn-id> [<dir>]`. More subcommands: `openbkn bkn --help` (see the openbkn skill if loaded).6061## Validation6263`openbkn 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.6465A `capabilities:` section in `network.bkn` never fails validation or push. Read `capabilities.skipped` and the warnings instead: an entry listed there binds on no platform, and a malformed section is ignored whole. After `push`, the answer's `capabilities.skipped` names what this platform could not resolve.6667## Per-type reference6869| Kind | Spec (section) | Template | Example (k8s) |70|------|------------------|----------|---------------|71| 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) |72| 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) |73| 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) |74| 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) |75| Concept group | `concept_group` | [assets/templates/concept_group.bkn.template](assets/templates/concept_group.bkn.template) | [references/examples/k8s-network/concept_groups/k8s.bkn](references/examples/k8s-network/concept_groups/k8s.bkn) |7677Full rules and optional sections: [references/SPECIFICATION.llm.md](references/SPECIFICATION.llm.md).7879## Naming conventions8081- **ID**: lowercase, digits, underscores; **file**: `{id}.bkn` under the matching folder82- **Headings**: `#` network title, `##` type block, `###` section, `####` logic property83- **Frontmatter**: at least `type`, `id`, `name` (see spec for each type)8485## Business rules placement8687Rules must sit in spec-defined places so import persists them. Full wording: [references/SPECIFICATION.llm.md](references/SPECIFICATION.llm.md#输出规则).8889- **Network-level** — prose in `network.bkn` right after `# {title}` (before structured sections like `## Network Overview`)90- **Type-level** — prose in each type file after `## ObjectType:` / `## RelationType:` / … and **before** the first `###`; never in frontmatter91- **Property-level** — in **Data Properties** table **Description** column92- **No extra sections** — do not add Markdown outside the standard sections; parsers may drop unparsed content on import9394## Validation checklist9596- [ ] `network.bkn` at root; frontmatter matches spec97- [ ] Every `.bkn` has valid YAML frontmatter (`type`, `id`, `name`)98- [ ] Files live under folders matching `type` (`object_types/`, `relation_types/`, …); filename = `{id}.bkn`99- [ ] Network Overview lists **all** definition IDs — no missing/extra100- [ ] Relations/actions reference existing object-type IDs; concept groups list only existing objects101- [ ] Parameter binding `Source` ∈ `property` | `input` | `const`; YAML blocks (e.g. trigger) parse102- [ ] Heading hierarchy has no skipped levels103- [ ] Business rules only in allowed places (see [Business rules placement](#business-rules-placement))104105## Output rules1061071. Emit raw `.bkn` content — do not wrap the whole file in a fenced `markdown` block1082. Reuse IDs consistently across relations/actions1093. IDs: lowercase + underscores; display text Chinese unless asked otherwise1104. Keep heading order per spec111112## Examples113114- [references/examples/k8s-network/](references/examples/k8s-network/) — modular sample (objects, relations, actions, concept group)115116## Delivered BKN: root SKILL.md117118When you build a knowledge network directory `{network_dir}/`, add `{network_dir}/SKILL.md` at the root (alongside `network.bkn`). Short overview + **index tables with file paths** (object | path | relation | path | action | path) so agents route to the right `.bkn` without scanning. Optional: topology sketch, usage scenarios. Example: [references/examples/k8s-network/SKILL.md](references/examples/k8s-network/SKILL.md).