AI Agent Hub
Back to plugins
🤖

dsh-is-power-of-two

Model Inference Updated 2026.08.21

Run the following command in DeepSeek Harness:

dsh plugin install uckkk/dsh-is-power-of-two

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install uckkk/dsh-is-power-of-two in the DeepSeek Harness terminal to install this plugin; the full source repository is at https://github.com/uckkk/dsh-is-power-of-two

About this plugin

In model inference pipelines, parameters such as attention head counts, KV-cache shard sizes, and quantization group sizes are expected to be powers of two; a single misconfiguration can cause silent corruption or runtime failures far downstream. dsh-is-power-of-two reduces that check to a single zero-dependency pure Node function: no network I/O, no async overhead, just a boolean returned immediately.

Its entire job is one: given a non-negative integer, return whether it is a power of two. There are no callbacks, no promises, no configuration surface. Under the hood it relies on the classic bit trick n & (n - 1), yielding an O(1) check that stays invisible even on hot paths that validate parameters thousands of times per second.

It fits naturally into inference-service startup self-checks, parameter-validation middleware, or CLI scaffolding where a lightweight assertion is needed. Licensed under MIT, it is a single portable file that drops into any Node project without adding a transitive dependency tree.

Use Cases

  • Validating attention head counts and KV-cache shard sizes at inference service startup
  • Checking quantization group-size parameters during model loading
  • Performing instant assertions on user input in CLI scaffolding

Best For

  • Engineers needing lightweight parameter checks in inference pipelines
  • Developers building zero-dependency Node.js toolchains
  • Teams running fast config self-checks in CI/CD