A recursive harness for cognizers acting through Kotlin scripts
An experiment extracted from Golem XIV: a cognizer answers only with a Kotlin script, which is executed by the harness, itself a Kotlin script, so the cognizer can invoke further cogitations of its own recursively.
The name comes from Honest Annie, the supercomputer which in Stanisław Lem's Golem XIV went its own way.
./gradlew run -Pinput="What's fibonacci number 45"A single cognizer unfolds every cogitation, including the ones it invokes:
Claude when ANTHROPIC_MODEL is set (with ANTHROPIC_API_KEY),
otherwise the OPENAI_MODEL (with OPENAI_API_KEY) served by the OpenAI API,
or by any OpenAI-compatible endpoint set as OPENAI_BASE_URL, the /v1 suffix included.
Cogitations are recorded in ANNIE_COGITATIONS_DIR (cogitations by default),
and unfolded by the harness script at the ANNIE_HARNESS path,
or by the default harness extracted from DefaultHarness.kt when not set.
When ANNIE_TOKEN_BUDGET is set, the cogitation and the ones it invokes spend at most that many tokens,
and are impeded once they have spent them.
When ANNIE_PARALLELISM is set, at most that many of them step at a time, e.g. 1 for one inference at a time,
the others waiting in the queue.
./gradlew listModels [-Pprompt="text"] lists the models served at OPENAI_BASE_URL.
GNU Affero General Public License v3.0
See DEVELOPMENT.md for the documentation conventions, and for maintenance notes on updating the gradle wrapper and the project dependencies.