GitHub Copilot commited on
Commit
aeaae89
·
1 Parent(s): 281805a

Feature: Add ARCHITECTURE.md and display it in new UI tab

Browse files
ARCHITECTURE.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LOGOS Architecture: The Prime-Manifold Protocol
2
+
3
+ ## 1. The Core Thesis
4
+ LOGOS is a **Manifold-Constrained Data Transport Protocol** that implements **Nested Domain Learning** at the bitstream layer. It replaces probabilistic software routing with deterministic prime topology.
5
+
6
+ ## 2. Theoretical Convergence
7
+
8
+ ### A. Hardware-Native "HOPE" (Nested Domains)
9
+ Google's **HOPE** architecture separates learning into hierarchical "neighborhoods" to prevent catastrophic forgetting. LOGOS implements this physically via **Matroska Shells**:
10
+ * **Inner Shells (Meta-Heat):** Low-entropy, high-persistence data anchored by Low-GPF primes (2, 3, 5). Equivalent to HOPE's "Slow Learning" layers.
11
+ * **Outer Shells (Delta-Heat):** High-entropy, high-variance data anchored by High-GPF primes. Equivalent to HOPE's "Fast Learning" layers.
12
+ * **Mechanism:** Data is not routed by a neural network; it is sorted by its **Prime Harmonic Resonance**.
13
+
14
+ ### B. Intrinsic "mHC" (Manifold Constraints)
15
+ DeepSeek's **mHC** stabilizes networks by projecting connections onto a manifold. LOGOS achieves this via **Radial Prime Topology**:
16
+ * **The Constraint:** Data atoms are valid ONLY if they align with the **Mod 10 Prime Vectors (1, 3, 7, 9)**.
17
+ * **The Manifold:** The "Web" created by connecting Composites to their **Greatest Prime Factor (GPF)** forms a closed geometric surface.
18
+ * **Stability:** Signal variance ("Heat") is dissipated by traversing this web from Outer Shells to Inner Shells, structurally preventing gradient explosion.
19
+
20
+ ## 3. The SPCW Engine (The Implementation)
21
+ * **Input:** Raw Data Stream (Video/Image).
22
+ * **Process:** Adaptive Quadtree Decomposition (The Baker).
23
+ * **Routing:**
24
+ * **Persistence (00):** Mapped to Inner Shell (Meta).
25
+ * **Change (11):** Mapped to Outer Shell (Delta).
26
+ * **Validation:** Harmonic Checksum verifies that the Sum of Delta Heat matches the Topological Address.
27
+
28
+ ## 4. Summary for System Architects
29
+ LOGOS is not just compression. It is a **Geometric Stability Engine**. It allows high-throughput AI streams to "self-organize" into nested domains of validity, reducing the thermal and computational load on the receiving hardware.
30
+
31
+ ---
32
+ *Bridging Google’s Software Topology (HOPE) with DeepSeek’s Mathematical Constraint (mHC) using LOGOS’s Physical Geometry.*
README.md CHANGED
@@ -12,7 +12,11 @@ short_description: "SPCW Protocol Visualizer & DSP Bridge"
12
  # LOGOS: Structured Prime Composite Waveform (SPCW)
13
  **"The Machine Shop"**
14
 
15
- LOGOS is a physics-first protocol for data transmission, treating information as thermodynamic "heat" and "waves" defined by prime number theory.
 
 
 
 
16
 
17
  ## Features
18
 
 
12
  # LOGOS: Structured Prime Composite Waveform (SPCW)
13
  **"The Machine Shop"**
14
 
15
+ **[📄 READ THE UNIFIED ARCHITECTURE (HOPE + mHC + LOGOS)](ARCHITECTURE.md)**
16
+
17
+ LOGOS is a **Manifold-Constrained Data Transport Protocol** that implements **Nested Domain Learning** at the bitstream layer. It replaces probabilistic software routing with deterministic prime topology.
18
+
19
+ It treats information as thermodynamic "heat" and "waves" defined by prime number theory.
20
 
21
  ## Features
22
 
app.py CHANGED
@@ -268,6 +268,14 @@ with gr.Blocks(theme=gr.themes.Monochrome(), title="LOGOS SPCW Protocol") as dem
268
  gr.Markdown("_\"The Machine Shop\" - Research & Development Lab_")
269
 
270
  with gr.Tabs():
 
 
 
 
 
 
 
 
271
  with gr.Tab("Prime Network Visualizer"):
272
  gr.Markdown("## Layer 1: Mathematical Blueprints")
273
  with gr.Row():
 
268
  gr.Markdown("_\"The Machine Shop\" - Research & Development Lab_")
269
 
270
  with gr.Tabs():
271
+ with gr.Tab("🏛️ Architecture"):
272
+ try:
273
+ with open(os.path.join(current_dir, "ARCHITECTURE.md"), "r", encoding='utf-8') as f:
274
+ arch_content = f.read()
275
+ gr.Markdown(arch_content)
276
+ except Exception:
277
+ gr.Markdown("## Architecture Document Not Found\nPlease check ARCHITECTURE.md in the file browser.")
278
+
279
  with gr.Tab("Prime Network Visualizer"):
280
  gr.Markdown("## Layer 1: Mathematical Blueprints")
281
  with gr.Row():
build_kb.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os
3
+ import json
4
+ import logging
5
+ from logos.connectors import get_connector
6
+
7
+ # Configure logging
8
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
9
+
10
+ def build_knowledge_base(source_dirs: list, output_file: str = "logos_knowledge_base.json"):
11
+ """
12
+ Scans directories for images, applies OCR, and saves a JSON knowledge base.
13
+ """
14
+ ocr = get_connector('ocr')
15
+ knowledge_base = []
16
+
17
+ total_files = 0
18
+ for directory in source_dirs:
19
+ if not os.path.exists(directory):
20
+ logging.warning(f"Directory not found: {directory}")
21
+ continue
22
+
23
+ logging.info(f"Scanning {directory}...")
24
+ for root, _, files in os.walk(directory):
25
+ for file in files:
26
+ if file.lower().endswith(('.png', '.jpg', '.jpeg', '.bmp')):
27
+ file_path = os.path.join(root, file)
28
+ try:
29
+ logging.info(f"Processing {file}...")
30
+ result = ocr.extract_text(file_path)
31
+
32
+ entry = {
33
+ "filename": file,
34
+ "path": file_path,
35
+ "word_count": result['word_count'],
36
+ "full_text": result['full_text'],
37
+ "text_blocks": result['text_blocks'] # Keep blocks for spatial context if needed
38
+ }
39
+ knowledge_base.append(entry)
40
+ total_files += 1
41
+ except Exception as e:
42
+ logging.error(f"Failed to process {file}: {e}")
43
+
44
+ with open(output_file, 'w', encoding='utf-8') as f:
45
+ json.dump(knowledge_base, f, indent=2, ensure_ascii=False)
46
+
47
+ logging.info(f"Knowledge Base built! Processed {total_files} images. Saved to {output_file}")
48
+
49
+ if __name__ == "__main__":
50
+ # Define source directories - Adjust these paths to where the user's notes actually are
51
+ # Using absolute paths based on previous context
52
+ PROJECT_ROOT = r"c:\Users\Nauti\Desktop\LOGOS CURSOR"
53
+ DIRS_TO_SCAN = [
54
+ os.path.join(PROJECT_ROOT, "LOGOS Screenshots"),
55
+ os.path.join(PROJECT_ROOT, "LOGOS Notes"),
56
+ os.path.join(PROJECT_ROOT, "LOGOS PRIME FUSE")
57
+ ]
58
+
59
+ # Check if we should only scan a subset for testing first?
60
+ # Or just go for it. Given "external resources are sparse, my notes are streamlined",
61
+ # we want as much as possible.
62
+
63
+ build_knowledge_base(DIRS_TO_SCAN)
logos/__pycache__/connectors.cpython-314.pyc ADDED
Binary file (23.9 kB). View file
 
logos_knowledge_base.json ADDED
@@ -0,0 +1 @@
 
 
1
+ []
query_kb.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import json
3
+ import argparse
4
+ import os
5
+
6
+ def query_knowledge_base(query, kb_file="logos_knowledge_base.json"):
7
+ if not os.path.exists(kb_file):
8
+ print(f"Knowledge base not found at {kb_file}. Run build_kb.py first.")
9
+ return
10
+
11
+ with open(kb_file, 'r', encoding='utf-8') as f:
12
+ kb = json.load(f)
13
+
14
+ print(f"\nSearching for: '{query}' in {len(kb)} documents...\n")
15
+ print("-" * 60)
16
+
17
+ hits = []
18
+ query = query.lower()
19
+
20
+ for entry in kb:
21
+ filename = entry['filename']
22
+ full_text = entry['full_text'].lower()
23
+
24
+ if query in full_text:
25
+ # Find context
26
+ idx = full_text.find(query)
27
+ start = max(0, idx - 50)
28
+ end = min(len(full_text), idx + 50 + len(query))
29
+ context = entry['full_text'][start:end].replace('\n', ' ')
30
+
31
+ hits.append({
32
+ 'filename': filename,
33
+ 'path': entry['path'],
34
+ 'context': f"...{context}...",
35
+ 'score': full_text.count(query)
36
+ })
37
+
38
+ # Sort by number of occurrences
39
+ hits.sort(key=lambda x: x['score'], reverse=True)
40
+
41
+ if not hits:
42
+ print("No matches found.")
43
+ else:
44
+ for hit in hits[:10]: # Top 10
45
+ print(f"📄 {hit['filename']} (Matches: {hit['score']})")
46
+ print(f" Path: {hit['path']}")
47
+ print(f" Context: {hit['context']}")
48
+ print("-" * 60)
49
+
50
+ if __name__ == "__main__":
51
+ parser = argparse.ArgumentParser(description="Query LOGOS Knowledge Base")
52
+ parser.add_argument("query", help="Search term")
53
+ args = parser.parse_args()
54
+
55
+ query_knowledge_base(args.query)