### Run ContextOS Installation Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Executes the main ContextOS installation script. This command detects your IDE, backs up configuration files, patches settings, downloads models, and starts the proxy daemon. ```bash contextos install ``` -------------------------------- ### Install ContextOS Source: https://github.com/skappal7/context-os/blob/main/README.md Install the ContextOS Python package and run the installation command to set up the proxy and integrate with supported IDEs. ```bash pip install contextos-dd && contextos install ``` -------------------------------- ### Install ContextOS Package Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Installs the ContextOS package and its dependencies using pip. This is the primary installation command for most users. ```bash pip install contextos-dd ``` -------------------------------- ### Install llama-cpp-python Prebuilt Wheel (Windows) Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md On Windows, install the prebuilt llama-cpp-python wheel first to avoid path length issues during compilation. Then, install the main ContextOS package. ```powershell pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu pip install contextos-dd ``` -------------------------------- ### Install ContextOS (Minimal) Source: https://github.com/skappal7/context-os/blob/main/README.md Install ContextOS without downloading models initially, suitable for offline or air-gapped environments. Models will download on first compaction. ```bash pip install contextos-dd contextos install --skip-models ``` -------------------------------- ### Warmup ContextOS Models Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Downloads and installs the necessary language models for ContextOS. This command can be run after an offline installation or to update models. ```bash contextos warmup ``` -------------------------------- ### Start ContextOS Daemon Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md If the ContextOS daemon is stopped, use this command to start it. Check daemon logs if issues persist. ```bash contextos start ``` -------------------------------- ### Install Dashboard Dependencies Source: https://github.com/skappal7/context-os/blob/main/README.md Install the necessary dependencies for the ContextOS dashboard using pip. ```bash pip install 'contextos-dd[dashboard]' ``` -------------------------------- ### Clone Repository and Install Development Dependencies Source: https://github.com/skappal7/context-os/blob/main/README.md Clone the ContextOS repository and install development and dashboard dependencies. Includes code checking and testing. ```bash git clone https://github.com/skappal7/context-os cd context-os pip install -e ".[dev,dashboard]" ruff check . pytest -q ``` -------------------------------- ### Start ContextOS Daemon Only Source: https://github.com/skappal7/context-os/blob/main/README.md Starts only the ContextOS daemon without launching the dashboard. ```bash contextos start --no-dashboard ``` -------------------------------- ### Start ContextOS Dashboard Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Launches the ContextOS dashboard in your web browser. This provides real-time insights into token savings and other metrics. ```bash contextos dashboard ``` -------------------------------- ### Start and Stop ContextOS Source: https://github.com/skappal7/context-os/blob/main/README.md Use these commands to manage the ContextOS service. Ensure CONTEXTOS_PASSTHROUGH is set for transparent proxying. ```bash export CONTEXTOS_PASSTHROUGH=1 contextos stop && contextos start ``` -------------------------------- ### Install ContextOS Without Models Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Installs ContextOS while skipping the model download step. This is useful for air-gapped or offline environments. Models can be downloaded later using 'contextos warmup'. ```bash contextos install --skip-models ``` -------------------------------- ### Verify ContextOS Installation Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Runs a diagnostic check on the ContextOS installation. It verifies paths, dependencies, network status, and IDE integrations. ```bash contextos doctor ``` -------------------------------- ### Start ContextOS Daemon in Foreground Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Run the ContextOS daemon in the foreground for live diagnostics. Output streams directly to the terminal, and Ctrl+C stops it cleanly. ```bash contextos start --foreground ``` -------------------------------- ### Reinstall llama-cpp-python for CPU Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md If you encounter installation errors with llama-cpp-python due to CPU instruction sets, reinstall version 0.2.90 using this command, which forces a CPU-specific wheel. ```bash pip install --force-reinstall "llama-cpp-python==0.2.90" --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu ``` -------------------------------- ### Listen for Step Changes Source: https://github.com/skappal7/context-os/blob/main/index.html Listens for custom 'cos-step-change' events and speaks the corresponding text if speech is enabled and audio is playing. Includes a delay to ensure camera movement starts first. ```javascript document.addEventListener('cos-step-change', e => { const step = e.detail.step; if(step === lastSpokenStep) return; lastSpokenStep = step; if(playing && speechEnabled && SPEECH[step]){ setTimeout(()=>speak(SPEECH[step]), 500); } }); ``` -------------------------------- ### Three.js Particle Sphere Creation Source: https://github.com/skappal7/context-os/blob/main/index.html Creates an interactive 3D sphere using Three.js, featuring particles that can be animated and respond to mouse movement. Includes setup for renderer, scene, camera, and particle geometry. ```javascript // ── THREE.JS SPHERE FACTORY ── function createSphere(canvasId){ const canvas=document.getElementById(canvasId); if(!canvas)return; const isHero=canvasId==='hero-canvas'; // Circular soft-dot sprite — circles not squares const spr=document.createElement('canvas');spr.width=64;spr.height=64; const sc=spr.getContext('2d'); const g=sc.createRadialGradient(32,32,0,32,32,32); g.addColorStop(0,'rgba(255,255,255,1)'); g.addColorStop(0.4,'rgba(255,255,255,0.8)'); g.addColorStop(0.8,'rgba(255,255,255,0.2)'); g.addColorStop(1,'rgba(255,255,255,0)'); sc.fillStyle=g;sc.fillRect(0,0,64,64); const sprite=new THREE.CanvasTexture(spr); const renderer=new THREE.WebGLRenderer({canvas,antialias:true,alpha:true}); renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)); const scene=new THREE.Scene(); const camera=new THREE.PerspectiveCamera(50,1,0.1,2000); camera.position.z=280; const resize=()=>{ const p=canvas.parentElement; renderer.setSize(p.clientWidth,p.clientHeight,false); camera.aspect=p.clientWidth/p.clientHeight; camera.updateProjectionMatrix() }; resize(); window.addEventListener('resize',resize); // ── PARTICLE DATA ────────────────────────────── const N=2400; // Sphere positions (origin) const originPos = new Float32Array(N*3); // Explode-to positions: each dot flies to a random point on a large shell const explodePos = new Float32Array(N*3); const col = new Float32Array(N*3); // Live buffer written each frame const livePos = new Float32Array(N*3); const R=90, EXPLODE_R=420; const golden=Math.PI*(1+Math.sqrt(5)); for(let i=0;i{ tx=(e.clientX/window.innerWidth -0.5)*0.45; ty=(e.clientY/window.innerHeight-0.5)*0.45; }); } // ── SCROLL PROGRESS (hero only) ──────────────── // Easing: ease-in-out cubic so explosion feels physical function easeInOut(t){ return t<0.5 ? 4*t*t*t : 1-Math.pow(-2*t+2,3)/2; } // Smooth scroll progress — lerped each frame for buttery feel let scrollProgress=0, targetScrol ``` -------------------------------- ### Hero Scene Animation Loop Source: https://github.com/skappal7/context-os/blob/main/index.html Handles the main animation loop for the hero scene, including auto-rotation, mouse parallax, and scroll-based explosion effects. Requires a 'hero-canvas' element and associated setup. ```javascript lProgress=0; if(isHero){ window.addEventListener('scroll',()=>{ const heroH=canvas.parentElement.clientHeight; targetScrollProgress=Math.min(window.scrollY/heroH,1); },{passive:true}); } // ── ANIMATION LOOP ───────────────────────────── (function animate(){ requestAnimationFrame(animate); // Slow auto-rotation points.rotation.y+=0.0022; // Mouse parallax cx+=(tx-cx)*0.04; cy+=(ty-cy)*0.04; if(isHero){ points.rotation.x=cy*0.6; points.rotation.z=cx*0.2; } if(isHero){ // Smooth scroll progress scrollProgress+=(targetScrollProgress-scrollProgress)*0.06; const p=easeInOut(scrollProgress); // Lerp every particle between origin and explode position const posAttr=geo.attributes.position; for(let i=0;iwrap.clientWidth; const H=()=>wrap.clientHeight; renderer.setSize(W(),H(),false); const scene = new THREE.Scene(); scene.fog = new THREE.FogExp2(0x04040C,0.012); const camera = new THREE.PerspectiveCamera(55,W()/H(),0.01,600); window.addEventListener('resize',()=>{ renderer.setSize(W(),H(),false); camera.aspect=W()/H(); camera.updateProjectionMatrix(); // rebuild overlay canvas rebuildOverlay(); },{passive:true}); ``` -------------------------------- ### Remove Corrupt Model and Warmup Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md If model compaction is slow, your model file might be corrupt. Remove the existing GGUF file and run 'contextos warmup' to re-download it. ```bash rm ~/.contextos/models/Qwen2.5-*.gguf contextos warmup ``` -------------------------------- ### Ambient Audio System Initialization Source: https://github.com/skappal7/context-os/blob/main/index.html Initializes the ambient audio system using the Web Audio API. This system plays a drone, procedural tones, and speech synthesis without external files or CDNs. ```javascript 'use strict'; const btn = document.getElementById('cos-audio-btn'); const icon = document.getElementById('cos-audio-icon'); const label = document.getElementById('cos-audio-lab ``` -------------------------------- ### Initialize LLM Node and Pulse Ring Source: https://github.com/skappal7/context-os/blob/main/index.html Sets up a 3D mesh for the LLM node and a visual pulse ring around it using Three.js. The ring material is set to be transparent and initially invisible. ```javascript const llmNodeMat=new THREE.MeshBasicMaterial({color:0x8888ff,transparent:true,opacity:0.0 }); const llmNode=new THREE.Mesh(new THREE.SphereGeometry(0.5,16,16),llmNodeMat); llmNode.position.set(P3.x+18,0,0); scene.add(llmNode); // Pulse ring around LLM node const llmRingMat=new THREE.MeshBasicMaterial({color:0x8888ff,transparent:true,opacity:0.0,wireframe:true}); const llmRing=new THREE.Mesh(new THREE.TorusGeometry(1.2,0.06,4,32),llmRingMat); llmRing.position.set(P3.x+18,0,0); llmRing.rotation.x=Math.PI/2; scene.add(llmRing); ``` -------------------------------- ### Build ContextOS Audio Graph Source: https://github.com/skappal7/context-os/blob/main/index.html Constructs the audio processing graph for ContextOS, including master gain, multiple oscillator layers for drones and pads, a scheduled pulse for a sci-fi tick, and filtered white noise for data stream effects. This function initializes the AudioContext and sets up all audio nodes. ```javascript function buildAudio(){ audioCtx = new (window.AudioContext || window.webkitAudioContext)(); // Master gain const master = audioCtx.createGain(); master.gain.setValueAtTime(0, audioCtx.currentTime); master.gain.linearRampToValueAtTime(0.55, audioCtx.currentTime + 2.5); master.connect(audioCtx.destination); nodes.master = master; // ── LAYER 1: Deep sub-bass drone (40Hz) ── const sub = audioCtx.createOscillator(); sub.type = 'sine'; sub.frequency.value = 40; const subGain = audioCtx.createGain(); subGain.gain.value = 0.35; sub.connect(subGain); subGain.connect(master); sub.start(); // ── LAYER 2: Mid drone (80Hz) with slow LFO wobble ── const mid = audioCtx.createOscillator(); mid.type = 'triangle'; mid.frequency.value = 80; const midGain = audioCtx.createGain(); midGain.gain.value = 0.18; // LFO on mid frequency const lfo1 = audioCtx.createOscillator(); lfo1.frequency.value = 0.12; const lfoGain1 = audioCtx.createGain(); lfoGain1.gain.value = 3; lfo1.connect(lfoGain1); lfoGain1.connect(mid.frequency); lfo1.start(); mid.connect(midGain); midGain.connect(master); mid.start(); // ── LAYER 3: High shimmer (320Hz) very faint ── const hi = audioCtx.createOscillator(); hi.type = 'sine'; hi.frequency.value = 320; const hiGain = audioCtx.createGain(); hiGain.gain.value = 0.04; // LFO on hi gain for pulse const lfo2 = audioCtx.createOscillator(); lfo2.frequency.value = 0.35; const lfoGain2 = audioCtx.createGain(); lfoGain2.gain.value = 0.03; lfo2.connect(lfoGain2); lfoGain2.connect(hiGain.gain); lfo2.start(); hi.connect(hiGain); hiGain.connect(master); hi.start(); // ── LAYER 4: Slow pad chord (160Hz + 192Hz + 240Hz) ── [160, 192, 240].forEach((freq, i) => { const pad = audioCtx.createOscillator(); pad.type = 'sine'; pad.frequency.value = freq; const padGain = audioCtx.createGain(); padGain.gain.value = 0.06; const padLFO = audioCtx.createOscillator(); padLFO.frequency.value = 0.08 + i * 0.03; const padLFOGain = audioCtx.createGain(); padLFOGain.gain.value = 0.05; padLFO.connect(padLFOGain); padLFOGain.connect(padGain.gain); padLFO.start(); pad.connect(padGain); padGain.connect(master); pad.start(); }); // ── LAYER 5: Data stream noise (filtered white noise) ── const bufSize = audioCtx.sampleRate * 2; const noiseBuffer = audioCtx.createBuffer(1, bufSize, audioCtx.sampleRate); const noiseData = noiseBuffer.getChannelData(0); for(let i=0;i v.lang.startsWith('en') && ( ``` -------------------------------- ### Uninstall ContextOS Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md Use this command to uninstall ContextOS. It restores IDE configurations and stops the daemon but does not delete data files. ```bash contextos uninstall ``` -------------------------------- ### Apply Visual Styles for Project Step Source: https://github.com/skappal7/context-os/blob/main/index.html Applies opacity and visual styles to various 3D model components (e.g., R1a, I2b, hexMats) based on the current project step. Controls the visibility and appearance of different stations and elements. ```javascript function applyStep(step){ // Station 1 const s1=step>=0?0.88:0; R1a.mat.opacity=s1; R1b.mat.opacity=s1*0.8; R1c.mat.opacity=s1*0.65; cM1.opacity=s1*0.95; // Station 2 const s2=step>=4?0.88:step===3?0.3:0; I2a.mat.opacity=s2; I2b.mat.opacity=s2*0.75; cM2.opacity=s2*0.95; compPts.material.opacity=step===5?0.88:step===4?0.4:0; // Station 3 const s3=step>=5?0.88:step===4?0.25:0; hexMats.forEach(m=>m.opacity=s3*0.9); strutMats.forEach(m=>m.opacity=s3*0.65); cM3. ``` -------------------------------- ### Set Proxy for Model Downloads Source: https://github.com/skappal7/context-os/blob/main/INSTALL.md If model downloads fail due to corporate proxies, set the HTTPS_PROXY environment variable before running 'contextos warmup'. You may also need to disable HF_TRANSFER. ```bash export HF_HUB_ENABLE_HF_TRANSFER=0 export HTTPS_PROXY=http://your-proxy:port ``` -------------------------------- ### Enable Passthrough Mode on Windows Source: https://github.com/skappal7/context-os/blob/main/README.md Sets an environment variable to disable trimming and keep IDE interactions as-is. Requires stopping and restarting the daemon. ```bash set CONTEXTOS_PASSTHROUGH=1 contextos stop && contextos start ``` -------------------------------- ### Create Raw Blob Particle System Source: https://github.com/skappal7/context-os/blob/main/index.html Generates a cloud of points representing a raw blob. The points are randomly distributed within a defined volume and rendered as a particle system. ```javascript const rawN=500,rawBase=new Float32Array(rawN*3); for(let i=0;i{titleEl.textContent=s.title;titleEl.style.opacity='1';titleEl.style.transform='translateY(0)';},150);} if(descEl){descEl.style.opacity='0'; setTimeout(()=>{descEl.textContent=s.desc;descEl.style.opacity='1';},200);} if(stepEl) stepEl.textContent=`STEP ${s.num} / 09`; targetTokens=TOKEN_VALS[step]; targetLabelOpacity=0; setTimeout(()=>{ targetLabelOpacity=1; },300); STEPS.forEach((_,i)=>{ const d=document.getElementById(`cos-dot-${i}`); if(d) d.style.cssText=`width:${i===step?'16px':'5px'};height:5px;border-radius:3px;background:${i===step?'var(--orange)':'rgba(255,255,255,0.18)'};transition:all 0.35s;`; }); if(hintEl) hintEl.style.opacity=step===0?'1':'0'; } ``` -------------------------------- ### Check ContextOS Status Source: https://github.com/skappal7/context-os/blob/main/README.md Displays the health status of the daemon and lists detected IDEs. ```bash contextos status ``` -------------------------------- ### Create Starfield Geometry and Points Source: https://github.com/skappal7/context-os/blob/main/index.html Generates a starfield using Three.js BufferGeometry and Points. Positions stars randomly within a defined volume. ```javascript (function(){ const N=1400,pos=new Float32Array(N*3); for(let i=0;i=STEPS.length) return; currentStep=s; const k=CAM[s]; tgtPos.set(k.p[0],k.p[1],k.p[2]); tgtLook.set(k.l[0],k.l[1],k.l[2]); updateUI(s); if(window.cosAudioStepChange) window.cosAudioStepChange(s); } const prevBtn=document.getElementById('cos-prev'); const nextBtn=document.getElementById('cos-next'); if(prevBtn) prevBtn.addEventListener('click',e=>{ e.stopPropagation(); goTo(currentStep-1); }); if(nextBtn) nextBtn.addEventListener('click',e=>{ e.stopPropagation(); goTo(currentStep+1); }); document.addEventListener('keydown',e=>{ if(e.key==='ArrowRight'||e.key==='ArrowDown') goTo(currentStep+1); if(e.key==='ArrowLeft' ||e.key==='ArrowUp') goTo(currentStep-1); }); let tx0=0,ty0=0; wrap.addEventListener('touchstart',e=>{ tx0=e.touches[0].clientX; ty0=e.touches[0].clientY; },{passive:true}); wrap.addEventListener('touchend',e=>{ const dx=e.changedTouches[0].clientX-tx0; const dy=e.changedTouches[0].clientY-ty0; if(Math.abs(dx)>Math.abs(dy)+10&&Math.abs(dx)>40){ if(dx<0) goTo(currentStep+1); else goTo(currentStep-1); } },{passive:true}); let md=false,mx0=0; wrap.addEventListener('mousedown',e=>{ md=true; mx0=e.clientX; wrap.style.cursor='grabbing'; }); window.addEventListener('mouseup',e=>{ if(md){ const dx=e.clientX-mx0; if(Math.abs(dx)>50){ if(dx<0) goTo(currentStep+1); else goTo(currentStep-1); } md=false; wrap.style.cursor='grab'; } }); ``` -------------------------------- ### Expose Step Change Functionality Source: https://github.com/skappal7/context-os/blob/main/index.html Exposes a global function `cosAudioStepChange` that allows external scripts to trigger a step change event, which in turn can initiate speech. ```javascript window.cosAudioStepChange = function(step){ document.dispatchEvent(new CustomEvent('cos-step-change',{detail:{step}})); }; ``` -------------------------------- ### Create and Manage 2D Overlay Canvas Source: https://github.com/skappal7/context-os/blob/main/index.html Creates a 2D canvas overlay for drawing labels or other 2D elements on top of the 3D scene. It handles scaling based on device pixel ratio and window size. ```javascript const oc = document.createElement('canvas'); oc.style.cssText='position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;'; wrap.appendChild(oc); let ctx; function rebuildOverlay(){ oc.width = W() * window.devicePixelRatio; oc.height = H() * window.devicePixelRatio; oc.style.width = W()+'px'; oc.style.height = H()+'px'; ctx = oc.getContext('2d'); ctx.scale(window.devicePixelRatio, window.devicePixelRatio); } rebuildOverlay(); ``` -------------------------------- ### Implement Scroll Reveal Animation Source: https://github.com/skappal7/context-os/blob/main/index.html Observes elements with the 'reveal' class and adds a 'visible' class when they enter the viewport, triggering animations. Includes support for transition delays. ```javascript const revealEls = document.querySelectorAll('.reveal'); const obs = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting) { const el = e.target; const delay = parseFloat(el.style.transitionDelay || el.dataset.delay || 0) * 1000; setTimeout(() => { el.classList.add('visible'); const op = el.dataset.opacity; if (op) el.style.opacity = op; }, delay); obs.unobserve(el); } }); }, { threshold: 0.1 }); revealEls.forEach(el => obs.observe(el)); ``` -------------------------------- ### Create Orbit Ring Dots Source: https://github.com/skappal7/context-os/blob/main/index.html Generates points arranged in a circular pattern to represent an orbit ring, using a custom PointsMaterial. ```javascript (function(){ const N=100,p=new Float32Array(N*3); for(let i=0;i