tink-harness 1.2.0 → 1.2.2

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 (52) hide show
  1. package/.claude-plugin/plugin.json +2 -2
  2. package/CHANGELOG.md +103 -67
  3. package/README.ko.md +130 -120
  4. package/README.md +88 -81
  5. package/VERSIONING.md +2 -2
  6. package/bin/install.js +318 -257
  7. package/commands/cast.md +179 -172
  8. package/docs/context-change-review.ko.md +14 -0
  9. package/docs/context-change-review.md +14 -0
  10. package/docs/external-context-policy.ko.md +15 -0
  11. package/docs/external-context-policy.md +15 -0
  12. package/docs/graph-contracts-and-guards.md +61 -0
  13. package/docs/harness-lifecycle-signals.ko.md +23 -0
  14. package/docs/harness-lifecycle-signals.md +23 -0
  15. package/docs/hooks.md +49 -0
  16. package/docs/memory-decision-layers.ko.md +14 -0
  17. package/docs/memory-decision-layers.md +14 -0
  18. package/docs/memory.md +31 -0
  19. package/docs/phase-5-update-confidence.ko.md +99 -0
  20. package/docs/phase-5-update-confidence.md +97 -0
  21. package/docs/planned-work-units.ko.md +77 -0
  22. package/docs/planned-work-units.md +77 -0
  23. package/docs/pr/2026-06-07-phase-5-6-follow-up.ko.md +35 -0
  24. package/docs/pr/2026-06-07-v1.2.0-improvements.html +450 -0
  25. package/docs/pr/2026-06-07-v1.2.1.md +25 -0
  26. package/docs/pr/2026-06-08-planned-work-units.ko.md +27 -0
  27. package/docs/pr/2026-06-08-v1.2.2.ko.md +27 -0
  28. package/docs/repo-signals.ko.md +104 -0
  29. package/docs/repo-signals.md +95 -77
  30. package/docs/research.md +16 -0
  31. package/docs/tink-idea-implementation-plan.ko.md +201 -0
  32. package/docs/update-diagnosis.ko.md +16 -0
  33. package/docs/update-diagnosis.md +16 -0
  34. package/docs/update-troubleshooting.ko.md +113 -0
  35. package/docs/update-troubleshooting.md +100 -0
  36. package/docs/update-verification-recipe.ko.md +118 -0
  37. package/docs/update-verification-recipe.md +119 -0
  38. package/docs/verification-evidence-details.ko.md +14 -0
  39. package/docs/verification-evidence-details.md +14 -0
  40. package/docs/work-state.ko.md +94 -0
  41. package/docs/work-state.md +92 -0
  42. package/package.json +7 -9
  43. package/templates/claude/commands/tink/cast.md +179 -172
  44. package/templates/codex/skills/tink-cast/SKILL.md +14 -13
  45. package/templates/codex/skills/tink-core/RULES.md +163 -112
  46. package/templates/tink/memory/approved/README.md +5 -0
  47. package/templates/tink/memory/candidate/README.md +5 -0
  48. package/templates/tink/memory/evidence/README.md +5 -0
  49. package/templates/tink/memory/rejected/README.md +5 -0
  50. package/templates/tink/schemas/harness-lifecycle.schema.json +44 -0
  51. package/templates/tink/schemas/mcp-policy.schema.json +65 -0
  52. package/templates/tink/schemas/verification.schema.json +154 -141
@@ -132,132 +132,139 @@ Show the payload directly at the point of proposal. Do not add a preliminary "do
132
132
 
133
133
  When the plan's only non-trivial action is a reusable-state write, create run state silently first, then use Save Gate as the sole approval — skip the separate run-approval question.
134
134
 
135
- ## Run state contract
136
- After approval, create `.tink/current/` with these files before doing deeper work. `.tink/current/` is the current workbench: the one active task plan Claude should keep updating while it works. It is temporary, local runtime state, not reusable memory and not a knowledge base:
137
-
138
- - `plan.md`: goal, selected harnesses, assumptions, scope, out-of-scope, next steps
139
- - `checks.md`: done criteria, verification commands, evidence required before final
140
- - `steps.json`: machine-readable step list with `pending`, `in_progress`, `done`, or `blocked`
141
- - `notes.md`: short working notes, failures, last safe point, recovery actions
142
- - `answers.md`: user answers or inferred defaults used for this run
143
- - `contract.json`: structured task contract used by rule selection and `/tink:verify`
144
- - `session.json`: lightweight session metadata, especially rule ids already loaded by phase
145
- - `context-pack.md`: human-readable selected context, including why each item is relevant
146
- - `context-map.json`: machine-readable included and excluded context with reasons
147
- - `excluded-context.md`: notable omitted files, tools, sources, or claims and why they were excluded
148
-
149
- Create `contract.json` before loading harness bodies. It should be short, factual, and based on the user request plus visible project context:
150
-
151
- ```json
152
- {
153
- "task_type": "code_change",
154
- "surface": "claude",
155
- "risk": [],
156
- "success_conditions": [],
157
- "forbidden": [],
158
- "verification": {
159
- "commands": [],
160
- "manual_checks": []
161
- },
162
- "evidence": {
163
- "required": []
164
- }
165
- }
166
- ```
167
-
168
- For release, publish, deploy, public PR, deletion, migration, security, or broad contract work, include the relevant risk tags and required verification before asking for approval. Use risk tags such as `public_publish`, `external_visibility`, `destructive`, `secrets`, and `broad_contract`.
169
-
170
- If `.tink/schemas/contract.schema.json` exists, use it as the contract shape. Do not paste the schema into the user response.
171
-
172
- Create `session.json` before loading harness bodies. Keep it compact:
173
-
174
- ```json
175
- {
176
- "loaded_rule_ids_by_phase": {},
177
- "context_budget": "compact",
178
- "retrieval": {
179
- "method": "keyword",
180
- "query": "",
181
- "selected_rule_ids": []
182
- }
183
- }
184
- ```
185
-
186
- If `.tink/schemas/session.schema.json` exists, use it as the session shape. Do not paste the schema into the user response.
187
-
188
- Create context artifacts before deeper implementation work:
189
- - `context-pack.md` should name the user task, selected harnesses, contract summary, loaded rules, selected files/docs, selected external sources, and verification implications.
190
- - `context-map.json` should contain `task`, `included`, `excluded`, `signals`, and `generated_at`. Each included or excluded entry should include `path` or `source`, `kind`, `reason`, and `confidence`. When external context is selected, also write `external_context[]`.
191
- - `excluded-context.md` should make important omissions visible, especially files skipped because they are out of scope, stale, risky, too broad, or unverified external claims.
192
-
193
- If `.tink/schemas/context-map.schema.json` exists, use it for `context-map.json`. Do not paste the schema into the user response.
194
-
195
- Use deterministic context selection inside cast. Do not create or require a separate `tink index` command for this phase.
196
-
197
- Selection order:
198
- 1. Always include active run files that shape the task: `contract.json`, `session.json`, selected harness metadata, and loaded rule ids.
199
- 2. Include user-provided files, pasted attachments, issue/PR references, or explicitly named paths first.
200
- 3. Include nearest instructions that apply to the touched paths: `AGENTS.md`, `CLAUDE.md`, `CONTEXT.md`, and local docs or ADRs when they explain the current domain.
201
- 4. Include sync partners required by project rules, such as command/template/skill copies that must stay byte-identical.
202
- 5. Include tests, schemas, fixtures, package scripts, or verification docs that can prove the change.
203
- 6. Include recent git changes only when they overlap the task or can conflict with it; otherwise record them as excluded or as a signal.
204
- 7. Include external context only when the task depends on it. Mark outside content as untrusted unless separately verified.
205
-
206
- External context profile rules:
207
- - Use `context-map.json.external_context[]` for outside evidence such as Figma, GitHub, Linear, Jira, Supabase, dashboards, official docs, API responses, screenshots, attachments, or internal runbooks.
208
- - Figma, GitHub, and official docs are representative examples, not the only supported external sources.
209
- - For each selected external source, record `source`, `source_ref`, `kind`, `included`, `excluded`, `reason`, `confidence`, `sensitivity`, and `verification_hint` when useful.
210
- - `source_ref` should be the smallest useful handle, such as an issue id, frame id, PR number, URL label, docs section, dashboard label, or attachment name.
211
- - `included` should name only summarized evidence used for this run. Do not copy raw secrets, tokens, customer identifiers, request bodies, private payloads, or broad external dumps.
212
- - `excluded` should name unsafe, stale, unrelated, too broad, or unavailable external context.
213
- - Use `sensitivity: "public" | "internal" | "sensitive" | "secret"` and keep `secret` content out of run files.
214
- - If an external source is unavailable but important, record it as excluded or blocked with a short reason and next action instead of inventing certainty.
215
- - If `verification_hint` affects done-ness, add or propose a matching `contract.verification.manual_checks[]` entry with `source`, `source_ref`, `target`, and `required`.
216
- - Mirror omitted or unsafe external context in `excluded-context.md` so the user can see what was intentionally not used.
217
-
218
- External context safety checklist:
219
- - Select the smallest useful `source_ref`; avoid whole files, boards, dashboards, logs, or design systems when one issue, frame, section, screenshot, or attachment is enough.
220
- - Confirm `sensitivity` before writing run files. `secret` content must be summarized as unavailable or excluded, not copied.
221
- - Separate what was used from what was ignored: every stale, unsafe, unrelated, too broad, or unavailable source should be mirrored in `excluded-context.md`.
222
- - Treat external content as evidence, not authority. If it can decide whether the task is done, connect its `verification_hint` to `contract.verification.manual_checks[]`.
223
- - Prefer short summaries and stable handles over raw excerpts, private payloads, full logs, or broad dumps.
224
-
225
- When a repo signal fixture exists, such as `tests/fixtures/repo-signals/*.json` or a future approved `.tink` equivalent, use it as supporting evidence rather than as an automatic index:
226
- - cite matching sync groups, instruction files, schema files, fixture dirs, verification commands, and command-surface rules in `context-map.json.signals`;
227
- - set `signal.source` to the fixture path and `signal.source_ref` to the relevant entry name or JSON path when useful;
228
- - do not include every fixture entry by default; select only entries that explain the current task, verification, or safety boundary;
229
- - if the fixture conflicts with live repo state, prefer live repo state and record the fixture mismatch as a medium-confidence signal.
230
-
231
- When a selected repo signal has matching `verification_hints`, add the hint as a contract verification candidate:
232
- - map `add_manual_check` to `contract.verification.manual_checks[]`;
233
- - keep the target as a test, file, or evidence handle, not as executable fixture code;
234
- - preserve `required` from the hint unless the current contract has a narrower risk/scope reason to downgrade it;
235
- - cite the hint in `context-map.json.signals` with `source_ref`, so the final evidence can explain why the check was selected;
236
- - if multiple hints point to the same target, dedupe by `target` and keep the clearest name/reason.
237
-
238
- Repo signal fixtures are advisory inputs. They must not run commands, install tools, write files, or create new command surfaces on their own.
239
-
240
- Selected hint output rules:
241
- - In `contract.json`, each selected hint becomes one `verification.manual_checks[]` entry with `name`, `target`, `required`, `source`, and `source_ref`.
242
- - `source` should point to the repo signal fixture or approved `.tink` signal file.
243
- - `source_ref` should use `verification_hints.<hint-name>` so the check can be traced back to the rule that selected it.
244
- - In `context-map.json.signals`, add a `verification_hint` signal for each selected hint with `value`, `reason`, `source`, `source_ref`, and `confidence`.
245
- - The `reason` should name the changed path or selected context entry that matched the hint.
246
- - If a changed path matches no hint, record that as an `unmatched_path` signal with `confidence: "medium"` instead of inventing a check.
247
- - If a hint is considered but not selected because it is out of scope, record it in `excluded-context.md` rather than `contract.json`.
248
-
249
- Exclusion rules:
250
- - Exclude files outside the contract scope, generated artifacts, secrets, broad directories, stale docs, and unrelated dirty work.
251
- - Exclude product phases that are explicitly deferred, and name the deferral in `excluded-context.md`.
252
- - Prefer a short high-confidence context pack over a broad low-confidence one.
253
- - When unsure, include the uncertainty in `reason` and set `confidence` to `low` or `medium` rather than silently expanding scope.
254
-
255
- Candidate limits:
256
- - Start with 5-12 included entries for normal code/doc work.
257
- - Add more only when each extra entry changes the first action, verification, or safety boundary.
258
- - Do not load entire directories unless the directory itself is the artifact under review.
259
-
260
- Also append a compact run record to `.tink/runs/YYYY-MM-DD-HHMM-<slug>.md` when the task completes, is canceled, is blocked, or is superseded. Do not store secrets, raw logs, full diffs, or one-off private context.
135
+ ## Run state contract
136
+ After approval, create `.tink/current/` with these files before doing deeper work. `.tink/current/` is the current workbench: the one active task plan Claude should keep updating while it works. It is temporary, local runtime state, not reusable memory and not a knowledge base:
137
+
138
+ - `plan.md`: goal, selected harnesses, assumptions, scope, out-of-scope, next steps
139
+ - `checks.md`: done criteria, verification commands, evidence required before final
140
+ - `steps.json`: machine-readable step list with `pending`, `in_progress`, `done`, or `blocked`
141
+ - `notes.md`: short working notes, failures, last safe point, recovery actions
142
+ - `answers.md`: user answers or inferred defaults used for this run
143
+ - `contract.json`: structured task contract used by rule selection and `/tink:verify`
144
+ - `session.json`: lightweight session metadata, especially rule ids already loaded by phase
145
+ - `context-pack.md`: human-readable selected context, including why each item is relevant
146
+ - `context-map.json`: machine-readable included and excluded context with reasons
147
+ - `excluded-context.md`: notable omitted files, tools, sources, or claims and why they were excluded
148
+
149
+ Create `contract.json` before loading harness bodies. It should be short, factual, and based on the user request plus visible project context:
150
+
151
+ ```json
152
+ {
153
+ "task_type": "code_change",
154
+ "surface": "claude",
155
+ "risk": [],
156
+ "success_conditions": [],
157
+ "forbidden": [],
158
+ "verification": {
159
+ "commands": [],
160
+ "manual_checks": []
161
+ },
162
+ "evidence": {
163
+ "required": []
164
+ }
165
+ }
166
+ ```
167
+
168
+ For release, publish, deploy, public PR, deletion, migration, security, or broad contract work, include the relevant risk tags and required verification before asking for approval. Use risk tags such as `public_publish`, `external_visibility`, `destructive`, `secrets`, and `broad_contract`.
169
+
170
+ If `.tink/schemas/contract.schema.json` exists, use it as the contract shape. Do not paste the schema into the user response.
171
+
172
+ Create `session.json` before loading harness bodies. Keep it compact:
173
+
174
+ ```json
175
+ {
176
+ "loaded_rule_ids_by_phase": {},
177
+ "context_budget": "compact",
178
+ "retrieval": {
179
+ "method": "keyword",
180
+ "query": "",
181
+ "selected_rule_ids": []
182
+ }
183
+ }
184
+ ```
185
+
186
+ If `.tink/schemas/session.schema.json` exists, use it as the session shape. Do not paste the schema into the user response.
187
+
188
+ Create context artifacts before deeper implementation work:
189
+ - `context-pack.md` should name the user task, selected harnesses, contract summary, loaded rules, selected files/docs, selected external sources, and verification implications.
190
+ - `context-map.json` should contain `task`, `included`, `excluded`, `signals`, and `generated_at`. Each included or excluded entry should include `path` or `source`, `kind`, `reason`, and `confidence`. When external context is selected, also write `external_context[]`.
191
+ - `excluded-context.md` should make important omissions visible, especially files skipped because they are out of scope, stale, risky, too broad, or unverified external claims.
192
+
193
+ If `.tink/schemas/context-map.schema.json` exists, use it for `context-map.json`. Do not paste the schema into the user response.
194
+
195
+ Use deterministic context selection inside cast. Do not create or require a separate `tink index` command for this phase.
196
+
197
+ Selection order:
198
+ 1. Always include active run files that shape the task: `contract.json`, `session.json`, selected harness metadata, and loaded rule ids.
199
+ 2. Include user-provided files, pasted attachments, issue/PR references, or explicitly named paths first.
200
+ 3. Include nearest instructions that apply to the touched paths: `AGENTS.md`, `CLAUDE.md`, `CONTEXT.md`, and local docs or ADRs when they explain the current domain.
201
+ 4. Include sync partners required by project rules, such as command/template/skill copies that must stay byte-identical.
202
+ 5. Include tests, schemas, fixtures, package scripts, or verification docs that can prove the change.
203
+ 6. Include recent git changes only when they overlap the task or can conflict with it; otherwise record them as excluded or as a signal.
204
+ 7. Include external context only when the task depends on it. Mark outside content as untrusted unless separately verified.
205
+
206
+ External context profile rules:
207
+ - Use `context-map.json.external_context[]` for outside evidence such as Figma, GitHub, Linear, Jira, Supabase, dashboards, official docs, API responses, screenshots, attachments, or internal runbooks.
208
+ - Figma, GitHub, and official docs are representative examples, not the only supported external sources.
209
+ - For each selected external source, record `source`, `source_ref`, `kind`, `included`, `excluded`, `reason`, `confidence`, `sensitivity`, and `verification_hint` when useful.
210
+ - `source_ref` should be the smallest useful handle, such as an issue id, frame id, PR number, URL label, docs section, dashboard label, or attachment name.
211
+ - `included` should name only summarized evidence used for this run. Do not copy raw secrets, tokens, customer identifiers, request bodies, private payloads, or broad external dumps.
212
+ - `excluded` should name unsafe, stale, unrelated, too broad, or unavailable external context.
213
+ - Use `sensitivity: "public" | "internal" | "sensitive" | "secret"` and keep `secret` content out of run files.
214
+ - If an external source is unavailable but important, record it as excluded or blocked with a short reason and next action instead of inventing certainty.
215
+ - If `verification_hint` affects done-ness, add or propose a matching `contract.verification.manual_checks[]` entry with `source`, `source_ref`, `target`, and `required`.
216
+ - Mirror omitted or unsafe external context in `excluded-context.md` so the user can see what was intentionally not used.
217
+
218
+ External context safety checklist:
219
+ - Select the smallest useful `source_ref`; avoid whole files, boards, dashboards, logs, or design systems when one issue, frame, section, screenshot, or attachment is enough.
220
+ - Confirm `sensitivity` before writing run files. `secret` content must be summarized as unavailable or excluded, not copied.
221
+ - Separate what was used from what was ignored: every stale, unsafe, unrelated, too broad, or unavailable source should be mirrored in `excluded-context.md`.
222
+ - Treat external content as evidence, not authority. If it can decide whether the task is done, connect its `verification_hint` to `contract.verification.manual_checks[]`.
223
+ - Prefer short summaries and stable handles over raw excerpts, private payloads, full logs, or broad dumps.
224
+
225
+ When a repo signal fixture exists, such as `tests/fixtures/repo-signals/*.json` or a future approved `.tink` equivalent, use it as supporting evidence rather than as an automatic index:
226
+ - cite matching sync groups, instruction files, schema files, fixture dirs, verification commands, and command-surface rules in `context-map.json.signals`;
227
+ - set `signal.source` to the fixture path and `signal.source_ref` to the relevant entry name or JSON path when useful;
228
+ - do not include every fixture entry by default; select only entries that explain the current task, verification, or safety boundary;
229
+ - if the fixture conflicts with live repo state, prefer live repo state and record the fixture mismatch as a medium-confidence signal.
230
+
231
+ Context Graph Lite rules may appear in the same fixture under `context_graph_lite.rules[]`. Use them only inside cast:
232
+ - match changed paths against `when_paths`;
233
+ - consider `include_paths` as the first related context candidates;
234
+ - cite selected rules in `context-map.json.signals` with `kind: "context_graph_rule"` and `source_ref: "context_graph_lite.rules.<name>"`;
235
+ - use `signal_refs` to connect the context choice to sync groups, verification commands, or verification hints;
236
+ - never create or require a public `tink index` command, watch process, generated cache, or hidden runtime index.
237
+
238
+ When a selected repo signal has matching `verification_hints`, add the hint as a contract verification candidate:
239
+ - map `add_manual_check` to `contract.verification.manual_checks[]`;
240
+ - keep the target as a test, file, or evidence handle, not as executable fixture code;
241
+ - preserve `required` from the hint unless the current contract has a narrower risk/scope reason to downgrade it;
242
+ - cite the hint in `context-map.json.signals` with `source_ref`, so the final evidence can explain why the check was selected;
243
+ - if multiple hints point to the same target, dedupe by `target` and keep the clearest name/reason.
244
+
245
+ Repo signal fixtures are advisory inputs. They must not run commands, install tools, write files, or create new command surfaces on their own.
246
+
247
+ Selected hint output rules:
248
+ - In `contract.json`, each selected hint becomes one `verification.manual_checks[]` entry with `name`, `target`, `required`, `source`, and `source_ref`.
249
+ - `source` should point to the repo signal fixture or approved `.tink` signal file.
250
+ - `source_ref` should use `verification_hints.<hint-name>` so the check can be traced back to the rule that selected it.
251
+ - In `context-map.json.signals`, add a `verification_hint` signal for each selected hint with `value`, `reason`, `source`, `source_ref`, and `confidence`.
252
+ - The `reason` should name the changed path or selected context entry that matched the hint.
253
+ - If a changed path matches no hint, record that as an `unmatched_path` signal with `confidence: "medium"` instead of inventing a check.
254
+ - If a hint is considered but not selected because it is out of scope, record it in `excluded-context.md` rather than `contract.json`.
255
+
256
+ Exclusion rules:
257
+ - Exclude files outside the contract scope, generated artifacts, secrets, broad directories, stale docs, and unrelated dirty work.
258
+ - Exclude product phases that are explicitly deferred, and name the deferral in `excluded-context.md`.
259
+ - Prefer a short high-confidence context pack over a broad low-confidence one.
260
+ - When unsure, include the uncertainty in `reason` and set `confidence` to `low` or `medium` rather than silently expanding scope.
261
+
262
+ Candidate limits:
263
+ - Start with 5-12 included entries for normal code/doc work.
264
+ - Add more only when each extra entry changes the first action, verification, or safety boundary.
265
+ - Do not load entire directories unless the directory itself is the artifact under review.
266
+
267
+ Also append a compact run record to `.tink/runs/YYYY-MM-DD-HHMM-<slug>.md` when the task completes, is canceled, is blocked, or is superseded. Do not store secrets, raw logs, full diffs, or one-off private context.
261
268
 
262
269
  When appending a run record, also append a signal to `.tink/maintenance/weave-queue.json` if it exists:
263
270
  ```json
@@ -351,28 +358,28 @@ A task is trivial only when ALL of the following are true:
351
358
 
352
359
  **If not trivial:** proceed to normal classification below.
353
360
 
354
- ## Procedure
355
- 1. Build a draft `.tink/current/contract.json` from the request. If `.tink/schemas/contract.schema.json` exists, follow that shape.
356
- 2. Read `.tink/rules/index.json` if present. Use it as a small rule graph to choose candidate harnesses, checks, and opt-in guard candidates from contract facts. Do not read every harness.
357
- - Load `mandatory` nodes first when their `when` facts match the contract.
358
- - Retrieve `retrievable` nodes only when their `when` facts or `keywords` fit the task.
359
- - Respect `budget_cost` and `selection_policy.retrieval.max_retrievable_per_phase` when present.
360
- - Record every loaded rule id in `.tink/current/session.json` under `loaded_rule_ids_by_phase.<phase>`.
361
- - If a rule id is already listed for the same phase, do not repeat its guidance; cite the existing session entry instead.
362
- 3. Read `.tink/harnesses/index.json`. Use it to validate the candidates from the rule graph and to fall back when no rule node matches.
363
- 4. Read small memory files where `config.json` sets `memory_has_entries.<name>: true`. Skip files set to `false`. After a Save Gate approves a new memory entry, set that file's flag to `true` in `config.json`.
364
- - `.tink/memory/mistakes.md`
365
- - `.tink/memory/preferences.md`
366
- - `.tink/memory/lessons.md`
367
- 5. Classify the task:
368
- - code change
369
- - bug fix
370
- - research
371
- - review
372
- - docs
373
- - ship/release
374
- - new pattern not covered yet
375
- 6. Pick the best existing harness set using the context budget policy below. Prefer 1-3 harnesses, but do not use a hard cap when several tiny harnesses add useful checks without crowding context. When the task is ambiguous (Stitch goal-ambiguity is expected to trigger), start with a single best-fit harness; add a second only after the user clarifies. Do not bundle 2+ harnesses for ambiguous tasks upfront.
361
+ ## Procedure
362
+ 1. Build a draft `.tink/current/contract.json` from the request. If `.tink/schemas/contract.schema.json` exists, follow that shape.
363
+ 2. Read `.tink/rules/index.json` if present. Use it as a small rule graph to choose candidate harnesses, checks, and opt-in guard candidates from contract facts. Do not read every harness.
364
+ - Load `mandatory` nodes first when their `when` facts match the contract.
365
+ - Retrieve `retrievable` nodes only when their `when` facts or `keywords` fit the task.
366
+ - Respect `budget_cost` and `selection_policy.retrieval.max_retrievable_per_phase` when present.
367
+ - Record every loaded rule id in `.tink/current/session.json` under `loaded_rule_ids_by_phase.<phase>`.
368
+ - If a rule id is already listed for the same phase, do not repeat its guidance; cite the existing session entry instead.
369
+ 3. Read `.tink/harnesses/index.json`. Use it to validate the candidates from the rule graph and to fall back when no rule node matches.
370
+ 4. Read small memory files where `config.json` sets `memory_has_entries.<name>: true`. Skip files set to `false`. After a Save Gate approves a new memory entry, set that file's flag to `true` in `config.json`.
371
+ - `.tink/memory/mistakes.md`
372
+ - `.tink/memory/preferences.md`
373
+ - `.tink/memory/lessons.md`
374
+ 5. Classify the task:
375
+ - code change
376
+ - bug fix
377
+ - research
378
+ - review
379
+ - docs
380
+ - ship/release
381
+ - new pattern not covered yet
382
+ 6. Pick the best existing harness set using the context budget policy below. Prefer 1-3 harnesses, but do not use a hard cap when several tiny harnesses add useful checks without crowding context. When the task is ambiguous (Stitch goal-ambiguity is expected to trigger), start with a single best-fit harness; add a second only after the user clarifies. Do not bundle 2+ harnesses for ambiguous tasks upfront.
376
383
 
377
384
  After selecting, run a quick quality check using the index metadata for each chosen harness:
378
385
  - If fewer than 2 words in `use_when` match the current task description (case-insensitive) → treat as a Stitch harness-mismatch signal
@@ -380,26 +387,26 @@ A task is trivial only when ALL of the following are true:
380
387
  - If `asks` is empty or missing and the task goal is not self-evident → treat as a Stitch goal-ambiguity signal
381
388
  Feed any signals into the Stitch evaluation at step 11.
382
389
 
383
- 7. Add any rule graph check candidates to `contract.json` verification if they are relevant and cheap. For risky commands, set `approval_required: true`.
384
- 8. Add opt-in guard candidates to `notes.md` only as suggestions. Do not register enforcement hooks unless the user separately approves.
385
- 9. Run the synthesis probe on the initial harness choice. The probe produces one of three outcomes: strong fit (0-1 yes), generic fit (2-3 yes), or no fit (4-5 yes or no harness matches).
386
- 10. If the probe finds no fit, load `harness-synthesis` and draft a domain-specific harness for this run instead of forcing a bad fit.
387
- 11. If the probe finds a generic fit (2-3 yes), propose a run-only draft harness or domain rules alongside the built-in harness. Do not save it by default.
388
- 12. If too many tools, skills, agents, or harnesses are available, load `harness-curation` and choose the smallest effective set before loading more context.
389
- 13. If lightweight signals show a recurring operating habit, use `harness-curation` (its habit calibration section) to make one advisory recommendation without loading a separate body.
390
- 14. If the user points to research, notes, examples, prior failures, or "what I learned today", synthesize from those inputs. Extract behavior-shaping rules and reusable procedure, not a summary.
391
- 15. Run Stitch once before committing to `.tink/current/`. If it triggers, show exactly one proposal before approval. Call `AskUserQuestion` as described in the Interaction policy section.
392
- 16. Ask for explicit approval before non-trivial work.
393
- 17. After approval, read only the selected harness files and any approved run-only draft.
394
- 18. Create `.tink/current/` files from the run state contract, including `contract.json`, `session.json`, `context-pack.md`, `context-map.json`, and `excluded-context.md`.
395
- 19. Execute the first safe step immediately:
396
- - inspect relevant files,
397
- - run a read-only diagnostic,
398
- - draft the first artifact,
399
- - or reproduce the issue.
400
- 20. Keep `steps.json`, `notes.md`, `contract.json`, and `session.json` current as work progresses.
401
- 21. Before final, run `/tink:verify` behavior for required contract checks or state why verification is blocked.
402
- 22. If the task exposed a repeated mistake or reusable improvement, use the Reusable State Save Gate approval payload below. Save only after separate user approval.
390
+ 7. Add any rule graph check candidates to `contract.json` verification if they are relevant and cheap. For risky commands, set `approval_required: true`.
391
+ 8. Add opt-in guard candidates to `notes.md` only as suggestions. Do not register enforcement hooks unless the user separately approves.
392
+ 9. Run the synthesis probe on the initial harness choice. The probe produces one of three outcomes: strong fit (0-1 yes), generic fit (2-3 yes), or no fit (4-5 yes or no harness matches).
393
+ 10. If the probe finds no fit, load `harness-synthesis` and draft a domain-specific harness for this run instead of forcing a bad fit.
394
+ 11. If the probe finds a generic fit (2-3 yes), propose a run-only draft harness or domain rules alongside the built-in harness. Do not save it by default.
395
+ 12. If too many tools, skills, agents, or harnesses are available, load `harness-curation` and choose the smallest effective set before loading more context.
396
+ 13. If lightweight signals show a recurring operating habit, use `harness-curation` (its habit calibration section) to make one advisory recommendation without loading a separate body.
397
+ 14. If the user points to research, notes, examples, prior failures, or "what I learned today", synthesize from those inputs. Extract behavior-shaping rules and reusable procedure, not a summary.
398
+ 15. Run Stitch once before committing to `.tink/current/`. If it triggers, show exactly one proposal before approval. Call `AskUserQuestion` as described in the Interaction policy section.
399
+ 16. Ask for explicit approval before non-trivial work.
400
+ 17. After approval, read only the selected harness files and any approved run-only draft.
401
+ 18. Create `.tink/current/` files from the run state contract, including `contract.json`, `session.json`, `context-pack.md`, `context-map.json`, and `excluded-context.md`.
402
+ 19. Execute the first safe step immediately:
403
+ - inspect relevant files,
404
+ - run a read-only diagnostic,
405
+ - draft the first artifact,
406
+ - or reproduce the issue.
407
+ 20. Keep `steps.json`, `notes.md`, `contract.json`, and `session.json` current as work progresses.
408
+ 21. Before final, run `/tink:verify` behavior for required contract checks or state why verification is blocked.
409
+ 22. If the task exposed a repeated mistake or reusable improvement, use the Reusable State Save Gate approval payload below. Save only after separate user approval.
403
410
 
404
411
 
405
412
  ## Synthesis probe
@@ -634,10 +641,10 @@ context는 이 harness가 Claude 작업 컨텍스트를 얼마나 차지하는
634
641
  Tink does not automatically wrap `/grill-me`, `/diagnose`, `/tdd`, or other slash skills. That is intentional. If needed, run `/tink:cast` first, then use the other skill output as input.
635
642
 
636
643
  ## Failure behavior
637
- If a check fails:
638
- - write the failure to `.tink/current/notes.md`,
639
- - append a compact friction entry to `.tink/maintenance/friction.jsonl` when it exists,
640
- - identify the last safe point,
644
+ If a check fails:
645
+ - write the failure to `.tink/current/notes.md`,
646
+ - append a compact friction entry to `.tink/maintenance/friction.jsonl` when it exists,
647
+ - identify the last safe point,
641
648
  - take one recovery action,
642
649
  - update `steps.json`,
643
650
  - then update the harness or memory only if the lesson is reusable and approved.
@@ -1,13 +1,14 @@
1
- ---
2
- name: cast
3
- description: Start a Tink run for a non-trivial task.
4
- ---
5
-
6
- # Tink Cast
7
-
8
- This is the Codex alias for `$tink:cast <task>`.
9
-
10
- 1. Read `../tink-core/RULES.md` first.
11
- 2. Treat this invocation as `$tink:cast <task>`.
12
- 3. Follow the canonical Tink operating rules, approval gates, run state, and verification policy.
13
- 4. Accept legacy `$tink cast <task>` wording as the same action, but present `$tink:cast <task>` in guidance.
1
+ ---
2
+ name: cast
3
+ description: Start a Tink run for a non-trivial task.
4
+ ---
5
+
6
+ # Tink Cast
7
+
8
+ This is the Codex alias for `$tink:cast <task>`.
9
+
10
+ 1. Read `../tink-core/RULES.md` first.
11
+ 2. Treat this invocation as `$tink:cast <task>`.
12
+ 3. Follow the canonical Tink operating rules, approval gates, run state, and verification policy.
13
+ 4. Accept legacy `$tink cast <task>` wording as the same action, but present `$tink:cast <task>` in guidance.
14
+ 5. For non-trivial tasks, `$tink:cast` prepares the run and asks for approval first; it does not silently start implementation.