@dannylee1020/kkt 0.5.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.
Files changed (50) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +275 -0
  3. package/assets/kkt-readme-modern.png +0 -0
  4. package/bin/kkt-install.mjs +25 -0
  5. package/cmd/kkt/main.go +15 -0
  6. package/go.mod +3 -0
  7. package/internal/workflow/cli.go +349 -0
  8. package/internal/workflow/cli_test.go +1266 -0
  9. package/internal/workflow/guardrails.go +900 -0
  10. package/internal/workflow/init.go +164 -0
  11. package/internal/workflow/init_test.go +113 -0
  12. package/internal/workflow/operations.go +1855 -0
  13. package/internal/workflow/validation_commands.go +291 -0
  14. package/internal/workflow/workspace.go +802 -0
  15. package/internal/workflow/workspace_test.go +285 -0
  16. package/package.json +45 -0
  17. package/scripts/install-cli.sh +210 -0
  18. package/scripts/install.sh +644 -0
  19. package/skills/kkt/SKILL.md +74 -0
  20. package/skills/kkt/references/discovery-tooling.md +53 -0
  21. package/skills/kkt/references/feature-optimization-model.md +120 -0
  22. package/skills/kkt/references/kkt-kernel.md +58 -0
  23. package/skills/kkt/references/layered-modeling-methods.md +101 -0
  24. package/skills/kkt/references/plan-assimilation.md +46 -0
  25. package/skills/kkt/references/schemas.md +231 -0
  26. package/skills/kkt/references/state-contract.md +76 -0
  27. package/skills/kkt-loop/SKILL.md +99 -0
  28. package/skills/kkt-loop/references/discovery-tooling.md +53 -0
  29. package/skills/kkt-loop/references/feature-optimization-model.md +120 -0
  30. package/skills/kkt-loop/references/kkt-kernel.md +58 -0
  31. package/skills/kkt-loop/references/layered-modeling-methods.md +101 -0
  32. package/skills/kkt-loop/references/plan-assimilation.md +46 -0
  33. package/skills/kkt-loop/references/schemas.md +231 -0
  34. package/skills/kkt-loop/references/state-contract.md +76 -0
  35. package/skills/kkt-model/SKILL.md +76 -0
  36. package/skills/kkt-model/references/discovery-tooling.md +53 -0
  37. package/skills/kkt-model/references/feature-optimization-model.md +120 -0
  38. package/skills/kkt-model/references/kkt-kernel.md +58 -0
  39. package/skills/kkt-model/references/layered-modeling-methods.md +101 -0
  40. package/skills/kkt-model/references/plan-assimilation.md +46 -0
  41. package/skills/kkt-model/references/schemas.md +231 -0
  42. package/skills/kkt-model/references/state-contract.md +76 -0
  43. package/skills/kkt-run/SKILL.md +62 -0
  44. package/skills/kkt-run/references/discovery-tooling.md +53 -0
  45. package/skills/kkt-run/references/feature-optimization-model.md +120 -0
  46. package/skills/kkt-run/references/kkt-kernel.md +58 -0
  47. package/skills/kkt-run/references/layered-modeling-methods.md +101 -0
  48. package/skills/kkt-run/references/plan-assimilation.md +46 -0
  49. package/skills/kkt-run/references/schemas.md +231 -0
  50. package/skills/kkt-run/references/state-contract.md +76 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,275 @@
1
+ ![kkt](assets/kkt-readme-modern.png)
2
+
3
+ <p align="center">
4
+ <strong>Start modeling your implementation</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/dannylee1020/kkt/actions/workflows/release-binaries.yml"><img alt="ci status" src="https://img.shields.io/github/actions/workflow/status/dannylee1020/kkt/release-binaries.yml?label=ci"></a>
9
+ <a href="https://github.com/dannylee1020/kkt/actions/workflows/codeql.yml"><img alt="security status" src="https://img.shields.io/github/actions/workflow/status/dannylee1020/kkt/codeql.yml?label=security"></a>
10
+ <a href="https://github.com/dannylee1020/kkt/releases/latest"><img alt="release version" src="https://img.shields.io/github/v/release/dannylee1020/kkt?sort=semver&display_name=tag"></a>
11
+ <a href="LICENSE"><img alt="license: Apache 2.0" src="https://img.shields.io/badge/license-Apache--2.0-2563eb.svg"></a>
12
+ </p>
13
+
14
+ <hr style="width: 100%; border: 0; border-top: 2px solid #e5e7eb;">
15
+
16
+ kkt applies [constrained optimization](https://en.wikipedia.org/wiki/Constrained_optimization) to coding-agent workflows. Named after the [Karush-Kuhn-Tucker conditions](https://en.wikipedia.org/wiki/Karush%E2%80%93Kuhn%E2%80%93Tucker_conditions), it translates mathematical modeling discipline into a practical framework for identifying application constraints, choosing feasible implementation paths, and validating the result.
17
+
18
+ ## How It Works
19
+
20
+ ```text
21
+ Without KKT:
22
+
23
+ request --> agent --> plan --> edits --> validation
24
+
25
+
26
+ With KKT:
27
+
28
+ request --> agent --> (model constraints --> model optimized path) --> edits --> validation
29
+ |
30
+ v
31
+ objective + decision variables + proof
32
+ ```
33
+
34
+
35
+ ## The Model
36
+
37
+ The core idea:
38
+
39
+ ```text
40
+ choose
41
+ x in X
42
+
43
+ maximize
44
+ alignment(user_goal, x)
45
+
46
+ subject to
47
+ C_app(x)
48
+ C_arch(x)
49
+ C_data(x)
50
+ C_ui(x)
51
+ C_infra(x)
52
+ C_validation(x)
53
+ ```
54
+
55
+ where:
56
+
57
+ - `x` is the implementation decision vector
58
+ - `X` is the feasible implementation region
59
+ - `C_*` are application constraints
60
+ - the selected plan is the best feasible plan, not the first plausible plan
61
+ - validation is the certificate that the selected plan satisfies the model
62
+
63
+ kkt does not implement a literal numerical solver. It borrows the discipline of constrained optimization and applies it to coding-agent decisions: feasibility first, optimization second, validation as the certificate.
64
+
65
+ ## Install
66
+
67
+ Recommended full install via npm:
68
+
69
+ ```bash
70
+ npx @dannylee1020/kkt install --target all
71
+ ```
72
+
73
+ The installer does three things:
74
+
75
+ - installs the KKT skills into supported coding-agent skill directories
76
+ - installs `ast-grep` for syntax-aware structural discovery when it is missing
77
+ - installs the `kkt` CLI used by those skills for deterministic workflow and validation
78
+
79
+ Common options:
80
+
81
+ ```bash
82
+ npx @dannylee1020/kkt install --target codex
83
+ npx @dannylee1020/kkt install --target claude
84
+ npx @dannylee1020/kkt install --target pi
85
+ npx @dannylee1020/kkt install --target opencode
86
+ npx @dannylee1020/kkt upgrade --target all
87
+ npx @dannylee1020/kkt install --bin-dir ~/.local/bin
88
+ ```
89
+
90
+ Pi users who only want the skills can install the package directly:
91
+
92
+ ```bash
93
+ pi install npm:@dannylee1020/kkt
94
+ ```
95
+
96
+ The Pi package path loads skills but does not install the companion Go CLI. Use the full `npx` installer when you need durable `.kkt/` state, guardrails, and validation commands.
97
+
98
+ Alternative curl installer:
99
+
100
+ ```bash
101
+ curl -fsSL https://raw.githubusercontent.com/dannylee1020/kkt/main/scripts/install.sh | bash
102
+ ```
103
+
104
+ The CLI is downloaded as a release binary when available, or built from source with Go. Use `KKT_VERSION` to pin a release tag, or `KKT_BINARY_URL` to install from an explicit binary URL.
105
+
106
+ ## Why KKT
107
+
108
+ Most coding-agent workflows turn a request into a plan. That helps, but it carries risk: the plan focuses on what to change, not what must stay unchanged.
109
+
110
+ kkt shifts the frame from planning to modeling, so the solution is built around the constraints already present in the codebase. It treats implementation as a constrained optimization problem: define the objective, mark the boundaries that cannot move, compare the viable paths, and name the proof that will make the result credible.
111
+
112
+ Instead of:
113
+
114
+ ```text
115
+ build xyz
116
+ ```
117
+
118
+ kkt pushes the agent toward:
119
+
120
+ ```text
121
+ what is the best feasible implementation,
122
+ given what must stay true?
123
+ ```
124
+
125
+ For coding agents, "what must stay true" is usually concrete:
126
+
127
+ - public contracts and API behavior
128
+ - architecture boundaries
129
+ - files, modules, endpoints, schemas, and migrations
130
+ - security, privacy, and data-integrity rules
131
+ - UI and product boundaries
132
+ - infrastructure and runtime limits
133
+ - validation evidence required before completion
134
+
135
+ the value is forcing feasibility before optimization: reject plans that violate hard constraints, compare the remaining plans, choose the best feasible path, then validate against the model.
136
+
137
+
138
+ ## KKT and Plan Mode
139
+
140
+ KKT supports two realistic entry paths.
141
+
142
+ Use KKT directly when you want it to substitute for default plan mode. In this path, KKT owns intent capture, discovery, feasibility checks, selected implementation model, approval, execution, and validation proof.
143
+
144
+ Use KKT after plan mode when a default plan already exists. In this path, the prior plan is useful scaffolding, but it is not a contract. KKT extracts whatever is useful, classifies claims as user input, assumptions, discoverable facts, candidate decisions, candidate constraints, or candidate validation, then verifies repo facts before turning them into the optimized model.
145
+
146
+ kkt answers: "Which implementation is optimal inside these constraints?"
147
+
148
+ | plan mode | kkt |
149
+ | --- | --- |
150
+ | discovery, preliminary findings, and sequencing | deeper implementation model around constraints |
151
+ | may describe steps before formal feasibility checks | requires objective, constraints, decision variables, and selected feasible path |
152
+ | often lives in the chat context | can persist workflow state under project-root `.kkt/` when useful |
153
+ | validates after implementation | defines validation proof before implementation |
154
+ | good for lightweight coordination | useful when correctness depends on preserving boundaries |
155
+
156
+ Use plan mode or KKT interchangeably when the task is small and low-risk. For more complex work, either start directly with KKT or start in plan mode to surface context and preliminary options, then ask the agent to use KKT to optimize the implementation path against the constraints. KKT cannot control a host agent's internal plan-mode output; it can only consume that output, verify it, and rebuild the contract inside KKT.
157
+
158
+ ## Quick Start
159
+
160
+ Most users start with `$kkt`:
161
+
162
+ ```text
163
+ $kkt <feature, bug fix, or refactor>
164
+ ```
165
+
166
+ Use the deeper workflows when the task needs them:
167
+
168
+ ```text
169
+ $kkt-model <architecture or tradeoff question>
170
+ $kkt-run <implement completed model>
171
+ $kkt-loop <long-running implementation>
172
+ ```
173
+
174
+ Skill invocation syntax varies by agent:
175
+
176
+ ```text
177
+ Codex: $kkt, $kkt-model, $kkt-run, $kkt-loop
178
+ Claude Code: /kkt, /kkt-model, /kkt-run, /kkt-loop
179
+ Pi: /skill:kkt, /skill:kkt-model, /skill:kkt-run, /skill:kkt-loop
180
+ OpenCode: ask OpenCode to use the relevant kkt skill
181
+ ```
182
+
183
+ ## Choose a Workflow
184
+
185
+ | workflow | use it for | what it produces | durable state |
186
+ | --- | --- | --- | --- |
187
+ | `$kkt` | normal feature work, bug fixes, and refactors | compact model, approval, implementation, validation | optional `.kkt/kkt.yaml` |
188
+ | `$kkt-model` | architecture choices and tradeoff analysis | selected model or decision brief | `.kkt/model/<slug>/` |
189
+ | `$kkt-run` | implementation from a completed model | approved execution with deterministic drift checks | `.kkt/run/<slug>/` |
190
+ | `$kkt-loop` | long-running or continuation-heavy work | durable workspace, progress, evidence, completion audit | `.kkt/loop/<slug>/` |
191
+
192
+ KKT is skill-first. The skills are what you invoke from your coding agent. The CLI is the deterministic tool those skills use for `.kkt/` scaffolding, status, guardrails, state persistence, and validation.
193
+
194
+ kkt turns rough input into an intent frame:
195
+
196
+ ```text
197
+ user goal
198
+ desired behavior
199
+ user-visible success
200
+ scope boundary
201
+ explicit user constraints
202
+ ```
203
+
204
+ The user does not need to provide all of this upfront. Repo constraints, affected files, and validation paths are discovered from the codebase when possible and marked as assumptions when needed.
205
+
206
+ When KKT is invoked after a prior plan, it treats the plan as untrusted scaffold:
207
+
208
+ ```text
209
+ plan output --> extract signals --> classify claims --> verify facts --> optimize KKT model
210
+ ```
211
+
212
+ Plan claims do not become KKT facts until KKT verifies them or explicitly carries them as assumptions.
213
+
214
+ Before edits, the selected model should name:
215
+
216
+ - objective function
217
+ - files or surfaces to modify
218
+ - hard and soft constraint functions
219
+ - decision variables with chosen values
220
+ - validation proof required for completion
221
+
222
+ Expected final audit:
223
+
224
+ ```text
225
+ Objective: satisfied
226
+ Hard constraints: satisfied
227
+ Binding constraints: respected
228
+ Validation evidence: tests, checks, artifacts, or reason validation was not possible
229
+ Residual risk: remaining uncertainty
230
+ ```
231
+
232
+ ## CLI and State
233
+
234
+ Agent uses the cli to persist state across layers, continuation and agent turns.
235
+
236
+ Commands:
237
+
238
+ ```bash
239
+ kkt start plan|model|run|loop "<request>"
240
+ kkt status [--json]
241
+ kkt next [--json]
242
+ kkt show [artifact]
243
+ kkt guardrails show|set|validate
244
+ kkt judge --checkpoint model-ready|pre-mutation|continuation|finalize --json
245
+ kkt validate [--run]
246
+ kkt done
247
+ ```
248
+
249
+ Discovery uses agent tools directly. Use `rg` for broad text and file discovery, then use `ast-grep` for syntax-aware questions such as call sites, imports, handlers, declarations, component patterns, and error-handling shapes. Optional helpers such as `fd`, `ctags`, `tokei`, and repo-native language tools are used when available, but discovery should not be routed through a KKT CLI command.
250
+
251
+ Advanced workflow commands:
252
+
253
+ ```bash
254
+ kkt intent|discovery|model --method <method> "<layer output>"
255
+ kkt run from-model [model-workspace]
256
+ kkt evidence --for <criterion-id> --command "<command>" "<validation evidence>"
257
+ kkt criteria add|satisfy|block
258
+ kkt task add|start|done|skip|block
259
+ kkt approve
260
+ kkt block
261
+ kkt resume
262
+ kkt replay --check
263
+ ```
264
+
265
+ All durable state lives under the project root's `.kkt/`. For plan-tier work, `.kkt/kkt.yaml` can carry the compact planning contract. For model, run, and loop workspaces, Markdown files hold richer context, and `guardrails.json` carries the deterministic drift contract.
266
+
267
+ For run and loop workspaces, `kkt judge` checks explicit workflow state: approval, validation, replay state, stop conditions, and changed-path bounds. It is deterministic; semantic code-behavior judgment is not claimed as part of the current guardrail layer.
268
+
269
+ When guardrails list `validation.required_commands`, use `kkt validate --run` to execute and record deterministic command proof. `kkt evidence` records narrative evidence and criterion mapping; it does not satisfy required command proof by itself.
270
+
271
+ For loop workspaces, `kkt.yaml` is the canonical current contract, `events.jsonl` is the append-only audit and resume history, and `kkt replay --check` reports drift between the event history and current state without mutating either file.
272
+
273
+ ## License
274
+
275
+ Apache-2.0
Binary file
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "node:child_process";
3
+ import { dirname, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
7
+ const script = resolve(root, "scripts/install.sh");
8
+
9
+ const child = spawn("bash", [script, ...process.argv.slice(2)], {
10
+ stdio: "inherit",
11
+ env: process.env,
12
+ });
13
+
14
+ child.on("exit", (code, signal) => {
15
+ if (signal) {
16
+ process.kill(process.pid, signal);
17
+ return;
18
+ }
19
+ process.exit(code ?? 1);
20
+ });
21
+
22
+ child.on("error", (error) => {
23
+ console.error(`Failed to start KKT installer: ${error.message}`);
24
+ process.exit(1);
25
+ });
@@ -0,0 +1,15 @@
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "os"
6
+
7
+ "github.com/dannylee1020/kkt/internal/workflow"
8
+ )
9
+
10
+ func main() {
11
+ if err := workflow.Run(os.Args[1:], os.Stdout, os.Stderr); err != nil {
12
+ fmt.Fprintln(os.Stderr, err)
13
+ os.Exit(1)
14
+ }
15
+ }
package/go.mod ADDED
@@ -0,0 +1,3 @@
1
+ module github.com/dannylee1020/kkt
2
+
3
+ go 1.22