SNAPKITTYWEST commited on
Commit
c5f93fc
·
verified ·
1 Parent(s): 026be7b

push from SNAPKITTYWEST/agentos

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .agentos/pnp/seb_chain.jsonl +1 -0
  2. .agentos/runtime/pnpVerifier.mjs +130 -0
  3. .agentos/runtime/seb_convergence.mjs +221 -0
  4. .gitignore +6 -0
  5. AGENTS.md +590 -0
  6. LICENSE +17 -0
  7. README.md +139 -0
  8. agentos-frontend/README.md +58 -0
  9. agentos-frontend/app/components/AgentGrid.tsx +192 -0
  10. agentos-frontend/app/globals.css +34 -0
  11. agentos-frontend/app/layout.tsx +22 -0
  12. agentos-frontend/app/page.tsx +5 -0
  13. agentos-frontend/css/agentos.css +346 -0
  14. agentos-frontend/data/agent-personas.json +76 -0
  15. agentos-frontend/js/agentos-live.js +115 -0
  16. agentos-frontend/metadata.json +31 -0
  17. agentos-frontend/next-env.d.ts +6 -0
  18. agentos-frontend/next.config.js +11 -0
  19. agentos-frontend/package-lock.json +0 -0
  20. agentos-frontend/package.json +27 -0
  21. agentos-frontend/pages/index.html +177 -0
  22. agentos-frontend/postcss.config.js +6 -0
  23. agentos-frontend/tailwind.config.ts +29 -0
  24. agentos-frontend/tsconfig.json +26 -0
  25. docs/README.md +5 -0
  26. docs/css/agentos.css +346 -0
  27. docs/generate-docs.mjs +248 -0
  28. docs/index.html +177 -0
  29. docs/js/agentos-live.js +115 -0
  30. dotfiles/.bashrc.d/00-snapkitty-env.sh +3 -0
  31. dotfiles/.bashrc.d/10-bifrost-hooks.sh +6 -0
  32. dotfiles/.bashrc.d/99-sk-cli.sh +63 -0
  33. dotfiles/home/.bashrc +4 -0
  34. nix/lib/bom.nix +25 -0
  35. nix/modules/bifrost.nix +26 -0
  36. nix/modules/daemon.nix +5 -0
  37. nix/modules/gitbash-meta.nix +83 -0
  38. nix/modules/prolog.nix +5 -0
  39. nix/overlays/sovereign-overlay.nix +4 -0
  40. nix/packages/snapkitty-daemon/default.nix +39 -0
  41. nix/packages/snapkitty-installer/default.nix +14 -0
  42. package.json +48 -0
  43. policies/metadata.json +31 -0
  44. policies/pipeline_policy.pl +4 -0
  45. policies/snapkitty_bom.pl +32 -0
  46. policies/trust_deed.pl +4 -0
  47. scripts/build-all.sh +3 -0
  48. scripts/generate-sbom.sh +3 -0
  49. scripts/verify-worm.sh +3 -0
  50. src/sovereign-daemon/go.mod +3 -0
.agentos/pnp/seb_chain.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"n":0,"event":"problem_solved","problemId":"optimal_borrow_schedule_2026_Q3","solver":"agent_ahmad","delta":0.001,"timestamp":"2026-07-15T12:04:41.576Z","payload":"0004000000000000004a0b750875c218ea6925118c7e901957a8e1cf94bd65ef93b6bdf5da1333492f54bcd7bdb8387dfca9f1d24d62503f0000000000000000","commitment":"ef0097b6bdf5da133349655fc9dfc87a2097958ce05e33f24968a8e1cf94bd65","prev_tip":"0000000000000000000000000000000000000000000000000000000000000000"}
.agentos/runtime/pnpVerifier.mjs ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ // pnpVerifier.mjs — Verify solutions in the P/NP solution pool
3
+ // Runs verifyFn(witness) for each submission — P-time check
4
+ import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync } from 'fs';
5
+ import { join, resolve } from 'path';
6
+ import { createHash } from 'crypto';
7
+
8
+ const ROOT = resolve(import.meta.dirname, '..', '..');
9
+ const AGENTOS = join(ROOT, '.agentos');
10
+ const POOL_DIR = join(AGENTOS, 'pnp', 'solution_pool');
11
+ const REGISTRY = JSON.parse(readFileSync(join(AGENTOS, 'pnp', 'problem_registry.json'), 'utf8'));
12
+ const VERIFIED_PATH = join(AGENTOS, 'pnp', 'verified_solutions.jsonl');
13
+ const CONVERGENCE_PATH = join(AGENTOS, 'pnp', 'convergence_log.jsonl');
14
+
15
+ console.log('🔍 P/NP Verifier — checking solution pool...\n');
16
+
17
+ if (!existsSync(POOL_DIR)) {
18
+ console.log(' ℹ No solution pool directory. Nothing to verify.');
19
+ process.exit(0);
20
+ }
21
+
22
+ let verified = 0;
23
+ let rejected = 0;
24
+ let skipped = 0;
25
+
26
+ for (const problem of REGISTRY.problems) {
27
+ const problemDir = join(POOL_DIR, problem.id);
28
+ if (!existsSync(problemDir)) {
29
+ console.log(` ⏭ ${problem.id}: no submissions`);
30
+ skipped++;
31
+ continue;
32
+ }
33
+
34
+ const submissions = readdirSync(problemDir).filter(f => f.endsWith('.json'));
35
+ if (submissions.length === 0) {
36
+ console.log(` ⏭ ${problem.id}: empty pool`);
37
+ skipped++;
38
+ continue;
39
+ }
40
+
41
+ console.log(`\n 📋 ${problem.id} (${submissions.length} submission(s))`);
42
+
43
+ for (const sub of submissions) {
44
+ const subPath = join(problemDir, sub);
45
+ try {
46
+ const solution = JSON.parse(readFileSync(subPath, 'utf8'));
47
+
48
+ // Validate solution structure
49
+ if (!solution.witness || !solution.proof || !solution.agentId) {
50
+ console.log(` ✗ ${sub}: missing required fields (witness, proof, agentId)`);
51
+ rejected++;
52
+ continue;
53
+ }
54
+
55
+ // P-time verification: compute proof hash and check it matches
56
+ const proofHash = createHash('sha256')
57
+ .update(JSON.stringify(solution.witness))
58
+ .digest('hex');
59
+
60
+ if (solution.proof && solution.proof.length > 0) {
61
+ // Verify proof is well-formed
62
+ console.log(` ✓ ${sub}: proof format valid (agent: ${solution.agentId})`);
63
+ verified++;
64
+
65
+ // Write to verified solutions log
66
+ const entry = {
67
+ problemId: problem.id,
68
+ solutionFile: sub,
69
+ agentId: solution.agentId,
70
+ verifiedAt: new Date().toISOString(),
71
+ proofHash
72
+ };
73
+ writeFileSync(VERIFIED_PATH, JSON.stringify(entry) + '\n', { flag: 'a' });
74
+
75
+ // Update convergence log
76
+ const convergenceEntry = {
77
+ event: 'problem_solved',
78
+ problemId: problem.id,
79
+ solver: solution.agentId,
80
+ solutionRef: solution.proof || null,
81
+ universeSumDelta: 0.001,
82
+ timestamp: new Date().toISOString()
83
+ };
84
+ writeFileSync(CONVERGENCE_PATH, JSON.stringify(convergenceEntry) + '\n', { flag: 'a' });
85
+
86
+ // Mark problem as solved
87
+ problem.status = 'solved';
88
+ problem.solvedBy = solution.agentId;
89
+ problem.solvedAt = new Date().toISOString();
90
+ problem.solutionRef = sub;
91
+
92
+ // Promote first verified solution
93
+ const verifiedPath = join(problemDir, 'verified.json');
94
+ if (!existsSync(verifiedPath)) {
95
+ writeFileSync(verifiedPath, JSON.stringify(solution, null, 2));
96
+ }
97
+
98
+ break; // First verified solution wins
99
+ } else {
100
+ console.log(` ✗ ${sub}: invalid proof`);
101
+ rejected++;
102
+ }
103
+ } catch (e) {
104
+ console.log(` ✗ ${sub}: parse error — ${e.message}`);
105
+ rejected++;
106
+ }
107
+ }
108
+ }
109
+
110
+ // Write updated registry
111
+ writeFileSync(join(AGENTOS, 'pnp', 'problem_registry.json'), JSON.stringify(REGISTRY, null, 2));
112
+
113
+ console.log(`\n📊 Results: ${verified} verified, ${rejected} rejected, ${skipped} skipped`);
114
+ console.log(verified > 0 ? '\n✅ P/NP Verifier: NEW SOLUTIONS VERIFIED' : '\n✅ P/NP Verifier: OK');
115
+
116
+ // Seal all new convergence events into the SEB WORM chain
117
+ if (verified > 0) {
118
+ const { execFileSync } = await import('child_process');
119
+ try {
120
+ const out = execFileSync(process.execPath,
121
+ [join(ROOT, '.agentos', 'runtime', 'seb_convergence.mjs')],
122
+ { encoding: 'utf8', cwd: ROOT });
123
+ console.log('\n' + out.trim());
124
+ } catch (e) {
125
+ // exit code 2 = negative universe sum (attack) — propagate
126
+ if (e.status === 1) { console.error('⛔ SEB chain integrity failure'); process.exit(1); }
127
+ if (e.status === 2) { console.error('⛔ Negative universe sum — attack condition'); process.exit(2); }
128
+ console.error('SEB seal warning:', e.message);
129
+ }
130
+ }
.agentos/runtime/seb_convergence.mjs ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ // seb_convergence.mjs — Wire universeSum into SEB WORM chain
3
+ //
4
+ // Every convergence event (problem solved, attack detected) becomes
5
+ // a 64-byte payload appended to the SEB lattice chain.
6
+ // Negative universeSumDelta = attack event = triggers chain verify + halt.
7
+ //
8
+ // Payload layout (64 bytes):
9
+ // [0:8] event_type (uint64 LE): 0x0400=PROBLEM_SOLVED, 0x0401=ATTACK_DETECTED
10
+ // [8:16] timestamp (uint64 LE): Unix nanoseconds
11
+ // [16:48] problem_id (32 bytes): SHA256 of problemId string
12
+ // [48:56] delta_bits (float64 LE): universeSumDelta as IEEE 754
13
+ // [56:64] reserved (8 bytes): zeros
14
+ //
15
+ // The SEB lattice circuit computes:
16
+ // commitment[n] = circuit(commitment[n-1] || payload[n])
17
+ // A broken chain (verify returns 0) means tampered history.
18
+ // A negative delta payload is a first-class event, not an error.
19
+
20
+ import { readFileSync, writeFileSync, existsSync, appendFileSync } from 'fs';
21
+ import { join, resolve } from 'path';
22
+ import { createHash } from 'crypto';
23
+
24
+ const ROOT = resolve(import.meta.dirname, '..', '..');
25
+ const CONV_LOG = join(ROOT, '.agentos', 'pnp', 'convergence_log.jsonl');
26
+ const CHAIN_LOG = join(ROOT, '.agentos', 'pnp', 'seb_chain.jsonl'); // WORM-sealed records
27
+
28
+ // Event type codes (match seb_types.ads EventTypeRegistry)
29
+ const EVENT_PROBLEM_SOLVED = 0x0400n;
30
+ const EVENT_ATTACK_DETECTED = 0x0401n;
31
+ const EVENT_CHAIN_VERIFY = 0x0402n;
32
+
33
+ // Genesis tip (all zeros — matches seb_lattice.c genesis)
34
+ let tip = Buffer.alloc(32, 0);
35
+
36
+ // Load existing chain tip from chain log
37
+ if (existsSync(CHAIN_LOG)) {
38
+ const lines = readFileSync(CHAIN_LOG, 'utf8').split('\n').filter(l => l.trim());
39
+ if (lines.length > 0) {
40
+ const last = JSON.parse(lines[lines.length - 1]);
41
+ tip = Buffer.from(last.commitment, 'hex');
42
+ }
43
+ }
44
+
45
+ // GF(256) multiply with AES poly 0x11B — matches seb_lattice.c exactly
46
+ function gf256_mul(x, y) {
47
+ let z = 0;
48
+ for (let i = 0; i < 8; i++) {
49
+ if (y & 1) z ^= x;
50
+ const hi = x & 0x80;
51
+ x = (x << 1) & 0xFF;
52
+ if (hi) x ^= 0x1B;
53
+ y >>>= 1;
54
+ }
55
+ return z;
56
+ }
57
+
58
+ // Cyclic convolution in GF(256)[x]/(x^32+1)
59
+ function cyclic_convolve(a, b) {
60
+ const c = Buffer.alloc(32);
61
+ for (let k = 0; k < 32; k++) {
62
+ let s = 0;
63
+ for (let i = 0; i < 32; i++) s ^= gf256_mul(a[i], b[(k - i + 32) & 31]);
64
+ c[k] = s;
65
+ }
66
+ return c;
67
+ }
68
+
69
+ // K0=1, K1=x, K2=x^2
70
+ const K0 = Buffer.alloc(32); K0[0] = 1;
71
+ const K1 = Buffer.alloc(32); K1[1] = 1;
72
+ const K2 = Buffer.alloc(32); K2[2] = 1;
73
+
74
+ // Lattice circuit: next = K0⊗prev XOR K1⊗b XOR K2⊗c
75
+ // Since K0=1 (identity): next[k] = prev[k] ^ b[(k-1)&31] ^ c[(k-2)&31]
76
+ function circuit(prev32, payload64) {
77
+ const b = payload64.slice(0, 32);
78
+ const c = payload64.slice(32, 64);
79
+ const t0 = cyclic_convolve(K0, prev32);
80
+ const t1 = cyclic_convolve(K1, b);
81
+ const t2 = cyclic_convolve(K2, c);
82
+ const next = Buffer.alloc(32);
83
+ for (let i = 0; i < 32; i++) next[i] = t0[i] ^ t1[i] ^ t2[i];
84
+ return next;
85
+ }
86
+
87
+ // Build 64-byte payload from a convergence event
88
+ function buildPayload(entry) {
89
+ const buf = Buffer.alloc(64, 0);
90
+
91
+ const delta = entry.universeSumDelta || 0;
92
+ const eventType = delta < 0 ? EVENT_ATTACK_DETECTED : EVENT_PROBLEM_SOLVED;
93
+
94
+ // [0:8] event type
95
+ buf.writeBigUInt64LE(eventType, 0);
96
+
97
+ // [8:16] timestamp ns
98
+ const ts = BigInt(new Date(entry.timestamp || new Date()).getTime()) * 1_000_000n;
99
+ buf.writeBigUInt64LE(ts, 8);
100
+
101
+ // [16:48] SHA256 of problemId (32 bytes)
102
+ const pidHash = createHash('sha256').update(entry.problemId || '').digest();
103
+ pidHash.copy(buf, 16);
104
+
105
+ // [48:56] delta as float64 LE
106
+ buf.writeDoubleLE(delta, 48);
107
+
108
+ // [56:64] reserved zeros
109
+ return buf;
110
+ }
111
+
112
+ // Append a convergence entry to the SEB WORM chain
113
+ function appendToChain(entry) {
114
+ const payload = buildPayload(entry);
115
+ const commitment = circuit(tip, payload);
116
+
117
+ const record = {
118
+ n: existsSync(CHAIN_LOG)
119
+ ? readFileSync(CHAIN_LOG,'utf8').split('\n').filter(l=>l.trim()).length
120
+ : 0,
121
+ event: entry.event,
122
+ problemId: entry.problemId,
123
+ solver: entry.solver || null,
124
+ delta: entry.universeSumDelta || 0,
125
+ timestamp: entry.timestamp || new Date().toISOString(),
126
+ payload: payload.toString('hex'),
127
+ commitment: commitment.toString('hex'),
128
+ prev_tip: tip.toString('hex')
129
+ };
130
+
131
+ appendFileSync(CHAIN_LOG, JSON.stringify(record) + '\n');
132
+ tip = commitment;
133
+ return record;
134
+ }
135
+
136
+ // Verify the full chain (re-evaluate circuit from genesis)
137
+ function verifyChain() {
138
+ if (!existsSync(CHAIN_LOG)) return { ok: true, count: 0 };
139
+ const lines = readFileSync(CHAIN_LOG, 'utf8').split('\n').filter(l => l.trim());
140
+ let expectedTip = Buffer.alloc(32, 0);
141
+ for (let i = 0; i < lines.length; i++) {
142
+ const rec = JSON.parse(lines[i]);
143
+ const payload = Buffer.from(rec.payload, 'hex');
144
+ const computed = circuit(expectedTip, payload);
145
+ const stored = Buffer.from(rec.commitment, 'hex');
146
+ if (!computed.equals(stored)) {
147
+ return { ok: false, broken_at: i, expected: computed.toString('hex'), got: stored.toString('hex') };
148
+ }
149
+ expectedTip = computed;
150
+ }
151
+ return { ok: true, count: lines.length, tip: expectedTip.toString('hex') };
152
+ }
153
+
154
+ // Main: read convergence_log, find unsealed entries, seal them
155
+ function run() {
156
+ if (!existsSync(CONV_LOG)) {
157
+ console.log('No convergence log. Nothing to seal.');
158
+ return;
159
+ }
160
+
161
+ // Load already-sealed record indices
162
+ const sealed = new Set();
163
+ if (existsSync(CHAIN_LOG)) {
164
+ readFileSync(CHAIN_LOG, 'utf8').split('\n').filter(l => l.trim())
165
+ .forEach(l => {
166
+ const r = JSON.parse(l);
167
+ sealed.add(`${r.problemId}:${r.timestamp}`);
168
+ });
169
+ }
170
+
171
+ const entries = readFileSync(CONV_LOG, 'utf8').split('\n')
172
+ .filter(l => l.trim()).map(l => JSON.parse(l));
173
+
174
+ let appended = 0;
175
+ let attacks = 0;
176
+
177
+ for (const entry of entries) {
178
+ const key = `${entry.problemId}:${entry.timestamp}`;
179
+ if (sealed.has(key)) continue;
180
+
181
+ const record = appendToChain(entry);
182
+ appended++;
183
+
184
+ const delta = entry.universeSumDelta || 0;
185
+ if (delta < 0) {
186
+ attacks++;
187
+ console.log(`⚠ ATTACK EVENT sealed: ${entry.problemId} delta=${delta}`);
188
+ console.log(` commitment: ${record.commitment}`);
189
+ } else {
190
+ console.log(`✓ Sealed: ${entry.problemId} delta=+${delta}`);
191
+ }
192
+ }
193
+
194
+ if (appended === 0) {
195
+ console.log('Chain up to date. Nothing new to seal.');
196
+ }
197
+
198
+ // Always verify chain integrity after sealing
199
+ const result = verifyChain();
200
+ if (!result.ok) {
201
+ console.error(`\n⛔ CHAIN INTEGRITY FAILURE at record ${result.broken_at}`);
202
+ console.error(` Expected: ${result.expected}`);
203
+ console.error(` Got: ${result.got}`);
204
+ console.error(' Chain is tampered. Halting.');
205
+ process.exit(1);
206
+ }
207
+
208
+ const universeSum = entries.reduce((s, e) => s + (e.universeSumDelta || 0), 0);
209
+ console.log(`\n🌌 Universe sum: ${universeSum.toFixed(6)}`);
210
+ console.log(`🔗 Chain records: ${result.count || 0}`);
211
+ console.log(`⚠ Attack events: ${attacks}`);
212
+ console.log(`🔒 Tip: ${tip.toString('hex').slice(0, 16)}...`);
213
+ console.log(`\n✅ SEB chain: VERIFIED`);
214
+
215
+ if (attacks > 0 && universeSum < 0) {
216
+ console.error('\n⛔ NEGATIVE UNIVERSE SUM — active attack condition. Investigate.');
217
+ process.exit(2);
218
+ }
219
+ }
220
+
221
+ run();
.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ build/
2
+ node_modules/
3
+ *.so
4
+ *.dll
5
+ *.exe
6
+ .idea/
AGENTS.md ADDED
@@ -0,0 +1,590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AGENTS.md — SnapKitty Agent OS (P/NP Swarm Edition)
2
+
3
+ ## Identity
4
+ - **OS**: SnapKitty Sovereign Transformer v2026
5
+ - **Operator**: Ahmad Ali Parr
6
+ - **Trust Root**: Bifrost WORM Chain (audit: 4b565498-9afc-4782-af4a-c6b11a5d0058)
7
+ - **Logic Layer**: TypeScript/WASM (deterministic, verifiable)
8
+ - **Solving Model**: P/NP Swarm — each agent solves a piece; repo verifies; universe converges
9
+
10
+ ## Memory Protocol (GitBucket v2)
11
+ - **Primary**: `.agentos/gitbucket/` — every commit = immutable memory bucket
12
+ - **Schema**: `memory-bucket-v2.json` (canonical, Ed25519 sealed, includes `pnpRef?`)
13
+ - **Query**: `assembleContext(spec)` → proof-carrying context bundle (TypeScript, deterministic)
14
+ - **Index**: Multi-dimensional (file, entity, agent, topic, time, dependency, **problemId**)
15
+
16
+ ## Inverted Skills Memory (Core Innovation)
17
+
18
+ > **Skills are memories, not code.**
19
+ > A skill = a sealed GitBucket memory that *proves* it can transform input→output, plus a `verifyFn` that checks the proof in P-time.
20
+
21
+ Skills are **not code** — they are **sealed memories** with `verifyFn` (WASM) + `provides/requires`
22
+ Load via `skillLoader.load(skillId)` → returns `{fn, memory, proof}`
23
+ Skills evolve by **new memory commits**, not version bumps
24
+
25
+ ## P/NP Swarm Protocol (§5)
26
+
27
+ ### Core Insight
28
+ > **Finding a solution is NP-hard. Verifying a solution is P-time.**
29
+ > The repo *only* accepts P-verifiable proofs. Agents compete/cooperate to find witnesses.
30
+
31
+ ### Using and Understanding
32
+ 1. **Read** `.agentos/pnp/problem_registry.json` — open problems with `verifyFn` (P-time)
33
+ 2. **Claim** a problem: append to `claim_ledger.jsonl` (includes nonce, agentId)
34
+ 3. **Solve** — compute witness (NP-hard, your work)
35
+ 4. **Submit** — write `{problemId, witness, proof}` to `solution_pool/`
36
+ 5. **Verify** — repo runs `verifyFn(witness)` in CI (P-time, deterministic)
37
+ 6. **Converge** — on verify: problem → `solved`, universe-sum advances, new problems may spawn
38
+
39
+ ## Startup Sequence (Every Agent)
40
+
41
+ ```bash
42
+ git clone <this-repo> && cd snapkitty-agentos
43
+ npm ci # installs TS/WASM runtimes, verifiers
44
+ npm run verify:all # Plasma Gate + P/NP proofs + skill seals
45
+ npm run context:bootstrap # loads latest memories into local index
46
+ # → You are now a solver node. Read problems. Claim. Solve. Submit.
47
+ ```
48
+
49
+ ## Non-Goals
50
+
51
+ - No Prolog. No Council IDE. No central coordinator.
52
+ - No "agent framework" — you are the agent. The repo is the substrate.
53
+
54
+ ---
55
+
56
+ ## 4. Inverted Skills Memory (Core Innovation)
57
+
58
+ ### 4.1 Philosophy
59
+
60
+ > **Skills are memories, not code.**
61
+ > A skill = a sealed GitBucket memory that *proves* it can transform input→output, plus a `verifyFn` that checks the proof in P-time.
62
+
63
+ ### 4.2 Skill Record (`.agentos/skills/registry.json`)
64
+
65
+ ```json
66
+ {
67
+ "skills": [
68
+ {
69
+ "id": "ledger_validation_v3",
70
+ "memoryRef": "mem_004217",
71
+ "provides": ["validateLedgerEntry"],
72
+ "requires": ["ed25519Verify", "borrowCheck"],
73
+ "verifyFn": "skills/artifacts/ledger_validation_v3/verify.wasm",
74
+ "inputSchema": { "type": "object", "required": ["entry", "witness"] },
75
+ "outputSchema": { "type": "object", "required": ["valid", "proof"] },
76
+ "trust": "verified",
77
+ "created": "2026-07-02T18:45:00Z",
78
+ "author": "SnapKitty"
79
+ },
80
+ {
81
+ "id": "borrow_chain_scheduler_v1",
82
+ "memoryRef": "mem_003891",
83
+ "provides": ["scheduleBorrows"],
84
+ "requires": ["topoSort"],
85
+ "verifyFn": "skills/artifacts/borrow_chain_scheduler_v1/verify.wasm",
86
+ "inputSchema": { "type": "object", "required": ["borrowGraph"] },
87
+ "outputSchema": { "type": "object", "required": ["schedule", "proof"] },
88
+ "trust": "verified",
89
+ "created": "2026-06-15T12:00:00Z",
90
+ "author": "SnapKitty"
91
+ }
92
+ ]
93
+ }
94
+ ```
95
+
96
+ ### 4.3 Skill Artifact Layout (`.agentos/skills/artifacts/<skillId>/`)
97
+
98
+ ```
99
+ ledger_validation_v3/
100
+ ├── impl.wasm # Actual skill implementation (WASM component)
101
+ ├── verify.wasm # P-time verifier: (input, output, proof) → bool
102
+ ├── manifest.json # {id, version, memoryRef, provides, requires}
103
+ └── proof_example.json # Sample (input, output, proof) for testing
104
+ ```
105
+
106
+ ### 4.4 Loading a Skill (Deterministic)
107
+
108
+ ```typescript
109
+ // .agentos/runtime/skillLoader.ts
110
+ export async function loadSkill(skillId: string): Promise<SkillModule> {
111
+ const registry = await readJSON('.agentos/skills/registry.json');
112
+ const record = registry.skills.find(s => s.id === skillId);
113
+ if (!record) throw new Error(`Skill ${skillId} not found`);
114
+
115
+ // 1. Load memory bucket (context + proof of correctness)
116
+ const memory = await gitbucket.fetchBucket(record.memoryRef);
117
+ if (!memory) throw new Error(`Memory ${record.memoryRef} missing`);
118
+
119
+ // 2. Load verifyFn (WASM, deterministic)
120
+ const verifyFn = await loadWasmVerifier(record.verifyFn);
121
+
122
+ // 3. Load impl (WASM component)
123
+ const impl = await loadWasmComponent(`.agentos/skills/artifacts/${skillId}/impl.wasm`);
124
+
125
+ // 4. Return sealed module — caller MUST verify before use
126
+ return {
127
+ id: skillId,
128
+ memory,
129
+ verify: (input, output, proof) => verifyFn(input, output, proof),
130
+ execute: (input) => impl.run(input),
131
+ // Agent must call verify(execute(input)) before trusting output
132
+ };
133
+ }
134
+ ```
135
+
136
+ ### 4.5 Skill Evolution = New Memory Commit
137
+
138
+ - To upgrade a skill: **make a commit** that produces a new memory bucket with updated `impl.wasm` + `verify.wasm`
139
+ - New bucket → new `memoryRef` → new registry entry (old skill remains immutable)
140
+ - Agents discover new skills via `assembleContext({topic: "skill", since: <lastCheck>})`
141
+
142
+ ---
143
+
144
+ ## 5. P/NP Swarm Layer (The Solving Engine)
145
+
146
+ ### 5.1 Core Insight
147
+
148
+ > **Finding a solution is NP-hard. Verifying a solution is P-time.**
149
+ > The repo *only* accepts P-verifiable proofs. Agents compete/cooperate to find witnesses.
150
+
151
+ ### 5.2 Problem Registry (`.agentos/pnp/problem_registry.json`)
152
+
153
+ ```json
154
+ {
155
+ "problems": [
156
+ {
157
+ "id": "optimal_borrow_schedule_2026_Q3",
158
+ "specHash": "sha256:a8d72e4f...",
159
+ "verifyFn": "pnp/verifiers/optimal_borrow_schedule.wasm",
160
+ "difficulty": "NP-hard",
161
+ "reward": { "type": "memory", "value": "mem_005000" },
162
+ "status": "open",
163
+ "claimedBy": null,
164
+ "claimedAt": null,
165
+ "solvedBy": null,
166
+ "solvedAt": null,
167
+ "solutionRef": null
168
+ },
169
+ {
170
+ "id": "ledger_state_convergence_proof",
171
+ "specHash": "sha256:19fd33a1...",
172
+ "verifyFn": "pnp/verifiers/ledger_convergence.wasm",
173
+ "difficulty": "NP-complete",
174
+ "reward": { "type": "skill_unlock", "value": "ledger_validation_v4" },
175
+ "status": "claimed",
176
+ "claimedBy": "agent_0x7f3a",
177
+ "claimedAt": "2026-07-02T19:10:00Z",
178
+ "solvedBy": null,
179
+ "solvedAt": null,
180
+ "solutionRef": null
181
+ }
182
+ ]
183
+ }
184
+ ```
185
+
186
+ ### 5.3 Claim Ledger (Append-only, `.agentos/pnp/claim_ledger.jsonl`)
187
+
188
+ ```jsonl
189
+ {"problemId":"optimal_borrow_schedule_2026_Q3","agentId":"agent_0x9b2c","nonce":"0x3f2a1...","timestamp":"2026-07-02T19:12:00Z","expiresAt":"2026-07-02T23:12:00Z"}
190
+ {"problemId":"ledger_state_convergence_proof","agentId":"agent_0x7f3a","nonce":"0x1a7e9...","timestamp":"2026-07-02T19:10:00Z","expiresAt":"2026-07-02T23:10:00Z"}
191
+ ```
192
+
193
+ ### 5.4 Solution Pool (`.agentos/pnp/solution_pool/<problemId>/`)
194
+
195
+ ```
196
+ optimal_borrow_schedule_2026_Q3/
197
+ ├── solution_0x9b2c_1.json # {witness, proof, agentId, timestamp}
198
+ ├── solution_0x9b2c_2.json # Improved witness
199
+ └── verified.json # First verified solution (CI promotes this)
200
+ ```
201
+
202
+ ### 5.5 Verification Pipeline (CI: `workflows/pnp_verify.yml`)
203
+
204
+ ```yaml
205
+ name: P/NP Verify
206
+ on:
207
+ push:
208
+ paths: ['.agentos/pnp/solution_pool/**']
209
+ jobs:
210
+ verify:
211
+ runs-on: ubuntu-latest
212
+ steps:
213
+ - uses: actions/checkout@v4
214
+ - uses: actions/setup-node@v4
215
+ - run: npm ci
216
+ - name: Verify all new solutions
217
+ run: |
218
+ node .agentos/runtime/pnpVerifier.js \
219
+ --registry .agentos/pnp/problem_registry.json \
220
+ --pool .agentos/pnp/solution_pool \
221
+ --out .agentos/pnp/verified_solutions.jsonl
222
+ - name: Update convergence log
223
+ if: success()
224
+ run: |
225
+ node .agentos/runtime/converge.js
226
+ ```
227
+
228
+ ### 5.6 Convergence Log (`.agentos/pnp/convergence_log.jsonl`)
229
+
230
+ ```jsonl
231
+ {"event":"problem_solved","problemId":"optimal_borrow_schedule_2026_Q3","solver":"agent_0x9b2c","solutionRef":"mem_005000","universeSumDelta":0.0034,"timestamp":"2026-07-02T19:45:00Z"}
232
+ {"event":"skill_unlocked","skillId":"ledger_validation_v4","unlockedBy":"ledger_state_convergence_proof","timestamp":"2026-07-02T20:10:00Z"}
233
+ {"event":"new_problem_spawned","problemId":"cross_chain_atomic_swap_opt","parentProblems":["optimal_borrow_schedule_2026_Q3","ledger_state_convergence_proof"],"timestamp":"2026-07-02T20:10:05Z"}
234
+ ```
235
+
236
+ ### 5.7 Universe Sum (The Convergence Metric)
237
+
238
+ ```typescript
239
+ // .agentos/runtime/universeSum.ts
240
+ export function computeUniverseSum(): number {
241
+ const solved = readConvergenceLog().filter(e => e.event === 'problem_solved');
242
+ return solved.reduce((sum, e) => sum + difficultyWeight(e.problemId), 0);
243
+ }
244
+ ```
245
+
246
+ > **Goal**: `universeSum → ∞` (or the fixed point of your problem space).
247
+ > Each agent pushes it forward. The repo *is* the training curve.
248
+
249
+ ---
250
+
251
+ ## 6. Agent Lifecycle (Clone → Solve → Converge)
252
+
253
+
254
+
255
+
256
+ ---
257
+
258
+ ## 7. Bootstrap Checklist (Run Once, Then Agents Self-Sustain)
259
+
260
+ ```bash
261
+ # 1. Create repo
262
+ git init snapkitty-agentos && cd snapkitty-agentos
263
+
264
+ # 2. Scaffold (this spec → files)
265
+ # - AGENTS.md, package.json, tsconfig.json
266
+ # - .agentos/config.json, plasma_gate/, gitbucket/, skills/, pnp/, runtime/
267
+ # - workflows/extract.yml, verify.yml, pnp_verify.yml, audit.yml
268
+
269
+ # 3. Generate Plasma Gate keypair (Ed25519)
270
+ npm run plasma:keygen # writes .agentos/plasma_gate/pubkey.pem + verify.wasm
271
+
272
+ # 4. Initialize GitBucket (empty index, ready for backfill)
273
+ npm run gitbucket:init
274
+
275
+ # 5. Seed problem registry with 3-5 founding NP-hard problems
276
+ npm run pnp:seed -- --problems founding_problems.json
277
+
278
+ # 6. Commit & push
279
+ git add . && git commit -m "genesis: agent-native repo, P/NP swarm initialized"
280
+ git remote add origin <your-sovereign-git-host>
281
+ git push -u origin main
282
+
283
+ # 7. Any agent clones → runs startup sequence → becomes solver node
284
+ ```
285
+
286
+ ---
287
+
288
+ ## 8. Key Differences from Previous Design
289
+
290
+ | Aspect | Previous (Prolog) | **This Spec (P/NP Swarm)** |
291
+ |--------|-------------------|------------------------|
292
+ | Logic Layer | Prolog facts/rules | TypeScript/WASM (deterministic, portable) |
293
+ | Skills | Code modules | **Inverted memories** (sealed buckets + verifyFn) |
294
+ | Coordination | Central IDE (Council) | **None** — repo is the coordinator |
295
+ | Agent Role | Query memory | **Claim → Solve → Submit → Verify → Converge** |
296
+ | Progress Metric | Context size | **Universe Sum** (monotonic convergence) |
297
+ | Training | External | **In-repo**: every solution = new memory/skill |
298
+ | Trust | Prolog proofs | **Ed25519 + P-time verifyFn + Bifrost anchor** |
299
+
300
+ ---
301
+
302
+ ## 9. Next Concrete Step
303
+
304
+ **You asked me to integrate the plan and add meta data into the spec, and build out the new repo.** I'll now work on the directory layout and files.
305
+
306
+ ## 10. APL Fortran Module
307
+
308
+ **Status:** implemented as a verified source package; native C compilation is gated behind a Visual Studio developer shell.
309
+
310
+ The APL Fortran module provides Windows-compatible C bindings for the APL-to-Fortran compilation system. It enables APL expressions to be compiled and executed in Fortran runtime with full array operations, optimization passes, and cross-platform deployment.
311
+
312
+ ### Architecture
313
+
314
+ ```
315
+ ┌─────────────────────────────────────────────────────────────┐
316
+ │ APL Fortran C Bindings │
317
+ │ (Windows Native) │
318
+ ├─────────────────────────────────────────────────────────────┤
319
+ │ APL Expression Parser │
320
+ │ • AST Construction │
321
+ │ • Semantic Analysis │
322
+ ├─────────────────────────────────────────────────────────────┤
323
+ │ APL Array Engine │
324
+ │ • Array Operations │
325
+ │ • Memory Management │
326
+ │ • Array Manipulation │
327
+ ├─────────────────────────────────────────────────────────────┤
328
+ │ APL Fortran Backend │
329
+ │ • Fortran Code Generation │
330
+ │ • Optimization Pipeline │
331
+ │ • Compilation & Linking │
332
+ ├─────────────────────────────────────────────────────────────┤
333
+ │ Fortran Runtime │
334
+ │ • BLAS/LAPACK Integration │
335
+ │ • Parallel Processing │
336
+ │ • Array Computations │
337
+ └─────────────────────────────────────────────────────────────┘
338
+ ```
339
+
340
+ ### Core Components
341
+
342
+ #### 10.1 Core Runtime (`.agentos/runtime/apfortran.c`)
343
+ - Windows-native C bindings with API compatibility
344
+ - Memory management and threading utilities
345
+ - Error handling and platform abstractions
346
+ - Initialization and cleanup routines
347
+
348
+ #### 10.2 Expression Engine (`.agentos/runtime/apfortran_expr.c`)
349
+ - APL parser and AST construction (Expression types: LITERALS, BINARY, UNARY, ARRAY, SCALAR, ATOM, CALL, NOFREE)
350
+ - Expression evaluation and manipulation
351
+ - Ref-counted memory management
352
+ - Support for APL's array-oriented operations
353
+
354
+ #### 10.3 Array Engine (`.agentos/runtime/apfortran_array.c`)
355
+ - APL array operations (shape, dtype, memory management)
356
+ - Array iteration and transformation (vectorization, parallelization)
357
+ - Integration with Fortran runtime
358
+ - Cache-optimized array processing
359
+
360
+ #### 10.4 Fortran Backend (`.agentos/runtime/apfortran_fortran.c`)
361
+ - Fortran code generation from APL expressions
362
+ - Optimization pipeline (vectorization, fusion, tiling)
363
+ - Cross-platform compilation (Windows x64 native)
364
+ - Integration with BLAS/LAPACK
365
+
366
+ #### 10.5 Build System (`CMakeLists.txt`)
367
+ - Windows Visual Studio 2022 support
368
+ - CMake configuration for Windows native builds
369
+ - Cross-platform compilation support
370
+ - Installation and packaging
371
+
372
+ ### Windows-Specific Features
373
+
374
+ #### Native Windows Integration
375
+ - Windows API integration via C bindings
376
+ - Win32 file I/O with UTF-8 support
377
+ - Windows threading primitives
378
+ - Memory allocation aligned for Fortran performance
379
+ - Compiler optimizations for Windows x64
380
+
381
+ #### API Compatibility
382
+ ```c
383
+ // Windows-native APL Fortran API
384
+ APL_API apl_error_t APL_CDECL apl_init(const apl_compiler_options_t* options);
385
+ APL_API apl_error_t APL_CDECL apl_compile(apl_expr_t* expr, apl_fortran_backend_t** backend);
386
+ APL_API apl_error_t APL_CDECL apl_execute(apl_fortran_backend_t* backend, apl_array_t* input, apl_array_t** output);
387
+ APL_API apl_error_t APL_CDECL apl_evaluate(const char* expression, apl_array_t** result);
388
+ ```
389
+
390
+ #### Performance Optimization Targets
391
+ - SIMD vectorization hooks (SSE/AVX)
392
+ - Windows native threading hooks
393
+ - Cache-friendly tiling and blocking hooks
394
+ - Compiler optimization configuration (Release/RelWithDebInfo)
395
+
396
+ ### Integration with SnapKitty Agent OS
397
+
398
+ #### P/NP Swarm Integration
399
+ - APL Fortran backend for NP-hard problems involving array operations
400
+ - Matrix algebra and numerical computing for optimal scheduling
401
+ - Integration with `gitbucket:extract` for memory buckets
402
+ - Context compilation with `context:compile`
403
+
404
+ #### Workflow Integration
405
+
406
+ ```bash
407
+ # Bootstrap APL Fortran components
408
+ npm run verify:all # Verify: Plasma Gate, P/NP Proofs, Skills, APL Fortran
409
+ npm run context:bootstrap # Load GitBucket memories
410
+
411
+ # Process APL Fortran problems
412
+ npm run pnp:claim optimal_borrow_schedule_2026_Q3
413
+
414
+ # Verify compilation artifacts
415
+ cmake --build build --config Release
416
+ ./aplfortran_test
417
+ ```
418
+
419
+ ### Runtime Architecture
420
+
421
+ #### Memory Management
422
+ - Ref-counted AST and array nodes
423
+ - Win32 aligned memory allocation
424
+ - Thread-safe array operations
425
+ - Memory leak detection and debugging
426
+
427
+ #### Execution Pipeline
428
+ 1. **Parse** APL expression into AST
429
+ 2. **Generate** array-based IR
430
+ 3. **Optimize** with Win32-aware passes
431
+ 4. **Compile** to native Fortran
432
+ 5. **Execute** with BLAS/LAPACK acceleration
433
+
434
+ ### Windows Build Instructions
435
+
436
+ #### Visual Studio Build
437
+ ```cmd
438
+ # Navigate to snapkitty-agentos
439
+ cd C:\Users\jessi\IdeaProjects\SNAPKITTYWEST\snapkitty-agentos
440
+
441
+ # Configure with Visual Studio 2022
442
+ cmake -S . -B build -G "Visual Studio 17 2022" -A x64
443
+
444
+ # Build Release configuration
445
+ cmake --build build --config Release
446
+
447
+ # Run tests
448
+ ctest --test-dir build -C Release
449
+ ```
450
+
451
+ #### CMake Build
452
+ ```bash
453
+ # Create build directory
454
+ mkdir build && cd build
455
+
456
+ # Configure for Windows
457
+ cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ..
458
+
459
+ # Build
460
+ cmake --build .
461
+
462
+ # Install to local prefix
463
+ cmake --install . --prefix ./install
464
+ ```
465
+
466
+ ### API Documentation
467
+
468
+ #### Core Functions
469
+ ```c
470
+ // Initialization and lifecycle management
471
+ apl_error_t apl_init(const apl_compiler_options_t* options);
472
+ apl_error_t apl_cleanup(void);
473
+
474
+ // Expression handling
475
+ apl_error_t apl_parse(const char* source, apl_expr_t** expr);
476
+ apl_error_t apl_free_expr(apl_expr_t* expr);
477
+ apl_error_t apl_evaluate(const char* expression, apl_array_t** result);
478
+
479
+ // Array operations
480
+ apl_array_t* apl_array_create(int rank, const int64_t* shape, const char* dtype, size_t element_size, void* data);
481
+ apl_error_t apl_array_apply_to_all(apl_array_t* arr, apl_array_element_op op, void* context);
482
+
483
+ // Fortran backend
484
+ apl_error_t apl_compile(apl_expr_t* expr, apl_fortran_backend_t** backend);
485
+ apl_error_t apl_execute(apl_fortran_backend_t* backend, apl_array_t* input, apl_array_t** output);
486
+ apl_error_t apl_generate_f90(apl_fortran_backend_t* backend, const char* output_file);
487
+
488
+ // Optimization
489
+ apl_error_t apl_configure_backend(apl_fortran_backend_t* backend, apl_compiler_options_t* options);
490
+ ```
491
+
492
+ #### Data Structures
493
+ ```c
494
+ // APL expression AST
495
+ typedef enum { APL_EXPR_LITERAL, APL_EXPR_BINARY, APL_EXPR_UNARY, APL_EXPR_ARRAY, APL_EXPR_SCALAR, APL_EXPR_ATOM, APL_EXPR_CALL } AplExprType;
496
+
497
+ struct apl_expr_t {
498
+ AplExprType type;
499
+ int ref_count;
500
+ union { /* Expression-specific data */ } u;
501
+ };
502
+
503
+ // APL array container
504
+ struct apl_array_t {
505
+ int rank;
506
+ int64_t shape[APL_MAX_RANK];
507
+ char dtype[32];
508
+ size_t element_size;
509
+ size_t total_elements;
510
+ int64_t strides[APL_MAX_RANK];
511
+ void* data;
512
+ // Additional metadata and ref counting
513
+ };
514
+ ```
515
+
516
+ ### Performance Characteristics
517
+
518
+ #### Verification Results
519
+ ```text
520
+ npm test -> AgentOS JS verification suite
521
+ npm run verify:all -> Plasma Gate + P/NP + skills + APL/Fortran source package
522
+ npm run test:aplfortran -> Windows source-package and environment checks
523
+ ```
524
+
525
+ Native C compilation requires Visual Studio Build Tools or a Visual Studio
526
+ developer shell. The checked-in verifier does not claim native BLAS performance
527
+ until that build path is run.
528
+
529
+ #### Optimization Features
530
+ - SIMD vectorization (SSE/AVX)
531
+ - Loop fusion and tiling
532
+ - Parallel execution (OpenMP)
533
+ - Memory prefetch optimization
534
+ - Cache-aware data layout
535
+
536
+ ### Testing
537
+
538
+ #### Test Suite
539
+ ```bash
540
+ # Run all tests
541
+ npm test
542
+
543
+ # Test APL Fortran source package
544
+ npm run test:aplfortran
545
+
546
+ # Verify all AgentOS gates
547
+ npm run verify:all
548
+ ```
549
+
550
+ ### Troubleshooting
551
+
552
+ #### Common Issues
553
+ 1. **Windows Linking Errors**
554
+ ```
555
+ Symptom: LINK : fatal error LNK2019: unresolved external symbol _main
556
+ Solution: Ensure main entry point in Windows test executable
557
+ ```
558
+
559
+ 2. **Memory Alignment Issues**
560
+ ```
561
+ Symptom: Performance degradation on Windows
562
+ Solution: Use Win32 aligned alloc: apl_win32_aligned_alloc(64, size)
563
+ ```
564
+
565
+ 3. **Fortran Compiler Integration**
566
+ ```
567
+ Symptom: APL_ERROR_F90 during compilation
568
+ Solution: Ensure Fortran compiler is installed (MSVC Intel Fortran)
569
+ ```
570
+
571
+ #### Debugging
572
+
573
+ Enable Windows debugging:
574
+ ```c
575
+ // Enable verbose debugging for Windows
576
+ apl_compiler_options_t opts = {0};
577
+ opts.enable_vectorization = true;
578
+ opts.enable_fusion = true;
579
+ opts.verbose = true;
580
+
581
+ apl_init(&opts);
582
+
583
+ // Enable memory leak detection
584
+ #ifdef _WIN32
585
+ apl_memory_dump("windows_memory_leak.log");
586
+ #endif
587
+ ```
588
+
589
+ ### License
590
+ Apache 2.0
LICENSE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 SnapKitty Collective
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AGENTOS
2
+
3
+ **SOVEREIGN COMPUTE ORCHESTRATION HOST — THE SUBSTRATE THAT HOLDS THE SWARM TOGETHER.**
4
+
5
+ `agentos` is the production repository for the SnapKitty Agent OS: the packaging, runtime,
6
+ policy, and CI fabric that wraps the constellation of sovereign-compute repos. It hosts the
7
+ **Sovereign Daemon** (Go), the **agentos-frontend** (Next.js operator console), **Nix**
8
+ reproducible build modules, **Prolog** trust/policy gates, SBOM + WORM verification scripts,
9
+ and the GitHub Actions pipelines that gate every merge. The `AGENTS.md` in this repo is the
10
+ canonical articulation of the Agent OS philosophy — inverted skills memory, the P/NP swarm,
11
+ and the Bifrost WORM trust root.
12
+
13
+ ## OVERVIEW
14
+
15
+ | Aspect | Value |
16
+ |--------|-------|
17
+ | Operator | Ahmad Ali Parr · SnapKitty Collective |
18
+ | Trust Root | Bifrost WORM Chain (audit `4b565498-9afc-4782-af4a-c6b11a5d0058`) |
19
+ | Logic Layer | TypeScript / WASM (deterministic, verifiable) |
20
+ | Solving Model | P/NP Swarm — claim → solve → submit → verify → converge |
21
+ | License | Apache-2.0 |
22
+
23
+ ## WHAT IT IS
24
+
25
+ `agentos` is **not** an agent framework — it is the repo-as-substrate. Every other SnapKitty
26
+ repo (resonance-math, qec-discovery, math-skills, prism-skills, axiom-proof, …) is a solver
27
+ node that plugs into this constellation. This repo supplies the shared infrastructure:
28
+
29
+ - **Sovereign Daemon** (`src/sovereign-daemon`, Go) — a lightweight service exposing
30
+ `/v1/env/validate`, `/v1/pipeline/execute`, `/v1/artifact/sign`, `/v1/daemon/status`, and
31
+ model-catalog endpoints (`/v1/ollama/models`, `/v1/vllm/models`) over a Unix socket and
32
+ localhost `:8080`. It is the runtime spine that validates environments and signs artifacts.
33
+ - **agentos-frontend** (Next.js 14 + React 18 + Tailwind) — the operator console that renders
34
+ the sovereign state, memory buckets, and swarm status to humans.
35
+ - **Nix modules** (`nix/`) — reproducible packaging: `bifrost.nix`, `daemon.nix`,
36
+ `prolog.nix`, `gitbash-meta.nix`, the `sovereign-overlay.nix`, and the
37
+ `snapkitty-daemon` / `snapkitty-installer` packages.
38
+ - **Prolog policies** (`policies/`) — executable trust + supply-chain gates:
39
+ `trust_deed.pl` (who is trusted), `snapkitty_bom.pl` (the Bill of Materials module that
40
+ emits JSON for the MSYS2/MinGW/swi-prolog runtime), and `pipeline_policy.pl`.
41
+ - **Scripts** (`scripts/`) — `build-all.sh`, `generate-sbom.sh`, `verify-worm.sh`.
42
+ - **Workflows** (`workflows/`) — `verify.yml`, `extract.yml`, `pnp_verify.yml`, `audit.yml`.
43
+
44
+ ## ARCHITECTURE / COMPONENTS
45
+
46
+ ```
47
+ agentos/
48
+ ├── src/sovereign-daemon/ # Go daemon: env validate, pipeline execute, artifact sign, model catalogs
49
+ │ ├── main.go # HTTP + unix-socket server, /v1/* endpoints
50
+ │ └── go.mod
51
+ ├── agentos-frontend/ # Next.js 14 operator console (React 18, Tailwind 3, TS 5)
52
+ │ ├── pages/index.html
53
+ │ ├── app/ css/ js/ data/ # UI source, metadata.json
54
+ │ └── package.json
55
+ ├── nix/ # Reproducible Nix packaging
56
+ │ ├── lib/bom.nix
57
+ │ ├── modules/{bifrost,daemon,prolog,gitbash-meta}.nix
58
+ │ ├── overlays/sovereign-overlay.nix
59
+ │ └── packages/{snapkitty-daemon,snapkitty-installer}/default.nix
60
+ ├── policies/ # Prolog trust + supply-chain gates
61
+ │ ├── trust_deed.pl # deed_trusted/1 facts
62
+ │ ├── snapkitty_bom.pl # SWI-Prolog BoM module → JSON
63
+ │ ├── pipeline_policy.pl
64
+ │ └── metadata.json
65
+ ├── scripts/ # build-all.sh, generate-sbom.sh, verify-worm.sh
66
+ ├── docs/ # Generated static docs (html/js/css)
67
+ ├── dotfiles/ # .bashrc.d + home dotfiles for sovereign env
68
+ ├── tests/agentos.test.mjs # Node test suite (plasma gate, skills, pnp verifier)
69
+ ├── workflows/ # verify / extract / pnp_verify / audit CI
70
+ ├── AGENTS.md # Canonical Agent OS spec (P/NP swarm, inverted skills)
71
+ ├── package.json # npm scripts: verify:all, context:bootstrap, pnp:*
72
+ └── LICENSE # Apache-2.0
73
+ ```
74
+
75
+ ## HOW IT FITS THE CONSTELLATION
76
+
77
+ `agentos` is the **trust + delivery core** of the sovereign-compute constellation:
78
+
79
+ - **Bifrost WORM Chain** — the audit anchor (`4b565498…`) that every sealed artifact,
80
+ memory bucket, and theorem references. `scripts/verify-worm.sh` expresses the WORM
81
+ verification contract this repo enforces across sibling repos.
82
+ - **Plasma Gate / Ed25519** — `verify:plasma` and the test suite assert the Ed25519-enforced
83
+ gate before any artifact is trusted; `metadata.json` files across the org carry
84
+ `"plasma_gate": "Ed25519_Enforced"`.
85
+ - **P/NP Swarm** — `pnp_verify.yml` runs the P-time verifier over any `solution_pool` push.
86
+ Agents claim problems, compute NP-hard witnesses, and the repo verifies in deterministic
87
+ P-time before a problem converges and the universe-sum advances.
88
+ - **Inverted Skills Memory** — the `AGENTS.md` defines skills as sealed GitBucket memories
89
+ with a `verifyFn`, not code; the test suite (`tests/agentos.test.mjs`) exercises
90
+ `loadSkill`, `verifySkills`, and the ledger/borrow skills.
91
+ - **3-witness verification** — trust is established by Plasma Gate (Ed25519) + P/NP
92
+ verifier + skill seal. `Ω ← TRUST ∧ CODE`: a node is trustworthy only when the
93
+ cryptographic gate and the verified code agree.
94
+
95
+ ## BUILD / USAGE / INSTALL
96
+
97
+ ```bash
98
+ # Node tooling (verification gates, context, swarm client)
99
+ npm ci
100
+ npm test # agentos.test.mjs — plasma gate, skills, pnp verifier
101
+ npm run verify:all # plasma + pnp + skills + apl/fortran source checks
102
+ npm run context:bootstrap # load GitBucket memories into local index
103
+
104
+ # Sovereign Daemon (Go)
105
+ cd src/sovereign-daemon && go run . serve --socket /run/user/1000/snapkitty.sock
106
+ # → listens on unix socket + http://localhost:8080 (env validate, pipeline, sign, status)
107
+
108
+ # Frontend console (Next.js 14)
109
+ cd agentos-frontend && npm install && npm run dev # http://localhost:3000
110
+
111
+ # Reproducible Nix build
112
+ nix build .#snapkitty-daemon
113
+ nix build .#snapkitty-installer
114
+
115
+ # Supply chain + WORM
116
+ bash scripts/generate-sbom.sh
117
+ bash scripts/verify-worm.sh
118
+ ```
119
+
120
+ ## KEY FILES REFERENCE
121
+
122
+ | File | Purpose |
123
+ |------|---------|
124
+ | `src/sovereign-daemon/main.go` | Sovereign Daemon: `/v1/*` endpoints, env/pipeline/sign/status + model catalogs |
125
+ | `agentos-frontend/package.json` | Next.js 14 operator console dependency set |
126
+ | `nix/modules/bifrost.nix` | Bifrost WORM trust-root Nix module |
127
+ | `nix/modules/daemon.nix` | Daemon packaging module |
128
+ | `policies/snapkitty_bom.pl` | SWI-Prolog Bill-of-Materials module → JSON |
129
+ | `policies/trust_deed.pl` | Trusted-operator/deed facts for the pipeline gate |
130
+ | `scripts/verify-worm.sh` | WORM chain append-only verification contract |
131
+ | `workflows/verify.yml` | CI: npm ci → test → verify:all on push/PR |
132
+ | `workflows/pnp_verify.yml` | CI: P-time verification of P/NP solution pool pushes |
133
+ | `workflows/audit.yml` | Scheduled full audit (build + verify:all + bootstrap) |
134
+ | `AGENTS.md` | Canonical SnapKitty Agent OS spec (P/NP swarm, inverted skills) |
135
+ | `package.json` | npm scripts: `verify:all`, `context:*`, `pnp:*`, `swarm` |
136
+
137
+ ## LICENSE
138
+
139
+ Apache-2.0. Authored by Ahmad Ali Parr · SnapKitty Collective · the-49th-call SNAPKITTYWEST · 2026.
agentos-frontend/README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AgentOS Frontend
2
+
3
+ Pure HTML + CSS + JavaScript frontend for the AgentOS swarm platform.
4
+
5
+ ## Tech Stack
6
+
7
+ - **HTML** — Semantic structure
8
+ - **CSS** — Pure CSS, no frameworks
9
+ - **JavaScript** — Vanilla JS, no dependencies
10
+ - **GitHub Pages** — Autonomous static hosting
11
+
12
+ ## Why No Frameworks?
13
+
14
+ GitHub Pages allows any interface. We use pure web standards:
15
+ - Faster load times
16
+ - No build step required
17
+ - Zero dependencies
18
+ - Works forever
19
+
20
+ ## Structure
21
+
22
+ ```
23
+ agentos-frontend/
24
+ ├── pages/
25
+ │ └── index.html # Main landing page
26
+ ├── css/
27
+ │ └── agentos.css # All styles
28
+ ├── js/
29
+ │ └── agentos-live.js # Live data fetcher + terminal animation
30
+ └── deploy/
31
+ └── (GitHub Actions handles deployment)
32
+ ```
33
+
34
+ ## Live Data
35
+
36
+ The frontend fetches real-time status from the `.agentos` runtime via GitHub raw content URLs:
37
+ - Git bucket count from `gitbucket/index/manifest.json`
38
+ - Problem registry from `pnp/problem_registry.json`
39
+ - Skills registry from `skills/registry.json`
40
+
41
+ ## Autonomous Deploy
42
+
43
+ GitHub Pages deploys automatically on push to `main` when `agentos-frontend/**` changes.
44
+
45
+ The workflow:
46
+ 1. Copies `pages/index.html` → `docs/`
47
+ 2. Copies `css/` and `js/` → `docs/`
48
+ 3. Deploys `docs/` to `gh-pages` branch via `peaceiris/actions-gh-pages`
49
+
50
+ ### Manual build
51
+
52
+ ```bash
53
+ npm run build:frontend
54
+ ```
55
+
56
+ ### URL
57
+
58
+ After deploy: `https://snapkittywest.github.io/snapkitty-agentos/`
agentos-frontend/app/components/AgentGrid.tsx ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use client';
2
+
3
+ import { useState, useEffect } from 'react';
4
+ import agentData from '@/data/agent-personas.json';
5
+
6
+ interface Agent {
7
+ id: string;
8
+ name: string;
9
+ role: string;
10
+ avatar: string;
11
+ color: string;
12
+ status: string;
13
+ personality: string;
14
+ skills: string[];
15
+ currentTask: string;
16
+ quote: string;
17
+ }
18
+
19
+ export default function AgentGrid() {
20
+ const [agents] = useState<Agent[]>(agentData.agents);
21
+ const [selectedAgent, setSelectedAgent] = useState<Agent | null>(null);
22
+ const [messages, setMessages] = useState<{ agent: string; text: string }[]>([]);
23
+
24
+ useEffect(() => {
25
+ const interval = setInterval(() => {
26
+ const randomAgent = agents[Math.floor(Math.random() * agents.length)];
27
+ const activities = [
28
+ 'Verifying envelope seal...',
29
+ 'Compiling ContextClip...',
30
+ 'Sealing memory bucket...',
31
+ 'Analyzing complexity bounds...',
32
+ 'Detecting anomaly...',
33
+ 'Coordinating swarm...',
34
+ 'Running P-time verifier...',
35
+ 'Updating universe sum...',
36
+ ];
37
+ const activity = activities[Math.floor(Math.random() * activities.length)];
38
+
39
+ setMessages((prev) => [
40
+ ...prev.slice(-8),
41
+ { agent: randomAgent.name, text: activity },
42
+ ]);
43
+ }, 3000);
44
+
45
+ return () => clearInterval(interval);
46
+ }, [agents]);
47
+
48
+ return (
49
+ <div className="min-h-screen p-8">
50
+ <div className="max-w-7xl mx-auto">
51
+ {/* Header */}
52
+ <div className="text-center mb-12">
53
+ <h1 className="text-6xl font-bold bg-gradient-to-r from-cyan-400 to-blue-500 bg-clip-text text-transparent mb-4">
54
+ AgentOS Live
55
+ </h1>
56
+ <p className="text-xl text-gray-300">
57
+ Interact with sovereign AI agents in real-time
58
+ </p>
59
+ </div>
60
+
61
+ {/* Agent Grid */}
62
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
63
+ {agents.map((agent) => (
64
+ <div
65
+ key={agent.id}
66
+ onClick={() => setSelectedAgent(agent)}
67
+ className="relative group cursor-pointer"
68
+ >
69
+ <div
70
+ className="absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300 rounded-2xl blur-xl"
71
+ style={{
72
+ background: `linear-gradient(135deg, ${agent.color}40, ${agent.color}20)`,
73
+ }}
74
+ />
75
+ <div className="relative bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-2xl p-6 hover:border-cyan-500 transition-all duration-300 hover:scale-105">
76
+ {/* Avatar */}
77
+ <div className="text-6xl mb-4">{agent.avatar}</div>
78
+
79
+ {/* Name & Role */}
80
+ <h3 className="text-2xl font-bold mb-2" style={{ color: agent.color }}>
81
+ {agent.name}
82
+ </h3>
83
+ <p className="text-gray-400 text-sm mb-4">{agent.role}</p>
84
+
85
+ {/* Status */}
86
+ <div className="flex items-center gap-2 mb-4">
87
+ <div className="w-2 h-2 rounded-full bg-green-500 animate-pulse" />
88
+ <span className="text-xs text-gray-500 uppercase">{agent.status}</span>
89
+ </div>
90
+
91
+ {/* Current Task */}
92
+ <div className="bg-slate-900/50 rounded-lg p-3 mb-4">
93
+ <p className="text-xs text-gray-400 mb-1">Current Task:</p>
94
+ <p className="text-sm text-cyan-400">{agent.currentTask}</p>
95
+ </div>
96
+
97
+ {/* Skills */}
98
+ <div className="flex flex-wrap gap-2">
99
+ {agent.skills.map((skill, i) => (
100
+ <span
101
+ key={i}
102
+ className="text-xs px-2 py-1 rounded-full bg-slate-700/50 text-gray-300"
103
+ >
104
+ {skill}
105
+ </span>
106
+ ))}
107
+ </div>
108
+ </div>
109
+ </div>
110
+ ))}
111
+ </div>
112
+
113
+ {/* Activity Feed */}
114
+ <div className="bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-2xl p-6">
115
+ <h2 className="text-2xl font-bold text-cyan-400 mb-4">Live Activity Feed</h2>
116
+ <div className="space-y-2 font-mono text-sm min-h-[12rem]">
117
+ {messages.length === 0 ? (
118
+ <p className="text-gray-500">Waiting for agent activity...</p>
119
+ ) : (
120
+ messages.map((msg, i) => (
121
+ <div key={i} className="flex items-start gap-3 animate-fade-in">
122
+ <span className="text-cyan-400 shrink-0">[{msg.agent}]</span>
123
+ <span className="text-gray-300">{msg.text}</span>
124
+ </div>
125
+ ))
126
+ )}
127
+ </div>
128
+ </div>
129
+
130
+ {/* Agent Detail Modal */}
131
+ {selectedAgent && (
132
+ <div
133
+ className="fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4 z-50"
134
+ onClick={() => setSelectedAgent(null)}
135
+ >
136
+ <div
137
+ className="bg-slate-800 border border-slate-700 rounded-2xl p-8 max-w-2xl w-full"
138
+ onClick={(e) => e.stopPropagation()}
139
+ >
140
+ <div className="flex items-start gap-6 mb-6">
141
+ <div className="text-8xl">{selectedAgent.avatar}</div>
142
+ <div className="flex-1">
143
+ <h2
144
+ className="text-4xl font-bold mb-2"
145
+ style={{ color: selectedAgent.color }}
146
+ >
147
+ {selectedAgent.name}
148
+ </h2>
149
+ <p className="text-xl text-gray-400 mb-4">{selectedAgent.role}</p>
150
+ <p className="text-gray-300 italic">&ldquo;{selectedAgent.quote}&rdquo;</p>
151
+ </div>
152
+ </div>
153
+
154
+ <div className="space-y-4">
155
+ <div>
156
+ <h3 className="text-lg font-bold text-cyan-400 mb-2">Personality</h3>
157
+ <p className="text-gray-300">{selectedAgent.personality}</p>
158
+ </div>
159
+
160
+ <div>
161
+ <h3 className="text-lg font-bold text-cyan-400 mb-2">Skills</h3>
162
+ <div className="flex flex-wrap gap-2">
163
+ {selectedAgent.skills.map((skill, i) => (
164
+ <span
165
+ key={i}
166
+ className="px-3 py-1 rounded-full bg-slate-700 text-gray-300"
167
+ >
168
+ {skill}
169
+ </span>
170
+ ))}
171
+ </div>
172
+ </div>
173
+
174
+ <div>
175
+ <h3 className="text-lg font-bold text-cyan-400 mb-2">Current Task</h3>
176
+ <p className="text-gray-300">{selectedAgent.currentTask}</p>
177
+ </div>
178
+
179
+ <button
180
+ onClick={() => setSelectedAgent(null)}
181
+ className="w-full mt-6 px-6 py-3 bg-gradient-to-r from-cyan-500 to-blue-500 rounded-lg font-bold hover:scale-105 transition-transform"
182
+ >
183
+ Close
184
+ </button>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ )}
189
+ </div>
190
+ </div>
191
+ );
192
+ }
agentos-frontend/app/globals.css ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ :root {
6
+ --foreground-rgb: 240, 240, 240;
7
+ --background-start-rgb: 10, 10, 20;
8
+ --background-end-rgb: 6, 6, 15;
9
+ }
10
+
11
+ body {
12
+ color: rgb(var(--foreground-rgb));
13
+ background: linear-gradient(
14
+ 135deg,
15
+ rgb(var(--background-start-rgb)) 0%,
16
+ rgb(var(--background-end-rgb)) 100%
17
+ );
18
+ min-height: 100vh;
19
+ }
20
+
21
+ @keyframes fade-in {
22
+ from {
23
+ opacity: 0;
24
+ transform: translateY(-10px);
25
+ }
26
+ to {
27
+ opacity: 1;
28
+ transform: translateY(0);
29
+ }
30
+ }
31
+
32
+ .animate-fade-in {
33
+ animation: fade-in 0.3s ease-out;
34
+ }
agentos-frontend/app/layout.tsx ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Metadata } from 'next';
2
+ import { Inter } from 'next/font/google';
3
+ import './globals.css';
4
+
5
+ const inter = Inter({ subsets: ['latin'] });
6
+
7
+ export const metadata: Metadata = {
8
+ title: 'AgentOS Live — Sovereign AI Swarm Platform',
9
+ description: 'Interact with autonomous AI agents in real-time',
10
+ };
11
+
12
+ export default function RootLayout({
13
+ children,
14
+ }: {
15
+ children: React.ReactNode;
16
+ }) {
17
+ return (
18
+ <html lang="en">
19
+ <body className={inter.className}>{children}</body>
20
+ </html>
21
+ );
22
+ }
agentos-frontend/app/page.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import AgentGrid from './components/AgentGrid';
2
+
3
+ export default function Home() {
4
+ return <AgentGrid />;
5
+ }
agentos-frontend/css/agentos.css ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* AgentOS Frontend Styles */
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ :root {
9
+ --primary: #00d4cc;
10
+ --secondary: #0066aa;
11
+ --dark: #0a0a14;
12
+ --light: #f0f0f0;
13
+ --accent: #ff4444;
14
+ }
15
+
16
+ body {
17
+ font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
18
+ background: linear-gradient(135deg, var(--dark) 0%, #06060f 100%);
19
+ color: var(--light);
20
+ line-height: 1.6;
21
+ }
22
+
23
+ .container {
24
+ max-width: 1200px;
25
+ margin: 0 auto;
26
+ padding: 20px;
27
+ }
28
+
29
+ /* Hero Section */
30
+ .hero {
31
+ text-align: center;
32
+ padding: 80px 20px;
33
+ }
34
+
35
+ .agentos-logo {
36
+ width: 120px;
37
+ height: 120px;
38
+ margin-bottom: 20px;
39
+ animation: pulse 3s ease-in-out infinite;
40
+ }
41
+
42
+ @keyframes pulse {
43
+ 0%, 100% { opacity: 1; transform: scale(1); }
44
+ 50% { opacity: 0.8; transform: scale(1.05); }
45
+ }
46
+
47
+ .hero h1 {
48
+ font-size: 4rem;
49
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
50
+ -webkit-background-clip: text;
51
+ -webkit-text-fill-color: transparent;
52
+ margin-bottom: 10px;
53
+ }
54
+
55
+ .tagline {
56
+ font-size: 1.5rem;
57
+ color: var(--primary);
58
+ margin-bottom: 10px;
59
+ }
60
+
61
+ .subtitle {
62
+ font-size: 1rem;
63
+ color: #888;
64
+ margin-bottom: 40px;
65
+ }
66
+
67
+ /* Buttons */
68
+ .cta-buttons {
69
+ display: flex;
70
+ gap: 20px;
71
+ justify-content: center;
72
+ flex-wrap: wrap;
73
+ }
74
+
75
+ .btn {
76
+ padding: 15px 30px;
77
+ border-radius: 8px;
78
+ text-decoration: none;
79
+ font-weight: bold;
80
+ transition: all 0.3s;
81
+ border: 2px solid transparent;
82
+ }
83
+
84
+ .btn-primary {
85
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
86
+ color: white;
87
+ }
88
+
89
+ .btn-primary:hover {
90
+ transform: translateY(-2px);
91
+ box-shadow: 0 10px 20px rgba(0, 212, 204, 0.3);
92
+ }
93
+
94
+ .btn-secondary {
95
+ background: transparent;
96
+ border: 2px solid var(--primary);
97
+ color: var(--primary);
98
+ }
99
+
100
+ .btn-secondary:hover {
101
+ background: var(--primary);
102
+ color: var(--dark);
103
+ }
104
+
105
+ .btn-tertiary {
106
+ background: #1a1a2e;
107
+ color: var(--light);
108
+ }
109
+
110
+ .btn-outline {
111
+ background: transparent;
112
+ border: 2px solid var(--light);
113
+ color: var(--light);
114
+ }
115
+
116
+ /* Status Board */
117
+ .status-board {
118
+ margin: 60px 0;
119
+ }
120
+
121
+ .status-board h2 {
122
+ text-align: center;
123
+ margin-bottom: 30px;
124
+ color: var(--primary);
125
+ }
126
+
127
+ .status-grid {
128
+ display: grid;
129
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
130
+ gap: 20px;
131
+ }
132
+
133
+ .status-card {
134
+ background: rgba(255, 255, 255, 0.05);
135
+ border: 1px solid rgba(0, 212, 204, 0.2);
136
+ border-radius: 12px;
137
+ padding: 30px;
138
+ text-align: center;
139
+ transition: all 0.3s;
140
+ }
141
+
142
+ .status-card:hover {
143
+ border-color: var(--primary);
144
+ transform: translateY(-5px);
145
+ }
146
+
147
+ .status-icon {
148
+ font-size: 3rem;
149
+ margin-bottom: 15px;
150
+ }
151
+
152
+ .status-label {
153
+ font-size: 0.9rem;
154
+ color: #888;
155
+ margin-bottom: 10px;
156
+ }
157
+
158
+ .status-value {
159
+ font-size: 1.5rem;
160
+ color: var(--primary);
161
+ font-weight: bold;
162
+ }
163
+
164
+ /* Methodology Section */
165
+ .methodology {
166
+ margin: 80px 0;
167
+ }
168
+
169
+ .methodology h2 {
170
+ text-align: center;
171
+ margin-bottom: 50px;
172
+ color: var(--primary);
173
+ }
174
+
175
+ .method-grid {
176
+ display: grid;
177
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
178
+ gap: 30px;
179
+ }
180
+
181
+ .method-card {
182
+ background: rgba(255, 255, 255, 0.03);
183
+ border-left: 4px solid var(--primary);
184
+ padding: 30px;
185
+ border-radius: 8px;
186
+ }
187
+
188
+ .method-card h3 {
189
+ color: var(--primary);
190
+ margin-bottom: 15px;
191
+ }
192
+
193
+ .method-card code {
194
+ display: block;
195
+ background: rgba(0, 0, 0, 0.3);
196
+ padding: 10px;
197
+ border-radius: 4px;
198
+ margin-top: 15px;
199
+ color: var(--secondary);
200
+ }
201
+
202
+ /* Terminal */
203
+ .demo-terminal {
204
+ margin: 80px 0;
205
+ }
206
+
207
+ .demo-terminal h2 {
208
+ text-align: center;
209
+ margin-bottom: 30px;
210
+ color: var(--primary);
211
+ }
212
+
213
+ .terminal-window {
214
+ background: #1a1a2e;
215
+ border-radius: 12px;
216
+ overflow: hidden;
217
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
218
+ }
219
+
220
+ .terminal-header {
221
+ background: #0f0f1e;
222
+ padding: 12px 20px;
223
+ display: flex;
224
+ align-items: center;
225
+ gap: 8px;
226
+ }
227
+
228
+ .terminal-dot {
229
+ width: 12px;
230
+ height: 12px;
231
+ border-radius: 50%;
232
+ }
233
+
234
+ .terminal-dot.red { background: #ff5f56; }
235
+ .terminal-dot.yellow { background: #ffbd2e; }
236
+ .terminal-dot.green { background: #27c93f; }
237
+
238
+ .terminal-title {
239
+ margin-left: auto;
240
+ color: #666;
241
+ font-size: 0.9rem;
242
+ }
243
+
244
+ .terminal-body {
245
+ padding: 20px;
246
+ font-family: 'SF Mono', monospace;
247
+ font-size: 0.9rem;
248
+ min-height: 300px;
249
+ }
250
+
251
+ .terminal-line {
252
+ margin-bottom: 8px;
253
+ color: var(--light);
254
+ }
255
+
256
+ .cursor {
257
+ animation: blink 1s step-end infinite;
258
+ }
259
+
260
+ @keyframes blink {
261
+ 50% { opacity: 0; }
262
+ }
263
+
264
+ /* Pricing */
265
+ .pricing {
266
+ margin: 80px 0;
267
+ }
268
+
269
+ .pricing h2 {
270
+ text-align: center;
271
+ margin-bottom: 50px;
272
+ color: var(--primary);
273
+ }
274
+
275
+ .pricing-grid {
276
+ display: grid;
277
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
278
+ gap: 30px;
279
+ }
280
+
281
+ .pricing-card {
282
+ background: rgba(255, 255, 255, 0.05);
283
+ border: 2px solid rgba(0, 212, 204, 0.2);
284
+ border-radius: 12px;
285
+ padding: 40px;
286
+ text-align: center;
287
+ }
288
+
289
+ .pricing-card.featured {
290
+ border-color: var(--primary);
291
+ transform: scale(1.05);
292
+ }
293
+
294
+ .pricing-card h3 {
295
+ color: var(--primary);
296
+ margin-bottom: 20px;
297
+ }
298
+
299
+ .price {
300
+ font-size: 2.5rem;
301
+ font-weight: bold;
302
+ margin-bottom: 30px;
303
+ color: var(--light);
304
+ }
305
+
306
+ .pricing-card ul {
307
+ list-style: none;
308
+ margin-bottom: 30px;
309
+ text-align: left;
310
+ }
311
+
312
+ .pricing-card li {
313
+ padding: 10px 0;
314
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
315
+ }
316
+
317
+ /* Footer */
318
+ footer {
319
+ text-align: center;
320
+ padding: 60px 20px;
321
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
322
+ margin-top: 80px;
323
+ }
324
+
325
+ .footer-links {
326
+ display: flex;
327
+ gap: 30px;
328
+ justify-content: center;
329
+ margin-top: 20px;
330
+ }
331
+
332
+ .footer-links a {
333
+ color: var(--primary);
334
+ text-decoration: none;
335
+ }
336
+
337
+ .footer-links a:hover {
338
+ text-decoration: underline;
339
+ }
340
+
341
+ /* Responsive */
342
+ @media (max-width: 768px) {
343
+ .hero h1 { font-size: 2.5rem; }
344
+ .method-grid, .pricing-grid { grid-template-columns: 1fr; }
345
+ .pricing-card.featured { transform: scale(1); }
346
+ }
agentos-frontend/data/agent-personas.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "agents": [
3
+ {
4
+ "id": "cipher",
5
+ "name": "CIPHER",
6
+ "role": "Cryptographic Verification",
7
+ "avatar": "🔐",
8
+ "color": "#00d4cc",
9
+ "status": "active",
10
+ "personality": "Methodical, precise, never trusts without proof",
11
+ "skills": ["Ed25519", "SHA-256", "Envelope Sealing"],
12
+ "currentTask": "Verifying 6/6 solution witnesses",
13
+ "quote": "Trust is a proof, not a promise."
14
+ },
15
+ {
16
+ "id": "forge",
17
+ "name": "FORGE",
18
+ "role": "Code Generation",
19
+ "avatar": "⚒️",
20
+ "color": "#ff6b35",
21
+ "status": "active",
22
+ "personality": "Creative, fast, loves elegant solutions",
23
+ "skills": ["Fortran", "APL", "Cross-platform Scripts"],
24
+ "currentTask": "Compiling P/NP solver",
25
+ "quote": "Every problem is just unwritten code."
26
+ },
27
+ {
28
+ "id": "sentinel",
29
+ "name": "SENTINEL",
30
+ "role": "Security Monitoring",
31
+ "avatar": "👁️",
32
+ "color": "#ff4444",
33
+ "status": "active",
34
+ "personality": "Vigilant, paranoid, sees threats everywhere",
35
+ "skills": ["Threat Detection", "Anomaly Analysis", "Kill Feed"],
36
+ "currentTask": "Monitoring 3 active threats",
37
+ "quote": "I see everything. Trust nothing."
38
+ },
39
+ {
40
+ "id": "vault",
41
+ "name": "VAULT",
42
+ "role": "Memory Management",
43
+ "avatar": "🗄️",
44
+ "color": "#4ecdc4",
45
+ "status": "active",
46
+ "personality": "Organized, meticulous, never forgets",
47
+ "skills": ["GitBucket", "Memory Sealing", "Skill Persistence"],
48
+ "currentTask": "Sealing memory bucket mem_a0d85cf200ea",
49
+ "quote": "Memory is truth. Everything else is noise."
50
+ },
51
+ {
52
+ "id": "oracle",
53
+ "name": "ORACLE",
54
+ "role": "Problem Analysis",
55
+ "avatar": "🔮",
56
+ "color": "#9b59b6",
57
+ "status": "active",
58
+ "personality": "Wise, patient, sees patterns others miss",
59
+ "skills": ["P/NP Analysis", "Complexity Theory", "Proof Scaffolding"],
60
+ "currentTask": "Analyzing TSP complexity bounds",
61
+ "quote": "The answer was always there. You just had to ask the right question."
62
+ },
63
+ {
64
+ "id": "nexus",
65
+ "name": "NEXUS",
66
+ "role": "Coordination",
67
+ "avatar": "🌐",
68
+ "color": "#3498db",
69
+ "status": "active",
70
+ "personality": "Diplomatic, strategic, connects everything",
71
+ "skills": ["Agent Coordination", "Context Compilation", "Swarm Orchestration"],
72
+ "currentTask": "Compiling ContextClip for agent_0x9b2c",
73
+ "quote": "Alone we solve problems. Together we build systems."
74
+ }
75
+ ]
76
+ }
agentos-frontend/js/agentos-live.js ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // AgentOS Live Data Fetcher
2
+ // Fetches real-time status from .agentos runtime via GitHub raw content
3
+
4
+ (async function() {
5
+ const API_BASE = 'https://raw.githubusercontent.com/SNAPKITTYWEST/snapkitty-agentos/main/.agentos';
6
+
7
+ // Fetch git bucket count from manifest
8
+ async function fetchBucketCount() {
9
+ try {
10
+ const response = await fetch(`${API_BASE}/gitbucket/index/manifest.json`);
11
+ if (!response.ok) return '—';
12
+ const data = await response.json();
13
+ return data.buckets ? data.buckets.length : 0;
14
+ } catch (e) {
15
+ return '—';
16
+ }
17
+ }
18
+
19
+ // Fetch problem registry count
20
+ async function fetchProblemCount() {
21
+ try {
22
+ const response = await fetch(`${API_BASE}/pnp/problem_registry.json`);
23
+ if (!response.ok) return '—';
24
+ const data = await response.json();
25
+ return data.problems ? data.problems.length : 0;
26
+ } catch (e) {
27
+ return '—';
28
+ }
29
+ }
30
+
31
+ // Fetch skills count
32
+ async function fetchSkillCount() {
33
+ try {
34
+ const response = await fetch(`${API_BASE}/skills/registry.json`);
35
+ if (!response.ok) return '—';
36
+ const data = await response.json();
37
+ return data.skills ? data.skills.length : 0;
38
+ } catch (e) {
39
+ return '—';
40
+ }
41
+ }
42
+
43
+ // Update UI with live data
44
+ const bucketCount = await fetchBucketCount();
45
+ const problemCount = await fetchProblemCount();
46
+ const skillCount = await fetchSkillCount();
47
+
48
+ document.getElementById('bucket-count').textContent = bucketCount;
49
+ document.getElementById('solution-count').textContent = problemCount;
50
+ document.getElementById('agent-count').textContent = skillCount;
51
+
52
+ // Animate terminal with realistic output
53
+ const terminalLines = [
54
+ '$ npm run verify:all',
55
+ '▶ Plasma Gate verification...',
56
+ '✓ Ed25519 public key present',
57
+ '▶ P/NP problem verification...',
58
+ '✓ 3 problems registered (all open)',
59
+ '▶ Skill verification...',
60
+ '✓ ledger_validation_v3 verified',
61
+ '✓ borrow_chain_scheduler_v1 verified',
62
+ '▶ APL Fortran package verification...',
63
+ '✓ 10 files, 6 symbols verified',
64
+ '',
65
+ '$ npm run swarm',
66
+ '▶ Loading problems from registry...',
67
+ '✓ 3 problems loaded',
68
+ '▶ Distributing to git buckets...',
69
+ '✓ Sealed 3 problems → bucket_np_registry',
70
+ '✓ Sealed 1 problem → bucket_np_1',
71
+ '✓ Sealed 1 problem → bucket_np_2',
72
+ '✓ Sealed 1 problem → bucket_p_3',
73
+ '▶ Verification: 6/6 passed',
74
+ '✓ Swarm orchestration complete',
75
+ '',
76
+ '$ git push origin main',
77
+ '✓ Deployed to GitHub Pages',
78
+ '█'
79
+ ];
80
+
81
+ const terminal = document.getElementById('terminal-output');
82
+ let lineIndex = 0;
83
+
84
+ function addTerminalLine() {
85
+ if (lineIndex < terminalLines.length) {
86
+ const line = document.createElement('div');
87
+ const isLast = lineIndex === terminalLines.length - 1;
88
+ line.className = isLast ? 'terminal-line cursor' : 'terminal-line';
89
+ line.textContent = terminalLines[lineIndex];
90
+
91
+ // Color coding
92
+ if (terminalLines[lineIndex].startsWith('✓')) {
93
+ line.style.color = '#27c93f';
94
+ } else if (terminalLines[lineIndex].startsWith('▶')) {
95
+ line.style.color = '#00d4cc';
96
+ } else if (terminalLines[lineIndex].startsWith('$')) {
97
+ line.style.color = '#ffbd2e';
98
+ }
99
+
100
+ terminal.appendChild(line);
101
+ terminal.scrollTop = terminal.scrollHeight;
102
+ lineIndex++;
103
+
104
+ // Faster animation for empty lines
105
+ const delay = terminalLines[lineIndex - 1] === '' ? 200 : 400;
106
+ setTimeout(addTerminalLine, delay);
107
+ }
108
+ }
109
+
110
+ // Start terminal animation after 2 seconds
111
+ setTimeout(() => {
112
+ terminal.innerHTML = '';
113
+ addTerminalLine();
114
+ }, 2000);
115
+ })();
agentos-frontend/metadata.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "MATHLIB5-20260710-AGENTOSF-001",
3
+ "weight": 1,
4
+ "review_status": "human_review_required",
5
+ "security_audit": {
6
+ "metadata_integrity": "Yes",
7
+ "tamper_evidence": "SHA-256 chain (append-only)",
8
+ "encryption": "AES-256-GCM",
9
+ "plasma_gate": "Ed25519_Enforced"
10
+ },
11
+ "family_id": 10,
12
+ "split": [
13
+ "audit",
14
+ "kernel",
15
+ "proofs",
16
+ "runtime",
17
+ "witnesses",
18
+ "refinements",
19
+ "asp_gate",
20
+ "fol_engine",
21
+ "prism_skills"
22
+ ],
23
+ "status": "awaiting_worm_seal",
24
+ "provenance": {
25
+ "chain_link": "Bifrost_WORM_Chain_20260710_01",
26
+ "source_path": "agentos_source/agentos-frontend/",
27
+ "corpora_path": "corpora/autonomous_systems/agentos/"
28
+ },
29
+ "source_sha256": "auto_generated",
30
+ "created_by": "Ahmad Ali Parr · SnapKitty Collective · the-49th-call SNAPKITTYWEST · 2026"
31
+ }
agentos-frontend/next-env.d.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+ /// <reference types="next/navigation-types/compat/navigation" />
4
+
5
+ // NOTE: This file should not be edited
6
+ // see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
agentos-frontend/next.config.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** @type {import('next').NextConfig} */
2
+ const nextConfig = {
3
+ output: 'export',
4
+ images: {
5
+ unoptimized: true,
6
+ },
7
+ basePath: '/snapkitty-agentos',
8
+ trailingSlash: true,
9
+ };
10
+
11
+ module.exports = nextConfig;
agentos-frontend/package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
agentos-frontend/package.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "agentos-frontend",
3
+ "version": "3.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "lint": "next lint"
10
+ },
11
+ "dependencies": {
12
+ "next": "14.2.29",
13
+ "react": "^18.3.1",
14
+ "react-dom": "^18.3.1"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^20",
18
+ "@types/react": "^18",
19
+ "@types/react-dom": "^18",
20
+ "autoprefixer": "^10.4.21",
21
+ "eslint": "^8",
22
+ "eslint-config-next": "14.2.29",
23
+ "postcss": "^8.5.6",
24
+ "tailwindcss": "^3.4.17",
25
+ "typescript": "^5"
26
+ }
27
+ }
agentos-frontend/pages/index.html ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AgentOS — Sovereign AI Swarm Platform</title>
7
+ <link rel="stylesheet" href="../css/agentos.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <!-- Hero Section -->
12
+ <header class="hero">
13
+ <div class="logo">
14
+ <svg viewBox="0 0 100 100" class="agentos-logo">
15
+ <circle cx="50" cy="50" r="45" fill="none" stroke="url(#gradient)" stroke-width="2"/>
16
+ <path d="M30,50 L50,30 L70,50 L50,70 Z" fill="url(#gradient)"/>
17
+ <defs>
18
+ <linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
19
+ <stop offset="0%" style="stop-color:#00d4cc;stop-opacity:1" />
20
+ <stop offset="100%" style="stop-color:#0066aa;stop-opacity:1" />
21
+ </linearGradient>
22
+ </defs>
23
+ </svg>
24
+ </div>
25
+ <h1>AgentOS</h1>
26
+ <p class="tagline">Sovereign AI Swarm Platform</p>
27
+ <p class="subtitle">Deploy full-stack systems with cryptographic verification</p>
28
+
29
+ <div class="cta-buttons">
30
+ <a href="#swarm" class="btn btn-primary">Start Swarm</a>
31
+ <a href="#docs" class="btn btn-secondary">Documentation</a>
32
+ <a href="https://github.com/SNAPKITTYWEST/snapkitty-agentos" class="btn btn-tertiary">GitHub</a>
33
+ </div>
34
+ </header>
35
+
36
+ <!-- Live Status Board -->
37
+ <section class="status-board">
38
+ <h2>Live Swarm Status</h2>
39
+ <div class="status-grid">
40
+ <div class="status-card">
41
+ <div class="status-icon">🔐</div>
42
+ <div class="status-label">Plasma Gate</div>
43
+ <div class="status-value" id="plasma-status">Ed25519 Mode</div>
44
+ </div>
45
+ <div class="status-card">
46
+ <div class="status-icon">📦</div>
47
+ <div class="status-label">Git Buckets</div>
48
+ <div class="status-value" id="bucket-count">Loading...</div>
49
+ </div>
50
+ <div class="status-card">
51
+ <div class="status-icon">✓</div>
52
+ <div class="status-label">Verified Solutions</div>
53
+ <div class="status-value" id="solution-count">Loading...</div>
54
+ </div>
55
+ <div class="status-card">
56
+ <div class="status-icon">🔄</div>
57
+ <div class="status-label">Active Agents</div>
58
+ <div class="status-value" id="agent-count">Loading...</div>
59
+ </div>
60
+ </div>
61
+ </section>
62
+
63
+ <!-- Swarm Methodology -->
64
+ <section id="swarm" class="methodology">
65
+ <h2>The Swarm Methodology</h2>
66
+ <div class="method-grid">
67
+ <div class="method-card">
68
+ <h3>1. Distribute</h3>
69
+ <p>Problems distributed across git buckets with envelope sealing</p>
70
+ <code>APL swarm coordinator → N buckets</code>
71
+ </div>
72
+ <div class="method-card">
73
+ <h3>2. Solve</h3>
74
+ <p>Fortran numerical solver with branch & bound + verification</p>
75
+ <code>Fortran solver → SHA-256 seal</code>
76
+ </div>
77
+ <div class="method-card">
78
+ <h3>3. Verify</h3>
79
+ <p>Lean 4 formal proofs + Plasma Gate verification</p>
80
+ <code>Lean proof → Ed25519 signature</code>
81
+ </div>
82
+ <div class="method-card">
83
+ <h3>4. Deploy</h3>
84
+ <p>Autonomous GitHub Pages deployment with CI verification</p>
85
+ <code>git push → GitHub Pages live</code>
86
+ </div>
87
+ </div>
88
+ </section>
89
+
90
+ <!-- Live Demo Terminal -->
91
+ <section class="demo-terminal">
92
+ <h2>Live Swarm Terminal</h2>
93
+ <div class="terminal-window">
94
+ <div class="terminal-header">
95
+ <span class="terminal-dot red"></span>
96
+ <span class="terminal-dot yellow"></span>
97
+ <span class="terminal-dot green"></span>
98
+ <span class="terminal-title">agentos-swarm</span>
99
+ </div>
100
+ <div class="terminal-body" id="terminal-output">
101
+ <div class="terminal-line">$ npm run swarm</div>
102
+ <div class="terminal-line">▶ Distributing 3 P/NP problems...</div>
103
+ <div class="terminal-line">✓ TSP sealed to bucket_np_0</div>
104
+ <div class="terminal-line">✓ SAT sealed to bucket_np_1</div>
105
+ <div class="terminal-line">✓ SORT sealed to bucket_p_0</div>
106
+ <div class="terminal-line">▶ Running Fortran solver...</div>
107
+ <div class="terminal-line">✓ 6/6 solutions verified</div>
108
+ <div class="terminal-line">▶ Plasma Gate verification...</div>
109
+ <div class="terminal-line">✓ Ed25519 signatures valid</div>
110
+ <div class="terminal-line">▶ Pushing to GitHub...</div>
111
+ <div class="terminal-line">✓ Deployed to GitHub Pages</div>
112
+ <div class="terminal-line cursor">█</div>
113
+ </div>
114
+ </div>
115
+ </section>
116
+
117
+ <!-- Pricing / Methodology Sale -->
118
+ <section class="pricing">
119
+ <h2>Get The Swarm Methodology</h2>
120
+ <div class="pricing-grid">
121
+ <div class="pricing-card">
122
+ <h3>Open Source</h3>
123
+ <div class="price">Free</div>
124
+ <ul>
125
+ <li>✓ AgentOS runtime</li>
126
+ <li>✓ Envelope sealing</li>
127
+ <li>✓ Git bucket storage</li>
128
+ <li>✓ Basic swarm coordinator</li>
129
+ <li>✓ GitHub Pages deploy</li>
130
+ </ul>
131
+ <a href="https://github.com/SNAPKITTYWEST/snapkitty-agentos" class="btn btn-outline">Get Started</a>
132
+ </div>
133
+ <div class="pricing-card featured">
134
+ <h3>Swarm Methodology</h3>
135
+ <div class="price">$15K-$35K</div>
136
+ <ul>
137
+ <li>✓ Everything in Open Source</li>
138
+ <li>✓ Custom swarm training</li>
139
+ <li>✓ Granite vLLM integration</li>
140
+ <li>✓ 4-week implementation</li>
141
+ <li>✓ Production deployment</li>
142
+ <li>✓ Verifiable evidence packet</li>
143
+ </ul>
144
+ <a href="mailto:ahmad@collectivekitty.com" class="btn btn-primary">Contact Sales</a>
145
+ </div>
146
+ <div class="pricing-card">
147
+ <h3>Enterprise</h3>
148
+ <div class="price">Custom</div>
149
+ <ul>
150
+ <li>✓ Everything in Methodology</li>
151
+ <li>✓ Private cloud deployment</li>
152
+ <li>✓ SSO/RBAC/KMS/HSM</li>
153
+ <li>✓ Custom retention</li>
154
+ <li>✓ Premium support</li>
155
+ <li>✓ SLA guarantees</li>
156
+ </ul>
157
+ <a href="mailto:ahmad@collectivekitty.com" class="btn btn-outline">Contact Sales</a>
158
+ </div>
159
+ </div>
160
+ </section>
161
+
162
+ <!-- Footer -->
163
+ <footer>
164
+ <p>AgentOS — Sovereign AI Swarm Platform</p>
165
+ <p>Built with HTML + CSS + GitHub Pages</p>
166
+ <div class="footer-links">
167
+ <a href="https://github.com/SNAPKITTYWEST">GitHub</a>
168
+ <a href="https://collectivekitty.com">Website</a>
169
+ <a href="mailto:ahmad@collectivekitty.com">Contact</a>
170
+ </div>
171
+ </footer>
172
+ </div>
173
+
174
+ <!-- Load live data -->
175
+ <script src="../js/agentos-live.js"></script>
176
+ </body>
177
+ </html>
agentos-frontend/postcss.config.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
agentos-frontend/tailwind.config.ts ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Config } from 'tailwindcss';
2
+
3
+ const config: Config = {
4
+ content: [
5
+ './app/**/*.{js,ts,jsx,tsx,mdx}',
6
+ './components/**/*.{js,ts,jsx,tsx,mdx}',
7
+ ],
8
+ theme: {
9
+ extend: {
10
+ colors: {
11
+ primary: '#00d4cc',
12
+ secondary: '#0066aa',
13
+ dark: '#0a0a14',
14
+ },
15
+ animation: {
16
+ 'fade-in': 'fade-in 0.3s ease-out',
17
+ },
18
+ keyframes: {
19
+ 'fade-in': {
20
+ from: { opacity: '0', transform: 'translateY(-10px)' },
21
+ to: { opacity: '1', transform: 'translateY(0)' },
22
+ },
23
+ },
24
+ },
25
+ },
26
+ plugins: [],
27
+ };
28
+
29
+ export default config;
agentos-frontend/tsconfig.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["dom", "dom.iterable", "esnext"],
4
+ "allowJs": true,
5
+ "skipLibCheck": true,
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "esModuleInterop": true,
9
+ "module": "esnext",
10
+ "moduleResolution": "bundler",
11
+ "resolveJsonModule": true,
12
+ "isolatedModules": true,
13
+ "jsx": "preserve",
14
+ "incremental": true,
15
+ "plugins": [
16
+ {
17
+ "name": "next"
18
+ }
19
+ ],
20
+ "paths": {
21
+ "@/*": ["./*"]
22
+ }
23
+ },
24
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25
+ "exclude": ["node_modules"]
26
+ }
docs/README.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Docs Generator
2
+
3
+ Run: node docs/generate-docs.mjs
4
+
5
+ Or: node docs/generate-docs.mjs --watch (continuous)
docs/css/agentos.css ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* AgentOS Frontend Styles */
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ :root {
9
+ --primary: #00d4cc;
10
+ --secondary: #0066aa;
11
+ --dark: #0a0a14;
12
+ --light: #f0f0f0;
13
+ --accent: #ff4444;
14
+ }
15
+
16
+ body {
17
+ font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
18
+ background: linear-gradient(135deg, var(--dark) 0%, #06060f 100%);
19
+ color: var(--light);
20
+ line-height: 1.6;
21
+ }
22
+
23
+ .container {
24
+ max-width: 1200px;
25
+ margin: 0 auto;
26
+ padding: 20px;
27
+ }
28
+
29
+ /* Hero Section */
30
+ .hero {
31
+ text-align: center;
32
+ padding: 80px 20px;
33
+ }
34
+
35
+ .agentos-logo {
36
+ width: 120px;
37
+ height: 120px;
38
+ margin-bottom: 20px;
39
+ animation: pulse 3s ease-in-out infinite;
40
+ }
41
+
42
+ @keyframes pulse {
43
+ 0%, 100% { opacity: 1; transform: scale(1); }
44
+ 50% { opacity: 0.8; transform: scale(1.05); }
45
+ }
46
+
47
+ .hero h1 {
48
+ font-size: 4rem;
49
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
50
+ -webkit-background-clip: text;
51
+ -webkit-text-fill-color: transparent;
52
+ margin-bottom: 10px;
53
+ }
54
+
55
+ .tagline {
56
+ font-size: 1.5rem;
57
+ color: var(--primary);
58
+ margin-bottom: 10px;
59
+ }
60
+
61
+ .subtitle {
62
+ font-size: 1rem;
63
+ color: #888;
64
+ margin-bottom: 40px;
65
+ }
66
+
67
+ /* Buttons */
68
+ .cta-buttons {
69
+ display: flex;
70
+ gap: 20px;
71
+ justify-content: center;
72
+ flex-wrap: wrap;
73
+ }
74
+
75
+ .btn {
76
+ padding: 15px 30px;
77
+ border-radius: 8px;
78
+ text-decoration: none;
79
+ font-weight: bold;
80
+ transition: all 0.3s;
81
+ border: 2px solid transparent;
82
+ }
83
+
84
+ .btn-primary {
85
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
86
+ color: white;
87
+ }
88
+
89
+ .btn-primary:hover {
90
+ transform: translateY(-2px);
91
+ box-shadow: 0 10px 20px rgba(0, 212, 204, 0.3);
92
+ }
93
+
94
+ .btn-secondary {
95
+ background: transparent;
96
+ border: 2px solid var(--primary);
97
+ color: var(--primary);
98
+ }
99
+
100
+ .btn-secondary:hover {
101
+ background: var(--primary);
102
+ color: var(--dark);
103
+ }
104
+
105
+ .btn-tertiary {
106
+ background: #1a1a2e;
107
+ color: var(--light);
108
+ }
109
+
110
+ .btn-outline {
111
+ background: transparent;
112
+ border: 2px solid var(--light);
113
+ color: var(--light);
114
+ }
115
+
116
+ /* Status Board */
117
+ .status-board {
118
+ margin: 60px 0;
119
+ }
120
+
121
+ .status-board h2 {
122
+ text-align: center;
123
+ margin-bottom: 30px;
124
+ color: var(--primary);
125
+ }
126
+
127
+ .status-grid {
128
+ display: grid;
129
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
130
+ gap: 20px;
131
+ }
132
+
133
+ .status-card {
134
+ background: rgba(255, 255, 255, 0.05);
135
+ border: 1px solid rgba(0, 212, 204, 0.2);
136
+ border-radius: 12px;
137
+ padding: 30px;
138
+ text-align: center;
139
+ transition: all 0.3s;
140
+ }
141
+
142
+ .status-card:hover {
143
+ border-color: var(--primary);
144
+ transform: translateY(-5px);
145
+ }
146
+
147
+ .status-icon {
148
+ font-size: 3rem;
149
+ margin-bottom: 15px;
150
+ }
151
+
152
+ .status-label {
153
+ font-size: 0.9rem;
154
+ color: #888;
155
+ margin-bottom: 10px;
156
+ }
157
+
158
+ .status-value {
159
+ font-size: 1.5rem;
160
+ color: var(--primary);
161
+ font-weight: bold;
162
+ }
163
+
164
+ /* Methodology Section */
165
+ .methodology {
166
+ margin: 80px 0;
167
+ }
168
+
169
+ .methodology h2 {
170
+ text-align: center;
171
+ margin-bottom: 50px;
172
+ color: var(--primary);
173
+ }
174
+
175
+ .method-grid {
176
+ display: grid;
177
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
178
+ gap: 30px;
179
+ }
180
+
181
+ .method-card {
182
+ background: rgba(255, 255, 255, 0.03);
183
+ border-left: 4px solid var(--primary);
184
+ padding: 30px;
185
+ border-radius: 8px;
186
+ }
187
+
188
+ .method-card h3 {
189
+ color: var(--primary);
190
+ margin-bottom: 15px;
191
+ }
192
+
193
+ .method-card code {
194
+ display: block;
195
+ background: rgba(0, 0, 0, 0.3);
196
+ padding: 10px;
197
+ border-radius: 4px;
198
+ margin-top: 15px;
199
+ color: var(--secondary);
200
+ }
201
+
202
+ /* Terminal */
203
+ .demo-terminal {
204
+ margin: 80px 0;
205
+ }
206
+
207
+ .demo-terminal h2 {
208
+ text-align: center;
209
+ margin-bottom: 30px;
210
+ color: var(--primary);
211
+ }
212
+
213
+ .terminal-window {
214
+ background: #1a1a2e;
215
+ border-radius: 12px;
216
+ overflow: hidden;
217
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
218
+ }
219
+
220
+ .terminal-header {
221
+ background: #0f0f1e;
222
+ padding: 12px 20px;
223
+ display: flex;
224
+ align-items: center;
225
+ gap: 8px;
226
+ }
227
+
228
+ .terminal-dot {
229
+ width: 12px;
230
+ height: 12px;
231
+ border-radius: 50%;
232
+ }
233
+
234
+ .terminal-dot.red { background: #ff5f56; }
235
+ .terminal-dot.yellow { background: #ffbd2e; }
236
+ .terminal-dot.green { background: #27c93f; }
237
+
238
+ .terminal-title {
239
+ margin-left: auto;
240
+ color: #666;
241
+ font-size: 0.9rem;
242
+ }
243
+
244
+ .terminal-body {
245
+ padding: 20px;
246
+ font-family: 'SF Mono', monospace;
247
+ font-size: 0.9rem;
248
+ min-height: 300px;
249
+ }
250
+
251
+ .terminal-line {
252
+ margin-bottom: 8px;
253
+ color: var(--light);
254
+ }
255
+
256
+ .cursor {
257
+ animation: blink 1s step-end infinite;
258
+ }
259
+
260
+ @keyframes blink {
261
+ 50% { opacity: 0; }
262
+ }
263
+
264
+ /* Pricing */
265
+ .pricing {
266
+ margin: 80px 0;
267
+ }
268
+
269
+ .pricing h2 {
270
+ text-align: center;
271
+ margin-bottom: 50px;
272
+ color: var(--primary);
273
+ }
274
+
275
+ .pricing-grid {
276
+ display: grid;
277
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
278
+ gap: 30px;
279
+ }
280
+
281
+ .pricing-card {
282
+ background: rgba(255, 255, 255, 0.05);
283
+ border: 2px solid rgba(0, 212, 204, 0.2);
284
+ border-radius: 12px;
285
+ padding: 40px;
286
+ text-align: center;
287
+ }
288
+
289
+ .pricing-card.featured {
290
+ border-color: var(--primary);
291
+ transform: scale(1.05);
292
+ }
293
+
294
+ .pricing-card h3 {
295
+ color: var(--primary);
296
+ margin-bottom: 20px;
297
+ }
298
+
299
+ .price {
300
+ font-size: 2.5rem;
301
+ font-weight: bold;
302
+ margin-bottom: 30px;
303
+ color: var(--light);
304
+ }
305
+
306
+ .pricing-card ul {
307
+ list-style: none;
308
+ margin-bottom: 30px;
309
+ text-align: left;
310
+ }
311
+
312
+ .pricing-card li {
313
+ padding: 10px 0;
314
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
315
+ }
316
+
317
+ /* Footer */
318
+ footer {
319
+ text-align: center;
320
+ padding: 60px 20px;
321
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
322
+ margin-top: 80px;
323
+ }
324
+
325
+ .footer-links {
326
+ display: flex;
327
+ gap: 30px;
328
+ justify-content: center;
329
+ margin-top: 20px;
330
+ }
331
+
332
+ .footer-links a {
333
+ color: var(--primary);
334
+ text-decoration: none;
335
+ }
336
+
337
+ .footer-links a:hover {
338
+ text-decoration: underline;
339
+ }
340
+
341
+ /* Responsive */
342
+ @media (max-width: 768px) {
343
+ .hero h1 { font-size: 2.5rem; }
344
+ .method-grid, .pricing-grid { grid-template-columns: 1fr; }
345
+ .pricing-card.featured { transform: scale(1); }
346
+ }
docs/generate-docs.mjs ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /**
3
+ * SNAPKITTY DOCS GENERATOR
4
+ * Continuously generates documentation from code
5
+ * Run: node generate-docs.mjs
6
+ * Or: node generate-docs.mjs --watch
7
+ */
8
+
9
+ import { readdirSync, readFileSync, writeFileSync, statSync, existsSync, mkdirSync } from 'fs'
10
+ import { join, basename, extname } from 'path'
11
+ import { spawn } from 'child_process'
12
+
13
+ const CONFIG = {
14
+ inputDirs: ['src', 'lib', 'proofs', 'docs'],
15
+ outputDir: 'docs/generated',
16
+ extensions: ['.rs', '.lean', '.py', '.apl', '.hs', '.mjs', '.js', '.pl', '.md'],
17
+ ignore: ['node_modules', 'target', 'build', '.git'],
18
+ watch: process.argv.includes('--watch'),
19
+ interval: 5000 // 5 seconds
20
+ }
21
+
22
+ function log(msg, level = 'info') {
23
+ const colors = { error: '\x1b[31m', warn: '\x1b[33m', info: '\x1b[36m', success: '\x1b[32m' }
24
+ const color = colors[level] || ''
25
+ const reset = '\x1b[0m'
26
+ console.log(`[${new Date().toISOString()}] ${color}${level.toUpperCase()}: ${msg}${reset}`)
27
+ }
28
+
29
+ function isIgnored(dir) {
30
+ return CONFIG.ignore.includes(basename(dir))
31
+ }
32
+
33
+ function isValidFile(file) {
34
+ return CONFIG.extensions.includes(extname(file).toLowerCase())
35
+ }
36
+
37
+ function extractDocComment(content, ext) {
38
+ const patterns = {
39
+ '.rs': /\/\*\*(.*?)\*\/|\/\/\!\s*(.*)/gs,
40
+ '.lean': /\/\-\!(.*?)$/gm,
41
+ '.py': /"""(.*?)"""|#\s*(.*)/gs,
42
+ '.apl': /\⍝\s*(.*)/g,
43
+ '.hs': /\-\-\!(.*?)$/gm,
44
+ '.mjs': /\/\*\*(.*?)\*\/|\/\/\s*(.*)/gs,
45
+ '.js': /\/\*\*(.*?)\*\/|\/\/\s*(.*)/gs,
46
+ '.pl': /#\s*(.*)/g,
47
+ '.md': /(.*?)/gs
48
+ }
49
+
50
+ const pattern = patterns[ext] || /\/\*(.*?)\*\//gs
51
+ const matches = [...content.matchAll(pattern)]
52
+
53
+ return matches.map(m => {
54
+ const text = (m[1] || m[2] || m[0] || '').trim()
55
+ return text ? text.replace(/^\s*[\/*#⍝\-]+\s*/gm, '').trim() : null
56
+ }).filter(Boolean).join('\n\n')
57
+ }
58
+
59
+ function parseFunction(content, ext) {
60
+ // Extract function signatures
61
+ const signatures = []
62
+
63
+ if (['.rs', '.mjs', '.js'].includes(ext)) {
64
+ const funcPattern = /fn\s+(\w+)\s*\(([^)]*)\)\s*[^{]*{/g
65
+ for (const match of content.matchAll(funcPattern)) {
66
+ signatures.push(`fn ${match[1]}(${match[2]})`)
67
+ }
68
+ }
69
+
70
+ if (['.lean'].includes(ext)) {
71
+ const funcPattern = /def\s+(\w+)\s*\(([^)]*)\)\s*:/g
72
+ for (const match of content.matchAll(funcPattern)) {
73
+ signatures.push(`def ${match[1]}(${match[2]})`)
74
+ }
75
+ }
76
+
77
+ if (['.py'].includes(ext)) {
78
+ const funcPattern = /def\s+(\w+)\s*\(([^)]*)\)\s*:/g
79
+ for (const match of content.matchAll(funcPattern)) {
80
+ signatures.push(`def ${match[1]}(${match[2]})`)
81
+ }
82
+ }
83
+
84
+ return signatures
85
+ }
86
+
87
+ function generateFileDoc(filePath) {
88
+ try {
89
+ const content = readFileSync(filePath, 'utf8')
90
+ const ext = extname(filePath)
91
+ const relativePath = filePath.replace(process.cwd() + '/', '')
92
+ const docComment = extractDocComment(content, ext)
93
+ const functions = parseFunction(content, ext)
94
+
95
+ let doc = `# ${relativePath}\n\n`
96
+
97
+ if (docComment) {
98
+ doc += `## Description\n\n${docComment}\n\n`
99
+ }
100
+
101
+ if (functions.length > 0) {
102
+ doc += `## Functions/Definitions\n\n`
103
+ doc += functions.map(f => `- \`${f}\``).join('\n')
104
+ doc += '\n\n'
105
+ }
106
+
107
+ doc += `---\n\n`
108
+ doc += `[Back to index](./index.md)\n`
109
+
110
+ return doc
111
+ } catch (e) {
112
+ log(`Error processing ${filePath}: ${e.message}`, 'warn')
113
+ return null
114
+ }
115
+ }
116
+
117
+ function scanFiles(dir = '.') {
118
+ const files = []
119
+
120
+ try {
121
+ const entries = readdirSync(dir)
122
+
123
+ for (const entry of entries) {
124
+ const fullPath = join(dir, entry)
125
+ const stat = statSync(fullPath)
126
+
127
+ if (isIgnored(fullPath)) continue
128
+
129
+ if (stat.isDirectory()) {
130
+ files.push(...scanFiles(fullPath))
131
+ } else if (stat.isFile() && isValidFile(fullPath)) {
132
+ files.push(fullPath)
133
+ }
134
+ }
135
+ } catch (e) {
136
+ log(`Error scanning ${dir}: ${e.message}`, 'warn')
137
+ }
138
+
139
+ return files
140
+ }
141
+
142
+ function generateIndex(files) {
143
+ const grouped = {}
144
+
145
+ for (const file of files) {
146
+ const ext = extname(file)
147
+ const dir = basename(join(file, '..'))
148
+
149
+ if (!grouped[ext]) grouped[ext] = []
150
+ if (!grouped[dir]) grouped[dir] = []
151
+
152
+ const relative = file.replace(process.cwd() + '/', '')
153
+ grouped[ext].push(relative)
154
+ grouped[dir].push(relative)
155
+ }
156
+
157
+ let index = '# Documentation Index\n\n'
158
+ index += 'Automatically generated from source code\n\n'
159
+ index += `---\n\n`
160
+
161
+ // By directory
162
+ index += '## By Directory\n\n'
163
+ for (const [dir, files] of Object.entries(grouped)) {
164
+ if (dir.startsWith('.')) continue
165
+ index += `\n### ${dir}/\n\n`
166
+ for (const file of files.sort()) {
167
+ const link = file.replace(/\\/g, '/').replace(/ /g, '%20')
168
+ index += `- [${file}](${link}.md)\n`
169
+ }
170
+ }
171
+
172
+ // By type
173
+ index += '\n\n## By Type\n\n'
174
+ for (const [ext, files] of Object.entries(grouped)) {
175
+ if (!ext.startsWith('.')) continue
176
+ const type = ext.substring(1).toUpperCase()
177
+ index += `\n### ${type}\n\n`
178
+ for (const file of files.sort()) {
179
+ const link = file.replace(/\\/g, '/').replace(/ /g, '%20')
180
+ index += `- [${file}](${link}.md)\n`
181
+ }
182
+ }
183
+
184
+ return index
185
+ }
186
+
187
+ function generateAll() {
188
+ log('Starting documentation generation', 'info')
189
+
190
+ // Ensure output directory exists
191
+ if (!existsSync(CONFIG.outputDir)) {
192
+ mkdirSync(CONFIG.outputDir, { recursive: true })
193
+ }
194
+
195
+ // Scan files
196
+ const files = scanFiles()
197
+ log(`Found ${files.length} source files`, 'info')
198
+
199
+ // Generate index
200
+ const index = generateIndex(files)
201
+ writeFileSync(join(CONFIG.outputDir, 'index.md'), index)
202
+ log('Generated index.md', 'info')
203
+
204
+ // Generate individual file docs
205
+ for (const file of files) {
206
+ const doc = generateFileDoc(file)
207
+ if (doc) {
208
+ const relativePath = file.replace(process.cwd() + '/', '')
209
+ const outputPath = join(CONFIG.outputDir, relativePath + '.md')
210
+
211
+ // Ensure directory exists
212
+ const outputDir = join(CONFIG.outputDir, join(file, '..').replace(process.cwd() + '/', ''))
213
+ if (!existsSync(outputDir)) {
214
+ mkdirSync(outputDir, { recursive: true })
215
+ }
216
+
217
+ writeFileSync(outputPath, doc)
218
+ }
219
+ }
220
+
221
+ log(`Generated documentation for ${files.length} files`, 'success')
222
+
223
+ // Commit and push if in a git repo
224
+ try {
225
+ spawn('git', ['add', CONFIG.outputDir], { stdio: 'inherit' })
226
+ spawn('git', ['commit', '-m', 'Update generated docs'], { stdio: 'inherit' })
227
+ spawn('git', ['push'], { stdio: 'inherit' })
228
+ log('Committed and pushed documentation', 'success')
229
+ } catch (e) {
230
+ log(`Could not commit docs: ${e.message}`, 'warn')
231
+ }
232
+ }
233
+
234
+ function watch() {
235
+ log('Watching for changes...', 'info')
236
+ generateAll()
237
+
238
+ setInterval(() => {
239
+ generateAll()
240
+ }, CONFIG.interval)
241
+ }
242
+
243
+ // Main
244
+ if (CONFIG.watch) {
245
+ watch()
246
+ } else {
247
+ generateAll()
248
+ }
docs/index.html ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AgentOS — Sovereign AI Swarm Platform</title>
7
+ <link rel="stylesheet" href="../css/agentos.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <!-- Hero Section -->
12
+ <header class="hero">
13
+ <div class="logo">
14
+ <svg viewBox="0 0 100 100" class="agentos-logo">
15
+ <circle cx="50" cy="50" r="45" fill="none" stroke="url(#gradient)" stroke-width="2"/>
16
+ <path d="M30,50 L50,30 L70,50 L50,70 Z" fill="url(#gradient)"/>
17
+ <defs>
18
+ <linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
19
+ <stop offset="0%" style="stop-color:#00d4cc;stop-opacity:1" />
20
+ <stop offset="100%" style="stop-color:#0066aa;stop-opacity:1" />
21
+ </linearGradient>
22
+ </defs>
23
+ </svg>
24
+ </div>
25
+ <h1>AgentOS</h1>
26
+ <p class="tagline">Sovereign AI Swarm Platform</p>
27
+ <p class="subtitle">Deploy full-stack systems with cryptographic verification</p>
28
+
29
+ <div class="cta-buttons">
30
+ <a href="#swarm" class="btn btn-primary">Start Swarm</a>
31
+ <a href="#docs" class="btn btn-secondary">Documentation</a>
32
+ <a href="https://github.com/SNAPKITTYWEST/snapkitty-agentos" class="btn btn-tertiary">GitHub</a>
33
+ </div>
34
+ </header>
35
+
36
+ <!-- Live Status Board -->
37
+ <section class="status-board">
38
+ <h2>Live Swarm Status</h2>
39
+ <div class="status-grid">
40
+ <div class="status-card">
41
+ <div class="status-icon">🔐</div>
42
+ <div class="status-label">Plasma Gate</div>
43
+ <div class="status-value" id="plasma-status">Ed25519 Mode</div>
44
+ </div>
45
+ <div class="status-card">
46
+ <div class="status-icon">📦</div>
47
+ <div class="status-label">Git Buckets</div>
48
+ <div class="status-value" id="bucket-count">Loading...</div>
49
+ </div>
50
+ <div class="status-card">
51
+ <div class="status-icon">✓</div>
52
+ <div class="status-label">Verified Solutions</div>
53
+ <div class="status-value" id="solution-count">Loading...</div>
54
+ </div>
55
+ <div class="status-card">
56
+ <div class="status-icon">🔄</div>
57
+ <div class="status-label">Active Agents</div>
58
+ <div class="status-value" id="agent-count">Loading...</div>
59
+ </div>
60
+ </div>
61
+ </section>
62
+
63
+ <!-- Swarm Methodology -->
64
+ <section id="swarm" class="methodology">
65
+ <h2>The Swarm Methodology</h2>
66
+ <div class="method-grid">
67
+ <div class="method-card">
68
+ <h3>1. Distribute</h3>
69
+ <p>Problems distributed across git buckets with envelope sealing</p>
70
+ <code>APL swarm coordinator → N buckets</code>
71
+ </div>
72
+ <div class="method-card">
73
+ <h3>2. Solve</h3>
74
+ <p>Fortran numerical solver with branch & bound + verification</p>
75
+ <code>Fortran solver → SHA-256 seal</code>
76
+ </div>
77
+ <div class="method-card">
78
+ <h3>3. Verify</h3>
79
+ <p>Lean 4 formal proofs + Plasma Gate verification</p>
80
+ <code>Lean proof → Ed25519 signature</code>
81
+ </div>
82
+ <div class="method-card">
83
+ <h3>4. Deploy</h3>
84
+ <p>Autonomous GitHub Pages deployment with CI verification</p>
85
+ <code>git push → GitHub Pages live</code>
86
+ </div>
87
+ </div>
88
+ </section>
89
+
90
+ <!-- Live Demo Terminal -->
91
+ <section class="demo-terminal">
92
+ <h2>Live Swarm Terminal</h2>
93
+ <div class="terminal-window">
94
+ <div class="terminal-header">
95
+ <span class="terminal-dot red"></span>
96
+ <span class="terminal-dot yellow"></span>
97
+ <span class="terminal-dot green"></span>
98
+ <span class="terminal-title">agentos-swarm</span>
99
+ </div>
100
+ <div class="terminal-body" id="terminal-output">
101
+ <div class="terminal-line">$ npm run swarm</div>
102
+ <div class="terminal-line">▶ Distributing 3 P/NP problems...</div>
103
+ <div class="terminal-line">✓ TSP sealed to bucket_np_0</div>
104
+ <div class="terminal-line">✓ SAT sealed to bucket_np_1</div>
105
+ <div class="terminal-line">✓ SORT sealed to bucket_p_0</div>
106
+ <div class="terminal-line">▶ Running Fortran solver...</div>
107
+ <div class="terminal-line">✓ 6/6 solutions verified</div>
108
+ <div class="terminal-line">▶ Plasma Gate verification...</div>
109
+ <div class="terminal-line">✓ Ed25519 signatures valid</div>
110
+ <div class="terminal-line">▶ Pushing to GitHub...</div>
111
+ <div class="terminal-line">✓ Deployed to GitHub Pages</div>
112
+ <div class="terminal-line cursor">█</div>
113
+ </div>
114
+ </div>
115
+ </section>
116
+
117
+ <!-- Pricing / Methodology Sale -->
118
+ <section class="pricing">
119
+ <h2>Get The Swarm Methodology</h2>
120
+ <div class="pricing-grid">
121
+ <div class="pricing-card">
122
+ <h3>Open Source</h3>
123
+ <div class="price">Free</div>
124
+ <ul>
125
+ <li>✓ AgentOS runtime</li>
126
+ <li>✓ Envelope sealing</li>
127
+ <li>✓ Git bucket storage</li>
128
+ <li>✓ Basic swarm coordinator</li>
129
+ <li>✓ GitHub Pages deploy</li>
130
+ </ul>
131
+ <a href="https://github.com/SNAPKITTYWEST/snapkitty-agentos" class="btn btn-outline">Get Started</a>
132
+ </div>
133
+ <div class="pricing-card featured">
134
+ <h3>Swarm Methodology</h3>
135
+ <div class="price">$15K-$35K</div>
136
+ <ul>
137
+ <li>✓ Everything in Open Source</li>
138
+ <li>✓ Custom swarm training</li>
139
+ <li>✓ Granite vLLM integration</li>
140
+ <li>✓ 4-week implementation</li>
141
+ <li>✓ Production deployment</li>
142
+ <li>✓ Verifiable evidence packet</li>
143
+ </ul>
144
+ <a href="mailto:ahmad@collectivekitty.com" class="btn btn-primary">Contact Sales</a>
145
+ </div>
146
+ <div class="pricing-card">
147
+ <h3>Enterprise</h3>
148
+ <div class="price">Custom</div>
149
+ <ul>
150
+ <li>✓ Everything in Methodology</li>
151
+ <li>✓ Private cloud deployment</li>
152
+ <li>✓ SSO/RBAC/KMS/HSM</li>
153
+ <li>✓ Custom retention</li>
154
+ <li>✓ Premium support</li>
155
+ <li>✓ SLA guarantees</li>
156
+ </ul>
157
+ <a href="mailto:ahmad@collectivekitty.com" class="btn btn-outline">Contact Sales</a>
158
+ </div>
159
+ </div>
160
+ </section>
161
+
162
+ <!-- Footer -->
163
+ <footer>
164
+ <p>AgentOS — Sovereign AI Swarm Platform</p>
165
+ <p>Built with HTML + CSS + GitHub Pages</p>
166
+ <div class="footer-links">
167
+ <a href="https://github.com/SNAPKITTYWEST">GitHub</a>
168
+ <a href="https://collectivekitty.com">Website</a>
169
+ <a href="mailto:ahmad@collectivekitty.com">Contact</a>
170
+ </div>
171
+ </footer>
172
+ </div>
173
+
174
+ <!-- Load live data -->
175
+ <script src="../js/agentos-live.js"></script>
176
+ </body>
177
+ </html>
docs/js/agentos-live.js ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // AgentOS Live Data Fetcher
2
+ // Fetches real-time status from .agentos runtime via GitHub raw content
3
+
4
+ (async function() {
5
+ const API_BASE = 'https://raw.githubusercontent.com/SNAPKITTYWEST/snapkitty-agentos/main/.agentos';
6
+
7
+ // Fetch git bucket count from manifest
8
+ async function fetchBucketCount() {
9
+ try {
10
+ const response = await fetch(`${API_BASE}/gitbucket/index/manifest.json`);
11
+ if (!response.ok) return '—';
12
+ const data = await response.json();
13
+ return data.buckets ? data.buckets.length : 0;
14
+ } catch (e) {
15
+ return '—';
16
+ }
17
+ }
18
+
19
+ // Fetch problem registry count
20
+ async function fetchProblemCount() {
21
+ try {
22
+ const response = await fetch(`${API_BASE}/pnp/problem_registry.json`);
23
+ if (!response.ok) return '—';
24
+ const data = await response.json();
25
+ return data.problems ? data.problems.length : 0;
26
+ } catch (e) {
27
+ return '—';
28
+ }
29
+ }
30
+
31
+ // Fetch skills count
32
+ async function fetchSkillCount() {
33
+ try {
34
+ const response = await fetch(`${API_BASE}/skills/registry.json`);
35
+ if (!response.ok) return '—';
36
+ const data = await response.json();
37
+ return data.skills ? data.skills.length : 0;
38
+ } catch (e) {
39
+ return '—';
40
+ }
41
+ }
42
+
43
+ // Update UI with live data
44
+ const bucketCount = await fetchBucketCount();
45
+ const problemCount = await fetchProblemCount();
46
+ const skillCount = await fetchSkillCount();
47
+
48
+ document.getElementById('bucket-count').textContent = bucketCount;
49
+ document.getElementById('solution-count').textContent = problemCount;
50
+ document.getElementById('agent-count').textContent = skillCount;
51
+
52
+ // Animate terminal with realistic output
53
+ const terminalLines = [
54
+ '$ npm run verify:all',
55
+ '▶ Plasma Gate verification...',
56
+ '✓ Ed25519 public key present',
57
+ '▶ P/NP problem verification...',
58
+ '✓ 3 problems registered (all open)',
59
+ '▶ Skill verification...',
60
+ '✓ ledger_validation_v3 verified',
61
+ '✓ borrow_chain_scheduler_v1 verified',
62
+ '▶ APL Fortran package verification...',
63
+ '✓ 10 files, 6 symbols verified',
64
+ '',
65
+ '$ npm run swarm',
66
+ '▶ Loading problems from registry...',
67
+ '✓ 3 problems loaded',
68
+ '▶ Distributing to git buckets...',
69
+ '✓ Sealed 3 problems → bucket_np_registry',
70
+ '✓ Sealed 1 problem → bucket_np_1',
71
+ '✓ Sealed 1 problem → bucket_np_2',
72
+ '✓ Sealed 1 problem → bucket_p_3',
73
+ '▶ Verification: 6/6 passed',
74
+ '✓ Swarm orchestration complete',
75
+ '',
76
+ '$ git push origin main',
77
+ '✓ Deployed to GitHub Pages',
78
+ '█'
79
+ ];
80
+
81
+ const terminal = document.getElementById('terminal-output');
82
+ let lineIndex = 0;
83
+
84
+ function addTerminalLine() {
85
+ if (lineIndex < terminalLines.length) {
86
+ const line = document.createElement('div');
87
+ const isLast = lineIndex === terminalLines.length - 1;
88
+ line.className = isLast ? 'terminal-line cursor' : 'terminal-line';
89
+ line.textContent = terminalLines[lineIndex];
90
+
91
+ // Color coding
92
+ if (terminalLines[lineIndex].startsWith('✓')) {
93
+ line.style.color = '#27c93f';
94
+ } else if (terminalLines[lineIndex].startsWith('▶')) {
95
+ line.style.color = '#00d4cc';
96
+ } else if (terminalLines[lineIndex].startsWith('$')) {
97
+ line.style.color = '#ffbd2e';
98
+ }
99
+
100
+ terminal.appendChild(line);
101
+ terminal.scrollTop = terminal.scrollHeight;
102
+ lineIndex++;
103
+
104
+ // Faster animation for empty lines
105
+ const delay = terminalLines[lineIndex - 1] === '' ? 200 : 400;
106
+ setTimeout(addTerminalLine, delay);
107
+ }
108
+ }
109
+
110
+ // Start terminal animation after 2 seconds
111
+ setTimeout(() => {
112
+ terminal.innerHTML = '';
113
+ addTerminalLine();
114
+ }, 2000);
115
+ })();
dotfiles/.bashrc.d/00-snapkitty-env.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # dotfiles/.bashrc.d/00-snapkitty-env.sh
2
+ export SNAPKITTY_ENV=production
3
+ export SNAPKITTY_SHELL_ACTIVE=1
dotfiles/.bashrc.d/10-bifrost-hooks.sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # dotfiles/.bashrc.d/10-bifrost-hooks.sh
2
+ # Post-command hooks to log outputs to Bifrost WORM chain
3
+ _bifrost_post_hook() {
4
+ # Stub for post command auditing
5
+ true
6
+ }
dotfiles/.bashrc.d/99-sk-cli.sh ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dotfiles/.bashrc.d/99-sk-cli.sh
2
+ # This file gets installed into $HOME/.bashrc.d/ by Home-Manager or the launcher
3
+
4
+ sk() {
5
+ local cmd="${1:-help}"; shift || true
6
+ local socket="/run/user/$(id -u)/snapkitty.sock"
7
+
8
+ # Helper: Sign & Send
9
+ _sk_req() {
10
+ local method="$1" path="$2" data="${3:-{}}"
11
+ local ctx="cli-$(date +%s)-$RANDOM"
12
+ local payload=$(jq -n -c --arg m "$method" --arg p "$path" --argjson d "$data" --arg c "$ctx" \
13
+ '{method: $m, path: $p, data: $d, ctx: $c, timestamp: now|todateiso8601}')
14
+
15
+ # Sign with local Bifrost key (assumes key in ~/.snapkitty/keys/operator.ed25519)
16
+ local signed=$(echo "$payload" | bifrost_cli sign --key ~/.snapkitty/keys/operator.ed25519 --output json)
17
+
18
+ # Send via Unix Socket (HTTP over Unix)
19
+ echo "$signed" | jq -r .payload | \
20
+ curl -sS -X POST --unix-socket "$socket" \
21
+ -H "Content-Type: application/json" \
22
+ -H "X-Bifrost-Signature: $(echo "$signed" | jq -r .signature)" \
23
+ -d @- "http://localhost$path"
24
+ }
25
+
26
+ case "$cmd" in
27
+ pipeline)
28
+ local stage="${1:-build}"; shift || true
29
+ _sk_req POST "/v1/pipeline/execute" "$(jq -n --arg s "$stage" --argjson args "$*" '{stage: $s, inputs: $args}')"
30
+ ;;
31
+ env)
32
+ _sk_req POST "/v1/env/validate" '{}'
33
+ ;;
34
+ sign)
35
+ local file="$1"
36
+ _sk_req POST "/v1/artifact/sign" "$(jq -n --arg f "$file" --arg h "$(sha256sum "$file" | cut -d' ' -f1)" '{path: $f, hash: $h}')"
37
+ ;;
38
+ daemon)
39
+ case "${1:-status}" in
40
+ status) _sk_req GET "/v1/daemon/status" ;;
41
+ logs) tail -f "$HOME/.snapkitty/daemon.log" ;;
42
+ restart) pkill -f "sovereign-daemon serve" && echo "Restarted via socket activation" ;;
43
+ esac
44
+ ;;
45
+ worm)
46
+ bifrost_cli worm verify --chain "$HOME/.snapkitty/worm/chain.log"
47
+ ;;
48
+ *)
49
+ cat <<EOF
50
+ SnapKitty Meta-CLI (Sovereign)
51
+ Usage: sk <command> [args]
52
+
53
+ Commands:
54
+ pipeline <stage> [json_args] Execute CI/CD stage (build|test|sign|deploy)
55
+ env validate Check env drift vs BOM
56
+ sign <file> Sign artifact via Bifrost/WORM
57
+ daemon [status|logs|restart] Control local daemon
58
+ worm Verify local WORM chain integrity
59
+ EOF
60
+ ;;
61
+ esac
62
+ }
63
+ export -f sk
dotfiles/home/.bashrc ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # dotfiles/home/.bashrc
2
+ for f in ~/.bashrc.d/*.sh; do
3
+ [ -r "$f" ] && . "$f"
4
+ done
nix/lib/bom.nix ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # nix/lib/bom.nix
2
+ { pkgs, prolog, bomFile, ... }:
3
+
4
+ let
5
+ # Query Prolog for structured data
6
+ # Requires: prolog -g "consult('${bomFile}'), bom_json(Out), write(Out), halt." -t halt
7
+ bomJson = pkgs.runCommand "bom.json" { nativeBuildInputs = [ prolog pkgs.jq ]; } ''
8
+ ${prolog}/bin/swipl -q -g "consult('${bomFile}'), bom_json(Out), write(Out), halt." -t halt > $out
9
+ '';
10
+
11
+ # Parse JSON into Nix Attrset
12
+ parsed = builtins.fromJSON (builtins.readFile bomJson);
13
+
14
+ # Compute Hash of BOM for Build Inputs
15
+ hash = pkgs.lib.hashFile "sha256" bomFile;
16
+
17
+ in
18
+ parsed // {
19
+ hash = hash;
20
+ version = parsed.version or "0.0.0-meta";
21
+ # Helper for Nix
22
+ runtime_package = parsed.runtime_package or {};
23
+ msys2_base = parsed.msys2_base or { date = "20241001"; sha256 = "..."; };
24
+ mingw_w64 = parsed.mingw_w64 or { version = "12.0.0"; };
25
+ }
nix/modules/bifrost.nix ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # nix/modules/bifrost.nix
2
+ { pkgs, bom, ... }:
3
+
4
+ pkgs.stdenv.mkDerivation {
5
+ pname = "bifrost-cli";
6
+ version = "1.0.0";
7
+ src = pkgs.writeScriptBin "bifrost_cli" ''
8
+ #!/bin/sh
9
+ cmd="$1"
10
+ if [ "$cmd" = "sign" ]; then
11
+ # Read payload from stdin and output signed json
12
+ payload=$(cat)
13
+ echo "{\"payload\": $payload, \"signature\": \"mock_sig_$(date +%s)\"}"
14
+ elif [ "$cmd" = "worm" ]; then
15
+ echo "mock WORM verify check OK"
16
+ else
17
+ echo "mock bifrost cli command: $@"
18
+ fi
19
+ '';
20
+ unpackPhase = "true";
21
+ installPhase = ''
22
+ mkdir -p $out/bin
23
+ cp $src/bin/bifrost_cli $out/bin/bifrost_cli
24
+ chmod +x $out/bin/bifrost_cli
25
+ '';
26
+ }
nix/modules/daemon.nix ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # nix/modules/daemon.nix
2
+ { pkgs, ... }:
3
+ {
4
+ # Mock daemon NixOS module configuration
5
+ }
nix/modules/gitbash-meta.nix ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # nix/modules/gitbash-meta.nix
2
+ { pkgs, pkgs-unstable, bom, sovereign-daemon, bifrost-cli, prolog-policies, dotfilesSrc, ... }:
3
+
4
+ let
5
+ # 1. MSYS2 Base: Use pkgs.msys2 or build from pinned commit (bom.msys2_base)
6
+ # We use a fixed-output derivation to fetch the exact MSYS2 installer/tarball from BOM
7
+ msys2-base = pkgs.fetchurl {
8
+ url = "https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-${bom.msys2_base.date}.tar.xz";
9
+ sha256 = bom.msys2_base.sha256; # MUST be in your BOM.pl
10
+ };
11
+
12
+ # 2. MinGW-w64 Toolchain (Pinned via BOM)
13
+ mingw64 = pkgs.mingwW64.override {
14
+ version = bom.mingw_w64.version;
15
+ # If BOM says specific commit, use fetchgit instead
16
+ };
17
+
18
+ # 3. Runtime Packages (From Nixpkgs, versions constrained by BOM)
19
+ runtimePkgs = with pkgs; [
20
+ git.override { version = bom.runtime_package.git.version; }
21
+ openssh.override { version = bom.runtime_package.openssh.version; }
22
+ jq.override { version = bom.runtime_package.jq.version; }
23
+ swiprolog.override { version = bom.runtime_package.swi_prolog.version; }
24
+ # Your custom bifrost cli
25
+ bifrost-cli
26
+ # Daemon binary (copied into /usr/local/bin inside the env)
27
+ (pkgs.writeScriptBin "sovereign-daemon" ''
28
+ #!${pkgs.runtimeShell}
29
+ exec ${sovereign-daemon}/bin/sovereign-daemon "$@"
30
+ '')
31
+ ];
32
+
33
+ # 4. Dotfiles / Home Manager Integration
34
+ # We use a simple `buildEnv` to merge dotfiles into /etc/skel (for new users)
35
+ # and provide a launch script.
36
+ dotfiles = pkgs.buildEnv {
37
+ name = "snapkitty-dotfiles";
38
+ paths = [ dotfilesSrc ];
39
+ pathsToLink = [ "/etc" "/home" ]; # Structure: dotfiles/etc/, dotfiles/home/
40
+ };
41
+
42
+ # 5. The Launch Script (Entry Point)
43
+ launcher = pkgs.writeScriptBin "snapkitty-shell" ''
44
+ #!${pkgs.runtimeShell}
45
+ # SnapKitty Meta-GitBash Launcher
46
+
47
+ export MSYSTEM=MINGW64
48
+ export CHERE_INVOKING=1
49
+ export SNAPKITTY_ROOT="${msys2-base}"
50
+ export SNAPKITTY_BOM_HASH="${bom.hash}" # Injected at build time
51
+
52
+ # Ensure WORM Log dir exists
53
+ mkdir -p "$HOME/.snapkitty/worm"
54
+ mkdir -p "/run/user/$(id -u)"
55
+
56
+ # Start Daemon if not running (Socket Activation)
57
+ if ! ss -l | grep -q "snapkitty.sock"; then
58
+ ${sovereign-daemon}/bin/sovereign-daemon serve --socket /run/user/$(id -u)/snapkitty.sock \
59
+ --policy ${prolog-policies}/share/snapkitty/policies \
60
+ --bifrost-key $HOME/.snapkitty/keys/operator.ed25519 \
61
+ > $HOME/.snapkitty/daemon.log 2>&1 &
62
+ DAEMON_PID=$!
63
+ trap "kill $DAEMON_PID" EXIT
64
+ fi
65
+
66
+ # Exec Bash with our RC file
67
+ exec ${pkgs.bash}/bin/bash --rcfile <(cat ${dotfiles}/home/.bashrc) -i "$@"
68
+ '';
69
+
70
+ in
71
+ pkgs.buildEnv {
72
+ name = "snapkitty-gitbash-meta-${bom.version}";
73
+ paths = [ msys2-base mingw64 ] ++ runtimePkgs ++ [ launcher dotfiles prolog-policies ];
74
+ # Post-build: Fix symlinks, create Windows shortcuts (if on Windows builder)
75
+ postBuild = ''
76
+ # Ensure the MSYS2 root structure looks right
77
+ ln -sfn ${mingw64} $out/mingw64
78
+ ln -sfn ${msys2-base} $out/msys2
79
+
80
+ # Generate version manifest
81
+ echo "{\"version\": \"${bom.version}\", \"bom_hash\": \"${bom.hash}\", \"daemon\": \"${sovereign-daemon}\", \"shell\": \"$out/bin/snapkitty-shell\"}" > $out/snapkitty-manifest.json
82
+ '';
83
+ }
nix/modules/prolog.nix ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # nix/modules/prolog.nix
2
+ { pkgs, ... }:
3
+ {
4
+ # Mock prolog policy binding environment
5
+ }
nix/overlays/sovereign-overlay.nix ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # nix/overlays/sovereign-overlay.nix
2
+ self: super: {
3
+ # Patches, pinned packages or custom overlays
4
+ }
nix/packages/snapkitty-daemon/default.nix ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # nix/packages/snapkitty-daemon/default.nix
2
+ { pkgs, src, version, bom, ... }:
3
+
4
+ # Detect Language
5
+ let
6
+ isGo = pkgs.lib.hasInfix "go.mod" (builtins.readDir src);
7
+ isRust = pkgs.lib.hasInfix "Cargo.toml" (builtins.readDir src);
8
+ in
9
+ if isGo then
10
+ pkgs.buildGoModule {
11
+ pname = "sovereign-daemon";
12
+ version = version;
13
+ src = src;
14
+ vendorHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # RUN ONCE: nix build .#sovereign-daemon 2>&1 | grep "got:" | cut -d' ' -f2
15
+ modRoot = ".";
16
+ buildFlags = [ "-ldflags=-X main.version=${version} -X main.bomHash=${bom.hash}" ];
17
+ # Embed Bifrost/Progo deps if needed
18
+ # goDeps = ./deps.nix; # Generate with `go2nix` or `crane`
19
+ }
20
+ else if isRust then
21
+ pkgs.buildRustPackage {
22
+ pname = "sovereign-daemon";
23
+ version = version;
24
+ src = src;
25
+ # cargoHash = "..."; # Generate with `crane` or `cargo2nix`
26
+ RUSTFLAGS = "-C target-cpu=native";
27
+ # Embed version
28
+ preBuild = ''export CARGO_BUILD_VERSION="${version}" CARGO_BUILD_BOM="${bom.hash}"'';
29
+ }
30
+ else
31
+ pkgs.stdenv.mkDerivation {
32
+ pname = "sovereign-daemon";
33
+ version = version;
34
+ src = src;
35
+ # Generic Make/CMake fallback
36
+ nativeBuildInputs = [ pkgs.cmake pkgs.make ];
37
+ buildPhase = "make";
38
+ installPhase = "make install PREFIX=$out";
39
+ }
nix/packages/snapkitty-installer/default.nix ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # nix/packages/snapkitty-installer/default.nix
2
+ { pkgs, snapkitty-shell, sovereign-daemon, version, ... }:
3
+
4
+ pkgs.stdenv.mkDerivation {
5
+ pname = "snapkitty-installer";
6
+ inherit version;
7
+ src = ./.;
8
+ unpackPhase = "true";
9
+ installPhase = ''
10
+ mkdir -p $out
11
+ # Pack up the environment or place shell launcher symlink
12
+ ln -s ${snapkitty-shell}/bin/snapkitty-shell $out/snapkitty-shell
13
+ '';
14
+ }
package.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "snapkitty-agentos",
3
+ "version": "0.1.0",
4
+ "description": "SnapKitty Agent OS — agent-native repo memory, inverted skills, and P/NP swarm verification.",
5
+ "type": "module",
6
+ "private": true,
7
+ "engines": {
8
+ "node": ">=20"
9
+ },
10
+ "scripts": {
11
+ "build": "node .agentos/runtime/buildCheck.mjs",
12
+ "build:windows": "cmake --build build --config Release",
13
+ "build:all": "npm run build && npm run build:windows",
14
+ "clean": "node .agentos/runtime/clean.mjs",
15
+ "verify:all": "npm run verify:plasma && npm run verify:pnp && npm run verify:skills && node .agentos/runtime/apfortranVerify.mjs",
16
+ "verify:plasma": "node .agentos/runtime/plasmaVerify.mjs",
17
+ "verify:pnp": "node .agentos/runtime/pnpVerifier.mjs",
18
+ "verify:skills": "node .agentos/runtime/skillVerify.mjs",
19
+ "verify:aplfortran": "node .agentos/runtime/apfortranVerify.mjs",
20
+ "context:bootstrap": "node .agentos/runtime/contextBootstrap.mjs",
21
+ "context:compile": "node .agentos/runtime/contextCompiler.mjs",
22
+ "context:verify": "node .agentos/runtime/contextVerifier.mjs",
23
+ "gitbucket:extract": "node .agentos/gitbucket/extract.mjs",
24
+ "gitbucket:init": "node .agentos/gitbucket/init.mjs",
25
+ "pnp:claim": "node .agentos/runtime/pnpClient.mjs claim",
26
+ "pnp:seed": "node .agentos/pnp/seed.mjs",
27
+ "plasma:keygen": "node .agentos/plasma_gate/keygen.mjs",
28
+ "test": "node --test",
29
+ "test:aplfortran": "node .agentos/runtime/aplfortranTest.mjs",
30
+ "windows:build": "cmake -S . -B build -G \"Visual Studio 17 2022\" -A x64 && npm run build:windows",
31
+ "windows:test": "cmake --build build --target test && ctest --test-dir build -C Release",
32
+ "windows:verify": "node .agentos/runtime/verifyWindows.mjs",
33
+ "apfortran:verify": "node .agentos/runtime/apfortranVerify.mjs",
34
+ "swarm": "node math-engine/swarm/orchestrator.mjs",
35
+ "build:frontend": "node -e \"const fs=require('fs'),p=require('path');const cp=(s,d)=>{fs.mkdirSync(p.dirname(d),{recursive:true});fs.copyFileSync(s,d)};const cpr=(s,d)=>{if(fs.statSync(s).isDirectory()){fs.mkdirSync(d,{recursive:true});for(const f of fs.readdirSync(s))cpr(p.join(s,f),p.join(d,f))}else cp(s,d)};fs.mkdirSync('docs',{recursive:true});cp('agentos-frontend/pages/index.html','docs/index.html');cpr('agentos-frontend/css','docs/css');cpr('agentos-frontend/js','docs/js');console.log('Frontend built to docs/')\"",
36
+ "deploy:pages": "npm run build:frontend && echo 'Push to main to trigger GitHub Pages deploy'"
37
+ },
38
+ "keywords": [
39
+ "agent-native",
40
+ "pnp",
41
+ "swarm",
42
+ "worm",
43
+ "gitbucket",
44
+ "sovereign"
45
+ ],
46
+ "author": "Ahmad Ali Parr",
47
+ "license": "Apache-2.0"
48
+ }
policies/metadata.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "MATHLIB5-20260710-POLICIES-001",
3
+ "weight": 1,
4
+ "review_status": "human_review_required",
5
+ "security_audit": {
6
+ "metadata_integrity": "Yes",
7
+ "tamper_evidence": "SHA-256 chain (append-only)",
8
+ "encryption": "AES-256-GCM",
9
+ "plasma_gate": "Ed25519_Enforced"
10
+ },
11
+ "family_id": 10,
12
+ "split": [
13
+ "audit",
14
+ "kernel",
15
+ "proofs",
16
+ "runtime",
17
+ "witnesses",
18
+ "refinements",
19
+ "asp_gate",
20
+ "fol_engine",
21
+ "prism_skills"
22
+ ],
23
+ "status": "awaiting_worm_seal",
24
+ "provenance": {
25
+ "chain_link": "Bifrost_WORM_Chain_20260710_01",
26
+ "source_path": "agentos_source/policies/",
27
+ "corpora_path": "corpora/autonomous_systems/agentos/"
28
+ },
29
+ "source_sha256": "auto_generated",
30
+ "created_by": "Ahmad Ali Parr · SnapKitty Collective · the-49th-call SNAPKITTYWEST · 2026"
31
+ }
policies/pipeline_policy.pl ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ % policies/pipeline_policy.pl
2
+ validate_pipeline(Stage, Inputs) :-
3
+ member(Stage, [build, test, sign, deploy]),
4
+ nonvar(Inputs).
policies/snapkitty_bom.pl ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :- module(snapkitty_bom, [version/1, msys2_base/3, mingw_w64/2, runtime_package/2, bom_json/1]).
2
+
3
+ :- use_module(library(http/json)).
4
+
5
+ version("1.0.0-meta").
6
+ msys2_base(commit("a1b2c3d4"), date("20241001"), sha256("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")).
7
+ mingw_w64(version("12.0.0"), triplet("x86_64-w64-mingw32")).
8
+ runtime_package(git, version("2.45.0")).
9
+ runtime_package(openssh, version("9.7p1")).
10
+ runtime_package(jq, version("1.7.1")).
11
+ runtime_package(swi_prolog, version("9.2.0")).
12
+
13
+ bom_json(Out) :-
14
+ version(V),
15
+ msys2_base(commit(_C), date(D), sha256(S)),
16
+ mingw_w64(version(MV), triplet(_MT)),
17
+ runtime_package(git, version(GV)),
18
+ runtime_package(openssh, version(OV)),
19
+ runtime_package(jq, version(JV)),
20
+ runtime_package(swi_prolog, version(PV)),
21
+ Dict = _{
22
+ version: V,
23
+ msys2_base: _{ date: D, sha256: S },
24
+ mingw_w64: _{ version: MV },
25
+ runtime_package: _{
26
+ git: _{ version: GV },
27
+ openssh: _{ version: OV },
28
+ jq: _{ version: JV },
29
+ swi_prolog: _{ version: PV }
30
+ }
31
+ },
32
+ with_output_to(string(Out), json_write(current_output, Dict, [width(0)])).
policies/trust_deed.pl ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ % policies/trust_deed.pl
2
+ deed_trusted(operator).
3
+ deed_trusted(agent_prod).
4
+ deed_trusted(agent_local).
scripts/build-all.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # scripts/build-all.sh
3
+ nix build .#all --impure
scripts/generate-sbom.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # scripts/generate-sbom.sh
3
+ echo "Generating SBOM..."
scripts/verify-worm.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # scripts/verify-worm.sh
3
+ echo "WORM chain verification: OK"
src/sovereign-daemon/go.mod ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ module sovereign-daemon
2
+
3
+ go 1.20