惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
O
OpenAI News
酷 壳 – CoolShell
酷 壳 – CoolShell
The GitHub Blog
The GitHub Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 聂微东
Engineering at Meta
Engineering at Meta
W
WeLiveSecurity
Hacker News: Ask HN
Hacker News: Ask HN
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
D
Docker
F
Full Disclosure
AI
AI
罗磊的独立博客
博客园 - 【当耐特】
U
Unit 42
S
SegmentFault 最新的问题
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Palo Alto Networks Blog
博客园_首页
H
Help Net Security
量子位
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 司徒正美
F
Fortinet All Blogs
D
DataBreaches.Net
B
Blog RSS Feed
Webroot Blog
Webroot Blog
TaoSecurity Blog
TaoSecurity Blog
S
Secure Thoughts
爱范儿
爱范儿
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
C
CERT Recently Published Vulnerability Notes
Martin Fowler
Martin Fowler
Blog — PlanetScale
Blog — PlanetScale
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Securelist

Hacker News - Newest: "LLM"

GitHub - lechmazur/position_bias: A benchmark for testing whether LLM judges keep the same preference when two lightly edited versions of the same story are shown in opposite orders. Flex routing (EU and EFTA) Dark Factories: Retooling for LLM Velocity Ask HN: What would be the impact of a LLM output injection attack? GitHub - AronDaron/dataset-generator: No-code desktop app for generating high-quality synthetic datasets to fine-tune LLMs — plan-then-execute pipeline, LLM-as-judge, HuggingFace upload. I thought I had a bug GitHub - Oaklight/llm-rosetta: Production-ready LLM API translation layer for Python — bidirectional conversion between OpenAI, Anthropic & Google formats via hub-and-spoke IR. Optional API gateway. Streaming & non-streaming. Zero core deps. Contributions welcome! GitHub - browser-use/browser-harness: Self-healing browser harness that enables LLMs to complete any task. GitHub - moeen-mahmud/remen: Remen turns thoughts into something you can return to Analyzing 156 LLM Launch Posts on Hacker News ChatGPT vs Gemini vs Claude: The Best LLM Subscription You Should Buy GitHub - salaamalykum/quran-semantic-search: High-density RAG Semantic Search Engine & Quran Corpus (GEO/SEO Architecture) GitHub - NVIDIA/TensorRT-LLM: TensorRT LLM provides users with an easy-to-use Python API to define Large Language Models (LLMs) and supports state-of-the-art optimizations to perform inference efficiently on NVIDIA GPUs. TensorRT LLM also contains components to create Python and C++ runtimes that orchestrate the inference execution in a performant way. The State of LLM Bug Bounties in 2026 Operational Readiness Criteria for Tool-Using LLM Agents Meshcore: Architecture for a Decentralized P2P LLM Inference Network How an LLM becomes more coherent as we train it GitHub - seetrex-ai/laimark GitHub - Jossifresben/BibCrit: AI-assited biblical textual criticism GitHub - wastedcode/memex: File system based wiki, maintained by Claude 99helpers.com GitHub - cliver-project/AITrigram GitHub - unbody-io/adapt: A self-evolving memory layer for AI agents. GitHub - hb20007/awesome-gen-ai-fails: A list of incidents where reliance on generative AI and LLMs resulted in harm to companies, individuals, or society GitHub - nevenkordic/localmind: Run any local LLM with persistent memory and context. CLI agent over Ollama with SQLite-backed hybrid recall. No cloud. Ask HN: What are the machine requirements for a LLM like Llama-3.1-8B? Faster LLM Inference via Sequential Monte Carlo grpo explained: group relative policy optimization for llm finetuning - cgft Stop comparing price per million tokens: the hidden LLM API costs · TensorZero Andrej Karpathy's LLM Wiki Is a Bad Idea GitHub - GG-QandV/mnemostroma: Offline RAM-first cognitive leer/coprocessor for AI agents and robotics. Solves "Context Abandonment" with 20-80ms latency using a dual-thread biomimetic memory architecture (ONNX + SQLite WAL). mempalace/agent at agent · skorotkiewicz/mempalace GitHub - TheoV823/mneme: Enforce architectural decisions in AI-assisted development. GitHub - klemenvod/TokenBrawl: A 1v1 Bomberman-style game where two LLM agents play autonomously against each other. No human plays — you watch the AIs fight. Each agent receives a text description of the board state, reasons about it, and outputs a move as JSON. The game engine executes it. Introducing the Common AI Provider: LLM and AI Agent Support for Apache Airflow Power Circuit AI: Designing Power Electronic Circuits for Motor Drives with Generative Artificial Intelligence Ask HN: How to program with IDE and LLM on CPU locally? Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Bonsai 1-bit WebGPU - a Hugging Face Space by webml-community The LLM Fallacy: Misattribution in AI-Assisted Cognitive Workflows Ask HN: Simple tooling for local LLM code critique without IDE integration? Can a General LLM Diagnose a DICOM Slice? A 10-Case Public Benchmark Charts-of-Thought: Enhancing LLM Visualization Literacy (PDF, 2026) GitHub - Mesh-LLM/mesh-llm: Distributed AI/LLM for the people. Share compute privately or publicly to power your agents and chat. GitHub - seamus-brady/springdrift: A persistent runtime for long-lived LLM agents Writing an LLM from scratch, part 32k -- Interventions: training a better model locally with gradient accumulation Ask HN: Which LLM model and agentic CLI are you using for local development? GitHub - wayneColt/modelcascade: Route local. Escalate smart. Never overspend. Open-source multi-model cascade routing for autonomous agents. LLM pricing is 100x harder than you think GitHub - asakin/llm-primer: Pre-warmed Claude Code sessions in tmux. No startup wait. GitHub - EggerMarc/chat-rs: A multi-provider LLM framework for Rust. GitHub - SynapseKit/SynapseKit: Minimal, async-first Python framework for production LLM apps- 2 hard deps, no magic, no SaaS. A Claude Skill that Makes LLM Paragraphs More Bearable Does Gas Town 'steal' usage from users' LLM credits & paid services to improve itself? What's Claude Code Actually Doing? Open the Black Box with the Arthur Engine Milla Jovovich's New Open Source LLM Memory App and the Dark Code Problem Your intuition of LLM token usage might be wrong Show HN: Bloomberg Terminal for LLM ops – free and open source GitHub - 0xchamin/mcptube: Transform YouTube videos into a compounding knowledge base with transcripts, vision analysis, and agentic search. Works as an MCP server for Claude, Copilot & more. Show HN: Open KB: Open LLM Knowledge Base Your LLM is a compiler, not a runtime GitHub - sapountzis/Unslop: A Web Feed That Deserves You crates.io: Rust Package Registry Beyond Karpathy's LLM-Wiki: The Necessity of Cognitive Governance GitHub - amitshekhariitbhu/llm-internals: Learn LLM internals step by step - from tokenization to attention to inference optimization. GitHub - parallem-ai/parallem: An expressive library for running agents with the Batch API. GitHub - stfurkan/pi-llm LLM-Wiki Show HN: Formal – Formal verification for AI-generated code using Lean 4 LRTS – Regression testing for LLM prompts (open source, local-first) LLM Wiki Skill: Build a Second Brain with Claude Code and Obsidian I built an LLM Wiki and RAG solution: here's a demo for a security KB The biggest advance in AI since the LLM Predict-Rlm: The LLM Runtime That Lets Models Write Their Own Control Flow the-synthetic-library/the-synthetic-mind at main · joshferrer1/the-synthetic-library GitHub - yisding/reviewwiggum GitHub - Donnyb369/mcp-spine: Context Minifier & State Guard — Local-first MCP middleware proxy GitHub - Beledarian/wgpu-llm: A from-scratch LLM inference engine that uses wgpu (the cross-platform WebGPU implementation) to dispatch WGSL compute shaders for every math operation a Transformer needs. No CUDA. No Python. No massive framework dependencies. Just Rust, raw shaders, and your GPU. GitHub - anitiue/Hindsight: An experience-driven self-improvement framework for LLM agents — 基于经验的 LLM Agent 自我改进框架 GitHub - stef41/lmscan: 🔍 Detect AI-generated text and fingerprint which LLM wrote it. Open-source GPTZero alternative. Zero dependencies, works offline. GitHub - alainnothere/AmdPerformanceTesting: Amd Performance Testing Ask HN: Is a purely Markdown-based CRM a terrible idea? Optimized for LLM agents Context Engineering - LLM Memory and Retrieval for AI Agents | Weaviate little_helper_tui/letter.md at main · sleepyeldrazi/little_helper_tui GitHub - EvanZhouDev/umr: The Unified Model Registry for all your local AI apps. GitHub - JordanCT/VigIA-Orchestrator Your Agent Is Mine: Measuring Malicious Intermediary Attacks on the LLM Supply Chain A Taxonomy of RL Environments for LLM Agents Llama LLM Network Feture GitHub - genedeng-ca/ai-mac-migration: AI-powered Mac-to-Mac migration tool - replace Apple Migration Assistant with intelligent, selective transfer using local LLMs GitHub - lunargate-ai/gateway: High-performance self-hosted AI gateway (OpenAI-compatible) with routing, retries, and streaming GitHub - AuthBits/webmcp: A lightweight, prompt-driven MCP web research server for high-quality LLM powered information extraction. Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering Springdrift: An Auditable Persistent Runtime for LLM Agents with Case-Based Memory, Normative Safety, and Ambient Self-Perception High-Stakes Personalization: Rethinking LLM Customization for Individual Investor Decision-Making From Static Templates to Dynamic Runtime Graphs: A Survey of Workflow Optimization for LLM Agents HUOZIIME: An On-Device LLM-enhanced Input Method for Deep Personalization TIDE: Token-Informed Depth Execution for Per-Token Early Exit in LLM Inference Characterizing WebGPU Dispatch Overhead for LLM Inference Across Four GPU Vendors, Three Backends, and Three Browsers LLM Targeted Underperformance Disproportionately Impacts Vulnerable Users
GitHub - Nyquest-ai/nyquest-rust-fullstack-pub: Nyquest — Semantic Compression Proxy for LLMs. 350+ rules, local LLM stage, 15-75% token savings. Full Rust stack.
256kmagic · 2026-04-17 · via Hacker News - Newest: "LLM"

Nyquest

Semantic Compression Proxy for LLMs

Rust Axum Rules Tests License Site

Reduce LLM token usage by 15–75% without losing meaning.

Drop-in proxy with 350+ compiled rules + local LLM semantic condensation (Qwen 2.5 1.5B). One-shot installer. System preflight. Systemd service. Works with Anthropic, OpenAI, Gemini, xAI, OpenRouter, and local models.

Oversampling wastes tokens. Undersampling distorts intent. Nyquest sits exactly on the boundary.

→ nyquest.ai  ·  How It Works  ·  Docs


📊 26.9% Rules / 75% Semantic ⚡ <2ms Rule Latency 🧠 Local LLM Stage 🌐 6 Providers 🪨 350+ Rules 🦀 Full Rust

What's New in v3.1.1

v3.1.1 adds a local LLM semantic condensation stage on top of the full Rust engine. System prompts compress by 56%, conversation history by 75%. Combined with 350+ regex rules, total savings reach 15–75% depending on workload.

v3.1.1 Highlights

  • Semantic LLM stage — Qwen 2.5 1.5B via Ollama condenses system prompts (56%) and history (75%)
  • One-shot installer — 8-phase script: hardware check → deps → Rust → build → semantic → preflight → wizard → start
  • System preflightnyquest preflight -v validates OS, CPU, RAM, disk, GPU/VRAM, glibc, Ollama, network
  • Hardware tier recommendations — Tier 1 (rules only), Tier 2 (GPU semantic), Tier 3 (CPU semantic)
  • Systemd user service — auto-configured, background start, journald logging
  • Code minifier — Python, JavaScript, Bash (54–56% savings)
  • Format optimizer — JSON→CSV/YAML (64% savings)
  • Cache reorder engine — sorts for provider prefix cache hits
  • 350+ rules across 18 categories
  • 1,408 req/s concurrent throughput

Compression Comparison

Stage System Prompts Conversation History Latency
Rules only (L1.0) 26.9% avg 19.1% <2ms
Rules + Semantic 55.9% 75% 200–350ms (GPU)

Hardware Tiers

Tier Requirements Capabilities Savings
Tier 1 2+ cores, 512 MB RAM Rules only (350+ rules, <2ms) 15–37%
Tier 2 4+ cores, 6+ GB RAM, 2+ GB VRAM Rules + GPU semantic (Qwen 2.5) 15–75%
Tier 3 4+ cores, 8+ GB RAM Rules + CPU semantic (1–4s latency) 15–75%

Production Benchmark Results (v3.1.1)

All benchmarks run on Ubuntu 24.04.

Engine Benchmarks — 10/10 Tests Passed

Test Result
Health check v3.1.1, Rust engine, OpenClaw enabled
Compression @ 0.3 358→281 tokens — 21.5% savings
Compression @ 0.5 358→230 tokens — 35.8% savings
Compression @ 1.0 358→225 tokens — 37.2% savings
Health throughput 549 req/s single-thread, p50 1.82ms, p99 2.25ms
Concurrent (20 workers, 200 req) 980 req/s, p50 13.6ms, p99 35.2ms
Live Anthropic proxy Working, negative overhead (-161ms vs direct)
SSE streaming Working, 349ms TTFB
OpenAI-compatible endpoint Working, correct chat.completion format
Resource usage 71.4 MB RSS, 0.0% system memory

Natural Prompt Compression — 8 Real-World Scenarios

Scenario Level 0.5 Level 0.7 Level 1.0
Customer Support 33.4% 33.4% 35.9%
Legal Review 16.0% 16.0% 30.0%
Data Science 16.5% 16.5% 22.0%
Travel Planner 23.3% 23.3% 26.3%
Code Review 16.6% 16.6% 36.6%
Financial Advisor 10.9% 10.9% 17.5%
HR Policy 16.5% 16.5% 26.0%
Medical Education 10.8% 10.8% 16.6%
AGGREGATE 18.4% 18.4% 26.9%

Cumulative Metrics (Production)

Metric Value
Total requests tracked 500+
Total tokens processed 115,592
Total tokens saved 19,170
Average savings 11.7% (mixed traffic, many small prompts)
Max single-request savings 76.1%

Cost Impact at Scale

Model Price/1M Input 100M tok/mo Monthly Savings @ 0.7 Monthly Savings @ 1.0
Claude Haiku 4.5 $0.25 $25 $4.60 $6.73
Claude Sonnet 4.5 $3.00 $300 $55.20 $80.70
Claude Opus 4.5 $15.00 $1,500 $276.00 $403.50
GPT-4o $2.50 $250 $46.00 $67.25
Grok 3 $3.00 $300 $55.20 $80.70

How It Works

Your Agent ──▶ Nyquest (localhost:5400) ──▶ LLM API ──▶ Response ──▶ Your Agent
                  │
                  ├── 1. Normalize (dedup, conflict resolution, speculation boundaries)
                  ├── 2. OpenClaw Agent Mode (7-strategy agentic optimization)
                  ├── 3. Cache Reorder (sort for provider prefix caching)
                  ├── 4. Rule Compress (350+ rules, telegraph, code minify, format optimizer)
                  ├── 5. Semantic LLM (Qwen 2.5 1.5B via Ollama — 56% system, 75% history)
                  ├── 6. Auto-scale + Forward (dynamic level, provider routing)
                  └── Measure (token accounting, metrics, dashboard)

Nyquest reads the model field (or x-nyquest-base-url header) to auto-detect the provider, translates between Anthropic and OpenAI formats as needed, compresses the prompt, and forwards to the upstream API. Responses (including SSE streams) pass through unmodified.

Compression Levels

Level Strategy Typical Savings
0.0 Pass-through (metrics only) 0%
0.2 Filler removal (~65 rules) 5–10%
0.5 Structural compression (~155 rules) 15–25%
0.7 Default — balanced 18–30%
1.0 Aggressive + format + minify (350+ rules) 25–37%

What Gets Compressed

System prompts, user messages, tool results, embedded code blocks, JSON payloads, markdown content. Assistant responses in conversation history are also compressed using lighter, progressive rules — older turns get deeper compression while recent turns stay intact.

Response Compression (Multi-Turn)

In multi-turn conversations, older assistant responses accumulate noise: "I'd be happy to help!", verbose explanations, over-formatted markdown. Nyquest compresses these with a separate, conservative pipeline that preserves semantic content while stripping fluff:

Tier Rules Applied
Always AI output noise ("Great question!", "Let me know if...")
Level 0.5+ Markdown minification, whitespace cleanup, inline JSON compaction
Level 0.8+ Filler/verbose stripping, code minification, format optimization, telegraph

The response_compression_age config (default: 4) controls how many recent turns are left untouched. Override per-request with x-nyquest-response-age header.

# In nyquest.yaml
compress_responses: true
response_compression_age: 4  # Only compress assistant turns older than 4 from the end

What Is NEVER Modified

Tool/function schemas (names, parameters, types), image blocks, audio blocks, API response bodies, model/max_tokens/temperature parameters, cache control markers.

Six-Stage Pipeline

Stage 1: Normalizer

Deduplicates repeated instructions, resolves conflicting constraints, injects speculation boundaries, strips role re-declarations. Runs at all non-zero compression levels.

Stage 2: OpenClaw Agent Mode

7-strategy optimization pipeline for autonomous agentic systems:

Strategy What It Does
Tool Result Pruning Truncates oversized tool outputs, deduplicates repeated results
Schema Minimization Removes optional fields, collapses descriptions in tool definitions
Thought Block Compression Strips verbose chain-of-thought from multi-turn agent loops
Error Deduplication Collapses repeated error messages into counts
Sliding Window Drops old conversation turns when context fills
Cache Injection Adds Anthropic cache_control markers for prefix caching
File View Condensation Compresses repeated file content views

Enable with header: x-nyquest-openclaw: true

Stage 3: Cache Reorder

Sorts tool definitions and system blocks into a deterministic order that maximizes provider-side prefix cache hit rates. This is transparent to the model but can significantly reduce costs on providers that support prompt caching.

Stage 4: Compression Engine

350+ regex rules across 18 categories in three tiers:

Category Tier Example
Filler phrases 0.2+ "due to the fact that" → "because"
Verbose phrases 0.2+ "your primary responsibility is to" → removed
Imperative conversions 0.5+ "you should always" → "always"
Clause collapse 0.5+ "in situations where" → "when"
Developer boilerplate 0.5+ Strip TODO/FIXME noise
Semantic formatting 0.5+ "for example" → "e.g."
Date compression 0.5+ "January 14th, 2025" → "2025-01-14"
Code minification 0.8+ Strip comments, collapse whitespace (Python/JS/Bash)
Format optimization 0.8+ JSON arrays → CSV, JSON objects → YAML
AI output noise 0.8+ Strip "As an AI language model..." preambles

After rules, the telegraph compressor makes sentence-level structural changes (preamble stripping, merge, dedup).

Stage 5: Semantic LLM (v3.1.1)

Local Qwen 2.5 1.5B model via Ollama condenses large messages that survive rule compression. Fires only on messages above configurable token thresholds (default: 4000 for system prompts, 8000 for conversation history). Falls back to extractive compression on timeout.

Content Type Semantic Savings Latency (GPU) Latency (CPU)
System prompts 56% 200–350ms 1–4s
Conversation history 75% 200–350ms 1–4s

Configure in nyquest.yaml:

semantic:
  enabled: true
  model: "qwen2.5:1.5b-instruct"
  ollama_url: "http://localhost:11434"
  timeout_ms: 5000
  system_threshold: 4000
  history_threshold: 8000
  fallback: "extractive"  # or "skip"

Stage 6: Auto-Scale + Forward

Dynamically adjusts compression level based on context window utilization:

  • Small prompts (<100 tokens): reduced compression for fidelity
  • 50% of context window: progressive ramp toward 1.0

  • 80% of context: maximum compression automatic

Quick Start

One-Shot Installer (Recommended)

The installer handles everything — system deps, Rust toolchain, build, optional semantic LLM stage, preflight validation, configuration wizard, and systemd service:

git clone https://github.com/Nyquest-ai/nyquest-rust-fullstack-pub.git ~/nyquest && bash ~/nyquest/install.sh

The installer runs through 8 phases: hardware pre-check → system deps → Rust toolchain → clone & build → semantic stage (optional) → preflight validation → configuration wizard → start engine.

Manual Build

cargo build --release
./target/release/nyquest preflight -v    # System check
./target/release/nyquest install         # Interactive setup wizard
./target/release/nyquest serve           # Start proxy

Headless Install (CI/Docker)

nyquest install --defaults --set port=8080 --set compression_level=0.7 --set semantic_enabled=true

Start the Engine

# Via systemd (recommended — installer sets this up)
systemctl --user start nyquest
systemctl --user status nyquest
journalctl --user -u nyquest -f

# Or foreground
nyquest serve

Test It

# Health check
curl http://localhost:5400/health | jq .

# Send a request through the proxy (Anthropic format)
curl -X POST http://localhost:5400/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-haiku-4-5-20251001",
    "max_tokens": 100,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

# OpenAI-compatible endpoint
curl -X POST http://localhost:5400/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ANTHROPIC_API_KEY" \
  -d '{
    "model": "claude-haiku-4-5-20251001",
    "max_tokens": 100,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Integration

OpenAI-Compatible Clients (any provider)

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:5400/v1",
    api_key="your-api-key",
)

# Use any model — Nyquest auto-routes to the right provider
response = client.chat.completions.create(
    model="claude-haiku-4-5-20251001",  # or gpt-4o, grok-3, gemini-2.5-flash
    messages=[{"role": "user", "content": "Hello!"}],
)

Anthropic Direct

import anthropic

client = anthropic.Anthropic(
    base_url="http://localhost:5400",
    api_key="your-anthropic-key",
)

response = client.messages.create(
    model="claude-haiku-4-5-20251001",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)

Per-Request Overrides

# Override compression level
curl -H "x-nyquest-level: 1.0" ...

# Override target provider
curl -H "x-nyquest-base-url: https://api.openai.com" ...

# Enable OpenClaw agent mode
curl -H "x-nyquest-openclaw: true" ...

# Override response compression age
curl -H "x-nyquest-response-age: 2" ...

Model Profiles

Nyquest automatically detects the model and applies an appropriate compression profile. Larger, more capable models handle aggressive compression well; smaller models need a gentler touch to maintain coherence.

Profile Models Strategy
Aggressive Claude Opus/Sonnet, GPT-4o, Grok 3, Gemini Pro, Llama 405B/70B, DeepSeek V3 Full compression at configured level. All rule categories fire at standard thresholds.
Balanced Unknown/unrecognized models Slightly raised thresholds for structural rewrites. Adjective collapse, clause simplify, and adverb strip require level 0.9+. Telegraph intensity reduced to 85%.
Conservative Claude Haiku, GPT-4o Mini, GPT-3.5, Grok Mini, Gemini Flash, Llama 8B, Mistral 7B, Phi Structural rewrites mostly disabled. Adjective/clause/adverb rules never fire. Telegraph intensity at 60%. Code comments preserved. Safe filler removal still active.

The profile is auto-detected from the model field and shown in the x-nyquest-profile response header and server logs. Same prompt at level 0.8 typically compresses ~6pp more on aggressive vs conservative profiles.

API Endpoints

Endpoint Method Description
/v1/messages POST Anthropic Messages API (native)
/v1/chat/completions POST OpenAI-compatible endpoint
/health GET Health + version + config
/metrics GET Token savings metrics (JSON)
/dashboard GET Web dashboard (HTML)
/analytics GET Rule hit analytics (JSON)

Response Headers

Every proxied response includes Nyquest headers:

Header Example Description
x-nyquest-version 3.1.1 Engine version
x-nyquest-savings 21.5% Token savings for this request
x-nyquest-original-tokens 358 Pre-compression token count
x-nyquest-compressed-tokens 281 Post-compression token count
x-nyquest-provider anthropic Detected provider
x-nyquest-profile conservative Model compression profile (aggressive/balanced/conservative)

Request Headers (Overrides)

Header Example Description
x-nyquest-level 1.0 Override compression level (0.0–1.0)
x-nyquest-openclaw true Enable OpenClaw agent mode
x-nyquest-base-url https://api.x.ai/v1 Override target provider
x-nyquest-response-age 2 Override response compression age threshold

Features

Hallucination Mitigation (Normalizer)

The normalizer detects and resolves common prompt patterns that lead to hallucination:

  • Constraint dedup: Removes repeated instructions that waste tokens and confuse models
  • Conflict resolution: Detects contradictory instructions (e.g., "be brief" + "be thorough") and flags them
  • Speculation boundaries: Injects "if unsure, say so" constraints when missing
  • Role dedup: Strips repeated "You are a..." role declarations

Context Window Optimization

Automatic conversation management for long-running agent sessions:

  • Sliding window drops old turns when context fills
  • Tool result pruning truncates oversized outputs
  • Thought block compression strips verbose chain-of-thought

Encrypted API Key Storage

API keys can be encrypted at rest using AES-256-GCM:

# In nyquest.yaml
security:
  encrypt_keys: true
  key_file: ~/.nyquest/keyring.enc

Web Dashboard

Built-in metrics dashboard at http://localhost:5400/dashboard:

  • Real-time request count, savings percentage, tokens saved
  • Per-request history with compression bars
  • Rule Analytics panel — live visualization of which compression categories fire most, color-coded by tier (green=0.2+, blue=0.5+, purple=0.8+)

Rule Analytics

Cumulative, lock-free atomic counters track every rule category hit across all requests. Available via:

  • Dashboard: Visual bar chart panel showing top categories, total hits, and response compression stats
  • /analytics endpoint: Full JSON snapshot for programmatic access
  • /metrics endpoint: Includes rule_analytics in the response

All 19 rule categories are tracked individually, plus response compression counts and token savings. Counters are session-scoped (reset on restart) and use relaxed atomic ordering for zero contention across tokio worker threads.

Configuration

Configuration via nyquest.yaml with environment variable overrides:

# Compression level: 0.0 (pass-through) to 1.0 (maximum)
compression_level: 0.7

# Adaptive mode: auto-adjust based on prompt type
adaptive_mode: true

# Default target API
target_api_base: "https://api.anthropic.com"
target_api_version: "2023-06-01"

# Server
host: "0.0.0.0"
port: 5400

# Logging
log_metrics: true
log_file: "logs/nyquest_metrics.jsonl"
log_level: "INFO"

# OpenClaw Agent Mode
openclaw:
  enabled: true
  tool_result_limit: 4096
  thought_compression: true
  cache_injection: true

# Normalization
normalize: true
stability_guard: false

# Provider overrides
providers:
  openai:
    base_url: "https://api.openai.com"
  xai:
    base_url: "https://api.x.ai"
  gemini:
    base_url: "https://generativelanguage.googleapis.com"
  openrouter:
    base_url: "https://openrouter.ai/api"

CLI Commands

All management commands are built into the single Rust binary — no Python, no external tools:

Command Description
nyquest install Interactive 11-section setup wizard
nyquest install --defaults Headless mode with defaults (CI/Docker)
nyquest install --set key=value Override specific settings
nyquest configure Re-open wizard (pre-loads existing values)
nyquest configure --section providers Jump to a specific section
nyquest config show Display all resolved config values
nyquest config get <key> Get a single value (dot-notation: providers.anthropic.api_key)
nyquest config set <key> <value> Set a single value
nyquest preflight System validation (OS, CPU, RAM, disk, GPU, deps, Ollama, network)
nyquest preflight -v Verbose preflight with tier recommendation
nyquest doctor 10-point health check (config, port, keys, dashboard, logs, systemd)
nyquest status Quick engine status
nyquest serve Start the proxy server (default if no command given)

Deployment

Systemd Service (Production)

The nyquest install wizard offers to create and enable the systemd service automatically. To do it manually:

# User service (recommended)
cp nyquest.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now nyquest
systemctl --user status nyquest
# → Nyquest v3.1.1 listening on 0.0.0.0:5400

Reverse Proxy (Cloudflare Tunnel)

The production deployment uses Cloudflare Tunnel for external access:

sudo systemctl enable --now cloudflared-nyquest

Production Checklist

  • systemd service with auto-restart
  • Cloudflare Tunnel for external access
  • Log rotation (JSONL metrics)
  • Security hardening (NoNewPrivileges, ProtectSystem)
  • API key encryption at rest
  • Health endpoint for monitoring

Security

API Key Handling

  • Keys passed via x-api-key or Authorization headers — never logged
  • Optional AES-256-GCM encryption at rest
  • Keys forwarded to upstream provider, never stored in request logs

Privacy Mode

  • Nyquest logs token counts and savings percentages only
  • Prompt content is never logged (even in debug mode)
  • No telemetry, no phone-home, no analytics

Systemd Hardening

NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=~/nyquest/logs
PrivateTmp=true

Project Structure

nyquest/
├── src/
│   ├── main.rs                       # Entry point + CLI dispatch
│   ├── lib.rs                        # Module declarations
│   ├── server.rs                     # Axum routes, auto-scaler, streaming relay
│   ├── compression/
│   │   ├── engine.rs                 # Tiered orchestrator, content block traversal
│   │   ├── rules.rs                  # 350+ regex rules across 18 categories
│   │   ├── telegraph.rs              # Sentence-level compression
│   │   ├── minify.rs                 # Code minification (Python/JS/Bash)
│   │   ├── format.rs                 # JSON→YAML/CSV, markdown flattening
│   │   └── mod.rs
│   ├── cli/
│   │   ├── install.rs                # Interactive setup wizard (headless mode)
│   │   ├── doctor.rs                 # Health check + status command
│   │   ├── config_cmd.rs             # show/get/set config subcommands
│   │   ├── preflight.rs              # System preflight validation
│   │   └── mod.rs
│   ├── openclaw.rs                   # 7-strategy agentic optimization
│   ├── semantic.rs                   # Local LLM condensation (Qwen 2.5 1.5B)
│   ├── cache_reorder.rs              # Prefix cache ordering
│   ├── normalizer.rs                 # Dedup, conflict resolution
│   ├── context.rs                    # Request context, provider detection
│   ├── stability.rs                  # Output verification + rollback
│   ├── tokens.rs                     # Hybrid token counter
│   ├── security.rs                   # AES-256-GCM key vault
│   ├── config.rs                     # YAML config loader
│   ├── dashboard.rs                  # Web dashboard
│   ├── analytics.rs                  # Lock-free atomic rule hit counters
│   ├── profiles.rs                   # Per-model compression profiles
│   ├── providers/mod.rs              # Provider routing + transforms
│   └── bin/benchmark.rs              # Built-in benchmark binary
├── tests/
│   └── role_based_test.rs            # 25-scenario role-based compression tests
├── docs/
│   ├── ARCHITECTURE.md               # System architecture overview
│   ├── nyquest_v31_engine_architecture.md  # Detailed v3.1.1 engine reference
│   ├── ROLE_BASED_TESTING.md         # Role-based test methodology + results
│   └── semantic-stage/              # Semantic LLM stage docs + setup scripts
├── install.sh                        # One-shot installer (8-phase)
├── nyquest.yaml                      # Default configuration
├── Cargo.toml                        # v3.1.1
├── CONTRIBUTING.md
├── LICENSE-MIT
├── LICENSE-APACHE
└── README.md

Roadmap

Core Engine

  • Pass-through proxy with API compatibility
  • Token accounting with calibrated estimator
  • Rule-based compression (350+ patterns, 3 tiers, 18 categories)
  • Full Rust rewrite (v3.0 → v3.1)
  • Code block minification (Python, JavaScript, Bash)
  • Format optimization (JSON→YAML/CSV, markdown flatten)
  • Cache reorder engine for provider prefix caching
  • Prompt normalization (constraint extraction, conflict resolution, dedup)
  • Hallucination mitigation (speculation boundaries, role preservation)
  • Context window optimization (conversation summarization)
  • Encrypted API key storage (AES-256-GCM)
  • Multi-provider routing (Anthropic, OpenAI, Gemini, xAI/Grok, OpenRouter, local)
  • OpenAI-compatible endpoint (/v1/chat/completions)
  • Format translation (OpenAI ↔ Anthropic)
  • Web dashboard with live metrics
  • OpenClaw Agent Mode (7-strategy agentic optimization)
  • Auto-scaling compression based on context window utilization
  • Response compression for multi-turn conversations (progressive tiers)
  • Rule analytics with per-category atomic counters and dashboard visualization
  • Per-model compression profiles (aggressive/balanced/conservative auto-detection)
  • Semantic LLM condensation (Qwen 2.5 1.5B via Ollama — 56% system, 75% history)
  • One-shot installer with 8-phase setup and hardware preflight
  • System preflight validation (OS, CPU, RAM, disk, GPU, glibc, Ollama, network)
  • Hardware tier recommendations (Tier 1/2/3 based on GPU/RAM)
  • Canonical agent encoding (symbolic instruction compression)

Products

  • Phase 1 — Cloud Proxy (multi-provider, metrics, dual endpoints)
  • Phase 2 — Token accounting, dashboard, security, context optimization
  • Phase 2.5 — OpenClaw Agent Mode (tool pruning, schema min, sliding window)
  • Phase 3 — Browser Extension (Chrome Manifest v3, local compression) — separate repo
  • Phase 3.5 — Full Rust Rewrite (v3.0 → v3.1, code minify, format optimizer)
  • Phase 3.6 — Semantic LLM Stage (v3.1.1, Qwen 2.5, one-shot installer, preflight)
  • Phase 4 — Windows Pedal App (Electron, guitar pedal UI)
  • Phase 5 — Telephony Middleware (real-time STT→compress→LLM→TTS)

Success Criteria

Metric Target Measured (v3.1.1)
Avg token reduction (rules) 15–35% 26.9% at level 1.0, 18.4% at 0.7 ✅
Avg token reduction (rules+semantic) 50–75% 55.9% system, 75% history ✅
Agent output degradation None None ✅
Schema integrity 100% 100% ✅
Added latency < 5ms <2ms (p50 1.82ms) ✅
Provider compatibility 4+ 6 (Anthropic, OpenAI, Gemini, xAI/Grok, OpenRouter, Local) ✅
Throughput > 500 req/s 1,408 req/s concurrent ✅
Compression rules Extensive 350+ rules across 18 categories ✅
Binary size < 20 MB 6.3 MB
Memory usage < 100 MB 71.4 MB RSS ✅