-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCRUSH.html
More file actions
4708 lines (4708 loc) · 284 KB
/
CRUSH.html
File metadata and controls
4708 lines (4708 loc) · 284 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 xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>CRUSH</title>
<style>
/* Default styles provided by pandoc.
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
*/
html {
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
margin: 0 auto;
max-width: 36em;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 12px;
}
h1 {
font-size: 1.8em;
}
}
@media print {
html {
background-color: white;
}
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
svg {
height: auto;
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
white-space: pre-wrap;
font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
font-size: 85%;
margin: 0;
hyphens: manual;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
border: none;
border-top: 1px solid #1a1a1a;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
#TOC li {
list-style: none;
}
#TOC ul {
padding-left: 1.3em;
}
#TOC > ul {
padding-left: 0;
}
#TOC a:not(:hover) {
text-decoration: none;
}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
/* CSS for syntax highlighting */
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
</head>
<body>
<header id="title-block-header">
<h1 class="title">CRUSH</h1>
</header>
<h1 id="crush.md---helixcode-development-guide">CRUSH.md - HelixCode
Development Guide</h1>
<p>This document contains essential information for agents working with
the HelixCode distributed AI development platform.</p>
<h2
id="constitutional-anchors-cascaded-from-constitution.md">Constitutional
anchors (cascaded from <code>CONSTITUTION.md</code>)</h2>
<h3 id="article-xi-11.9-anti-bluff-forensic-anchor">Article XI §11.9 —
Anti-Bluff Forensic Anchor</h3>
<blockquote>
<p>Verbatim user mandate: <em>“We had been in position that all tests do
execute with success and all Challenges as well, but in reality the most
of the features does not work and can’t be used! This MUST NOT be the
case and execution of tests and Challenges MUST guarantee the quality,
the completion and full usability by end users of the product!”</em></p>
<p>Operative rule: every PASS in this codebase MUST carry positive
runtime evidence captured during execution. Metadata-only /
configuration-only / absence-of-error / grep-based PASS without runtime
evidence are critical defects regardless of how green the summary line
looks. No false-success results are tolerable.</p>
</blockquote>
<h3 id="article-xii-12.1-const-042-no-secret-leak">Article XII §12.1
(CONST-042) — No-Secret-Leak</h3>
<p>No API key, token, password, certificate, or other credential may be
committed to any repository owned by HelixDevelopment or vasic-digital.
All secrets live in <code>.env</code> files (mode 0600) listed in
<code>.gitignore</code>. Any leak is a release blocker until rotated and
post-mortemed.</p>
<h3 id="article-xii-12.2-const-043-no-force-push">Article XII §12.2
(CONST-043) — No-Force-Push</h3>
<p>No force push, force-with-lease push, history rewrite, branch
deletion of <code>main</code>/<code>master</code>, or
upstream-overwriting operation may be performed without explicit,
in-conversation user approval per operation. Authorization for one push
does not extend further. Bypassing hooks / signing / protected-branch
rules also requires explicit approval.</p>
<h3
id="const-048-full-automation-coverage-mandate-cascaded-from-constitution-submodule-11.4.25">CONST-048
— Full-Automation-Coverage Mandate (cascaded from constitution submodule
§11.4.25)</h3>
<p>No feature/functionality/flow/use-case/edge-case/service/application
on any supported platform of HelixCode is deliverable until covered by
automation tests proving six invariants: (1) anti-bluff posture with
captured runtime evidence; (2) proof of working capability end-to-end on
target topology; (3) implementation matches documented promise; (4) no
open issues/bugs surfaced; (5) full documentation in sync; (6)
four-layer test floor. Coverage ledger regenerated at release-gate. See
constitution submodule <code>Constitution.md</code> §11.4.25 for the
full mandate.</p>
<h3
id="const-049-constitution-submodule-update-workflow-mandate-cascaded-from-constitution-submodule-11.4.26">CONST-049
— Constitution-Submodule Update Workflow Mandate (cascaded from
constitution submodule §11.4.26)</h3>
<p>Before any modification to
<code>constitution/{Constitution,CLAUDE,AGENTS}.md</code>: (1) fetch +
pull first; (2) apply with §11.4.17 classification + verbatim mandate;
(3) validate; (4) commit + push to EVERY configured upstream; (5)
resolve conflicts preserving union — force-push forbidden; (6) cascade
verification (CONST-047); (7) bump <code>.gitmodules</code> pointer in
SAME commit. See constitution submodule <code>Constitution.md</code>
§11.4.26 for the full mandate.</p>
<h3
id="const-050-no-fakes-beyond-unit-tests-100-test-type-coverage-mandate-cascaded-from-constitution-submodule-11.4.27">CONST-050
— No-Fakes-Beyond-Unit-Tests + 100%-Test-Type-Coverage Mandate (cascaded
from constitution submodule §11.4.27)</h3>
<p><strong>(A)</strong> Mocks/stubs/fakes/placeholders/TODOs/FIXMEs/“for
now”/empty-implementation patterns PERMITTED only in unit-test sources;
non-unit tests MUST exercise the real, fully implemented system.
Production code MUST NOT import <code>helix_code/internal/mocks/</code>.
<strong>(B)</strong> 100% test-type coverage: unit + integration + E2E +
full-automation + security + DDoS + scaling + chaos + stress +
performance + benchmarking + UI + UX + Challenges
(vasic-digital/Challenges submodule at <code>./challenges/</code>) +
helix_qa (HelixDevelopment/HelixQA submodule at
<code>./helix_qa/</code>, with full autonomous QA sessions). See
constitution submodule <code>Constitution.md</code> §11.4.27 for the
full mandate.</p>
<h3
id="const-051-submodules-as-equal-codebase-decoupling-dependency-layout-mandate-cascaded-from-constitution-submodule-11.4.28">CONST-051
— Submodules-As-Equal-Codebase + Decoupling + Dependency-Layout Mandate
(cascaded from constitution submodule §11.4.28)</h3>
<p><strong>(A)</strong> Every owned-by-us submodule (orgs:
vasic-digital, HelixDevelopment, red-elf, ATMOSphere1234321, Bear-Suite,
BoatOS123456, Helix-Flow, Helix-Track, Server-Factory — dynamically
discoverable via gh/glab) is an EQUAL part of HelixCode’s codebase. Same
engineering attention as main (analysis, tests, gap-fill, bug-fix,
docs/diagrams/SQL/website materials). <strong>(B)</strong> Submodules
MUST stay fully decoupled — NEVER inject HelixCode-specific context; use
configuration injection when needed. <strong>(C)</strong> Dependencies
of owned submodules MUST live at HelixCode root
(<code><root>/<name>/</code> or
<code><root>/submodules/<name>/</code>); nested own-org
submodule chains FORBIDDEN. Third-party submodules exempt. See
constitution submodule <code>Constitution.md</code> §11.4.28 for the
full mandate.</p>
<h2 id="project-overview">Project Overview</h2>
<p>HelixCode is an enterprise-grade distributed AI development platform
built in Go that enables intelligent task division, work preservation,
and cross-platform development workflows. It features:</p>
<ul>
<li><strong>Distributed Computing</strong>: SSH-based worker pools with
automatic management and health monitoring</li>
<li><strong>Multi-Provider LLM Integration</strong>: Support for
Llama.cpp, Ollama, OpenAI, Anthropic, Gemini, Qwen, xAI, OpenRouter,
GitHub Copilot, and more</li>
<li><strong>Development Workflows</strong>: Automated planning,
building, testing, refactoring, debugging, and deployment workflows</li>
<li><strong>Task Management</strong>: Intelligent task division with
dependency tracking, checkpointing, and automatic rollback</li>
<li><strong>MCP Protocol</strong>: Full Model Context Protocol
implementation with multi-transport support</li>
<li><strong>Multi-Client Architecture</strong>: REST API, CLI, Terminal
UI, WebSocket, mobile, and specialized platform support</li>
</ul>
<h2 id="project-structure">Project Structure</h2>
<pre><code>helix_code/
├── cmd/ # Application entry points
│ ├── server/ # Main HTTP server
│ ├── cli/ # CLI client
│ ├── tui/ # Terminal UI
│ └── desktop/ # Desktop client
├── internal/ # Internal packages (not importable externally)
│ ├── auth/ # Authentication & authorization
│ ├── worker/ # Worker pool & SSH management
│ ├── task/ # Task management & checkpoints
│ ├── llm/ # LLM provider implementations
│ ├── mcp/ # MCP protocol
│ ├── workflow/ # Workflow engine
│ ├── project/ # Project management
│ ├── session/ # Session tracking
│ ├── notification/ # Notification channels
│ ├── hardware/ # Hardware detection
│ ├── server/ # HTTP server & routes
│ ├── database/ # Database layer
│ ├── redis/ # Redis client
│ ├── config/ # Configuration management
│ ├── tools/ # Development tools
│ ├── editor/ # Code editing interfaces
│ ├── agent/ # AI agent coordination
│ ├── context/ # Context building
│ ├── focus/ # Focus management
│ ├── hooks/ # System hooks
│ ├── memory/ # Memory management
│ ├── persistence/ # Data persistence
│ ├── repomap/ # Repository mapping
│ ├── rules/ # Rule system
│ ├── template/ # Template system
│ ├── discovery/ # Service discovery
│ ├── event/ # Event bus
│ ├── commands/ # Command system
│ └── logo/ # Logo processing
├── applications/ # Platform-specific applications
│ ├── desktop/ # Desktop app (Fyne)
│ ├── terminal-ui/ # TUI app (tview)
│ ├── ios/ # iOS app
│ ├── android/ # Android app
│ ├── aurora-os/ # Aurora OS client
│ └── harmony-os/ # Harmony OS client
├── config/ # Configuration files
├── scripts/ # Build and utility scripts
├── tests/ # Test suites and frameworks
├── docker/ # Docker configurations
├── docs/ # Documentation
├── examples/ # Example usage
├── assets/ # Static assets
├── shared/ # Shared mobile code
└── mobile/ # Mobile-specific code</code></pre>
<h2 id="essential-build-commands">Essential Build Commands</h2>
<h3 id="development">Development</h3>
<div class="sourceCode" id="cb2"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> HelixCode</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Build main application</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> build <span class="co"># Builds to bin/helixcode</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="co"># Development server</span></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> dev <span class="co"># Build and run with dev config</span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a><span class="co"># Generate assets (logo, themes)</span></span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> logo-assets</span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a><span class="co"># Setup development environment</span></span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> dev-setup <span class="co"># Install dependencies and setup</span></span></code></pre></div>
<h3 id="testing">Testing</h3>
<div class="sourceCode" id="cb3"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Run all tests</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> test</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Run comprehensive test suite</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./scripts/run-tests.sh</span> all</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Run specific test types</span></span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a><span class="ex">./scripts/run-tests.sh</span> unit <span class="co"># Unit tests only</span></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a><span class="ex">./scripts/run-tests.sh</span> integration <span class="co"># Integration tests only</span></span>
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a><span class="ex">./scripts/run-tests.sh</span> e2e <span class="co"># End-to-end tests only</span></span>
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a><span class="ex">./scripts/run-tests.sh</span> coverage <span class="co"># Generate coverage report</span></span>
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-13"><a href="#cb3-13" aria-hidden="true" tabindex="-1"></a><span class="co"># Performance tests</span></span>
<span id="cb3-14"><a href="#cb3-14" aria-hidden="true" tabindex="-1"></a><span class="ex">./scripts/run-tests.sh</span> performance</span>
<span id="cb3-15"><a href="#cb3-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-16"><a href="#cb3-16" aria-hidden="true" tabindex="-1"></a><span class="co"># Test specific packages</span></span>
<span id="cb3-17"><a href="#cb3-17" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> test <span class="at">-v</span> ./internal/auth/</span>
<span id="cb3-18"><a href="#cb3-18" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> test <span class="at">-v</span> ./internal/worker/</span>
<span id="cb3-19"><a href="#cb3-19" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> test <span class="at">-cover</span> ./...</span></code></pre></div>
<h3 id="code-quality">Code Quality</h3>
<div class="sourceCode" id="cb4"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Format code</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> fmt</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Lint code</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> lint</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Clean build artifacts</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> clean</span></code></pre></div>
<h3 id="production-builds">Production Builds</h3>
<div class="sourceCode" id="cb5"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Cross-platform builds</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> prod <span class="co"># Build for Linux, macOS, Windows</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Mobile bindings</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> mobile-ios <span class="co"># Build iOS framework</span></span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> mobile-android <span class="co"># Build Android AAR</span></span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> mobile <span class="co"># Build all mobile bindings</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a><span class="co"># Specialized platforms</span></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> aurora-os <span class="co"># Build Aurora OS client</span></span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> harmony-os <span class="co"># Build Harmony OS client</span></span>
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> aurora-harmony <span class="co"># Build both specialized platforms</span></span>
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a><span class="co"># Full release build</span></span>
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> release <span class="co"># Clean + assets + docs + build + test</span></span></code></pre></div>
<h2 id="configuration-management">Configuration Management</h2>
<h3 id="primary-configuration">Primary Configuration</h3>
<p>Main configuration at <code>config/config.yaml</code> with
environment variable overrides:</p>
<div class="sourceCode" id="cb6"><pre
class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">server</span><span class="kw">:</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">address</span><span class="kw">:</span><span class="at"> </span><span class="st">"0.0.0.0"</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">port</span><span class="kw">:</span><span class="at"> </span><span class="dv">8080</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="fu">database</span><span class="kw">:</span></span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">host</span><span class="kw">:</span><span class="at"> </span><span class="st">"localhost"</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">port</span><span class="kw">:</span><span class="at"> </span><span class="dv">5432</span></span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">dbname</span><span class="kw">:</span><span class="at"> </span><span class="st">"helixcode"</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a><span class="co"> # Password via HELIX_DATABASE_PASSWORD</span></span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a><span class="fu">auth</span><span class="kw">:</span></span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a><span class="co"> # JWT secret via HELIX_AUTH_JWT_SECRET</span></span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">token_expiry</span><span class="kw">:</span><span class="at"> </span><span class="dv">86400</span></span>
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">session_expiry</span><span class="kw">:</span><span class="at"> </span><span class="dv">604800</span></span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a><span class="fu">workers</span><span class="kw">:</span></span>
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">health_check_interval</span><span class="kw">:</span><span class="at"> </span><span class="dv">30</span></span>
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">max_concurrent_tasks</span><span class="kw">:</span><span class="at"> </span><span class="dv">10</span></span>
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a><span class="fu">tasks</span><span class="kw">:</span></span>
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">max_retries</span><span class="kw">:</span><span class="at"> </span><span class="dv">3</span></span>
<span id="cb6-22"><a href="#cb6-22" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">checkpoint_interval</span><span class="kw">:</span><span class="at"> </span><span class="dv">300</span></span>
<span id="cb6-23"><a href="#cb6-23" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-24"><a href="#cb6-24" aria-hidden="true" tabindex="-1"></a><span class="fu">llm</span><span class="kw">:</span></span>
<span id="cb6-25"><a href="#cb6-25" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">default_provider</span><span class="kw">:</span><span class="at"> </span><span class="st">"local"</span></span>
<span id="cb6-26"><a href="#cb6-26" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">max_tokens</span><span class="kw">:</span><span class="at"> </span><span class="dv">4096</span></span>
<span id="cb6-27"><a href="#cb6-27" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">temperature</span><span class="kw">:</span><span class="at"> </span><span class="fl">0.7</span></span></code></pre></div>
<h3 id="environment-variables">Environment Variables</h3>
<p><strong>Required for Production:</strong></p>
<div class="sourceCode" id="cb7"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_DATABASE_PASSWORD</span><span class="op">=</span><span class="st">"your_secure_password"</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_AUTH_JWT_SECRET</span><span class="op">=</span><span class="st">"your_jwt_secret"</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_REDIS_PASSWORD</span><span class="op">=</span><span class="st">"your_redis_password"</span> <span class="co"># if Redis enabled</span></span></code></pre></div>
<p><strong>LLM Provider Keys:</strong></p>
<div class="sourceCode" id="cb8"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Free providers (optional for higher limits)</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">GITHUB_TOKEN</span><span class="op">=</span><span class="st">"ghp_your_github_token"</span> <span class="co"># GitHub Copilot</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">OPENROUTER_API_KEY</span><span class="op">=</span><span class="st">"sk-or-your-key"</span> <span class="co"># OpenRouter</span></span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">XAI_API_KEY</span><span class="op">=</span><span class="st">"xai-your-key"</span> <span class="co"># XAI/Grok</span></span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a><span class="co"># Premium providers</span></span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">ANTHROPIC_API_KEY</span><span class="op">=</span><span class="st">"sk-ant-your-key"</span> <span class="co"># Anthropic Claude</span></span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">GEMINI_API_KEY</span><span class="op">=</span><span class="st">"your-gemini-key"</span> <span class="co"># Google Gemini</span></span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">OPENAI_API_KEY</span><span class="op">=</span><span class="st">"sk-your-openai-key"</span> <span class="co"># OpenAI</span></span></code></pre></div>
<p><strong>Notification Channels:</strong></p>
<div class="sourceCode" id="cb9"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_SLACK_WEBHOOK_URL</span><span class="op">=</span><span class="st">"https://hooks.slack.com/..."</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_TELEGRAM_BOT_TOKEN</span><span class="op">=</span><span class="st">"your_bot_token"</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_TELEGRAM_CHAT_ID</span><span class="op">=</span><span class="st">"your_chat_id"</span></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_EMAIL_SMTP_SERVER</span><span class="op">=</span><span class="st">"smtp.gmail.com"</span></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_EMAIL_USERNAME</span><span class="op">=</span><span class="st">"your_email"</span></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_EMAIL_PASSWORD</span><span class="op">=</span><span class="st">"your_app_password"</span></span></code></pre></div>
<h2 id="code-style-patterns">Code Style & Patterns</h2>
<h3 id="go-conventions">Go Conventions</h3>
<p><strong>Language Version:</strong> Go 1.24.0 (toolchain go1.24.9)
<strong>Module:</strong> <code>dev.helix.code</code></p>
<p><strong>Naming Conventions:</strong> - <strong>Types</strong>:
PascalCase for exported, camelCase for unexported -
<strong>Functions</strong>: PascalCase for exported, camelCase for
unexported - <strong>Variables</strong>: camelCase, descriptive names -
<strong>Constants</strong>: PascalCase, grouped by functionality -
<strong>Interfaces</strong>: Simple capability names (Provider,
Repository, Manager)</p>
<p><strong>Import Organization:</strong> 1. Standard library imports 2.
Third-party imports 3. Internal imports (dev.helix.code/internal/…) 4.
Blank line between groups</p>
<p><strong>Error Handling:</strong> - Return errors with context using
<code>fmt.Errorf("failed to X: %v", err)</code> - Check errors
immediately after operations - Use package-level error variables:
<code>ErrInvalidCredentials</code> - Structured error responses in HTTP
handlers</p>
<h3 id="architectural-patterns">Architectural Patterns</h3>
<p><strong>Interface-Driven Design:</strong> - Core interfaces define
contracts (Provider, Repository, Manager) - Multiple implementations per
interface (various LLM providers) - Factory pattern for provider
creation - Easy mocking for unit tests</p>
<p><strong>Dependency Injection:</strong> - Constructor injection:
<code>NewService(config Config, repo Repository)</code> -
Configuration-based service initialization - Clean separation between
layers</p>
<p><strong>Manager Pattern:</strong> - Centralized managers
(TaskManager, WorkerManager, ProviderManager) - Thread-safe operations
with <code>sync.RWMutex</code> - Encapsulate complex business logic</p>
<p><strong>Repository Pattern:</strong> - Data access abstraction via
interfaces - Database-agnostic implementations - Redis caching
integrated transparently</p>
<h2 id="testing-patterns">Testing Patterns</h2>
<h3 id="test-structure">Test Structure</h3>
<p><strong>File Organization:</strong> - Test files alongside source:
<code>auth_test.go</code> next to <code>auth.go</code> - Comprehensive
test coverage required - Separate test packages for complex
scenarios</p>
<p><strong>Test Patterns:</strong> - Table-driven tests for multiple
scenarios - Subtests with
<code>t.Run("name", func(t *testing.T) {...})</code> - Setup/teardown
with helper functions - Mock implementations using
<code>testify/mock</code></p>
<p><strong>Assertions:</strong></p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode go"><code class="sourceCode go"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>require<span class="op">.</span>NoError<span class="op">(</span>t<span class="op">,</span> err<span class="op">)</span> # Critical operations</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a>assert<span class="op">.</span>Equal<span class="op">(</span>t<span class="op">,</span> expected<span class="op">,</span> actual<span class="op">)</span> # Value comparisons</span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>assert<span class="op">.</span>Contains<span class="op">(</span>t<span class="op">,</span> result<span class="op">,</span> substring<span class="op">)</span> # String contains</span></code></pre></div>
<p><strong>Mock Usage:</strong> - Interface-based mocking for isolation
- <code>mock.Mock</code> for behavior verification - Test doubles for
external dependencies</p>
<h3 id="test-categories">Test Categories</h3>
<p><strong>Unit Tests:</strong> - Fast, isolated tests for individual
functions - Mock all external dependencies - Tagged with
<code>unit</code> build tag</p>
<p><strong>Integration Tests:</strong> - Test interaction between
components - Use real databases/Redis in Docker - Tagged with
<code>integration</code> build tag</p>
<p><strong>End-to-End Tests:</strong> - Full workflow testing - Docker
Compose test environment - Mock external services (LLM providers) -
Tagged with <code>e2e</code> build tag</p>
<h2 id="database-setup">Database Setup</h2>
<h3 id="postgresql">PostgreSQL</h3>
<div class="sourceCode" id="cb11"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Create database and user</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="ex">createdb</span> helixcode</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="ex">createuser</span> helixcode</span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a><span class="co"># Set password via environment variable</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">HELIX_DATABASE_PASSWORD</span><span class="op">=</span>your_password</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a><span class="co"># Schema is automatically created by the application</span></span></code></pre></div>
<h3 id="key-tables">Key Tables</h3>
<ul>
<li><code>users</code> - User authentication and profiles</li>
<li><code>workers</code> - Worker node registration and status</li>
<li><code>tasks</code> - Task management and state</li>
<li><code>projects</code> - Project metadata and sessions</li>
<li><code>sessions</code> - User session tracking</li>
<li><code>llm_providers</code> - LLM provider configurations</li>
<li><code>notifications</code> - Notification rules and history</li>
</ul>
<h2 id="cli-usage">CLI Usage</h2>
<h3 id="build-cli">Build CLI</h3>
<div class="sourceCode" id="cb12"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> HelixCode</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> build <span class="at">-o</span> bin/cli ./cmd/cli</span></code></pre></div>
<h3 id="common-commands">Common Commands</h3>
<div class="sourceCode" id="cb13"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Interactive mode</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./bin/cli</span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Worker management</span></span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./bin/cli</span> <span class="at">--list-workers</span></span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a><span class="ex">./bin/cli</span> <span class="at">--worker</span> worker-host <span class="at">--user</span> helix <span class="at">--key</span> ~/.ssh/id_rsa</span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a><span class="co"># AI-powered generation</span></span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a><span class="ex">./bin/cli</span> <span class="at">--prompt</span> <span class="st">"Hello world"</span> <span class="at">--model</span> llama-3-8b <span class="at">--max-tokens</span> 1000</span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a><span class="co"># Notifications</span></span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a><span class="ex">./bin/cli</span> <span class="at">--notify</span> <span class="st">"Build complete"</span> <span class="at">--notify-type</span> <span class="st">"success"</span></span>
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a><span class="co"># Health check</span></span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a><span class="ex">./bin/cli</span> <span class="at">--health</span></span></code></pre></div>
<h2 id="ai-provider-integration">AI Provider Integration</h2>
<h3 id="free-providers-no-api-key-required">Free Providers (No API Key
Required)</h3>
<p><strong>XAI (Grok):</strong></p>
<div class="sourceCode" id="cb14"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="ex">helixcode</span> llm provider set xai</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Models: grok-3-fast-beta, grok-3-mini-fast-beta, grok-3-beta</span></span></code></pre></div>
<p><strong>OpenRouter:</strong></p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">helixcode</span> llm provider set openrouter</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Models: deepseek-r1-free, meta-llama/llama-3.2-3b-instruct:free</span></span></code></pre></div>
<p><strong>GitHub Copilot:</strong></p>
<div class="sourceCode" id="cb16"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">GITHUB_TOKEN</span><span class="op">=</span><span class="st">"ghp_your_github_token"</span></span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a><span class="ex">helixcode</span> llm provider set copilot</span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Models: gpt-4o, claude-3.5-sonnet, claude-3.7-sonnet, o1, gemini-2.0-flash</span></span></code></pre></div>
<h3 id="premium-providers">Premium Providers</h3>
<p><strong>Anthropic Claude (Extended Thinking &
Caching):</strong></p>
<div class="sourceCode" id="cb17"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">ANTHROPIC_API_KEY</span><span class="op">=</span><span class="st">"sk-ant-your-key"</span></span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="ex">helixcode</span> llm provider set anthropic <span class="at">--model</span> claude-4-sonnet</span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Features: Extended thinking, prompt caching, 200K context, 50K output</span></span></code></pre></div>
<p><strong>Google Gemini (2M Token Context):</strong></p>
<div class="sourceCode" id="cb18"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">GEMINI_API_KEY</span><span class="op">=</span><span class="st">"your-gemini-key"</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a><span class="ex">helixcode</span> llm provider set gemini <span class="at">--model</span> gemini-2.5-pro</span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Features: 2M token context, multimodal, function calling</span></span></code></pre></div>
<h2 id="important-gotchas-patterns">Important Gotchas &
Patterns</h2>
<h3 id="ssh-worker-auto-install">SSH Worker Auto-Install</h3>
<ul>
<li>When adding workers via SSH, the system automatically installs the
Helix CLI binary on remote machines</li>
<li>Requires SSH key-based authentication</li>
<li>Workers are health-checked every 30s by default</li>
</ul>
<h3 id="task-checkpointing">Task Checkpointing</h3>
<ul>
<li>Long-running tasks automatically checkpoint at configured intervals
(default 300s)</li>
<li>Enables work preservation and recovery from failures</li>
<li>Checkpoints stored in PostgreSQL for persistence</li>
</ul>
<h3 id="provider-fallback">Provider Fallback</h3>
<ul>
<li>LLM requests can fall back to alternative providers if the primary
fails</li>
<li>Configurable provider priority and retry logic</li>
<li>Automatic rate limiting and quota management</li>
</ul>
<h3 id="session-context">Session Context</h3>
<ul>
<li>Development sessions maintain context across interactions for
continuity</li>
<li>Context stored in Redis for fast access</li>
<li>Automatic cleanup of expired sessions</li>
</ul>
<h3 id="mcp-protocol">MCP Protocol</h3>
<ul>
<li>Supports both stdio and SSE transports for Model Context
Protocol</li>
<li>Tool integration and execution through standardized interface</li>
<li>Real-time bidirectional communication</li>
</ul>
<h3 id="mobile-specialized-platforms">Mobile & Specialized
Platforms</h3>
<ul>
<li>Gomobile bindings for iOS/Android applications</li>
<li>Aurora OS (Russian platform) and Harmony OS (Chinese platform)
support</li>
<li>Cross-platform UI with Fyne framework</li>
</ul>
<h2 id="development-workflow">Development Workflow</h2>
<h3 id="before-making-changes">Before Making Changes</h3>
<ol type="1">
<li>Read existing code in the relevant package</li>
<li>Check for similar patterns in other packages</li>
<li>Run tests to ensure baseline functionality</li>
<li>Make incremental changes with tests</li>
</ol>
<h3 id="after-changes">After Changes</h3>
<ol type="1">
<li>Run <code>make test</code> to ensure all tests pass</li>
<li>Run <code>make fmt</code> and <code>make lint</code> for code
quality</li>
<li>Test specific functionality with targeted tests</li>
<li>Update documentation if needed</li>
</ol>
<h3 id="commit-process">Commit Process</h3>
<ol type="1">
<li>Use conventional commit messages</li>
<li>Include tests for new functionality</li>
<li>Update relevant documentation</li>
<li>Ensure CI/CD pipeline would pass</li>
</ol>
<h2 id="dependencies">Dependencies</h2>
<h3 id="core-dependencies">Core Dependencies</h3>
<ul>
<li><code>github.com/gin-gonic/gin</code>: HTTP framework</li>
<li><code>github.com/jackc/pgx/v5</code>: PostgreSQL driver</li>
<li><code>github.com/golang-jwt/jwt/v4</code>: JWT authentication</li>
<li><code>github.com/spf13/viper</code>: Configuration management</li>
<li><code>github.com/gorilla/websocket</code>: WebSocket support</li>
<li><code>golang.org/x/crypto/ssh</code>: SSH client for workers</li>
<li><code>github.com/google/uuid</code>: UUID generation</li>
<li><code>github.com/stretchr/testify</code>: Testing framework</li>
</ul>
<h3 id="ui-frameworks">UI Frameworks</h3>
<ul>
<li><code>fyne.io/fyne/v2</code>: Desktop GUI framework</li>
<li><code>github.com/rivo/tview</code>: Terminal UI framework</li>
</ul>
<h3 id="external-integrations">External Integrations</h3>
<ul>
<li>AWS SDK v2: Bedrock integration</li>
<li>Azure SDK: Azure AI services</li>
<li>Chromedp: Browser automation</li>
<li>Go-Redis: Redis client</li>
</ul>
<h2 id="cross-platform-support">Cross-Platform Support</h2>
<p><strong>Standard Platforms:</strong> - Linux (amd64, arm64) - macOS
(amd64, arm64) - Windows (amd64)</p>
<p><strong>Mobile Platforms:</strong> - iOS (via gomobile) - Android
(via gomobile)</p>
<p><strong>Specialized Platforms:</strong> - Aurora OS (Russian
platform) - Harmony OS (Chinese platform)</p>
<h2 id="code-generation-assets">Code Generation & Assets</h2>
<h3 id="logo-assets">Logo Assets</h3>
<div class="sourceCode" id="cb19"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Generate logo assets and themes</span></span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> logo-assets</span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Manual generation</span></span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> scripts/logo <span class="kw">&&</span> <span class="ex">go</span> run generate_assets.go</span></code></pre></div>
<p>This extracts colors and creates themed variations of the logo for
different platforms and use cases.</p>
<h2 id="monitoring-observability">Monitoring & Observability</h2>
<h3 id="health-checks">Health Checks</h3>
<ul>
<li>Application health endpoint: <code>/health</code></li>
<li>Worker health monitoring</li>
<li>Database connectivity checks</li>
<li>External service availability</li>
</ul>
<h3 id="metrics">Metrics</h3>
<ul>
<li>Prometheus metrics endpoint: <code>/metrics</code></li>
<li>Task execution statistics</li>
<li>Worker performance metrics</li>
<li>LLM provider response times</li>
<li>Resource usage tracking</li>
</ul>
<h3 id="logging">Logging</h3>
<ul>
<li>Structured logging with levels</li>
<li>Contextual information in logs</li>
<li>Integration with external logging systems</li>
<li>Security event logging</li>
</ul>
<h2 id="security-considerations">Security Considerations</h2>
<ul>
<li>JWT-based authentication with configurable expiry</li>
<li>Password hashing with bcrypt</li>
<li>SSH key-based worker authentication</li>
<li>Environment variable configuration (no secrets in code)</li>
<li>Rate limiting on API endpoints</li>
<li>Input validation and sanitization</li>
<li>HTTPS enforcement in production</li>
</ul>
<h2 id="performance-optimization">Performance Optimization</h2>
<h3 id="database">Database</h3>
<ul>
<li>Connection pooling with pgx</li>
<li>Query optimization and indexing</li>
<li>Prepared statements for repeated queries</li>
<li>Read replica support for scaling</li>
</ul>
<h3 id="caching">Caching</h3>
<ul>
<li>Redis for session and task state</li>
<li>LLM response caching with TTL</li>
<li>Static asset caching</li>
<li>Database query result caching</li>
</ul>
<h3 id="concurrency">Concurrency</h3>
<ul>
<li>Goroutine pools for task execution</li>
<li>Channel-based communication</li>
<li>Mutex protection for shared state</li>
<li>Context-based cancellation</li>
</ul>
<p>This guide provides the essential information needed for effective
development in the HelixCode codebase. Follow these patterns and
conventions to maintain consistency and quality across the platform.</p>
<h3
id="const-052-lowercase-snake_case-naming-mandate-cascaded-from-constitution-submodule-11.4.29">CONST-052
— Lowercase-Snake_Case-Naming Mandate (cascaded from constitution
submodule §11.4.29)</h3>
<p>Every directory/submodule/file MUST use lowercase snake_case names.
Existing non-compliant names MUST be renamed atomically with updates to
all references (configs, docs, source-code imports, governance files).
Common-sense exceptions: language-mandated case
(Java/Kotlin/Android/Apple/C#/Swift) inside language-root, vendor
third-party submodules, build artefacts. <code>upstreams/</code> →
<code>upstreams/</code> transition: <code>install_upstreams.sh</code>
supports BOTH directory names during migration. Phased execution; each
rename batch ships with (i) reference-resolution regression test, (ii)
full CONST-050(B) test-type matrix run, (iii) anti-bluff wire-evidence.
See root <code>CONSTITUTION.md</code> §CONST-052 and constitution
submodule <code>Constitution.md</code> §11.4.29 for the full
mandate.</p>
<h2
id="const-053-.gitignore-no-versioned-build-artifacts-mandate-cascaded-from-constitution-submodule-11.4.30">CONST-053:
.gitignore + No-Versioned-Build-Artifacts Mandate (cascaded from
constitution submodule §11.4.30)</h2>
<blockquote>
<p>Verbatim user mandate (2026-05-15): <em>“every project module, every
Submodule, every servcie and apolication MUST HAVE proper .gitignore
file! We MUST NOT git version build artifacts, cache files, tmp files,
main .env file(s) or any files containing sensitive data, API keys or
token! Any build derivate which we can recreate by executing proper
mechanism for generating MUST NOT be versioned! We MUST pay attention
what is going to be commited every time we are preparing to execute
commit! If any violetion is detected it MUST be fixed before commit is
executed!”</em></p>
</blockquote>
<p>Every project module, owned-by-us submodule, service, and application
MUST ship a proper <code>.gitignore</code>.
Forbidden-from-version-control classes:</p>
<ol type="1">
<li><strong>Build artefacts</strong>: <code>/bin/</code>,
<code>/build/</code>, <code>/dist/</code>, <code>/out/</code>,
<code>target/</code>, <code>*.exe</code>, <code>*.dll</code>,
<code>*.so</code>, <code>*.dylib</code>, <code>*.a</code>,
<code>*.o</code>, <code>*.class</code>, <code>*.pyc</code>,
generator-produced files when the generator is committed.</li>
<li><strong>Cache files</strong>: <code>__pycache__/</code>,
<code>.pytest_cache/</code>, <code>.mypy_cache/</code>,
<code>.ruff_cache/</code>, <code>node_modules/</code>,
<code>.next/</code>, <code>.cache/</code>, <code>.gradle/</code>,
<code>.terraform/</code>, language-server caches.</li>
<li><strong>Temp files</strong>: <code>*.tmp</code>, <code>*.swp</code>,
<code>*~</code>, <code>.DS_Store</code>, <code>Thumbs.db</code>,
<code>*.orig</code>, <code>*.rej</code>.</li>
<li><strong>Sensitive-data files</strong>: <code>.env</code>,
<code>.env.*</code> (allow <code>.env.example</code> placeholder only —
no real secrets even as examples), <code>*.pem</code>,
<code>*.key</code>, <code>*.crt</code>, <code>id_rsa*</code>,
<code>id_ed25519*</code>, <code>.netrc</code>, <code>secrets/</code>,
<code>api_keys.sh</code>.</li>
<li><strong>Generated reports/logs</strong>: <code>*.log</code>,
<code>coverage.out</code>, <code>htmlcov/</code>, runtime captures
unless reference assets.</li>
<li><strong>OS/IDE personal state</strong>: <code>.idea/</code>,
<code>.history/</code>, <code>.vscode/</code> (except shared
settings).</li>
</ol>
<p><strong>Anti-bluff invariant</strong>: <code>.gitignore</code> line
alone is not sufficient — no file matching the forbidden patterns may be
CURRENTLY TRACKED. A tracked <code>*.log</code> despite the ignore-line
is a violation of equal severity to no ignore-line at all.</p>
<p><strong>Pre-commit attention</strong>: every commit author (human OR
agent) MUST inspect <code>git diff --staged</code> +
<code>git status</code> BEFORE executing the commit. Forbidden-class
hits abort the commit until fixed (un-stage, add to
<code>.gitignore</code>, scrub if already-tracked). Gate
<code>CM-GITIGNORE-PRECOMMIT-AUDIT</code> + paired mutation.</p>
<p><strong>Secret-leak intersection (CONST-042 / §11.4.10):</strong> a
<code>.env</code> leak is BOTH a CONST-053 and a CONST-042 violation;
rotation + post-mortem required.</p>
<p><strong>Recreatable-content test</strong>: if a documented mechanism
regenerates the file from sources, it is a build derivative and MUST be
ignored. The committed sources MUST include the generator.</p>
<p><strong>Cascade requirement:</strong> This anchor (verbatim or by
<code>CONST-053</code> ID reference) MUST appear in every owned
submodule’s <code>CONSTITUTION.md</code>, <code>CLAUDE.md</code>, and
<code>AGENTS.md</code>. Severity-equivalent to a §11.4 PASS-bluff at the
repository-hygiene layer. See constitution submodule
<code>Constitution.md</code> §11.4.30 for the full mandate.</p>
<h2
id="const-054-submodule-dependency-manifest-mandate-cascaded-from-constitution-submodule-11.4.31">CONST-054:
Submodule-Dependency-Manifest Mandate (cascaded from constitution
submodule §11.4.31)</h2>
<blockquote>
<p>Verbatim user mandate (2026-05-15): <em>“We MUST HAVE mechanism for
each Submodule to determine / know what are its Submodule dependencies
so new projects or palces we are incorporate them can add these
Submodules to the project root and make them available! Suggested idea
is configuration file with expected Submodules Git ssh urls perhaps? New
project can read it, and recursively add each Submodule to the root of
the project and install / expose it to veryone.”</em></p>
</blockquote>
<p>Every owned-by-us submodule MUST ship <code>helix-deps.yaml</code> at
its root declaring its own-org dependencies. Schema:
<code>schema_version</code>,
<code>deps: [{name, ssh_url, ref, why, layout: flat|grouped}]</code>,
<code>transitive_handling.{recursive,conflict_resolution}</code>,
<code>language_specific_subtree</code>. Tooling:
<code>incorporate-submodule <ssh-url></code> adds the submodule at
the parent project’s canonical path (CONST-051(C)), reads
<code>helix-deps.yaml</code>, recurses for each declared dep, aborts on
conflicting refs, emits <code><root>/.helix-manifest.yaml</code>
audit record.</p>
<p>Anti-bluff guarantee: every manifest paired with a Challenge that
bootstraps a throwaway consuming project, runs
<code>incorporate-submodule</code>, asserts produced layout matches the
manifest, runs the submodule’s own tests against the bootstrapped
layout, captures wire evidence per §11.4.2. A manifest without this
proof is a CONST-054 violation.</p>
<p>§11.4.31 / CONST-054 is the <strong>operational complement</strong>
of CONST-051(C): nested own-org submodule chains are FORBIDDEN —
manifests are the bridge that lets consumers reconstruct the dependency
graph at the parent root.</p>
<p><strong>Cascade requirement:</strong> This anchor (verbatim or by
<code>CONST-054</code> ID reference) MUST appear in every owned
submodule’s <code>CONSTITUTION.md</code>, <code>CLAUDE.md</code>, and
<code>AGENTS.md</code>. Severity-equivalent to §11.4 PASS-bluff at the
dependency-graph layer. See constitution submodule
<code>Constitution.md</code> §11.4.31 for the full mandate.</p>
<h2
id="const-055-post-constitution-pull-validation-mandate-cascaded-from-constitution-submodule-11.4.32">CONST-055:
Post-Constitution-Pull Validation Mandate (cascaded from constitution
submodule §11.4.32)</h2>
<blockquote>
<p>Verbatim user mandate (2026-05-15): <em>“Every time we fetch and pull
new changes on constitution Submodule we MUST process the whole project
and all Submodule (deep recursively) for validation and verification
taht every single rule or mandatory constraint is followed and
respected! If it is not, IT MUST BE!”</em></p>
</blockquote>
<p>Whenever a project’s constitution submodule is fetched + pulled with
any content change, the project MUST run
<code>scripts/verify-all-constitution-rules.sh</code> BEFORE the new
constitution HEAD is treated as canonical for any other work. The sweep
re-runs the governance-cascade verifier AND every implementable rule
gate (CONST-053 <code>.gitignore</code> audit, CONST-051(C)
nested-own-org-chain audit, CONST-052 case audit, CONST-050(A)
mock-from-production audit, CONST-035 anti-bluff smoke, etc.) against
the post-pull tree. Failures populate the project’s Issues tracker per
§11.4.15 (Status: <code>Reopened</code>, Type: <code>Bug</code>);
closure requires positive-evidence per §11.4.</p>
<p>Pull-time invocation:
<code>git submodule update --remote constitution</code> triggers the
sweep automatically (post-update hook OR commit-wrapper invocation).
Operator-explicit manual invocation also available.</p>
<p>Anti-bluff: the sweep’s own meta-test (paired mutation per §1.1)
plants a known violation of each enforced gate and asserts the sweep
reports FAIL for the planted gate. A sweep that exits PASS without
running every implementable gate is a CONST-055 violation.</p>
<p>CONST-055 is the <strong>enforcement engine</strong> for every other
§11.4.x and CONST-NNN rule — without it, new rules cascade as anchors
but never get enforced.</p>
<p><strong>Cascade requirement:</strong> This anchor (verbatim or by
<code>CONST-055</code> ID reference) MUST appear in every owned
submodule’s <code>CONSTITUTION.md</code>, <code>CLAUDE.md</code>, and
<code>AGENTS.md</code>. Severity-equivalent to §11.4 PASS-bluff at the
constitutional-enforcement layer. See constitution submodule
<code>Constitution.md</code> §11.4.32 for the full mandate.</p>
<h2
id="const-056-mandatory-install_upstreams-on-cloneadd-mandate-cascaded-from-constitution-submodule-11.4.36">CONST-056:
Mandatory install_upstreams on clone/add Mandate (cascaded from
constitution submodule §11.4.36)</h2>
<blockquote>