@aikdna/kdna-studio-cli 0.10.1 → 0.11.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/README.md CHANGED
@@ -1,15 +1,25 @@
1
1
  # @aikdna/kdna-studio-cli
2
2
 
3
- Official Studio command-line entry for KDNA judgment asset creation — turns your notes, documents, works, and feedback into loadable `.kdna` files.
3
+ > **Status:** Pre-release authoring toolchain. This repository contains the
4
+ > unreleased `0.11.0` corrective candidate; the published incumbent remains
5
+ > `0.10.2`. Candidate behavior must not be described as already published.
4
6
 
5
- Two authoring paths: interview-first (articulate judgment directly) and distillation-first (provide content, find the patterns, review what belongs in scope).
7
+ Official terminal entry for KDNA judgment asset creation. The default Creation
8
+ Engine guides a user or terminal Agent from purpose and source material through
9
+ judgment review, boundary examples, confirmation, repair, a managed test
10
+ candidate, and final exact-byte delivery. It does not require the Studio app
11
+ or manual `.kdna` format editing.
6
12
 
7
- Distillation-first authoring is domain-first: declare the target domain, owner scope, granularity, task scope, include areas, exclude areas, and load condition before extracting candidates. A single `.kdna` should stay scoped; complex work should compose multiple domain assets through a KDNA Cluster.
13
+ Two creation paths remain useful: interview-first (articulate judgment
14
+ directly) and material-first (provide content, find the patterns, review what
15
+ belongs in scope).
8
16
 
9
- This package provides the `kdna-studio` command. It creates Studio projects,
10
- imports evidence, manages judgment cards, records optional review/provenance
11
- signals, compiles project content, and exports canonical `.kdna`
12
- assets with build reports.
17
+ Distillation-first authoring is domain-first: declare the target domain, owner scope, granularity, task scope, include areas, exclude areas, and load condition before extracting candidates. A single `.kdna` should stay scoped. Any future multi-asset use requires an explicit, separately admitted Host contract; it is not an implicit Studio export behavior.
18
+
19
+ This package provides the `kdna-studio` command. Its default Agent surface
20
+ speaks in purpose, material, judgment, boundary, example, confirmation, and
21
+ export terms. The existing project, evidence, candidate, and card commands
22
+ remain available as an expert authoring surface.
13
23
 
14
24
  It is intentionally separate from `@aikdna/kdna-cli`:
15
25
 
@@ -22,11 +32,80 @@ It is intentionally separate from `@aikdna/kdna-cli`:
22
32
  ## Install
23
33
 
24
34
  ```bash
25
- npm install -g @aikdna/kdna-studio-cli
35
+ npm install -g @aikdna/kdna-studio-cli@0.10.2
26
36
  ```
27
37
 
38
+ That command installs the published incumbent. To assess the unreleased
39
+ `0.11.0` candidate, use this source repository and its exact candidate
40
+ dependency coordinates; do not mix candidate documentation with npm `latest`.
41
+
28
42
  ## Usage
29
43
 
44
+ For a terminal Agent, start with the user's ordinary-language goal and an
45
+ optional explicit material path. The Host translates that request into private
46
+ machine input and generates stable technical coordinates. A normal user never
47
+ supplies a mode enum, Agent ID, operation ID, digest, schema, signing key,
48
+ receipt, seed, or benchmark coordinate.
49
+
50
+ ```bash
51
+ # Stable public machine templates; do not inspect package source for shapes.
52
+ kdna-studio guide-agent --action create --json
53
+ # For every command below, the Host streams its private JSON/text request to
54
+ # stdin from memory. Private purpose, answers and judgments are not ordinary
55
+ # project files and never go in argv.
56
+ kdna-studio create-agent my_creation --input-stdin
57
+ kdna-studio inventory-agent my_creation --material ./notes.md \
58
+ --input-stdin --json
59
+ # After exact inventory/policy approval, deliver only the accepted source.
60
+ private_material_file="$(mktemp)"
61
+ chmod 600 "$private_material_file"
62
+ trap 'rm -f "$private_material_file"' EXIT INT TERM
63
+ kdna-studio deliver-material my_creation \
64
+ --input-stdin \
65
+ --private-output-file "$private_material_file" --json
66
+ kdna-studio guide-agent my_creation --json
67
+ kdna-studio resume my_creation --json
68
+ kdna-studio status my_creation --json
69
+ kdna-studio answer my_creation --input-stdin
70
+ kdna-studio review my_creation --input-stdin
71
+ kdna-studio try my_creation --input-stdin
72
+ kdna-studio repair my_creation --input-stdin
73
+ kdna-studio export-agent my_creation --json
74
+ # Only after all three gates bind the same exact managed candidate:
75
+ kdna-studio finalize-agent my_creation --out dist/my_creation.kdna --json
76
+ ```
77
+
78
+ For an approved named remote processor, the Host reads the mode-0600 temporary
79
+ file into that named model context and deletes it in `finally`. A dedicated
80
+ adapter may use fd 3 instead. This is Host-declared remote processing under the
81
+ named provider retention boundary; it is not verified-local or a claim that
82
+ model input is log-free. The generic CLI fails closed when separately attested
83
+ local processing is required.
84
+
85
+ The machine API uses a Host-generated, caller-stable operation coordinate.
86
+ Exact retry is inert while its semantic coordinate remains current; stale
87
+ semantic replay and changed input, material bytes, output path, or protection
88
+ mode fail closed. This is a Host automation contract, not a user prompt.
89
+
90
+ `status` reports the next unresolved decision plus the separate
91
+ `JUDGMENT_ACCEPTED`, `FORMAT_VALID`, and `APPLICATION_VERIFIED` gates.
92
+ `compile_ready` is only readiness to build a managed candidate. `export-agent`
93
+ can establish the exact-byte format gate but never writes an incomplete
94
+ candidate to the user's final path. Later official Host orchestration freezes
95
+ the `application-adoption-fidelity` plan, loads the exact managed bytes in a
96
+ fresh Consumer context, and obtains independent evaluation and scenario-local
97
+ stability evidence. The ordinary user does not assemble role keys, signatures,
98
+ plans, or receipts.
99
+
100
+ The machine-readable envelope exposes private Creation vocabulary and recovery
101
+ coordinates needed for another Agent to resume. It is not ordinary log
102
+ content. It does not return source bodies, absolute source paths, passwords,
103
+ decrypted payloads, or private keys. See
104
+ [Terminal Agent Creation](docs/TERMINAL_AGENT_CREATION.md) and the
105
+ [command contract](docs/CREATION_COMMAND_CONTRACT.md).
106
+
107
+ The expert authoring surface remains available:
108
+
30
109
  ```bash
31
110
  kdna-studio create my_domain --name @yourscope/my_domain
32
111
  kdna-studio import my_domain ./notes.md
@@ -74,47 +153,73 @@ kdna load dist/my_domain.kdna --profile=compact --as=prompt
74
153
  runtime control plane for inspecting, validating, packing, unpacking, and
75
154
  loading existing `.kdna` assets.
76
155
 
77
- ## 5-minute first asset
156
+ ## First small asset
78
157
 
79
- If you just installed and want to ship a KDNA asset without an LLM:
158
+ Tell a compatible terminal Agent:
80
159
 
81
- ```bash
82
- # 1. Create a project
83
- kdna-studio create my_domain --name @yourscope/my_domain
160
+ > Create a KDNA that keeps new titles to eight words or fewer. Use
161
+ > `./title-notes.md`. This current remote terminal Host may process that exact
162
+ > file under its named provider retention policy.
163
+ > Save the result as an ordinary local file, but do not publish or share it.
84
164
 
85
- # 2. Add at least one judgment card
86
- kdna-studio card add my_domain axiom \
87
- --field one_sentence='specific evidence outranks broad claims' \
88
- --field full_statement='Always cite the specific source that supports a judgment; broad claims without evidence are the most common cause of bad agent advice.' \
89
- --field why='because vague advice fails in production' \
90
- --field applies_when='["reviewing"]' \
91
- --field does_not_apply_when='["formatting"]' \
92
- --field failure_risk='praise without diagnosis' \
93
- --field confidence='high' \
94
- --field evidence_type='practice'
165
+ The Agent chooses the private machine fields, previews material without
166
+ reading it, binds the exact preview when it matches the user's stated
167
+ authorization, and shows the next meaningful semantic decision. It asks again
168
+ only for an unexpected scope, sensitive item, coverage gap, destination
169
+ change, or genuine ambiguity. One material file, one complete Judgment Unit,
170
+ no relation, and no correction can be sufficient. Zero-material
171
+ interview-first work, small collections, and paged large collections use the
172
+ same state machine; file count is not an acceptance score.
95
173
 
96
- # 3. Optional: approve and record Human Lock provenance
97
- kdna-studio card approve my_domain --all --by me --statement "i confirm"
174
+ Verified local-only processing is available only through a separately trusted
175
+ local Host adapter. A remote terminal Host must fail before reading when the
176
+ user requires verified-local handling; fd 3 or a caller-supplied digest cannot
177
+ upgrade remote processing into a locality proof.
98
178
 
99
- # 4. Export the asset
100
- kdna-studio export my_domain --out my_domain.kdna
179
+ A review can confirm `reviewed-no-change`. Highest question, worldview, value
180
+ order, priority, exception, conflict, and other complex structures appear only
181
+ when the actual asset needs them.
101
182
 
102
- # 5. Verify with the runtime CLI
103
- kdna load my_domain.kdna --profile=compact
104
- ```
183
+ An explicitly approved material source can also be a current packaged `.kdna`.
184
+ It is validated,
185
+ authorized-loaded, Studio-reimported, and converted into reviewable derivation
186
+ candidates without copying its raw payload into the workspace. Protected
187
+ source assets use `--password-stdin`. Directory shape alone does not declare
188
+ material historical, current, migrated, owned, or authoritative; every source
189
+ starts with an honest unknown/review state.
105
190
 
106
- The first three AI commands (feynman, distill --ai, test, interview) work
107
- without `KDNA_LLM_PROVIDER` / `KDNA_LLM_API_KEY` by passing `--no-llm`. They
108
- return a structured but unsynthesised result. To enable real evaluation:
191
+ The expert `distill --ai` and `interview` commands can use a configured model
192
+ provider:
109
193
 
110
194
  ```bash
111
- kdna-studio llm config --provider openai --model gpt-4 --key <your-key>
112
- # or set KDNA_LLM_PROVIDER, KDNA_LLM_API_KEY, KDNA_LLM_MODEL
195
+ printf '%s\n' "$KDNA_LLM_API_KEY" | \
196
+ kdna-studio llm config --provider openai --model gpt-4 --key-pipe
197
+ # Provider/model/key environment variables can also configure a one-shot run.
113
198
  ```
114
199
 
200
+ External AI providers must use a canonical HTTPS base URL. Plain HTTP is
201
+ accepted only for local development at the exact numeric loopback hosts
202
+ `127.0.0.1` or `[::1]`; `localhost`, LAN addresses, URL credentials, query
203
+ strings, and fragments are rejected. Provider redirects are not followed with
204
+ API keys or authoring material, and provider response bodies are not copied
205
+ into CLI errors.
206
+
207
+ The Creation Engine `try` command records semantic examples and their reviewed
208
+ results; it is separate from the retired Test Lab UI. Test Lab and Feynman
209
+ workshop implementations remain in the source repository
210
+ for research and regression coverage. Published releases up to and including
211
+ 0.10.2 shipped them as CLI commands in the npm tarball; the current
212
+ development line removes them from the default CLI and from the npm release
213
+ tarball, effective with the next release after 0.10.2. The public CLI
214
+ contract remains the create, review, compile, and export path shown above.
215
+
115
216
  ## Runtime Export Contract
116
217
 
117
- `kdna-studio export` is the canonical runtime export path. It uses
218
+ `kdna-studio export-agent` creates the managed candidate and may establish its
219
+ exact-byte `FORMAT_VALID` result. It is not Creation Accepted or
220
+ `CREATION_COMPLETE`; final delivery remains blocked until all three gates bind
221
+ that same candidate.
222
+ `kdna-studio export` remains the expert Studio-project export path. Both use
118
223
  `@aikdna/kdna-studio-core` to compile the Studio project into the current KDNA
119
224
  runtime asset and then packs it with `@aikdna/kdna-core`.
120
225
 
@@ -156,6 +261,11 @@ kdna-studio identity init --name "Your Name"
156
261
  kdna-studio identity show
157
262
  ```
158
263
 
264
+ A configured machine-local identity is not inherited by `create` or `migrate`.
265
+ Use `--use-local-identity` only when that identity is intentionally the creator
266
+ for the current work. Signing and identity-management commands continue to
267
+ load identity explicitly.
268
+
159
269
  ## Import from existing KDNA or legacy folders
160
270
 
161
271
  ```bash
@@ -171,6 +281,11 @@ Current `.kdna` imports also preserve explicitly declared `highest_question`,
171
281
  project. Re-export writes those values back exactly; Studio does not infer a
172
282
  replacement judgment core from an axiom.
173
283
 
284
+ Imports preserve authored source references, `core_structure` relations,
285
+ pattern subtypes, scenario and case metadata, extended reasoning fields, and
286
+ source-authored evolution. Studio-only card state and lock audit records remain
287
+ authoring provenance and are not rewritten as Runtime judgment evolution.
288
+
174
289
  ## Related
175
290
 
176
291
  - [KDNA Core](https://github.com/aikdna/kdna) — Official format specification