Skip to content

Instantly share code, notes, and snippets.

View fourlexboehm's full-sized avatar

Alex Boehm fourlexboehm

  • Adelaide, Australia
View GitHub Profile
@fourlexboehm
fourlexboehm / gist:a60e4ef9306744483731cd176bd02e9f
Last active September 1, 2026 04:33
Minimal CLI Agent in C
// This is an entire CLI agent, it can do everything Claude code can do, using raw mode to support pasting, backspace,
// escape to cancel agents turn, and multiline prompts with Shift + enter,
// but with 2MB of RAM, neglibible CPU usage and one small C file.
// It is a single C file for the openai responses api, with no dependency other than libcurl, and an
// OPENAI_API_KEY env var.
// compile with `cc -lcurl -o cgent this_file.c` then install where you please.
// AI USAGE - This code was written without AI agents, largely to maintain my c skills, as such it is likely to have
// memory safety bugs.
#include <ctype.h>