interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / train / omega-llm / tools / controller / policy.om

123 lines · 2386 bytes Raw Blame History
1note Seeded Omega supervised controller for initial tool choice and retry decisions.
2note Model rows are five decision contexts by eight feature groups plus one pooled group.
3text cpmagic "OCP1"
4text ctarray " view "
5text ctleft " left "
6text ctdata " data "
7text ctthen "then "
8text cthalf "half "
9text ctsquare "square "
10text cttwice "twice "
11text ctthree "three plus"
12global cpvotes ulong 90
13fn hastext p view uchar * needle view uchar * to bool
14if lt len p len needle
15ret false
16end
17for i ulong add 1 sub len p len needle
18ok = true
19for j ulong len needle
20if ne get p add i j get needle j
21ok = false
22break
23end
24end
25if ok
26ret true
27end
28end
29ret false
30end
31fn cpfeatures p view uchar * to ulong
32group = ulong 0
33if hastext p ctarray
34group = 1
35end
36if or hastext p ctleft hastext p ctdata
37group = add group 2
38end
39if or hastext p ctthen or hastext p cthalf or hastext p ctsquare or hastext p cttwice hastext p ctthree
40group = add group 4
41end
42ret group
43end
44fn cell stage ulong group ulong to ulong
45ret mul 2 add group mul 9 stage
46end
47fn addvote stage ulong group ulong choice ulong to void
48i = add cell stage group choice
49put cpvotes i add 1 get cpvotes i
50j = add cell stage 8 choice
51put cpvotes j add 1 get cpvotes j
52end
53fn retryctx route ulong status ulong to ulong
54ret add add 1 mul 2 route status
55end
56fn cpbit b bool to ulong
57if b
58ret 1
59end
60ret 0
61end
62fn cptrain j ulong to void
63group = ulong get wdsrc j
64dp = ulong get wdsrc add j 1
65ap = ulong get wdsrc add j 2
66dh = ulong get wdsrc add j 3
67ah = ulong get wdsrc add j 4
68d = and eq dp 2 eq dh 2
69a = and eq ap 2 eq ah 2
70if ne d a
71if a
72addvote 0 group 1
73else
74addvote 0 group 0
75end
76end
77if lt dp 2
78addvote retryctx 0 dp group cpbit a
79end
80if lt ap 2
81addvote retryctx 1 ap group cpbit d
82end
83end
84fn cppredict stage ulong group ulong to ulong
85i = cell stage group
86if lt add get cpvotes i get cpvotes add i 1 4
87i = cell stage 8
88end
89other = get cpvotes add i 1
90if ne stage 0
91other = mul 4 other
92end
93ret cpbit gt other get cpvotes i
94end
95fn cpdump to void
96wdot cpmagic
97for i ulong len cpvotes
98v = get cpvotes i
99if gt v 65535
100exit 72
101end
102wdoc and v 255
103wdoc shr v 8
104end
105wdoflush 1
106end
107fn cprestore arg ulong to void
108wdpclr
109wdpa arg
110n = wdload
111if ne n 184
112exit 72
113end
114for j ulong len cpmagic
115if ne get wdsrc j get cpmagic j
116exit 72
117end
118end
119for i ulong len cpvotes
120k = add 4 mul 2 i
121put cpvotes i add ulong get wdsrc k shl ulong get wdsrc add k 1 8
122end
123end