@tuned-tensor/cli 0.16.0 → 0.17.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.
@@ -0,0 +1,110 @@
1
+ # Work from the behavior spec
2
+
3
+ Explore the [interactive architecture diagram](spec-architecture.html) for source
4
+ excerpts, code structure and command examples. Open the HTML file in a browser.
5
+
6
+ `tunedtensor.json` is the local recipe for the model's behavior, examples and
7
+ training settings. Ask the agent to improve that recipe, review the proposed
8
+ diff, approve the edit, then preview or execute a pipeline against the saved spec.
9
+ The agent reads the actual file before proposing changes; it does not use the
10
+ conversation transcript as a replacement for the current spec.
11
+
12
+ ## Review without a model call
13
+
14
+ Inside the TT shell, in your project directory:
15
+
16
+ ```text
17
+ /spec
18
+ /spec validate
19
+ /spec diff
20
+ /spec history
21
+ ```
22
+
23
+ `/spec` shows the complete current file, validation results and SHA-256.
24
+ `/spec diff` shows pending spec edits in the current conversation; otherwise it
25
+ shows the latest approved edit, or external changes since that revision.
26
+ `/spec history` lists up to 50 recent revision records. These commands require
27
+ no credentials and work before the agent is configured.
28
+
29
+ Outside the shell, use `tt spec show`, `tt spec validate`, `tt spec diff`, and
30
+ `tt spec history`. Add a workspace-relative path, for example
31
+ `tt spec show feedback/tunedtensor.json`. For continued work on a nested
32
+ project, `/cd feedback` makes its `tunedtensor.json` the current recipe.
33
+ `--json` returns structured review results. `tt spec validate` exits nonzero
34
+ for an invalid spec.
35
+
36
+ ## Edit, review, approve
37
+
38
+ ```text
39
+ › Keep my training settings, but require a single lowercase sentiment label.
40
+ [agent reads the spec and proposes a diff]
41
+ › /spec diff
42
+ › /approve
43
+ › /spec
44
+ › /spec history
45
+ ```
46
+
47
+ `get_local_spec` returns the document, validation diagnostics and content hash.
48
+ `prepare_update_local_spec` requires that hash and a patch of supported fields.
49
+ Arrays replace their whole field; `hyperparameters` and `foundation` merge by
50
+ key. Unmentioned fields remain unchanged. Identity and engine cannot change
51
+ through this edit tool. The full resulting document must pass the runtime's
52
+ strict schema, readiness checks, nonblank content checks and distinct-example
53
+ checks. Small example sets produce a warning; validation is not a claim of model
54
+ quality or GPU readiness.
55
+
56
+ Proposing an edit does not write anything. `/approve` revalidates the workspace,
57
+ parent directory, current file bytes and proposed result, acquires the spec's
58
+ writer lock and atomically replaces the file. `/reject` leaves it unchanged.
59
+ If the file changes after review, prepare a fresh edit. A saved edit invalidates
60
+ any previously prepared pipeline preview for the old spec.
61
+
62
+ Secure agent edits currently require Linux filesystem handles. Reads work on
63
+ other supported CLI platforms; edit the JSON with your editor there. Spec reads
64
+ and edits are bounded to 200 KB. Large model-facing proposals may hit the
65
+ agent's existing smaller review budget; split the request or use your editor.
66
+
67
+ Revision records live beside the spec under `.tuned-tensor/spec-history/` and
68
+ contain before/after snapshots and hashes. They can contain your training
69
+ examples. They use private permissions. History records changes made through
70
+ this edit workflow; it is not a file watcher or a complete history of external
71
+ editor changes. A `prepared` record without an `applied` record is an incomplete
72
+ journal entry: inspect the current file and its hash before attempting another
73
+ edit. A crashed writer can leave `.tunedtensor-spec.lock`; after confirming no
74
+ TT writer is still running, remove that lock manually. The lock coordinates TT
75
+ writers; avoid concurrent external editor saves during approval.
76
+
77
+ ## Execute the saved recipe
78
+
79
+ ```bash
80
+ tt spec validate
81
+ tt pipeline run --spec tunedtensor.json --dry-run
82
+ tt pipeline run --spec tunedtensor.json
83
+ ```
84
+
85
+ The default pipeline derives from the current spec. An adjacent
86
+ `tunedtensor.pipeline.json` is no longer loaded implicitly. To select an advanced
87
+ recipe explicitly, pass `--file`; a missing explicit recipe or `--spec` file fails. Foundation
88
+ training parameters in an explicit recipe must agree with the spec, including
89
+ in previews and the runtime's own execution guard. Change the spec and regenerate
90
+ the recipe when they disagree. Explicit recipes may still select supported
91
+ stages; `--only` and `--skip` remain available.
92
+
93
+ CLI planning, validation, execution and agent pipeline proposals share
94
+ `pipelineForRunInput` in `src/pipeline.ts`. It uses the same
95
+ `validateBehaviorSpec` rules as spec review and editing, defined beside the
96
+ runtime parser in `src/local-runtime/local-project.ts`. The edit module only
97
+ owns workspace access, patches and revision history.
98
+
99
+ The command reads one spec snapshot for planning, hardware warnings and execution. Plan/dry-run
100
+ JSON and final result JSON identify its path and SHA-256. The spec's compiled
101
+ instructions and examples feed training and task evaluation; the independently
102
+ configured general-regression suite keeps its own prompt. Provider choice and
103
+ GPU placement remain separate runtime choices in agent configuration and
104
+ `local-runner.json`. Evaluation policy (inference/scoring settings and the
105
+ general-regression suite) also remains in the runner config. Moving that policy
106
+ into the spec would be a separate schema change.
107
+
108
+ Agent `/approve` for a pipeline still runs a preview only. Real training uses
109
+ the direct command above. The spec is the behavior recipe; approval of a spec
110
+ edit is not approval to launch training.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuned-tensor/cli",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Local TT agent and CUDA fine-tuning CLI for Tuned Tensor workflows",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,6 +34,8 @@
34
34
  "training/foundation/uv.lock",
35
35
  "training/foundation/src/*.py",
36
36
  "docs/local-runtime",
37
+ "docs/spec-workflow.md",
38
+ "docs/spec-architecture.html",
37
39
  "examples/local-runtime/*.json",
38
40
  "examples/local-runtime/*.jsonl"
39
41
  ],