code-context-control 2.28.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. cli/__init__.py +1 -0
  2. cli/_hook_utils.py +99 -0
  3. cli/c3.py +6152 -0
  4. cli/commands/__init__.py +1 -0
  5. cli/commands/common.py +312 -0
  6. cli/commands/parser.py +286 -0
  7. cli/docs.html +3178 -0
  8. cli/edits.html +878 -0
  9. cli/hook_auto_snapshot.py +142 -0
  10. cli/hook_c3_signal.py +61 -0
  11. cli/hook_c3read.py +116 -0
  12. cli/hook_edit_ledger.py +213 -0
  13. cli/hook_edit_unlock.py +170 -0
  14. cli/hook_filter.py +130 -0
  15. cli/hook_ghost_files.py +238 -0
  16. cli/hook_pretool_enforce.py +334 -0
  17. cli/hook_read.py +200 -0
  18. cli/hook_session_stats.py +62 -0
  19. cli/hook_terse_advisor.py +190 -0
  20. cli/hub.html +3764 -0
  21. cli/hub_server.py +1619 -0
  22. cli/mcp_proxy.py +428 -0
  23. cli/mcp_server.py +660 -0
  24. cli/server.py +2985 -0
  25. cli/tools/__init__.py +4 -0
  26. cli/tools/_helpers.py +65 -0
  27. cli/tools/agent.py +1165 -0
  28. cli/tools/compress.py +215 -0
  29. cli/tools/delegate.py +1184 -0
  30. cli/tools/edit.py +313 -0
  31. cli/tools/edits.py +118 -0
  32. cli/tools/filter.py +285 -0
  33. cli/tools/impact.py +163 -0
  34. cli/tools/memory.py +469 -0
  35. cli/tools/read.py +224 -0
  36. cli/tools/search.py +337 -0
  37. cli/tools/session.py +95 -0
  38. cli/tools/shell.py +193 -0
  39. cli/tools/status.py +306 -0
  40. cli/tools/validate.py +310 -0
  41. cli/ui/api.js +36 -0
  42. cli/ui/app.js +207 -0
  43. cli/ui/components/chat.js +758 -0
  44. cli/ui/components/dashboard.js +689 -0
  45. cli/ui/components/edits.js +220 -0
  46. cli/ui/components/instructions.js +481 -0
  47. cli/ui/components/memory.js +626 -0
  48. cli/ui/components/sessions.js +606 -0
  49. cli/ui/components/settings.js +1404 -0
  50. cli/ui/components/sidebar.js +156 -0
  51. cli/ui/icons.js +51 -0
  52. cli/ui/shared.js +119 -0
  53. cli/ui/theme.js +22 -0
  54. cli/ui.html +168 -0
  55. cli/ui_legacy.html +6797 -0
  56. cli/ui_nano.html +503 -0
  57. code_context_control-2.28.0.dist-info/METADATA +248 -0
  58. code_context_control-2.28.0.dist-info/RECORD +150 -0
  59. code_context_control-2.28.0.dist-info/WHEEL +5 -0
  60. code_context_control-2.28.0.dist-info/entry_points.txt +4 -0
  61. code_context_control-2.28.0.dist-info/licenses/LICENSE +201 -0
  62. code_context_control-2.28.0.dist-info/top_level.txt +5 -0
  63. core/__init__.py +75 -0
  64. core/config.py +269 -0
  65. core/ide.py +188 -0
  66. oracle/__init__.py +1 -0
  67. oracle/config.py +75 -0
  68. oracle/oracle.html +3900 -0
  69. oracle/oracle_server.py +663 -0
  70. oracle/services/__init__.py +1 -0
  71. oracle/services/c3_bridge.py +210 -0
  72. oracle/services/chat_engine.py +1103 -0
  73. oracle/services/chat_store.py +155 -0
  74. oracle/services/cross_memory.py +154 -0
  75. oracle/services/federated_graph.py +463 -0
  76. oracle/services/health_checker.py +117 -0
  77. oracle/services/insight_engine.py +307 -0
  78. oracle/services/memory_reader.py +106 -0
  79. oracle/services/memory_writer.py +182 -0
  80. oracle/services/ollama_bridge.py +332 -0
  81. oracle/services/project_scanner.py +87 -0
  82. oracle/services/review_agent.py +206 -0
  83. services/__init__.py +1 -0
  84. services/activity_log.py +93 -0
  85. services/agent_base.py +124 -0
  86. services/agents.py +1529 -0
  87. services/auto_memory.py +407 -0
  88. services/bench/__init__.py +6 -0
  89. services/bench/external/__init__.py +29 -0
  90. services/bench/external/aider_polyglot.py +405 -0
  91. services/bench/external/swe_bench.py +485 -0
  92. services/benchmark_dashboard.py +596 -0
  93. services/claude_md.py +785 -0
  94. services/compressor.py +592 -0
  95. services/context_snapshot.py +356 -0
  96. services/conversation_store.py +870 -0
  97. services/doc_index.py +537 -0
  98. services/e2e_benchmark.py +2884 -0
  99. services/e2e_evaluator.py +396 -0
  100. services/e2e_tasks.py +743 -0
  101. services/edit_ledger.py +459 -0
  102. services/embedding_index.py +341 -0
  103. services/error_reporting.py +123 -0
  104. services/file_memory.py +734 -0
  105. services/hub_service.py +585 -0
  106. services/indexer.py +712 -0
  107. services/memory.py +318 -0
  108. services/memory_consolidator.py +538 -0
  109. services/memory_graph.py +382 -0
  110. services/memory_grounder.py +304 -0
  111. services/memory_scorer.py +246 -0
  112. services/metrics.py +86 -0
  113. services/notifications.py +209 -0
  114. services/ollama_client.py +201 -0
  115. services/output_filter.py +488 -0
  116. services/parser.py +1238 -0
  117. services/project_manager.py +579 -0
  118. services/protocol.py +306 -0
  119. services/proxy_state.py +152 -0
  120. services/retrieval_broker.py +129 -0
  121. services/router.py +414 -0
  122. services/runtime.py +326 -0
  123. services/session_benchmark.py +1945 -0
  124. services/session_manager.py +1026 -0
  125. services/session_preloader.py +251 -0
  126. services/text_index.py +90 -0
  127. services/tool_classifier.py +176 -0
  128. services/transcript_index.py +340 -0
  129. services/validation_cache.py +155 -0
  130. services/vector_store.py +299 -0
  131. services/version_tracker.py +271 -0
  132. services/watcher.py +192 -0
  133. tui/__init__.py +0 -0
  134. tui/backend.py +59 -0
  135. tui/main.py +145 -0
  136. tui/screens/__init__.py +1 -0
  137. tui/screens/benchmark_view.py +109 -0
  138. tui/screens/claudemd_view.py +46 -0
  139. tui/screens/compress_view.py +52 -0
  140. tui/screens/index_view.py +74 -0
  141. tui/screens/init_view.py +82 -0
  142. tui/screens/mcp_view.py +73 -0
  143. tui/screens/optimize_view.py +41 -0
  144. tui/screens/pipe_view.py +46 -0
  145. tui/screens/projects_view.py +355 -0
  146. tui/screens/search_view.py +55 -0
  147. tui/screens/session_view.py +143 -0
  148. tui/screens/stats.py +158 -0
  149. tui/screens/ui_view.py +54 -0
  150. tui/theme.tcss +335 -0
cli/docs.html ADDED
@@ -0,0 +1,3178 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>C3 Docs — Claude Code Companion</title>
8
+ <style>
9
+ @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');
10
+
11
+ *,
12
+ *::before,
13
+ *::after {
14
+ box-sizing: border-box;
15
+ margin: 0;
16
+ padding: 0;
17
+ }
18
+
19
+ html {
20
+ height: 100%;
21
+ }
22
+
23
+ /* ── Theme variables (dark default) ── */
24
+ :root {
25
+ --bg: #0a0e14;
26
+ --surface: #0f1319;
27
+ --surface-alt: #141a22;
28
+ --border: #1e2733;
29
+ --border-hover: #2a3544;
30
+ --text: #c5cdd8;
31
+ --text-muted: #5c6a7a;
32
+ --text-dim: #3a4555;
33
+ --text-heading: #ffffff;
34
+ --accent: #00e5a0;
35
+ --accent-dim: #00e5a018;
36
+ --accent-bg: #00e5a008;
37
+ --accent-border: #00e5a020;
38
+ --accent-border-strong: #00e5a040;
39
+ --blue: #4da6ff;
40
+ --blue-dim: #4da6ff15;
41
+ --blue-border: #4da6ff30;
42
+ --purple: #b38aff;
43
+ --purple-dim: #b38aff15;
44
+ --purple-border: #b38aff30;
45
+ --warn: #ffb224;
46
+ --warn-dim: #ffb22408;
47
+ --warn-border: #ffb22420;
48
+ --scrollbar: #1e2733;
49
+ --scrollbar-hover: #2a3544;
50
+ }
51
+
52
+ html[data-theme="light"] {
53
+ --bg: #f0f2f5;
54
+ --surface: #ffffff;
55
+ --surface-alt: #e8ebef;
56
+ --border: #dde2e8;
57
+ --border-hover: #b8c0cb;
58
+ --text: #1a2332;
59
+ --text-muted: #5a6a7a;
60
+ --text-dim: #9daab8;
61
+ --text-heading: #0d1520;
62
+ --accent: #009e72;
63
+ --accent-dim: #009e7214;
64
+ --accent-bg: #009e7208;
65
+ --accent-border: #009e7225;
66
+ --accent-border-strong: #009e7240;
67
+ --blue: #1a6fc4;
68
+ --blue-dim: #1a6fc414;
69
+ --blue-border: #1a6fc430;
70
+ --purple: #6b40c4;
71
+ --purple-dim: #6b40c414;
72
+ --purple-border: #6b40c430;
73
+ --warn: #b87000;
74
+ --warn-dim: #b8700008;
75
+ --warn-border: #b8700025;
76
+ --scrollbar: #dde2e8;
77
+ --scrollbar-hover: #b8c0cb;
78
+ }
79
+
80
+ body {
81
+ background: var(--bg);
82
+ color: var(--text);
83
+ font-family: 'DM Sans', -apple-system, sans-serif;
84
+ line-height: 1.7;
85
+ min-height: 100%;
86
+ transition: background 0.2s, color 0.2s;
87
+ }
88
+
89
+ ::-webkit-scrollbar {
90
+ width: 5px;
91
+ }
92
+
93
+ ::-webkit-scrollbar-track {
94
+ background: transparent;
95
+ }
96
+
97
+ ::-webkit-scrollbar-thumb {
98
+ background: var(--scrollbar);
99
+ border-radius: 3px;
100
+ }
101
+
102
+ ::-webkit-scrollbar-thumb:hover {
103
+ background: var(--scrollbar-hover);
104
+ }
105
+
106
+ code,
107
+ pre {
108
+ font-family: 'JetBrains Mono', monospace;
109
+ }
110
+
111
+ a {
112
+ color: var(--accent);
113
+ text-decoration: none;
114
+ }
115
+
116
+ a:hover {
117
+ text-decoration: underline;
118
+ }
119
+
120
+ /* Layout */
121
+ .page {
122
+ display: flex;
123
+ min-height: 100vh;
124
+ }
125
+
126
+ .sidebar {
127
+ width: 240px;
128
+ flex-shrink: 0;
129
+ position: sticky;
130
+ top: 0;
131
+ height: 100vh;
132
+ overflow-y: auto;
133
+ background: var(--surface);
134
+ border-right: 1px solid var(--border);
135
+ padding: 20px 0;
136
+ }
137
+
138
+ .sidebar-logo {
139
+ padding: 0 20px 18px;
140
+ border-bottom: 1px solid var(--border);
141
+ margin-bottom: 12px;
142
+ display: flex;
143
+ align-items: center;
144
+ gap: 10px;
145
+ }
146
+
147
+ .sidebar-logo .icon {
148
+ width: 32px;
149
+ height: 32px;
150
+ border-radius: 8px;
151
+ background: var(--accent-dim);
152
+ border: 1px solid var(--accent-border-strong);
153
+ display: flex;
154
+ align-items: center;
155
+ justify-content: center;
156
+ color: var(--accent);
157
+ font-weight: 700;
158
+ font-size: 14px;
159
+ font-family: 'JetBrains Mono', monospace;
160
+ }
161
+
162
+ .sidebar-logo .text {
163
+ font-size: 15px;
164
+ font-weight: 700;
165
+ color: var(--text);
166
+ }
167
+
168
+ .sidebar-logo .text span {
169
+ color: var(--accent);
170
+ }
171
+
172
+ .sidebar-logo .sub {
173
+ font-size: 9px;
174
+ color: var(--text-muted);
175
+ text-transform: uppercase;
176
+ letter-spacing: 1.5px;
177
+ margin-top: 1px;
178
+ }
179
+
180
+ .theme-toggle {
181
+ margin-left: auto;
182
+ background: none;
183
+ border: 1px solid var(--border);
184
+ border-radius: 6px;
185
+ padding: 4px 7px;
186
+ cursor: pointer;
187
+ color: var(--text-muted);
188
+ font-size: 13px;
189
+ line-height: 1;
190
+ transition: all 0.15s;
191
+ flex-shrink: 0;
192
+ }
193
+
194
+ .theme-toggle:hover {
195
+ border-color: var(--accent);
196
+ color: var(--accent);
197
+ }
198
+
199
+ .sidebar-section {
200
+ padding: 8px 16px;
201
+ font-size: 10px;
202
+ font-weight: 700;
203
+ color: var(--text-dim);
204
+ text-transform: uppercase;
205
+ letter-spacing: 1.2px;
206
+ margin-top: 8px;
207
+ }
208
+
209
+ .sidebar a {
210
+ display: block;
211
+ padding: 5px 20px;
212
+ font-size: 13px;
213
+ color: var(--text-muted);
214
+ transition: all 0.15s;
215
+ border-left: 2px solid transparent;
216
+ }
217
+
218
+ .sidebar a:hover {
219
+ color: var(--text);
220
+ background: var(--surface-alt);
221
+ text-decoration: none;
222
+ }
223
+
224
+ .sidebar a.active {
225
+ color: var(--accent);
226
+ border-left-color: var(--accent);
227
+ background: var(--accent-bg);
228
+ }
229
+
230
+ .content {
231
+ flex: 1;
232
+ max-width: 860px;
233
+ padding: 40px 48px 80px;
234
+ }
235
+
236
+ /* Typography */
237
+ h1 {
238
+ font-size: 32px;
239
+ font-weight: 700;
240
+ color: var(--text-heading);
241
+ letter-spacing: -0.5px;
242
+ margin-bottom: 10px;
243
+ line-height: 1.2;
244
+ }
245
+
246
+ h1 span {
247
+ color: var(--accent);
248
+ }
249
+
250
+ .subtitle {
251
+ font-size: 15px;
252
+ color: var(--text-muted);
253
+ margin-bottom: 40px;
254
+ line-height: 1.6;
255
+ }
256
+
257
+ h2 {
258
+ font-size: 20px;
259
+ font-weight: 700;
260
+ color: var(--text-heading);
261
+ margin: 48px 0 16px;
262
+ padding-bottom: 8px;
263
+ border-bottom: 1px solid var(--border);
264
+ letter-spacing: -0.3px;
265
+ }
266
+
267
+ h3 {
268
+ font-size: 15px;
269
+ font-weight: 700;
270
+ color: var(--text);
271
+ margin: 28px 0 10px;
272
+ }
273
+
274
+ p {
275
+ margin-bottom: 14px;
276
+ font-size: 14px;
277
+ }
278
+
279
+ ul,
280
+ ol {
281
+ margin: 0 0 14px 20px;
282
+ font-size: 14px;
283
+ }
284
+
285
+ li {
286
+ margin-bottom: 4px;
287
+ }
288
+
289
+ li code {
290
+ font-size: 12px;
291
+ }
292
+
293
+ strong {
294
+ color: var(--text);
295
+ font-weight: 600;
296
+ }
297
+
298
+ /* Code blocks */
299
+ pre {
300
+ background: var(--surface);
301
+ border: 1px solid var(--border);
302
+ border-radius: 8px;
303
+ padding: 16px 18px;
304
+ margin: 12px 0 18px;
305
+ overflow-x: auto;
306
+ font-size: 12.5px;
307
+ line-height: 1.65;
308
+ color: var(--text);
309
+ }
310
+
311
+ code {
312
+ background: var(--surface-alt);
313
+ padding: 2px 6px;
314
+ border-radius: 4px;
315
+ font-size: 12px;
316
+ color: var(--accent);
317
+ }
318
+
319
+ pre code {
320
+ background: none;
321
+ padding: 0;
322
+ color: inherit;
323
+ font-size: inherit;
324
+ }
325
+
326
+ /* Tables */
327
+ table {
328
+ width: 100%;
329
+ border-collapse: collapse;
330
+ margin: 12px 0 18px;
331
+ font-size: 13px;
332
+ }
333
+
334
+ th {
335
+ text-align: left;
336
+ padding: 10px 14px;
337
+ background: var(--surface);
338
+ border: 1px solid var(--border);
339
+ color: var(--text-muted);
340
+ font-weight: 600;
341
+ text-transform: uppercase;
342
+ font-size: 10px;
343
+ letter-spacing: 1px;
344
+ }
345
+
346
+ td {
347
+ padding: 10px 14px;
348
+ border: 1px solid var(--border);
349
+ vertical-align: top;
350
+ }
351
+
352
+ td code {
353
+ white-space: nowrap;
354
+ }
355
+
356
+ tr:hover td {
357
+ background: var(--surface-alt);
358
+ }
359
+
360
+ /* Cards */
361
+ .card {
362
+ background: var(--surface);
363
+ border: 1px solid var(--border);
364
+ border-radius: 8px;
365
+ padding: 18px 20px;
366
+ margin: 12px 0 18px;
367
+ }
368
+
369
+ .card-title {
370
+ font-size: 11px;
371
+ font-weight: 700;
372
+ color: var(--text-muted);
373
+ text-transform: uppercase;
374
+ letter-spacing: 1px;
375
+ margin-bottom: 10px;
376
+ }
377
+
378
+ /* Badges */
379
+ .badge {
380
+ display: inline-block;
381
+ padding: 2px 8px;
382
+ border-radius: 4px;
383
+ font-size: 11px;
384
+ font-weight: 600;
385
+ font-family: 'JetBrains Mono', monospace;
386
+ white-space: nowrap;
387
+ }
388
+
389
+ .badge-green {
390
+ background: var(--accent-dim);
391
+ color: var(--accent);
392
+ border: 1px solid var(--accent-border);
393
+ }
394
+
395
+ .badge-blue {
396
+ background: var(--blue-dim);
397
+ color: var(--blue);
398
+ border: 1px solid var(--blue-border);
399
+ }
400
+
401
+ .badge-purple {
402
+ background: var(--purple-dim);
403
+ color: var(--purple);
404
+ border: 1px solid var(--purple-border);
405
+ }
406
+
407
+ .badge-warn {
408
+ background: var(--warn-dim);
409
+ color: var(--warn);
410
+ border: 1px solid var(--warn-border);
411
+ }
412
+
413
+ /* Feature grid */
414
+ .features {
415
+ display: grid;
416
+ grid-template-columns: 1fr 1fr;
417
+ gap: 12px;
418
+ margin: 16px 0 24px;
419
+ }
420
+
421
+ .feature {
422
+ background: var(--surface);
423
+ border: 1px solid var(--border);
424
+ border-radius: 8px;
425
+ padding: 16px 18px;
426
+ }
427
+
428
+ .feature-num {
429
+ font-family: 'JetBrains Mono', monospace;
430
+ font-size: 11px;
431
+ font-weight: 700;
432
+ color: var(--accent);
433
+ margin-bottom: 6px;
434
+ }
435
+
436
+ .feature-title {
437
+ font-size: 14px;
438
+ font-weight: 700;
439
+ color: var(--text);
440
+ margin-bottom: 4px;
441
+ }
442
+
443
+ .feature-desc {
444
+ font-size: 12px;
445
+ color: var(--text-muted);
446
+ line-height: 1.5;
447
+ }
448
+
449
+ /* Architecture diagram */
450
+ .arch {
451
+ background: var(--surface);
452
+ border: 1px solid var(--border);
453
+ border-radius: 8px;
454
+ padding: 20px;
455
+ margin: 12px 0 18px;
456
+ overflow-x: auto;
457
+ }
458
+
459
+ .arch pre {
460
+ background: transparent;
461
+ border: none;
462
+ padding: 0;
463
+ margin: 0;
464
+ color: var(--text-muted);
465
+ font-size: 12px;
466
+ }
467
+
468
+ .arch pre strong {
469
+ color: var(--accent);
470
+ font-weight: 600;
471
+ }
472
+
473
+ .arch pre em {
474
+ color: var(--blue);
475
+ font-style: normal;
476
+ }
477
+
478
+ /* Steps */
479
+ .steps {
480
+ counter-reset: step;
481
+ margin: 16px 0 24px;
482
+ }
483
+
484
+ .step {
485
+ display: flex;
486
+ gap: 14px;
487
+ margin-bottom: 16px;
488
+ padding: 14px 16px;
489
+ background: var(--surface);
490
+ border: 1px solid var(--border);
491
+ border-radius: 8px;
492
+ }
493
+
494
+ .step::before {
495
+ counter-increment: step;
496
+ content: counter(step);
497
+ width: 28px;
498
+ height: 28px;
499
+ border-radius: 50%;
500
+ flex-shrink: 0;
501
+ background: var(--accent-dim);
502
+ border: 1px solid var(--accent-border-strong);
503
+ color: var(--accent);
504
+ font-family: 'JetBrains Mono', monospace;
505
+ font-size: 13px;
506
+ font-weight: 700;
507
+ display: flex;
508
+ align-items: center;
509
+ justify-content: center;
510
+ }
511
+
512
+ .step-content {
513
+ flex: 1;
514
+ }
515
+
516
+ .step-title {
517
+ font-size: 14px;
518
+ font-weight: 600;
519
+ color: var(--text);
520
+ margin-bottom: 4px;
521
+ }
522
+
523
+ .step-desc {
524
+ font-size: 13px;
525
+ color: var(--text-muted);
526
+ }
527
+
528
+ .step-desc code {
529
+ font-size: 12px;
530
+ }
531
+
532
+ /* Tab preview */
533
+ .tabs-preview {
534
+ display: grid;
535
+ grid-template-columns: 1fr 1fr;
536
+ gap: 10px;
537
+ margin: 14px 0 18px;
538
+ }
539
+
540
+ .tab-card {
541
+ background: var(--surface);
542
+ border: 1px solid var(--border);
543
+ border-radius: 8px;
544
+ padding: 14px 16px;
545
+ }
546
+
547
+ .tab-name {
548
+ font-size: 13px;
549
+ font-weight: 700;
550
+ color: var(--text);
551
+ margin-bottom: 4px;
552
+ display: flex;
553
+ align-items: center;
554
+ gap: 6px;
555
+ }
556
+
557
+ .tab-desc {
558
+ font-size: 12px;
559
+ color: var(--text-muted);
560
+ line-height: 1.5;
561
+ }
562
+
563
+ /* Tip boxes */
564
+ .tip {
565
+ background: var(--accent-bg);
566
+ border: 1px solid var(--accent-border);
567
+ border-left: 3px solid var(--accent);
568
+ border-radius: 6px;
569
+ padding: 14px 16px;
570
+ margin: 12px 0 18px;
571
+ font-size: 13px;
572
+ }
573
+
574
+ .tip-title {
575
+ font-weight: 700;
576
+ color: var(--accent);
577
+ font-size: 12px;
578
+ text-transform: uppercase;
579
+ letter-spacing: 0.5px;
580
+ margin-bottom: 4px;
581
+ }
582
+
583
+ .warn {
584
+ background: var(--warn-dim);
585
+ border: 1px solid var(--warn-border);
586
+ border-left: 3px solid var(--warn);
587
+ border-radius: 6px;
588
+ padding: 14px 16px;
589
+ margin: 12px 0 18px;
590
+ font-size: 13px;
591
+ }
592
+
593
+ .warn-title {
594
+ font-weight: 700;
595
+ color: var(--warn);
596
+ font-size: 12px;
597
+ text-transform: uppercase;
598
+ letter-spacing: 0.5px;
599
+ margin-bottom: 4px;
600
+ }
601
+
602
+ /* Responsive */
603
+ @media (max-width: 900px) {
604
+ .sidebar {
605
+ display: none;
606
+ }
607
+
608
+ .content {
609
+ padding: 24px 20px 60px;
610
+ }
611
+
612
+ .features,
613
+ .tabs-preview {
614
+ grid-template-columns: 1fr;
615
+ }
616
+ }
617
+
618
+ /* Back-to-top */
619
+ .back-top {
620
+ position: fixed;
621
+ bottom: 24px;
622
+ right: 24px;
623
+ width: 36px;
624
+ height: 36px;
625
+ border-radius: 50%;
626
+ background: var(--surface);
627
+ border: 1px solid var(--border);
628
+ color: var(--text-muted);
629
+ display: flex;
630
+ align-items: center;
631
+ justify-content: center;
632
+ cursor: pointer;
633
+ transition: all 0.15s;
634
+ font-size: 16px;
635
+ z-index: 100;
636
+ }
637
+
638
+ .back-top:hover {
639
+ color: var(--accent);
640
+ border-color: var(--accent-border-strong);
641
+ }
642
+
643
+ /* Sidebar search */
644
+ .search-wrap {
645
+ position: relative;
646
+ padding: 0 12px 14px;
647
+ border-bottom: 1px solid var(--border);
648
+ margin-bottom: 12px;
649
+ }
650
+
651
+ .search-input {
652
+ width: 100%;
653
+ background: var(--surface-alt);
654
+ border: 1px solid var(--border);
655
+ border-radius: 5px;
656
+ padding: 6px 28px 6px 28px;
657
+ font-size: 12px;
658
+ color: var(--text);
659
+ font-family: 'DM Sans', sans-serif;
660
+ outline: none;
661
+ transition: border-color 0.15s;
662
+ }
663
+
664
+ .search-input:focus {
665
+ border-color: var(--accent-border-strong);
666
+ }
667
+
668
+ .search-input::placeholder {
669
+ color: var(--text-dim);
670
+ }
671
+
672
+ .search-icon {
673
+ position: absolute;
674
+ left: 21px;
675
+ top: 50%;
676
+ transform: translateY(-50%);
677
+ color: var(--text-dim);
678
+ font-size: 11px;
679
+ pointer-events: none;
680
+ }
681
+
682
+ .search-clear {
683
+ position: absolute;
684
+ right: 20px;
685
+ top: 50%;
686
+ transform: translateY(-50%);
687
+ background: none;
688
+ border: none;
689
+ color: var(--text-dim);
690
+ cursor: pointer;
691
+ font-size: 15px;
692
+ line-height: 1;
693
+ display: none;
694
+ padding: 0;
695
+ }
696
+
697
+ .search-clear.visible {
698
+ display: block;
699
+ }
700
+
701
+ .search-clear:hover {
702
+ color: var(--text);
703
+ }
704
+
705
+ .search-hint {
706
+ font-size: 9px;
707
+ color: var(--text-dim);
708
+ text-align: right;
709
+ margin-top: 4px;
710
+ letter-spacing: 0.5px;
711
+ }
712
+
713
+ .search-no-results {
714
+ padding: 6px 20px 4px;
715
+ font-size: 12px;
716
+ color: var(--text-dim);
717
+ display: none;
718
+ }
719
+ </style>
720
+ </head>
721
+
722
+ <body>
723
+
724
+ <div class="page">
725
+ <!-- Sidebar Navigation -->
726
+ <nav class="sidebar" id="sidebar">
727
+ <div class="sidebar-logo">
728
+ <div class="icon">C3</div>
729
+ <div>
730
+ <div class="text">C<span>3</span> Docs</div>
731
+ <div class="sub">Code Companion</div>
732
+ </div>
733
+ <button id="themeToggle" class="theme-toggle" title="Toggle light/dark mode">☀</button>
734
+ </div>
735
+
736
+ <div class="search-wrap">
737
+ <span class="search-icon">⌕</span>
738
+ <input type="search" class="search-input" id="docSearch" placeholder="Search docs…" autocomplete="off"
739
+ spellcheck="false">
740
+ <button class="search-clear" id="searchClear" title="Clear">×</button>
741
+ <div class="search-hint">/ or Ctrl+K to focus</div>
742
+ </div>
743
+ <div class="search-no-results" id="searchNoResults">No results</div>
744
+
745
+ <div class="sidebar-section">Getting Started</div>
746
+ <a href="#overview">Overview</a>
747
+ <a href="#recent-updates">Recent Updates</a>
748
+ <a href="#installation">Installation</a>
749
+ <a href="#quickstart">Quick Start</a>
750
+ <a href="#cross-ide">Cross-IDE Setup</a>
751
+
752
+ <div class="sidebar-section">MCP Server</div>
753
+ <a href="#mcp-tools">MCP Tools</a>
754
+ <a href="#context-tools">Context Manager</a>
755
+ <a href="#claudemd-tools">Instructions Tools</a>
756
+ <a href="#agent-tools">Background Agents</a>
757
+ <a href="#hybrid-tools">Hybrid Intelligence</a>
758
+ <a href="#proxy-layer">MCP Proxy</a>
759
+ <a href="#file-memory">File Memory</a>
760
+ <a href="#hooks">Hooks</a>
761
+ <a href="#mcp-behavior">Auto Behavior</a>
762
+
763
+ <div class="sidebar-section">Web Dashboard</div>
764
+ <a href="#dashboard">Launching</a>
765
+ <a href="#tabs">Dashboard Tabs</a>
766
+ <a href="#right-sidebar">Right Sidebar</a>
767
+ <a href="#bottom-drawer">Bottom Drawer</a>
768
+ <a href="#api">REST API</a>
769
+
770
+ <div class="sidebar-section">CLI</div>
771
+ <a href="#cli-commands">Commands</a>
772
+ <a href="#cli-examples">Examples</a>
773
+
774
+ <div class="sidebar-section">Reference</div>
775
+ <a href="#architecture">Architecture</a>
776
+ <a href="#conversations">Conversations</a>
777
+ <a href="#compression">Compression Modes</a>
778
+ <a href="#data-layout">Data Layout</a>
779
+ <a href="#token-savings">Token Savings</a>
780
+ <a href="#tips">Tips</a>
781
+ <a href="#troubleshooting">Troubleshooting</a>
782
+ </nav>
783
+
784
+ <!-- Main Content -->
785
+ <main class="content">
786
+
787
+ <!-- ─── Overview ────────────────────── -->
788
+ <h1 id="overview">Code <span>Companion</span></h1>
789
+ <div class="subtitle">
790
+ A local code intelligence system that reduces AI coding assistant token usage through compression,
791
+ indexing, and persistent memory. Works with <strong>Claude Code</strong>, <strong>Google Antigravity</strong>,
792
+ <strong>Gemini CLI</strong>,
793
+ <strong>VS Code Copilot</strong>, and <strong>Cursor</strong> via MCP. Available as an <strong>MCP
794
+ server</strong>,
795
+ <strong>CLI</strong>, and <strong>web dashboard</strong>.
796
+ </div>
797
+
798
+ <div class="features">
799
+ <div class="feature">
800
+ <div class="feature-num">01</div>
801
+ <div class="feature-title">Context Compression</div>
802
+ <div class="feature-desc">AST-based code summarization with structure, outline, smart, and diff modes</div>
803
+ </div>
804
+ <div class="feature">
805
+ <div class="feature-num">02</div>
806
+ <div class="feature-title">Smart Local Index</div>
807
+ <div class="feature-desc">TF-IDF retrieval to pre-filter what gets sent to Claude</div>
808
+ </div>
809
+ <div class="feature">
810
+ <div class="feature-num">03</div>
811
+ <div class="feature-title">Session Tracking</div>
812
+ <div class="feature-desc">Persistent decisions, file changes, and tool call logging across sessions</div>
813
+ </div>
814
+ <div class="feature">
815
+ <div class="feature-num">04</div>
816
+ <div class="feature-title">Compression Protocol</div>
817
+ <div class="feature-desc">Shorthand encoding/decoding for prompts and responses</div>
818
+ </div>
819
+ <div class="feature">
820
+ <div class="feature-num">05</div>
821
+ <div class="feature-title">Tiered Memory</div>
822
+ <div class="feature-desc">Durable fact storage with cross-session semantic search</div>
823
+ </div>
824
+ <div class="feature">
825
+ <div class="feature-num">06</div>
826
+ <div class="feature-title">File Watcher</div>
827
+ <div class="feature-desc">Monitors project changes and triggers automatic index rebuilds</div>
828
+ </div>
829
+ <div class="feature">
830
+ <div class="feature-num">07</div>
831
+ <div class="feature-title">Context Snapshots</div>
832
+ <div class="feature-desc">Capture/restore working context across session boundaries to reset tokens without
833
+ losing state</div>
834
+ </div>
835
+ <div class="feature">
836
+ <div class="feature-num">08</div>
837
+ <div class="feature-title">Transcript Search</div>
838
+ <div class="feature-desc">TF-IDF index over past conversations for cross-session semantic retrieval (Claude
839
+ Code; other IDEs use c3_memory(action='recall')/c3_memory(action='query'))</div>
840
+ </div>
841
+ <div class="feature">
842
+ <div class="feature-num">09</div>
843
+ <div class="feature-title">Background Agents</div>
844
+ <div class="feature-desc">Autonomous daemon threads that monitor index staleness, memory health, instructions
845
+ file drift, and context budget</div>
846
+ </div>
847
+ <div class="feature">
848
+ <div class="feature-num">10</div>
849
+ <div class="feature-title">Output Filter</div>
850
+ <div class="feature-desc">Two-pass terminal output filtering: deterministic noise removal + optional LLM
851
+ summarization via Ollama</div>
852
+ </div>
853
+ <div class="feature">
854
+ <div class="feature-num">11</div>
855
+ <div class="feature-title">Adaptive Router</div>
856
+ <div class="feature-desc">Classifies queries and routes to appropriate local LLMs (gemma3, deepseek-r1,
857
+ llama3.2) or passes through to Claude</div>
858
+ </div>
859
+ <div class="feature">
860
+ <div class="feature-num">12</div>
861
+ <div class="feature-title">SLTM Vector Memory</div>
862
+ <div class="feature-desc">Semantic Long-Term Memory with optional ChromaDB vector search, hybrid TF-IDF +
863
+ cosine similarity scoring</div>
864
+ </div>
865
+ <div class="feature">
866
+ <div class="feature-num">13</div>
867
+ <div class="feature-title">File Memory</div>
868
+ <div class="feature-desc">Persistent structural index of source files with line ranges, enabling targeted
869
+ reads. Background agent maintains maps; Read hook enforces C3 tool usage</div>
870
+ </div>
871
+ </div>
872
+
873
+ <h2 id="recent-updates">Recent Updates</h2>
874
+ <div class="card">
875
+ <div class="card-title">v2.3.3 &mdash; March 6, 2026</div>
876
+ <ul>
877
+ <li><strong>Persistent Compression Cache:</strong> Compression and structural mapping results are now globally cached in <code>.c3/cache</code> based on MD5 content hashes and mode, making subsequent reads instantly fast and avoiding redundant AST parsing.</li>
878
+ <li><strong>Expanded Language Mapping:</strong> Rich AST-based structural support added for <strong>Go, Rust, JSON, and YAML</strong> files, in addition to the existing Python and JS/TS support.</li>
879
+ <li><strong>Documentation Mapping:</strong> Added structural mapping for <strong>HTML, Markdown, and CSS</strong> files, enabling targeted reads of specific UI components, document headers, and styles.</li>
880
+ <li><strong>Performance History:</strong> <code>c3 benchmark</code> reports now feature a dedicated <strong>History Tab</strong> with time-series charts (via Chart.js) tracking token savings, quality, and latency across versions.</li>
881
+ <li><strong>Global Configuration Migration:</strong> <code>c3 init . --force</code> now correctly migrates legacy analytics locations and refreshes instructions files across all supported IDEs.</li>
882
+ </ul>
883
+ </div>
884
+
885
+ <div class="card">
886
+ <div class="card-title">v2.3.0 &mdash; March 5, 2026</div>
887
+ <ul>
888
+ <li><strong>Tree-sitter Integration:</strong> Migrated from line-based regex to precise AST parsing for core languages, vastly improving map and search precision.</li>
889
+ <li><strong>Hybrid Vector Search:</strong> Search recall now combines traditional keyword matching with semantic vector distance for higher retrieval grounding.</li>
890
+ <li><strong>Background Agents:</strong> Autonomous daemon threads now monitor index staleness and context budget in real-time.</li>
891
+ </ul>
892
+ </div>
893
+
894
+ <div class="card">
895
+ <div class="card-title">Latest Local Benchmark Snapshot</div>
896
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 8px;">
897
+ Optimized run executed on <strong>March 6, 2026</strong> (v2.3.3) in this repository.
898
+ </p>
899
+ <table>
900
+ <tr>
901
+ <th>Metric</th>
902
+ <th>Result</th>
903
+ </tr>
904
+ <tr>
905
+ <td>Overall Token Savings (43 files)</td>
906
+ <td><strong>94.7%</strong></td>
907
+ </tr>
908
+ <tr>
909
+ <td>Prompt Budget Multiplier</td>
910
+ <td><strong>18.74x</strong></td>
911
+ </tr>
912
+ <tr>
913
+ <td>Grounding Performance (with C3)</td>
914
+ <td><strong>100.0%</strong> hit rate</td>
915
+ </tr>
916
+ <tr>
917
+ <td>Avg Local Latency</td>
918
+ <td>2.05 ms/task</td>
919
+ </tr>
920
+ </table>
921
+ </div>
922
+
923
+ <!-- ─── Installation ────────────────── -->
924
+ <h2 id="installation">Installation</h2>
925
+
926
+ <pre><code>cd code-context-control
927
+ pip install .
928
+
929
+ # Initialize in your project
930
+ c3 init /path/to/your/project</code></pre>
931
+
932
+ <p>Platform installers handle dependencies and PATH setup automatically:</p>
933
+ <ul>
934
+ <li><strong>Windows:</strong> <code>install.bat</code></li>
935
+ <li><strong>Linux/macOS:</strong> <code>install.sh</code></li>
936
+ </ul>
937
+
938
+ <!-- ─── Quick Start ─────────────────── -->
939
+ <h2 id="quickstart">Quick Start</h2>
940
+ <p>The recommended way to use C3 is as an MCP server — your IDE calls C3 tools directly with no manual piping.
941
+ </p>
942
+
943
+ <div class="steps">
944
+ <div class="step">
945
+ <div class="step-content">
946
+ <div class="step-title">Install C3</div>
947
+ <div class="step-desc"><code>cd code-context-control && pip install .</code></div>
948
+ </div>
949
+ </div>
950
+ <div class="step">
951
+ <div class="step-content">
952
+ <div class="step-title">Initialize C3 in your project</div>
953
+ <div class="step-desc"><code>python cli/c3.py init /path/to/your/project</code><br>Creates the
954
+ <code>.c3/</code> directory, builds the code index, and then walks through a guided 3-step setup:
955
+ choose the IDE profile, optionally run a local <code>git init</code>, and optionally install MCP.
956
+ When MCP is installed, C3 writes the IDE config plus project-local session files such as
957
+ <code>.codex/config.toml</code> and <code>.gemini/settings.json</code>. For VS Code, also generates
958
+ <code>.github/copilot-instructions.md</code> (hard enforcement language) and
959
+ <code>.vscode/settings.json</code> (Copilot instruction links). For Codex, generates
960
+ <code>AGENTS.md</code> with the C3 session protocol. Use <code>--ide vscode</code>,
961
+ <code>--ide cursor</code>, or <code>--ide codex</code> to override IDE detection.
962
+ </div>
963
+ </div>
964
+ </div>
965
+ <div class="step">
966
+ <div class="step-content">
967
+ <div class="step-title">Restart your IDE</div>
968
+ <div class="step-desc">Open your IDE in the project. For Claude Code, run <code>/mcp</code> to verify C3
969
+ tools appear. For Google Antigravity and Gemini CLI, the MCP tools will be loaded based on your config.
970
+ For VS Code, check MCP tools in the Copilot agent panel. For Codex, the <code>.codex/config.toml</code> is
971
+ picked up automatically on next session start.</div>
972
+ </div>
973
+ </div>
974
+ </div>
975
+
976
+ <!-- ─── Cross-IDE Setup ──────────────── -->
977
+ <h2 id="cross-ide">Cross-IDE Setup</h2>
978
+ <p>C3 works with any MCP-capable IDE. The <code>install-mcp</code> command auto-detects your IDE and generates the
979
+ correct config format.</p>
980
+
981
+ <h3>Supported IDEs</h3>
982
+ <table>
983
+ <tr>
984
+ <th>IDE</th>
985
+ <th>Config File</th>
986
+ <th>Instructions File</th>
987
+ <th>Extra Files</th>
988
+ <th>Hooks</th>
989
+ <th>Transcripts</th>
990
+ </tr>
991
+ <tr>
992
+ <td><strong>Claude Code</strong></td>
993
+ <td><code>.mcp.json</code></td>
994
+ <td><code>CLAUDE.md</code></td>
995
+ <td><code>.claude/settings.local.json</code></td>
996
+ <td>Yes</td>
997
+ <td>Yes</td>
998
+ </tr>
999
+ <tr>
1000
+ <td><strong>VS Code Copilot</strong></td>
1001
+ <td><code>.vscode/mcp.json</code></td>
1002
+ <td><code>.github/copilot-instructions.md</code></td>
1003
+ <td><code>.vscode/settings.json</code></td>
1004
+ <td>No</td>
1005
+ <td>No</td>
1006
+ </tr>
1007
+ <tr>
1008
+ <td><strong>Cursor</strong></td>
1009
+ <td><code>.cursor/mcp.json</code></td>
1010
+ <td><code>.cursorrules</code></td>
1011
+ <td>—</td>
1012
+ <td>No</td>
1013
+ <td>No</td>
1014
+ </tr>
1015
+ <tr>
1016
+ <td><strong>OpenAI Codex</strong></td>
1017
+ <td><code>.codex/config.toml</code></td>
1018
+ <td><code>AGENTS.md</code></td>
1019
+ <td>—</td>
1020
+ <td>No</td>
1021
+ <td>No</td>
1022
+ </tr>
1023
+ <tr>
1024
+ <td><strong>Gemini CLI</strong></td>
1025
+ <td><code>.gemini/settings.json</code></td>
1026
+ <td><code>GEMINI.md</code></td>
1027
+ <td>—</td>
1028
+ <td>No</td>
1029
+ <td>No</td>
1030
+ </tr>
1031
+ <tr>
1032
+ <td><strong>Google Antigravity</strong></td>
1033
+ <td><code>~/.gemini/antigravity/mcp_config.json</code> <span class="badge badge-warn"
1034
+ style="font-size:10px">global</span></td>
1035
+ <td><code>GEMINI.md</code></td>
1036
+ <td>—</td>
1037
+ <td>No</td>
1038
+ <td>No</td>
1039
+ </tr>
1040
+ </table>
1041
+
1042
+ <h3>IDE-specific Installation</h3>
1043
+ <pre><code># Guided setup (recommended)
1044
+ python cli/c3.py init /path/to/project
1045
+
1046
+ # Non-interactive setup with local Git + direct MCP
1047
+ python cli/c3.py init /path/to/project --force --git --ide codex --mcp-mode direct
1048
+
1049
+ # MCP-only setup
1050
+ python cli/c3.py install-mcp /path/to/project
1051
+
1052
+ # Explicit direct/proxy mode
1053
+ python cli/c3.py install-mcp /path/to/project --mcp-mode direct
1054
+ python cli/c3.py install-mcp /path/to/project --mcp-mode proxy
1055
+
1056
+ # Explicit IDE selection
1057
+ python cli/c3.py install-mcp /path/to/project --ide vscode
1058
+ python cli/c3.py install-mcp /path/to/project --ide cursor
1059
+ python cli/c3.py install-mcp /path/to/project --ide claude
1060
+ python cli/c3.py install-mcp /path/to/project --ide codex
1061
+ python cli/c3.py install-mcp /path/to/project --ide gemini
1062
+ python cli/c3.py install-mcp /path/to/project --ide antigravity
1063
+
1064
+ # IDE shorthand when already inside the project directory
1065
+ python cli/c3.py install-mcp claude
1066
+ python cli/c3.py install-mcp codex
1067
+ python cli/c3.py install-mcp . gemini</code></pre>
1068
+
1069
+ <p><code>--git</code> runs a local-only <code>git init</code>. It does not create remotes or connect to GitHub,
1070
+ GitLab, or any other hosted service.</p>
1071
+
1072
+ <p><strong>VS Code Copilot</strong> — <code>install-mcp --ide vscode</code> (and
1073
+ <code>c3 init --ide vscode</code>) generate two additional enforcement files:
1074
+ </p>
1075
+ <ul>
1076
+ <li><code>.github/copilot-instructions.md</code> — workspace instructions auto-injected by Copilot into every
1077
+ chat. Written with REQUIRED/MANDATORY/NEVER language and a 4-step C3 session checklist. Only created if
1078
+ absent; existing customizations are preserved.</li>
1079
+ <li><code>.vscode/settings.json</code> — pins both <code>copilot-instructions.md</code> and
1080
+ <code>CLAUDE.md</code> as instruction context for
1081
+ <code>github.copilot.chat.codeGeneration.instructions</code>, <code>reviewSelection.instructions</code>, and
1082
+ <code>testGeneration.instructions</code>. Merged with existing settings.
1083
+ </li>
1084
+ </ul>
1085
+
1086
+ <p><strong>OpenAI Codex</strong> — <code>install-mcp --ide codex</code> (and <code>c3 init --ide codex</code>)
1087
+ write a TOML config and enforce Codex instructions for C3 usage:</p>
1088
+ <ul>
1089
+ <li><code>.codex/config.toml</code> — project-scoped Codex MCP config in TOML format with a
1090
+ <code>[mcp_servers.c3]</code> section. C3 writes <code>command</code>, <code>args</code>, and
1091
+ <code>enabled = true</code> so the server is active immediately. The global equivalent is
1092
+ <code>~/.codex/config.toml</code>. Auto-detected when a <code>.codex/</code> directory or
1093
+ <code>.codex/config.toml</code> already exists.
1094
+ </li>
1095
+ <li><code>AGENTS.md</code> — Codex reads this file as its instructions context (equivalent to
1096
+ <code>CLAUDE.md</code> for Claude Code). C3 enforces the mandatory workflow: if required C3 markers are
1097
+ missing, it updates <code>AGENTS.md</code> and preserves prior content under an <em>Existing Project
1098
+ Instructions</em> section.
1099
+ </li>
1100
+ <li><strong>Global conflict warning</strong> — if <code>~/.codex/config.toml</code> contains
1101
+ <code>[mcp_servers.c3] enabled = false</code>, C3 warns because this commonly makes C3 appear disabled even
1102
+ when project config is correct.
1103
+ </li>
1104
+ </ul>
1105
+
1106
+ <p><strong>Gemini CLI</strong> — <code>install-mcp --ide gemini</code> (and <code>c3 init --ide gemini</code>)
1107
+ write a project-scoped JSON config and a GEMINI.md instructions file:</p>
1108
+ <ul>
1109
+ <li><code>.gemini/settings.json</code> — project-scoped MCP config under the <code>mcpServers</code> key.
1110
+ Gemini CLI reads both this file and <code>~/.gemini/settings.json</code> (user-global). Merged with existing
1111
+ settings. Auto-detected when a <code>.gemini/</code> directory or <code>.gemini/settings.json</code> already
1112
+ exists.</li>
1113
+ <li><code>GEMINI.md</code> — Gemini CLI reads this file as project context (loaded from the project root and
1114
+ parent directories). Generated with REQUIRED/MANDATORY/NEVER language and the 7-step C3 session protocol. Only
1115
+ created if absent.</li>
1116
+ </ul>
1117
+
1118
+ <p><strong>Google Antigravity</strong> — <code>install-mcp --ide antigravity</code> writes the MCP config to the
1119
+ user-global Antigravity config and a project-local <code>GEMINI.md</code>:</p>
1120
+ <ul>
1121
+ <li><code>~/.gemini/antigravity/mcp_config.json</code> — user-global Antigravity MCP config under the
1122
+ <code>mcpServers</code> key. This is the file managed by Antigravity's <em>Manage MCPs</em> UI. Merged with
1123
+ existing config. Each project still passes <code>--project</code> to the MCP server so C3 indexes the correct
1124
+ directory.
1125
+ </li>
1126
+ <li><code>GEMINI.md</code> — Antigravity and Gemini CLI both read <code>GEMINI.md</code> files from the
1127
+ project root. Same content as Gemini CLI profile. Only created if absent.</li>
1128
+ <li>Auto-detected when <code>~/.gemini/antigravity/</code> directory already exists alongside a
1129
+ <code>.gemini/</code> project directory.
1130
+ </li>
1131
+ </ul>
1132
+
1133
+ <h3>Graceful Degradation</h3>
1134
+ <p>All core C3 tools (search, compress, file_map, memory, sessions) work identically in every IDE. Claude-specific
1135
+ features degrade gracefully:</p>
1136
+ <ul>
1137
+ <li><strong>Transcript search</strong> — returns a helpful message suggesting <code>c3_memory(action='recall')</code> or
1138
+ <code>c3_memory(action='query')</code> as alternatives
1139
+ </li>
1140
+ <li><strong>Hooks</strong> — only installed for Claude Code; VS Code, Cursor, and Codex use hard-language
1141
+ workflow instructions in their instructions file instead</li>
1142
+ <li><strong>Instructions file</strong> — <code>c3_claudemd_generate</code> writes to the IDE-appropriate file
1143
+ (CLAUDE.md, copilot-instructions.md, .cursorrules, AGENTS.md, or GEMINI.md). All IDEs use MANDATORY/NEVER
1144
+ language — the hook-enforcement note is omitted for non-hook IDEs</li>
1145
+ <li><strong>Snapshot/Restore</strong> — works in all IDEs for saving and restoring working context</li>
1146
+ </ul>
1147
+
1148
+ <!-- ─── MCP Tools ───────────────────── -->
1149
+ <h2 id="mcp-tools">MCP Tools Reference</h2>
1150
+ <p>C3 exposes 9 MCP tools. All core tools work without Ollama; delegate requires it.</p>
1151
+
1152
+ <h3>Discovery &amp; Compression</h3>
1153
+ <table>
1154
+ <tr>
1155
+ <th>Tool</th>
1156
+ <th>Description</th>
1157
+ </tr>
1158
+ <tr>
1159
+ <td><code>c3_search</code></td>
1160
+ <td>Consolidated search for code or transcripts. Actions:
1161
+ <span class="badge badge-blue">code</span> TF-IDF search across indexed codebase.
1162
+ <span class="badge badge-green">exact</span> Exact or regex match across tracked files.
1163
+ <span class="badge badge-purple">files</span> Ranked file discovery with structural metadata.
1164
+ <span class="badge badge-warn">transcript</span> Search past conversations (Claude Code).
1165
+ Params: <code>query</code>, <code>action</code>, <code>top_k</code>, <code>max_tokens</code>.
1166
+ </td>
1167
+ </tr>
1168
+ <tr>
1169
+ <td><code>c3_compress</code></td>
1170
+ <td>Compresses a source file to a token-efficient summary. Saves 40-70% tokens. Modes:
1171
+ <span class="badge badge-green">map</span> Structural map (classes/functions) with line numbers.
1172
+ <span class="badge badge-blue">dense_map</span> Detailed structural map.
1173
+ <span class="badge badge-purple">smart</span> Intelligent default (auto-selects best mode).
1174
+ <span class="badge badge-warn">diff</span> Changes only (git diff context).
1175
+ Params: <code>file_path</code>, <code>mode</code>.
1176
+ </td>
1177
+ </tr>
1178
+ <tr>
1179
+ <td><code>c3_read</code></td>
1180
+ <td><strong>Surgically read</strong> specific sections of a file. Resolves symbol names to exact line ranges.
1181
+ Supports multi-file reads (comma-separated paths), multiple <code>symbols</code> (partial/substring match),
1182
+ and manual <code>lines</code> ranges (single int, range, or list of ranges).
1183
+ Params: <code>file_path</code>, <code>symbols</code>, <code>lines</code>, <code>include_docstrings</code>.
1184
+ </td>
1185
+ </tr>
1186
+ <tr>
1187
+ <td><code>c3_filter</code></td>
1188
+ <td>Filter terminal output or extract from files. Two modes:
1189
+ <strong>text mode</strong>: pass <code>text</code> for terminal output filtering (strips noise, collapses pass/fail).
1190
+ <strong>file mode</strong>: pass <code>file_path</code> to extract from logs/data. Use <code>pattern</code> for regex grep.
1191
+ Depth levels: <span class="badge badge-green">fast</span> regex only,
1192
+ <span class="badge badge-purple">smart</span> regex + heuristics (default),
1193
+ <span class="badge badge-warn">deep</span> regex + heuristics + LLM (requires Ollama).
1194
+ Params: <code>file_path</code>, <code>text</code>, <code>pattern</code>, <code>max_lines</code>, <code>depth</code>.
1195
+ </td>
1196
+ </tr>
1197
+ <tr>
1198
+ <td><code>c3_validate</code></td>
1199
+ <td>Syntax-check a file using native language parsers &mdash; no AI, no external services.
1200
+ Supports: py&rarr;ast, json&rarr;json.loads, yaml, xml/svg&rarr;ElementTree, toml,
1201
+ js/jsx&rarr;node, ts&rarr;tsc, tsx&rarr;tsc, java&rarr;javac, go&rarr;gofmt, rs&rarr;rustc,
1202
+ r&rarr;Rscript, sh/bash&rarr;bash -n, html&rarr;lxml, css&rarr;tinycss2.
1203
+ Params: <code>file_path</code>.
1204
+ </td>
1205
+ </tr>
1206
+ </table>
1207
+
1208
+ <h3>Session &amp; Memory</h3>
1209
+ <table>
1210
+ <tr>
1211
+ <th>Tool</th>
1212
+ <th>Description</th>
1213
+ </tr>
1214
+ <tr>
1215
+ <td><code>c3_session</code></td>
1216
+ <td>Consolidated session management. Actions:
1217
+ <span class="badge badge-green">start</span> Begin new session.
1218
+ <span class="badge badge-green">save</span> Persist current session.
1219
+ <span class="badge badge-blue">log</span> Record decision or file change (<code>event_type</code>: decision|file_change|auto).
1220
+ <span class="badge badge-blue">plan</span> Store/update a named plan.
1221
+ <span class="badge badge-purple">snapshot</span> Capture work state before /clear.
1222
+ <span class="badge badge-purple">restore</span> Reinstate context after /clear.
1223
+ <span class="badge badge-warn">compact</span> Snapshot + reset budget.
1224
+ <span class="badge badge-warn">convo_log</span> Zero-token turn logger.
1225
+ </td>
1226
+ </tr>
1227
+ <tr>
1228
+ <td><code>c3_memory</code></td>
1229
+ <td>Consolidated memory management (facts and Semantic LT Memory). Actions:
1230
+ <span class="badge badge-green">add</span> Store a fact with category.
1231
+ <span class="badge badge-blue">recall</span> Search stored facts + semantic memory.
1232
+ <span class="badge badge-purple">query</span> Deep cross-session query (uses vector search with TF-IDF fallback).
1233
+ Params: <code>action</code>, <code>query</code>, <code>fact</code>, <code>category</code>, <code>top_k</code>.
1234
+ </td>
1235
+ </tr>
1236
+ </table>
1237
+
1238
+ <h3>Status &amp; Delegation</h3>
1239
+ <table>
1240
+ <tr>
1241
+ <th>Tool</th>
1242
+ <th>Description</th>
1243
+ </tr>
1244
+ <tr>
1245
+ <td><code>c3_status</code></td>
1246
+ <td>Consolidated status and observability. Views:
1247
+ <span class="badge badge-green">budget</span> Context tokens vs threshold, per-tool breakdown. Use <code>detailed: true</code> for full token accounting.
1248
+ <span class="badge badge-blue">health</span> System diagnostics (Ollama, index, notifications, session, SLTM, memory).
1249
+ <span class="badge badge-purple">notifications</span> List/acknowledge background agent notifications.
1250
+ </td>
1251
+ </tr>
1252
+ <tr>
1253
+ <td><code>c3_delegate</code></td>
1254
+ <td>Delegate heavy tasks to local Ollama LLMs. <strong>Requires Ollama.</strong>
1255
+ Task types: <code>available</code> (zero-cost status check), <code>auto</code> (infer from content),
1256
+ <code>summarize</code>, <code>explain</code>, <code>docstring</code>, <code>review</code>,
1257
+ <code>ask</code>, <code>test</code>, <code>diagnose</code>, <code>improve</code>.
1258
+ Supports multi-file paths. Returns graceful error with suggestion if Ollama unavailable.
1259
+ Params: <code>task</code>, <code>task_type</code>, <code>context</code>, <code>file_path</code>.
1260
+ </td>
1261
+ </tr>
1262
+ <tr>
1263
+ <td><code>c3_edits</code></td>
1264
+ <td>AI-tracked edit versioning and audit trail.
1265
+ <span class="badge badge-green">log</span> Record an edit with file, change_type, summary.
1266
+ <span class="badge badge-blue">history</span> Query edit history (optional file filter, limit, since).
1267
+ <span class="badge badge-purple">versions</span> All version entries for a specific file.
1268
+ <span class="badge badge-green">stats</span> Summary: total edits, files, by change_type, most-edited.
1269
+ Auto-logged by PostToolUse hooks on Edit/Write tools.
1270
+ Configurable tracking levels: minimal, standard, detailed.
1271
+ Standalone UI at <code>/edits</code>.
1272
+ Params: <code>action</code>, <code>file</code>, <code>change_type</code>, <code>summary</code>, <code>limit</code>, <code>since</code>, <code>tag</code>.
1273
+ </td>
1274
+ </tr>
1275
+ </table>
1276
+
1277
+ <div class="tip">
1278
+ <div class="tip-title">Snapshot-and-restore workflow</div>
1279
+ When your context window fills up: (1) call <code>c3_session(action='snapshot')</code> with a task description, (2) reset your
1280
+ context (e.g. <code>/clear</code> in Claude Code, or start a new chat in other IDEs), (3) call
1281
+ <code>c3_session(action='restore')</code> to reinstate your working context. Repeat this every 2-3 milestones to bypass the
1282
+ linear snowball effect of session history.
1283
+ When token usage exceeds the budget threshold, C3 nudges the AI to snapshot and restart.
1284
+ </div>
1285
+
1286
+ <div class="tip">
1287
+ <div class="tip-title">Instructions file management</div>
1288
+ CLAUDE.md management is available via CLI (<code>c3 claudemd generate|save|check</code>), TUI, and REST API.
1289
+ It is no longer exposed as an MCP tool. The <code>ClaudeMdUpdater</code> background agent handles automatic maintenance.
1290
+ </div>
1291
+
1292
+ <div class="tip">
1293
+ <div class="tip-title">Edit Ledger — automatic edit tracking</div>
1294
+ Every Edit/Write tool call is auto-logged to <code>.c3/edit_ledger.jsonl</code> via PostToolUse hooks.
1295
+ Works on Claude Code and Gemini CLI (IDEs with hook support). Other IDEs can use <code>c3_edits(action='log')</code> manually.
1296
+ Configure tracking level in Settings → Edit Ledger: <strong>minimal</strong> (file + type only),
1297
+ <strong>standard</strong> (+ git info &amp; diffs), or <strong>detailed</strong> (+ code snippets).
1298
+ View the full timeline at <code>/edits</code>.
1299
+ </div>
1300
+
1301
+ <h3 id="agent-tools">Background Agents</h3>
1302
+ <p>C3 runs 9 autonomous daemon threads that perform periodic analysis and surface findings via a notification
1303
+ queue. Notifications are automatically prepended to the next MCP tool response so Claude sees them naturally.
1304
+ Each agent supports optional AI enhancement via local Ollama models &mdash; when AI is unavailable or disabled,
1305
+ agents fall back to heuristic logic.</p>
1306
+
1307
+ <table>
1308
+ <tr>
1309
+ <th>Agent</th>
1310
+ <th>Interval</th>
1311
+ <th>Description</th>
1312
+ </tr>
1313
+ <tr>
1314
+ <td><code>IndexStaleness</code></td>
1315
+ <td>60s</td>
1316
+ <td>Monitors file changes. Warns at 5 pending changes, auto-rebuilds index at 15. <span class="badge-blue"
1317
+ style="font-size:10px">AI: summarizes affected areas after rebuild</span></td>
1318
+ </tr>
1319
+ <tr>
1320
+ <td><code>MemoryPruner</code></td>
1321
+ <td>300s</td>
1322
+ <td>Finds duplicate facts and flags unused facts when store exceeds 10 entries. <span class="badge-blue"
1323
+ style="font-size:10px">AI: embedding cosine similarity + merge suggestions</span> <span class="badge-warn"
1324
+ style="font-size:10px">Fallback: Jaccard similarity &ge; 0.8</span></td>
1325
+ </tr>
1326
+ <tr>
1327
+ <td><code>ClaudeMdDrift</code></td>
1328
+ <td>120s</td>
1329
+ <td>Checks the instructions file for staleness when files have changed. Deduplicates by hashing issues. <span
1330
+ class="badge-blue" style="font-size:10px">AI: actionable update summary</span></td>
1331
+ </tr>
1332
+ <!-- ContextBudget agent removed — budget nudges are now inline -->
1333
+ <tr>
1334
+ <td><code>SessionInsight</code></td>
1335
+ <td>600s</td>
1336
+ <td>Analyzes session activity to surface coaching tips (repeated queries, missing remembers, low compression
1337
+ usage, heavy search without extract). Only re-analyzes after 5+ new tool calls. <span class="badge-blue"
1338
+ style="font-size:10px">AI: contextual coaching tip from session summary</span></td>
1339
+ </tr>
1340
+ <tr>
1341
+ <td><code>AutonomyPlanner</code></td>
1342
+ <td>240s</td>
1343
+ <td>Builds a prioritized autonomous next-step plan from recent tool telemetry (context pressure, repeated
1344
+ read/search loops, terminal failures, and stale-index signals). Uses cooldown + score gating to avoid noise.
1345
+ <span class="badge-blue" style="font-size:10px">AI: rewrites plan into concise prioritized actions</span>
1346
+ <span class="badge-warn" style="font-size:10px">Fallback: deterministic signal scoring</span>
1347
+ </td>
1348
+ </tr>
1349
+ <tr>
1350
+ <td><code>ClaudeMdUpdater</code></td>
1351
+ <td>900s</td>
1352
+ <td>Auto-maintains the instructions file using memory, sessions, and staleness checks. Promotes high-relevance
1353
+ facts, refreshes stale sections, compacts when over the IDE's line limit. Supports <code>auto_apply</code>
1354
+ (default on) or dry-run mode. <span class="badge-blue" style="font-size:10px">AI: generates targeted update
1355
+ plan</span></td>
1356
+ </tr>
1357
+ <tr>
1358
+ <td><code>FileMemory</code></td>
1359
+ <td>120s</td>
1360
+ <td>Maintains persistent structural maps of source files. Processes queued files from the Read hook,
1361
+ re-extracts section maps (classes, functions, line ranges) when files change. <span class="badge-blue"
1362
+ style="font-size:10px">AI: generates 1-2 sentence file summary</span> <span class="badge-warn"
1363
+ style="font-size:10px">Fallback: structural map only, no summary</span></td>
1364
+ </tr>
1365
+ <tr>
1366
+ <td><code>DelegateCoach</code></td>
1367
+ <td>180s</td>
1368
+ <td>Monitors session activity for missed delegation opportunities (large file reads, unhandled tracebacks,
1369
+ heavy compression). Emits actionable notifications with exact <code>c3_delegate</code> commands to use.
1370
+ <span class="badge-blue" style="font-size:10px">AI: suggests targeted delegation tips</span> <span
1371
+ class="badge-warn" style="font-size:10px">Fallback: heuristic rule matching</span>
1372
+ </td>
1373
+ </tr>
1374
+ </table>
1375
+
1376
+ <table>
1377
+ <tr>
1378
+ <th>Tool</th>
1379
+ <th>Description</th>
1380
+ </tr>
1381
+ <tr>
1382
+ <td><code>c3_status(view='notifications')</code></td>
1383
+ <td>List and acknowledge agent notifications. Pass <code>data='ack_all'</code> to acknowledge all pending.</td>
1384
+ </tr>
1385
+ </table>
1386
+
1387
+ <div class="tip">
1388
+ <div class="tip-title">Agent configuration</div>
1389
+ Agents can be enabled/disabled, AI-enhanced, and their intervals adjusted via <code>.c3/config.json</code> or
1390
+ the <strong>Agents</strong> tab in the dashboard:
1391
+ <pre><code>{"agents": {"IndexStaleness": {"enabled": true, "interval": 90, "use_ai": true}, "MemoryPruner": {"enabled": false}}}</code></pre>
1392
+ Each agent accepts <code>enabled</code>, <code>use_ai</code>, <code>interval</code>, and <code>ai_model</code>.
1393
+ AI features require a running Ollama instance.
1394
+ </div>
1395
+
1396
+ <div class="tip">
1397
+ <div class="tip-title">Notification severity levels</div>
1398
+ <code>critical</code> and <code>warning</code> notifications auto-surface (prepended to the next tool response,
1399
+ max 3, auto-acknowledged). <code>info</code> notifications are only shown via <code>c3_status(view='notifications')</code>.
1400
+ </div>
1401
+
1402
+ <div class="tip">
1403
+ <div class="tip-title">AI badge &amp; quick actions</div>
1404
+ Notifications include an <code>ai_enhanced</code> boolean field. When <code>true</code>, the dashboard and
1405
+ bottom drawer display a purple <span class="badge badge-purple" style="font-size:10px">AI</span> badge next to
1406
+ the severity indicator, showing at a glance whether the notification was generated by AI or heuristic
1407
+ logic.<br><br>
1408
+ Each agent's notifications also include contextual quick action buttons in the bottom drawer:
1409
+ <table style="margin-top: 8px;">
1410
+ <tr>
1411
+ <th>Agent</th>
1412
+ <th>Actions</th>
1413
+ </tr>
1414
+ <tr>
1415
+ <td><code>IndexStaleness</code></td>
1416
+ <td><strong>Rebuild Index</strong> &mdash; triggers <code>POST /api/index/rebuild</code></td>
1417
+ </tr>
1418
+ <tr>
1419
+ <td><code>MemoryPruner</code></td>
1420
+ <td><strong>View Facts</strong> &mdash; navigates to Memory tab</td>
1421
+ </tr>
1422
+ <tr>
1423
+ <td><code>ClaudeMdDrift</code></td>
1424
+ <td><strong>Check Staleness</strong> &mdash; fetches <code>GET /api/claudemd/check</code> |
1425
+ <strong>Compact</strong> &mdash; triggers <code>POST /api/claudemd/compact</code>
1426
+ </td>
1427
+ </tr>
1428
+ <!-- ContextBudget notification action removed -->
1429
+ <tr>
1430
+ <td><code>SessionInsight</code></td>
1431
+ <td><strong>View Session</strong> &mdash; navigates to Sessions tab</td>
1432
+ </tr>
1433
+ <tr>
1434
+ <td><code>AutonomyPlanner</code></td>
1435
+ <td><strong>View Activity</strong> &mdash; navigates to Activity Log tab</td>
1436
+ </tr>
1437
+ <tr>
1438
+ <td><code>ClaudeMdUpdater</code></td>
1439
+ <td><strong>Check Staleness</strong> &mdash; fetches <code>GET /api/claudemd/check</code> | <strong>View
1440
+ Instructions</strong> &mdash; navigates to Settings tab</td>
1441
+ </tr>
1442
+ <tr>
1443
+ <td><code>FileMemory</code></td>
1444
+ <td><strong>View Files</strong> &mdash; navigates to Smart Index tab</td>
1445
+ </tr>
1446
+ <tr>
1447
+ <td><code>DelegateCoach</code></td>
1448
+ <td><strong>View Activity</strong> &mdash; navigates to Activity Log tab</td>
1449
+ </tr>
1450
+ </table>
1451
+ API-type actions auto-acknowledge the notification after success.
1452
+ </div>
1453
+
1454
+ <h3 id="hybrid-tools">Hybrid Intelligence</h3>
1455
+ <p>v2.3 adds three tiers of local intelligence: output filtering, query routing, and semantic long-term memory.
1456
+ Each tier can be enabled/disabled independently via feature flags.</p>
1457
+ <table>
1458
+ <tr>
1459
+ <th>Tool</th>
1460
+ <th>Description</th>
1461
+ </tr>
1462
+ <tr>
1463
+ <td><code>c3_route</code></td>
1464
+ <td>Classify and route query to local LLM. Returns routing decision with class and target model. Params:
1465
+ <code>query</code>, <code>context</code>, <code>force_class</code>. Classes: <code>log_summary</code>,
1466
+ <code>simple_qa</code>, <code>complex</code>, <code>passthrough</code>. If a preferred model is missing or
1467
+ times out, router attempts configured fallbacks before returning Claude fallback.
1468
+ </td>
1469
+ </tr>
1470
+ <tr>
1471
+ <td><code>c3_summarize</code></td>
1472
+ <td>Summarize text via appropriate local model. Params: <code>text</code>, <code>style</code>. Styles:
1473
+ <code>concise</code>, <code>detailed</code>, <code>bullet</code>.
1474
+ </td>
1475
+ </tr>
1476
+ <tr>
1477
+ <td><code>c3_filter(text=...)</code></td>
1478
+ <td>Filter terminal output. Pass 1: deterministic noise removal. Pass 2: optional LLM summary. Params:
1479
+ <code>text</code>, <code>use_llm</code>.
1480
+ </td>
1481
+ </tr>
1482
+ <tr>
1483
+ <td><code>c3_memory(action='add')</code></td>
1484
+ <td>Store record in SLTM. Params: <code>text</code>, <code>category</code>, <code>metadata_json</code>.
1485
+ Categories: <code>design_docs</code>, <code>api_contracts</code>, <code>bug_history</code>,
1486
+ <code>terminal_summaries</code>, <code>code_notes</code>, <code>general</code>.
1487
+ </td>
1488
+ </tr>
1489
+ <tr>
1490
+ <td><code>c3_memory(action='query')</code></td>
1491
+ <td>Hybrid TF-IDF + vector search across SLTM collections. Params: <code>query</code>, <code>category</code>,
1492
+ <code>top_k</code>.
1493
+ </td>
1494
+ </tr>
1495
+ <tr>
1496
+ <td><code>c3_status(view='memory')</code></td>
1497
+ <td>SLTM collection sizes and backend status (ChromaDB, Ollama).</td>
1498
+ </tr>
1499
+ <tr>
1500
+ <td><code>c3_raw</code></td>
1501
+ <td>Show last unfiltered terminal output (before C3 filtering).</td>
1502
+ </tr>
1503
+ <tr>
1504
+ <td><code>c3_why_context</code></td>
1505
+ <td>Show injected memories, filter/router decisions, and metrics.</td>
1506
+ </tr>
1507
+ <tr>
1508
+ <td><code>c3_delegate</code></td>
1509
+ <td>Offload a task to a local Ollama LLM to save Claude API tokens. Params: <code>task</code>,
1510
+ <code>task_type</code> (<code>summarize</code>, <code>explain</code>, <code>docstring</code>,
1511
+ <code>review</code>, <code>ask</code>, <code>test</code>, <code>diagnose</code>, <code>improve</code>,
1512
+ <code>auto</code>), <code>context</code>, <code>file_path</code>, <code>threshold_tokens</code>,
1513
+ <code>force_delegate</code>. Auto-compresses file context and auto-searches index for <code>ask</code> tasks.
1514
+ Supports task-type inference (<code>auto</code>) and optional threshold gating. Returns
1515
+ <code>[delegate:type:model|latency|confidence]</code> header + response. If the required Ollama model is not
1516
+ pulled locally, returns a specific error with the <code>ollama pull &lt;model&gt;</code> command to fix it.
1517
+ </td>
1518
+ </tr>
1519
+ </table>
1520
+
1521
+ <div class="card">
1522
+ <div class="card-title">Configuration</div>
1523
+ <p style="font-size:13px; color:#5c6a7a; margin-bottom:8px;">Configured via <code>.c3/config.json</code> &rarr;
1524
+ <code>"hybrid"</code> key:
1525
+ </p>
1526
+ <table>
1527
+ <tr>
1528
+ <th>Key</th>
1529
+ <th>Default</th>
1530
+ <th>Description</th>
1531
+ </tr>
1532
+ <tr>
1533
+ <td><code>sltm_alpha</code></td>
1534
+ <td>0.5</td>
1535
+ <td>TF-IDF weight in hybrid search (1-alpha = vector score weight)</td>
1536
+ </tr>
1537
+ <tr>
1538
+ <td><code>sltm_min_score</code></td>
1539
+ <td>0.3</td>
1540
+ <td>Minimum similarity threshold for VectorStore search. Results below this are discarded.</td>
1541
+ </tr>
1542
+ <tr>
1543
+ <td><code>embed_model</code></td>
1544
+ <td>nomic-embed-text</td>
1545
+ <td>Ollama model used for vector embeddings</td>
1546
+ </tr>
1547
+ </table>
1548
+ </div>
1549
+
1550
+ <!-- ─── Proxy Layer ─────────────────── -->
1551
+ <h3 id="proxy-layer">MCP Proxy Layer</h3>
1552
+ <p>The proxy is now an optional advanced mode. The recommended default is direct mode, which points the IDE
1553
+ straight at <code>mcp_server.py</code>. Use proxy mode only if you explicitly want dynamic tool filtering.</p>
1554
+
1555
+ <div class="card">
1556
+ <div class="card-title">Architecture</div>
1557
+ <pre
1558
+ style="font-size:12px; margin:8px 0 0;"><code>IDE &lt;--stdio--&gt; mcp_proxy.py &lt;--subprocess stdio--&gt; mcp_server.py</code></pre>
1559
+ </div>
1560
+
1561
+ <div class="card">
1562
+ <div class="card-title">Proxy Defaults</div>
1563
+ <p style="font-size:13px; color:#5c6a7a; margin-bottom:8px;">When proxy mode is enabled, it defaults to a lean
1564
+ configuration: core tools pinned, filtering enabled, and context injection disabled.</p>
1565
+ <table>
1566
+ <tr>
1567
+ <th>Category</th>
1568
+ <th>Tools</th>
1569
+ <th>Activation</th>
1570
+ </tr>
1571
+ <tr>
1572
+ <td><span class="badge badge-green">core</span></td>
1573
+ <td>search, compress, extract, session_log, remember, recall</td>
1574
+ <td>Always visible</td>
1575
+ </tr>
1576
+ <tr>
1577
+ <td><span class="badge badge-purple">session</span></td>
1578
+ <td>session_start/save, snapshot, restore, transcript_search</td>
1579
+ <td>Recent use or keyword match</td>
1580
+ </tr>
1581
+ <tr>
1582
+ <td><span class="badge badge-blue">memory</span></td>
1583
+ <td>memory_query, sltm_add/search/stats</td>
1584
+ <td>Recent use or keyword match</td>
1585
+ </tr>
1586
+ <tr>
1587
+ <td><span class="badge badge-warn">claudemd</span></td>
1588
+ <td>claudemd_generate/check/compact/promote</td>
1589
+ <td>Recent use or keyword match</td>
1590
+ </tr>
1591
+ <tr>
1592
+ <td><span class="badge badge-purple">hybrid</span></td>
1593
+ <td>route, summarize, filter_output, raw, why_context, delegate</td>
1594
+ <td>Recent use or keyword match</td>
1595
+ </tr>
1596
+ <tr>
1597
+ <td><span class="badge badge-blue">meta</span></td>
1598
+ <td>optimize, token_stats, context_status, notifications</td>
1599
+ <td>Recent use or keyword match</td>
1600
+ </tr>
1601
+ </table>
1602
+ </div>
1603
+
1604
+ <div class="card">
1605
+ <div class="card-title">Context Injection</div>
1606
+ <p style="font-size:13px; color:#5c6a7a;">Disabled by default in proxy mode because it adds recurring response
1607
+ overhead. Enable it only if you have a specific reason to trade tokens for extra continuity hints.</p>
1608
+ </div>
1609
+
1610
+ <div class="card">
1611
+ <div class="card-title">Configuration</div>
1612
+ <p style="font-size:13px; color:#5c6a7a;">Configured via <code>.c3/config.json</code> &rarr;
1613
+ <code>"proxy"</code> key:
1614
+ </p>
1615
+ <table>
1616
+ <tr>
1617
+ <th>Key</th>
1618
+ <th>Default</th>
1619
+ <th>Description</th>
1620
+ </tr>
1621
+ <tr>
1622
+ <td><code>enabled</code></td>
1623
+ <td>true</td>
1624
+ <td>Enable proxy features</td>
1625
+ </tr>
1626
+ <tr>
1627
+ <td><code>PROXY_DISABLE</code></td>
1628
+ <td>false</td>
1629
+ <td>When true, proxy is a transparent pipe</td>
1630
+ </tr>
1631
+ <tr>
1632
+ <td><code>filter_tools</code></td>
1633
+ <td>true</td>
1634
+ <td>Enable dynamic tool filtering by category</td>
1635
+ </tr>
1636
+ <tr>
1637
+ <td><code>always_visible</code></td>
1638
+ <td>["core"]</td>
1639
+ <td>Categories always exposed; use <code>["core"]</code> for lean defaults or <code>["all"]</code> to bypass filtering</td>
1640
+ </tr>
1641
+ <tr>
1642
+ <td><code>max_tools</code></td>
1643
+ <td>12</td>
1644
+ <td>Maximum tools visible per turn</td>
1645
+ </tr>
1646
+ <tr>
1647
+ <td><code>use_slm</code></td>
1648
+ <td>true</td>
1649
+ <td>Use local SLM for uncertain classifications</td>
1650
+ </tr>
1651
+ <tr>
1652
+ <td><code>slm_model</code></td>
1653
+ <td>gemma3n:latest</td>
1654
+ <td>Ollama model for SLM classification</td>
1655
+ </tr>
1656
+ <tr>
1657
+ <td><code>context_window_size</code></td>
1658
+ <td>10</td>
1659
+ <td>Rolling window of tracked tool calls</td>
1660
+ </tr>
1661
+ <tr>
1662
+ <td><code>inject_context_summary</code></td>
1663
+ <td>false</td>
1664
+ <td>Append context line to tool responses</td>
1665
+ </tr>
1666
+ </table>
1667
+ </div>
1668
+
1669
+ <div class="tip">
1670
+ <div class="tip-title">Recommended Setup</div>
1671
+ Use direct mode unless you explicitly want proxy behavior. Install with
1672
+ <code>--mcp-mode direct</code> for the recommended path or <code>--mcp-mode proxy</code> for advanced
1673
+ filtering experiments.
1674
+ </div>
1675
+
1676
+ <div class="tip">
1677
+ <div class="tip-title">Windows Compatibility</div>
1678
+ The proxy uses a threaded stdin reader instead of <code>asyncio.connect_read_pipe</code>, which does not work on
1679
+ Windows' ProactorEventLoop. This is handled internally — no extra configuration is needed.
1680
+ </div>
1681
+
1682
+ <!-- ─── File Memory ─────────────────── -->
1683
+ <h3 id="file-memory">File Memory System</h3>
1684
+ <p>File Memory maintains a persistent structural index of source files &mdash; classes, functions, imports with
1685
+ exact line ranges &mdash; so Claude can do targeted <code>Read</code> calls with
1686
+ <code>offset</code>/<code>limit</code> instead of reading entire files.
1687
+ </p>
1688
+
1689
+ <div class="card">
1690
+ <div class="card-title">How It Works</div>
1691
+ <ol>
1692
+ <li><code>c3_file_map("services/agents.py")</code> returns a structural map (~50-100 tokens)</li>
1693
+ <li>Claude identifies the section it needs (e.g. <code>check()</code> at lines 115-152)</li>
1694
+ <li><code>Read(file_path, offset=115, limit=38)</code> reads only that section</li>
1695
+ </ol>
1696
+ <p style="margin-top: 8px;">Maps are cached in <code>.c3/file_memory/</code> (one JSON per file, keyed by MD5 of
1697
+ path). The <code>FileMemoryAgent</code> background thread re-extracts sections when files change and
1698
+ optionally generates AI summaries via Ollama.</p>
1699
+ </div>
1700
+
1701
+ <div class="card">
1702
+ <div class="card-title">Supported Languages</div>
1703
+ <p>Rich structural mapping (AST-based) is available for:</p>
1704
+ <div class="grid-2">
1705
+ <ul class="check-list">
1706
+ <li><strong>Python</strong> (.py) - Classes, functions, imports</li>
1707
+ <li><strong>JavaScript/TS</strong> (.js, .ts, .tsx, .jsx) - Classes, methods, arrows</li>
1708
+ <li><strong>HTML/Markdown</strong> (.html, .md) - Headings, IDs</li>
1709
+ </ul>
1710
+ <ul class="check-list">
1711
+ <li><strong>Go/Rust</strong> (.go, .rs) - Functions, traits, structs, impls</li>
1712
+ <li><strong>JSON/YAML</strong> (.json, .yaml) - Top-level keys/properties</li>
1713
+ <li><strong>CSS</strong> (.css) - Rule sets, media queries</li>
1714
+ </ul>
1715
+ </div>
1716
+ </div>
1717
+
1718
+ <h3>Example Map Output</h3>
1719
+ <pre><code># services/agents.py (933 lines, python)
1720
+ Background agent system with periodic check loop and AI enhancement.
1721
+
1722
+ 9-9 import json
1723
+ 19-102 class BackgroundAgent
1724
+ Base class for background analysis agents.
1725
+ 38-41 ai_available(self)
1726
+ 42-51 _ai_generate(self, prompt, system, max_tokens)
1727
+ 52-58 start(self)
1728
+ 59-64 stop(self)
1729
+ 103-152 class IndexStalenessAgent
1730
+ 115-152 check(self)
1731
+ ...</code></pre>
1732
+
1733
+ <!-- ─── Hooks ──────────────────────── -->
1734
+ <h3 id="hooks">PostToolUse Hooks <span class="badge badge-blue" style="font-size:10px">Claude Code only</span>
1735
+ </h3>
1736
+ <p>C3 registers two PostToolUse hooks in <code>.claude/settings.local.json</code> that run after Claude executes
1737
+ certain tools. These hooks are only installed for Claude Code &mdash; other IDEs rely on the workflow
1738
+ instructions in their instructions file instead.</p>
1739
+
1740
+ <table>
1741
+ <tr>
1742
+ <th>Hook</th>
1743
+ <th>Trigger</th>
1744
+ <th>Behavior</th>
1745
+ </tr>
1746
+ <tr>
1747
+ <td><code>hook_filter.py</code></td>
1748
+ <td>After <code>Bash</code> tool</td>
1749
+ <td>Filters terminal output through C3's two-pass output filter (deterministic + optional LLM). Replaces the
1750
+ tool result with a compressed version when &gt;10% savings. Injects <code>c3_delegate</code> hints into
1751
+ <code>additionalContext</code> for unhandled tracebacks and long outputs. Stores original for
1752
+ <code>c3_raw</code> retrieval.
1753
+ </td>
1754
+ </tr>
1755
+ <tr>
1756
+ <td><code>hook_read.py</code></td>
1757
+ <td>After <code>Read</code> tool</td>
1758
+ <td><strong>STRICT ENFORCEMENT</strong> of the C3-First workflow. Checks the activity log for recent
1759
+ <code>c3_file_map</code>/<code>c3_search</code>/<code>c3_compress</code> calls targeting the same file. If
1760
+ none found and the file is 30+ lines of code, injects a ⚠️ <code>[c3:enforce]</code> warning via
1761
+ <code>additionalContext</code>. Also queues the file for async indexing by the FileMemory agent.
1762
+ </td>
1763
+ </tr>
1764
+ </table>
1765
+
1766
+ <div class="tip">
1767
+ <div class="tip-title">Enforcement skips</div>
1768
+ The Read hook does not enforce on: files under 30 lines, targeted reads (offset/limit already used), or binary
1769
+ files (images, PDFs). It now monitors most text-based formats including web (HTML/CSS), data (JSON/YAML), and
1770
+ docs (MD). Enforcement checks the last 30 activity log entries for any C3 tool call referencing the same file.
1771
+ </div>
1772
+
1773
+ <!-- ─── MCP Behavior ────────────────── -->
1774
+ <h2 id="mcp-behavior">Automatic Behavior</h2>
1775
+
1776
+ <div class="card">
1777
+ <div class="card-title">On Startup</div>
1778
+ <ul>
1779
+ <li>Loads (or builds) the code index</li>
1780
+ <li>Loads (or builds) the transcript index from <code>~/.claude/projects/</code> (Claude Code only; skipped in
1781
+ other IDEs)</li>
1782
+ <li>Starts a new session</li>
1783
+ <li>Begins watching project files for changes</li>
1784
+ <li>Initializes the file memory store for structural file indexing</li>
1785
+ <li>Syncs Claude Code conversation transcripts into the conversation store (Claude Code only)</li>
1786
+ <li>Starts a background thread that re-syncs conversation transcripts every 60 seconds (Claude Code only)</li>
1787
+ <li>Launches background agents (index staleness, memory pruner, instructions file drift, context budget,
1788
+ session insight, instructions file auto-updater, file memory)</li>
1789
+ </ul>
1790
+ </div>
1791
+ <div class="card">
1792
+ <div class="card-title">On Shutdown</div>
1793
+ <ul>
1794
+ <li>Stops the background conversation sync thread</li>
1795
+ <li>Stops all background agents</li>
1796
+ <li>Stops the file watcher</li>
1797
+ <li>Saves the current session</li>
1798
+ <li>Performs a final forced sync of Claude Code conversation transcripts to capture the session's last turns
1799
+ (Claude Code only)</li>
1800
+ </ul>
1801
+ </div>
1802
+
1803
+ <h3>Compact Response Format</h3>
1804
+ <p>All MCP tool responses use a terse <code>[tag:value]</code> format instead of markdown prose, reducing response
1805
+ overhead by ~35%. Examples:</p>
1806
+ <pre><code>[search:auth middleware] 3 results, 1200tok
1807
+ --- services/auth.py:L10-45 verify_token (function,180tok)
1808
+ ...code...
1809
+
1810
+ [stats] files:18 chunks:142 tokens:24.5k | symbols:89 index:38KB facts:12 calls:7
1811
+
1812
+ [logged:decision]
1813
+ [nudge:save_facts|calls:25|facts:0]
1814
+
1815
+ [remembered:a1b2c3] total:13
1816
+ [recall:auth] 3 facts
1817
+ [architecture] Auth uses JWT in localStorage
1818
+ [convention] All middleware in services/middleware/
1819
+
1820
+ [snapshot:20260228_143012] 167tok captured
1821
+ [restore:20260228_143012] task:Fix auth flow d:3 f:5
1822
+
1823
+ [transcript:auth middleware] 3r,890tok
1824
+ --- abc123:t7 [2026-02-27] score:4.2
1825
+ ...turn text...
1826
+
1827
+ [extract:.log] 8500tok->320tok (96% saved)
1828
+ [log] 2400 lines | ERROR:12 | WARN:45</code></pre>
1829
+ <p>Claude parses these tags natively — no information is lost, but each response uses fewer tokens in the
1830
+ context window.</p>
1831
+
1832
+ <h3>Token counting</h3>
1833
+ <p>C3 uses tiktoken (<code>cl100k_base</code> encoding) for accurate token counts. Falls back to a heuristic
1834
+ estimator if tiktoken is unavailable.</p>
1835
+
1836
+ <h3>Code indexing</h3>
1837
+ <p>The indexer scans project files, splits them into structural chunks (functions, classes, blocks), and builds a
1838
+ TF-IDF index. This lets <code>c3_search</code> find relevant code without sending the entire codebase to Claude.
1839
+ </p>
1840
+ <p><strong>Supported file types (80+):</strong></p>
1841
+ <table>
1842
+ <tr>
1843
+ <th>Category</th>
1844
+ <th>Extensions</th>
1845
+ </tr>
1846
+ <tr>
1847
+ <td>Python</td>
1848
+ <td><code>.py</code> <code>.pyi</code> <code>.pyx</code></td>
1849
+ </tr>
1850
+ <tr>
1851
+ <td>JavaScript / TypeScript</td>
1852
+ <td><code>.js</code> <code>.jsx</code> <code>.ts</code> <code>.tsx</code> <code>.mjs</code> <code>.cjs</code>
1853
+ </td>
1854
+ </tr>
1855
+ <tr>
1856
+ <td>Web</td>
1857
+ <td><code>.html</code> <code>.htm</code> <code>.css</code> <code>.scss</code> <code>.sass</code>
1858
+ <code>.less</code> <code>.vue</code> <code>.svelte</code>
1859
+ </td>
1860
+ </tr>
1861
+ <tr>
1862
+ <td>Data / Config</td>
1863
+ <td><code>.json</code> <code>.yaml</code> <code>.yml</code> <code>.toml</code> <code>.ini</code>
1864
+ <code>.cfg</code> <code>.xml</code> <code>.csv</code>
1865
+ </td>
1866
+ </tr>
1867
+ <tr>
1868
+ <td>Systems</td>
1869
+ <td><code>.c</code> <code>.h</code> <code>.cpp</code> <code>.cxx</code> <code>.cc</code> <code>.hpp</code>
1870
+ <code>.rs</code> <code>.go</code> <code>.java</code> <code>.kt</code> <code>.scala</code> <code>.cs</code>
1871
+ </td>
1872
+ </tr>
1873
+ <tr>
1874
+ <td>Scripting</td>
1875
+ <td><code>.sh</code> <code>.bash</code> <code>.zsh</code> <code>.fish</code> <code>.ps1</code>
1876
+ <code>.bat</code> <code>.rb</code> <code>.pl</code> <code>.lua</code> <code>.php</code> <code>.r</code>
1877
+ <code>.R</code> <code>.jl</code>
1878
+ </td>
1879
+ </tr>
1880
+ <tr>
1881
+ <td>Query / Schema</td>
1882
+ <td><code>.sql</code> <code>.graphql</code> <code>.gql</code> <code>.prisma</code></td>
1883
+ </tr>
1884
+ <tr>
1885
+ <td>Functional</td>
1886
+ <td><code>.hs</code> <code>.ex</code> <code>.exs</code> <code>.erl</code> <code>.clj</code> <code>.elm</code>
1887
+ <code>.ml</code>
1888
+ </td>
1889
+ </tr>
1890
+ <tr>
1891
+ <td>Mobile</td>
1892
+ <td><code>.swift</code> <code>.m</code> <code>.dart</code></td>
1893
+ </tr>
1894
+ <tr>
1895
+ <td>Docs / Markup</td>
1896
+ <td><code>.md</code> <code>.mdx</code> <code>.rst</code> <code>.tex</code> <code>.adoc</code></td>
1897
+ </tr>
1898
+ <tr>
1899
+ <td>DevOps / IaC</td>
1900
+ <td><code>.tf</code> <code>.hcl</code> <code>.dockerfile</code> <code>.nix</code></td>
1901
+ </tr>
1902
+ <tr>
1903
+ <td>Other</td>
1904
+ <td><code>.proto</code> <code>.thrift</code> <code>.zig</code> <code>.nim</code> <code>.v</code>
1905
+ <code>.makefile</code> <code>.cmake</code>
1906
+ </td>
1907
+ </tr>
1908
+ </table>
1909
+ <p><strong>Skipped directories:</strong> <code>node_modules</code> <code>.git</code> <code>__pycache__</code>
1910
+ <code>.c3</code> <code>venv</code> <code>dist</code> <code>build</code> <code>.next</code> <code>.cache</code>
1911
+ </p>
1912
+
1913
+ <h3>File watching</h3>
1914
+ <p>The watcher runs on a background thread and tracks file creates, modifications, deletions, and moves. When
1915
+ enough changes accumulate, the indexer rebuilds the index automatically (or run <code>c3 index</code> manually).</p>
1916
+
1917
+ <!-- ─── Web Dashboard ───────────────── -->
1918
+ <h2 id="dashboard">Web Dashboard</h2>
1919
+
1920
+ <pre><code>c3 ui /path/to/your/project # Opens full UI at http://localhost:3333/
1921
+ c3 ui /path/to/your/project --nano # Opens nano mission-control UI at /nano
1922
+ c3 ui /path/to/your/project --port 8080 # Custom port
1923
+ c3 ui /path/to/your/project --no-browser # Don't auto-open browser
1924
+ c3 ui /path/to/your/project --silent # Hide API request logs in terminal</code></pre>
1925
+
1926
+ <p>The dashboard provides a visual interface for all C3 capabilities — compression, search, sessions, memory,
1927
+ agents, and system settings. The layout is <code>[Left Nav] [Main Content] [Right Sidebar]</code>. Both the left
1928
+ navigation and right sidebar support <strong>hover-to-open</strong>: when collapsed to their icon strip,
1929
+ hovering expands them automatically. Click the <strong>pin icon</strong> (📌) to keep a panel locked open;
1930
+ click again to unpin and return to hover-only mode. Pin state is saved to <code>localStorage</code> and restored
1931
+ on next load.</p>
1932
+
1933
+ <div class="tip">
1934
+ <div class="tip-title">Multiple project dashboards</div>
1935
+ Each <code>c3 ui</code> launch auto-selects the next free port starting from 3333. Each instance uses
1936
+ <code>window.location.origin</code> for all API calls, so opening a second project at
1937
+ <code>localhost:3334</code> shows only that project's data. The startup banner prints the assigned URL and
1938
+ project path.
1939
+ </div>
1940
+
1941
+ <h2 id="tabs">Dashboard Tabs</h2>
1942
+
1943
+ <div class="tabs-preview">
1944
+ <div class="tab-card">
1945
+ <div class="tab-name"><span class="badge badge-green">1</span> Dashboard</div>
1946
+ <div class="tab-desc">Token savings card (tokens saved, savings rate with progress bar, est. cost &amp; time
1947
+ saved), Claude token usage (input/output/total tokens, est. API cost), file stats, memory, MCP status, agent
1948
+ notifications (with severity and AI badges), recent tool calls.</div>
1949
+ </div>
1950
+ <div class="tab-card">
1951
+ <div class="tab-name"><span class="badge badge-blue">2</span> Compressor</div>
1952
+ <div class="tab-desc">Stats row (total files, tokens, avg savings, last compressed), searchable file picker
1953
+ with sort (name/tokens/type) and type-colored badges, mode selector with descriptions, single-file compress
1954
+ with line-numbered output and copy button, batch-all compression with aggregate stats, clickable compression
1955
+ history (last 10), and a collapsible <strong>Compression Dictionary</strong> panel showing all action codes,
1956
+ term codes, and project-specific abbreviations.</div>
1957
+ </div>
1958
+ <div class="tab-card">
1959
+ <div class="tab-name"><span class="badge badge-purple">3</span> Smart Index</div>
1960
+ <div class="tab-desc">Stats row (files, chunks, codebase tokens, symbols, index size), search input with
1961
+ configurable top_k (3/5/10/15/20) and max_tokens (2K/4K/8K), collapsible search history (last 10, click to
1962
+ restore), and expandable result cards with line-numbered code, per-chunk copy, copy-all, file-type badges,
1963
+ relevance score bars, and rebuild with success feedback.</div>
1964
+ </div>
1965
+ <div class="tab-card">
1966
+ <div class="tab-name"><span class="badge badge-warn">4</span> Sessions</div>
1967
+ <div class="tab-desc">Current Session card (highlighted, with stat mini-boxes for decisions, files, tool
1968
+ calls) at top, Past Sessions list below. Tool call data is backfilled from the activity log when the session
1969
+ file has none.</div>
1970
+ </div>
1971
+ <div class="tab-card">
1972
+ <div class="tab-name"><span class="badge badge-purple">5</span> Memory</div>
1973
+ <div class="tab-desc">Store and search facts, view all facts grouped by category, delete facts, stat boxes for
1974
+ totals and recall counts. Auto-refreshes every 5 seconds so facts saved via MCP appear in real time.</div>
1975
+ </div>
1976
+ <div class="tab-card">
1977
+ <div class="tab-name"><span class="badge badge-blue">6</span> Activity Log</div>
1978
+ <div class="tab-desc">Live event timeline with type filtering, persistent auto-refresh, expandable detail
1979
+ view. Tool call events show color-coded tool name badges (search=blue, compress=purple, etc.).</div>
1980
+ </div>
1981
+ <div class="tab-card">
1982
+ <div class="tab-name"><span class="badge badge-green">7</span> Conversations</div>
1983
+ <div class="tab-desc">Full conversation history viewer. Displays user and AI turns in a threaded chat layout
1984
+ per session. Features:
1985
+ <ul style="margin: 6px 0 0 0; padding-left: 18px;">
1986
+ <li><strong>Session list</strong> - left panel lists all sessions sorted newest-first. Shows title (first
1987
+ user message), relative date, turn count, and source badge. Each row has direct <strong>Plans</strong>
1988
+ and <strong>Todos</strong> quick-jump buttons.</li>
1989
+ <li><strong>Chat / Plans / Todos views</strong> — switch between the full conversation thread, logged
1990
+ decisions/plans (<code>c3_session_log</code> events), and extracted markdown checkbox items; Plans and
1991
+ Todos also load automatically when using the quick-jump buttons</li>
1992
+ <li><strong>Search scope toggle</strong> - explicit <em>All</em> / <em>Session</em> toggle next to the
1993
+ search box. Search is debounced and scope-aware; "Session" is disabled until a conversation is open.
1994
+ </li>
1995
+ <li><strong>Table of Contents</strong> - toggle the <strong>ToC</strong> button to show a collapsible
1996
+ index of user prompts (numbered, 2-line preview). In narrow layouts the ToC is hidden for readability.
1997
+ </li>
1998
+ <li><strong>Pagination</strong> - turns are loaded in pages with a <em>Load more</em> action for long
1999
+ sessions.</li>
2000
+ <li><strong>Session rename</strong> — title overrides stored in <code>localStorage</code> (key
2001
+ <code>c3_conv_titles</code>); editable inline in the list or via the Rename button in the session header
2002
+ </li>
2003
+ <li>Gzip compression for old archives; auto-sync from Claude Code transcripts/imports; manual logging via
2004
+ <code>c3_session(action='convo_log', role=..., text=..., session_id?, source?)</code> for other IDEs
2005
+ </li>
2006
+ </ul>
2007
+ </div>
2008
+ </div>
2009
+ <div class="tab-card">
2010
+ <div class="tab-name"><span class="badge badge-warn">8</span> Agents</div>
2011
+ <div class="tab-desc">Per-agent configuration: enabled/use_ai toggles, interval input, AI model selector.
2012
+ Agent-specific advanced settings (thresholds, embed model, autonomy planner scoring/cooldown, auto-apply mode).
2013
+ Supports all 9 agents including AutonomyPlanner and DelegateCoach.</div>
2014
+ </div>
2015
+ <div class="tab-card">
2016
+ <div class="tab-name"><span class="badge badge-purple">9</span> Hybrid</div>
2017
+ <div class="tab-desc">Three-panel view: Output Filter savings (calls, tokens, savings %) | Router decisions
2018
+ (routes by class, avg latency) | SLTM collections (vector status, record counts). Feature flag toggles to
2019
+ enable/disable each tier independently. Includes Delegate Threshold Policy controls for local AI delegation
2020
+ gating (<code>threshold_enabled</code>, minimum tokens, task-type scopes, and force-delegate task types).</div>
2021
+ </div>
2022
+ <div class="tab-card">
2023
+ <div class="tab-name"><span class="badge badge-warn">10</span> Proxy</div>
2024
+ <div class="tab-desc">Tool Visibility card with "Show All / Filter by Category" mode selector, per-category
2025
+ pin toggles with expandable tool lists, visible/total tool count badge. Reconnect banner when tool
2026
+ visibility changes (prompts to restart session or run <code>/mcp</code>). Proxy settings (enable/disable,
2027
+ context injection, SLM classification, max tools, window size). Live context panel with detected goal,
2028
+ recent files, decisions, and tool calls. Traffic and context injection metrics.</div>
2029
+ </div>
2030
+ <div class="tab-card">
2031
+ <div class="tab-name"><span class="badge badge-green">11</span> Settings</div>
2032
+ <div class="tab-desc">Project info (editable name, tech stack, description), quick actions (rebuild index,
2033
+ save instructions file), project data management (view sizes and item counts per .c3/ category, clear
2034
+ actions), instructions file management, and MCP management: target IDE selector (Claude/Gemini/VS
2035
+ Code/Cursor/Codex/Antigravity), custom MCP add form, installed MCP cards, and per-card trash removal.
2036
+ Removing <code>c3</code> can also clean related IDE files/hooks. Includes IDE selector for C3 MCP
2037
+ installation and optimization suggestions.</div>
2038
+ </div>
2039
+ </div>
2040
+
2041
+ <h3 id="header-bar">Header Bar</h3>
2042
+ <p>A persistent top bar above the main content area. Shows the active tab icon and title, connection status,
2043
+ inline quick stats (savings % and indexed file count), and action buttons:</p>
2044
+ <ul>
2045
+ <li><strong>Connection status</strong> — glowing dot with "Live" / "Offline" label. When health data is
2046
+ available, color-coded service badges appear inline: <span style="color:#00e5a0">green</span> for connected,
2047
+ <span style="color:#ff4d6a">red</span> for disconnected. All four services (c3, proxy, ollama, sltm) are
2048
+ always shown so you can see at a glance what is down. The <strong>proxy</strong> badge uses dual-signal
2049
+ detection: green if the MCP config references <code>mcp_proxy.py</code>, OR if
2050
+ <code>.c3/proxy_state.json</code> was written within the last 4 hours (meaning the proxy actively ran in this
2051
+ session).
2052
+ </li>
2053
+ <li><strong>Check connections button</strong> — small refresh icon next to the service badges. Clicking it
2054
+ re-calls <code>GET /api/health</code> and updates all badges immediately; the icon spins while the request is
2055
+ in flight. The same button is also present in the left sidebar bottom panel and in the right sidebar Services
2056
+ section.</li>
2057
+ <li><strong>Project switcher</strong> — appears automatically when two or more <code>c3 ui</code> instances
2058
+ are running simultaneously. Shows the current project name and a count badge. Click to open a dropdown listing
2059
+ all running sessions; clicking another project navigates to its UI in the same tab. The switcher polls
2060
+ <code>GET /api/registry</code> every 30 seconds and is hidden when only one session is active.
2061
+ </li>
2062
+ <li><strong>Light/dark toggle</strong> — sun/moon button switches between dark and light mode. Preference is
2063
+ saved to <code>localStorage</code> and restored on next load.</li>
2064
+ <li><strong>Refresh</strong> — manually re-fetch stats and file data from the API</li>
2065
+ <li><strong>Docs</strong> — open the documentation page in a new tab</li>
2066
+ <li><strong>Panel pin</strong> — pin or unpin the right sidebar. When pinned (icon highlighted), the panel
2067
+ stays open. When unpinned, it collapses to a 40px icon strip and expands on hover.</li>
2068
+ </ul>
2069
+
2070
+ <h3 id="left-nav">Left Navigation</h3>
2071
+ <p>A collapsible vertical tab list on the left edge. Supports two modes:</p>
2072
+ <ul>
2073
+ <li><strong>Pinned open</strong> — 210px wide, shows icon + label for each tab. The C3 logo and status panel
2074
+ are visible. Click the <strong>pin icon</strong> in the header to unpin.</li>
2075
+ <li><strong>Hover-only</strong> — collapses to a 54px icon strip. Hover over it to expand temporarily; moving
2076
+ the mouse away collapses it again. Click the pin icon while expanded to lock it open.</li>
2077
+ </ul>
2078
+ <p>The bottom of the left nav shows a connection status dot, service badges, and a health refresh button (only
2079
+ visible when expanded).</p>
2080
+
2081
+ <h3 id="right-sidebar">Right Sidebar (Control Bar)</h3>
2082
+ <p>A collapsible right sidebar visible on all tabs. Supports the same hover-open + pin modes as the left nav:</p>
2083
+ <ul>
2084
+ <li><strong>Pinned open</strong> — 320px wide, shows full control bar content. Pin icon in the header is
2085
+ highlighted (accent color). Click to unpin.</li>
2086
+ <li><strong>Hover-only</strong> — collapses to a 40px icon strip. Hover to expand temporarily. Click the pin
2087
+ icon in the expanded header, or click any icon in the collapsed strip, to lock it open.</li>
2088
+ </ul>
2089
+
2090
+ <div class="card">
2091
+ <div class="card-title">Savings Summary</div>
2092
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 6px;">Compact display at the top showing
2093
+ tokens saved, estimated cost, estimated time, and Claude input/output token counts. Only visible when the
2094
+ sidebar is expanded and stats are available.</p>
2095
+ </div>
2096
+ <div class="card">
2097
+ <div class="card-title">Quick Settings</div>
2098
+ <ul>
2099
+ <li><strong>Rebuild Index</strong> — triggers <code>POST /api/index/rebuild</code></li>
2100
+ <li><strong>Save Instructions</strong> — triggers <code>POST /api/claudemd/save</code> (writes to
2101
+ IDE-appropriate file)</li>
2102
+ <li><strong>Auto-refresh toggle</strong> — enables 5-second polling for the activity feed</li>
2103
+ </ul>
2104
+ </div>
2105
+ <div class="card">
2106
+ <div class="card-title">Activity Feed</div>
2107
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 6px;">Compact view of the last 15 events
2108
+ from <code>/api/activity?limit=15</code>. Each row shows time-ago, a color-coded tool name badge (for tool
2109
+ calls) or event type badge, and a one-line summary. Click "View all" to navigate to the Activity Log tab.</p>
2110
+ </div>
2111
+ <div class="card">
2112
+ <div class="card-title">Current Session</div>
2113
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 6px;">Shows the live running session from
2114
+ <code>/api/sessions/current</code>, which reconstructs the active MCP session from the activity log. Displays
2115
+ a glowing "Live Session" indicator, session ID, started time, live duration, and counts for decisions, files
2116
+ touched, and tool calls. Falls back to the most recent saved session if no live session is active. Click "View
2117
+ all sessions" to navigate to the Sessions tab.
2118
+ </p>
2119
+ </div>
2120
+ <div class="card">
2121
+ <div class="card-title">Services</div>
2122
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 6px;">Color-coded badges for the four C3
2123
+ services: <code>c3</code>, <code>proxy</code>, <code>ollama</code>, and <code>sltm</code>. Green = reachable,
2124
+ red = unreachable. A dedicated refresh icon button sits inline with the "Services" label — clicking it
2125
+ re-calls <code>GET /api/health</code> and updates all badges with a spin animation. Shows "not checked yet"
2126
+ until the first check completes. The same connection status (with its own refresh button) is mirrored in the
2127
+ header bar and in the left sidebar bottom panel.</p>
2128
+ </div>
2129
+
2130
+ <div class="tip">
2131
+ <div class="tip-title">Hover-open &amp; pin</div>
2132
+ Both sidebars start pinned open. Unpin via the pin icon to switch to hover-only mode — the panel collapses to
2133
+ an icon strip and expands on mouse enter. Clicking any icon in the collapsed strip (right sidebar) or the pin
2134
+ icon (left nav) re-pins it. Pin state persists across page reloads via <code>localStorage</code>.
2135
+ </div>
2136
+
2137
+ <h3 id="bottom-drawer">Bottom Drawer</h3>
2138
+ <p>A slide-up drawer anchored to the bottom of the main content area. It has two tabs:</p>
2139
+
2140
+ <div class="card">
2141
+ <div class="card-title">Agent Activity</div>
2142
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 6px;">
2143
+ Lists all pending agent notifications with severity badge, optional <span class="badge badge-purple"
2144
+ style="font-size:10px">AI</span> badge (when <code>ai_enhanced</code> is true), agent name, title, message,
2145
+ and relative timestamp. Each notification includes contextual quick action buttons that either call an API
2146
+ endpoint (with inline feedback and auto-acknowledge) or navigate to a relevant dashboard tab. Supports
2147
+ individual acknowledge and "Acknowledge All".
2148
+ </p>
2149
+ </div>
2150
+ <div class="card">
2151
+ <div class="card-title">API Console</div>
2152
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 6px;">
2153
+ Live tool call timeline from the activity log. Each row shows timestamp, tool name badge, arguments summary,
2154
+ and result preview. Click a row to expand the full args/result JSON.
2155
+ </p>
2156
+ </div>
2157
+
2158
+ <!-- ─── API ─────────────────────────── -->
2159
+ <h2 id="api">REST API</h2>
2160
+ <p>The web server exposes a full REST API at <code>http://localhost:3333</code>.</p>
2161
+
2162
+ <h3>Core</h3>
2163
+ <table>
2164
+ <tr>
2165
+ <th>Method</th>
2166
+ <th>Endpoint</th>
2167
+ <th>Description</th>
2168
+ </tr>
2169
+ <tr>
2170
+ <td><span class="badge badge-green">GET</span></td>
2171
+ <td><code>/api/stats</code></td>
2172
+ <td>Comprehensive system stats including <code>claude_tokens</code> (input/output from Claude Code sessions)
2173
+ and <code>total_tool_calls</code></td>
2174
+ </tr>
2175
+ <tr>
2176
+ <td><span class="badge badge-green">GET</span></td>
2177
+ <td><code>/api/files</code></td>
2178
+ <td>List project files</td>
2179
+ </tr>
2180
+ <tr>
2181
+ <td><span class="badge badge-blue">POST</span></td>
2182
+ <td><code>/api/compress</code></td>
2183
+ <td>Compress a file <code>{file, mode}</code></td>
2184
+ </tr>
2185
+ <tr>
2186
+ <td><span class="badge badge-blue">POST</span></td>
2187
+ <td><code>/api/compress/batch</code></td>
2188
+ <td>Batch compress all project files <code>{mode}</code></td>
2189
+ </tr>
2190
+ <tr>
2191
+ <td><span class="badge badge-green">GET</span></td>
2192
+ <td><code>/api/compress/protected-files</code></td>
2193
+ <td>List files blocked from compression</td>
2194
+ </tr>
2195
+ <tr>
2196
+ <td><span class="badge badge-blue">POST</span></td>
2197
+ <td><code>/api/search</code></td>
2198
+ <td>Search code index <code>{query, top_k, max_tokens}</code></td>
2199
+ </tr>
2200
+ <tr>
2201
+ <td><span class="badge badge-blue">POST</span></td>
2202
+ <td><code>/api/index/rebuild</code></td>
2203
+ <td>Rebuild the index</td>
2204
+ </tr>
2205
+ <tr>
2206
+ <td><span class="badge badge-green">GET</span></td>
2207
+ <td><code>/api/index/stats</code></td>
2208
+ <td>Index statistics</td>
2209
+ </tr>
2210
+ </table>
2211
+
2212
+ <h3>Sessions</h3>
2213
+ <table>
2214
+ <tr>
2215
+ <th>Method</th>
2216
+ <th>Endpoint</th>
2217
+ <th>Description</th>
2218
+ </tr>
2219
+ <tr>
2220
+ <td><span class="badge badge-green">GET</span></td>
2221
+ <td><code>/api/sessions</code></td>
2222
+ <td>List all sessions</td>
2223
+ </tr>
2224
+ <tr>
2225
+ <td><span class="badge badge-green">GET</span></td>
2226
+ <td><code>/api/sessions/current</code></td>
2227
+ <td>Live running session reconstructed from activity log, or latest saved session if ended. Returns
2228
+ <code>live: true</code> when active.
2229
+ </td>
2230
+ </tr>
2231
+ <tr>
2232
+ <td><span class="badge badge-green">GET</span></td>
2233
+ <td><code>/api/sessions/&lt;id&gt;</code></td>
2234
+ <td>Session detail (includes tool_calls)</td>
2235
+ </tr>
2236
+ <tr>
2237
+ <td><span class="badge badge-blue">POST</span></td>
2238
+ <td><code>/api/sessions/start</code></td>
2239
+ <td>Start a session <code>{description}</code></td>
2240
+ </tr>
2241
+ <tr>
2242
+ <td><span class="badge badge-blue">POST</span></td>
2243
+ <td><code>/api/sessions/save</code></td>
2244
+ <td>Save session <code>{summary}</code></td>
2245
+ </tr>
2246
+ <tr>
2247
+ <td><span class="badge badge-green">GET</span></td>
2248
+ <td><code>/api/sessions/context</code></td>
2249
+ <td>Compressed context from recent sessions</td>
2250
+ </tr>
2251
+ </table>
2252
+
2253
+ <h3>Memory</h3>
2254
+ <table>
2255
+ <tr>
2256
+ <th>Method</th>
2257
+ <th>Endpoint</th>
2258
+ <th>Description</th>
2259
+ </tr>
2260
+ <tr>
2261
+ <td><span class="badge badge-green">GET</span></td>
2262
+ <td><code>/api/memory/facts</code></td>
2263
+ <td>List all stored facts</td>
2264
+ </tr>
2265
+ <tr>
2266
+ <td><span class="badge badge-blue">POST</span></td>
2267
+ <td><code>/api/memory/remember</code></td>
2268
+ <td>Store a fact <code>{fact, category}</code></td>
2269
+ </tr>
2270
+ <tr>
2271
+ <td><span class="badge badge-blue">POST</span></td>
2272
+ <td><code>/api/memory/recall</code></td>
2273
+ <td>Search facts <code>{query, top_k}</code></td>
2274
+ </tr>
2275
+ <tr>
2276
+ <td><span class="badge badge-blue">POST</span></td>
2277
+ <td><code>/api/memory/query</code></td>
2278
+ <td>Search facts + sessions <code>{query, top_k}</code></td>
2279
+ </tr>
2280
+ <tr>
2281
+ <td><span class="badge badge-warn">DEL</span></td>
2282
+ <td><code>/api/memory/facts/&lt;id&gt;</code></td>
2283
+ <td>Delete a fact by ID</td>
2284
+ </tr>
2285
+ <tr>
2286
+ <td><span class="badge badge-green">GET</span></td>
2287
+ <td><code>/api/memory/export?category=</code></td>
2288
+ <td>Export facts as markdown grouped by category <code>{markdown, count}</code></td>
2289
+ </tr>
2290
+ </table>
2291
+
2292
+ <h3>Activity Log</h3>
2293
+ <table>
2294
+ <tr>
2295
+ <th>Method</th>
2296
+ <th>Endpoint</th>
2297
+ <th>Description</th>
2298
+ </tr>
2299
+ <tr>
2300
+ <td><span class="badge badge-green">GET</span></td>
2301
+ <td><code>/api/activity?limit=100&amp;type=&amp;since=&amp;until=</code></td>
2302
+ <td>Recent activity events, filterable by type and ISO timestamp range (<code>since</code>/<code>until</code>)
2303
+ </td>
2304
+ </tr>
2305
+ <tr>
2306
+ <td><span class="badge badge-green">GET</span></td>
2307
+ <td><code>/api/activity/stats</code></td>
2308
+ <td>Event counts by type, total, time range</td>
2309
+ </tr>
2310
+ </table>
2311
+
2312
+ <h3>Conversations</h3>
2313
+ <table>
2314
+ <tr>
2315
+ <th>Method</th>
2316
+ <th>Endpoint</th>
2317
+ <th>Description</th>
2318
+ </tr>
2319
+ <tr>
2320
+ <td><span class="badge badge-green">GET</span></td>
2321
+ <td><code>/api/conversations?limit=100</code></td>
2322
+ <td>List session metadata sorted by most recent first</td>
2323
+ </tr>
2324
+ <tr>
2325
+ <td><span class="badge badge-green">GET</span></td>
2326
+ <td><code>/api/conversations/sync?source=all|claude|imports</code></td>
2327
+ <td>Sync from transcript/import sources - returns <code>{synced, total, by_source, errors?}</code></td>
2328
+ </tr>
2329
+ <tr>
2330
+ <td><span class="badge badge-green">GET</span></td>
2331
+ <td><code>/api/conversations/stats</code></td>
2332
+ <td>Aggregate stats: sessions, turns, user_tokens, assistant_tokens, compressed_sessions</td>
2333
+ </tr>
2334
+ <tr>
2335
+ <td><span class="badge badge-green">GET</span></td>
2336
+ <td><code>/api/conversations/search?q=&amp;limit=30&amp;session_id=</code></td>
2337
+ <td>TF-IDF search across all (or one) session - returns scored turn hits with <code>turn_key</code></td>
2338
+ </tr>
2339
+ <tr>
2340
+ <td><span class="badge badge-green">GET</span></td>
2341
+ <td><code>/api/conversations/&lt;session_id&gt;?offset=&amp;limit=</code></td>
2342
+ <td>Turn list for one session (paginated; handles .gz archives transparently)</td>
2343
+ </tr>
2344
+ <tr>
2345
+ <td><span class="badge badge-blue">POST</span></td>
2346
+ <td><code>/api/conversations/&lt;session_id&gt;/turn</code></td>
2347
+ <td>Append a turn manually <code>{role, text, tool_calls?, source?}</code></td>
2348
+ </tr>
2349
+ </table>
2350
+
2351
+ <h3>Notifications</h3>
2352
+ <table>
2353
+ <tr>
2354
+ <th>Method</th>
2355
+ <th>Endpoint</th>
2356
+ <th>Description</th>
2357
+ </tr>
2358
+ <tr>
2359
+ <td><span class="badge badge-green">GET</span></td>
2360
+ <td><code>/api/notifications?limit=20</code></td>
2361
+ <td>Get unacknowledged agent notifications. Each entry includes: <code>id</code>, <code>agent</code>,
2362
+ <code>severity</code>, <code>title</code>, <code>message</code>, <code>timestamp</code>,
2363
+ <code>acknowledged</code>, <code>ai_enhanced</code>
2364
+ </td>
2365
+ </tr>
2366
+ <tr>
2367
+ <td><span class="badge badge-blue">POST</span></td>
2368
+ <td><code>/api/notifications/ack</code></td>
2369
+ <td>Acknowledge a notification <code>{id}</code></td>
2370
+ </tr>
2371
+ <tr>
2372
+ <td><span class="badge badge-blue">POST</span></td>
2373
+ <td><code>/api/notifications/ack-all</code></td>
2374
+ <td>Acknowledge all pending notifications</td>
2375
+ </tr>
2376
+ </table>
2377
+
2378
+ <h3>MCP</h3>
2379
+ <table>
2380
+ <tr>
2381
+ <th>Method</th>
2382
+ <th>Endpoint</th>
2383
+ <th>Description</th>
2384
+ </tr>
2385
+ <tr>
2386
+ <td><span class="badge badge-green">GET</span></td>
2387
+ <td><code>/api/mcp/status?ide=&lt;profile&gt;</code></td>
2388
+ <td>MCP status for the selected IDE profile (<code>configured</code>, <code>active</code>,
2389
+ <code>server_found</code>, <code>config_path</code>, normalized server list). If <code>ide</code> is
2390
+ omitted, uses the active profile.
2391
+ </td>
2392
+ </tr>
2393
+ <tr>
2394
+ <td><span class="badge badge-blue">POST</span></td>
2395
+ <td><code>/api/mcp/install</code></td>
2396
+ <td>Install MCP configuration for a target IDE <code>{ide}</code></td>
2397
+ </tr>
2398
+ <tr>
2399
+ <td><span class="badge badge-blue">POST</span></td>
2400
+ <td><code>/api/mcp/servers</code></td>
2401
+ <td>Add/update custom MCP server for selected IDE <code>{ide, name, command, args, env?, enabled?}</code>.
2402
+ Supports JSON configs and Codex TOML.</td>
2403
+ </tr>
2404
+ <tr>
2405
+ <td><span class="badge badge-warn">DELETE</span></td>
2406
+ <td><code>/api/mcp/servers/&lt;name&gt;?ide=&lt;profile&gt;&amp;remove_files=1</code></td>
2407
+ <td>Remove MCP server from selected IDE config. When deleting <code>c3</code> with
2408
+ <code>remove_files=1</code>, also removes related IDE artifacts (instructions file, Claude hooks/settings
2409
+ cleanup).
2410
+ </td>
2411
+ </tr>
2412
+ </table>
2413
+
2414
+ <h3>Protocol</h3>
2415
+ <table>
2416
+ <tr>
2417
+ <th>Method</th>
2418
+ <th>Endpoint</th>
2419
+ <th>Description</th>
2420
+ </tr>
2421
+ <tr>
2422
+ <td><span class="badge badge-blue">POST</span></td>
2423
+ <td><code>/api/encode</code></td>
2424
+ <td>Encode text <code>{text}</code></td>
2425
+ </tr>
2426
+ <tr>
2427
+ <td><span class="badge badge-blue">POST</span></td>
2428
+ <td><code>/api/decode</code></td>
2429
+ <td>Decode text <code>{text}</code></td>
2430
+ </tr>
2431
+ <tr>
2432
+ <td><span class="badge badge-green">GET</span></td>
2433
+ <td><code>/api/protocol/header</code></td>
2434
+ <td>Protocol header for system prompts</td>
2435
+ </tr>
2436
+ <tr>
2437
+ <td><span class="badge badge-green">GET</span></td>
2438
+ <td><code>/api/protocol/dictionary</code></td>
2439
+ <td>Full compression dictionary</td>
2440
+ </tr>
2441
+ <tr>
2442
+ <td><span class="badge badge-blue">POST</span></td>
2443
+ <td><code>/api/protocol/build-dictionary</code></td>
2444
+ <td>Build project-specific dictionary</td>
2445
+ </tr>
2446
+ </table>
2447
+
2448
+ <h3>Instructions File</h3>
2449
+ <table>
2450
+ <tr>
2451
+ <th>Method</th>
2452
+ <th>Endpoint</th>
2453
+ <th>Description</th>
2454
+ </tr>
2455
+ <tr>
2456
+ <td><span class="badge badge-green">GET</span></td>
2457
+ <td><code>/api/claudemd</code></td>
2458
+ <td>Get generated instructions file content</td>
2459
+ </tr>
2460
+ <tr>
2461
+ <td><span class="badge badge-blue">POST</span></td>
2462
+ <td><code>/api/claudemd/save</code></td>
2463
+ <td>Save instructions file to project (IDE-appropriate path)</td>
2464
+ </tr>
2465
+ <tr>
2466
+ <td><span class="badge badge-green">GET</span></td>
2467
+ <td><code>/api/claudemd/check</code></td>
2468
+ <td>Check instructions file for staleness and drift</td>
2469
+ </tr>
2470
+ <tr>
2471
+ <td><span class="badge badge-blue">POST</span></td>
2472
+ <td><code>/api/claudemd/compact</code></td>
2473
+ <td>Compact instructions file <code>{target_lines}</code></td>
2474
+ </tr>
2475
+ <tr>
2476
+ <td><span class="badge badge-green">GET</span></td>
2477
+ <td><code>/api/claudemd/promote</code></td>
2478
+ <td>Get promotion candidates for instructions file</td>
2479
+ </tr>
2480
+ <tr>
2481
+ <td><span class="badge badge-green">GET</span></td>
2482
+ <td><code>/api/optimize</code></td>
2483
+ <td>Get optimization suggestions</td>
2484
+ </tr>
2485
+ </table>
2486
+
2487
+ <h3>Hybrid Intelligence</h3>
2488
+ <table>
2489
+ <tr>
2490
+ <th>Method</th>
2491
+ <th>Endpoint</th>
2492
+ <th>Description</th>
2493
+ </tr>
2494
+ <tr>
2495
+ <td><span class="badge badge-green">GET</span></td>
2496
+ <td><code>/api/hybrid/metrics</code></td>
2497
+ <td>All tier metrics (filter, router, SLTM)</td>
2498
+ </tr>
2499
+ <tr>
2500
+ <td><span class="badge badge-green">GET</span></td>
2501
+ <td><code>/api/hybrid/config</code></td>
2502
+ <td>Current hybrid feature flags and config</td>
2503
+ </tr>
2504
+ <tr>
2505
+ <td><span class="badge badge-purple">PUT</span></td>
2506
+ <td><code>/api/hybrid/config</code></td>
2507
+ <td>Update hybrid feature flags <code>{key: value}</code></td>
2508
+ </tr>
2509
+ <tr>
2510
+ <td><span class="badge badge-green">GET</span></td>
2511
+ <td><code>/api/delegate/config</code></td>
2512
+ <td>Current delegate/local-AI policy config (including threshold settings)</td>
2513
+ </tr>
2514
+ <tr>
2515
+ <td><span class="badge badge-purple">PUT</span></td>
2516
+ <td><code>/api/delegate/config</code></td>
2517
+ <td>Update delegate policy <code>{threshold_enabled, threshold_min_total_tokens, ...}</code></td>
2518
+ </tr>
2519
+ <tr>
2520
+ <td><span class="badge badge-green">GET</span></td>
2521
+ <td><code>/api/sltm/stats</code></td>
2522
+ <td>SLTM backend status and collection sizes</td>
2523
+ </tr>
2524
+ <tr>
2525
+ <td><span class="badge badge-blue">POST</span></td>
2526
+ <td><code>/api/sltm/search</code></td>
2527
+ <td>Search SLTM <code>{query, category, top_k}</code></td>
2528
+ </tr>
2529
+ <tr>
2530
+ <td><span class="badge badge-blue">POST</span></td>
2531
+ <td><code>/api/sltm/add</code></td>
2532
+ <td>Add record to SLTM <code>{text, category, metadata}</code></td>
2533
+ </tr>
2534
+ </table>
2535
+
2536
+ <h3>Proxy</h3>
2537
+ <table>
2538
+ <tr>
2539
+ <th>Method</th>
2540
+ <th>Endpoint</th>
2541
+ <th>Description</th>
2542
+ </tr>
2543
+ <tr>
2544
+ <td><span class="badge badge-green">GET</span></td>
2545
+ <td><code>/api/proxy/metrics</code></td>
2546
+ <td>Proxy traffic and filtering metrics (written on shutdown)</td>
2547
+ </tr>
2548
+ <tr>
2549
+ <td><span class="badge badge-green">GET</span></td>
2550
+ <td><code>/api/proxy/config</code></td>
2551
+ <td>Current proxy configuration</td>
2552
+ </tr>
2553
+ <tr>
2554
+ <td><span class="badge badge-purple">PUT</span></td>
2555
+ <td><code>/api/proxy/config</code></td>
2556
+ <td>Update proxy config <code>{key: value}</code></td>
2557
+ </tr>
2558
+ <tr>
2559
+ <td><span class="badge badge-green">GET</span></td>
2560
+ <td><code>/api/proxy/tools</code></td>
2561
+ <td>Full tool inventory with categories, visibility status, and pinned state</td>
2562
+ </tr>
2563
+ <tr>
2564
+ <td><span class="badge badge-green">GET</span></td>
2565
+ <td><code>/api/proxy/state</code></td>
2566
+ <td>Live proxy state (goal, recent files, decisions, tool calls)</td>
2567
+ </tr>
2568
+ </table>
2569
+
2570
+ <!-- ─── CLI ─────────────────────────── -->
2571
+ <h2 id="cli-commands">CLI Commands</h2>
2572
+ <p>All commands are run via <code>c3</code> (or <code>python cli/c3.py</code>) from within your project directory.
2573
+ </p>
2574
+
2575
+ <h3>Project Setup</h3>
2576
+ <pre><code>c3 init &lt;project_path&gt; [--ide auto|claude|vscode|cursor|codex|gemini] [--force]
2577
+ # Initialize C3: builds index, creates config, generates instructions file,
2578
+ # and automatically installs the MCP config for your IDE.
2579
+ # Re-running on an existing project now migrates config defaults and
2580
+ # refreshes instruction workflow files (Update / Clear / Reset options).
2581
+ c3 index [--max-files 500] # Rebuild the code index
2582
+ c3 install-mcp [project_path] [ide] [--ide auto|claude|vscode|cursor|codex|gemini] # (Re-)generate MCP config manually
2583
+ c3 ui [project_path] [--port 3333] [--nano] [--silent] # Launch web dashboard (full or nano)</code></pre>
2584
+
2585
+ <h3>Compression &amp; Search</h3>
2586
+ <pre><code>c3 compress &lt;file&gt; [--mode smart] [-o] # Compress a file (modes: structure, outline, smart, diff)
2587
+ c3 context &lt;query&gt; [--top-k 5] # Get relevant context for a query
2588
+ c3 pipe &lt;query&gt; [--top-k 5] # All-in-one pipeline: index + context + session -> pipe to Claude
2589
+ c3 encode &lt;text&gt; [--pipe] # Encode to compressed format
2590
+ c3 decode &lt;text&gt; # Decode compressed format</code></pre>
2591
+
2592
+ <h3>Sessions</h3>
2593
+ <pre><code>c3 session start [description] # Start a new session
2594
+ c3 session save [summary] # Save current session
2595
+ c3 session load [session_id] # Load a session (defaults to latest)
2596
+ c3 session list # List all sessions
2597
+ c3 session context # Get session context for prompt</code></pre>
2598
+
2599
+ <h3>Other</h3>
2600
+ <pre><code>c3 stats # Show token usage analytics
2601
+ c3 benchmark [project] [--sample-size 25] [--json] [--output .c3/benchmark_latest.json]
2602
+ # Run local benchmark for compression, retrieval, and grounding proxy metrics
2603
+ c3 optimize # Show optimization suggestions
2604
+ c3 claudemd generate # Preview auto-generated instructions file
2605
+ c3 claudemd save # Write instructions file to project root (IDE-appropriate path)</code></pre>
2606
+
2607
+ <!-- ─── CLI Examples ────────────────── -->
2608
+ <h2 id="cli-examples">CLI Examples</h2>
2609
+
2610
+ <pre><code># Pipe compressed context into Claude Code
2611
+ c3 context "fix the auth bug" | claude -p -
2612
+
2613
+ # Auto-compress before sending
2614
+ c3 encode "Read src/Dashboard.tsx and fix the error on line 47" | claude -p -
2615
+
2616
+ # All-in-one pipeline
2617
+ c3 pipe "fix the metrics calculation" | claude -p -
2618
+
2619
+ # Run benchmark and save machine-readable report
2620
+ c3 benchmark . --sample-size 25 --output .c3/benchmark_latest.json
2621
+
2622
+ # Save session after work
2623
+ c3 session save --summary "Fixed auth flow, updated tests"
2624
+
2625
+ # Start new session with prior context loaded
2626
+ c3 session load | claude --resume</code></pre>
2627
+
2628
+ <!-- ─── Architecture ────────────────── -->
2629
+ <h2 id="architecture">Architecture</h2>
2630
+
2631
+ <div class="arch">
2632
+ <pre>
2633
+ <strong>IDE</strong> (Claude Code / VS Code Copilot / Cursor / Codex / Gemini CLI)
2634
+ | MCP Protocol (IDE-specific config file)
2635
+ v
2636
+ <strong>MCP Proxy</strong> ──── Dynamic tool filtering + context injection (optional, opt-in via MCP config)
2637
+ | Subprocess stdio (NDJSON)
2638
+ v
2639
+ <strong>C3 MCP Server</strong> ─── 26 tools: search, compress, session, memory, CLAUDE.md, context, hybrid, notifications...
2640
+ |
2641
+ +── <em>Compression</em> <em>Smart Index</em>
2642
+ | AST Summary TF-IDF + Code Structure
2643
+ | Diff Engine Chunk Retrieval
2644
+ | Dedup Cache
2645
+ |
2646
+ +── <em>Session Manager</em> <em>Tiered Memory</em>
2647
+ | Decisions Fact Store (TF-IDF)
2648
+ | Tool Calls Cross-Session Search
2649
+ | Instructions Gen Category Tagging
2650
+ |
2651
+ +── <em>Instructions Mgr</em> <em>Protocol</em>
2652
+ | Generate/Check Encoder
2653
+ | Compact/Promote Dictionary
2654
+ |
2655
+ +── <em>Context Snapshots</em> <em>Transcript Index</em>
2656
+ | Capture/Restore TF-IDF over .jsonl
2657
+ | Save-and-Restore Past Conversation Search (Claude Code)
2658
+ |
2659
+ +── <em>File Watcher</em> <em>File Extractor</em>
2660
+ | Change Detection Log/JSONL Pre-filter
2661
+ | Auto Index Rebuild Token Savings Tracking
2662
+ |
2663
+ +── <em>Background Agents</em> <em>Notification Store</em>
2664
+ | Index Staleness Thread-safe JSONL Queue
2665
+ | Memory Pruner Severity + Dedup
2666
+ | Instructions Drift Auto-surface to Claude
2667
+ | Context Budget AI-enhanced (Ollama)
2668
+ | Session Insight AI Badge + Quick Actions
2669
+ |
2670
+ v
2671
+ <strong>Web Dashboard</strong> (:3333)
2672
+ [Left Nav ⇄ pin] [Dashboard | Compressor | Index | Sessions | Memory | Activity | Hybrid | Agents | Proxy | Settings] [Right Sidebar ⇄ pin]
2673
+ Both sidebars: hover-to-expand (icon strip) or pin to keep open (persisted in localStorage)
2674
+ </pre>
2675
+ </div>
2676
+
2677
+ <!-- ─── Conversations ──────────────── -->
2678
+ <h2 id="conversations">Conversations</h2>
2679
+ <p>The Conversations module records full user/assistant turns and makes them browsable and searchable in the C3
2680
+ UI. It complements the existing <strong>Sessions</strong> tab (which tracks tool calls and decisions) with the
2681
+ actual dialogue content.</p>
2682
+
2683
+ <h3>Storage</h3>
2684
+ <p>All conversation data lives under <code>.c3/conversations/</code>:</p>
2685
+ <ul>
2686
+ <li><code>sessions.json</code> — index of all session metadata (title, started, ended, turn count, token
2687
+ totals, source)</li>
2688
+ <li><code>{session_id}.jsonl</code> — one JSON object per line, each a single turn with <code>id</code>,
2689
+ <code>ts</code>, <code>role</code>, <code>text</code>, <code>tokens</code>, and optional
2690
+ <code>tool_calls</code>
2691
+ </li>
2692
+ <li><code>{session_id}.jsonl.gz</code> — gzip-compressed archive for sessions older than 30 days (read
2693
+ transparently, no data loss)</li>
2694
+ </ul>
2695
+
2696
+ <h3>Data Sources</h3>
2697
+ <div class="card">
2698
+ <div class="card-title">Claude Code — Automatic Sync</div>
2699
+ <p style="font-size:13px;color:var(--text-muted);margin-bottom:6px;">Claude Code transcripts are synced
2700
+ automatically — no manual action required:</p>
2701
+ <ul style="font-size:13px;color:var(--text-muted);margin:4px 0 6px 16px;">
2702
+ <li><strong>Startup</strong> — initial sync of all transcript files on MCP server start</li>
2703
+ <li><strong>Every 60 seconds</strong> — background thread keeps the store current during active sessions
2704
+ </li>
2705
+ <li><strong>Shutdown</strong> — forced final sync captures the session's last turns before exit</li>
2706
+ </ul>
2707
+ <p style="font-size:13px;color:var(--text-muted);margin-bottom:0;">You can also trigger a manual sync via
2708
+ <strong>Sync</strong> in the Conversations tab or <code>GET /api/conversations/sync?source=all</code>. Use
2709
+ <code>source=claude</code> or <code>source=imports</code> to scope it. Sync is incremental — only files
2710
+ changed since the last run are reprocessed.
2711
+ </p>
2712
+ </div>
2713
+ <div class="card">
2714
+ <div class="card-title">Other IDEs — Manual Logging via MCP tool</div>
2715
+ <p style="font-size:13px;color:var(--text-muted);margin-bottom:6px;">Call the
2716
+ <code>c3_session(action='convo_log', role=..., text=..., session_id?, source?)</code> MCP tool to append a turn. If
2717
+ <code>session_id</code> is omitted, the current C3 session ID is used. This allows VS Code Copilot and Cursor
2718
+ users to build up conversation history. The REST endpoint
2719
+ <code>POST /api/conversations/&lt;session_id&gt;/turn</code> provides the same capability programmatically.
2720
+ </p>
2721
+ </div>
2722
+
2723
+ <h3>Conversations UI</h3>
2724
+ <ul>
2725
+ <li><strong>Session list</strong> - left panel lists all sessions sorted newest-first. Shows title (first user
2726
+ message), relative date, turn count, and source badge. Each row has direct <strong>Plans</strong> and
2727
+ <strong>Todos</strong> quick-jump buttons.
2728
+ </li>
2729
+ <li><strong>Thread view</strong> — right panel renders the full conversation as a chat thread. User turns show
2730
+ a "You" badge; AI turns show an "AI" badge. Tool call badges appear inline in AI turn headers. A
2731
+ <strong>Rename</strong> button in the session header lets you edit the title in-place. Title overrides are
2732
+ stored in <code>localStorage</code> under the key <code>c3_conv_titles</code>.
2733
+ </li>
2734
+ <li><strong>Chat / Plans / Todos tabs</strong> — switch views without leaving the conversation. <em>Plans</em>
2735
+ pulls <code>c3_session_log</code> decision events from the activity log for the session's time range.
2736
+ <em>Todos</em> extracts all markdown checkbox items (<code>- [ ] task</code> / <code>- [x] done</code>) from
2737
+ the thread with links back to the originating turn. Both views load automatically when using the quick-jump
2738
+ buttons in the session list.
2739
+ </li>
2740
+ <li><strong>Table of Contents</strong> - toggle the <strong>ToC</strong> button to show a collapsible index of
2741
+ user prompts (numbered, 2-line preview). In narrow layouts the ToC is hidden for readability.</li>
2742
+ <li><strong>Pagination</strong> - turns are loaded in pages with a <em>Load more</em> action for long sessions.
2743
+ </li>
2744
+ <li><strong>Search scope toggle</strong> - explicit <em>All</em> / <em>Session</em> toggle next to the search
2745
+ box. Search is debounced and scope-aware; "Session" is disabled until a conversation is open.</li>
2746
+ <li><strong>Pagination</strong> - conversation turns are loaded in pages with a <em>Load more</em> action for
2747
+ long sessions.</li>
2748
+ <li><strong>Compression</strong> - sessions older than 30 days are automatically gzip-compressed. The UI reads
2749
+ them transparently; compressed sessions show a "gz" badge in the list and an "archived" label in the header.
2750
+ </li>
2751
+ </ul>
2752
+
2753
+ <div class="tip">
2754
+ <div class="tip-title">Search scope</div>
2755
+ Use the <strong>All / Session</strong> toggle next to the search box to control search scope explicitly. Set it
2756
+ to <em>All</em> to search across every session simultaneously. Switch to <em>Session</em> to narrow results to
2757
+ the open conversation.
2758
+ </div>
2759
+
2760
+ <!-- ─── Compression Modes ───────────── -->
2761
+ <h2 id="compression">Compression Modes</h2>
2762
+ <p>When using <code>c3_compress</code> or the CLI <code>compress</code> command:</p>
2763
+
2764
+ <table>
2765
+ <tr>
2766
+ <th>Mode</th>
2767
+ <th>Best For</th>
2768
+ <th>What It Keeps</th>
2769
+ </tr>
2770
+ <tr>
2771
+ <td><span class="badge badge-green">structure</span></td>
2772
+ <td>Large files (1000+ tokens)</td>
2773
+ <td>Function/class signatures, imports</td>
2774
+ </tr>
2775
+ <tr>
2776
+ <td><span class="badge badge-blue">outline</span></td>
2777
+ <td>Medium files</td>
2778
+ <td>Signatures + first-line docstrings + key comments</td>
2779
+ </tr>
2780
+ <tr>
2781
+ <td><span class="badge badge-purple">smart</span></td>
2782
+ <td>General use (default)</td>
2783
+ <td>Adapts based on file size: full text for &lt;100 tokens, outline for &lt;1000, structure for larger</td>
2784
+ </tr>
2785
+ <tr>
2786
+ <td><span class="badge badge-warn">diff</span></td>
2787
+ <td>Repeated reads</td>
2788
+ <td>Only the changes since C3 last saw the file (1 line of context)</td>
2789
+ </tr>
2790
+ </table>
2791
+
2792
+ <!-- ─── Data Layout ─────────────────── -->
2793
+ <h2 id="data-layout">Project Data Layout</h2>
2794
+ <p>After initialization, C3 creates this structure in your project:</p>
2795
+
2796
+ <pre><code>.c3/
2797
+ config.json # project configuration (includes "ide" key for cross-IDE support)
2798
+ dictionary.json # project-specific compression dictionary
2799
+ index/
2800
+ index.json # TF-IDF code index
2801
+ cache/ # file compression cache (for diff mode)
2802
+ sessions/
2803
+ session_*.json # saved sessions (includes tool_calls, duration)
2804
+ analytics.json # aggregate session stats
2805
+ facts/
2806
+ facts.json # persistent fact store
2807
+ snapshots/
2808
+ snap_*.json # context snapshots for save-and-restore workflow
2809
+ transcript_index/
2810
+ index.json # TF-IDF index over .jsonl transcripts (Claude Code only)
2811
+ manifest.json # tracks which transcript files have been indexed
2812
+ file_memory/
2813
+ *.json # per-file structural maps (classes, functions, line ranges)
2814
+ _queue.txt # async update queue (from Read hook)
2815
+ activity_log.jsonl # append-only activity log
2816
+ notifications.jsonl # agent notification queue
2817
+ proxy_metrics.json # proxy traffic and filtering metrics (written on shutdown)</code></pre>
2818
+
2819
+ <div class="tip">
2820
+ <div class="tip-title">Privacy</div>
2821
+ All data is local to your project. Nothing is sent to external services.
2822
+ </div>
2823
+
2824
+ <h3>Project Structure</h3>
2825
+ <pre><code>claude-companion/
2826
+ cli/
2827
+ c3.py # CLI entry point (all commands)
2828
+ mcp_server.py # MCP server (30 tools via FastMCP)
2829
+ mcp_proxy.py # Optional advanced MCP proxy (tool filtering)
2830
+ server.py # Flask web server + REST API
2831
+ ui.html # Single-page React dashboard
2832
+ docs.html # Documentation (this page)
2833
+ hook_filter.py # PostToolUse hook for Bash (output filtering, Claude Code only)
2834
+ hook_read.py # PostToolUse hook for Read (C3 enforcement + file memory queue, Claude Code only)
2835
+ services/
2836
+ compressor.py # AST-based code compression
2837
+ indexer.py # TF-IDF code index
2838
+ session_manager.py # Session tracking + instructions file generation
2839
+ claude_md.py # Instructions file lifecycle management (generate/check/compact/promote)
2840
+ memory.py # Tiered memory with fact storage + search
2841
+ context_snapshot.py # Context snapshots for save-and-restore workflow
2842
+ transcript_index.py # TF-IDF index over .jsonl transcripts (Claude Code only)
2843
+ activity_log.py # Append-only JSONL activity log
2844
+ notifications.py # Thread-safe notification queue for agents
2845
+ agents.py # Background analysis agents (7 daemon threads, AI-enhanced)
2846
+ file_memory.py # Persistent structural file index with line ranges
2847
+ tool_classifier.py # Tool category classification for proxy filtering
2848
+ proxy_state.py # Sliding window conversation state tracker
2849
+ watcher.py # File system change monitoring
2850
+ protocol.py # Compression protocol encoder/decoder
2851
+ core/
2852
+ __init__.py # Token counting utilities
2853
+ ide.py # IDE profile registry (Claude Code, VS Code, Cursor, Codex) + auto-detection
2854
+ config.py # Hybrid, proxy, delegate, and agent configuration loaders
2855
+ install.bat # Windows installer
2856
+ install.sh # Linux/macOS installer
2857
+ pyproject.toml # Python package metadata + dependencies</code></pre>
2858
+
2859
+ <!-- ─── Token Savings ───────────────── -->
2860
+ <h2 id="token-savings">Token Savings Estimates</h2>
2861
+
2862
+ <table>
2863
+ <tr>
2864
+ <th>Strategy</th>
2865
+ <th>Estimated Savings</th>
2866
+ </tr>
2867
+ <tr>
2868
+ <td>AST Summarization</td>
2869
+ <td>40-70% on file reads</td>
2870
+ </tr>
2871
+ <tr>
2872
+ <td>Diff-only mode</td>
2873
+ <td>60-90% on edits (1-line context)</td>
2874
+ </tr>
2875
+ <tr>
2876
+ <td>Smart Retrieval</td>
2877
+ <td>50-80% on search operations</td>
2878
+ </tr>
2879
+ <tr>
2880
+ <td>Compact MCP Responses</td>
2881
+ <td>~35% on tool response overhead (terse tags vs prose)</td>
2882
+ </tr>
2883
+ <tr>
2884
+ <td>Session Memory</td>
2885
+ <td>30-50% on repeated context</td>
2886
+ </tr>
2887
+ <tr>
2888
+ <td>Compression Protocol</td>
2889
+ <td>20-40% on prompts</td>
2890
+ </tr>
2891
+ <tr>
2892
+ <td>Delegation to local LLM (<code>c3_delegate</code>)</td>
2893
+ <td>~80% on analysis, summarization, test generation, and code review tasks</td>
2894
+ </tr>
2895
+ <tr>
2896
+ <td>Log/output pre-filtering (<code>c3_filter(file_path=...)</code>, <code>c3_filter(text=...)</code>)</td>
2897
+ <td>50-95% on log files and noisy terminal output</td>
2898
+ </tr>
2899
+ <tr>
2900
+ <td><strong>Combined</strong></td>
2901
+ <td><strong>65-90% overall</strong></td>
2902
+ </tr>
2903
+ </table>
2904
+
2905
+ <div class="card" style="margin-top: 12px;">
2906
+ <div class="card-title">Measured Benchmark (March 5, 2026)</div>
2907
+ <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 8px;">
2908
+ Latest measured values from <code>c3 benchmark</code> in this repository:
2909
+ </p>
2910
+ <ul>
2911
+ <li>Compression: <strong>95.8%</strong> token savings across 25 sampled files</li>
2912
+ <li>Search context: <strong>95.1%</strong> fewer tokens vs naive full-file baseline</li>
2913
+ <li>Grounding proxy hit rate (expected file in top-5): <strong>83.3%</strong> for C3 retrieval (baseline: 66.7%)</li>
2914
+ <li>Delegate offload: measured locally and promoted into the main benchmark scorecard when Ollama is available</li>
2915
+ </ul>
2916
+ </div>
2917
+
2918
+ <!-- ─── Tips ────────────────────────── -->
2919
+ <h2 id="tips">Tips</h2>
2920
+
2921
+ <div class="tip">
2922
+ <div class="tip-title">Let Claude use the tools</div>
2923
+ You don't need to tell Claude to call C3 — it will use the tools when they're relevant.
2924
+ But you can explicitly ask things like "search the codebase for authentication" or "remember that we use JWT for
2925
+ auth".
2926
+ </div>
2927
+
2928
+ <div class="tip">
2929
+ <div class="tip-title">Use remember for conventions</div>
2930
+ Store things like "we use snake_case for Python, camelCase for JS" or "the API gateway is in
2931
+ services/gateway.py". These persist across sessions and surface when relevant.
2932
+ </div>
2933
+
2934
+ <div class="tip">
2935
+ <div class="tip-title">Memory nudges are automatic</div>
2936
+ C3 nudges Claude to save facts at natural checkpoints — after 20+ tool calls with no saves, 3+ decisions with
2937
+ no facts, or every 15 tool calls. Nudges use terse tags like <code>[nudge:save_facts|calls:25|facts:0]</code> to
2938
+ minimize token overhead. Once Claude saves a fact, the nudges calm down.
2939
+ </div>
2940
+
2941
+ <div class="tip">
2942
+ <div class="tip-title">Use snapshots to manage context</div>
2943
+ When your context gets heavy, call <code>c3_session(action='snapshot')</code> to save your working state. After resetting context
2944
+ (<code>/clear</code> in Claude Code, or starting a new chat in other IDEs), call <code>c3_session(action='restore')</code> to
2945
+ bring back your decisions, files, and notes in a compact briefing — much cheaper than replaying the full
2946
+ conversation. When over the budget threshold, C3 nudges the AI to snapshot and restart.
2947
+ </div>
2948
+
2949
+ <div class="tip">
2950
+ <div class="tip-title">Filter long terminal output</div>
2951
+ If a shell command prints more than ~20 lines, run <code>c3_filter(text="...")</code> before analysis.
2952
+ For log/data files, run <code>c3_filter(file_path=..., pattern?)</code> before reading raw content.
2953
+ </div>
2954
+
2955
+ <div class="tip">
2956
+ <div class="tip-title">Search past conversations</div>
2957
+ <code>c3_transcript_search</code> indexes your Claude Code transcript history (Claude Code only). In other IDEs,
2958
+ use <code>c3_memory(action='recall')</code> or <code>c3_memory(action='query')</code> to find context from past sessions. These tools work
2959
+ across all IDEs and search stored facts and semantic memory.
2960
+ </div>
2961
+
2962
+ <div class="tip">
2963
+ <div class="tip-title">Pre-filter large files with extract</div>
2964
+ Before reading a large log, JSONL, or data file, use <code>c3_filter(file_path=...)</code> to get just the relevant parts. For
2965
+ logs it finds errors/warnings; for JSONL it samples entries; for code files it delegates to the compressor.
2966
+ </div>
2967
+
2968
+ <div class="tip">
2969
+ <div class="tip-title">Delegate heavy analysis to save ~80% tokens</div>
2970
+ Use <code>c3_delegate</code> before doing analysis inline. Mandatory triggers: any file &gt;200 lines you need
2971
+ to understand (not edit) → <code>task_type='summarize'</code> or <code>'explain'</code>; any error traceback
2972
+ → <code>task_type='diagnose'</code>; writing unit tests → <code>task_type='test'</code>; code review →
2973
+ <code>task_type='review'</code>; codebase Q&amp;A → <code>task_type='ask'</code>. Responses are cached
2974
+ in-session so repeated calls are instant. You can also use <code>task_type='auto'</code> and set delegation
2975
+ threshold policy in <code>.c3/config.json</code> (<code>delegate.threshold_enabled</code>,
2976
+ <code>delegate.threshold_min_total_tokens</code>, <code>delegate.threshold_task_types</code>).
2977
+ </div>
2978
+
2979
+ <div class="tip">
2980
+ <div class="tip-title">Rebuild after big changes</div>
2981
+ If you've added many files or restructured the project, run <code>c3 index</code> from the terminal.
2982
+ </div>
2983
+
2984
+ <div class="tip">
2985
+ <div class="tip-title">Per-project instances</div>
2986
+ Each project gets its own C3 instance with its own index, sessions, and facts. Run <code>c3 init</code> in each
2987
+ project — it handles both initialization and MCP registration in one step.
2988
+ </div>
2989
+
2990
+ <div class="tip">
2991
+ <div class="tip-title">Browse session history</div>
2992
+ Session files in <code>.c3/sessions/</code> are plain JSON. You can read them directly to review past decisions,
2993
+ file changes, and tool calls.
2994
+ </div>
2995
+
2996
+ <!-- ─── Troubleshooting ─────────────── -->
2997
+ <h2 id="troubleshooting">Troubleshooting</h2>
2998
+
2999
+ <div class="warn">
3000
+ <div class="warn-title">Tools don't appear</div>
3001
+ <ul>
3002
+ <li>Make sure the MCP config file exists (<code>.mcp.json</code> for Claude Code,
3003
+ <code>.vscode/mcp.json</code> for VS Code, <code>.cursor/mcp.json</code> for Cursor,
3004
+ <code>.codex/config.toml</code> for Codex)
3005
+ </li>
3006
+ <li>Check that the Python path in the config is correct (<code>"command"</code> field for JSON configs;
3007
+ <code>command</code> key for Codex TOML)
3008
+ </li>
3009
+ <li>For Codex, ensure neither project nor global TOML disables C3
3010
+ (<code>[mcp_servers.c3] enabled = false</code>). Project config should normally be
3011
+ <code>enabled = true</code>.
3012
+ </li>
3013
+ <li>If <code>install-mcp</code> reports permission denied on <code>.codex/config.toml</code>, close
3014
+ IDE/session handles that may lock the file, then re-run.</li>
3015
+ <li>Restart your IDE after generating the MCP config</li>
3016
+ <li>For Claude Code: run <code>/mcp</code> to verify tools; for VS Code: check the Copilot agent panel; for
3017
+ Codex: the TOML is picked up automatically on next session start</li>
3018
+ </ul>
3019
+ </div>
3020
+
3021
+ <div class="warn">
3022
+ <div class="warn-title">"No relevant code found" from c3_search</div>
3023
+ <ul>
3024
+ <li>The index may not be built. Run <code>c3 index</code> from the terminal.</li>
3025
+ <li>Check that your file types are in the supported list</li>
3026
+ </ul>
3027
+ </div>
3028
+
3029
+ <div class="warn">
3030
+ <div class="warn-title">Server fails to start</div>
3031
+ <ul>
3032
+ <li>Run <code>python cli/mcp_server.py --project /path/to/project</code> manually to see error output</li>
3033
+ <li>Verify the install: <code>pip install .</code> (from the C3 source dir)</li>
3034
+ </ul>
3035
+ </div>
3036
+
3037
+ <div class="warn">
3038
+ <div class="warn-title">tiktoken import error</div>
3039
+ <ul>
3040
+ <li>Install it: <code>pip install tiktoken</code></li>
3041
+ <li>C3 falls back to a heuristic counter if tiktoken is unavailable — this is not fatal</li>
3042
+ </ul>
3043
+ </div>
3044
+
3045
+ <div class="warn">
3046
+ <div class="warn-title">Second UI shows wrong project's data</div>
3047
+ <ul>
3048
+ <li>Each <code>c3 ui</code> launch finds the next free port from 3333. The UI always calls its
3049
+ <strong>own</strong> port via <code>window.location.origin</code>, so navigating to
3050
+ <code>localhost:3334</code> shows that instance's project.
3051
+ </li>
3052
+ <li>If you see stale or wrong data, verify you're on the correct URL — the startup banner prints the
3053
+ assigned URL and project path for each instance.</li>
3054
+ <li>Service badges (proxy, ollama, sltm) may show red on a second instance if those services are not
3055
+ configured for the second project. Use the refresh button in the header or sidebar to re-check.</li>
3056
+ </ul>
3057
+ </div>
3058
+
3059
+ <div
3060
+ style="margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim); text-align: center;">
3061
+ C3 — Claude Code Companion &middot; MIT License
3062
+ </div>
3063
+
3064
+ </main>
3065
+ </div>
3066
+
3067
+ <!-- Sidebar active link + search -->
3068
+ <script>
3069
+ // ── Theme toggle ──────────────────────────────
3070
+ const html = document.documentElement;
3071
+ const themeBtn = document.getElementById('themeToggle');
3072
+ const savedTheme = localStorage.getItem('c3-theme') || 'dark';
3073
+ if (savedTheme === 'light') {
3074
+ html.setAttribute('data-theme', 'light');
3075
+ themeBtn.textContent = '☽';
3076
+ }
3077
+ themeBtn.addEventListener('click', () => {
3078
+ const isLight = html.getAttribute('data-theme') === 'light';
3079
+ if (isLight) {
3080
+ html.removeAttribute('data-theme');
3081
+ localStorage.setItem('c3-theme', 'dark');
3082
+ themeBtn.textContent = '☀';
3083
+ } else {
3084
+ html.setAttribute('data-theme', 'light');
3085
+ localStorage.setItem('c3-theme', 'light');
3086
+ themeBtn.textContent = '☽';
3087
+ }
3088
+ });
3089
+
3090
+ const links = document.querySelectorAll('.sidebar a');
3091
+ const sections = [...links].map(a => document.querySelector(a.getAttribute('href'))).filter(Boolean);
3092
+ const sectionDividers = document.querySelectorAll('.sidebar-section');
3093
+ const noResults = document.getElementById('searchNoResults');
3094
+ const searchInput = document.getElementById('docSearch');
3095
+ const searchClear = document.getElementById('searchClear');
3096
+
3097
+ // ── Active link tracking ──────────────────────
3098
+ function updateActive() {
3099
+ let current = '';
3100
+ for (const section of sections) {
3101
+ if (section.getBoundingClientRect().top <= 100) current = section.id;
3102
+ }
3103
+ links.forEach(a => {
3104
+ a.classList.toggle('active', a.getAttribute('href') === '#' + current);
3105
+ });
3106
+ }
3107
+
3108
+ document.querySelector('.content').parentElement.addEventListener('scroll', updateActive);
3109
+ window.addEventListener('scroll', updateActive);
3110
+ updateActive();
3111
+
3112
+ // ── Search ────────────────────────────────────
3113
+ function filterDocs(query) {
3114
+ const q = query.toLowerCase().trim();
3115
+ searchClear.classList.toggle('visible', q.length > 0);
3116
+
3117
+ if (!q) {
3118
+ links.forEach(a => a.style.display = '');
3119
+ sectionDividers.forEach(d => d.style.display = '');
3120
+ noResults.style.display = 'none';
3121
+ return;
3122
+ }
3123
+
3124
+ let anyVisible = false;
3125
+ links.forEach(a => {
3126
+ const match = a.textContent.toLowerCase().includes(q);
3127
+ a.style.display = match ? '' : 'none';
3128
+ if (match) anyVisible = true;
3129
+ });
3130
+
3131
+ // Hide section headers whose children are all hidden
3132
+ sectionDividers.forEach(d => {
3133
+ let next = d.nextElementSibling;
3134
+ let hasVisible = false;
3135
+ while (next && !next.classList.contains('sidebar-section')) {
3136
+ if (next.tagName === 'A' && next.style.display !== 'none') hasVisible = true;
3137
+ next = next.nextElementSibling;
3138
+ }
3139
+ d.style.display = hasVisible ? '' : 'none';
3140
+ });
3141
+
3142
+ noResults.style.display = anyVisible ? 'none' : 'block';
3143
+ }
3144
+
3145
+ searchInput.addEventListener('input', e => filterDocs(e.target.value));
3146
+
3147
+ searchClear.addEventListener('click', () => {
3148
+ searchInput.value = '';
3149
+ filterDocs('');
3150
+ searchInput.focus();
3151
+ });
3152
+
3153
+ // Keyboard shortcuts: / or Ctrl+K to focus; Escape to clear
3154
+ document.addEventListener('keydown', e => {
3155
+ if ((e.key === '/' && document.activeElement !== searchInput) ||
3156
+ (e.key === 'k' && (e.ctrlKey || e.metaKey))) {
3157
+ e.preventDefault();
3158
+ searchInput.focus();
3159
+ searchInput.select();
3160
+ }
3161
+ if (e.key === 'Escape' && document.activeElement === searchInput) {
3162
+ searchInput.value = '';
3163
+ filterDocs('');
3164
+ searchInput.blur();
3165
+ }
3166
+ });
3167
+
3168
+ // ── Back to top ───────────────────────────────
3169
+ const btn = document.createElement('a');
3170
+ btn.href = '#overview';
3171
+ btn.className = 'back-top';
3172
+ btn.innerHTML = '&#8593;';
3173
+ document.body.appendChild(btn);
3174
+ </script>
3175
+
3176
+ </body>
3177
+
3178
+ </html>