@almadar/std 16.223.0 → 16.225.0
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/behaviors/behaviors-registry.json +250858 -0
- package/behaviors/lolo/infra/atoms/std-knowledge-loop.lolo +316 -0
- package/behaviors/lolo-behavior-contracts.json +1 -0
- package/behaviors/registry/factory-signatures.json +1 -0
- package/behaviors/registry/infra/atoms/std-knowledge-loop.orb +1518 -0
- package/behaviors/signatures.lolo +41181 -0
- package/dist/behaviors-embeddings.hash.json +3 -3
- package/dist/behaviors-embeddings.json +1 -1
- package/dist/behaviors-registry.json +461 -921
- package/dist/knob-embeddings.hash.json +3 -3
- package/dist/knob-embeddings.json +1 -1
- package/dist/registry/factory-signatures.json +1 -1
- package/package.json +20 -3
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
app std-knowledge-loop "1.0.0"
|
|
2
|
+
"std-knowledge-loop — generic epistemic-loop / decision-gate machinery. Use when a user voices that a claim, hypothesis, or fix needs to be varied, predicted, falsified, independently checked, and calibrated before it is trusted (root-cause investigation, hypothesis testing, a fix that needs sign-off before it ships, a claim that needs a second opinion). The topology (vary -> compare -> hypothesize -> predict -> falsify -> verify -> generalize -> isolate & intervene -> compose -> calibrate -> select next target -> vary again) is fixed and never re-authored per domain. Each gate is announced: entering falsification emits FalsificationRequested, entering verification emits VerificationRequested, entering calibration emits CalibrationRequested (all carry the claim's title + candidateStructure). Who answers a gate is the consumer's call: with manualFalsification / manualVerification on (the default) the atom renders Survived/Failed and Checks-agree/Checks-disagree buttons and a person judges; a consumer that can compute the verdict sets the knob off, authors a sibling trait that listens for the *Requested event, does the domain check, and emits its result, then overrides listens {} at the call site to route that result into SURVIVED/FAILED or CHECKS_AGREE/CHECKS_DISAGREE — the `when` guard on that route IS the consumer's definition of what the gate means (e.g. ReproCheck.REPRO_RESULT -> SURVIVED when (>= ?passRate 0.95)). Calibration is enforced by the atom itself: a submitted numeric score is checked against reliabilityThreshold. On a claim clearing calibration, emits LoopConcluded (title, reliabilityScore) so a composing host can act on the validated result."
|
|
3
|
+
|
|
4
|
+
orbital KnowledgeLoopOrbital {
|
|
5
|
+
uses Typography from "std/behaviors/ui-typography"
|
|
6
|
+
uses Button from "std/behaviors/ui-button"
|
|
7
|
+
uses Divider from "std/behaviors/ui-divider"
|
|
8
|
+
|
|
9
|
+
type ScoreCommit = { score : number }
|
|
10
|
+
|
|
11
|
+
type ConditionCommit = { title : string, candidateStructure : string }
|
|
12
|
+
|
|
13
|
+
entity KnowledgeClaim [runtime] {
|
|
14
|
+
title : string! @description "what's being investigated"
|
|
15
|
+
candidateStructure : string @description "the current hypothesis" = ""
|
|
16
|
+
survivedFalsification : boolean @description "did the prediction survive an honest attempt to break it" = false
|
|
17
|
+
independentChecksAgree : boolean @description "did a different method or observer converge on the same result" = false
|
|
18
|
+
reliabilityScore : number @description "the calibrated model's measured reliability, 0-1" = 0
|
|
19
|
+
nextTarget : string @description "the next question that removes the most uncertainty" = ""
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
trait LoopTitle = Typography.traits.TypographyRender -> KnowledgeClaim {
|
|
23
|
+
config {
|
|
24
|
+
content: "Knowledge loop"
|
|
25
|
+
variant: h3
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
trait AwaitingFalsificationText = Typography.traits.TypographyRender -> KnowledgeClaim {
|
|
30
|
+
config {
|
|
31
|
+
color: muted
|
|
32
|
+
content: "Falsification requested — awaiting the automated check's verdict."
|
|
33
|
+
variant: caption
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
trait AwaitingVerificationText = Typography.traits.TypographyRender -> KnowledgeClaim {
|
|
38
|
+
config {
|
|
39
|
+
color: muted
|
|
40
|
+
content: "Independent verification requested — awaiting the automated check's verdict."
|
|
41
|
+
variant: caption
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
trait LoopDivider = Divider.traits.DividerRender -> KnowledgeClaim {
|
|
46
|
+
config {}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
trait SurvivedButton = Button.traits.ButtonRender -> KnowledgeClaim {
|
|
50
|
+
config {
|
|
51
|
+
action: SURVIVED
|
|
52
|
+
icon: check
|
|
53
|
+
label: Survived
|
|
54
|
+
variant: primary
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
trait FailedButton = Button.traits.ButtonRender -> KnowledgeClaim {
|
|
59
|
+
config {
|
|
60
|
+
action: FAILED
|
|
61
|
+
icon: x
|
|
62
|
+
label: Failed
|
|
63
|
+
variant: danger
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
trait ChecksAgreeButton = Button.traits.ButtonRender -> KnowledgeClaim {
|
|
68
|
+
config {
|
|
69
|
+
action: CHECKS_AGREE
|
|
70
|
+
icon: check
|
|
71
|
+
label: "Checks agree"
|
|
72
|
+
variant: primary
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
trait ChecksDisagreeButton = Button.traits.ButtonRender -> KnowledgeClaim {
|
|
77
|
+
config {
|
|
78
|
+
action: CHECKS_DISAGREE
|
|
79
|
+
icon: x
|
|
80
|
+
label: "Checks disagree"
|
|
81
|
+
variant: danger
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
trait ChooseNextTargetButton = Button.traits.ButtonRender -> KnowledgeClaim {
|
|
86
|
+
config {
|
|
87
|
+
action: CHOOSE_NEXT_TARGET
|
|
88
|
+
icon: arrow-right
|
|
89
|
+
label: "Choose next target"
|
|
90
|
+
variant: primary
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
trait KnowledgeLoop -> @rebindable KnowledgeClaim [interaction, collection] {
|
|
95
|
+
initial: varying
|
|
96
|
+
|
|
97
|
+
state varying {
|
|
98
|
+
INIT -> varying
|
|
99
|
+
(fetch KnowledgeClaim)
|
|
100
|
+
(render-ui main {
|
|
101
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, { type: "detail-panel", entity: @entity, title: "Current claim", fields: ["title", "candidateStructure", "survivedFalsification", "independentChecksAgree", "reliabilityScore", "nextTarget"] }, {
|
|
102
|
+
entity: { }
|
|
103
|
+
fields: (title candidateStructure)
|
|
104
|
+
mode: create
|
|
105
|
+
submitEvent: CHANGE_CONDITION
|
|
106
|
+
type: form-section
|
|
107
|
+
}]
|
|
108
|
+
direction: vertical
|
|
109
|
+
gap: md
|
|
110
|
+
type: stack
|
|
111
|
+
})
|
|
112
|
+
CHANGE_CONDITION -> comparing
|
|
113
|
+
(set @entity.title (object/get ?data title))
|
|
114
|
+
(set @entity.candidateStructure (object/get ?data candidateStructure))
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
state comparing {
|
|
118
|
+
MEASURE_DIFFERENCE -> hypothesizing
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
state hypothesizing {
|
|
122
|
+
FORM_GUESS -> predicting
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
state predicting {
|
|
126
|
+
EXTRAPOLATE -> falsifying
|
|
127
|
+
(emit FalsificationRequested { title: @entity.title, candidateStructure: @entity.candidateStructure })
|
|
128
|
+
(if @config.manualFalsification (render-ui main {
|
|
129
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, @trait.SurvivedButton, @trait.FailedButton]
|
|
130
|
+
direction: vertical
|
|
131
|
+
gap: md
|
|
132
|
+
type: stack
|
|
133
|
+
}) (render-ui main {
|
|
134
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, @trait.AwaitingFalsificationText]
|
|
135
|
+
direction: vertical
|
|
136
|
+
gap: md
|
|
137
|
+
type: stack
|
|
138
|
+
}))
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
state falsifying {
|
|
142
|
+
SURVIVED -> generalizing when (not @config.requireIndependentVerification)
|
|
143
|
+
(set @entity.survivedFalsification true)
|
|
144
|
+
(set @entity.independentChecksAgree true)
|
|
145
|
+
SURVIVED -> verifying when @config.requireIndependentVerification
|
|
146
|
+
(set @entity.survivedFalsification true)
|
|
147
|
+
(emit VerificationRequested { title: @entity.title, candidateStructure: @entity.candidateStructure })
|
|
148
|
+
(if @config.manualVerification (render-ui main {
|
|
149
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, @trait.ChecksAgreeButton, @trait.ChecksDisagreeButton]
|
|
150
|
+
direction: vertical
|
|
151
|
+
gap: md
|
|
152
|
+
type: stack
|
|
153
|
+
}) (render-ui main {
|
|
154
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, @trait.AwaitingVerificationText]
|
|
155
|
+
direction: vertical
|
|
156
|
+
gap: md
|
|
157
|
+
type: stack
|
|
158
|
+
}))
|
|
159
|
+
FAILED -> hypothesizing
|
|
160
|
+
(set @entity.survivedFalsification false)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
state verifying {
|
|
164
|
+
CHECKS_AGREE -> generalizing
|
|
165
|
+
(set @entity.independentChecksAgree true)
|
|
166
|
+
CHECKS_DISAGREE -> hypothesizing
|
|
167
|
+
(set @entity.independentChecksAgree false)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
state generalizing {
|
|
171
|
+
STRIP_TO_ESSENTIALS -> isolating
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
state isolating {
|
|
175
|
+
FIND_AND_CONTROL_CAUSE -> composing
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
state composing {
|
|
179
|
+
COMBINE_WITH_TRUSTED -> calibrating
|
|
180
|
+
(emit CalibrationRequested { title: @entity.title, candidateStructure: @entity.candidateStructure })
|
|
181
|
+
(render-ui main {
|
|
182
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, {
|
|
183
|
+
cancelEvent: CANCEL_SCORE
|
|
184
|
+
entity: { }
|
|
185
|
+
fields: (reliabilityScore)
|
|
186
|
+
mode: create
|
|
187
|
+
submitEvent: CONFIRM_SCORE
|
|
188
|
+
type: form-section
|
|
189
|
+
}]
|
|
190
|
+
direction: vertical
|
|
191
|
+
gap: md
|
|
192
|
+
type: stack
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
state calibrating {
|
|
197
|
+
CONFIRM_SCORE -> selecting when (>= (object/get ?data score) @config.reliabilityThreshold)
|
|
198
|
+
(set @entity.reliabilityScore (object/get ?data score))
|
|
199
|
+
(emit LoopConcluded { title: @entity.title, reliabilityScore: (object/get ?data score) })
|
|
200
|
+
(render-ui main {
|
|
201
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, @trait.ChooseNextTargetButton]
|
|
202
|
+
direction: vertical
|
|
203
|
+
gap: md
|
|
204
|
+
type: stack
|
|
205
|
+
})
|
|
206
|
+
CONFIRM_SCORE -> falsifying when (< (object/get ?data score) @config.reliabilityThreshold)
|
|
207
|
+
(set @entity.reliabilityScore (object/get ?data score))
|
|
208
|
+
(emit FalsificationRequested { title: @entity.title, candidateStructure: @entity.candidateStructure })
|
|
209
|
+
(if @config.manualFalsification (render-ui main {
|
|
210
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, @trait.SurvivedButton, @trait.FailedButton]
|
|
211
|
+
direction: vertical
|
|
212
|
+
gap: md
|
|
213
|
+
type: stack
|
|
214
|
+
}) (render-ui main {
|
|
215
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, @trait.AwaitingFalsificationText]
|
|
216
|
+
direction: vertical
|
|
217
|
+
gap: md
|
|
218
|
+
type: stack
|
|
219
|
+
}))
|
|
220
|
+
CANCEL_SCORE -> calibrating
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
state selecting {
|
|
224
|
+
CHOOSE_NEXT_TARGET -> varying
|
|
225
|
+
(fetch KnowledgeClaim)
|
|
226
|
+
(render-ui main {
|
|
227
|
+
children: [@trait.LoopTitle, @trait.LoopDivider, { type: "detail-panel", entity: @entity, title: "Current claim", fields: ["title", "candidateStructure", "survivedFalsification", "independentChecksAgree", "reliabilityScore", "nextTarget"] }, {
|
|
228
|
+
entity: { }
|
|
229
|
+
fields: (title candidateStructure)
|
|
230
|
+
mode: create
|
|
231
|
+
submitEvent: CHANGE_CONDITION
|
|
232
|
+
type: form-section
|
|
233
|
+
}]
|
|
234
|
+
direction: vertical
|
|
235
|
+
gap: md
|
|
236
|
+
type: stack
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
emits {
|
|
241
|
+
FalsificationRequested -> external {
|
|
242
|
+
title: string
|
|
243
|
+
candidateStructure: string
|
|
244
|
+
}
|
|
245
|
+
@description "The loop entered the falsification gate. A consumer that computes the verdict listens for this, runs its check, and routes its result into SURVIVED or FAILED via a listens override."
|
|
246
|
+
@synonyms "falsify, test the prediction, try to break it"
|
|
247
|
+
@tier "domain"
|
|
248
|
+
VerificationRequested -> external {
|
|
249
|
+
title: string
|
|
250
|
+
candidateStructure: string
|
|
251
|
+
}
|
|
252
|
+
@description "The loop entered the independent-verification gate. A consumer routes its second-method result into CHECKS_AGREE or CHECKS_DISAGREE via a listens override."
|
|
253
|
+
@synonyms "verify independently, second opinion, cross-check"
|
|
254
|
+
@tier "domain"
|
|
255
|
+
CalibrationRequested -> external {
|
|
256
|
+
title: string
|
|
257
|
+
candidateStructure: string
|
|
258
|
+
}
|
|
259
|
+
@description "The loop entered the calibration gate and is waiting for a reliability score (CONFIRM_SCORE, data.score), which the atom checks against reliabilityThreshold."
|
|
260
|
+
@synonyms "calibrate, measure reliability, score it"
|
|
261
|
+
@tier "domain"
|
|
262
|
+
LoopConcluded -> external {
|
|
263
|
+
title: string
|
|
264
|
+
reliabilityScore: number
|
|
265
|
+
}
|
|
266
|
+
@description "A claim cleared calibration; a composing host can act on the validated result."
|
|
267
|
+
@synonyms "validated, calibrated, concluded, ready to ship"
|
|
268
|
+
@tier "domain"
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
listens {
|
|
272
|
+
SurvivedButton.SURVIVED -> SURVIVED
|
|
273
|
+
FailedButton.FAILED -> FAILED
|
|
274
|
+
ChecksAgreeButton.CHECKS_AGREE -> CHECKS_AGREE
|
|
275
|
+
ChecksDisagreeButton.CHECKS_DISAGREE -> CHECKS_DISAGREE
|
|
276
|
+
ChooseNextTargetButton.CHOOSE_NEXT_TARGET -> CHOOSE_NEXT_TARGET
|
|
277
|
+
CONFIRM_SCORE {
|
|
278
|
+
data: ScoreCommit
|
|
279
|
+
}
|
|
280
|
+
@description "The reliability-score form committed."
|
|
281
|
+
@synonyms "submit score, report reliability"
|
|
282
|
+
@tier "internal"
|
|
283
|
+
CHANGE_CONDITION {
|
|
284
|
+
data: ConditionCommit
|
|
285
|
+
}
|
|
286
|
+
@description "The investigation's title and current hypothesis were entered."
|
|
287
|
+
@synonyms "start investigation, set hypothesis"
|
|
288
|
+
@tier "internal"
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
config {
|
|
292
|
+
requireIndependentVerification: boolean = true
|
|
293
|
+
@label "Require independent verification"
|
|
294
|
+
@description "Whether a second, independent check must agree before the claim advances. Off skips straight to generalization once falsification survives."
|
|
295
|
+
@synonyms "second opinion, independent check, cross-verify"
|
|
296
|
+
@tier "policy"
|
|
297
|
+
manualFalsification: boolean = true
|
|
298
|
+
@label "Falsification is judged by a person"
|
|
299
|
+
@description "On: the falsification gate renders Survived / Failed buttons and a person decides. Off: no buttons render; the consumer's own sibling trait must answer FalsificationRequested by routing its result into SURVIVED / FAILED through a listens override."
|
|
300
|
+
@synonyms "manual falsification, human judged, automated check off"
|
|
301
|
+
@tier "policy"
|
|
302
|
+
manualVerification: boolean = true
|
|
303
|
+
@label "Verification is judged by a person"
|
|
304
|
+
@description "On: the verification gate renders Checks-agree / Checks-disagree buttons. Off: the consumer's sibling trait answers VerificationRequested by routing its result into CHECKS_AGREE / CHECKS_DISAGREE through a listens override."
|
|
305
|
+
@synonyms "manual verification, human second opinion, automated cross-check off"
|
|
306
|
+
@tier "policy"
|
|
307
|
+
reliabilityThreshold: number = 0.8
|
|
308
|
+
@label "Reliability threshold"
|
|
309
|
+
@description "The measured reliability score a calibrated claim must clear before it is considered good enough to act on. Below it, the loop returns to falsification for more testing."
|
|
310
|
+
@synonyms "confidence threshold, calibration bar, minimum reliability"
|
|
311
|
+
@tier "policy"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
page "/knowledge-loop" as KnowledgeLoopPage -> KnowledgeLoop [view: detail, entity: KnowledgeClaim, initial]
|
|
316
|
+
}
|