01
AI Code Rescue
Your AI-built app is fragile, insecure, or impossible to extend. We audit it, find the root causes, and turn it into software your team can own.
Schedule an Audit
// Threadbull Engineering
AI can write code. We make it work. Threadbull audits, refactors, and hardens AI-generated codebases — and builds deterministic AI workflows with tight schemas, explicit state, and predictable execution.
~40 yrs engineering · 30+ shipped games · custom 3D engines · C++ / systems / agents
// Symptoms
These aren't prompt problems. They're engineering problems.
01
Your AI-built app is fragile, insecure, or impossible to extend. We audit it, find the root causes, and turn it into software your team can own.
Schedule an Audit
02
Your agents and pipelines work sometimes. We make them work every time: strict schemas, state machines, validation, and safeguards.
Discuss Your AI Project
03
Your team uses coding agents. We give them guardrails: quality gates, automated verification, context management, and workflows that ship.
Fix Your AI Development Workflow
// How we think
Most AI shops add more AI to fix AI. Threadbull adds engineering: tight schemas, explicit state machines, validation at every boundary, tests, and the minimum agent surface area needed to do the job.
01
If a step can be code, it's code. Models handle judgment, not plumbing.
02
Every model output is parsed against a schema before it touches your data. Invalid output fails loudly, not silently.
03
Fewer agents, fewer tools, tighter permissions. Complexity is a cost, not a feature.
04
Tests, docs, and a handoff your team (or your next AI tool) can actually work from.
// The difference
# Agent decides what to do and writes straight to the DB
def process_ticket(ticket):
while True:
resp = llm.chat(f"Handle this support ticket and return JSON: {ticket}")
try:
data = json.loads(resp[resp.find("{"):resp.rfind("}") + 1])
except Exception:
continue # just ask again...forever
if data.get("action") == "refund":
db.execute(f"UPDATE orders SET refunded=1 WHERE id={data['order_id']}")
if data.get("done"):
breakfrom enum import Enum
from pydantic import BaseModel, Field, ValidationError
class Action(str, Enum):
REPLY = "reply"
ESCALATE = "escalate"
REQUEST_REFUND = "request_refund" # proposes; never executes
class TicketDecision(BaseModel):
action: Action
order_id: int | None = Field(default=None, gt=0)
reply_text: str = Field(max_length=2000)
confidence: float = Field(ge=0, le=1)
MAX_ATTEMPTS = 2
def classify_ticket(ticket: Ticket) -> TicketDecision:
for attempt in range(MAX_ATTEMPTS):
raw = llm.structured(TICKET_PROMPT, ticket.text, schema=TicketDecision)
try:
return TicketDecision.model_validate_json(raw)
except ValidationError as err:
log.warning("invalid_llm_output", attempt=attempt, error=str(err))
return TicketDecision(action=Action.ESCALATE, reply_text="", confidence=0.0)
def process_ticket(ticket: Ticket) -> None:
decision = classify_ticket(ticket)
audit.record(ticket.id, decision) # every decision is logged
if decision.action is Action.REQUEST_REFUND:
refunds.queue_for_review(ticket.id, decision.order_id) # human-in-the-loop
elif decision.action is Action.REPLY and decision.confidence >= 0.8:
replies.send(ticket.id, decision.reply_text)
else:
escalations.open(ticket.id, decision)// Start here
A fixed-scope, fixed-price review of your codebase or AI pipeline. You get a written report and a walkthrough call. You'll know exactly what's wrong, what it's costing you, and what to fix first — whether or not you hire us for the fix.
Fixed price: $2,000 — founding-client rate (list $3,500). Credited toward any follow-on engagement.
Not ready for a full audit? Start with a 90-minute Code Triage for $399.
Threadbull is led by Dan Duncalf, a software engineer with nearly 40 years of experience. He co-founded Pipeworks Software in 1999, shipped more than 30 commercial video games, and built multiple proprietary 3D engines — work where performance, memory, and reliability are not optional. Today he applies that same discipline to AI systems and the code AI writes.
// Work
Real-time computer vision, agent orchestration, and performance engineering.
See the work
// Products
In betabstats: live youth basketball scoring, crowd-sourced from the stands.
See what's in the lab