@zalom/plastic 1.0.0-beta.28 → 1.0.0-beta.29
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/package.json
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
# and surface each candidate's `## Intent` + `## Context` as the
|
|
11
11
|
# EVIDENCE an agent reads to judge influence.
|
|
12
12
|
# - record_edge: record a CONFIRMED `sources`/`chain` frontmatter edge AND append a
|
|
13
|
-
# line to
|
|
13
|
+
# dated line to the subject intent file's `## Insights` section
|
|
14
|
+
# carrying (utc, target, edge, rating, reason).
|
|
14
15
|
# Append-only, frontmatter block only, never a `## Links` line,
|
|
15
16
|
# never a delete. A no-op without confirm: true.
|
|
16
17
|
# - drift: flag any `## Links` wikilink with no matching frontmatter edge.
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
|
|
31
32
|
require "time"
|
|
32
33
|
require_relative "intent_validator"
|
|
34
|
+
require_relative "insights"
|
|
33
35
|
|
|
34
36
|
class LinkSuggestions
|
|
35
37
|
# One discovery candidate plus the evidence an agent reads to judge influence.
|
|
@@ -181,7 +183,7 @@ class LinkSuggestions
|
|
|
181
183
|
|
|
182
184
|
# Record a single CONFIRMED edge from `subject_id` to `target_id`:
|
|
183
185
|
# 1. append `target_id` to the subject's frontmatter `sources` or `chain`;
|
|
184
|
-
# 2. append a line to
|
|
186
|
+
# 2. append a dated line to the subject's `## Insights` section capturing
|
|
185
187
|
# {utc, target, edge, rating, reason}.
|
|
186
188
|
# Append-only, frontmatter block only. NEVER writes a `## Links` line, NEVER
|
|
187
189
|
# deletes. A no-op (returns false) without confirm: true, so a default run mutates
|
|
@@ -199,8 +201,8 @@ class LinkSuggestions
|
|
|
199
201
|
updated = add_frontmatter_ref(content, edge.to_s, target_id)
|
|
200
202
|
return false if updated == content
|
|
201
203
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
+
final = append_link_insight(updated, target_id, edge, rating, reason, now)
|
|
205
|
+
reader.write(subject[:path], final)
|
|
204
206
|
true
|
|
205
207
|
end
|
|
206
208
|
|
|
@@ -220,20 +222,15 @@ class LinkSuggestions
|
|
|
220
222
|
|
|
221
223
|
private
|
|
222
224
|
|
|
223
|
-
#
|
|
224
|
-
#
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
reader.write(ledger, existing.rstrip + "\n" + line + "\n")
|
|
233
|
-
else
|
|
234
|
-
header = "# Link decisions (intent 91 D6): utc | target | edge | rating | reason\n\n"
|
|
235
|
-
reader.write(ledger, header + line + "\n")
|
|
236
|
-
end
|
|
225
|
+
# Insert one dated link-decision line at the bottom of the subject intent file's
|
|
226
|
+
# `## Insights` section (96 D3: link rationale lives IN the intent file, never a side
|
|
227
|
+
# file). Reuses the blessed Insights writer (intent 82) for section insertion; carries
|
|
228
|
+
# the five fields (utc, target, edge, rating, reason) as a readable line under the 82
|
|
229
|
+
# exact-timestamp prefix. Returns the augmented content for the single caller write.
|
|
230
|
+
def append_link_insight(content, target_id, edge, rating, reason, now)
|
|
231
|
+
prefix = "#{now.utc.iso8601} · Link · link-suggest"
|
|
232
|
+
text = "#{edge} edge to #{target_id} (rating #{rating || "-"}): #{reason || "-"}"
|
|
233
|
+
Insights.with_entry(content, "#{prefix} — #{text}")
|
|
237
234
|
end
|
|
238
235
|
|
|
239
236
|
# Natural sort key for ids so 2 sorts before 10 and 14a groups with 14.
|
package/scripts/link-suggest
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
# link-suggest - support links decided by CONTEXT INFLUENCE (intent 91, D7). Links are
|
|
6
6
|
# NOT graded by a script: whether one intent's context influenced another is a
|
|
7
7
|
# judgement an agent makes by reading the candidate's Intent + Context. This tool
|
|
8
|
-
# gathers candidates with that evidence, records a CONFIRMED edge
|
|
9
|
-
# reason in `
|
|
10
|
-
# never deletes.
|
|
8
|
+
# gathers candidates with that evidence, records a CONFIRMED edge in frontmatter plus a
|
|
9
|
+
# dated rating/reason line in the intent's `## Insights` section, and flags drift. It
|
|
10
|
+
# never writes a `## Links` line and never deletes.
|
|
11
11
|
#
|
|
12
12
|
# `## Links` is a DERIVED view of `sources`/`chain` (Convention over Configuration).
|
|
13
13
|
# Tiers, by context influence:
|
|
@@ -42,8 +42,9 @@ module LinkSuggestCLI
|
|
|
42
42
|
|
|
43
43
|
Links are decided by context influence, judged by an agent reading each
|
|
44
44
|
candidate's Intent + Context. This tool only gathers candidates with that
|
|
45
|
-
evidence, records a confirmed edge plus its rating/reason in
|
|
46
|
-
and flags drift. It never writes a ## Links line and
|
|
45
|
+
evidence, records a confirmed edge plus its rating/reason in the intent's
|
|
46
|
+
## Insights section, and flags drift. It never writes a ## Links line and
|
|
47
|
+
never deletes.
|
|
47
48
|
|
|
48
49
|
--edge is explicit and required (sources is decided by origin, never inferred).
|
|
49
50
|
--rating is required when --edge is chain. Without --confirm, nothing is written.
|
|
@@ -132,7 +133,8 @@ module LinkSuggestCLI
|
|
|
132
133
|
reason: opts[:reason], confirm: true)
|
|
133
134
|
if wrote
|
|
134
135
|
out.puts "Recorded #{opts[:edge]} edge #{opts[:subject]} -> #{opts[:record]} " \
|
|
135
|
-
"and appended to
|
|
136
|
+
"and appended a rating/reason line to the intent's ## Insights. " \
|
|
137
|
+
"Reproject ## Links with scripts/project-links."
|
|
136
138
|
return 0
|
|
137
139
|
end
|
|
138
140
|
out.puts "No edge written (edge may already exist, or intent missing)."
|
|
@@ -38,9 +38,9 @@ Two distinct steps, do not conflate them:
|
|
|
38
38
|
It does not wait for code to exist; it is reasoning over the candidate's context, not over a diff.
|
|
39
39
|
|
|
40
40
|
**Record the call.** For every edge an agent adds, store a rating (high / medium / low) plus a
|
|
41
|
-
one-line reason
|
|
42
|
-
|
|
43
|
-
projection identity.
|
|
41
|
+
one-line reason as a dated line under the intent file's `## Insights` section (per 96 D3, link
|
|
42
|
+
rationale lives in the intent file, not a side file). It stays out of frontmatter (graph only) and
|
|
43
|
+
out of the projected `## Links` label, so the audit trail never breaks the projection identity.
|
|
44
44
|
|
|
45
45
|
## `## Links` is derived (never author it by hand)
|
|
46
46
|
|