Solo-C: a tiny coding agent in a single C file

main.c is the whole agent: a readline REPL that talks to any OpenAI-compatible
/chat/completions endpoint and exposes exactly one tool, bash(command). Commands
run through the user's shell with stdout and stderr merged, a hard timeout, and
a process-group kill; the output and an exit marker go back to the model until
it answers without calling a tool.

make static-deps builds curl and c-ares from source into static-deps/, so
`make static` can link a fully static binary on distros that get in the way: the
distro libcurl.a drags in libpsl, brotli, zstd and nghttp2, whose static objects
are GCC 14 LTO bytecode a newer linker cannot read, and a minimal system often
ships no libcares.a at all.

Two details worth keeping in mind when editing mkstaticdeps.sh. curl 8.22 takes
--enable-ares=PREFIX rather than the older --with-cares, and it only warns
about options it does not recognise, so the wrong spelling turns off async DNS
in silence instead of failing. And link order is load-bearing: libcares.a has
to come after libcurl.a or ares_* stays undefined.
This commit is contained in:
Luxferre
2026-10-03 09:15:02 +03:00
commit 494bee8b77
5 changed files with 1102 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
# Build artifacts.
# Both names are produced by the Makefile targets `solo` and `static`.
# Anchor on the root so a directory called solo is still tracked.
/solo
/solo-static
*.o
*.a
*.so
*.so.*
# Prebuilt libcurl.a for `make static`, regenerated by `make static-deps`
# (see mkstaticdeps.sh). Large, and tied to the machine that built it.
/static-deps/
/curl-*/
# Per-directory session state: the live model parameters, the tool schema and
# the full conversation transcript, which can contain secrets. Runtime data, so
# it must never be committed.
.solo_sess.json
*.solo_sess.json
# Readline history, in case HOME or XDG is pointed here in some setups.
.solo_history
.history
# Scratch space the agent is told to use.
/solo-tmp/
/tmp/
# Editor and tooling droppings.
*~
*.bak
*.orig
*.rej
*.swp
*.swo
.*.sw?
.\#*
\#*\#
# Vim.
.vim/
*.vim
*.swo
# Emacs.
*.elc
*.symc
.\#*
\#*\#
# Compiled binaries and debug output from ad-hoc experiments.
/core
/core.*
vgcore.*
a.out
gdb.core
# Coverage and profiling, if instrumentation is ever added.
*.gcda
*.gcno
*.gcov
*.profraw
*.profdata
# OS cruft.
.DS_Store
Thumbs.db
desktop.ini
# Secrets and local overrides. Commit a .env.example instead.
.env
.env.local
SOLO_API_KEY
SOLO_SYSPROMPT.local