Skip to content

NikanEidi/StarryNote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

71 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

 β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘
 β–‘                                                                      β–‘
 β–‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—                 β–‘
 β–‘   β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•                 β–‘
 β–‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•                  β–‘
 β–‘   β•šβ•β•β•β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—  β•šβ–ˆβ–ˆβ•”β•                   β–‘
 β–‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘                    β–‘
 β–‘   β•šβ•β•β•β•β•β•β•   β•šβ•β•   β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•   β•šβ•β•                    β–‘
 β–‘                       N   O   T   E                                  β–‘
 β–‘                                                                      β–‘
 β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘

Cybernetic Knowledge Architecture System

Transform raw academic chaos into structured, exam-ready study guides β€” powered by Gemma 3 running locally on Apple Silicon.

Python MLX Gemma 3 Rich TUI Tests License


πŸ“‹ Table of Contents


🌟 What Is StarryNote?

StarryNote is a local-first, AI-powered knowledge synthesis engine that transforms raw study materials β€” lecture notes, code files, PDFs, screenshots β€” into professional-grade, structured study guides with zero cloud dependency.

Unlike generic summarizers, StarryNote acts as a Knowledge Architect: it doesn't just restate your input β€” it synthesizes original code examples, mathematical proofs, Mermaid diagrams, and exam questions that explain the source material at a deeper level.

The Philosophy: Your notes are fragments. StarryNote turns them into architecture.

Why StarryNote?

Problem StarryNote's Solution
Notes are scattered across formats Universal MIME scanner processes any file type
AI summaries are surface-level Knowledge Architect prompt forces synthesis > summary
Cloud AI raises privacy concerns Runs 100% locally on Apple Silicon via MLX
Output varies wildly Master Template enforces consistent, exam-ready output
No way to self-assess Metacognitive Calibration with confidence meters
LLM output has rendering bugs Triple-layer PostProcessor auto-fixes every output

✨ Key Features

🧠 AI Engine

  • Gemma 3 4B-IT running natively on Metal GPU
  • Multimodal: processes text, images, and PDFs
  • OCR fallback for scanned/image-based PDFs
  • Knowledge Architect prompt with 5 core directives
  • 8,192 token budget for complete 10-section output

πŸ›‘οΈ Post-Processing Pipeline

  • MermaidFixer: Auto-injects cyberpunk classDef, removes semicolons, replaces forbidden diagram types
  • OutputCleaner: Strips leaked AI instructions and unfilled placeholders
  • OutputValidator: Checks all 10 sections, Mermaid diagrams, exam questions
  • Triple-layer defense guarantees clean output

πŸ“œ 10-Section Master Template

  • Executive Summary Β· Concept Register
  • Cyberpunk Mermaid diagrams (auto-styled)
  • 3-tier exam questions (Apply β†’ Analyze β†’ Synthesize)
  • Quick Reference Card Β· Metacognitive Calibration

πŸ” Universal Scanner

  • DFS directory traversal with directory pruning
  • MIME-based detection (not file extensions)
  • Auto-skips .venv, __pycache__, .git, etc.
  • ScanResult with file stats and error tracking

πŸ–₯️ Cyberpunk Terminal UI

  • Large ASCII hero banner in neon purple
  • 4-phase pipeline with animated spinners
  • Resource discovery table with MIME icons
  • Knowledge Density star rating (✦ to ✦✦✦✦✦)

πŸ§ͺ 382 Unit Tests

  • 12 test files covering every module
  • 50+ MIME types classified and routing-tested
  • Edge cases: symlinks, empty files, Unicode, large content
  • Realistic dirty LLM output simulation
  • Full traceability matrix (75 requirements β†’ 382 tests)

πŸ—οΈ System Architecture

graph TD
    classDef default fill:#1a1a1a,stroke:#bc13fe,stroke-width:2px,color:#00f3ff
    classDef highlight fill:#2a0a3a,stroke:#00f3ff,stroke-width:2px,color:#bc13fe
    classDef input fill:#1a1a1a,stroke:#ff6ec7,stroke-width:2px,color:#ff6ec7
    classDef output fill:#1a1a1a,stroke:#39ff14,stroke-width:2px,color:#39ff14

    A["πŸ“‚ Raw Study Materials"]:::input --> B["πŸ” StarryScanner<br/>MIME Detection Β· DFS Walk"]
    B --> C{"File Type Router"}
    C -->|"image/*"| D["πŸ–ΌοΈ Image Analyzer<br/>PIL Β· Multimodal"]
    C -->|"application/pdf"| E["πŸ“„ PDF Analyzer<br/>PyMuPDF Β· OCR"]
    C -->|"text/*"| F["πŸ“ Text Analyzer<br/>UTF-8 Read"]
    D --> G["🧠 Gemma 3 Engine"]:::highlight
    E --> G
    F --> G
    G --> H["πŸ“ PromptBuilder<br/>System Rules + Template"]:::highlight
    H --> I["πŸ›‘οΈ PostProcessor<br/>Mermaid Fix Β· Clean Β· Validate"]:::highlight
    I --> J["πŸ’Ύ StarryFormatter<br/>Instructions/ Output"]
    J --> K["πŸ“˜ Study Guides"]:::output
Loading

Module Dependency Graph

graph LR
    classDef default fill:#1a1a1a,stroke:#bc13fe,stroke-width:2px,color:#00f3ff
    classDef highlight fill:#2a0a3a,stroke:#00f3ff,stroke-width:2px,color:#bc13fe

    main[main.py] --> engine[StarryEngine]
    main --> scanner[StarryScanner]
    main --> formatter[StarryFormatter]
    engine --> tl[TemplateLoader]:::highlight
    engine --> pb[PromptBuilder]:::highlight
    engine --> pp[PostProcessor]:::highlight
    formatter --> pp
    pp --> mf[MermaidFixer]
    pp --> oc[OutputCleaner]
    pp --> ov[OutputValidator]
Loading

Data Flow

sequenceDiagram
    participant U as πŸ‘€ User
    participant M as main.py<br/>TUI Hub
    participant S as StarryScanner
    participant E as StarryEngine
    participant PB as PromptBuilder
    participant G as Gemma 3<br/>MLX Metal
    participant PP as PostProcessor
    participant F as StarryFormatter

    U->>M: python main.py
    M->>E: Initialize (load model)
    E->>G: Load weights into Unified Memory
    G-->>E: Model ready
    M->>S: scan(cwd)
    S-->>M: ScanResult{resources, stats}
    
    loop For each resource
        M->>E: process_resource(resource)
        E->>PB: build(template, content)
        PB-->>E: Complete prompt
        E->>G: stream_generate(prompt)
        G-->>E: Raw Markdown
        E->>PP: PostProcessor.process(raw)
        PP-->>E: Clean Markdown
        E-->>M: guide_content
        M->>F: save_guide(path, content)
        F->>PP: PostProcessor.process(content)
        F-->>M: output_path
    end
    
    M-->>U: Mission Report + Constellation
Loading

πŸ“ Project Structure

StarryNote/
β”œβ”€β”€ main.py                          # πŸ–₯️  TUI entry point (4-phase pipeline)
β”œβ”€β”€ requirements.txt                 # πŸ“¦  Python dependencies
β”œβ”€β”€ README.md                        # πŸ“–  You are here
β”œβ”€β”€ .gitignore                       # 🚫  Git exclusion rules
β”‚
β”œβ”€β”€ src/                             # βš™οΈ  Core engine modules (6 files, 10 classes)
β”‚   β”œβ”€β”€ __init__.py                  #     Package initializer
β”‚   β”œβ”€β”€ scanner.py                   # πŸ”  UniversalResource + ScanResult + StarryScanner
β”‚   β”œβ”€β”€ template_loader.py           # πŸ“  Template I/O, cleaning, and compaction
β”‚   β”œβ”€β”€ prompt_builder.py            # πŸ€–  Knowledge Architect prompt construction
β”‚   β”œβ”€β”€ model_engine.py              # 🧠  MimeClassifier + TextExtractor + StarryEngine
β”‚   β”œβ”€β”€ postprocessor.py             # πŸ›‘οΈ  MermaidFixer + OutputCleaner + OutputValidator
β”‚   └── formatter.py                 # πŸ’Ύ  Post-process + save to Instructions/
β”‚
β”œβ”€β”€ templates/                       # πŸ“  AI output templates
β”‚   └── master_template.md           # πŸ“œ  10-section study guide scaffold
β”‚
β”œβ”€β”€ tests/                           # πŸ§ͺ  Test suite (382 tests across 12 files)
β”‚   β”œβ”€β”€ __init__.py                  #     Package initializer
β”‚   β”œβ”€β”€ test_engine.py               # πŸ”¬  StarryEngine prompt + routing tests (22)
β”‚   β”œβ”€β”€ test_file_types.py           # πŸ”¬  MimeClassifier + TextExtractor + routing (92)
β”‚   β”œβ”€β”€ test_postprocessor.py        # πŸ”¬  MermaidFixer + Cleaner + Validator (27)
β”‚   β”œβ”€β”€ test_prompt_builder.py       # πŸ”¬  PromptBuilder rules tests (14)
β”‚   β”œβ”€β”€ test_template_loader.py      # πŸ”¬  TemplateLoader I/O tests (14)
β”‚   β”œβ”€β”€ test_template.py             # πŸ”¬  Master template structure tests (33)
β”‚   β”œβ”€β”€ test_formatter.py            # πŸ”¬  Formatter + post-processing tests (15)
β”‚   β”œβ”€β”€ test_scanner.py              # πŸ”¬  Scanner + ScanResult tests (22)
β”‚   β”œβ”€β”€ test_edge_cases.py           # πŸ”¬  Cross-module edge cases (19)
β”‚   β”œβ”€β”€ test_tui.py                  # πŸ”¬  TUI utility + animation tests (112)
β”‚   β”œβ”€β”€ test_model.py                # πŸ”¬  GPU + metal validation (1, requires GPU)
β”‚   β”œβ”€β”€ test_universal_scanner.py    # πŸ”¬  Integration smoke test (1)
β”‚   └── sample_note.txt              # πŸ“  Test fixture
β”‚
β”œβ”€β”€ docs/                            # πŸ“š  Documentation
β”‚   β”œβ”€β”€ TestLog.md                   # πŸ“‹  Complete test execution log
β”‚   β”œβ”€β”€ TraceabilityMatrix.md        # πŸ”—  Requirements β†’ Code β†’ Tests mapping
β”‚   └── FunctionExplanations.md      # πŸ“–  Detailed function documentation
β”‚
β”œβ”€β”€ .github/                         # πŸ€–  CI/CD
β”‚   └── workflows/
β”‚       └── main.yml                 # ▢️   GitHub Actions: pytest on push/PR
β”‚
β”œβ”€β”€ models/                          # πŸ—„οΈ  MLX model weights (auto-downloaded, gitignored)
└── Instructions/                    # πŸ“˜  Generated study guides (created at runtime)

⚑ Prerequisites

Requirement Minimum Recommended
macOS 13.0 (Ventura) 14.0+ (Sonoma)
Chip Apple M1 Apple M3 / M4
RAM 8 GB Unified 16 GB+ Unified
Python 3.11 3.12+
Disk ~5 GB (model weights) 10 GB+
libmagic Required brew install libmagic

⚠️ Apple Silicon Required. StarryNote uses MLX, Apple's Metal-optimized ML framework. It will not run on Intel Macs or Linux/Windows without modifying the engine.


πŸš€ Installation

1. Clone the Repository

git clone https://github.com/NikanEidi/StarryNote.git
cd StarryNote

2. Install System Dependencies

# libmagic is required for MIME type detection
brew install libmagic

3. Create & Activate Virtual Environment

python3 -m venv .venv
source .venv/bin/activate

4. Install Python Dependencies

pip install -r requirements.txt

5. Verify GPU Access

python -c "import mlx.core as mx; print(f'Metal GPU: {mx.metal.is_available()}')"
# Expected output: Metal GPU: True

πŸ’‘ First Run Note: Gemma 3 weights (~5 GB) are downloaded automatically from Hugging Face on the first execution. Subsequent runs load from cache.


🎯 Usage

Basic Usage

Navigate to any directory containing study materials, then run:

cd /path/to/your/study/materials
python /path/to/StarryNote/main.py

Or from the StarryNote directory itself:

python main.py

What Happens

  1. ⚑ Phase 1 β€” Neural Initialization: Loads Gemma 3 into Apple Silicon's unified memory
  2. πŸ” Phase 2 β€” Deep Scan: DFS traversal discovering all files via MIME detection
  3. 🧠 Phase 3 β€” Knowledge Synthesis: Processes each file through the Knowledge Architect pipeline
  4. πŸ“Š Phase 4 β€” Mission Report: Displays results table with timing and density ratings

Output

Study guides are saved to an Instructions/ folder in the current working directory:

Instructions/
β”œβ”€β”€ lecture_notes_StudyGuide.md
β”œβ”€β”€ algorithm_code_StudyGuide.md
└── exam_review_StudyGuide.md

Every saved guide is automatically post-processed β€” Mermaid diagrams are fixed, leaked instructions are stripped, and output is validated.


πŸ”¬ Pipeline Deep Dive

The Scanner (src/scanner.py)

graph LR
    classDef default fill:#1a1a1a,stroke:#bc13fe,stroke-width:2px,color:#00f3ff

    A["os.walk()"] --> B["python-magic<br/>MIME detection"]
    B --> C{"Classify"}
    C -->|"image/jpeg"| D["πŸ–ΌοΈ UniversalResource"]
    C -->|"application/pdf"| E["πŸ“„ UniversalResource"]
    C -->|"text/x-python"| F["🐍 UniversalResource"]
    C -->|"text/plain"| G["πŸ“ UniversalResource"]
Loading

The StarryScanner uses libmagic to read binary headers and determine the true MIME type. Each file is packaged into a UniversalResource dataclass:

@dataclass
class UniversalResource:
    file_path: str       # Absolute path to the file
    mime_type: str       # e.g., 'image/jpeg', 'application/pdf'
    raw_data: Any        # Path reference for downstream processing
    size_bytes: int = 0  # File size in bytes

The enhanced scan() method returns a ScanResult with full statistics:

result = scanner.scan("/path/to/notes")
print(f"Found {result.count} files, {result.total_bytes} bytes")
print(f"Skipped {result.skipped_count}, Errors: {result.error_count}")

The Engine (src/model_engine.py)

The engine routes each UniversalResource through the appropriate analyzer:

MIME Type Analyzer Strategy
image/* _analyze_image() PIL β†’ RGB conversion β†’ multimodal prompt
application/pdf _analyze_pdf() PyMuPDF text extraction β†’ OCR fallback if <100 chars
text/* _analyze_text() Direct content injection into prompt

All three analyzers run PostProcessor.process() on the raw output before returning.

The Formatter (src/formatter.py)

  • Creates Instructions/ directory at the current working directory
  • Generates filenames: {original_name}_StudyGuide.md
  • Automatically post-processes every guide before saving (Mermaid fixing, instruction stripping)
  • Provides validate_guide() for checking structural completeness of saved files

πŸ“œ The Master Template

Every generated study guide follows a strict 10-section structure:

graph TD
    classDef default fill:#1a1a1a,stroke:#bc13fe,stroke-width:2px,color:#00f3ff
    classDef highlight fill:#1a1a1a,stroke:#39ff14,stroke-width:2px,color:#39ff14

    A["I. Executive Summary"] --> B["II. Core Concepts"]
    B --> C["III. Visual Knowledge Graph"]
    C --> D["IV. Technical Deep Dive"]
    D --> E["V. Annotated Glossary"]
    E --> F["VI. Exam Preparation"]
    F --> G["VII. Knowledge Connections"]
    G --> H["VIII. Quick Reference Card"]:::highlight
    H --> I["IX. Metacognitive Calibration"]:::highlight
    I --> J["X. Source Archive"]
Loading

Section Breakdown

# Section Purpose Unique Feature
I Executive Summary Abstract + Central Thesis + Applied Context Forces non-obvious insight extraction
II Core Concepts Concept Register table + Comparative Analysis Requires specific "Common Pitfall" per concept
III Visual Knowledge Graph Auto-generated Mermaid diagram Cyberpunk styling: #bc13fe stroke, #00f3ff text
IV Technical Deep Dive Code (CS) / LaTeX (Math) / Source Analysis (Humanities) Auto-selects block type by subject classification
V Annotated Glossary Domain terms with etymology & related terms Requires linguistic root for scientific terms
VI Exam Preparation 3-tier questions: Application β†’ Analysis β†’ Synthesis Collapsible answers with reasoning chains
VII Knowledge Connections Dependencies, next topics, cross-domain links Maps learning pathways
VIII Quick Reference Card Condensed cheat sheet: takeaways + formulas + traps Pre-exam checklist
IX Metacognitive Calibration Confidence Meter (πŸ”΄πŸŸ‘πŸŸ’πŸ”΅) per concept Personalized study prescriptions
X Source Archive Verbatim original input (read-only) Audit trail for review

πŸ›‘οΈ Post-Processing Pipeline

StarryNote uses a triple-layer defense to guarantee clean output regardless of what the LLM generates:

graph LR
    classDef default fill:#1a1a1a,stroke:#bc13fe,stroke-width:2px,color:#00f3ff
    classDef highlight fill:#2a0a3a,stroke:#00f3ff,stroke-width:2px,color:#bc13fe

    A["Raw LLM Output"] --> B["OutputCleaner<br/>Strip leaked instructions"]:::highlight
    B --> C["MermaidFixer<br/>Fix diagrams + inject classDef"]:::highlight
    C --> D["OutputValidator<br/>Check sections + warnings"]:::highlight
    D --> E["Clean Study Guide"]
Loading

Layer 1: PromptBuilder (Prevention)

All rules are baked into the system prompt β€” the model is instructed to generate clean output from the start.

Layer 2: PostProcessor (Correction)

Even if the LLM ignores the rules, PostProcessor.process() auto-fixes the output:

Fixer What It Does
OutputCleaner Strips <!-- AI INSTRUCTION -->, [[AI INSTRUCTION]], **RULES:**, unfilled {{PLACEHOLDERS}}
MermaidFixer Replaces sequenceDiagram/mindmap/classDiagram β†’ graph TD, injects cyberpunk classDef, removes ; and inline style
OutputValidator Logs warnings for missing sections, missing mermaid, missing exam questions

Layer 3: Formatter (Final Gate)

StarryFormatter.save_guide() runs the full PostProcessor pipeline again before writing to disk β€” the final safety net.


πŸ€– Knowledge Architect Prompt

The AI follows 4 Core Directives defined in src/prompt_builder.py:

Directive Rule
AUTHORSHIP Set Author to "S T A R R Y N O T E"
SYNTHESIS > SUMMARY Create original examples, proofs, and diagrams β€” don't just repeat the input
FORMATTING Follow the Master Template exactly, generate ALL 10 sections
ACADEMIC TONE Scholarly, precise, no conversational filler

Plus section-specific rules for each of the 10 sections, Mermaid rules with exact classDef values, and explicit output rules forbidding HTML comments and instruction markers.


πŸ–₯️ Terminal UI

StarryNote's TUI is built with Rich and follows a 4-phase pipeline design:

Phase Layout

Phase Name Visual Elements
⚑ 1 Neural Initialization Animated spinner while loading Gemma 3 into unified memory
πŸ” 2 Deep Scan Resource table with MIME icons (πŸπŸ–ΌπŸ“„πŸ“πŸ“¦), file sizes
🧠 3 Knowledge Synthesis Progress bar per file + overall, elapsed time, density rating
πŸ“Š 4 Mission Report Results table, summary panel, constellation footer

Knowledge Density Rating

Measures AI amplification β€” how much original content the AI generated relative to the input size:

Rating Ratio Meaning
✦ < 1Γ— Minimal expansion
✦✦ 1–2Γ— Moderate synthesis
✦✦✦ 3–4Γ— Strong synthesis
✦✦✦✦ 5–7Γ— Deep synthesis
✦✦✦✦✦ 8Γ—+ Maximum amplification

πŸ§ͺ Testing

Run All Tests

source .venv/bin/activate
pytest tests/ -v

Test Summary

File Tests What It Covers
test_engine.py 22 Engine prompt building, MIME routing, token budget
test_file_types.py 92 MimeClassifier (50+ MIME types), TextExtractor (all readers), routing (24 formats)
test_postprocessor.py 27 MermaidFixer, OutputCleaner, OutputValidator, pipeline
test_prompt_builder.py 24 All rules, Mermaid classDef, structural rules, table format rules
test_template_loader.py 14 Template I/O, clean, compact, recovery mode
test_template.py 33 Master template structure, sections, placeholders
test_formatter.py 15 Save, naming, UTF-8, post-processing integration
test_scanner.py 22 Resources, ScanResult, filtering, errors
test_edge_cases.py 19 Symlinks, Unicode, nested dirs, realistic dirty output
test_tui.py 112 Icons, sizing, density, starfield, glitch, matrix rain, waveform, orbital, neon pulse, gradient bar, design system
test_model.py 1 GPU validation (requires Apple Silicon)
test_universal_scanner.py 1 Integration smoke test
TOTAL 382 100% pass rate

CI/CD

GitHub Actions runs pytest tests/ on every push to main/master and on pull requests. See .github/workflows/main.yml.

⚠️ Note: test_model.py requires Apple Silicon with Metal GPU β€” it will skip in CI (Ubuntu runner).


πŸ“š Documentation

Document Path Description
Test Log docs/TestLog.md Complete test execution results with all 196 tests
Traceability Matrix docs/TraceabilityMatrix.md Maps 53 requirements β†’ implementations β†’ 196 tests
Function Explanations docs/FunctionExplanations.md Detailed documentation of every class and method

βš™οΈ Configuration

Model Selection

Change the model in src/model_engine.py:

engine = StarryEngine(model_path="google/gemma-3-4b-it")   # Default
engine = StarryEngine(model_path="google/gemma-3-12b-it")   # Larger (needs 16GB+ RAM)

Max Token Output

Adjust MAX_TOKENS in src/model_engine.py:

MAX_TOKENS = 8192   # Default β€” full 10-section guide
MAX_TOKENS = 12000  # Longer, more detailed guides

Skip Patterns

Customize skip patterns in src/scanner.py:

scanner = StarryScanner(skip_patterns={
    "Instructions", ".venv", "__pycache__", ".git",
    ".DS_Store", ".idea", "node_modules",
})

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit with clear messages: git commit -m "feat: add X"
  4. Push to your fork: git push origin feature/my-feature
  5. Open a Pull Request

Code Style

black src/ main.py tests/

Test Before Pushing

pytest tests/ -v
# All 382 tests should pass

πŸ“Š Tech Stack

graph LR
    classDef default fill:#1a1a1a,stroke:#bc13fe,stroke-width:2px,color:#00f3ff

    subgraph "AI Layer"
        A["Gemma 3 4B-IT"] --> B["MLX Framework"]
        B --> C["Metal GPU"]
    end

    subgraph "Processing Layer"
        D["python-magic"] --> E["StarryScanner"]
        F["PyMuPDF"] --> G["PDF Analyzer"]
        H["Pillow"] --> I["Image Analyzer"]
    end

    subgraph "Safety Layer"
        J["MermaidFixer"] --> K["PostProcessor"]
        L["OutputCleaner"] --> K
        M["OutputValidator"] --> K
    end

    subgraph "Presentation Layer"
        N["Rich"] --> O["Cyberpunk TUI"]
        P["Master Template"] --> Q["Markdown Output"]
    end

    E --> A
    G --> A
    I --> A
    A --> P
    A --> K
    K --> Q
Loading

πŸ—οΈ Module Architecture

Module Classes Responsibility
scanner.py UniversalResource, ScanResult, StarryScanner DFS file discovery, MIME detection, skip filtering, stats
template_loader.py TemplateLoader Template I/O, cleaning, compaction, recovery mode
prompt_builder.py PromptBuilder System prompt with all rules (single source of truth)
model_engine.py MimeClassifier, TextExtractor, StarryEngine MIME classification, universal file reading, LLM orchestration
postprocessor.py MermaidFixer, OutputCleaner, OutputValidator, PostProcessor Output sanitization pipeline
formatter.py StarryFormatter Post-process + save to disk + validation

 ─────────────────────────────────────────────────────────────────────────────
  S T A R R Y N O T E  Β·  Knowledge Architecture System  Β·  v2.1
  Gemma 3  Β·  Apple Silicon  Β·  MLX  Β·  382 Tests  Β·  12 Classes
  Structured for clarity.  Engineered for mastery.  Calibrated for you.
 ─────────────────────────────────────────────────────────────────────────────

Made with ✦ by Nikan Eidi

About

A local-first, AI-powered knowledge architecture system that transforms raw study materials into professional-grade study guides using Gemma 3 on Apple Silicon.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages