Minimal CLI Agent in C A developer has created a minimal CLI agent in C that can perform tasks similar to Claude Code, using only 2MB of RAM and negligible CPU usage. The single-file program, named cgent, relies solely on libcurl and the OpenAI Responses API, supporting raw terminal mode for pasting, backspace, and multiline prompts. The developer wrote the code without AI assistance to maintain C skills, acknowledging potential memory safety bugs. | // 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