Skip to content

Instantly share code, notes, and snippets.

View jordangarcia's full-sized avatar

Jordan Garcia jordangarcia

View GitHub Profile

Local Agent Control Plane: unify main-app and agent/ web-ui session management

Context

Two UIs drive the same agent runtime today, through incompatible control planes:

  • The main app (packages/client src/pages/agents.tsxAgentSession.tsx) creates sessions via POST /harness-sessions on packages/server, which provisions one sandbox (one agent-server process) per session and exposes its data plane only through a cookie-authenticated proxy.
  • The diagnostic web-ui (agent/packages/web-ui-react) talks directly to a single long-lived agent-server on :4001/:4000 and shows many sessions inside that one process.

The data plane is already shared — both UIs use the same agent-client package and wire protocol against the same agent-server HTTP/SSE API. The incompatibility is purely control-plane: who creates sandboxes, who knows where they live, who is allowed to see them.

Coding Style Guide for Al

Core Programming Philosophy

Functional Programming Preference

  • Strong preference for functional programming patterns
  • Use map, filter, reduce extensively rather than imperative loops
  • Favor immutable data transformations over mutation
  • Create pure functions where possible
@jordangarcia
jordangarcia / import-service-cpu-investigation.md
Created May 11, 2026 20:01
Import service CPU spike investigation (May 9, 2026)

Import Service CPU Spike Investigation (May 9, 2026)

Summary

On May 9, import-prod avg request duration jumped from ~10s to 3,240s (54 minutes), autoscaling kicked in from 2 to 7 tasks, and 500 errors spiked 20x. No code was deployed to the import service. The root cause was a Transloadit outage that exposed the fact that the import service has no enforceable request-level timeout anywhere in the stack.

Agentic import was ruled out — its CPU was ~0.5%, and import-prod request volume was flat across the incident window.

Timeline (May 9 UTC)

@jordangarcia
jordangarcia / README.md
Created April 23, 2026 16:26
Claude Code skill: Graphite stacked PRs workflow

Graphite Stacked PRs Skill for Claude Code

A Claude Code skill that teaches Claude the Graphite CLI workflow for stacked PRs.

Package Structure

~/.claude/skills/graphite/
├── SKILL.md                          # Main skill definition + trigger config
└── references/
@jordangarcia
jordangarcia / slow-ramp-gap-analysis.md
Created April 22, 2026 17:55
Why the slow ramp didn't catch the flux-2-klein outage

Why the slow ramp didn't catch the flux-2-klein outage

The problem

On 2026-04-21, Black Forest Labs' API endpoint api.bfl.ai/v1/flux-2-klein-9b-private started returning 404 Not Found on every request. This has been going on for 24+ hours. Every image generation request that targets flux-2-klein fails immediately (~49ms), the ImageModelFallback catches the error, and the system falls back to flux-1-quick or qwen-image-fast.

The fallback chain is working, so users still get images. But we're making ~300-500 wasted API calls per hour (spiking to 18k+ during peak) to an endpoint that's been dead for over a day. No automated system detected or responded to this.

What we wanted slow ramp to do

@jordangarcia
jordangarcia / pr-18856-review.md
Created April 22, 2026 16:42
PR #18856 review notes: Buddy-E Redux→BuddyAgent migration

PR #18856 Review Notes

Follow-up items

1. saveFn as constructor param

BuddyAgent takes a saveFn callback and wires debounce + flush-chaining inside its constructor:

// BuddyAgent.ts:91,103-121

Unprocessed Card HTML Emitter

What changed

Added a typed EventEmitter to the deck generation pipeline so we can tap into raw card HTML before post-processing (layout formatting, image injection, etc.).

New file: packages/server/src/common/event-emitter.ts

Generic, typesafe EventEmitter<EventPayloads> class. Supports:

  • Typed on/off/emit keyed by an event map
@jordangarcia
jordangarcia / interview-laptop-provisioning.md
Created April 15, 2026 17:47
Interview Laptop Provisioning Plan — Kandji + Git + SOPS

Interview Laptop Provisioning

Problem

Laptops are unreliable for interviews — passwords missing, software not installed, candidate artifacts visible from previous interviews, no clear ownership, interviewers scrambling to use personal machines.

Architecture

Split responsibility between Kandji (IT-managed, slow-changing) and a git repo (eng-managed, fast-changing).

@jordangarcia
jordangarcia / greview
Created April 15, 2026 05:34
greview - PR code review in worktrees with Claude
#!/usr/bin/env bun
const USAGE = `greview - PR code review in worktrees with Claude
Usage:
greview <github-url|graphite-url|pr-number>
Examples:
greview https://github.com/gamma-app/gamma/pull/4521
greview https://app.graphite.com/github/pr/gamma-app/gamma/4521

PR #19026 — Suggested simplification

The polymorphism win (no any casts, cleaner component API) can be achieved without the abstract class hierarchy. Here's the alternative.

Types — plain objects, no classes

Keep the original discriminated union types unchanged:

type BaseQuestion = {