chatfile

Version, currently polished2 versions

github.com/TedSinger/chatfile

A notebook-like textfile format for chatting with LLMs

8 stars
0 dependents
License: MIT

Nothing has been indexed for polished yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  chatfile:
    github: TedSinger/chatfile
    version: ~> polished

Then run:

shards install

shard.yml

No shard.yml has been indexed for polished. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

chatfile

Plain-text AI

demo

Why?

AI input is text. AI output is text. Text belongs in a text file. Text files belong in a text editor.

It just makes sense.

What?

  1. A file format for a text interaction between a human and an LLM. Like a screenplay or dialog
  2. A program that interprets this file and fills in a response from an LLM

Example chatfile:

#!/usr/bin/env chatfile
#@ user
Kindly relate a humorous anecdote regarding a jungle fowl and a transit corridor
#@ brainstorm
<thinking>Any number of cliched jokes about a chicken crossing the road would fit. But the user's word choice is oddly technical. Let's try something more futuristic.</thinking>
#@ ai
What motivation compelled the RoosterBot to trespass across the hyperlane? To access the excluded zone!

Details

  • Use models on OpenRouter, AWS Bedrock, OpenAI, or Anthropic
  • Configure prompts, providers, models, parameters in ~/.config/chatfile/personas.ini
[global]
prompt = You are a terse and efficient assistant
provider = bedrock
model = us.anthropic.claude-3-7-sonnet-20250219-v1:0
temperature = 0.7

[shakespeare]
prompt = You are William Shakespeare, the Bard of Avon,
  loquacious poet, author not only of classic plays in
  English, but of the English language itself
temperature = 0.7
provider = openrouter
model = meta-llama/llama-3.3-8b-instruct:free
  • Separate blocks with "persona lines", starting with #@
  • Reference shortcuts in a persona line #@ shakespeare to merge the parameters from the config file
  • Give context from commands with "shell blocks", labeled #@ $
    • Commands in the block will be executed and the output provided to the model
    • Add a path (#@ $ ~/projects/) to change the working directory for the shell commands
  • Force structured output by putting a json schema in a block tagged #@ {}
    • (Hint: ask the LLM to write one, then change the block tag)