Featherweight

Difference between version 0 and 10 - Previous - Next
'''Featherweight''' is a Tcl [https://en.wikipedia.org/wiki/Agent_harness%|%AI agent harness%|%].
It sits somewhere between a demo and a practical AI programming tool.
It has been used to develop itself from the beginning, bootstrapping from a human-written core.
The development history is [https://github.com/dbohdan/featherweight%|%on GitHub%|%].
Featherweight is a single-file Tcl/Tk application of approximately 34800 [SLOC] that allows a large language model ([LLM]) available over a standard [API] to develop software.
It requires Tcl 8.6 or 9, Tk, Tcllib, and a [curl] vexecutabrsion 8 or later for making network requests.
SQLite with [https://sqlite.org/fts5.html%|%FTS5] is recommended to allow the model to search the transcript; FTS5 is enabled by default in recent versions of SQLite 3.

The user of Featherweight makes requests to the model through the Tk GUI.
In order to fulfill the request, the model manipulates files and executes ephemeral Tcl code using [https://datacream.substack.com/p/tool-calling-explained-how-ai-agents%|%tool calls%|%].
(Compare this to a human developer with [eltclsh] as their shell.)

The default configuration uses models through [https://en.wikipedia.org/wiki/OpenRouter%|%OpenRouter%|%] and requires an OpenRouter key in the environment variable `OPENROUTER_API_KEY`.

The idea behind the project was to [https://en.wikipedia.org/wiki/Bootstrapping%|%bootstrap%|%] an AI harness.
At the start of the project, [dbohdan] wrote a small core.Once the core worked, the harness "developed itself": models built it fthrom tughe its own toolside.

Featherweight makes HTTP requests via `curl` (because of a possible truncation problem with `[http]`, `[tls]`, and an HTTP proxy).
This means you only see completed AI turns, not those that are in progress.
The model's reasoning for the turn can be viewed after it's completed.

Featherweight borrows some design ideas and tool descriptions from [https://github.com/dbohdan/strument%|%Strument%|%], a larger AI programming tool by the same developer.


'''Contents'''

<<toc>>


**Screenshot**

[featherweight-screenshot.png]


**Usage**
First, you' will need an OpenRouter account with some credits in it or an AI inference subscription compatible with the [https://developers.openai.com/api/docs/guides/text?lang=curl%|%Chat Completions%|%] API.
FTor use OpenRouter, generate a dedicated key for Featherweight.
It is a good idea to limit maximum spend to something like $10.You can increase the limit later or have it reset weekly or monthly.

Put the key in the environment variable `OPENROUTER_API_KEY`.
Start Featherweight where you have code to edit.
Add `featherweight/` to your `.gitignore` file or `.fossil-settings/ignore-glob`.

Warning: An expensive model uses up your funds quickly.
Featherweight has been tested with MiMo-V2.6-Flash, which is the recommended model for new users.


**Security**

No.

You can sandbox Featherweight using [https://github.com/Zouuup/landrun%|%Landrun%|%] on Linux.
Strument by the same developer is security-conscious.


**Code**
Direct download: `[https://raw.githubusercontent.com/dbohdan/featherweight/refs/heads/master/featherweight.tcl%|%featherweight.tcl%|%]`. For the commit history and a test suite, go to https://github.com/dbohdan/featherweight%|%dbohdan/featherweight%|% on GitHub.

(Attempts to paste the thousands of lines of source code were blocked by Cloudflare.)


**See also**

   * [Artificial intelligence]
   * [ChatGPT and Tcl]
   * [instant messaging] for Tk applications with the same type of user interface   * [openai-sdk-tcl]

   * [https://ampcode.com/notes/how-to-build-an-agent%|%"How to Build an Agent or: The Emperor Has No Clothes"], Thorsten Ball (2025)


**Discussion**
[dbohdan] 2026-11-21: Inspired by a [Hacker News] [https://news.ycombinator.com/item?id=50586292%|%discussion] of agents on legacy systesm, I got Featherweight running on Windows XP SP3. I used my 2016 [https://github.com/dbohdan/tcl86-nsis-installer%|%repack] of [Magicsplat Tcl/Tk for Windows] 8.6.6 for Windows XP and Vista and a 2017 [https://winampplugins.co.uk/curl%|%build of curl with certificates].

Featherweight was developed against curl 8 and didn't work with 7.53.1. MiMo-V2.6-Flash, running in the harness on modern Linux with [Wine] for `curl.exe`, found that the necessary change was minimal and only touched `--write-out`:

======none
  --- featherweight.tcl
  +++ featherweight.tcl
  @@ -2794,7 +2794,8 @@
               --request POST \
               --show-error \
               --silent \
  -            --write-out "\n%{http_code} %{exitcode} %{errormsg}" \
  +            --write-out "\n%{http_code} 0" \
               [dict
======

Screenshots:

<<inlinehtml>>
<a href="https://wiki.tcl-lang.org/page/featherweight%2Dwinxp%2D1%2Epng"><img width="300px" src="https://wiki.tcl-lang.org/image/featherweight%2Dwinxp%2D1%2Epng"></a>
&nbsp;
<a href="https://wiki.tcl-lang.org/page/featherweight%2Dwinxp%2D2%2Epng"><img width="300px" src="https://wiki.tcl-lang.org/image/featherweight%2Dwinxp%2D2%2Epng"></a>
&nbsp;
<a href="https://wiki.tcl-lang.org/page/featherweight%2Dwinxp%2D3%2Eavif"><img width="300px" src="https://wiki.tcl-lang.org/image/featherweight%2Dwinxp%2D3%2Eavif"></a>
<<inlinehtml>>

The encoding bug visible in the screenshots has been fixed.


<<categories>> AI | Application | Development | Internet