Skip to main content

Published September 14, 2026

7 New Kujo Helpers for Safer AI-Assisted Development

Interconnected systems with a checkmark.

A few weeks ago I wrote about seven ways Kujo improves AI-assisted development.

Since then, the runtime has kept moving.

The first list covered things like deterministic AI calls, request hashing, structured output validation, token budgeting, capabilities, the toolchain and Kujo's VM-first runtime.

So I'm not going to repeat those here.

These are seven newer, lower-level helpers that matter once your AI agents start doing more than simply generate code.

When they start reading files, crawling sites, processing data, downloading artifacts and writing results back to disk.

That is where the plumbing underneath becomes especially important.

1. Exact byte measurement with byte_length()

len() and byte size are not the same thing.

That matters when an agent is feeding data into an API, writing an artifact, processing binary data or staying under a hard input limit.

Kujo now has:

byte_length(value)

For strings, it returns the actual UTF-8 byte size. For byte arrays, it returns their raw size directly.

So:

byte_length("é")

returns 2, even though the string contains one Unicode character.

It also does the measurement without allocating another copy of the data.

Small helper. Useful boundary.

An agent can check the actual payload size before it sends, stores or transforms it instead of guessing from character counts.

2. HTML can be turned into bounded data

Agents increasingly read the web.

That usually means pulling in a full DOM library, browser runtime or a pile of parsing code just to answer basic questions about a document.

Kujo added:

html_tokens(text, max_events)

It turns HTML into bounded tokenizer events for tags, attributes and text.

The important word is bounded.

You specify how much output the parser is allowed to produce.

Kujo also added:

url_normalize(...)

url_components(...)

so an agent can normalize links and inspect their scheme, host, port, origin, path and query without inventing its own URL parser.

For something like a research agent, crawler, documentation tool or site auditor, that gives you a surprisingly useful web-processing layer without immediately reaching for a browser.

3. Large agent artifacts don't have to become giant in-memory arrays

JSONL is a natural format for agent work.

One line can be a page.

A finding.

A tool result.

An evaluation.

A run record.

A source.

Kujo now has native helpers including:

jsonl_read_chunk(...)

jsonl_write(...)

jsonl_sort(...)

jsonl_wrap_array(...)

jsonl_read_chunk() can work through a file in bounded batches and return the next offset.

jsonl_sort() performs an external sort instead of requiring the entire dataset to live in memory.

jsonl_wrap_array() can stream validated records into a normal JSON document.

There are also bounded json_file_read() and json_file_write() helpers.

This is the kind of infrastructure that becomes important when an agent stops being a chatbot and starts producing thousands of pieces of evidence.

The runtime can work through them without pretending every job fits comfortably in RAM.

4. An agent can verify the artifact it actually produced

Kujo also added:

regular_file_digest(...)

That gives programs a native way to calculate the digest of a bounded regular file.

Pair that with:

create_temp_dir(...)

publish_directory_noreplace(...)

and there is a useful pattern available:

Build somewhere private.

Verify what was built.

Publish it only when the destination is clear.

Do not silently replace something that was already there.

That works for generated reports, indexes, builds, research results and other agent-produced artifacts.

The agent does not need to treat "I wrote the files" as proof that the operation completed correctly.

5. HTTP downloads can have rules before the first byte arrives

An autonomous agent fetching a URL should not mean:

download whatever this hostname eventually points at

Kujo's newer HTTP helpers support much tighter contracts.

For example:

http_destination_check(url)

can resolve and evaluate a destination before sending the HTTP request.

And:

http_get_file_response(...)

can stream a response directly into a new file with an explicit size limit.

The HTTP layer can combine controls such as:

pin_dns

destination_policy

redirects

max_bytes

Pinned or deny-private requests also disable ambient proxy discovery so a proxy cannot quietly resolve the hostname somewhere different from the destination Kujo already approved.

This is useful for any agent that downloads documentation, datasets, model artifacts, source archives or external evidence.

The network request gets a contract instead of blind trust.

6. Messy external text can be decoded without giving it unlimited room

Real-world data is not all clean UTF-8.

Agents eventually meet old feeds, exports, scraped documents and random files somebody created fifteen years ago.

Kujo added bounded text decoding helpers such as:

decode_text_lossy(bytes, charset, max_bytes)

and streaming XML processing through:

xml_file_select(...)

The XML helper is deliberately defensive.

It can select matching elements while streaming the document, enforce depth and output limits, bound compressed expansion and reject DTD/entity declarations instead of resolving external entities.

That makes the primitive useful for things like sitemaps, feeds and machine-generated XML without turning "parse this document" into "trust this document with the process."

AI systems consume a lot of outside information.

Parsing that information deserves boundaries too.

7. Agent output can be confined to an actual directory

This one is especially interesting.

Kujo has been adding descriptor/handle-relative filesystem operations so a program can work underneath a trusted directory rather than repeatedly trusting path strings.

The newer source API is:

write_file_atomic_beneath(

root,

relative_path,

content,

overwrite

)

It rejects absolute paths, . and .., intermediate symlinks and Windows reparse points.

The trusted root is opened first, and traversal happens relative to held directory handles.

The final file is written privately and then published atomically.

So an agent can be told:

write this report somewhere under this workspace

without the implementation simply concatenating strings and hoping the resulting path still points where you think it does.

There is an important release note here: write_file_atomic_beneath() is currently documented as an unreleased source API rather than something I would claim as part of an older stable binary.

But the direction matters.

AI-assisted development creates a new filesystem problem.

The thing deciding which file to create may no longer be a human typing the path.

The runtime needs to assume that path could be wrong.

Connected software components show how runtime safeguards fit together.

A lot of "AI-native" development still focuses on the model call.

Kujo already has that layer.

What I've been more interested in lately is everything that happens around it.

An agent needs to read untrusted input.

It needs to fetch things.

Parse things.

Move through large datasets.

Write artifacts.

Verify them.

Publish them.

And it needs to do all of that without every generated script rebuilding the same safety boundaries from scratch.

That's where a programming language built for AI-assisted development starts to feel different.

Not because it has an AI() function.

Because the boring work surrounding the AI was designed for it too.

Learn more at kujolang.ai 🦾

Originally published on X

Related Reading