@kriya-ai/harness 0.0.0-stage → 0.2.1

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 (185) hide show
  1. package/README.md +379 -2
  2. package/SAFETY.md +162 -0
  3. package/THIRD_PARTY_NOTICES.md +7911 -0
  4. package/bin/kriya.js +577 -0
  5. package/bundle/cordis.patch.yml +397 -0
  6. package/contract/SOURCE.md +15 -0
  7. package/contract/contract.json +1355 -0
  8. package/package.json +57 -4
  9. package/plugins/anchor/index.js +56 -0
  10. package/plugins/anchor/package.json +13 -0
  11. package/plugins/approvals/index.js +183 -0
  12. package/plugins/approvals/package.json +13 -0
  13. package/plugins/brand/DESIGN.md +112 -0
  14. package/plugins/brand/client.js +826 -0
  15. package/plugins/brand/index.js +15 -0
  16. package/plugins/brand/package.json +25 -0
  17. package/plugins/brand/src/client.js +823 -0
  18. package/plugins/browser/index.js +218 -0
  19. package/plugins/browser/package.json +13 -0
  20. package/plugins/budget/index.js +108 -0
  21. package/plugins/budget/package.json +13 -0
  22. package/plugins/changes/client.js +245 -0
  23. package/plugins/changes/index.js +75 -0
  24. package/plugins/changes/package.json +22 -0
  25. package/plugins/edit/client.js +113 -0
  26. package/plugins/edit/index.js +58 -0
  27. package/plugins/edit/package.json +23 -0
  28. package/plugins/fs-freshness/index.js +28 -0
  29. package/plugins/fs-freshness/package.json +13 -0
  30. package/plugins/graph/client.js +178 -0
  31. package/plugins/graph/index.js +4 -0
  32. package/plugins/graph/package.json +22 -0
  33. package/plugins/kriya-handoff/index.js +194 -0
  34. package/plugins/kriya-handoff/package.json +13 -0
  35. package/plugins/kriya-tools/index.js +189 -0
  36. package/plugins/kriya-tools/package.json +13 -0
  37. package/plugins/loop/index.js +743 -0
  38. package/plugins/loop/package.json +13 -0
  39. package/plugins/mirror/index.js +235 -0
  40. package/plugins/mirror/package.json +13 -0
  41. package/plugins/overview/client.js +276 -0
  42. package/plugins/overview/index.js +95 -0
  43. package/plugins/overview/package.json +22 -0
  44. package/plugins/preview/client.js +337 -0
  45. package/plugins/preview/index.js +4 -0
  46. package/plugins/preview/package.json +22 -0
  47. package/plugins/progress/client.js +290 -0
  48. package/plugins/progress/index.js +100 -0
  49. package/plugins/progress/package.json +22 -0
  50. package/plugins/projects/client.js +249 -0
  51. package/plugins/projects/index.js +30 -0
  52. package/plugins/projects/package.json +24 -0
  53. package/plugins/rea/index.js +256 -0
  54. package/plugins/rea/package.json +10 -0
  55. package/plugins/rea/skill/LICENSE +21 -0
  56. package/plugins/rea/skill/SKILL.md +360 -0
  57. package/plugins/rea/skill/references/android-applications.md +36 -0
  58. package/plugins/rea/skill/references/connection-and-recovery.md +127 -0
  59. package/plugins/rea/skill/references/evidence-workflows.md +71 -0
  60. package/plugins/rea/skill/references/javascript-applications.md +218 -0
  61. package/plugins/rea/skill/references/native-and-artifacts.md +297 -0
  62. package/plugins/rea/skill/references/runtime-observation.md +78 -0
  63. package/plugins/remote/index.js +297 -0
  64. package/plugins/remote/package.json +10 -0
  65. package/plugins/router/index.js +84 -0
  66. package/plugins/router/package.json +13 -0
  67. package/plugins/sessions/client.js +68 -0
  68. package/plugins/sessions/index.js +79 -0
  69. package/plugins/sessions/package.json +20 -0
  70. package/plugins/skills/client.js +504 -0
  71. package/plugins/skills/index.js +166 -0
  72. package/plugins/skills/package.json +23 -0
  73. package/src/api.js +97 -0
  74. package/src/browser.js +286 -0
  75. package/src/changes.js +191 -0
  76. package/src/checkpoints.js +313 -0
  77. package/src/daemon.js +503 -0
  78. package/src/doctor.js +137 -0
  79. package/src/edit/core/anchors.js +102 -0
  80. package/src/edit/core/audio.js +158 -0
  81. package/src/edit/core/faces.js +99 -0
  82. package/src/edit/core/ffmpeg.js +258 -0
  83. package/src/edit/core/handoff.js +220 -0
  84. package/src/edit/core/history.js +90 -0
  85. package/src/edit/core/layout.js +92 -0
  86. package/src/edit/core/mix.js +115 -0
  87. package/src/edit/core/ops.js +602 -0
  88. package/src/edit/core/plan.js +266 -0
  89. package/src/edit/core/project.d.ts +134 -0
  90. package/src/edit/core/project.js +307 -0
  91. package/src/edit/core/reframe.js +125 -0
  92. package/src/edit/core/solver.js +416 -0
  93. package/src/edit/core/time.js +110 -0
  94. package/src/edit/core/tonemap.js +57 -0
  95. package/src/edit/director/ask.js +120 -0
  96. package/src/edit/director/gateway.js +16 -0
  97. package/src/edit/director/revise.js +186 -0
  98. package/src/edit/engine/capabilities.js +33 -0
  99. package/src/edit/engine/captions.js +154 -0
  100. package/src/edit/engine/color.js +269 -0
  101. package/src/edit/engine/confine.js +67 -0
  102. package/src/edit/engine/dna.js +148 -0
  103. package/src/edit/engine/index.js +473 -0
  104. package/src/edit/engine/loudness.js +43 -0
  105. package/src/edit/engine/media.js +57 -0
  106. package/src/edit/engine/motion.js +281 -0
  107. package/src/edit/engine/packs.js +87 -0
  108. package/src/edit/engine/probe.js +101 -0
  109. package/src/edit/engine/receipt.js +123 -0
  110. package/src/edit/engine/tool.js +101 -0
  111. package/src/edit/gates/copy.js +113 -0
  112. package/src/edit/gates/index.js +430 -0
  113. package/src/edit/gates/picture.js +130 -0
  114. package/src/edit/gates/sound.js +58 -0
  115. package/src/edit/gates/speech.js +127 -0
  116. package/src/edit/gates/text.js +196 -0
  117. package/src/edit/gates/text.swift +22 -0
  118. package/src/edit/graph/index.js +139 -0
  119. package/src/edit/graph/journal.js +69 -0
  120. package/src/edit/graph/scheduler.js +79 -0
  121. package/src/edit/host/client.js +58 -0
  122. package/src/edit/host/deliver.js +119 -0
  123. package/src/edit/host/jobs.js +84 -0
  124. package/src/edit/host/main.js +135 -0
  125. package/src/edit/host/paths.js +11 -0
  126. package/src/edit/host/projects.js +415 -0
  127. package/src/edit/host/server.js +391 -0
  128. package/src/edit/host/taste.js +135 -0
  129. package/src/edit/host/tavi.js +417 -0
  130. package/src/edit/host/watch.js +141 -0
  131. package/src/edit/index/db.js +109 -0
  132. package/src/edit/index/index.js +236 -0
  133. package/src/edit/index/layers/faces.js +78 -0
  134. package/src/edit/index/layers/faces.swift +18 -0
  135. package/src/edit/index/layers/meta.js +35 -0
  136. package/src/edit/index/layers/music.js +146 -0
  137. package/src/edit/index/layers/quality.js +120 -0
  138. package/src/edit/index/layers/retakes.js +132 -0
  139. package/src/edit/index/layers/screen.js +99 -0
  140. package/src/edit/index/layers/shots.js +29 -0
  141. package/src/edit/index/layers/sound.js +42 -0
  142. package/src/edit/index/layers/words.js +64 -0
  143. package/src/edit/index/story.js +248 -0
  144. package/src/edit/index/views.js +71 -0
  145. package/src/edit/loop/governor.js +112 -0
  146. package/src/edit/loop/loop.js +69 -0
  147. package/src/edit/loop/make.js +115 -0
  148. package/src/edit/loop/repair.js +97 -0
  149. package/src/edit/loop/replay.js +32 -0
  150. package/src/edit/recipes/multicam.js +461 -0
  151. package/src/edit/recipes/reel.js +202 -0
  152. package/src/edit/recipes/short-from-long.js +237 -0
  153. package/src/edit/recipes/tutorial.js +137 -0
  154. package/src/edit/recipes/youtube.js +155 -0
  155. package/src/edit/runtime/cli.js +126 -0
  156. package/src/edit/runtime/doctor.js +122 -0
  157. package/src/edit/runtime/fetch.js +15 -0
  158. package/src/edit/runtime/licences.js +88 -0
  159. package/src/edit/runtime/manifest.js +73 -0
  160. package/src/edit/runtime/setup.js +252 -0
  161. package/src/failure.js +69 -0
  162. package/src/gateway-proxy.js +213 -0
  163. package/src/intent.js +130 -0
  164. package/src/launch.js +315 -0
  165. package/src/live.js +81 -0
  166. package/src/local-skills.js +284 -0
  167. package/src/login.js +82 -0
  168. package/src/loop.js +428 -0
  169. package/src/modes.js +128 -0
  170. package/src/overview.js +71 -0
  171. package/src/paths.js +30 -0
  172. package/src/profiles.js +92 -0
  173. package/src/projects.js +104 -0
  174. package/src/recon.js +244 -0
  175. package/src/rules.js +139 -0
  176. package/src/runner.bundle.js +21172 -0
  177. package/src/sentinel.js +248 -0
  178. package/src/skill-switches.js +130 -0
  179. package/src/store.js +58 -0
  180. package/src/strict.js +124 -0
  181. package/src/verify.js +659 -0
  182. package/src/world.js +268 -0
  183. package/studio/dist/index.html +14 -0
  184. package/studio/dist/studio.css +163 -0
  185. package/studio/dist/studio.js +1 -0
package/README.md CHANGED
@@ -1,3 +1,380 @@
1
- # Temporary Holding Version
1
+ # Kriya Harness (beta)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Kriya agent on your own machine: it reads and changes files and runs
4
+ commands in a folder you choose, and uses your Kriya account's model
5
+ allowance. **Built on DeepSeek Harness** (MIT), as a pinned dependency
6
+ extended through its documented profile and plugin seams; DeepSeek Harness
7
+ itself isn't modified. Read [SAFETY.md](SAFETY.md) first.
8
+
9
+ Status: alpha (track H, phase H4). Not published to npm yet.
10
+
11
+ ## Use
12
+
13
+ Needs Node 24.9 or later.
14
+
15
+ ```bash
16
+ npm install
17
+ node bin/kriya.js login --url https://<your Kriya address>
18
+ ```
19
+
20
+ | Command | What it does |
21
+ | --- | --- |
22
+ | `kriya login [--url …] [--no-browser]` | Signs this device in: shows a code, opens Kriya's connect page, waits for you to approve it there |
23
+ | `kriya [--mode <mode>] [--no-open] [--port <n>]` | DeepSeek Harness's Web UI on `127.0.0.1`, with Kriya's models |
24
+ | `kriya run [--mode <mode>] "<job>" [--json]` | One job; prints the answer; exit 0 done, 1 failed |
25
+ | `kriya acp` | The same agent for editors that speak ACP v1 (Agent Client Protocol): your editor starts it and talks over stdin/stdout |
26
+ | `kriya handoff ["<note>"]` | Hands this repository's uncommitted work (HEAD must be on GitHub) to your Kriya agent in a cloud workspace; prints the thread's link |
27
+ | `kriya pull [<workspace id>]` | Brings a workspace's latest changes back on a new branch `kriya/pull-<id>` at its base commit (default: your last handoff) |
28
+ | `kriya serve [folder]` | Lets your Kriya agents' cloud tasks work on this machine, in new subfolders of `<folder>` (default: this folder), while it runs; see SAFETY.md |
29
+ | `kriya skills [link <folder> [--only a,b] \| unlink <name> \| off <name> [--everywhere] \| on <name>]` | Lists the `SKILL.md` skills the agent sees in this folder, which are off and the catalog's size; links a folder of skills into `~/.kriya/skills`; turns a skill off for this project (or everywhere) or back on |
30
+ | `kriya doctor` | Checks Node, the profiles, the sign-in and the gateway |
31
+ | `kriya logout` | Signs out here and revokes the device in Kriya |
32
+ | `kriya --version` | Versions of Kriya Harness and DeepSeek Harness |
33
+
34
+ Modes (`--mode`, default `ask`): `ask` works in this folder and asks before
35
+ anything beyond it; `auto` works in this folder without asking and refuses
36
+ the rest; `read` changes nothing; `plan` (`kriya run`) answers with a plan
37
+ and changes nothing; `full` has no sandbox and asks nothing. Details and
38
+ limits in [SAFETY.md](SAFETY.md). In the Web UI, switch with the Permissions
39
+ control or `/permission`, and plan first with `/plan`.
40
+
41
+ The Kriya loop's verify step (H14a; **on by default since 0.2.0**, `--no-loop`
42
+ or `KRIYA_LOOP=off` turns it off) gives the agent `kriya_verify`, which runs the check you confirmed
43
+ for the project and reports pass, fail, or blocked after 4 failed runs, from
44
+ its exit code alone. The agent is told never to say the work passes without
45
+ it. `kriya verify` lists the checks the project defines (package.json
46
+ scripts, Makefile, cargo, go, pytest…), `kriya verify use <number>` (or a
47
+ command in quotes) confirms one, and `kriya verify clear` forgets it. The
48
+ tool takes no command, so the model can't change what passing means; the
49
+ check runs like any bash command, in the session's folder under its mode's
50
+ sandbox. Without a confirmed check nothing runs and the work is "not
51
+ checked". Every run is recorded per session in
52
+ `~/.kriya/progress/<project>/<session>.md` (never in the project). Without
53
+ `--loop` the agent is exactly as before.
54
+
55
+ A pass covers the files it ran on (harness upgrade U8): each run records a
56
+ fingerprint of the working tree (HEAD, the changed and untracked files and
57
+ their contents, read without writing anything to `.git`). If files change
58
+ after the last pass, the verdict reads "not checked" again, and before the
59
+ turn ends the agent is sent back once to run the check again. A pass whose
60
+ work changed test or check files (tests, `package.json`, `pytest.ini` and
61
+ the like) names them, so you can see a test that was changed to pass.
62
+
63
+ Plans and steps (H14c, with the loop): for a task with several parts the
64
+ agent records a plan with `kriya_plan` (a goal and at most 7 ordered steps,
65
+ each with what is true when it's done), then runs each with `kriya_step`. A
66
+ step is built by a fresh agent that sees only the goal, the plan and its own
67
+ step; the harness then runs the check; on a failure a new builder gets the
68
+ check's real output, up to 4 runs, then the step is blocked and the agent
69
+ stops. Steps run in order, builders can't plan or run steps themselves, and
70
+ a session makes at most 3 plans (a new plan can't wipe out "blocked"
71
+ forever). The plan and every run are in the session's progress file. For a
72
+ single run, `KRIYA_VERIFY_CHECK="<command>"` in your shell sets the check
73
+ without `kriya verify use` (benchmarks use it with the visible tests).
74
+
75
+ Step checkpoints (H14b, with the loop): before each tool call that can
76
+ change files (write, edit, bash and the like), the working tree, tracked and
77
+ untracked files but never ignored ones, is saved as a commit on Kriya's own
78
+ ref, `refs/kriya/checkpoints/<session>/<n>`. `kriya undo` puts the files
79
+ back one step, `kriya undo --list` shows the checkpoints and `kriya undo
80
+ <number>` goes to one. Your branches, tags, stash, HEAD and index are never
81
+ touched (Kriya stages into its own index file under `~/.kriya`), so it works
82
+ mid-rebase too; what an undo replaces is saved first, so an undo can be
83
+ undone. Not in Read only, where nothing changes; outside a git repository
84
+ there are no checkpoints. The newest 100 per session are kept, and
85
+ `refs/kriya/*` isn't pushed by a normal `git push`.
86
+
87
+ Why these defaults (0.2.0): on KriyaBench's capability tasks with DeepSeek
88
+ V4.1 Flash, three runs each, the loop with the turn budget passed 18 of 21
89
+ task runs against 14 of 21 without them (every disagreement in its favour;
90
+ not yet significant at 95% with this few tasks), at about 1.4× the spend per
91
+ passed task. Confirm your project's check (`kriya verify`, then `kriya
92
+ verify use <number>`): the gain comes from running it. Full numbers in the
93
+ Kriya repository, `docs/kriya-harness/harness_upgradation/BENCHMARK_PLAN.md`.
94
+
95
+ Turn budget (harness upgrade U2; **on by default since 0.2.0**, `--no-budget`
96
+ or `KRIYA_BUDGET=off` turns it off) bounds each turn by code: at most 150 steps (`KRIYA_MAX_STEPS`),
97
+ 60 minutes (`KRIYA_TURN_MINUTES`) and 10 identical tool calls in a row
98
+ (`KRIYA_MAX_REPEATS`). Five steps before the step limit (or at 90% of the
99
+ time) the agent is told once to wrap up; at a limit the next step is
100
+ refused, so the turn ends "blocked" and `kriya run` exits 1, never
101
+ "completed". Each step's builder (`kriya_step`) has its own budget.
102
+ With `--no-budget` turns are unbounded, as before 0.2.0.
103
+
104
+ Kriya's host runs a web application firewall that reads request bodies, and
105
+ an agent's conversation (commands, HTML, test code) can look like an attack
106
+ to it. `kriya` therefore starts a local relay (loopback only, random port)
107
+ between DeepSeek Harness and Kriya: when Kriya says it decodes them, JSON
108
+ request bodies go gzip-compressed and base64-encoded, and a firewall block
109
+ is reported as "Kriya's host firewall blocked this request (request ID …)"
110
+ instead of "API key is invalid". The relay adds no credential and only
111
+ forwards the harness API to the Kriya you signed in to. `KRIYA_RELAY=off`
112
+ talks to Kriya directly, as before.
113
+
114
+ Step builders (with the loop, whatever `--no-budget` says) are bounded more
115
+ tightly: at most 40 steps (`KRIYA_BUILDER_STEPS`) and 15 minutes
116
+ (`KRIYA_BUILDER_MINUTES`) per builder. Eight steps before the limit (or at
117
+ 80% of the time) the builder is told once to wrap up; at the limit its next
118
+ step is refused, a tool call that never returns is cut off a minute later,
119
+ and the project's check still runs on what it left (the step result says
120
+ the builder was stopped). The Progress tab shows the step being built, the
121
+ builder's steps, minutes and latest tool while it works. With no confirmed
122
+ check, `kriya_plan` says so at once and builders are told not to spend
123
+ steps on open-ended manual QA.
124
+
125
+ Kept request (beta, harness upgrade U7): `kriya --anchor` or `kriya run
126
+ --anchor` keeps every message you send in the session, word for word, in a
127
+ late part of the system prompt, which compaction never condenses: a
128
+ requirement survives even when the conversation's summary leaves it out.
129
+ Only your own messages, never tool output. Without `--anchor` the agent is
130
+ exactly as before.
131
+
132
+ Control Center (`kriya daemon`; needs Kriya's Control Center switched on):
133
+ run tasks, health checks, rule decisions, handoff, pull and serve on this
134
+ computer from Kriya's `/harness` page or your phone. The daemon long-polls
135
+ Kriya and runs each action with the same routines as the terminal. It runs
136
+ only in the folder it starts in and each `--folder` you give (never your
137
+ home folder, never a path typed in Kriya); Full access and serving work from
138
+ Kriya only with `--allow-full-access` / `--allow-serve` (an edit from Kriya only
139
+ with `--allow-edit`, or **Allow editing from Kriya** in Remote Control); a task in Ask mode
140
+ still sends its approvals to Kriya. `kriya daemon install` keeps it running
141
+ in the background (launchd on macOS, a systemd user unit on Linux; logs in
142
+ `~/.kriya/daemon.log`); `kriya daemon uninstall` stops it. Every `kriya`,
143
+ `kriya run` and `kriya acp` tells Kriya its mode, switches, folder name and
144
+ state (never the task), shown under Activity; `KRIYA_BROADCAST=off` turns
145
+ that off.
146
+
147
+ Web UI tabs (right sidebar): **Overview** (this computer, the folder, the
148
+ GitHub repository and branch, context and usage, changes, background tasks,
149
+ connectors), **Graph** (the plan as a graph, from what really ran), **Progress** (goal → plan → build → verify → done from the
150
+ loop's own check runs) and **Preview** (an app on this computer, localhost
151
+ only, in a frame).
152
+
153
+ **Changes** shows every file the agent added, changed or deleted, with its
154
+ diff. In a git repository that's against the last commit. In a folder that
155
+ isn't one, it's this session's changes since the agent's first change,
156
+ including those its step builders made: Kriya keeps its own record in
157
+ `~/.kriya/shadow/` (dependency, build and cache folders left out; nothing,
158
+ not even a `.git`, is written into your folder; your home folder and drive
159
+ roots are never tracked). Checkpoints and `kriya undo` work there too.
160
+
161
+ With no check confirmed, **Progress** lists the checks the harness found
162
+ (also in project subfolders, e.g. `cd benchmarks/app && npm run check`); one
163
+ click confirms one, exactly as `kriya verify use` does. A step built with no
164
+ check reads "built, not checked": the plan moves on, and nothing counts as
165
+ passed.
166
+
167
+ Intent router (beta, off; `kriya --router`, `kriya run --router`,
168
+ `KRIYA_ROUTER=on`): for each request, code (no model call) writes a short
169
+ brief into the prompt: the request's intent, the skills of your catalog most
170
+ likely to help (BM25 over their names and descriptions) and the tools to
171
+ start with, naming only tools the agent has. It hides and adds nothing.
172
+
173
+ Long tasks on a small window (with `--loop-v2`): the plan's state (goal,
174
+ each step's status, the next step, the last check) is kept in a part of the
175
+ prompt that compaction never condenses, so the agent keeps its place
176
+ however often older turns are summarised.
177
+
178
+ Agent's browser (beta; **on wherever Google Chrome is installed**, since
179
+ 2026-11-04; `--no-browser-tools` or `KRIYA_BROWSER=off` turns it off): the
180
+ agent tests and reviews apps on
181
+ this computer with your installed Google Chrome (headless, its own profile
182
+ in `~/.kriya/browser/`): `browser_open`, `browser_read`,
183
+ `browser_screenshot`, `browser_click`, `browser_type`, `browser_press`,
184
+ `browser_console`, `browser_network`. Only localhost addresses open (never
185
+ the Web UI's own port); a link elsewhere is refused before it is sent and
186
+ the page stays. In Read only it can open and read, not click or type. The
187
+ Preview tab's "Agent's browser" shows the same page live and lets you click,
188
+ scroll and type into it.
189
+
190
+ Loop v2 (beta, off; `kriya --loop-v2`, `kriya run --loop-v2`,
191
+ `KRIYA_LOOP_V2=on`): plan steps name the earlier steps they need, so a
192
+ blocked step skips only what depends on it; a failed check is classified
193
+ (syntax, type, assertion, environment, timeout) and cut to its failing
194
+ lines; a pass that changed tests must also pass with the committed tests;
195
+ an attempt that fails further from passing is set aside (kept in `kriya
196
+ undo --list`); a failure seen twice is proposed as a rule, which the agent
197
+ sees only after `kriya rules confirm <number>`. No extra model calls; not
198
+ yet measured on a real model. Without `--loop-v2` the loop is exactly v1.
199
+
200
+ **On by default since 2026-11-05 (owner's decision; not measured on a real model):** the loop guard, strict loop, defensive engine, reconnaissance, just-in-time tools and intent router described below, whatever each paragraph's "off" says. Turn one off with its `--no-…` flag or `KRIYA_…=off`; `--defensive` brings the strict loop, so turn off both to drop it.
201
+
202
+ Loop guard (beta, off; `kriya --loop-guard`, `kriya run --loop-guard`,
203
+ `KRIYA_LOOP_GUARD=on`): an agent that stops with plan steps still to do is
204
+ sent back (once per step, from the records, never from what it says); a step
205
+ stops after the same failure twice with no file changed, or when the check
206
+ can't run on this machine, instead of spending all four builders; a builder
207
+ that died on an error before changing a file isn't counted as an attempt
208
+ (at most twice per step); and a step resumed after a crash starts from its
209
+ last recorded failure. No extra model calls of its own; not yet measured on a
210
+ real model.
211
+
212
+ Strict coding loop (beta, off; `--strict-loop`, `KRIYA_STRICT_LOOP=on`; includes
213
+ the loop guard): `kriya_plan` takes a task contract (`kind`, `invariants`,
214
+ `acceptance`), and a `surgical_bugfix` has at most 2 steps. Each check runs
215
+ cheapest first: parsing changed files, then `tsc` when the project has it, then
216
+ the tests that import what changed, then your confirmed check. These can only
217
+ fail a step: passing still means your check exited 0. A weakened or deleted
218
+ test, an added `any`, `@ts-ignore` or empty catch, or a changed invariant is
219
+ refused; adding tests is fine. A bug fix must fail on the old code. Two attempts
220
+ in a row that break the build undo the step's files, and a blocked step leaves
221
+ them as they were (the attempts stay in `kriya undo --list`). Needs a git
222
+ repository.
223
+
224
+ Defensive engine (beta, off; `--defensive`, `KRIYA_DEFENSIVE=on`; brings the
225
+ strict loop): a plan of two or more steps needs a `premortem` (failure hypotheses,
226
+ each naming the test that proves it can't happen; the blast radius; bad inputs).
227
+ Before tests run, added lines are checked for tenant bypasses, SQL built from
228
+ strings, money in floats, identity taken from the request and secrets. Tests of
229
+ code the change can reach run after its own. Before a pass, the diff is reviewed
230
+ for broken callers, changed defaults and promises nobody awaits, and anything new
231
+ needs a test with a bad input. All fixed rules, no model; expect false alarms on
232
+ about 6% of commits, and minutes of extra tests on heavily shared files.
233
+
234
+ Reconnaissance (beta, off; `--recon`, `KRIYA_RECON=on`): `code_outline` lists a
235
+ file's symbols, `code_impact` lists what imports it (both by fixed patterns, not
236
+ a parser), and one read takes at most 400 lines. Just-in-time tools (beta, off;
237
+ `--jit-tools`, `KRIYA_JIT_TOOLS=on`): a step's builder gets browser and reverse
238
+ engineering tools only when the step's words call for them, and a hint of the
239
+ skills that fit. None of these is measured on a real model.
240
+
241
+ `kriya verify status [--session <id>] [--json]` reports where the newest
242
+ session in this folder stands, with each check run as evidence: `verified`
243
+ (every plan step passed), `partial` (passes, but plan steps still open),
244
+ `not checked`, `failed` or `blocked`. It exits 0 only when verified.
245
+
246
+ Model limits (harness upgrade U3): when Kriya reports a tier's context
247
+ window and output cap (`GET /models`), the tier declares them to DeepSeek
248
+ Harness, capped at a 262,144-token working window, so compaction starts
249
+ before a smaller model's window is full; a tier without them keeps DeepSeek
250
+ Harness's defaults. When the provider says a conversation is too long,
251
+ Kriya answers `context_length_exceeded`, which DeepSeek Harness compacts and
252
+ retries. `kriya usage [--json]` prints this month's spend and limit
253
+ (KriyaBench's `--meter` reads it).
254
+
255
+ Models are Kriya's tiers: `balanced`, `budget`, `escalation`. A session
256
+ starts on `balanced`, or on the best tier your plan allows. Your plan decides
257
+ which are allowed and its monthly limit, and the model picker offers only
258
+ those (read from Kriya when `kriya` starts; restart it after a plan change).
259
+ A session saved on a tier your plan no longer has shows "Select model":
260
+ pick one of your plan's tiers and carry on.
261
+
262
+ Skills: any folder of `<name>/SKILL.md` skills works, including the ones
263
+ written for Claude Code (superpowers, ponytail, ECC), without conversion:
264
+
265
+ ```bash
266
+ kriya skills link ~/.claude/plugins/cache/ponytail/ponytail/<version>/skills
267
+ kriya skills
268
+ ```
269
+
270
+ The agent sees a catalog (each skill's name and description) and loads a
271
+ skill when it needs it; type `/<name>` to use one directly. In the browser
272
+ (`kriya`), the **Skills** page in the sidebar lists every skill the agent
273
+ sees, where it comes from and what the list costs per request. It edits the
274
+ skills you own (each save is checked by DeepSeek Harness's own parser and
275
+ undone if the agent couldn't read it), turns a linked skill into your own
276
+ copy (its source stays untouched), creates new ones and unlinks.
277
+ `node scripts/skill-eval.js` measures automatic selection on the real
278
+ client (it spends your allowance). The catalog goes
279
+ with every request, so turn off what a project doesn't need: each row on
280
+ the Skills page has a switch (on, off in this project, off everywhere;
281
+ `kriya skills off <name>` in a terminal), and the page shows what the
282
+ list costs and what the skills that are off save. A skill that's off is
283
+ out of the agent's list, its `skill` tool and `/name` in every profile
284
+ (browser, `kriya run`, editors), from the agent's next step; its files are
285
+ never touched. Switches live in `~/.kriya/skill-switches.json`, per
286
+ project (its git root). Skills are guidance only; Claude Code hooks and slash commands don't
287
+ carry over, and a skill never adds a tool or skips an approval. Skills in a
288
+ project's `.dsh/skills` or `.agents/skills`, and in `~/.agents/skills`, are
289
+ read too; your Kriya agent's own skills come on top.
290
+
291
+ ## How it's put together
292
+
293
+ - `bin/kriya.js` signs in, prepares the Kriya profiles in `~/.kriya`
294
+ (`DSH_HOME`) and starts DeepSeek Harness's own launcher with
295
+ `--profile kriya`, `--profile kriya-run` or `--profile kriya-acp`.
296
+ - `bundle/cordis.patch.yml` is the "kriya" bundle each profile (`kriya`,
297
+ `kriya-run`, `kriya-acp`) stacks on `dsh-base`: the Kriya gateway as the
298
+ only model route, Kriya's `balanced` tier as the default (for ACP
299
+ sessions too), and DeepSeek's account, models, web search and telemetry
300
+ rows disabled.
301
+ - `plugins/brand/` is the Kriya look for the Web UI ([DESIGN.md](plugins/brand/DESIGN.md)):
302
+ Kriya's palette through DeepSeek Harness's theme token layer, Geist,
303
+ Fraunces and JetBrains Mono embedded, the brand slots (sidebar mark and
304
+ name), the start screen where the K is stitched in, and Kriya's tab title
305
+ and icon. The bundle turns DeepSeek's official brand row off. Edit
306
+ `plugins/brand/src/client.js`, then `npm run build:brand`.
307
+ - `plugins/projects/` is the **Projects** page in the sidebar: the folders
308
+ on this computer that look like projects (a `.git`, `package.json`,
309
+ `pyproject.toml`, `Cargo.toml`, `go.mod` and similar) in `~/Developer`,
310
+ `~/Projects`, `~/code` and the other usual places, one level of group
311
+ folders deep, plus the folder you started `kriya` in. **Open** makes the
312
+ folder a workspace and starts a session there. macOS asks before an app
313
+ reads Desktop, Documents or Downloads, so those are searched only when
314
+ you name them: `KRIYA_PROJECT_ROOTS=~/Documents:~/work kriya`. Read-only;
315
+ it lists names, paths and times.
316
+ - One product, one language: the bundle turns off DeepSeek Harness's
317
+ Creator mode (which writes DSH plugins), its Plugins page and Settings →
318
+ Built-in plugins, and the brand plugin pins Kriya's English (`en-IN`, a
319
+ language pack over DSH's English with Kriya's own words where DSH names
320
+ itself); DSH's 中文 is not offered.
321
+ - `plugins/changes/` is the **Changes** tab in the right sidebar (next to
322
+ DeepSeek Harness's own Workspace files, Terminal and Browser): every file
323
+ changed in the session's folder against HEAD (staged, unstaged and
324
+ untracked, renames and binaries too) with lines added and removed, and
325
+ each file's diff, refreshed every few seconds while it's on screen.
326
+ Read-only; the browser names a session, never a folder, and a diff is
327
+ only made for a file git lists as changed.
328
+ - `contract/contract.json` is the Kriya Harness API contract, copied from
329
+ the Kriya repository ([contract/SOURCE.md](contract/SOURCE.md)).
330
+ - `plugins/approvals/` sends DeepSeek Harness's approval questions to Kriya
331
+ too: answer in the local prompt or in Kriya on your phone, and the first
332
+ answer wins. With no answer from either (Kriya unreachable, the request
333
+ expired), the action is refused. In `kriya run` the phone is the only
334
+ place to answer.
335
+ - `plugins/mirror/` sends a summary of each turn (its answer and the tools
336
+ it used) to a thread in Kriya, so your phone shows progress, but only
337
+ when you turn the mirror on for this computer in Kriya (Account →
338
+ Devices). "Full" also sends each tool's arguments and output. Turns wait
339
+ in `~/.kriya/mirror-queue.json` while Kriya is unreachable.
340
+ - `plugins/kriya-tools/` brings your Kriya agent's skills into the harness
341
+ (your own local skills win a name) and two tools: `kriya_memory_search`
342
+ for its notes and `kriya_memory_save`, whose notes stay unconfirmed
343
+ until you confirm them in Kriya.
344
+ - `plugins/kriya-handoff/` is `kriya handoff` and `kriya pull`. The patch
345
+ is the working tree against HEAD (untracked and binary files included,
346
+ ignored ones left out, your index untouched), sent with its sha256; the
347
+ cloud workspace starts from GitHub at HEAD and applies it. A pull checks
348
+ the sha256, needs a clean tree and changes nothing if the patch doesn't
349
+ apply.
350
+ - `src/world.js` is `kriya serve` (H10, HD-12): one outbound WebSocket to
351
+ kriya-relay, whose frames go to track C's own runner
352
+ (`src/runner.bundle.js`, generated from the Kriya repository's
353
+ `runner/index.ts`; the rebuild command is its first line), one per
354
+ workspace, each in its own fresh subfolder.
355
+ - `kriya acp` is DeepSeek Harness's ACP app (`dsh-acp-app`) with the same
356
+ Kriya bundle: sessions start on Kriya's `balanced` tier (the editor's
357
+ model picker lists Kriya's three tiers only), with the same tools,
358
+ skills, memory, phone approvals (the editor's permission prompt and your
359
+ phone; first answer wins), mirror and permission defaults as `kriya`.
360
+ Stdout carries only protocol frames; kriya's own messages go to stderr.
361
+
362
+ ## Develop
363
+
364
+ ```bash
365
+ npm run check # exact pins, notices and theme build current, all tests
366
+ npm run build:brand # rebuild plugins/brand/client.js (fonts inlined)
367
+ npm run release:check # the release gate: pins, licenses (allow-list or a decided exception), notices
368
+ npm run sbom # the release's SBOM (CycloneDX JSON) on stdout, from the lockfile
369
+ npm run dump-config # re-record expected/*.dump.yml after a reviewed DSH bump
370
+ npm run notices # regenerate THIRD_PARTY_NOTICES.md from the lockfile
371
+ ```
372
+
373
+ Tests use `tests/fake-kriya.js` on `127.0.0.1` and boot the real, pinned
374
+ DeepSeek Harness; nothing reaches a real Kriya or model provider.
375
+
376
+ Upgrading DeepSeek Harness: change only the version, run `npm run check`,
377
+ review the `expected/` diff from `npm run dump-config`, record the result.
378
+ A package outside the license allow-list needs an owner decision recorded in
379
+ `notices-exceptions.json` for its exact version and license; the release
380
+ gate fails on a new version, a changed license or a stale exception.
package/SAFETY.md ADDED
@@ -0,0 +1,162 @@
1
+ # Kriya Harness safety notice (beta)
2
+
3
+ Kriya Harness is a **beta**. It is built on DeepSeek Harness, which describes
4
+ itself as experimental developer-preview software that has not had a
5
+ security audit and expects breaking changes. Kriya hasn't changed that: do
6
+ not treat Kriya Harness as secure or production-ready. `kriya` shows this
7
+ notice the first time it runs.
8
+
9
+ ## Where to run it
10
+
11
+ - Start it in **one project folder** that is under version control or
12
+ backed up, and commit your work before you start.
13
+ - Never start it in `/`, your home folder, or a folder you can't afford to
14
+ lose (photos, documents, other projects). The agent starts in the folder
15
+ you open it in.
16
+ - Sign out on machines you share (`kriya logout`).
17
+
18
+ ## On by default since 0.2.0
19
+
20
+ - **The Kriya loop.** Before each tool call that can change files, the
21
+ working tree is saved as a commit on Kriya's own git ref
22
+ (`refs/kriya/checkpoints/…`, the newest 100 per session); your branches,
23
+ tags, index, stash and HEAD are never touched, and `refs/kriya/*` isn't
24
+ pushed by a normal `git push`, but the objects are in your repository's
25
+ `.git`. The agent's `kriya_verify` runs only the check you confirmed, under
26
+ the session's own mode; without one, nothing runs and work is "not
27
+ checked". `--no-loop` turns all of this off.
28
+ - **The turn budget.** A turn stops at 150 steps, 60 minutes or 10 identical
29
+ tool calls in a row, and ends "blocked" rather than "completed".
30
+ `--no-budget` turns it off.
31
+ - Neither changes a mode, a sandbox or an approval.
32
+
33
+ ## What it can do on this machine
34
+
35
+ The agent reads and changes files and runs commands under the mode you
36
+ start it in (`kriya --mode <mode>`, `kriya run --mode <mode>`; in the Web
37
+ UI, the Permissions control or `/permission`). Every mode is one of
38
+ DeepSeek Harness's sandbox modes plus one approval policy, set by Kriya's
39
+ bundle; the shell's own variables can't change it.
40
+
41
+ | Mode | Sandbox | Approvals | What it means |
42
+ | --- | --- | --- | --- |
43
+ | `ask` (default) | this folder | ask | Writes inside the folder you opened; anything beyond it needs your answer first |
44
+ | `auto` | this folder | never | Works inside the folder without asking; anything that would need your answer is refused, never allowed |
45
+ | `read` | read-only | never | Reads and answers; changes no file |
46
+ | `plan` (`kriya run` only) | read-only | never | Writes a step-by-step plan and changes no file. In the Web UI, type `/plan` |
47
+ | `full` | none | never | Runs commands and changes files anywhere you can, without asking. Kriya prints a warning each time |
48
+
49
+ What the sandbox covers, so you can choose well:
50
+
51
+ - It governs **file changes**. Network access and which programs run aren't
52
+ limited by it, in any mode.
53
+ - "This folder" also includes the platform's temporary areas, which
54
+ DeepSeek Harness leaves writable on purpose.
55
+ - `DSH_PERMISSION_MODE` from your environment is no longer read; the mode
56
+ comes only from `--mode` (default `ask`).
57
+
58
+ Read what it asks to run before you approve it. You can answer in the
59
+ terminal, the Web UI or your editor, or in Kriya on your phone: the first
60
+ answer wins and the other is withdrawn. With no answer from either (Kriya
61
+ unreachable, the request expired), the action is refused.
62
+
63
+ ## Skills you add
64
+
65
+ A skill you link (`kriya skills link`) or keep in a project's `.dsh/skills`
66
+ or `.agents/skills` is instructions the agent follows, like a prompt you
67
+ wrote. It can't add a tool or skip an approval, and your mode still applies,
68
+ but it can ask the agent to run its scripts or commands. Link skills only
69
+ from sources you trust, and read new ones first. The Skills page in the
70
+ browser saves only skills you own (in `~/.kriya/skills`, `~/.agents/skills`
71
+ or the project) and only through the browser you signed in with: its routes
72
+ sit behind DeepSeek Harness's sign-in cookie and its same-origin checks. Their names and descriptions
73
+ go to the model with every request.
74
+
75
+ ## What leaves this machine
76
+
77
+ - **Model calls.** Your prompts, the files and command output the agent
78
+ reads, and its replies go to Kriya's model gateway, which forwards them to
79
+ Kriya's model provider. Kriya's servers keep each call's usage and cost,
80
+ not its content.
81
+ - **Approval requests.** The tool's name, a summary and its arguments, with
82
+ values whose names look secret (passwords, tokens, API keys, cookies,
83
+ cards…) replaced by `[redacted]` before they're sent; Kriya redacts again.
84
+ - **The session mirror**, only if you turn it on for this device in Kriya
85
+ (Account → Devices); it's off by default.
86
+ - *Summary*: each turn's answer and each tool's name, status and time.
87
+ - *Full*: also each tool's arguments (secret-looking names hidden, as
88
+ above) and up to 4 KB of its output, **which is not redacted**: a
89
+ command that prints a secret sends it. Use Summary in projects that
90
+ hold secrets.
91
+ - Turns wait in `~/.kriya/mirror-queue.json` (readable only by you) while
92
+ Kriya is unreachable. Kriya's cloud agents treat mirrored text as
93
+ outside content, not as your instructions.
94
+ - **Memory.** Notes the agent saves with `kriya_memory_save` stay
95
+ **unconfirmed** until you confirm them in Kriya (Inbox → Memories to
96
+ review), and Kriya refuses values such as card numbers.
97
+ - **`kriya handoff`** uploads the repository's uncommitted changes,
98
+ **including untracked files** (files in `.gitignore` are left out), to
99
+ your Kriya account. Make sure `.env` files and other secrets are ignored
100
+ by git before you hand off. `kriya pull` applies a workspace's changes on
101
+ a new branch `kriya/pull-<id>` and never touches your own branch.
102
+ - **`kriya serve [folder]`** lets your Kriya agents' cloud tasks run
103
+ commands and change files **on this machine, as you, with your network**:
104
+ there is no sandbox, firewall or registry-only network here. Each task
105
+ works in a new subfolder `<folder>/<workspace id>-<generation>` (never in
106
+ files already there), and Kriya deletes that subfolder when it closes the
107
+ workspace; a command can still reach anything your account can. It runs
108
+ only while `kriya serve` does (Ctrl-C stops it) and only when your Kriya
109
+ has the device world turned on. Signing the device out in Kriya (Account →
110
+ Devices) disconnects it within minutes.
111
+
112
+ ### Edits from Kriya
113
+
114
+ Off unless you turn on **Allow editing from Kriya** in Remote Control or start
115
+ `kriya daemon --allow-edit`, with editing on. An agent in Kriya can then ask this
116
+ computer for one edit at a time, in a folder you offered, after you approve that exact
117
+ job. Your footage and project stay here. The job reports its stage, percent, which
118
+ checks passed and a reason code, never a file name or a transcript. One small preview
119
+ of its own output goes straight to Kriya's storage, if your plan keeps previews, so you
120
+ can watch it on your phone. Whether the checks passed is what this computer says; Kriya
121
+ can only check the preview file itself.
122
+
123
+ When a choice is really yours, your phone can show it: which of two files you meant, or
124
+ which of two takes, with a few seconds of each as small clips. Each has a default, so a
125
+ question nobody answers never stops an edit. Notes you send from your phone come back here
126
+ as requests in your own words, checked like any other edit.
127
+
128
+ `kriya edit watch <folder>` is off until you run it, for that folder only. When a new
129
+ recording settles, Kriya hears its name and how long it is, and nothing else. Nothing runs
130
+ until you tap its card. `kriya edit unwatch <folder>` stops it.
131
+
132
+ Kriya notices how you edit, on this computer, in `~/.kriya/edit/taste.json`: the caption look
133
+ and the zoom you keep choosing across projects. Nothing changes until you say yes, in the
134
+ Studio or on a "Remember this?" card, which carries that one sentence and nothing else. Every
135
+ rule is listed on the Studio's home page, and you can remove it there.
136
+
137
+ ## What Kriya Harness keeps on this machine
138
+
139
+ - `~/.kriya/device.json`: this device's sign-in token, readable only by your
140
+ user account. Anyone who can read it can use your Kriya Harness allowance
141
+ until you sign out (`kriya logout`) or revoke the device in Kriya under
142
+ Account → Devices.
143
+ - `~/.kriya/profiles/`: DeepSeek Harness profiles and their session history.
144
+
145
+ The token is passed to DeepSeek Harness as `KRIYA_DEVICE_TOKEN`. DeepSeek
146
+ Harness removes variables with `TOKEN` in their name from every command the
147
+ agent runs, so commands can't read it from the environment. The agent's file
148
+ tools may still be able to read `~/.kriya/device.json` if you approve
149
+ reading outside the project folder.
150
+
151
+ ## The Web UI and editors
152
+
153
+ - `kriya` serves its Web UI only on `127.0.0.1`, behind its own session
154
+ link; it never offers a way to bind to another address.
155
+ - `kriya acp` talks to your editor over stdin/stdout. The editor is trusted
156
+ as its controller: MCP servers your editor declares for a session are
157
+ started with the commands and environment it gives.
158
+
159
+ ## Reporting
160
+
161
+ Report a security problem to the Kriya team privately, not in a public
162
+ issue.