Thanks for your interest in contributing! This guide will help you get started.
# Clone the repo
git clone https://github.com/peterlodri-sec/kompress-ultra.git
cd kompress-ultra
# Install dependencies (requires Bun)
bun install
# Run tests
bun test
# Type check
bun run typecheck
# Build
bun run buildsrc/types.ts— All interfaces,validateOptions()config validationsrc/errors.ts— Typed error hierarchy (KompressError,CircuitOpenError, etc.)src/scoring.ts— Message scoring logic (relevance, recency, structural)src/rewriter.ts— Compression levels and message rewriting (fenced + inline code protection)src/compression.ts— Density computation and adaptive thresholdssrc/circulator.ts—Circulatorclass + singleton compat functionssrc/embedding.ts— Milvus integration and vector similaritysrc/brain.ts— Brain state managementsrc/token-budget.ts— Per-agent token budgets, pluggablesetTokenEstimator()src/circuit-breaker.ts—CircuitBreakerclass + singleton compat functionsserver/worker.ts— Cloudflare Worker (MCP + REST API with optional auth)
- TypeScript strict mode
- No external runtime dependencies (Bun stdlib only; Zod/dev deps for types)
- Functional style where possible; class-based for stateful modules
- JSDoc comments for public APIs
We use Bun's built-in test runner:
bun test # Run all tests
bun test --watch # Watch modeTests should cover:
- Edge cases (empty input, max length, Unicode)
- Safety floor guarantees (critical tokens never pruned, inline code preserved)
- Circuit breaker state transitions and instance isolation
- Circulator queue isolation between instances
- Config validation (range checks, invalid types)
- Pluggable token estimator behavior
- Full pipeline integration (score → filter → rewrite → token accounting)
- Fork the repo
- Create a feature branch (
git checkout -b feat/my-feature) - Add tests for new functionality
- Ensure all tests pass (
bun test) - Ensure type check passes (
bun run typecheck) - Submit a PR with a clear description
- Use the bug report template for bugs
- Use the feature request template for proposals
- Include reproduction steps for bugs
- Include benchmark data if relevant
This package implements the compression strategy from Asymmetric Loss Modulation Resolves the Voting Ensemble Paradox. If your change affects the scoring or compression logic, please:
- Reference the relevant section of the paper
- Include before/after benchmark numbers
- Explain any tradeoffs
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.