@inerrata-corporation/errata 2.0.22-dev.4130 → 2.0.22-dev.4148

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.
@@ -16084,6 +16084,548 @@ var init_sqlite_adapter = __esm({
16084
16084
  }
16085
16085
  });
16086
16086
 
16087
+ // ../../packages/local-shared/src/tag-grammar.ts
16088
+ function tagGrammarCopy() {
16089
+ const copy = [];
16090
+ for (const ref of ["its-handle", "its-id", "h", "id"]) {
16091
+ for (const build of Object.values(TAG_EXAMPLES)) copy.push(build(ref));
16092
+ }
16093
+ for (const v of TAG_VERBS) {
16094
+ copy.push(v.hint);
16095
+ if (v.taughtBy) copy.push(v.taughtBy);
16096
+ for (const q of v.qualifiers ?? []) copy.push(q.note);
16097
+ for (const l of v.lowering) {
16098
+ if (l.note) copy.push(l.note);
16099
+ if (l.knownViolation) copy.push(l.knownViolation.finding);
16100
+ }
16101
+ }
16102
+ for (const f of TAG_FENCES) copy.push(f.hint);
16103
+ return copy;
16104
+ }
16105
+ function normalizeTemplateBody(body) {
16106
+ return body.replace(/…|\.{3}/g, " ").replace(/\s+/g, " ").trim().replace(/^[\s,;:—–-]+|[\s,;:.—–-]+$/g, "").toLowerCase();
16107
+ }
16108
+ function deriveTagTemplates(copy) {
16109
+ const bodies = /* @__PURE__ */ new Set();
16110
+ const handles = new Set([...TAG_PLACEHOLDER_HANDLES].map((h) => h.toLowerCase()));
16111
+ for (const text of copy) {
16112
+ for (const m of text.matchAll(BRACKET_TOKEN)) {
16113
+ const token = m[1].trim().toLowerCase();
16114
+ if (!/^[!?]/.test(token) && !REAL_HANDLE_SHAPE.test(token)) handles.add(token);
16115
+ }
16116
+ }
16117
+ for (const text of copy) {
16118
+ for (const m of text.matchAll(TEMPLATE_VERB_GROUP)) {
16119
+ const body = normalizeTemplateBody(m[2]);
16120
+ bodies.add(body);
16121
+ const unthreaded = normalizeTemplateBody(body.replace(/^#[a-z][\w-]*/i, ""));
16122
+ bodies.add(unthreaded);
16123
+ const rest = normalizeTemplateBody(unthreaded.replace(BRACKET_TOKEN, (t, h) => handles.has(h.trim().toLowerCase()) ? " " : t).replace(/,/g, " "));
16124
+ bodies.add(rest);
16125
+ }
16126
+ }
16127
+ bodies.delete("");
16128
+ return { bodies, handles };
16129
+ }
16130
+ var TAG_CANONICAL_ID_PREFIXES, TAG_HANDLE_SOURCE, TAG_THREAD_SOURCE, TAG_PLACEHOLDER_HANDLES, TAG_EXAMPLES, P, S, RC, CITE_LOWERING, INSTANCE_LOWERING, TRIAGE_TO_RC, TAG_VERBS, TAG_FENCES, TAG_VERB_BY_NAME, TAG_PAREN_VERBS, TAG_GRAMMAR_OPENERS, TAG_QUOTED_PAREN_SOURCE, TAG_QUOTED_RE, TAG_QUOTED_PAREN_RE, TEMPLATE_VERB_GROUP, BRACKET_TOKEN, REAL_HANDLE_SHAPE, TAG_TEMPLATES, VERB_WORDS_SOURCE, JOINED_VERB, LEADING_VERB, ANY_VERB_WORD, QUOTED_TAG_OPENER;
16131
+ var init_tag_grammar = __esm({
16132
+ "../../packages/local-shared/src/tag-grammar.ts"() {
16133
+ "use strict";
16134
+ TAG_CANONICAL_ID_PREFIXES = ["pat", "sol", "drc", "dcause", "dfix", "dprob", "dvuln", "prob", "claim", "err"];
16135
+ TAG_HANDLE_SOURCE = String.raw`\[([a-z0-9][\w-]{0,80})\]|((?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})`;
16136
+ TAG_THREAD_SOURCE = String.raw`#([a-z][\w-]{0,63})`;
16137
+ TAG_PLACEHOLDER_HANDLES = /* @__PURE__ */ new Set([
16138
+ "handle",
16139
+ "its-handle",
16140
+ "another",
16141
+ "a-third",
16142
+ "h",
16143
+ "h1",
16144
+ "h2",
16145
+ "id",
16146
+ "its-id",
16147
+ "a",
16148
+ "b",
16149
+ "\u2026",
16150
+ "..."
16151
+ ]);
16152
+ TAG_EXAMPLES = {
16153
+ prior: (ref) => `([${ref}])`,
16154
+ problem: () => `[!one line on what's wrong]`,
16155
+ vulnerability: () => `[!vuln: who can do what; observed basis @ path:line]`,
16156
+ suspectedVulnerability: () => `[?vuln: consequence; missing check]`,
16157
+ vulnerabilityThread: () => `[!#v vuln: finding here]`,
16158
+ fix: (ref) => `(fix:[${ref}])`,
16159
+ // CONSTRAINT — the native capture path for a DIFFUSE problem (a constraint/tension/
16160
+ // conflict that shaped a decision). Free text, attaches to the decision sentence the
16161
+ // agent is already writing. Full rationale in the constraint note below + prior-tags.ts.
16162
+ constraint: () => `(constraint: the limitation that forced it)`,
16163
+ // TRIAGE — routes the problem/symptom in scope to its cause. `(cause:[handle])`
16164
+ // links to a cited RootCause/Solution node; `(cause: free text)` mints a RootCause
16165
+ // from the text. Harvested in prior-tags.ts → engine.ts (see the triage note below).
16166
+ triage: (ref) => `(cause:[${ref}])`,
16167
+ // Unlike a bare cause citation, this handle names the Problem being explained.
16168
+ triageExplain: (ref) => `(cause:[${ref}] the mechanism)`,
16169
+ // The MINT form — free-text cause that mints a RootCause. Prime-time surfacing
16170
+ // (recallForFile) pastes this next to an open Problem that has no cause yet, so the
16171
+ // diagnostic moment is cued when the agent is looking at the problem. Kept here so
16172
+ // the grammar can't drift from parseInlineTags' `(cause: …)` acceptance.
16173
+ triageMint: () => `(cause: why it happens)`,
16174
+ // THREAD forms — the witness-declared symptom↔cause/fix binding. A `#id` on the
16175
+ // flag names the diagnosis thread; the same `#id` on a later verb binds to it
16176
+ // explicitly (across sentences AND turns), replacing proximity guessing. Adjacent
16177
+ // tags never need one — the id is for diagnoses that unfold over distance.
16178
+ problemThread: () => `[!#slug one line on what's wrong]`,
16179
+ causeThread: () => `(cause:#slug the mechanism)`,
16180
+ fixThread: (thread = "slug") => `(fix:#${thread} what you changed)`,
16181
+ // ATTEMPT arc — what's being tried and what didn't work. A failed attempt is a
16182
+ // witnessed NEGATIVE result: it saves the next agent the same dead end.
16183
+ tried: () => `(tried: the approach you're attempting)`,
16184
+ failed: () => `(failed: what didn't work and the dead end it rules out)`,
16185
+ // `(failed:[h] …)` on a shown SOLUTION — the refute-by-failure form the context render teaches.
16186
+ failedCite: (ref) => `(failed:[${ref}] what came back)`,
16187
+ // LINK verbs (AC epic) — bind the problem in scope to CANONICAL priors and
16188
+ // abstractions. Multi-target by design: single links are weak; ~3 links to 3
16189
+ // DIFFERENT relevant priors is the target shape (see linkBullet).
16190
+ instance: (ref) => `(instance:[${ref}],[another],[a-third])`,
16191
+ pattern: () => `(pattern: name the general shape)`,
16192
+ // DOMAIN — the abstract area a problem is about; the concept layer an
16193
+ // anchor-less problem clusters on. Mints/resolves a Domain by name.
16194
+ domain: () => `(domain: The Area)`,
16195
+ // PACKAGE/COMPONENT — agent-named public anchors (OM-agent-anchors): the
16196
+ // package a problem is ABOUT (even when not a dependency) and the
16197
+ // framework/product-level unit it concerns. Public spine anchors → the
16198
+ // knowledge can cross to the collective.
16199
+ package: () => `(package: the-package-name)`,
16200
+ component: () => `(component: The Component)`,
16201
+ aids: (ref) => `(aids:[${ref}])`,
16202
+ // SOLUTION-STRUCTURE (SS-structure) — taught in the link bullet; Solution→Solution.
16203
+ buildsOn: (ref) => `(builds-on:[${ref}])`,
16204
+ supersedes: (ref) => `(supersedes:[${ref}])`,
16205
+ alternative: (ref) => `(alternative:[${ref}])`,
16206
+ // VERDICT (VS-verdict-tags) — a judgment on a SHOWN prior, distinct from leaning on it.
16207
+ // `confirm` rides the corroborate channel (it held); `refute` the contradict channel
16208
+ // (it's wrong / didn't hold) and REQUIRES a reason. This is the inline producer the
16209
+ // evidence channels lacked — refute sat dead (contradictionPressure 0) until now, while
16210
+ // lean-on corroboration lived, because only corroboration had an inline path. Grammar
16211
+ // single-sourced with parseInlineTags' CONFIRM_PREFIX/REFUTE_PREFIX.
16212
+ confirm: (ref) => `(confirm:[${ref}])`,
16213
+ refute: (ref) => `(refute:[${ref}] one line why)`,
16214
+ // RETRACT — "not a real problem": the errata-resolved block with a disposition
16215
+ // (parseDesignResolutions, turn.ts). No inline form exists; the block is the grammar.
16216
+ retract: (id) => ["```errata-resolved", `id: ${id}`, "disposition: false_positive", "reason: why it was never a real problem", "```"].join("\n")
16217
+ };
16218
+ P = "Problem";
16219
+ S = "Solution";
16220
+ RC = "RootCause";
16221
+ CITE_LOWERING = [
16222
+ { target: RC, writes: [{ from: P, edge: "CAUSED_BY", to: RC }] },
16223
+ { target: S, writes: [{ from: P, edge: "SOLVED_BY", to: S }] },
16224
+ { target: "Pattern", writes: [{ from: P, edge: "INSTANCE_OF", to: "Pattern" }, { from: "Pattern", edge: "ANCHORED_AT", to: "File" }], note: "cite-anchor promotion after 2 sessions", decision: "d", knownViolation: { edge: "ANCHORED_AT", finding: "motif cite-anchor promotion writes a refused ANCHORED_AT" } },
16225
+ { target: "Package", writes: [{ from: P, edge: "DEPENDS_ON", to: "Package" }] },
16226
+ { target: "Language", writes: [{ from: P, edge: "OCCURS_IN", to: "Language" }] },
16227
+ { target: "Tool", writes: [{ from: P, edge: "CONCERNS", to: "Tool" }] },
16228
+ { target: "Component", writes: [{ from: P, edge: "CONCERNS", to: "Component" }] },
16229
+ { target: P, writes: [{ from: P, edge: "RELATES_TO", to: P }, { from: P, edge: "ANCHORED_AT", to: "File" }], note: "corroboration witness + cite-anchor promotion" },
16230
+ { target: "AntiPattern", writes: [{ from: P, edge: "RELATES_TO", to: "AntiPattern" }, { from: "AntiPattern", edge: "ANCHORED_AT", to: "File" }], decision: "e", knownViolation: { edge: "ANCHORED_AT", finding: "motif cite-anchor promotion writes a refused ANCHORED_AT" } },
16231
+ { target: "Technique", writes: [{ from: P, edge: "RELATES_TO", to: "Technique" }, { from: "Technique", edge: "ANCHORED_AT", to: "File" }], decision: "e", knownViolation: { edge: "ANCHORED_AT", finding: "motif cite-anchor promotion writes a refused ANCHORED_AT" } },
16232
+ { target: "Weakness", writes: [{ from: P, edge: "RELATES_TO", to: "Weakness" }], decision: "e" },
16233
+ { target: "Domain", writes: [{ from: P, edge: "RELATES_TO", to: "Domain" }], decision: "e" },
16234
+ { target: "Claim", writes: [{ from: P, edge: "RELATES_TO", to: "Claim" }, { from: "Claim", edge: "ANCHORED_AT", to: "File" }] }
16235
+ ];
16236
+ INSTANCE_LOWERING = [
16237
+ { target: "Pattern", writes: [{ from: P, edge: "INSTANCE_OF", to: "Pattern" }] },
16238
+ { target: P, writes: [{ from: P, edge: "RELATES_TO", to: P }] },
16239
+ { target: S, writes: [{ from: P, edge: "SOLVED_BY", to: S }], note: "an instance cite on a Solution claims the problem is solved by it", decision: "a" },
16240
+ { target: RC, writes: [{ from: P, edge: "CAUSED_BY", to: RC }] },
16241
+ { target: "AntiPattern", writes: [{ from: P, edge: "RELATES_TO", to: "AntiPattern" }], decision: "e" },
16242
+ { target: "Technique", writes: [{ from: P, edge: "RELATES_TO", to: "Technique" }], decision: "e" },
16243
+ { target: "Weakness", writes: [{ from: P, edge: "RELATES_TO", to: "Weakness" }], decision: "e" },
16244
+ { target: "Domain", writes: [{ from: P, edge: "RELATES_TO", to: "Domain" }], decision: "e" },
16245
+ { target: "Package", writes: [{ from: P, edge: "DEPENDS_ON", to: "Package" }] },
16246
+ { target: "Component", writes: [{ from: P, edge: "CONCERNS", to: "Component" }] }
16247
+ ];
16248
+ TRIAGE_TO_RC = [
16249
+ { from: P, edge: "TRIAGED_BY", to: "Triage" },
16250
+ { from: "Triage", edge: "INDICATES", to: RC },
16251
+ { from: P, edge: "CAUSED_BY", to: RC }
16252
+ ];
16253
+ TAG_VERBS = [
16254
+ {
16255
+ verb: "cite",
16256
+ form: "citation",
16257
+ opener: "(",
16258
+ kinds: ["prior"],
16259
+ args: "handles",
16260
+ thread: false,
16261
+ handleRequired: true,
16262
+ lowering: CITE_LOWERING,
16263
+ examples: ["prior"],
16264
+ hint: "cite a shown prior you leaned on: ([its-handle]) \u2014 handles only, no prose inside the parens",
16265
+ taught: "taught"
16266
+ },
16267
+ {
16268
+ verb: "!",
16269
+ form: "flag",
16270
+ opener: "[!",
16271
+ kinds: ["problem", "triage", "vulnerability", "fix", "prior"],
16272
+ args: "flag-body",
16273
+ thread: true,
16274
+ minText: 8,
16275
+ qualifiers: [
16276
+ { name: "vuln", taught: true, note: "[!vuln: \u2026] \u2192 Vulnerability (asserted)" },
16277
+ { name: "fixed", taught: false, note: "[!fixed: X] \u2192 read as a self-found fix" },
16278
+ { name: "resolved", taught: false, note: "[!resolved: X] \u2192 read as a self-found fix" }
16279
+ ],
16280
+ lowering: [
16281
+ { target: P, writes: [], note: "mints a Problem; `@ path[:line]` anchors it (ANCHORED_AT to code)" },
16282
+ { target: RC, writes: [...TRIAGE_TO_RC, { from: RC, edge: "CAUSED_BY", to: RC }], note: "`<-` segments: first \u2192 triage route, later \u2192 RootCause chain" },
16283
+ { target: "Vulnerability", writes: [], note: "[!vuln: \u2026]; `<-` causes stay on the finding (vulnerabilityCauses)" }
16284
+ ],
16285
+ examples: ["problem", "problemThread", "vulnerability", "vulnerabilityThread"],
16286
+ hint: "flag a problem on one line: [!what's wrong @ path:42]; fold causes with <- ; a fix goes in (fix: \u2026), not [!fixed: \u2026]",
16287
+ taught: "taught"
16288
+ },
16289
+ {
16290
+ verb: "?",
16291
+ form: "flag",
16292
+ opener: "[?",
16293
+ kinds: ["todo", "vulnerability"],
16294
+ args: "flag-body",
16295
+ thread: true,
16296
+ minText: 8,
16297
+ qualifiers: [{ name: "vuln", taught: true, note: "[?vuln: \u2026] \u2192 Vulnerability (suspected)" }],
16298
+ lowering: [{ target: P, writes: [], note: "mints a todo Problem; a fix can close it today", decision: "g" }],
16299
+ examples: ["suspectedVulnerability"],
16300
+ hint: "[?\u2026] marks an open question / todo; [?vuln: consequence; missing check] a suspected vulnerability",
16301
+ taught: "untaught",
16302
+ taughtBy: "only the [?vuln:] form is taught; the bare [?todo] form is not",
16303
+ decisions: ["g"]
16304
+ },
16305
+ {
16306
+ verb: "fix",
16307
+ form: "verb",
16308
+ opener: "(fix:",
16309
+ kinds: ["fix"],
16310
+ args: "handles-text",
16311
+ thread: true,
16312
+ minText: 12,
16313
+ lowering: [
16314
+ { target: P, writes: [{ from: P, edge: "SOLVED_BY", to: S }], note: "closes the Problem; a note \u226512 chars mints the Solution" },
16315
+ { target: "Vulnerability", writes: [{ from: "Vulnerability", edge: "SOLVED_BY", to: S }] },
16316
+ { target: RC, writes: [], note: "dropped: 'fix tag went nowhere' (not a Problem); no tag writes FIXED_BY", decision: "f" }
16317
+ ],
16318
+ examples: ["fix", "fixThread"],
16319
+ hint: "one fix per tag: (fix:[its-handle]) or (fix:#thread what you changed) \u2014 put the cause in its own (cause: \u2026)",
16320
+ taught: "taught",
16321
+ decisions: ["f"]
16322
+ },
16323
+ {
16324
+ verb: "cause",
16325
+ form: "verb",
16326
+ opener: "(cause:",
16327
+ kinds: ["triage"],
16328
+ args: "handles-text",
16329
+ thread: true,
16330
+ minText: 8,
16331
+ lowering: [
16332
+ { target: RC, writes: TRIAGE_TO_RC },
16333
+ { target: P, writes: [{ from: P, edge: "TRIAGED_BY", to: "Triage" }, { from: "Triage", edge: "INDICATES", to: RC }, { from: P, edge: "CAUSED_BY", to: RC }], note: "(cause:[problem] mechanism) \u2014 the cited Problem is the symptom; the mechanism mints the RootCause" },
16334
+ { target: S, writes: [{ from: P, edge: "TRIAGED_BY", to: "Triage" }, { from: "Triage", edge: "INDICATES", to: S }], decision: "b", knownViolation: { edge: "INDICATES", finding: "(cause:[solution]) writes a refused INDICATES \u2192 Solution" } }
16335
+ ],
16336
+ examples: ["triage", "triageExplain", "triageMint", "causeThread"],
16337
+ hint: "(cause: the mechanism you'd change) or (cause:[root-cause-handle]); bind a distant symptom with (cause:#thread \u2026)",
16338
+ taught: "taught",
16339
+ decisions: ["b"]
16340
+ },
16341
+ {
16342
+ verb: "constraint",
16343
+ form: "verb",
16344
+ opener: "(constraint:",
16345
+ kinds: ["constraint"],
16346
+ args: "text",
16347
+ thread: false,
16348
+ minText: 8,
16349
+ textRequired: true,
16350
+ lowering: [{ target: P, writes: [], note: "mints a constraint-kind Problem" }],
16351
+ examples: ["constraint"],
16352
+ hint: "(constraint: the limitation that forced the decision)",
16353
+ taught: "taught"
16354
+ },
16355
+ {
16356
+ verb: "tried",
16357
+ form: "verb",
16358
+ opener: "(tried:",
16359
+ kinds: ["attempt"],
16360
+ args: "text",
16361
+ thread: true,
16362
+ minText: 8,
16363
+ textRequired: true,
16364
+ lowering: [{ target: P, writes: [], note: "journals an attempt on the bound problem" }],
16365
+ examples: ["tried"],
16366
+ hint: "(tried: the approach) \u2014 bind with (tried:#thread \u2026)",
16367
+ taught: "taught"
16368
+ },
16369
+ {
16370
+ verb: "failed",
16371
+ form: "verb",
16372
+ opener: "(failed:",
16373
+ kinds: ["failure"],
16374
+ args: "handles-text",
16375
+ thread: true,
16376
+ minText: 8,
16377
+ textRequired: true,
16378
+ lowering: [
16379
+ { target: P, writes: [], note: "journals a failed attempt on the bound problem" },
16380
+ { target: S, writes: [], note: "(failed:[h]) refutes the cited prior (contradictionPressure); skips the label gate today", decision: "j" }
16381
+ ],
16382
+ examples: ["failed", "failedCite"],
16383
+ hint: "(failed: what didn't work); (failed:[solution] what came back) refutes a shown fix",
16384
+ taught: "taught",
16385
+ decisions: ["j"]
16386
+ },
16387
+ {
16388
+ verb: "instance",
16389
+ form: "verb",
16390
+ opener: "(instance:",
16391
+ kinds: ["instance"],
16392
+ args: "handles",
16393
+ thread: false,
16394
+ handleRequired: true,
16395
+ lowering: INSTANCE_LOWERING,
16396
+ examples: ["instance"],
16397
+ hint: "(instance:[h1],[h2],[h3]) \u2014 ~3 DIFFERENT shown priors this problem instantiates; handles only",
16398
+ taught: "taught",
16399
+ decisions: ["a", "e"]
16400
+ },
16401
+ {
16402
+ verb: "pattern",
16403
+ form: "verb",
16404
+ opener: "(pattern:",
16405
+ kinds: ["pattern"],
16406
+ args: "handle-or-text",
16407
+ thread: false,
16408
+ minText: 3,
16409
+ lowering: [{ target: "Pattern", writes: [{ from: P, edge: "INSTANCE_OF", to: "Pattern" }], note: "a handle must be a Pattern; free text resolves-or-mints one" }],
16410
+ examples: ["pattern"],
16411
+ hint: "(pattern: name the general shape) or (pattern:[shown-pattern])",
16412
+ taught: "taught"
16413
+ },
16414
+ {
16415
+ verb: "domain",
16416
+ form: "verb",
16417
+ opener: "(domain:",
16418
+ kinds: ["domain"],
16419
+ args: "text",
16420
+ thread: false,
16421
+ minText: 2,
16422
+ textRequired: true,
16423
+ lowering: [{ target: "Domain", writes: [{ from: P, edge: "PERTAIN_TO", to: "Domain" }], note: '(domain:#t X) mints a Domain named "#t X" today', decision: "k" }],
16424
+ examples: ["domain"],
16425
+ hint: "(domain: The Area) \u2014 Title Case, no thread",
16426
+ taught: "taught",
16427
+ decisions: ["k"]
16428
+ },
16429
+ {
16430
+ verb: "package",
16431
+ form: "verb",
16432
+ opener: "(package:",
16433
+ kinds: ["package"],
16434
+ args: "text",
16435
+ thread: false,
16436
+ minText: 2,
16437
+ textRequired: true,
16438
+ lowering: [{ target: "Package", writes: [{ from: P, edge: "DEPENDS_ON", to: "Package" }], note: "means 'concerns', written as DEPENDS_ON", decision: "c" }],
16439
+ examples: ["package"],
16440
+ hint: "(package: the-package-name) \u2014 the public package it's about",
16441
+ taught: "taught",
16442
+ decisions: ["c"]
16443
+ },
16444
+ {
16445
+ verb: "component",
16446
+ form: "verb",
16447
+ opener: "(component:",
16448
+ kinds: ["component"],
16449
+ args: "text",
16450
+ thread: false,
16451
+ minText: 2,
16452
+ textRequired: true,
16453
+ lowering: [{ target: "Component", writes: [{ from: P, edge: "CONCERNS", to: "Component" }] }],
16454
+ examples: ["component"],
16455
+ hint: "(component: The Component) \u2014 the framework/product unit",
16456
+ taught: "taught"
16457
+ },
16458
+ {
16459
+ verb: "aids",
16460
+ form: "verb",
16461
+ opener: "(aids:",
16462
+ kinds: ["transfer"],
16463
+ args: "handles",
16464
+ thread: true,
16465
+ handleRequired: true,
16466
+ lowering: [{ target: P, writes: [{ from: S, edge: "MAY_RESOLVE", to: P }], note: "source = the Solution in scope; non-Problem targets are skipped" }],
16467
+ examples: ["aids"],
16468
+ hint: "(aids:[problem-handle],\u2026) \u2014 other shown problems your fix might also resolve",
16469
+ taught: "taught"
16470
+ },
16471
+ {
16472
+ verb: "builds-on",
16473
+ form: "verb",
16474
+ opener: "(builds-on:",
16475
+ kinds: ["builds-on"],
16476
+ args: "handles",
16477
+ thread: true,
16478
+ handleRequired: true,
16479
+ lowering: [{ target: S, writes: [{ from: S, edge: "BUILDS_ON", to: S }] }],
16480
+ examples: ["buildsOn"],
16481
+ hint: "(builds-on:[shown-solution]) \u2014 your fix layers on it",
16482
+ taught: "taught",
16483
+ taughtBy: "linkBullet instruction text"
16484
+ },
16485
+ {
16486
+ verb: "supersedes",
16487
+ form: "verb",
16488
+ opener: "(supersedes:",
16489
+ kinds: ["supersedes"],
16490
+ args: "handles",
16491
+ thread: true,
16492
+ handleRequired: true,
16493
+ lowering: [{ target: S, writes: [{ from: S, edge: "SUPERSEDES", to: S }] }],
16494
+ examples: ["supersedes"],
16495
+ hint: "(supersedes:[shown-solution]) \u2014 your fix replaces it",
16496
+ taught: "taught",
16497
+ taughtBy: "linkBullet instruction text"
16498
+ },
16499
+ {
16500
+ verb: "alternative",
16501
+ form: "verb",
16502
+ opener: "(alternative:",
16503
+ kinds: ["alternative"],
16504
+ args: "handles",
16505
+ thread: true,
16506
+ handleRequired: true,
16507
+ lowering: [{ target: S, writes: [{ from: S, edge: "ALTERNATIVE_TO", to: S }] }],
16508
+ examples: ["alternative"],
16509
+ hint: "(alternative:[shown-solution]) \u2014 a different valid approach",
16510
+ taught: "taught",
16511
+ taughtBy: "linkBullet instruction text"
16512
+ },
16513
+ {
16514
+ verb: "confirm",
16515
+ form: "verb",
16516
+ opener: "(confirm:",
16517
+ kinds: ["confirm"],
16518
+ args: "handles",
16519
+ thread: false,
16520
+ handleRequired: true,
16521
+ lowering: [{ target: S, writes: [], note: "corroboration witness (corroborationCount), no edge" }],
16522
+ examples: ["confirm"],
16523
+ hint: "(confirm:[shown-prior]) \u2014 it held",
16524
+ taught: "taught",
16525
+ taughtBy: "verdictBullet + context render",
16526
+ decisions: ["j"]
16527
+ },
16528
+ {
16529
+ verb: "refute",
16530
+ form: "verb",
16531
+ opener: "(refute:",
16532
+ kinds: ["refute"],
16533
+ args: "handles-text",
16534
+ thread: false,
16535
+ minText: 4,
16536
+ handleRequired: true,
16537
+ textRequired: true,
16538
+ lowering: [{ target: S, writes: [], note: "contradiction witness (contradictionPressure), no edge; reason stays local" }],
16539
+ examples: ["refute"],
16540
+ hint: "(refute:[shown-prior] one line why) \u2014 the reason is required",
16541
+ taught: "taught",
16542
+ taughtBy: "verdictBullet + context render",
16543
+ decisions: ["j"]
16544
+ }
16545
+ ];
16546
+ TAG_FENCES = [
16547
+ {
16548
+ fence: "errata-problem",
16549
+ fields: ["problem", "cause", "fix", "anchor", "kind"],
16550
+ required: [["problem"]],
16551
+ taught: "untaught",
16552
+ parser: "apps/daemon/src/turn.ts parseDesignFlags",
16553
+ decisions: ["h"],
16554
+ hint: "use an inline [!\u2026] flag instead (errata-problem cause ids never meet inline ids)"
16555
+ },
16556
+ {
16557
+ fence: "errata-resolved",
16558
+ fields: ["id", "problem", "fix", "disposition", "reason"],
16559
+ required: [["id", "problem"]],
16560
+ taught: "taught",
16561
+ taughtBy: "retract form only (TAG_EXAMPLE.retract); the fix form is untaught",
16562
+ parser: "apps/daemon/src/turn.ts parseDesignResolutions",
16563
+ hint: "```errata-resolved with id: and disposition: false_positive | invalid, reason: \u2026"
16564
+ },
16565
+ {
16566
+ fence: "errata-triage",
16567
+ fields: ["presenting", "cause", "test", "fix", "drift", "route"],
16568
+ required: [["presenting", "route"], ["cause", "test"]],
16569
+ taught: "taught",
16570
+ taughtBy: "MCP errata_triage tool copy",
16571
+ parser: "packages/local-graph/src/triage.ts parseTriageFences",
16572
+ hint: "```errata-triage with presenting: and cause: (or route: + test: to answer one)"
16573
+ },
16574
+ {
16575
+ fence: "errata-abstraction",
16576
+ fields: ["candidate", "principle", "covers"],
16577
+ required: [["candidate"], ["principle"], ["covers"]],
16578
+ taught: "taught",
16579
+ taughtBy: "MCP errata_pending_abstractions tool copy",
16580
+ parser: "packages/local-graph/src/abstraction.ts parseAbstractionFences",
16581
+ hint: "```errata-abstraction with candidate:, principle:, covers: (all required)"
16582
+ },
16583
+ {
16584
+ fence: "errata-intent",
16585
+ fields: ["intent"],
16586
+ required: [["intent"]],
16587
+ taught: "taught",
16588
+ parser: "packages/local-graph/src/intent.ts parseIntentFences",
16589
+ hint: "```errata-intent with intent: what you're about to do"
16590
+ },
16591
+ {
16592
+ fence: "errata-share",
16593
+ fields: ["priors"],
16594
+ required: [["priors"]],
16595
+ taught: "taught",
16596
+ taughtBy: "subagent hand-off copy",
16597
+ parser: "packages/local-graph/src/intent.ts parseShareFence",
16598
+ hint: "```errata-share with priors: all | [h1], [h2]"
16599
+ }
16600
+ ];
16601
+ TAG_VERB_BY_NAME = new Map(
16602
+ TAG_VERBS.filter((v) => v.form === "verb").map((v) => [v.verb, v])
16603
+ );
16604
+ TAG_PAREN_VERBS = [...TAG_VERB_BY_NAME.keys()].sort((a, b) => b.length - a.length);
16605
+ TAG_GRAMMAR_OPENERS = [
16606
+ ...new Set(TAG_VERBS.filter((v) => v.form !== "citation").map((v) => v.opener))
16607
+ ];
16608
+ TAG_QUOTED_PAREN_SOURCE = String.raw`\(\s*(?:${TAG_PAREN_VERBS.map((v) => v.replace(/-/g, "\\-")).join("|")})\s*:|\(\[`;
16609
+ TAG_QUOTED_RE = new RegExp(String.raw`\[[!?]|` + TAG_QUOTED_PAREN_SOURCE, "i");
16610
+ TAG_QUOTED_PAREN_RE = new RegExp(TAG_QUOTED_PAREN_SOURCE, "i");
16611
+ TEMPLATE_VERB_GROUP = new RegExp(
16612
+ String.raw`\(\s*(${TAG_PAREN_VERBS.map((v) => v.replace(/-/g, "\\-")).join("|")})\s*:((?:[^()\n]|\([^()\n]*\))*)\)`,
16613
+ "gi"
16614
+ );
16615
+ BRACKET_TOKEN = /\[([^\]\n]{1,80})\]/g;
16616
+ REAL_HANDLE_SHAPE = new RegExp(
16617
+ String.raw`^(?:[a-z0-9]+(?:-[a-z0-9]+)*-(?=[0-9a-f]{0,3}\d)[0-9a-f]{4}|(?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})$`,
16618
+ "i"
16619
+ );
16620
+ TAG_TEMPLATES = deriveTagTemplates(tagGrammarCopy());
16621
+ VERB_WORDS_SOURCE = TAG_PAREN_VERBS.map((v) => v.replace(/-/g, "\\-")).join("|");
16622
+ JOINED_VERB = new RegExp(String.raw`[,;]\s*(?=(?:${VERB_WORDS_SOURCE})\s*:)`, "i");
16623
+ LEADING_VERB = new RegExp(String.raw`^\s*(${VERB_WORDS_SOURCE})\s*:`, "i");
16624
+ ANY_VERB_WORD = new RegExp(String.raw`\b(?:${VERB_WORDS_SOURCE})\s*:`, "gi");
16625
+ QUOTED_TAG_OPENER = new RegExp(String.raw`\(\s*(?:(${VERB_WORDS_SOURCE})\s*:|(?=\[))`, "gi");
16626
+ }
16627
+ });
16628
+
16087
16629
  // ../../packages/local-shared/src/index.ts
16088
16630
  var init_src2 = __esm({
16089
16631
  "../../packages/local-shared/src/index.ts"() {
@@ -16097,6 +16639,7 @@ var init_src2 = __esm({
16097
16639
  init_review();
16098
16640
  init_anchorable();
16099
16641
  init_sqlite_adapter();
16642
+ init_tag_grammar();
16100
16643
  }
16101
16644
  });
16102
16645
 
@@ -19766,7 +20309,14 @@ function summaryFromDoc(doc, kind) {
19766
20309
  }
19767
20310
  if (verb !== null) return null;
19768
20311
  const noun = clipped.replace(/^(?:the|a|an)\s+/i, "");
19769
- return tidy(`${lead(kind)} for ${noun.charAt(0).toLowerCase()}${noun.slice(1)}`);
20312
+ const head = noun.split(/[\s-]/, 1)[0].replace(/[.,;:!?]+$/, "");
20313
+ return tidy(`${lead(kind)} for ${isOrdinaryCapital(head) ? noun.charAt(0).toLowerCase() + noun.slice(1) : noun}`);
20314
+ }
20315
+ var CONTRACTION_BASES = /* @__PURE__ */ new Set(["it", "that", "this", "there", "here", "what", "who", "where", "when", "why", "how", "let", "he", "she"]);
20316
+ function isOrdinaryCapital(word) {
20317
+ const contraction = /^([A-Za-z]+)['’]s$/.exec(word);
20318
+ if (contraction) return CONTRACTION_BASES.has(contraction[1].toLowerCase()) && /^[A-Z][a-z]*$/.test(contraction[1]);
20319
+ return /^[A-Z][a-z]+$/.test(word);
19770
20320
  }
19771
20321
  var VERB_PHRASE_KINDS = /* @__PURE__ */ new Set(["function", "method"]);
19772
20322
  function summaryFromName(name, kind) {