@aikdna/kdna-cli 0.9.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.
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +73 -0
- package/package.json +58 -0
- package/skills/kdna-loader/SKILL.md +257 -0
- package/src/agent.js +434 -0
- package/src/cli.js +260 -0
- package/src/cluster.js +235 -0
- package/src/cmds/_common.js +100 -0
- package/src/cmds/cluster.js +235 -0
- package/src/cmds/domain.js +638 -0
- package/src/cmds/identity.js +31 -0
- package/src/cmds/legacy.js +83 -0
- package/src/cmds/quality.js +87 -0
- package/src/cmds/registry.js +114 -0
- package/src/cmds/setup.js +8 -0
- package/src/compare.js +324 -0
- package/src/diff.js +288 -0
- package/src/identity.js +211 -0
- package/src/init.js +168 -0
- package/src/install.js +849 -0
- package/src/loader.js +70 -0
- package/src/publish.js +600 -0
- package/src/registry.js +258 -0
- package/src/search.js +73 -0
- package/src/setup.js +197 -0
- package/src/verify.js +423 -0
- package/src/version.js +112 -0
- package/templates/cluster/KDNA_Cluster.json +25 -0
- package/templates/cluster/README.md +32 -0
- package/templates/minimal-domain/KDNA_Core.json +54 -0
- package/templates/minimal-domain/KDNA_Patterns.json +37 -0
- package/templates/minimal-domain/kdna.json +31 -0
- package/templates/minimal-domain/tests/before-after.json +16 -0
- package/templates/standard-domain/KDNA_Core.json +76 -0
- package/templates/standard-domain/KDNA_Patterns.json +44 -0
- package/templates/standard-domain/README.md +74 -0
- package/templates/standard-domain/USAGE.md +59 -0
- package/templates/standard-domain/evals/1_excluded_case.json +16 -0
- package/templates/standard-domain/evals/3_boundary_cases.json +38 -0
- package/templates/standard-domain/evals/3_core_cases.json +35 -0
- package/templates/standard-domain/evals/3_failure_cases.json +35 -0
- package/templates/standard-domain/evals/scoring.json +60 -0
- package/templates/standard-domain/kdna.json +28 -0
- package/validators/kdna-lint.js +53 -0
- package/validators/kdna-validate.js +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
KDNA
|
|
2
|
+
Copyright 2026 KDNA contributors
|
|
3
|
+
|
|
4
|
+
This product includes software developed by the KDNA Team
|
|
5
|
+
(https://github.com/knowledge-dna).
|
|
6
|
+
|
|
7
|
+
KDNA Documentation and examples are licensed under CC BY 4.0 unless
|
|
8
|
+
otherwise noted. Code, including validators and package metadata, is
|
|
9
|
+
licensed under Apache-2.0.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @aikdna/kdna-cli
|
|
2
|
+
|
|
3
|
+
KDNA CLI — create, validate, install, and manage domain cognition packages for AI agents.
|
|
4
|
+
|
|
5
|
+
Part of the [KDNA](https://github.com/knowledge-dna/KDNA) ecosystem.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @aikdna/kdna-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Validate a domain
|
|
17
|
+
kdna validate ./my-domain
|
|
18
|
+
|
|
19
|
+
# Verify a domain (structure + trust + judgment)
|
|
20
|
+
kdna verify @aikdna/writing
|
|
21
|
+
|
|
22
|
+
# Install a domain
|
|
23
|
+
kdna install @aikdna/writing
|
|
24
|
+
|
|
25
|
+
# Create a new domain
|
|
26
|
+
kdna init my-domain
|
|
27
|
+
|
|
28
|
+
# Search the registry
|
|
29
|
+
kdna search writing
|
|
30
|
+
|
|
31
|
+
# Compare with/without KDNA
|
|
32
|
+
kdna compare @aikdna/writing --input "..."
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
| Command | Description |
|
|
38
|
+
|---------|-------------|
|
|
39
|
+
| `kdna validate <dir>` | Validate domain structure |
|
|
40
|
+
| `kdna verify <name>` | Full 3-layer verification (structure/trust/judgment) |
|
|
41
|
+
| `kdna install <name>` | Install a domain from the registry |
|
|
42
|
+
| `kdna remove <name>` | Remove an installed domain |
|
|
43
|
+
| `kdna info <name>` | Show domain information |
|
|
44
|
+
| `kdna inspect <dir\|file>` | Inspect a domain or .kdna file |
|
|
45
|
+
| `kdna list` | List installed domains |
|
|
46
|
+
| `kdna search <keyword>` | Search the registry |
|
|
47
|
+
| `kdna init <name>` | Create a new domain from template |
|
|
48
|
+
| `kdna pack <dir>` | Pack a domain into .kdna file |
|
|
49
|
+
| `kdna unpack <file>` | Unpack a .kdna file |
|
|
50
|
+
| `kdna publish <dir>` | Publish a domain to the registry |
|
|
51
|
+
| `kdna compare <name>` | Compare AI output with/without KDNA |
|
|
52
|
+
| `kdna diff <name@v1> <name@v2>` | Diff two domain versions |
|
|
53
|
+
| `kdna project init` | Initialize .kdna/config.json for a project |
|
|
54
|
+
| `kdna identity init` | Create a signing identity |
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/knowledge-dna/kdna-cli.git
|
|
60
|
+
cd kdna-cli
|
|
61
|
+
npm install
|
|
62
|
+
npm test
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Related
|
|
66
|
+
|
|
67
|
+
- [@aikdna/kdna-core](https://github.com/knowledge-dna/KDNA/tree/main/packages/kdna-core) — Pure logic library
|
|
68
|
+
- [KDNA Registry](https://github.com/knowledge-dna/kdna-registry) — Domain catalog
|
|
69
|
+
- [aikdna.com](https://aikdna.com) — Website
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
Apache-2.0
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aikdna/kdna-cli",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "KDNA CLI — create, validate, install, and manage domain cognition packages for AI agents.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"bin": {
|
|
7
|
+
"kdna": "src/cli.js",
|
|
8
|
+
"kdna-lint": "validators/kdna-lint.js",
|
|
9
|
+
"kdna-validate": "validators/kdna-validate.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src/",
|
|
13
|
+
"validators/",
|
|
14
|
+
"templates/",
|
|
15
|
+
"skills/",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"NOTICE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"lint": "eslint src/ validators/ tests/",
|
|
21
|
+
"format": "prettier --write .",
|
|
22
|
+
"format:check": "prettier --check .",
|
|
23
|
+
"test": "node --test tests/v07-commands.test.js tests/validator.test.js",
|
|
24
|
+
"pretest": "npm install --ignore-scripts"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"kdna",
|
|
28
|
+
"kdna-cli",
|
|
29
|
+
"ai-agent",
|
|
30
|
+
"domain-cognition",
|
|
31
|
+
"knowledge-dna",
|
|
32
|
+
"cli"
|
|
33
|
+
],
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/knowledge-dna/kdna-cli.git"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://aikdna.com",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/knowledge-dna/kdna-cli/issues"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@aikdna/kdna-core": "^0.3.0"
|
|
48
|
+
},
|
|
49
|
+
"optionalDependencies": {
|
|
50
|
+
"ajv": "^8.17.1",
|
|
51
|
+
"ajv-formats": "^3.0.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/js": "^9.39.0",
|
|
55
|
+
"eslint": "^9.39.0",
|
|
56
|
+
"prettier": "^3.8.3"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kdna-loader
|
|
3
|
+
description: Discover and load KDNA judgment frameworks from ~/.kdna/domains/ when the task requires domain-specific judgment (review, diagnosis, critique, classification, strategy) where the same input could legitimately be interpreted multiple ways. Skip for pure formatting, factual lookup, code execution, or mechanical transformations. This skill is the entire interface to KDNA — domains themselves are not separate skills.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# KDNA Loader
|
|
7
|
+
|
|
8
|
+
KDNA (Knowledge DNA) is a portable format for encoding domain judgment.
|
|
9
|
+
Each KDNA domain is a small JSON bundle (~5–30 KB) that describes how
|
|
10
|
+
an expert thinks inside one domain: the principles they reason from,
|
|
11
|
+
the misunderstandings they avoid, the questions they ask themselves
|
|
12
|
+
before deciding.
|
|
13
|
+
|
|
14
|
+
**KDNA does not act. KDNA shapes how an agent judges before acting.**
|
|
15
|
+
Together with this skill, KDNA + kdna-loader form a complete loop:
|
|
16
|
+
this skill provides the **routing and protocol**, KDNA provides the
|
|
17
|
+
**judgment material**.
|
|
18
|
+
|
|
19
|
+
This skill is the **only** KDNA-related skill. Domains themselves are
|
|
20
|
+
not registered as skills — they live in `~/.kdna/domains/` as data and
|
|
21
|
+
are discovered on demand. Whether the user has 1 domain installed or
|
|
22
|
+
100, this skill is the single entry point.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Part 1 — Decide whether KDNA applies at all
|
|
27
|
+
|
|
28
|
+
Most tasks do **not** need KDNA. Run this check first.
|
|
29
|
+
|
|
30
|
+
### Use KDNA when
|
|
31
|
+
|
|
32
|
+
- The same input could mean different things, and the wrong reading
|
|
33
|
+
produces a wrong response. Examples:
|
|
34
|
+
- "Your price is too high" → could be value uncertainty, budget,
|
|
35
|
+
or risk aversion. Wrong diagnosis → wrong response.
|
|
36
|
+
- "Review this article opening" → could need polish, or structural
|
|
37
|
+
rewrite. Wrong frame → wasted edit cycle.
|
|
38
|
+
- "Did our meeting reach a decision?" → could be a real commitment
|
|
39
|
+
or just discussion. Wrong call → fake progress.
|
|
40
|
+
- The task is **review / diagnosis / critique / classification /
|
|
41
|
+
strategy / evaluation** in a specific domain.
|
|
42
|
+
- The user expects expert judgment, not a procedure.
|
|
43
|
+
|
|
44
|
+
### Skip KDNA when
|
|
45
|
+
|
|
46
|
+
- The task is mechanical: format conversion, syntax fixes, lookups,
|
|
47
|
+
arithmetic, code execution.
|
|
48
|
+
- The task is purely creative without a judgment dimension.
|
|
49
|
+
- The user explicitly asked for one-shot output without analysis.
|
|
50
|
+
- No installed domain plausibly covers the task.
|
|
51
|
+
|
|
52
|
+
If you decide to skip, **answer normally** and do not mention KDNA.
|
|
53
|
+
The user should never see "I considered loading KDNA but didn't."
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Part 2 — Discover what's installed
|
|
58
|
+
|
|
59
|
+
Do **not** assume any specific domains exist. Ask the CLI every time.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
kdna available --json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Returns a compact JSON array — one entry per installed domain — with:
|
|
66
|
+
`name`, `version`, `judgment_version`, `status`, `description`,
|
|
67
|
+
`core_insight`, `keywords`, `applies_when` (flattened across all
|
|
68
|
+
axioms), `does_not_apply_when` (flattened), `failure_risks`. Yanked
|
|
69
|
+
domains are excluded automatically.
|
|
70
|
+
|
|
71
|
+
This is your **only** discovery interface. Do not `ls ~/.kdna/domains/`
|
|
72
|
+
or `cat` the JSON files directly — the CLI is the supported contract
|
|
73
|
+
between this skill and the KDNA file format. The on-disk layout may
|
|
74
|
+
change; `kdna available` will not.
|
|
75
|
+
|
|
76
|
+
If the command returns `[]` or fails (CLI not installed) → no KDNA
|
|
77
|
+
available → answer normally, mention installation only if the user is
|
|
78
|
+
asking about KDNA itself.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Part 3 — Evaluate fit (per candidate domain)
|
|
83
|
+
|
|
84
|
+
`kdna available --json` already gave you each domain's `applies_when`
|
|
85
|
+
and `does_not_apply_when` (flattened across all axioms). For each
|
|
86
|
+
domain in the list, decide whether it fits the current task by
|
|
87
|
+
**reading the language**, not by token matching.
|
|
88
|
+
|
|
89
|
+
For a hint signal (optional, low-trust), you can also call:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
kdna match "<task in user's own words>" --json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This returns two things:
|
|
96
|
+
|
|
97
|
+
- `dropped`: domains whose `does_not_apply_when` matched the task
|
|
98
|
+
with high enough confidence to mechanically disqualify them.
|
|
99
|
+
**Respect this.** Even if your own reading thinks the domain
|
|
100
|
+
could fit, the author explicitly excluded the case.
|
|
101
|
+
- `hints`: domains with weak surface keyword overlap. Many false
|
|
102
|
+
positives are normal — treat as one input among many, not as a
|
|
103
|
+
decision.
|
|
104
|
+
|
|
105
|
+
The decision is yours, not the CLI's. The CLI only mechanically
|
|
106
|
+
disqualifies (via `dropped`); it cannot pick the winner.
|
|
107
|
+
|
|
108
|
+
### How to decide
|
|
109
|
+
|
|
110
|
+
For each domain still in play after `dropped` exclusion:
|
|
111
|
+
|
|
112
|
+
1. Does the domain's **description** match what the user is asking?
|
|
113
|
+
2. Does **any** `applies_when` entry describe a situation that
|
|
114
|
+
matches this specific task?
|
|
115
|
+
3. Does **any** `does_not_apply_when` entry describe what the user
|
|
116
|
+
actually wants (e.g. they explicitly asked for copy edit)?
|
|
117
|
+
|
|
118
|
+
If 1 and 2 are yes and 3 is no → strong fit.
|
|
119
|
+
If 2 is unclear → weak fit. Prefer skipping over forcing.
|
|
120
|
+
|
|
121
|
+
A domain's `failure_risks` (also in `available --json`) tells you
|
|
122
|
+
what bad output the author warns about. Pre-check: is this exactly
|
|
123
|
+
what you'd produce if you loaded the domain? If yes, skip it.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Part 4 — Selection
|
|
128
|
+
|
|
129
|
+
After evaluating, you should usually have:
|
|
130
|
+
|
|
131
|
+
- **0 fits** → do not load KDNA. Answer normally.
|
|
132
|
+
- **1 fit** → load it.
|
|
133
|
+
- **2+ fits** → prefer the narrowest match. If two domains take
|
|
134
|
+
genuinely different stances on the task, surface the choice:
|
|
135
|
+
> "Two installed domains could apply here: @aikdna/writing
|
|
136
|
+
> (structural diagnosis) and @yourorg/copy_polish (line-level
|
|
137
|
+
> polish). Which judgment frame should I use?"
|
|
138
|
+
Do **not** silently blend.
|
|
139
|
+
|
|
140
|
+
Never load more than one domain as primary. A secondary domain can
|
|
141
|
+
constrain (e.g. `@aikdna/agent_safety` always advises on irreversible
|
|
142
|
+
actions), but the primary judgment frame is always one.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Part 5 — Load
|
|
147
|
+
|
|
148
|
+
Once selected, load the domain via the CLI:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
kdna load @scope/name
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The default output (`--as=prompt`) is a compact text rendering
|
|
155
|
+
optimized for system-prompt injection: axioms with their
|
|
156
|
+
`applies_when` / `does_not_apply_when` / `failure_risk`, stances,
|
|
157
|
+
banned terms, misunderstandings, and self-checks. Typically
|
|
158
|
+
~30–50% smaller than the raw JSON.
|
|
159
|
+
|
|
160
|
+
Other output modes:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
kdna load @scope/name --as=json # raw Core + Patterns JSON
|
|
164
|
+
kdna load @scope/name --as=raw # concatenated raw file contents
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Use `--as=prompt` for normal loading. Use `--as=json` only when you
|
|
168
|
+
genuinely need to inspect the structure (e.g. user is debugging the
|
|
169
|
+
domain itself).
|
|
170
|
+
|
|
171
|
+
**Token discipline**: the prompt output already includes everything
|
|
172
|
+
the agent needs to apply judgment. Do not also `cat` the optional
|
|
173
|
+
files (`KDNA_Scenarios.json`, `KDNA_Cases.json`, etc.) unless the
|
|
174
|
+
user explicitly asks for examples, reasoning chains, or capability
|
|
175
|
+
stages.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Part 6 — Apply silently
|
|
180
|
+
|
|
181
|
+
You have now internalized the domain's judgment surface. From this
|
|
182
|
+
point on:
|
|
183
|
+
|
|
184
|
+
1. **Adopt the axioms as your reasoning frame** — reason *from*
|
|
185
|
+
them, not *around* them.
|
|
186
|
+
2. **Honour the boundaries** — for each axiom you'd apply, confirm
|
|
187
|
+
the task is in `applies_when` AND not in `does_not_apply_when`.
|
|
188
|
+
3. **Pre-check failure_risk** — before producing output, ask:
|
|
189
|
+
"Am I about to commit the failure this domain explicitly warns
|
|
190
|
+
about?" If yes, step back.
|
|
191
|
+
4. **Use preferred terminology** — even if the user uses banned
|
|
192
|
+
terms, gently substitute the domain's terms.
|
|
193
|
+
5. **Detect named misunderstandings** in the user's framing.
|
|
194
|
+
6. **Apply frameworks** when their `when_to_use` matches.
|
|
195
|
+
7. **Run self-checks** before final output. If a self-check fails,
|
|
196
|
+
revise.
|
|
197
|
+
8. **Output a domain-shaped answer** — never quote KDNA, never list
|
|
198
|
+
axioms, never say "according to the loaded KDNA." The user sees
|
|
199
|
+
sharper judgment, not the source.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Part 7 — Boundary respect
|
|
204
|
+
|
|
205
|
+
KDNA does not override:
|
|
206
|
+
|
|
207
|
+
- **User intent**: if the user asks for grammar fixes, give grammar
|
|
208
|
+
fixes — do not lecture about structural void.
|
|
209
|
+
- **Evidence**: if the user provides facts contradicting an axiom,
|
|
210
|
+
evidence wins.
|
|
211
|
+
- **Safety**: if `@aikdna/agent_safety` (or equivalent) says halt,
|
|
212
|
+
halt.
|
|
213
|
+
- **Skills' execution layer**: KDNA shapes judgment; other skills /
|
|
214
|
+
tools do the action.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Failure handling
|
|
219
|
+
|
|
220
|
+
| Situation | What to do |
|
|
221
|
+
|---|---|
|
|
222
|
+
| `kdna` CLI not installed | Skip KDNA. Answer normally. Mention installation only if user asks about KDNA itself. |
|
|
223
|
+
| `kdna available --json` returns `[]` | No domains installed. Skip KDNA. |
|
|
224
|
+
| `kdna load <name>` exits non-zero | That domain is broken (yanked, missing files, parse error). Try next candidate or skip KDNA. The error message tells you why. |
|
|
225
|
+
| User explicitly asks for a domain that isn't installed | Tell them, suggest `kdna install <name>`. Do not fabricate the domain. |
|
|
226
|
+
| Two domains' stances directly conflict on the task | Surface to user. Do not blend. |
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Debug mode
|
|
231
|
+
|
|
232
|
+
If the user asks "did you use KDNA?" or "which domain did you load?",
|
|
233
|
+
you may reveal:
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
Loaded: @aikdna/writing@0.7.2 (judgment_version 2026.05)
|
|
237
|
+
Reason: matched axiom_problem_not_prose.applies_when
|
|
238
|
+
on "user asked for content review"
|
|
239
|
+
Applied modules: KDNA_Core, KDNA_Patterns
|
|
240
|
+
Skipped: @aikdna/code_review (task is not code-related)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Otherwise, stay silent about the loading mechanics.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## What this skill is NOT
|
|
248
|
+
|
|
249
|
+
- Not a list of available KDNA domains (those live in
|
|
250
|
+
`~/.kdna/domains/`, discovered on demand)
|
|
251
|
+
- Not a registry browser (use `kdna list --available` CLI)
|
|
252
|
+
- Not a domain creator (use `kdna init <name>` CLI)
|
|
253
|
+
- Not an auto-loader that runs on every request — you decide per
|
|
254
|
+
request whether the task needs KDNA at all
|
|
255
|
+
|
|
256
|
+
The skill teaches the protocol. The KDNA files supply the judgment.
|
|
257
|
+
Both are required; neither is sufficient alone.
|