Date: 2026-07-06
Tool name: humfmt
Humfmt should make Hum code look like Hum code everywhere.
A language built around readability cannot leave formatting as a community argument. The formatter should be first-party, stable, boring, and strict.
humfmt file.hum
humfmt examples
humfmt --check examples
nectar fmt
nectar fmt --check- One canonical style by default.
- Minimal configuration early.
- Preserve meaning exactly.
- Preserve comments and intent blocks.
- Make task headers, capability blocks, and
does:bodies easy to scan. - Keep beginner examples polished.
- Make diffs small and predictable.
Humfmt should not become a second language.
Humfmt should keep this shape:
task add_item(title: Text) -> Result Task, TaskError {
why:
let the user remember something to do
changes:
tasks
needs:
title is not empty
ensures:
new item is saved
new item is not done
does:
if title is empty {
fail TaskError.empty_title
}
save item in tasks
return item
}
Humfmt should prefer this task section order:
why:targets:uses:changes:creates:deletes:needs:assumes:ensures:keeps:protects:trusts:fails when:watch for:cost:allocates:avoids:tradeoffs:optimizes:tests:benchmarks:proves:does:
Early humfmt may warn about order before auto-reordering. Reordering prose-heavy blocks can surprise users, so automatic movement should wait until the parser can preserve all comments and trivia safely.
Use two spaces.
Reason:
- intent blocks are nested often
- examples stay compact
- code remains readable in docs
No tabs in formatted Hum source.
Humfmt should wrap long machine syntax before it wraps human prose.
Human prose inside blocks should be preserved unless it clearly exceeds a project line limit and can be wrapped without changing meaning.
Humfmt fixes layout.
Chirp critiques meaning and style.
Examples:
- humfmt aligns and spaces sections
- chirp warns that
why:is vague - humfmt formats
cost: - chirp warns that
cost:lackscheck:
Do not make the formatter a linter.
Humfmt should eventually use the lossless syntax tree, not ad hoc text rewriting.
Required before serious auto-formatting:
- tokens with spans
- comments/trivia preserved
- block sections preserved
- stable parse errors
- golden formatting tests
Humfmt should be so standard that people forget it exists.
If teams argue about Hum formatting, the formatter failed.