cd /news/developer-tools/parse-ai-coding-jsonl-safely-before-… · home topics developer-tools article
[ARTICLE · art-72572] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Parse AI Coding JSONL Safely Before You Infer Completion

Agent Island v1.7.1 implements defensive JSONL parsing for AI coding transcripts, using platform-specific safeguards such as a 64 MiB backstop on macOS and a 1,000,000-character line skip on Windows. The system employs provider-aware projections, semantic ordering, and deduplication to safely infer session state from live coding-agent data.

read2 min views1 publishedJul 24, 2026

JSONL is easy to underestimate. One object per line sounds like a format you can parse with a short loop. A live coding-agent transcript adds the cases that make that loop unsafe: a partial final append, an unusually large record, duplicate events, provider-specific envelopes, and old completion markers that later activity has invalidated.

Here is the defensive design we use before inferring session state.

Do not read an unbounded transcript into one string. Use a streaming reader and a documented line policy. Agent Island v1.7.1 currently uses different released safeguards on each platform: the macOS Claude reader has a 64 MiB backstop, while the Windows reader skips a line above 1,000,000 characters before parsing.

Those are not one shared limit. They are platform-specific policies with the same goal: one malformed or pathological record should not take down the rest of the scan.

Broad deserialization creates accidental dependencies on unrelated payloads. A monitor needs a smaller provider-aware projection.

For Claude, useful fields include type

, uuid

, timestamp

, message.stop_reason

, isSidechain

, isApiErrorMessage

, and toolEndsTurn

. For Codex, released readers inspect fields such as type

, payload.type

, payload.turn_id

, role

, timestamp

, completed_at

, and started_at

.

read bounded line
  -> parse JSON
  -> project provider-specific fields
  -> attach identity and semantic time
  -> reduce ordered events into state

A completion-shaped event belongs to one turn. A later user message or start event means the session moved on. The reducer must compare semantic order and allow later activity to supersede the older completion.

This is also why file modification time is not enough. One file can contain several turns, and the newest event may contradict an earlier stop marker.

A syntactically valid line can still be semantically wrong for a foreground alert.

Run provider-specific guards before the generic completion reducer.

Agent Island watches JSONL files for changes and keeps polling as a fallback. Event-driven observation reduces delay; polling recovers from a missed watcher notification. A partial line skipped now can be reconsidered after the next append.

Caching unchanged files by path, size, and modification time is useful, but the cache must invalidate when the source changes. Caching is an optimization, not permission to freeze an old state.

Safe JSONL parsing is bounded I/O plus provider-aware semantics, ordering, deduplication, and refresh behavior. The complete implementation notes and current scope are in the canonical guide.

── more in #developer-tools 4 stories · sorted by recency
── more on @agent island 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/parse-ai-coding-json…] indexed:0 read:2min 2026-07-24 ·