@saasontools/strauss-kb 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ARCHITECTURE.md CHANGED
@@ -107,6 +107,32 @@ Each anchor records the resolver that stamped it. A hash only the previous
107
107
  resolver reproduces is `drifted`, reason `resolver-changed`. Trees are cached
108
108
  per content hash, grammars load once per process.
109
109
 
110
+ A tree-sitter stamp hashes the span's token stream rather than its text
111
+ (`hash_kind: "ast"`), so a reformat is not drift; a raw hash keeps comparing
112
+ raw until it is rebaselined.
113
+
114
+ ### Drift classification
115
+
116
+ Once the bytes differ, the question is what a machine can settle and what it
117
+ must hand on.
118
+
119
+ | Class | Test | Who settles it |
120
+ | ---------- | ------------------------------------------- | -------------- |
121
+ | `moved` | the stored hash resolves at another address | `kb_reassess` |
122
+ | `cosmetic` | both spans are one token stream | classification |
123
+ | `gone` | the file or symbol no longer exists | a reader |
124
+ | `changed` | everything else | a reader |
125
+
126
+ `moved` and `cosmetic` cost a repository search and a git read, so `load` and
127
+ `query` report only the two a hash comparison already answers and
128
+ `classifyDrift` refines the rest on demand.
129
+
130
+ Classification stops there because the next question — does the record's claim
131
+ still hold — is a reading, and every mechanical proxy for it (similarity
132
+ scores, "small" diffs) answers a different question confidently. So the packet
133
+ carries the evidence a reader needs and names a type-based default, and no
134
+ drift path writes `verified[]` or moves standing.
135
+
110
136
  Repository identity is normalised and compared, not parsed: an invented format
111
137
  would reject correct values from unseen hosts.
112
138
 
package/README.md CHANGED
@@ -211,13 +211,14 @@ end of it. Six optional fields extend it:
211
211
  | Field | Meaning |
212
212
  | ------------- | ------------------------------------------------------------------------------------- |
213
213
  | `hash` | `sha256:<hex>` over the anchored text, algorithm-prefixed. |
214
+ | `hash_kind` | What `hash` covered: `raw` text, or the `ast` token stream. Absent means `raw`. |
214
215
  | `lines` | Line count the hash covered. |
215
216
  | `resolved_at` | When the anchor last resolved. |
216
217
  | `resolver` | Which resolver produced the hash: `tree-sitter` or `regex`. |
217
218
  | `repo` | Which repository — remote URL or short name. Absent means this base's own repository. |
218
219
  | `ref` | Git rev the evidence was taken at. |
219
220
 
220
- `hash`, `lines`, `resolved_at`, and `resolver` are **measured** — a resolution pass stamps
221
+ `hash`, `hash_kind`, `lines`, `resolved_at`, and `resolver` are **measured** — a resolution pass stamps
221
222
  them; `repo` and `ref` are **author-owned identity** and a resolution pass
222
223
  never writes them.
223
224
 
@@ -259,6 +260,29 @@ package: grammar and query both download on first use, sha256-pinned against
259
260
  the new one does not is `drifted` with reason `resolver-changed` — accept it
260
261
  with `--rebaseline`.
261
262
 
263
+ A tree-sitter stamp hashes the span's normalised token stream
264
+ (`hash_kind: "ast"`), so reformatting the anchored code is not drift. An anchor
265
+ stamped before that keeps comparing raw text until `--rebaseline` restamps it.
266
+
267
+ ### Drift classes
268
+
269
+ Once the bytes differ, drift is classified — two classes a machine can close,
270
+ two it hands on:
271
+
272
+ - **moved** — the stored hash turned up elsewhere: same code, new address.
273
+ `kb_reassess` moves the anchor and asks nothing of a reader.
274
+ - **cosmetic** — the old and new spans are one token stream; only formatting
275
+ changed. Needs a grammar, so the regex resolver never reports it.
276
+ - **gone** — the file or the symbol no longer exists. The strongest signal:
277
+ the described code cannot be re-read.
278
+ - **changed** — everything else, and the only class a reader has to judge.
279
+
280
+ `kb_reassess <concept-id>` (`kb_doctor --drifted` base-wide) turns what is left
281
+ into a packet: the record's claim, each anchor's class, the old-vs-new span diff
282
+ (`--with-diff`, recovered from `ref` or from history), and the record's `impact`
283
+ set. Neither verb verifies, supersedes, or changes standing — see the skill's
284
+ protocol.
285
+
262
286
  Drift also surfaces on read: `kb_load` and `kb_query` attach a
263
287
  `{ kind: "drifted" }` warning — or `{ kind: "unchecked" }` for a foreign anchor
264
288
  they could not read from the cache, because they never fetch — and `kb_doctor`
@@ -285,6 +309,8 @@ strauss-kb [--bundle PATH] <command> [args]
285
309
  verify <concept-id> --note <text> Append a verified[] event — who checked, when, and what the check found.
286
310
  anchor-resolve <concept-id> [--repo-root <path>] [--rebaseline] [--restamp]
287
311
  Resolve anchors against the working tree: stamp, or report drift.
312
+ reassess <concept-id> [--repo-root <path>] [--with-diff]
313
+ One drifted record as something to judge: claim, classes, diff, impact.
288
314
  load [type] [--budget N | --all] [--repo-root PATH]
289
315
  Hand over the whole base, each record with its standing.
290
316
  catalog [type] Every record in one line — id, type, title, standing, stale flag.
@@ -354,9 +380,11 @@ strauss-kb validate || echo "errors above" # warnings alone still exit 0
354
380
  ```
355
381
 
356
382
  Every CLI verb is a tool: `kb_write`, `kb_write_decision`, `kb_no_decision`,
357
- `kb_status`, `kb_supersede`, `kb_answer`, `kb_verify`, `kb_anchor_resolve`, `kb_load`, `kb_catalog`,
383
+ `kb_status`, `kb_supersede`, `kb_answer`, `kb_verify`, `kb_anchor_resolve`, `kb_reassess`,
384
+ `kb_load`, `kb_catalog`,
358
385
  `kb_pack`,
359
- `kb_query`, `kb_trace`, `kb_impact`, `kb_backlinks`, `kb_list`, `kb_index`, `kb_log`, `kb_validate`,
386
+ `kb_query`, `kb_trace`, `kb_impact`, `kb_backlinks`, `kb_list`, `kb_index`, `kb_log`, `kb_stamp`,
387
+ `kb_validate`,
360
388
  `kb_doctor`, `kb_schema`, `kb_types`, `kb_pin`, `kb_unpin`, `kb_pins`,
361
389
  `kb_context`. Most take a `bundlePath`. The one CLI verb with no tool is
362
390
  `sync-instructions`; the agent capability is `kb_context`.