Why autonomous coding agents need verifiable telemetry, how I engineered thermal receipt diff generation, and the architecture of the Qodewk terminal control panel.
In late 2024, my daily engineering routine underwent an irreversible phase shift. Like thousands of software engineers, I stopped writing repetitive boilerplate line by line. Instead, I began pairing with autonomous coding agents: Google Antigravity, Claude Code, Cursor Composer, and Copilot CLI.
Suddenly, a multi-stage feature that once required three days of focused keyboard time was being synthesized in forty seconds. Agents were reading whole repositories, fanning out across multiple files, executing builds in subshells, fixing errors, and staging git hunks before I could finish my sip of coffee.
Yet, as velocity soared by an order of magnitude, something fundamental broke. The software development lifecycle had gained superhuman throughput, but its auditability collapsed into an impenetrable black box.
This is the story of why I built Qodewk—an open-source proof-of-shipment receipt engine and terminal telemetry harvester engineered to bring provenance, determinism, and physical-grade accountability to agent-driven codebases.
+-----------------------------------------------------------------------+
| THE AGENT VELOCITY GAP |
| |
| Velocity =========================================> [ 10x Speed ] |
| |
| Audit =====> [ Raw Unified Diff Only ] |
| (Lost: model ID, token spend, prompts, safety footprints) |
+-----------------------------------------------------------------------+
The blind spot of the AI coding boom
When human developers write code, git commits capture more than just textual diffs; they capture intent, mental models, and accountability through granular commit histories, authored identity, and peer reviews.
In the AI agent era, this chain of custody evaporates. Consider what happens when an autonomous agent operates across your repository:
- Massive atomic mutations: An agent modifies 24 files in a single turn. Functions are refactored, dependencies updated, and configurations rewired.
- Attribution ambiguity: Did a human architect the schema migration while the agent filled in the controllers, or did an unvetted background subagent rewrite core security guards?
- Ghost telemetry: How many prompt and completion tokens were burned? Which model temperature or reasoning effort was used? What was the latency overhead?
- Credential and environment leaks: Agents running in local terminal shells inspect environment files, temporary logs, and local paths (
/Users/...orC:\Users\...), occasionally embedding sensitive artifacts directly into code comments or diff contexts.
A standard git diff HEAD~1 yields unified patch chunks, but it strips away all agentic provenance. It cannot tell you whether a diff chunk was generated by Claude 3.7 Sonnet, Gemini 2.5 Pro, an internal fine-tune, or human keystrokes.
We had built supersonic jet engines for code synthesis, but we were flying without flight recorders.
Defining "proof of shipment"
To restore trust without throttling agent velocity, we need a deterministic artifact generated at the moment of completion: proof of shipment.
In physical logistics, when a cargo freighter delivers high-value goods, the manifest isn't merely an informal note; it is an itemized, cryptographically sealed bill of lading specifying dimensions, tare weight, provenance seals, and timestamps.
In Qodewk, a proof of shipment establishes three non-negotiable invariants:
+-----------------------------------------------------------------------+
| PROOF OF SHIPMENT INVARIANTS |
+-----------------------------------------------------------------------+
| 1. Cryptographic Provenance |
| Deterministic SHA-256 signatures tying tree state to agent model, |
| session metadata, and author identity. |
| |
| 2. Telemetry Footprint |
| Granular audit of input/output token counts, execution duration, |
| tool call invocations, and compute cost approximations. |
| |
| 3. Deterministic Verification |
| Any team member, CI runner, or external reviewer can reproduce and |
| verify the exact receipt checksum from the raw git tree. |
+-----------------------------------------------------------------------+
I wanted this proof to feel tangible. Not an obscure JSON log buried inside .git/ or a proprietary web dashboard behind a corporate login, but something immediate, tactile, and unmistakable.
That desire led to the core visual metaphor of Qodewk: the thermal digital receipt.
Engineering the thermal receipt
Why a thermal receipt?
Physical retail receipts—specifically the high-contrast, monospace slips produced by thermal printers in Tokyo convenience stores—are masterpieces of constrained information architecture. They pack itemized listings, sub-totals, tax breakdowns, timestamps, and merchant barcodes into a disciplined 48-column strip.
Translating this aesthetic to modern terminal emulators and Markdown documents solved multiple technical requirements simultaneously:
- Monospace universality: Guaranteed pixel-perfect alignment across raw ANSI terminal outputs, GitHub markdown diff comments, Discord channels, and CI/CD job logs.
- Cognitive ergonomics: A developer's eyes immediately understand top-to-bottom itemization: header, file manifests, telemetry totals, and cryptographic footer seals.
- Zero heavy asset dependencies: Rendered entirely with UTF-8 box-drawing glyphs (
┌,─,┐,│,└,┘,├,┤) without requiring canvas libraries, Puppeteer screenshots, or external image hosts.
Monospace anatomy of a Qodewk receipt
Below is a live representation of a terminal receipt produced by Qodewk after an autonomous agent refactors an API client:
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Q O D E W K T E L E M E T R Y R E C E I P T
PROOF OF SHIPMENT // AUTONOMOUS AGENT RUN
----------------------------------------------------------------
TIMESTAMP : 2025-02-20T14:22:08.412Z
PROJECT : qodewk-engine / core
BRANCH : feat/stream-virtualizer
AUTHOR : Abu Shaid (@abushaidislam)
AGENT ID : antigravity-v2.4-pro (autonomous)
----------------------------------------------------------------
FILES MUTATED LINES CHUNKS
----------------------------------------------------------------
src/engine/diff-stream.ts +84/-12 3
src/engine/virtualizer.ts +142/-4 5
src/tui/components/receipt-view.tsx +65/-19 2
tests/diff-parser.test.ts +91/-0 4
----------------------------------------------------------------
DIFF SUMMARY:
+382 additions -35 deletions 4 files changed 14 hunks
----------------------------------------------------------------
AGENT TELEMETRY METRICS:
Prompt Tokens : 24,180 tokens
Completion Tokens : 3,842 tokens
Total Token Spend : 28,022 tokens ($0.082 USD est.)
Wall Clock Time : 14.82 seconds
Tool Invocations : 6 (fs.read, ast.parse, test.run)
----------------------------------------------------------------
CANONICAL PROVENANCE SEAL:
TREE SHA : d9a41e976b2c89f53c829e0134a6efb189cc5241
RECEIPT : e8b9c40217dd95cfa3198811f0a8c26bbef61453...
STATUS : VERIFIED // DETERMINISTIC PASS
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/The diff engine and AST chunking
Generating this receipt requires analyzing git changes at the hunk level rather than simply running git diff --stat.
In packages/core/src/engine/diff-parser.ts, Qodewk implements a streaming diff tokenizer that parses unified diff streams into strongly typed AST nodes:
export interface DiffHunk {
oldStart: number
oldLines: number
newStart: number
newLines: number
heading: string
lines: string[]
additions: number
deletions: number
}
export interface FileDiffSummary {
filePath: string
oldPath?: string
isNew: boolean
isDeleted: boolean
isRenamed: boolean
hunks: DiffHunk[]
totalAdditions: number
totalDeletions: number
}
export interface AgentRunTelemetry {
agentName: string
modelIdentifier: string
promptTokens: number
completionTokens: number
durationMs: number
toolCallsCount: number
}The tokenizer splits raw diff output by regex boundaries while maintaining line buffers to prevent memory spikes when inspecting multi-megabyte diffs:
import { createReadStream } from "node:fs"
import { createInterface } from "node:readline"
export class StreamingDiffParser {
private static readonly HUNK_HEADER_REGEX =
/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/
public static parseUnifiedDiff(rawDiff: string): FileDiffSummary[] {
const lines = rawDiff.split("\n")
const summaries: FileDiffSummary[] = []
let currentFile: FileDiffSummary | null = null
let currentHunk: DiffHunk | null = null
for (let i = 0; i < lines.length; i++) {
const line = lines[i]
if (line.startsWith("diff --git")) {
if (currentFile) {
if (currentHunk) currentFile.hunks.push(currentHunk)
summaries.push(currentFile)
}
currentHunk = null
currentFile = {
filePath: "",
isNew: false,
isDeleted: false,
isRenamed: false,
hunks: [],
totalAdditions: 0,
totalDeletions: 0,
}
} else if (line.startsWith("+++ b/")) {
if (currentFile) currentFile.filePath = line.substring(6)
} else if (line.startsWith("--- a/")) {
if (currentFile) currentFile.oldPath = line.substring(6)
} else if (line.startsWith("@@ ")) {
if (currentFile && currentHunk) {
currentFile.hunks.push(currentHunk)
}
const match = line.match(this.HUNK_HEADER_REGEX)
if (match && currentFile) {
currentHunk = {
oldStart: parseInt(match[1], 10),
oldLines: match[2] ? parseInt(match[2], 10) : 1,
newStart: parseInt(match[3], 10),
newLines: match[4] ? parseInt(match[4], 10) : 1,
heading: match[5]?.trim() ?? "",
lines: [],
additions: 0,
deletions: 0,
}
}
} else if (currentHunk && currentFile) {
if (line.startsWith("+") && !line.startsWith("+++")) {
currentHunk.additions++
currentFile.totalAdditions++
currentHunk.lines.push(line)
} else if (line.startsWith("-") && !line.startsWith("---")) {
currentHunk.deletions++
currentFile.totalDeletions++
currentHunk.lines.push(line)
} else if (line.startsWith(" ")) {
currentHunk.lines.push(line)
}
}
}
if (currentFile) {
if (currentHunk) currentFile.hunks.push(currentHunk)
summaries.push(currentFile)
}
return summaries
}
}Deterministic SHA verification
A telemetry receipt is only as reliable as its immutability. If a developer or automated script could tweak the token numbers or file metrics after the fact, the receipt would lose all authority.
To guarantee tamper resistance, Qodewk computes a canonical receipt checksum using standard SHA-256 over a normalized payload:
import { createHash } from "node:crypto"
export interface ReceiptPayload {
version: "1.0"
timestamp: string
gitTreeSha: string
parentCommit: string
files: Array<{
path: string
additions: number
deletions: number
hunkCount: number
}>
telemetry: AgentRunTelemetry
}
export function computeDeterministicReceiptHash(
payload: ReceiptPayload
): string {
// Sort files lexicographically by normalized POSIX path
const normalizedFiles = [...payload.files].sort((a, b) =>
a.path.localeCompare(b.path)
)
const canonicalBuffer = JSON.stringify({
version: payload.version,
timestamp: payload.timestamp,
gitTreeSha: payload.gitTreeSha,
parentCommit: payload.parentCommit,
files: normalizedFiles,
telemetry: {
agentName: payload.telemetry.agentName,
modelIdentifier: payload.telemetry.modelIdentifier,
promptTokens: payload.telemetry.promptTokens,
completionTokens: payload.telemetry.completionTokens,
durationMs: payload.telemetry.durationMs,
toolCallsCount: payload.telemetry.toolCallsCount,
},
})
return createHash("sha256").update(canonicalBuffer, "utf8").digest("hex")
}Because file paths are normalized and key ordering is deterministic, any CI check or downstream reviewer running qodewk verify on the commit tree recalculates the identical hash to confirm zero post-hoc tampering.
The terminal control panel (TUI)
While the receipt is the static artifact, developers need an interactive environment during active agent sessions to triage pending diffs, inspect hunk telemetry, and toggle verification flags.
I engineered the Qodewk terminal control panel using Node.js, TypeScript, and Ink (React for CLI environments).
+--------------------------------------------------------------------------+
| QODEWK TERMINAL CONTROL PANEL ARCHITECTURE |
+--------------------------------------------------------------------------+
| |
| [ Git Subprocess Engine ] [ Multi-Agent Harvester ] |
| (Streaming stdout buffers) (Anthropic / OpenAI / Gemini) |
| | | |
| v v |
| +--------------------------------------------------------------+ |
| | Diff & Telemetry Event Bus | |
| +--------------------------------------------------------------+ |
| | |
| v |
| +--------------------------------------------------------------+ |
| | Terminal State Machine (Vim-Mode Key Dispatch) | |
| +--------------------------------------------------------------+ |
| | |
| v |
| +--------------------------------------------------------------+ |
| | Zero-Tearing Double-Buffered Virtualizer | |
| +--------------------------------------------------------------+ |
| | |
| v |
| [ ANSI Monospace Display ] |
| |
+--------------------------------------------------------------------------+
Eliminating terminal lag and frame tearing
Building rich TUIs in Node.js reveals an immediate pitfall: standard terminal re-renders flush escape codes synchronously to process.stdout. When streaming large git diffs or handling high-frequency keyboard navigation, naive React state updates cause noticeable terminal flicker and dropped frames.
To achieve fluid, zero-lag performance, Qodewk employs three architectural constraints:
- Decoupled subprocess streams: Git operations (
git diff,git log) run in background worker threads using child process streams with bounded chunk sizes (64KB), keeping the main Node.js event loop completely responsive to key inputs. - Viewport virtualization: Instead of rendering 2,000 lines of parsed diff into terminal DOM nodes, the TUI measures current terminal rows (
process.stdout.rows) and slices only the visible window plus an overscan buffer of four lines. - Raw mode keyboard state machine: Keypresses bypass default line-buffering through
process.stdin.setRawMode(true), dispatched directly through a low-latency finite state machine supporting natural vim bindings (j,k,g,G,Enter,Esc).
Here is the core keyboard controller that drives the control panel without triggering redundant reconciliations:
import { useEffect, useReducer } from "react"
import { useInput } from "ink"
interface NavigationState {
selectedIndex: number
viewportOffset: number
activeTab: "overview" | "diffs" | "telemetry" | "receipt"
isExpanded: boolean
}
type NavigationAction =
| { type: "MOVE_UP"; maxItems: number; viewportHeight: number }
| { type: "MOVE_DOWN"; maxItems: number; viewportHeight: number }
| { type: "SET_TAB"; tab: NavigationState["activeTab"] }
| { type: "TOGGLE_EXPAND" }
function navigationReducer(
state: NavigationState,
action: NavigationAction
): NavigationState {
switch (action.type) {
case "MOVE_DOWN": {
if (state.selectedIndex >= action.maxItems - 1) return state
const nextIndex = state.selectedIndex + 1
const isPastBottom =
nextIndex >= state.viewportOffset + action.viewportHeight
return {
...state,
selectedIndex: nextIndex,
viewportOffset: isPastBottom
? state.viewportOffset + 1
: state.viewportOffset,
}
}
case "MOVE_UP": {
if (state.selectedIndex <= 0) return state
const prevIndex = state.selectedIndex - 1
const isPastTop = prevIndex < state.viewportOffset
return {
...state,
selectedIndex: prevIndex,
viewportOffset: isPastTop
? state.viewportOffset - 1
: state.viewportOffset,
}
}
case "SET_TAB":
return {
...state,
activeTab: action.tab,
selectedIndex: 0,
viewportOffset: 0,
}
case "TOGGLE_EXPAND":
return { ...state, isExpanded: !state.isExpanded }
default:
return state
}
}
export function useTerminalNavigator(
itemCount: number,
viewportHeight: number
) {
const [state, dispatch] = useReducer(navigationReducer, {
selectedIndex: 0,
viewportOffset: 0,
activeTab: "overview",
isExpanded: false,
})
useInput((input, key) => {
if (input === "j" || key.downArrow) {
dispatch({ type: "MOVE_DOWN", maxItems: itemCount, viewportHeight })
} else if (input === "k" || key.upArrow) {
dispatch({ type: "MOVE_UP", maxItems: itemCount, viewportHeight })
} else if (input === "1") {
dispatch({ type: "SET_TAB", tab: "overview" })
} else if (input === "2") {
dispatch({ type: "SET_TAB", tab: "diffs" })
} else if (input === "3") {
dispatch({ type: "SET_TAB", tab: "telemetry" })
} else if (input === "4") {
dispatch({ type: "SET_TAB", tab: "receipt" })
} else if (key.return) {
dispatch({ type: "TOGGLE_EXPAND" })
}
})
return state
}Privacy-safe multi-agent footprint extraction
One of the most dangerous side effects of autonomous coding agents is accidental disclosure.
Agents routinely inspect local configs, .env files, shell histories, and system diagnostics to understand how to build and test your project. In doing so, agent trace logs and tool telemetry frequently capture:
- API tokens (
sk-ant-...,ghp_...,Bearer ey...) - Absolute system paths containing developer usernames (
/Users/syed/projects/...) - Internal staging URLs, VPN hostnames, and IP addresses
- Database connection strings embedded in error stack traces
If a receipt engine publishes raw telemetry to pull request comments or commits it into git history, it turns a productivity feature into a massive security vulnerability.
The redaction pipeline
Qodewk integrates an aggressive, multi-stage redaction pipeline that scrubs all telemetry payloads before they are formatted into receipts or written to disk:
+--------------------------------------------------------------------------+
| PRIVACY REDACTION PIPELINE |
+--------------------------------------------------------------------------+
| |
| Raw Telemetry Stream (Logs, Hunk Metadata, Agent Invocations) |
| | |
| v |
| [ Stage 1: Absolute Path Normalization ] |
| - Strip /Users/<user>/... or C:\Users\<user>\... |
| - Re-map to POSIX-relative workspace paths (./src/...) |
| | |
| v |
| [ Stage 2: Pattern-Based Secret Redactor ] |
| - Match OpenAI, Anthropic, GitHub, AWS, Stripe tokens via regex |
| - Replace with constant-length SHA digests [REDACTED:sha256(secret)] |
| | |
| v |
| [ Stage 3: Shannon Entropy Scanner ] |
| - Flag any hexadecimal/base64 strings with entropy > 4.5 |
| | |
| v |
| Clean, Auditable Telemetry Payload Ready for Receipt Sealing |
| |
+--------------------------------------------------------------------------+
Here is the implementation of the TelemetrySanitizer in packages/core/src/security/sanitizer.ts:
import { createHash } from "node:crypto"
export class TelemetrySanitizer {
private static readonly SENSITIVE_PATTERNS: Array<{
name: string
pattern: RegExp
}> = [
{ name: "OPENAI_KEY", pattern: /sk-[a-zA-Z0-9]{32,64}/g },
{ name: "ANTHROPIC_KEY", pattern: /sk-ant-[a-zA-Z0-9\-_]{32,128}/g },
{ name: "GITHUB_TOKEN", pattern: /gh[pousr]_[a-zA-Z0-9]{36,255}/g },
{ name: "GENERIC_BEARER", pattern: /Bearer\s+([a-zA-Z0-9_\-\.]{20,})/gi },
{ name: "POSTGRES_URI", pattern: /postgres:\/\/[^:]+:[^@]+@[^\/]+\/\w+/gi },
]
private workspaceRoot: string
constructor(workspaceRoot: string) {
this.workspaceRoot = workspaceRoot.replace(/\\/g, "/")
}
public sanitizePaths(text: string): string {
const normalizedRoot = this.workspaceRoot
const escapedRoot = normalizedRoot.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
const rootRegex = new RegExp(escapedRoot, "g")
// Also scrub generic OS user path prefixes
const unixUserRegex = /\/(?:home|Users)\/[a-zA-Z0-9_\-\.]+\//g
const winUserRegex = /[a-zA-Z]:\\Users\\[a-zA-Z0-9_\-\.]+\\/g
return text
.replace(rootRegex, ".")
.replace(unixUserRegex, "/workspace/")
.replace(winUserRegex, "workspace/")
}
public redactSecrets(input: string): string {
let sanitized = input
for (const { name, pattern } of TelemetrySanitizer.SENSITIVE_PATTERNS) {
sanitized = sanitized.replace(pattern, (matched) => {
const maskedDigest = createHash("sha256")
.update(matched)
.digest("hex")
.substring(0, 8)
return `[REDACTED:${name}:${maskedDigest}]`
})
}
return sanitized
}
public processTelemetry<T extends Record<string, unknown>>(data: T): T {
const serialized = JSON.stringify(data)
const scrubbedPaths = this.sanitizePaths(serialized)
const scrubbedSecrets = this.redactSecrets(scrubbedPaths)
return JSON.parse(scrubbedSecrets) as T
}
}Notice the masking strategy: instead of replacing sensitive secrets with a generic ***, Qodewk hashes the secret and outputs [REDACTED:OPENAI_KEY:a1b2c3d4].
This allows team leads and security auditors to verify whether two separate occurrences of a redacted key were identical credentials or distinct tokens—without exposing the plaintext token value.
Lessons learned and what's next
Building Qodewk while relying heavily on autonomous coding agents taught me a profound lesson about the future of our craft:
Agents do not make craftsmanship obsolete; they heighten the necessity of precision.
When you can generate an entire microservice in two minutes, the bottleneck of software engineering moves completely from typing speed to verification rigor. The developers who thrive in this era won't be those who generate the most code—they will be the engineers who establish the most airtight verification loops, deterministic proofs, and diagnostic clarity.
What is next on the roadmap
Qodewk is actively evolving in several directions:
- GitHub Actions & Praxd integration: Automatically generating and posting verified thermal receipts to pull requests, pairing directly with Praxd, my split diff PR review workspace.
- Multi-agent attribution consensus: Dissecting collaborative hunks where a human developer, Claude Code, and Antigravity iterate on the same file, assigning line-level attribution percentages.
- Local-first receipt registry: An SQLite-backed local cache that indexes all past agent runs, letting you search your repository's history by token burn, latency, or model version.
If you are shipping code with AI agents and want deterministic proof of what your machines are building, explore the repository on GitHub:
- Source Code: github.com/abushaidislam/qodewk
- Author: Abu Shaid (@abushaidislam)
- Related Project: Praxd — Focused GitHub PR Workspace
Velocity without telemetry is just high-speed chaos. Let's build with receipts.