htmlp

Stop the Slop.

Token limits for prompt files, statically enforceable

Give each budget a reason. Check files before loading them, and track where your context comes from at runtime.

Write a prompt file

Use the .htmlp extension. Set max-tokens and a brief reason. Write Markdown inside sections.

<htmlp max-tokens="2k" reason="Loaded on every request.">
<section id="workflow" max-tokens="500" reason="Keep routine steps short.">
Read the code. Make one change. Run its tests.
</section>
</htmlp>

Sign and check

cargo install --git https://github.com/alexmckenley/htmlp --tag v0.2.0-alpha.4 --features cli
htmlp sign ./prompts
htmlp check ./prompts

2k means 2,000 tokens. The checker reports invalid markup, missing reasons, changed budget signatures, and exceeded limits. Each file is independent; no repository configuration is needed.

Signing records each limit and its reason in a short sig. Re-sign intentional budget changes; content edits need only a check.

Build typed prompts in Rust

Use the runtime feature with or without prompt files. Each fragment has an explicit source and role; request estimates stay separate from provider-reported usage.

use htmlp::runtime::{ContentSource, ModelRequest, PromptFragment, Role};

let request = ModelRequest::builder("my-model")
    .fragment(PromptFragment::text(
        ContentSource::SystemPrompt, Role::System, "Review the change.",
    ))
    .build();
let estimate = request.estimate();

Use the Rust interface →

Read the documentation →