Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
1416 lines (1354 loc) · 83.9 KB
/
Copy pathindex.html
File metadata and controls
1416 lines (1354 loc) · 83.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Lynx — policy-gated, durable, audited execution for AI agent tool calls</title>
<meta name="description" content="Lynx is a stateless, type-safe Python policy kernel for AI agent tool calls. Every action gets a five-verdict policy check (allow / deny / dry_run / approve_required / transform) plus mandatory obligations, a crash-safe checkpoint, and a tamper-evident audit event — before it touches the real world. A library, not a server. Works with Claude, GPT, LangChain, CrewAI, and MCP." />
<meta name="keywords" content="AI agent governance, LLM tool calls, policy engine, agent guardrails, AI safety, policy as code, durable execution, audit log, human-in-the-loop approval, MCP proxy, LangChain, CrewAI, OpenAI Agents SDK, Claude, GPT, Python, agentic AI, tool-call policy, XACML, Cedar, obligations" />
<meta name="author" content="Lynx contributors" />
<meta name="robots" content="index, follow, max-image-preview:large" />
<meta name="theme-color" content="#0b0d10" />
<link rel="canonical" href="https://lynxharness.com/" />
<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Lynx" />
<meta property="og:title" content="Lynx — the governance layer for your agent's tool calls" />
<meta property="og:description" content="A stateless Python policy kernel for AI agents. Five-verdict checks, obligations, durable crash-resume, and tamper-evident audit on every tool call — a library, not a server." />
<meta property="og:url" content="https://lynxharness.com/" />
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Lynx — governance for AI agent tool calls" />
<meta name="twitter:description" content="Five-verdict policy, obligations, durable execution, and tamper-evident audit on every agent tool call. Stateless Python library." />
<style>
:root {
--bg: #0b0d10;
--bg-soft: #12151a;
--panel: #161a21;
--line: #232a34;
--ink: #e8edf4;
--muted: #9aa6b6;
--faint: #6b7686;
--accent: #f5a623; /* lynx amber */
--accent-2: #5cc8ff; /* signal blue */
--green: #51d88a;
--red: #ff6b6b;
--violet: #b08cff;
--mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
margin: 0; background: var(--bg); color: var(--ink); overflow-x: hidden;
font-family: var(--sans); line-height: 1.6;
-webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
code, pre { font-family: var(--mono); }
/* nav */
nav {
position: sticky; top: 0; z-index: 50;
backdrop-filter: blur(12px); background: rgba(11,13,16,.72);
border-bottom: 1px solid var(--line);
}
nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.navlinks { display: flex; gap: 20px; align-items: center; font-size: 14px; }
.navlinks a { color: var(--muted); }
.navlinks a:hover { color: var(--ink); text-decoration: none; }
.navlinks .ghbtn { color: var(--ink); border: 1px solid var(--line); padding: 6px 14px; border-radius: 8px; }
@media (max-width: 860px){ .navlinks .hideSm { display:none; } }
/* hero */
header.hero { padding: 86px 0 64px; position: relative; overflow: hidden; }
header.hero::before {
content:""; position:absolute; inset:0;
background:
radial-gradient(700px 360px at 78% -8%, rgba(245,166,35,.13), transparent 60%),
radial-gradient(620px 320px at 12% 4%, rgba(92,200,255,.10), transparent 60%);
pointer-events:none;
}
.eyebrow {
display:inline-flex; align-items:center; gap:8px;
font-size:12.5px; letter-spacing:.6px; text-transform:uppercase;
color: var(--accent); border:1px solid rgba(245,166,35,.32);
background: rgba(245,166,35,.06); padding:5px 12px; border-radius:999px;
}
h1 { font-size: clamp(34px, 6vw, 58px); line-height: 1.04; margin: 22px 0 0; letter-spacing: -1px; }
h1 .grad { background: linear-gradient(92deg, var(--accent), #ffd27a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(17px, 2.4vw, 21px); color: var(--muted); max-width: 730px; margin: 22px 0 0; }
.cta { display:flex; flex-wrap:wrap; gap:14px; margin-top: 32px; align-items:center; }
.btn {
display:inline-flex; align-items:center; gap:9px; font-weight:600; font-size:15px;
padding: 12px 20px; border-radius: 10px; border:1px solid transparent; cursor:pointer;
}
.btn.primary { background: var(--accent); color:#1a1206; }
.btn.primary:hover { background:#ffb845; text-decoration:none; }
.btn.ghost { border-color: var(--line); color: var(--ink); background: var(--bg-soft); }
.btn.ghost:hover { border-color:#34404f; text-decoration:none; }
.install {
margin-top: 30px; display:flex; align-items:center; gap:12px; flex-wrap:wrap;
background: var(--panel); border:1px solid var(--line); border-radius: 12px;
padding: 14px 16px; max-width: 520px;
}
.install code { color: var(--ink); font-size: 15px; }
.install .pfx { color: var(--accent); }
.copy { margin-left:auto; border:1px solid var(--line); background:transparent; color:var(--muted);
border-radius:7px; padding:6px 11px; font-size:12.5px; cursor:pointer; }
.copy:hover { color: var(--ink); border-color:#34404f; }
/* section scaffolding */
section { padding: 72px 0; border-top: 1px solid var(--line); }
.kicker { color: var(--accent); font-size:13px; font-weight:700; letter-spacing:.8px; text-transform:uppercase; }
h2 { font-size: clamp(26px, 4vw, 36px); margin: 12px 0 0; letter-spacing:-.5px; }
.sub { color: var(--muted); margin-top: 12px; max-width: 760px; font-size: 16.5px; }
/* loop diagram */
.loop { margin-top: 40px; display:grid; grid-template-columns: 1fr; gap: 0; }
.looprow { display:flex; align-items:stretch; gap:14px; flex-wrap:wrap; justify-content:center; }
.node {
flex:1 1 150px; min-width:140px; background: var(--panel); border:1px solid var(--line);
border-radius:12px; padding:16px; text-align:center;
}
.node .lbl { font-weight:600; font-size:14.5px; }
.node .meta { color: var(--faint); font-size:12.5px; margin-top:4px; }
.node.gate { border-color: rgba(245,166,35,.5); box-shadow: 0 0 0 1px rgba(245,166,35,.14), 0 8px 30px rgba(245,166,35,.08); background: linear-gradient(180deg, rgba(245,166,35,.07), var(--panel)); }
.node.gate .lbl { color: var(--accent); }
.arrow { align-self:center; color: var(--faint); font-size:20px; }
@media (max-width:640px){
/* stack the loop diagram vertically so 4 nodes don't force the page wide */
.looprow { flex-direction:column; align-items:stretch; }
.node { min-width:0; width:100%; flex:0 0 auto; }
.arrow { transform: rotate(90deg); }
}
/* verdict cards */
.grid { display:grid; gap:16px; margin-top:36px; }
.v5 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card { background: var(--panel); border:1px solid var(--line); border-radius:14px; padding:20px; }
.card h3 { margin:0; font-size:16px; display:flex; align-items:center; gap:9px; }
.card p { margin:10px 0 0; color: var(--muted); font-size:14px; }
.pill { width:9px; height:9px; border-radius:50%; display:inline-block; }
.p-allow{background:var(--green)} .p-deny{background:var(--red)} .p-dry{background:var(--accent-2)}
.p-appr{background:var(--accent)} .p-tx{background:var(--violet)}
.feat { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.feat .card h3 { font-size:15.5px; }
.feat .ic { color: var(--accent); }
/* code block */
pre.code {
margin-top: 28px; background:#0e1116; border:1px solid var(--line); border-radius:14px;
padding: 22px; overflow:auto; font-size: 13.5px; line-height:1.7;
}
pre.code .c { color: var(--faint); } /* comment */
pre.code .k { color: var(--accent); } /* keyword */
pre.code .s { color: var(--green); } /* string */
pre.code .f { color: var(--accent-2); } /* func / name */
pre.code .n { color: var(--violet); } /* number/const */
.two { display:grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 36px; }
@media (max-width: 760px){ .two { grid-template-columns: 1fr; } }
.listcard { background: var(--bg-soft); border:1px solid var(--line); border-radius:14px; padding:22px 24px; }
.listcard h3 { margin:0 0 12px; font-size:16px; }
.listcard ul { margin:0; padding-left: 0; list-style:none; }
.listcard li { padding:9px 0; border-bottom:1px dashed var(--line); color:var(--muted); font-size:14.5px; }
.listcard li:last-child { border-bottom:0; }
.listcard li b { color: var(--ink); font-weight:600; }
.yes li::marker, .no li::marker { content:""; }
.tick { color: var(--green); } .cross { color: var(--red); }
/* tables */
.tbl { width:100%; border-collapse:collapse; margin-top:28px; font-size:14px; }
.tbl th, .tbl td { text-align:left; padding:11px 14px; border-bottom:1px solid var(--line); vertical-align:top; }
.tbl th { color:var(--accent); font-weight:600; font-size:12.5px; text-transform:uppercase; letter-spacing:.5px; }
.tbl td { color:var(--muted); }
.tbl td b, .tbl td code { color:var(--ink); }
.tbl tr:last-child td { border-bottom:0; }
.tbl code { font-size:13px; }
.scrollx { overflow-x:auto; }
.chips { display:flex; flex-wrap:wrap; gap:10px; margin-top:30px; }
.chip { border:1px solid var(--line); background:var(--panel); border-radius:999px; padding:7px 15px; font-size:13.5px; color:var(--muted); }
.chip b { color: var(--ink); }
.badge { display:inline-block; font-size:11px; font-weight:700; letter-spacing:.5px; text-transform:uppercase;
color:var(--accent); border:1px solid rgba(245,166,35,.4); background:rgba(245,166,35,.07);
border-radius:6px; padding:2px 8px; margin-left:10px; vertical-align:middle; }
footer { border-top:1px solid var(--line); padding: 44px 0 64px; color: var(--faint); font-size:13.5px; }
footer .wrap { display:flex; justify-content:space-between; flex-wrap:wrap; gap:16px; }
.note { margin-top:8px; font-size:12px; color:var(--faint); }
/* ---- animated feature rows ---- */
.feature{padding:74px 0;border-top:1px solid var(--line)}
.feature .wrap{display:grid;grid-template-columns:0.92fr 1.08fr;gap:54px;align-items:center}
/* grid items default to min-width:auto, so the white-space:pre code snippet
forces the column wider than a phone screen — let them shrink instead */
.feature .wrap > *{min-width:0}
.snip,.visual canvas{max-width:100%}
@media(max-width:860px){ .feature .wrap{grid-template-columns:1fr;gap:26px} }
.feature .kicker{display:flex;align-items:center;gap:10px}
.feature .kicker .num{font-family:var(--mono);color:var(--faint);font-weight:600}
.desc h2{font-size:clamp(25px,3.4vw,33px);margin:14px 0 0;letter-spacing:-.5px}
.desc p{color:var(--muted);font-size:16px;margin:14px 0 0}
.desc p b{color:var(--ink);font-weight:600}
.tags{display:flex;flex-wrap:wrap;gap:8px;margin-top:18px}
.tag{font-family:var(--mono);font-size:12px;color:var(--muted);border:1px solid var(--line);background:var(--panel);border-radius:7px;padding:4px 9px}
.snip{margin-top:16px;background:#0e1116;border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:10px;padding:12px 14px;overflow-x:auto;font-family:var(--mono);font-size:12.5px;line-height:1.65;color:var(--ink);white-space:pre}
.snip .c{color:var(--faint)}
.visual{position:relative}
.visual canvas{width:100%;aspect-ratio:600/420;display:block;border-radius:16px;border:1px solid var(--line);background:#0d1014;box-shadow:0 20px 60px rgba(0,0,0,.35)}
.cap{margin-top:10px;font-family:var(--mono);font-size:12px;color:var(--faint);text-align:center}
/* ---- WebGL hero ---- */
header.hero{min-height:84vh;display:flex;align-items:center}
#hero-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;z-index:0}
.hero-grad{position:absolute;inset:0;pointer-events:none;z-index:1;background:radial-gradient(62% 62% at 50% 40%,transparent,rgba(11,13,16,.5) 74%,var(--bg) 100%)}
.hero-inner{position:relative;z-index:2;width:100%}
/* ---- FAQ ---- */
.faq{margin-top:30px;display:grid;gap:10px}
.faq details{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:2px 18px}
.faq summary{cursor:pointer;padding:15px 0;font-weight:600;font-size:15.5px;list-style:none;color:var(--ink)}
.faq summary::-webkit-details-marker{display:none}
.faq summary::before{content:"+";color:var(--accent);margin-right:11px;font-weight:700}
.faq details[open] summary::before{content:"\2013"}
.faq details p{margin:0 0 16px;color:var(--muted);font-size:14.5px}
/* ---- responsive ---- */
@media(max-width:600px){
header.hero{min-height:auto;padding:64px 0 44px}
.feature{padding:52px 0}
/* wrap long code lines instead of letting white-space:pre force the page wide */
.snip{font-size:11.5px;white-space:pre-wrap;overflow-wrap:anywhere}
.wrap{padding:0 18px}
}
</style>
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"SoftwareApplication","name":"Lynx","alternateName":"lynx-agent","applicationCategory":"DeveloperApplication","operatingSystem":"OS Independent","description":"Stateless, type-safe policy kernel for AI agent tool calls: five-verdict policy checks, mandatory obligations, durable crash-resume, and tamper-evident audit — a library, not a server.","programmingLanguage":"Python","license":"https://www.apache.org/licenses/LICENSE-2.0","codeRepository":"https://github.com/hadihonarvar/lynx","downloadUrl":"https://pypi.org/project/lynx-agent/","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}
</script>
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[
{"@type":"Question","name":"Is Lynx an agent framework?","acceptedAnswer":{"@type":"Answer","text":"No. Lynx is the governance and safety layer for an agent loop, not the loop itself. It checks, audits, and bounds each tool call. Use it with frameworks like LangChain, CrewAI, or the OpenAI Agents SDK, or drive a minimal loop yourself with run_agent."}},
{"@type":"Question","name":"Does Lynx need a database or a server?","acceptedAnswer":{"@type":"Answer","text":"No. It is a pure Python library with three dependencies and no server. Audit events stream to sinks you own; durable crash-resume uses a RunStore you implement over your own storage."}},
{"@type":"Question","name":"Which models does Lynx support?","acceptedAnswer":{"@type":"Answer","text":"Claude and GPT directly, plus any OpenAI-compatible provider through one registry — Grok, Mistral, DeepSeek, Groq, Ollama, and more. The same policy governs every model."}},
{"@type":"Question","name":"What are the five verdicts?","acceptedAnswer":{"@type":"Answer","text":"Every action gets exactly one verdict: allow (run it), deny (refuse), dry_run (preview via a side-effect-free shadow), approve_required (pause for a human with a timeout), or transform (rewrite the arguments first)."}},
{"@type":"Question","name":"What are obligations?","acceptedAnswer":{"@type":"Answer","text":"Obligations are mandatory side-actions attached to any verdict, in the XACML/Cedar model. A pre obligation gates the action (it fails closed if the handler fails); a post obligation fires after. The kernel ships no handlers — you wire an ObligationRegistry."}},
{"@type":"Question","name":"Does Lynx work with MCP?","acceptedAnswer":{"@type":"Answer","text":"Yes. The MCP proxy sits in front of any MCP server: the client points at Lynx instead of the server, and every call_tool flows through the same policy check with an audit stream — zero code change on client or server."}}
]}
</script>
</head>
<body>
<nav>
<div class="wrap">
<div class="brand"><span class="dot"></span> Lynx</div>
<div class="navlinks">
<a href="#loop" class="hideSm">How it works</a>
<a href="#f-verdicts" class="hideSm">Verdicts</a>
<a href="#f-obligations" class="hideSm">Obligations</a>
<a href="#f-budgets" class="hideSm">Rails</a>
<a href="#f-graph" class="hideSm">Graphs</a>
<a href="#f-mcp" class="hideSm">Integrations</a>
<a class="ghbtn" href="https://github.com/hadihonarvar/lynx">GitHub ↗</a>
</div>
</div>
</nav>
<header class="hero">
<canvas id="hero-canvas" aria-hidden="true"></canvas>
<div class="hero-grad"></div>
<div class="hero-inner">
<div class="wrap">
<span class="eyebrow">● stateless · pure · provable</span>
<h1>The governance layer<br>for your agent's <span class="grad">tool calls</span>.</h1>
<p class="lede">
Lynx is a stateless policy kernel for AI agents. Every action an agent proposes gets a
<strong>five-verdict policy check</strong> with <strong>mandatory obligations</strong>, a
<strong>crash-safe checkpoint</strong>, and a <strong>tamper-evident audit event</strong> —
before it touches the real world. A library, not a server.
</p>
<div class="cta">
<a class="btn primary" href="https://pypi.org/project/lynx-agent/">Install from PyPI →</a>
<a class="btn ghost" href="https://github.com/hadihonarvar/lynx">View on GitHub ↗</a>
</div>
<div class="install">
<code><span class="pfx">$</span> pip install lynx-agent</code>
<button class="copy" onclick="copyInstall(this)">Copy</button>
</div>
</div>
</div>
</header>
<main>
<!-- LOOP -->
<section id="loop">
<div class="wrap">
<div class="kicker">How it works</div>
<h2>One chokepoint on the one dangerous moment</h2>
<p class="sub">
An agent harness is a loop: the model proposes a tool call, the harness runs it, the result feeds back.
Lynx isn't the loop — it clamps onto the single point where a proposed call is about to touch the world,
and runs <code>evaluate → mediate</code> on every one.
</p>
<div class="loop">
<div class="looprow">
<div class="node"><div class="lbl">Model</div><div class="meta">proposes a tool call</div></div>
<div class="arrow">→</div>
<div class="node gate"><div class="lbl">Lynx</div><div class="meta">evaluate → mediate</div></div>
<div class="arrow">→</div>
<div class="node"><div class="lbl">Executor</div><div class="meta">your sandbox runs it</div></div>
<div class="arrow">→</div>
<div class="node"><div class="lbl">Result</div><div class="meta">audited, fed back</div></div>
</div>
</div>
<p class="note" style="text-align:center;margin-top:22px">
Pure functions over immutable values. No database. No globals. No leaks. Lynx holds <em>nothing</em> between calls.
</p>
<pre class="code"><span class="c"># A whole governed run — Lynx holds no state after it returns</span>
result = <span class="k">await</span> <span class="f">run_agent</span>(
my_agent,
task=<span class="s">"clean up old logs"</span>,
tools=ToolSet.<span class="f">from_functions</span>(shell),
policy=<span class="f">load_policy_file</span>(<span class="s">"policy.yaml"</span>),
sinks=(<span class="f">stdout_sink</span>(),),
on_approval=<span class="f">auto_deny</span>(<span class="s">"no approvals configured"</span>),
obligations={<span class="s">"notify-finance"</span>: notify_handler}, <span class="c"># side-actions policy can require</span>
environment=<span class="s">"prod"</span>, <span class="c"># policy can match on this</span>
budget=<span class="f">Budget</span>(steps=<span class="n">50</span>, duration_seconds=<span class="n">600</span>), <span class="c"># hard caps that STOP the run</span>
)
<span class="c"># → { correlation_id, bundle_id, final_answer, error, steps_taken, usage }</span></pre>
</div>
</section>
<!-- ===== live feature components ===== -->
<!-- 1 LOOP -->
<section class="feature" id="f-loop">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">01</span> The chokepoint</div>
<h2>One gate on the one dangerous moment</h2>
<p>An agent harness is a loop: the model proposes a tool call, something runs it, the result feeds back. Lynx isn't the loop — it <b>clamps onto the single point</b> where a proposed call is about to touch the world, and runs <code>evaluate → mediate</code> on every one.</p>
<p>Pure functions over immutable values. No database, no globals. Lynx holds <b>nothing</b> between calls.</p>
<pre class="snip">result = await run_agent(agent, task,
tools=tools, policy=policy, sinks=(stdout_sink(),))</pre>
<div class="tags"><span class="tag">run_agent()</span><span class="tag">stateless</span><span class="tag">pure</span></div>
</div>
<div class="visual"><canvas id="c-loop" role="img" aria-label="model → lynx → executor → result, audited & fed back"></canvas><div class="cap">model → lynx → executor → result, audited & fed back</div></div>
</div>
</section>
<!-- 2 VERDICTS -->
<section class="feature" id="f-verdicts">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">02</span> The boundary</div>
<h2>Five verdicts on every action</h2>
<p>Policy is a pure function of <code>(request, context)</code> that returns exactly one verdict — and the action can't run unless it says so. <b>allow</b> runs it, <b>deny</b> refuses, <b>dry_run</b> previews via a side-effect-free shadow, <b>approve_required</b> pauses for a human, <b>transform</b> rewrites the args first.</p>
<p>No rule matched? It <b>fails closed</b> — and names the fall-through in the audit trail.</p>
<pre class="snip">- match: { tool: shell, args.cmd.matches: 'rm -rf' }
decision: deny</pre>
<div class="tags"><span class="tag">allow</span><span class="tag">deny</span><span class="tag">dry_run</span><span class="tag">approve_required</span><span class="tag">transform</span></div>
</div>
<div class="visual"><canvas id="c-verdicts" role="img" aria-label="one request in, exactly one verdict out"></canvas><div class="cap">one request in, exactly one verdict out</div></div>
</div>
</section>
<!-- 3 OBLIGATIONS -->
<section class="feature" id="f-obligations">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">03</span> Decision + obligations <span class="badge">new</span></div>
<h2>Allow — but you must also…</h2>
<p>Like XACML and AWS Cedar, a decision can carry <b>mandatory side-actions</b>. A <b>pre</b> obligation is a fail-closed gate: if "issue the 5-minute credential" fails, the action is denied and the tool never runs. A <b>post</b> obligation fires after — notify finance — and is flagged if it fails (physics: the side effect already happened).</p>
<p>Mechanism, not policy: the kernel ships <b>no</b> handlers — you wire an <code>obligations={…}</code> registry.</p>
<pre class="snip">- match: { tool: refund, args.amount.gt: 1000 }
decision: allow
obligations: [{ id: notify-finance, phase: post }]</pre>
<div class="tags"><span class="tag">phase: pre → gate</span><span class="tag">phase: post → flag</span><span class="tag">fail-closed</span></div>
</div>
<div class="visual"><canvas id="c-oblig" role="img" aria-label="pre-gate must clear before the action; post fires after"></canvas><div class="cap">pre-gate must clear before the action; post fires after</div></div>
</div>
</section>
<!-- 4 LAYERED POLICY -->
<section class="feature" id="f-layers">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">04</span> Layered policy scopes</div>
<h2>org → team → user, composed</h2>
<p>Stack independent named policies. Each layer is evaluated on its own, then a developer-chosen <b>Combiner</b> resolves disagreements. The default <code>strict_overrides_loose</code> is fail-closed: a broader layer sets a floor narrower layers can only <b>tighten</b> — any layer can deny, none can secretly re-grant.</p>
<p>Non-matching layers abstain; provenance stays layer-tagged (<code>team:block-http</code>).</p>
<pre class="snip">compile_policy([PolicyLayer("org", org),
PolicyLayer("team", team), PolicyLayer("user", user)])</pre>
<div class="tags"><span class="tag">strict_overrides_loose</span><span class="tag">last_layer_wins</span><span class="tag">first_layer_wins</span></div>
</div>
<div class="visual"><canvas id="c-layers" role="img" aria-label="a request drops through each layer; the strictest wins"></canvas><div class="cap">a request drops through each layer; the strictest wins</div></div>
</div>
</section>
<!-- 5 BUDGETS -->
<section class="feature" id="f-budgets">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">05</span> Loop control & rails</div>
<h2>Caps that stop a runaway run</h2>
<p>Hard budgets on <b>steps, duration, and tokens</b> (separate input / output / combined) are enforced between steps — they <b>halt</b> the run, they don't just alert. Plus a <b>kill-switch</b> checked before every tool, and a <b>repetition gate</b> that breaks same-tool-same-args infinite loops.</p>
<p>Lynx counts; it never prices. You multiply <code>step.usage</code> by your own rates in a sink.</p>
<pre class="snip">run_agent(..., budget=Budget(steps=50, output_tokens=100_000),
cancel=CancelToken())</pre>
<div class="tags"><span class="tag">Budget(steps, tokens, …)</span><span class="tag">CancelToken</span><span class="tag">max_repeated_calls</span></div>
</div>
<div class="visual"><canvas id="c-budget" role="img" aria-label="token budget fills as steps run — at the cap, the run stops"></canvas><div class="cap">token budget fills as steps run — at the cap, the run stops</div></div>
</div>
</section>
<!-- 6 DURABLE -->
<section class="feature" id="f-durable">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">06</span> Durable execution</div>
<h2>Crash-resume, no double side effects</h2>
<p>Pass a <code>RunStore</code> you own and a stable <code>run_id</code>. Every action is journaled <b>before</b> it runs. A crash mid-loop? On retry, completed steps <b>replay from the journal</b> — the model isn't re-called (no re-burned tokens) and journaled actions aren't re-executed (no double charges).</p>
<p>Two racing workers resolve to one winner; the loser exits <code>superseded</code> having executed nothing.</p>
<pre class="snip">run_agent(..., store=my_store, run_id="invoice-0611")</pre>
<div class="tags"><span class="tag">write-ahead journal</span><span class="tag">replay</span><span class="tag">supersede</span></div>
</div>
<div class="visual"><canvas id="c-durable" role="img" aria-label="write → crash → replay completed steps → continue"></canvas><div class="cap">write → crash → replay completed steps → continue</div></div>
</div>
</section>
<!-- 7 AUDIT -->
<section class="feature" id="f-audit">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">07</span> Tamper-evident audit</div>
<h2>An audit log you can't quietly edit</h2>
<p><code>hash_chained_sink</code> fingerprints every event and chains it to the one before — <code>hash = sha256(prev + event)</code>. Edit a body, drop a denial, or reorder events and <b>every fingerprint downstream breaks</b>. A pure, stdlib-only sink that composes with the rest.</p>
<p>Verify with <code>verify_chain()</code> or <code>lynx verify audit.jsonl</code> — exits 1 if broken.</p>
<pre class="snip">run_agent(..., sinks=(hash_chained_sink(f),))
verify_chain("audit.jsonl") <span class="c"># intact=True</span></pre>
<div class="tags"><span class="tag">hash_chained_sink</span><span class="tag">verify_chain</span><span class="tag">otel_sink</span></div>
</div>
<div class="visual"><canvas id="c-audit" role="img" aria-label="tamper with one block → the chain breaks from there on"></canvas><div class="cap">tamper with one block → the chain breaks from there on</div></div>
</div>
</section>
<!-- 8 EXECUTOR -->
<section class="feature" id="f-executor">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">08</span> The executor seam</div>
<h2>Policy says whether — the executor says where</h2>
<p>Every approved action flows through one <code>Executor</code>: in-process, a <b>subprocess with rlimits</b>, or <b>your</b> Docker / gVisor / E2B / Firecracker wrapper — one async callable. Route per-tool with <code>@tool(isolation=…)</code> + <code>route_executor</code>.</p>
<p>Routing <b>fails closed</b>: a tool that asks for a sandbox with no route gets a failed action, never a silent fallback to the host.</p>
<pre class="snip">run_agent(..., executor=route_executor({
None: inline_executor(), "container": my_docker}))</pre>
<div class="tags"><span class="tag">inline_executor</span><span class="tag">subprocess_executor</span><span class="tag">route_executor</span></div>
</div>
<div class="visual"><canvas id="c-exec" role="img" aria-label="each action routes to its isolation — missing route = blocked"></canvas><div class="cap">each action routes to its isolation — missing route = blocked</div></div>
</div>
</section>
<!-- 9 COMPRESSOR -->
<section class="feature" id="f-compressor">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">09</span> The compressor seam</div>
<h2>Shrink results before they cost you</h2>
<p>Metering measures spend; the compressor <b>reduces</b> it. Every fresh tool result is shrunk <b>before</b> it enters the conversation, the journal, and any replay — so a 40 KB log dumped once isn't re-sent in full on every later step.</p>
<p>Ships <code>truncate</code>, <code>dedup</code>, <code>route</code>, <code>compose</code> reference compressors and <b>fails open</b> — a broken compressor never drops a real output.</p>
<pre class="snip">run_agent(..., compressor=truncate_compressor(max_chars=2000))</pre>
<div class="tags"><span class="tag">compressor=</span><span class="tag">fails open</span><span class="tag">prompt caching</span></div>
</div>
<div class="visual"><canvas id="c-compress" role="img" aria-label="40 KB result → compressor → 1.2 KB into the conversation"></canvas><div class="cap">40 KB result → compressor → 1.2 KB into the conversation</div></div>
</div>
</section>
<!-- 10 GRAPH -->
<section class="feature" id="f-graph">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">10</span> Handoff graphs</div>
<h2>The edge is a permission boundary</h2>
<p>Sequential multi-agent workflows where each node is one <code>run_agent</code> call with its <b>own</b> policy, tools, and budget. Per-node policy is <b>enforced, not prompted</b> — if triage tries to write, its node denies it; the orchestrator can't bypass its role.</p>
<p>And <code>denials_gt</code> routes: too many rejections escalate to a privileged node. Bounded by construction (<code>max_transitions</code>).</p>
<pre class="snip">graph = compile_graph(spec_yaml)
await run_graph(nodes, "Fix the bug", router=graph)</pre>
<div class="tags"><span class="tag">compile_graph</span><span class="tag">denials_gt</span><span class="tag">durable</span></div>
</div>
<div class="visual"><canvas id="c-graph" role="img" aria-label="triage → fixer ⇄ reviewer; repeated denials escalate"></canvas><div class="cap">triage → fixer ⇄ reviewer; repeated denials escalate</div></div>
</div>
</section>
<!-- 11 APPROVALS -->
<section class="feature" id="f-approve">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">11</span> Human-in-the-loop</div>
<h2>Pause for a human — with a deadline</h2>
<p>The <code>approve_required</code> verdict <b>blocks the run synchronously</b> and calls your handler — a CLI prompt, a Slack button, a webhook. Grant it and the action proceeds; deny it and it's refused.</p>
<p>The wait is bounded: an enforced <code>timeout_seconds</code> means a request can't hang forever. No answer in time → it <b>fails closed</b> (denied).</p>
<pre class="snip">run_agent(..., on_approval=cli_prompt_approval())
<span class="c"># or: callback_approval(slack_handler)</span></pre>
<div class="tags"><span class="tag">approve_required</span><span class="tag">cli_prompt / callback</span><span class="tag">timeout_seconds</span></div>
</div>
<div class="visual"><canvas id="c-approve" role="img" aria-label="paused → approve / deny / timed-out (fail-closed)"></canvas><div class="cap">paused → approve / deny / timed-out (fail-closed)</div></div>
</div>
</section>
<!-- 12 SINKS -->
<section class="feature" id="f-sinks">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">12</span> Streaming audit</div>
<h2>Events fan out to your sinks</h2>
<p>Every step emits <code>AuditEvent</code>s. Lynx <b>streams</b> them and <b>stores nothing</b> — <code>multi_sink</code> fans each one out concurrently to stdout, a JSONL file, a hash-chained log, OpenTelemetry spans, a webhook, whatever you wire.</p>
<p>Your sink owns the bytes: you buffer, rotate, and ship where you want. Write your own — it's just <code>async __call__(event)</code>.</p>
<pre class="snip">sink = multi_sink(stdout_sink(), jsonl_sink(f), otel_sink())
run_agent(..., sinks=(sink,))</pre>
<div class="tags"><span class="tag">multi_sink</span><span class="tag">otel_sink</span><span class="tag">jsonl_sink</span><span class="tag">callback_sink</span></div>
</div>
<div class="visual"><canvas id="c-sinks" role="img" aria-label="one event → many sinks, concurrently — Lynx keeps nothing"></canvas><div class="cap">one event → many sinks, concurrently — Lynx keeps nothing</div></div>
</div>
</section>
<!-- 13 MCP PROXY -->
<section class="feature" id="f-mcp">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">13</span> MCP proxy</div>
<h2>Govern any MCP server, zero code change</h2>
<p>Point your MCP client (Claude Desktop/Code, Cursor) at <b>Lynx instead of the server</b>. Every <code>call_tool</code> flows through the same <code>evaluate → mediate</code> path — all five verdicts, full audit stream — and a denied call <b>never reaches the upstream server</b>.</p>
<p>No rewrite on either side: the client thinks it's talking to the server.</p>
<pre class="snip">await serve_mcp_proxy("mcp-server-foo",
policy=policy, sinks=(stdout_sink(),))</pre>
<div class="tags"><span class="tag">serve_mcp_proxy</span><span class="tag">GovernedProxy</span><span class="tag">allow / deny / transform</span></div>
</div>
<div class="visual"><canvas id="c-mcp" role="img" aria-label="client → Lynx → server; denied calls stop at Lynx"></canvas><div class="cap">client → Lynx → server; denied calls stop at Lynx</div></div>
</div>
</section>
<!-- 14 MULTI-PROVIDER -->
<section class="feature" id="f-provider">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">14</span> Model adapters</div>
<h2>One policy, any model</h2>
<p>The same <code>run_agent</code> + policy governs every provider. Swap the adapter — <b>Claude</b>, <b>GPT</b>, or any OpenAI-compatible (<b>Grok, Mistral, DeepSeek, Groq, Ollama</b>) through one registry — and the policy is <b>unchanged</b>.</p>
<p>Governance lives at the tool boundary, not in the model. The model is a plug-in.</p>
<pre class="snip">agent = openai_compatible_agent("grok",
tools=tools, model="grok-2") <span class="c"># same policy, any model</span></pre>
<div class="tags"><span class="tag">ClaudeAgent</span><span class="tag">OpenAIAgent</span><span class="tag">openai_compatible_agent</span></div>
</div>
<div class="visual"><canvas id="c-provider" role="img" aria-label="swap the model adapter — the policy never changes"></canvas><div class="cap">swap the model adapter — the policy never changes</div></div>
</div>
</section>
<!-- 15 TOOLGUARD -->
<section class="feature" id="f-toolguard">
<div class="wrap">
<div class="desc">
<div class="kicker"><span class="num">15</span> Framework-native governance</div>
<h2>Your framework drives — Lynx governs</h2>
<p>When an agent <i>framework</i> owns the loop (OpenAI Agents SDK, LangChain, CrewAI, PydanticAI), drop a <code>ToolGuard</code> in front of its tool calls. <code>await guard.check(name, args)</code> runs the same <code>evaluate → mediate</code> kernel and returns a <code>GovernedCall</code> — so all five verdicts work with <b>no proxy and no rewrite</b>.</p>
<p>This is the <b>inverse of an adapter</b>: there Lynx drives the loop; here the framework drives, and Lynx governs each call inside it.</p>
<pre class="snip">guard = ToolGuard(tools=tools, policy=policy)
call = await guard.check(tool_name, args) <span class="c"># GovernedCall</span></pre>
<div class="tags"><span class="tag">ToolGuard</span><span class="tag">guard.check()</span><span class="tag">governed_function_tools</span></div>
</div>
<div class="visual"><canvas id="c-toolguard" role="img" aria-label="the framework owns the loop; Lynx checks each call inside it"></canvas><div class="cap">the framework owns the loop; Lynx checks each call inside it</div></div>
</div>
</section>
<!-- INSTALL -->
<section id="install">
<div class="wrap">
<div class="kicker">Get started</div>
<h2>Install and govern your first tool call</h2>
<p class="sub">Three dependencies. No server, no database. The <code>lynx</code> CLI ships with the core.</p>
<pre class="code">$ pip install lynx-agent
$ lynx init # writes one file: policy.yaml
$ python examples/01_hello_allow.py</pre>
<div class="chips" style="margin-top:22px">
<span class="chip"><b>lynx-agent[anthropic]</b> · Claude</span>
<span class="chip"><b>[openai]</b> · GPT + OpenAI-compatible</span>
<span class="chip"><b>[langgraph]</b> · <b>[crewai]</b> · <b>[openai-agents]</b></span>
<span class="chip"><b>[mcp]</b> · MCP proxy</span>
<span class="chip"><b>[otel]</b> · OpenTelemetry</span>
</div>
</div>
</section>
<!-- SCOPE -->
<section id="scope">
<div class="wrap">
<div class="kicker">Honest scope</div>
<h2>What it owns — and what it composes with</h2>
<p class="sub">The gaps are boundaries, not holes. Lynx owns a high-value spine and integrates with specialists for the rest.</p>
<div class="two">
<div class="listcard yes">
<h3 class="tick">✓ Lynx owns this</h3>
<ul>
<li><b>Enforcement</b> on every action — not observation after the fact</li>
<li><b>Obligations</b> — mandatory side-actions, fail-closed on the pre-gate</li>
<li><b>Human-in-the-loop</b> approvals with enforced timeouts</li>
<li><b>Durable execution</b> — crash-resume, no double side effects</li>
<li><b>Cost control</b> — token metering + caps that stop a run</li>
<li><b>Compliance-grade audit</b> — a tamper-evident evidence trail</li>
</ul>
</div>
<div class="listcard no">
<h3 class="cross">✗ Compose with a specialist</h3>
<ul>
<li><b>Prompt / content filtering</b> → NeMo Guardrails, Guardrails AI</li>
<li><b>Long-term memory</b> → mem0, Zep, Letta (gated as tools)</li>
<li><b>Dashboards</b> → Langfuse, Phoenix, Datadog (fed by a sink)</li>
<li><b>The agent's reasoning</b> → LangGraph, CrewAI</li>
<li><b>Storage & supervision</b> → your Redis/Postgres + k8s</li>
<li><b>Cluster orchestration</b> → Temporal, Inngest</li>
</ul>
</div>
</div>
</div>
</section>
<!-- FAQ -->
<section id="faq">
<div class="wrap">
<div class="kicker">FAQ</div>
<h2>Common questions</h2>
<div class="faq">
<details><summary>Is Lynx an agent framework?</summary><p>No. Lynx is the governance and safety layer for an agent loop, not the loop itself. It checks, audits, and bounds each tool call. Use it with frameworks like LangChain, CrewAI, or the OpenAI Agents SDK via <code>ToolGuard</code>, or drive a minimal stateless loop yourself with <code>run_agent</code>.</p></details>
<details><summary>Does Lynx need a database or a server?</summary><p>No. It is a pure Python library with three dependencies and no server. Audit events stream to sinks you own; durable crash-resume uses a <code>RunStore</code> you implement over your own Redis / Postgres / Dynamo. Lynx never opens a file or a connection.</p></details>
<details><summary>Which model providers are supported?</summary><p>Claude and GPT directly, plus any OpenAI-compatible provider through one registry — Grok (xAI), Mistral, DeepSeek, Groq, OpenRouter, Together, Fireworks, Perplexity, and Ollama. The <em>same policy</em> governs every model; swap the adapter, not the rules.</p></details>
<details><summary>What are the five verdicts?</summary><p>Policy is a pure function that returns exactly one verdict per action: <code>allow</code> (run it), <code>deny</code> (refuse), <code>dry_run</code> (preview via a side-effect-free shadow), <code>approve_required</code> (pause for a human with an enforced timeout), or <code>transform</code> (rewrite the arguments first). It fails closed by default.</p></details>
<details><summary>What are obligations?</summary><p>Obligations are mandatory side-actions attached to any verdict, in the XACML / AWS Cedar model. A <code>pre</code> obligation gates the action — it fails closed if the handler fails (“refund only if a scoped credential was issued”); a <code>post</code> obligation fires after (notify finance, write a special audit record). The kernel ships no handlers — you wire an <code>ObligationRegistry</code>.</p></details>
<details><summary>Does Lynx work with MCP?</summary><p>Yes. The MCP proxy sits in front of any MCP server: the client (Claude Desktop/Code, Cursor) points at Lynx instead of the server, and every <code>call_tool</code> flows through the same <code>evaluate → mediate</code> path with an audit stream — zero code change on client or server.</p></details>
<details><summary>How fast is policy evaluation?</summary><p>Roughly a microsecond. Evaluation is a pure function over immutable values with no I/O, so the governance layer adds negligible overhead to a tool call.</p></details>
</div>
</div>
</section>
<!-- FINAL CTA -->
<section style="text-align:center">
<div class="wrap">
<h2>Make every agent action safe, recoverable, and auditable.</h2>
<p class="sub" style="margin:14px auto 0">Three dependencies. Zero infrastructure. One function.</p>
<div class="cta" style="justify-content:center">
<a class="btn primary" href="https://pypi.org/project/lynx-agent/">pip install lynx-agent →</a>
<a class="btn ghost" href="https://github.com/hadihonarvar/lynx">Star on GitHub ★</a>
</div>
</div>
</section>
</main>
<footer>
<div class="wrap">
<div><span class="brand"><span class="dot"></span> Lynx</span> — policy-gated, durable, audited execution for AI agent tool calls.</div>
<div>
<a href="https://github.com/hadihonarvar/lynx">GitHub</a> ·
<a href="https://pypi.org/project/lynx-agent/">PyPI</a> ·
<a href="https://github.com/hadihonarvar/lynx/blob/main/docs/concepts.md">Docs</a> ·
<a href="mailto:hadi.work.ca@gmail.com">hadi.work.ca@gmail.com</a>
</div>
</div>
</footer>
<script>
function copyInstall(btn){
navigator.clipboard.writeText("pip install lynx-agent").then(function(){
var t = btn.textContent; btn.textContent = "Copied ✓";
setTimeout(function(){ btn.textContent = t; }, 1400);
});
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js" onload="window.__three_ok=true" onerror="window.__three_ok=false"></script>
<script>
/* ========================= palette ========================= */
const C={bg:'#0d1014',panel:'#161a21',line:'#2a323d',ink:'#e8edf4',muted:'#9aa6b6',
faint:'#6b7686',amber:'#f5a623',blue:'#5cc8ff',green:'#51d88a',red:'#ff6b6b',violet:'#b08cff'};
const SANS='600 15px system-ui,-apple-system,sans-serif';
const SANS_S='12px system-ui,-apple-system,sans-serif';
const MONO='12px ui-monospace,Menlo,monospace';
/* ========================= helpers ========================= */
function rr(ctx,x,y,w,h,r){r=Math.min(r,w/2,h/2);ctx.beginPath();
ctx.moveTo(x+r,y);ctx.arcTo(x+w,y,x+w,y+h,r);ctx.arcTo(x+w,y+h,x,y+h,r);
ctx.arcTo(x,y+h,x,y,r);ctx.arcTo(x,y,x+w,y,r);ctx.closePath();}
const lerp=(a,b,t)=>a+(b-a)*t;
const clamp=(v,a,b)=>Math.max(a,Math.min(b,v));
const ease=t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2;
function txt(ctx,s,x,y,col,font,align){ctx.fillStyle=col;ctx.font=font||SANS;
ctx.textAlign=align||'center';ctx.textBaseline='middle';ctx.fillText(s,x,y);}
function box(ctx,x,y,w,h,label,sub,col,glow){
ctx.save();
if(glow){ctx.shadowColor=col;ctx.shadowBlur=glow;}
ctx.fillStyle=C.panel;rr(ctx,x,y,w,h,11);ctx.fill();
ctx.shadowBlur=0;ctx.lineWidth=1.6;ctx.strokeStyle=col||C.line;rr(ctx,x,y,w,h,11);ctx.stroke();
txt(ctx,label,x+w/2,y+h/2-(sub?9:0),C.ink,SANS);
if(sub)txt(ctx,sub,x+w/2,y+h/2+10,C.faint,SANS_S);
ctx.restore();
}
function dot(ctx,x,y,r,col,glow){ctx.save();ctx.shadowColor=col;ctx.shadowBlur=glow==null?16:glow;
ctx.fillStyle=col;ctx.beginPath();ctx.arc(x,y,r,0,7);ctx.fill();ctx.restore();}
function arrow(ctx,x1,y1,x2,y2,col,a,w){ctx.save();ctx.globalAlpha=a==null?1:a;
ctx.strokeStyle=col;ctx.fillStyle=col;ctx.lineWidth=w||2;
ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.stroke();
const an=Math.atan2(y2-y1,x2-x1);
ctx.beginPath();ctx.moveTo(x2,y2);ctx.lineTo(x2-9*Math.cos(an-.42),y2-9*Math.sin(an-.42));
ctx.lineTo(x2-9*Math.cos(an+.42),y2-9*Math.sin(an+.42));ctx.closePath();ctx.fill();ctx.restore();}
function qbez(p0,p1,p2,t){const u=1-t;return{
x:u*u*p0.x+2*u*t*p1.x+t*t*p2.x, y:u*u*p0.y+2*u*t*p1.y+t*t*p2.y};}
/* ========================= engine ========================= */
const anims=[];
function mount(id,draw){
const c=document.getElementById(id);if(!c)return;
// default visible so the first paint never depends on an IO callback firing;
// the observer then only PAUSES canvases that scroll out of view (perf).
const o={c,ctx:c.getContext('2d'),draw,vis:true,t0:performance.now()};
anims.push(o);
new IntersectionObserver(es=>es.forEach(e=>o.vis=e.isIntersecting),{threshold:0}).observe(c);
sizeOne(o);
}
function sizeOne(o){const r=o.c.getBoundingClientRect();const dpr=Math.min(window.devicePixelRatio||1,2);
o.c.width=Math.max(1,r.width*dpr);o.c.height=Math.max(1,r.height*dpr);}
window.addEventListener('resize',()=>anims.forEach(sizeOne));
function frame(now){
for(const o of anims){
if(!o.vis)continue;
const ctx=o.ctx;
ctx.setTransform(o.c.width/600,0,0,o.c.height/420,0,0);
ctx.fillStyle=C.bg;ctx.fillRect(0,0,600,420);
try{o.draw(ctx,(now-o.t0)/1000);}catch(e){/* one bad frame never kills the rest */}
}
requestAnimationFrame(frame);
}
/* ============================================================
VISUAL 01 — the chokepoint loop
============================================================ */
function vLoop(ctx,t){
const y=200,h=58,w=104,bx=[18,170,322,474];
const cx=bx.map(x=>x+w/2);
// connecting arrows in the gaps
for(let i=0;i<3;i++)arrow(ctx,bx[i]+w,y,bx[i+1],y,C.line,1,2);
// feedback arc (result -> model)
ctx.save();ctx.strokeStyle=C.line;ctx.lineWidth=2;ctx.setLineDash([5,6]);
ctx.beginPath();ctx.moveTo(cx[3],y+h/2);
ctx.bezierCurveTo(cx[3],360,cx[0],360,cx[0],y+h/2);ctx.stroke();ctx.restore();
txt(ctx,'result fed back into the loop',300,372,C.faint,MONO);
// packet position over a 4.4s cycle across the 3 forward segments
const dur=4.4,p=(t%dur)/dur, seg=Math.min(2,Math.floor(p*3)),lp=ease((p*3)%1);
const px=lerp(cx[seg],cx[seg+1],lp), py=y;
const inGate=px>bx[1]-6&&px<bx[1]+w+6;
// boxes
box(ctx,bx[0],y-h/2,w,h,'Model','proposes',C.line,0);
box(ctx,bx[1],y-h/2,w,h,'Lynx','evaluate→mediate',C.amber,inGate?26:12);
box(ctx,bx[2],y-h/2,w,h,'Executor','your sandbox',C.line,0);
box(ctx,bx[3],y-h/2,w,h,'Result','audited',C.line,0);
// feedback packet (faint) — follows the SAME cubic path drawn above, back to Model
const fp=(t*0.22)%1, fu=1-fp;
const fx=fu*fu*fu*cx[3]+3*fu*fu*fp*cx[3]+3*fu*fp*fp*cx[0]+fp*fp*fp*cx[0];
const fy=fu*fu*fu*229+3*fu*fu*fp*360+3*fu*fp*fp*360+fp*fp*fp*229;
dot(ctx,fx,fy,3.5,C.faint,8);
// forward packet
dot(ctx,px,py,6,inGate?C.amber:C.blue,inGate?22:16);
}
/* ============================================================
VISUAL 02 — five verdicts fan-out
============================================================ */
const VERDS=[
{k:'allow',col:C.green,d:'tool runs'},
{k:'deny',col:C.red,d:'blocked'},
{k:'dry_run',col:C.blue,d:'shadow preview'},
{k:'approve',col:C.amber,d:'wait for human'},
{k:'transform',col:C.violet,d:'args rewritten'},
];
function vVerdicts(ctx,t){
const gx=30,gw=120,gh=58,gy=200;
const cys=[50,118,186,254,322];
const dur=1.7,idx=Math.floor(t/dur)%5,lp=(t%dur)/dur;
// request entering gate
const inx=clamp((lp<.18?lp/.18:1),0,1);
// lanes
for(let i=0;i<5;i++){
const v=VERDS[i],cy=cys[i],active=i===idx;
const p0={x:gx+gw,y:gy},p1={x:300,y:gy},p2={x:430,y:cy};
ctx.save();ctx.strokeStyle=active?v.col:C.line;ctx.globalAlpha=active?.9:.5;ctx.lineWidth=active?2.5:1.4;
ctx.beginPath();ctx.moveTo(p0.x,p0.y);ctx.quadraticCurveTo(p1.x,p1.y,p2.x,p2.y);ctx.stroke();ctx.restore();
box(ctx,432,cy-21,150,42,v.k,v.d,active?v.col:C.line,active?16:0);
// outcome glyph on active
if(active){
let pp, paused=false;
if(v.k==='deny'){ // reach the box, then bounce back
pp=(lp<.5?ease(lp*2):ease((1-lp)*2))*0.84;
}else if(v.k==='approve'){ // advance, HOLD for a human, then proceed
if(lp<.32)pp=ease(lp/.32)*0.52;
else if(lp<.62){pp=0.52;paused=true;}
else pp=0.52+ease((lp-.62)/.38)*0.48;
}else pp=ease(clamp(lp*1.2,0,1));
const pt=qbez(p0,p1,p2,clamp(pp,0,1));
if(paused){ // pause glyph above the waiting packet
ctx.save();ctx.fillStyle=C.amber;
ctx.fillRect(pt.x-5,pt.y-20,3,9);ctx.fillRect(pt.x+2,pt.y-20,3,9);
txt(ctx,'human',pt.x,pt.y-28,C.amber,MONO);ctx.restore();
}
dot(ctx,pt.x,pt.y,6,v.col,20);
}
}
box(ctx,gx,gy-gh/2,gw,gh,'policy','(req, ctx)',C.amber,18);
// request dot
if(inx<1)dot(ctx,lerp(-10,gx,inx),gy,5,C.blue,14);
}
/* ============================================================
VISUAL 03 — obligations (pre gate + post notify)
============================================================ */
function vOblig(ctx,t){
const y=168,h=54,w=96;
const cx={model:66,pre:206,act:346,res:516}; // box CENTERS; packet flows through them
const dur=4.4,ci=Math.floor(t/dur),fail=(ci%4===3),p=(t%dur)/dur;
const preOpen=!fail;
// links between adjacent box edges
const link=(a,b)=>arrow(ctx,a+w/2,y,b-w/2,y,C.line,1,2);
link(cx.model,cx.pre);link(cx.pre,cx.act);link(cx.act,cx.res);
// post-notify target
box(ctx,cx.act-75,330,150,40,'#finance','post: notify',C.blue,0);
// boxes
box(ctx,cx.model-w/2,y-h/2,w,h,'Model','refund req',C.line,0);
const lockCol=p<.30?C.faint:(preOpen?C.green:C.red);
box(ctx,cx.pre-w/2,y-h/2,w,h,'pre-gate',
preOpen?(p<.30?'checking…':'credential ✓'):'DENIED',lockCol,p<.34?14:(preOpen?14:20));
drawLock(ctx,cx.pre+w/2-6,y-h/2-13,p<.30?'shut':(preOpen?'open':'shut'),lockCol);
box(ctx,cx.act-w/2,y-h/2,w,h,'action',
preOpen?(p>.62?'ran ✓':'runs'):'skipped',preOpen?(p>.62?C.green:C.muted):C.line,0);
box(ctx,cx.res-w/2,y-h/2,w,h,'Result',
fail?'DENIED':(p>.88?'ok ✓':'…'),fail?C.red:(p>.88?C.green:C.line),p>.62?12:0);
txt(ctx,'pre: issue-ttl-credential (300s)',cx.pre,y+h/2+24,C.faint,MONO);
// packet motion — continuous through centers
let px,col=C.violet;
if(p<.30){px=lerp(cx.model,cx.pre,ease(p/.30));}
else if(!preOpen){px=lerp(cx.pre,cx.model,ease(clamp((p-.30)/.45,0,1)));col=C.red;}
else if(p<.62){px=lerp(cx.pre,cx.act,ease((p-.30)/.32));}
else{px=lerp(cx.act,cx.res,ease(clamp((p-.62)/.30,0,1)));col=C.green;}
dot(ctx,px,y,6,col,20);
// post bubble dropping to #finance once the action has run
if(preOpen&&p>.62){const q=ease(clamp((p-.62)/.32,0,1));
dot(ctx,lerp(cx.act,cx.act+8,q),lerp(y+h/2,330,q),5,C.blue,15);}
txt(ctx, fail?'pre obligation failed → fail-closed → the tool never runs'
:'pre cleared → action runs → post notifies #finance',
300, 398, fail?C.red:C.muted, MONO);
}
function drawLock(ctx,x,y,state,col){
ctx.save();ctx.strokeStyle=col;ctx.fillStyle=col;ctx.lineWidth=2.4;
rr(ctx,x-8,y,16,12,3);ctx.fillStyle=C.bg;ctx.fill();ctx.strokeStyle=col;rr(ctx,x-8,y,16,12,3);ctx.stroke();
ctx.beginPath();
if(state==='open')ctx.arc(x+3,y-3,6,Math.PI,Math.PI*2.1);
else ctx.arc(x,y-3,6,Math.PI,Math.PI*2);
ctx.stroke();ctx.restore();
}
/* ============================================================
VISUAL 04 — layered policy (org/team/user drop-through)
============================================================ */
function vLayers(ctx,t){
// three clearly-tinted filter bars; the gap (slot) narrows top→bottom (org loosest, user strictest)
const layers=[{name:'org', scope:'broadest', gap:168,y:78, col:C.blue, tint:'rgba(92,200,255,.14)'},
{name:'team',scope:'tightens', gap:108,y:172,col:C.amber, tint:'rgba(245,166,35,.14)'},
{name:'user',scope:'strictest', gap:60, y:266,col:C.violet, tint:'rgba(176,140,255,.16)'}];
const dur=4.6,ci=Math.floor(t/dur),p=(t%dur)/dur;
// rotate which layer denies: each layer gets a turn, plus one all-pass cycle (ci%4===3)
const denyAt = (ci%4===3) ? -1 : (ci%4);
const cxc=300;
txt(ctx,'strict_overrides_loose — any layer can tighten; the strictest wins',300,36,C.faint,MONO);
layers.forEach((L,i)=>{
const closed = denyAt===i;
const gap = closed?0:L.gap;
ctx.save();ctx.fillStyle=L.tint;ctx.strokeStyle=L.col;ctx.lineWidth=2;
rr(ctx,64,L.y,(cxc-gap/2)-64,34,7);ctx.fill();ctx.stroke(); // left slab
rr(ctx,cxc+gap/2,L.y,536-(cxc+gap/2),34,7);ctx.fill();ctx.stroke(); // right slab
ctx.restore();
// label sits ON the left slab so the bar is unmistakably a named layer
txt(ctx,L.name,82,L.y+17,L.col,SANS,'left');
txt(ctx,L.scope,520,L.y+17,C.faint,MONO,'right');
if(closed)txt(ctx,'✕ denies',cxc,L.y+17,C.red,MONO);
});
// falling request
const top=44,yEnd=348;
let by=lerp(top,yEnd,ease(p)),blocked=false;
if(denyAt>=0){const stopY=layers[denyAt].y-12; if(by>=stopY){by=stopY;blocked=true;}}
box(ctx,206,356,188,46,'Combiner', blocked?'final: DENY':'final: ALLOW', blocked?C.red:C.green, by>=348?16:0);
dot(ctx,cxc,by,7,blocked?C.red:C.green,18);
}
/* ============================================================
VISUAL 05 — budgets gauge
============================================================ */
function vBudget(ctx,t){
const dur=6.5,p=(t%dur)/dur;
const n=12, capStep=9; // budget is exhausted after the 9th step
const run=Math.min(capStep,Math.floor(p/0.70*capStep)); // how many steps have executed
const halted=p>=0.70; // once spent, the run is stopped
const consumed=run/capStep; // fraction of the token cap spent
const tok=Math.round(consumed*550);
// tokens-spent meter (consumption toward a hard ceiling — NOT a progress bar)
const gx=60,gy=78,gw=480,gh=34;
txt(ctx,'output tokens spent',gx,gy-14,C.faint,MONO,'left');
txt(ctx,tok+'k / 550k',gx+gw,gy-14,halted?C.red:C.amber,MONO,'right');
ctx.fillStyle=C.panel;rr(ctx,gx,gy,gw,gh,8);ctx.fill();
ctx.strokeStyle=C.line;ctx.lineWidth=1.5;rr(ctx,gx,gy,gw,gh,8);ctx.stroke();
const grad=ctx.createLinearGradient(gx,0,gx+gw,0);
grad.addColorStop(0,'#b98e3a');grad.addColorStop(.82,C.amber);grad.addColorStop(1,C.red);
ctx.save();rr(ctx,gx+2,gy+2,(gw-4)*consumed,gh-4,6);ctx.clip();
ctx.fillStyle=grad;ctx.fillRect(gx,gy,gw,gh);ctx.restore();
// hard cap at the right edge
ctx.strokeStyle=C.red;ctx.setLineDash([4,4]);ctx.lineWidth=2;
ctx.beginPath();ctx.moveTo(gx+gw,gy-6);ctx.lineTo(gx+gw,gy+gh+6);ctx.stroke();ctx.setLineDash([]);
txt(ctx,'hard cap',gx+gw,gy+gh+18,C.red,MONO,'right');
// planned steps: executed (amber) … then BLOCKED once the budget is gone (the rest never run)
const sy=150,sw=(gw-(n-1)*6)/n;
txt(ctx,'steps',gx,sy-12,C.faint,MONO,'left');
for(let i=0;i<n;i++){
const x=gx+i*(sw+6);
const ran=i<run, blocked=i>=capStep&&halted;
ctx.save();
ctx.fillStyle=ran?'rgba(245,166,35,.20)':'transparent';
ctx.strokeStyle=ran?C.amber:(blocked?C.red:C.line);ctx.lineWidth=1.6;
rr(ctx,x,sy,sw,30,5);ctx.fill();ctx.stroke();
if(blocked){ctx.strokeStyle=C.red;ctx.lineWidth=2;ctx.beginPath();
ctx.moveTo(x+5,sy+6);ctx.lineTo(x+sw-5,sy+24);ctx.stroke();}
ctx.restore();
}
txt(ctx,'■ executed',gx,sy+50,C.amber,MONO,'left');
txt(ctx,'✕ blocked by the cap — never runs',gx+gw,sy+50,halted?C.red:C.faint,MONO,'right');
// status — the cap stops the WHOLE run, not one action
if(halted){box(ctx,176,232,248,52,'■ run halts','steps 10–12 never execute',C.red,22);}
else txt(ctx,'budget checked between every step',300,250,C.muted,MONO);
txt(ctx,'a cap stops the whole run — the rest of the loop is blocked',300,322,C.muted,MONO);
txt(ctx,'(honest: the step that crossed the line already ran)',300,346,C.faint,MONO);
}
/* ============================================================
VISUAL 06 — durable resume
============================================================ */
function vDurable(ctx,t){
const n=6,bw=66,gap=14,x0=42,y=120;
const dur=8,p=(t%dur)*1; // seconds
// phases: write 0-3.2, crash 3.2-4, replay 4-5.8, continue 5.8-8
let phase='write';
if(p>=5.8)phase='cont';else if(p>=4)phase='replay';else if(p>=3.2)phase='crash';
const crashIdx=3;
for(let i=0;i<n;i++){
const x=x0+i*(bw+gap);
let col=C.line,fill=C.panel,lbl='step '+(i+1),sub='';
let shown=false,grey=false;
if(phase==='write'){shown=i<=Math.floor(p/3.2*n);col=shown?C.green:C.line;sub=shown?'journaled':'';}
else if(phase==='crash'){shown=i<=crashIdx;col=i<crashIdx?C.green:C.red;if(i===crashIdx){sub='½ written';}}
else if(phase==='replay'){ // completed steps 1..3 replay; step 4 is the resume point
shown=i<=crashIdx; const rl=Math.floor((p-4)/1.8*crashIdx);
if(i<crashIdx){col=i<=rl?C.faint:C.line;sub=i<=rl?'replayed':'';}
else{col=C.amber;sub='resume here';}}
else {shown=true; // continue: step 4 re-proposed, then 5,6 run fresh
if(i<crashIdx){col=C.faint;sub='replayed';}
else{const run=crashIdx+Math.floor((p-5.8)/2.2*(n-crashIdx));
if(i<=run){col=C.green;sub='ran';}else{col=C.line;sub='';}}}
if(!shown)col=C.line;
box(ctx,x,y,bw,52,lbl,sub,col,col===C.red?18:0);
if(i<n-1)arrow(ctx,x+bw,y+26,x+bw+gap,y+26,C.line,.6,1.5);
}
// crash bolt
if(phase==='crash'){const cx=x0+crashIdx*(bw+gap)+bw/2;
ctx.save();ctx.strokeStyle=C.red;ctx.lineWidth=3;ctx.shadowColor=C.red;ctx.shadowBlur=14;
ctx.beginPath();ctx.moveTo(cx,30);ctx.lineTo(cx-12,70);ctx.lineTo(cx+4,70);ctx.lineTo(cx-8,108);ctx.stroke();ctx.restore();
txt(ctx,'⚡ crash',cx,20,C.red,MONO);}
// journal store
box(ctx,210,230,180,46,'RunStore (yours)','write-ahead journal',C.blue,0);
const cap={write:'journaling each step before it runs',
crash:'process dies mid-loop',
replay:'completed steps replay — model NOT re-called',
cont:'resume at the incomplete step — no double side effects'};
const ccol={write:C.muted,crash:C.red,replay:C.amber,cont:C.green};
txt(ctx,cap[phase],300,330,ccol[phase],MONO);
txt(ctx,'two racing workers → one winner; loser exits "superseded"',300,360,C.faint,MONO);
}
/* ============================================================
VISUAL 07 — tamper-evident hash chain
============================================================ */
function vAudit(ctx,t){
const n=6,bw=70,gap=18,x0=40,y=150;
const dur=6,p=(t%dur);
// phases: write 0-2.4, tamper 2.4-3.4 (edit block 2), break 3.4-6
const tamperIdx=2;
let phase='write';if(p>=3.4)phase='break';else if(p>=2.4)phase='tamper';
for(let i=0;i<n;i++){
const x=x0+i*(bw+gap);
let col=C.green,sub='hash ✓';
if(phase==='write'){const w=Math.floor(p/2.4*n);if(i>w){col=C.line;sub='';}}
else if(phase==='tamper'){if(i===tamperIdx){col=C.red;sub='edited';}}