Context

Tenx allows the user to attach context to a session - that is, information that is provided to the model, but is not editable. Often, this is reference material - manuals or documentation - but it can also be examples of output the user wants, style guides, tweaks to the model's prompt, or anything else that the user needs the model to know.

Tenx has a flexible - and growing - set of commands for including and managing context. All the contxt commands are grouped as subcommands under tenx ctx.

One command to note here is refresh. Some context types, like url and ruskel take some time to fetch or generate. Usually, this is done once when the context is first added, but refresh lets you regenerate the data if there have been updates.

The configuration file also has a context section, where you can define default context that is added to every session.

Context Types

cmd

The cmd context type executes a shell command and uses its output as context. The command is run with sh -c, and both stdout and stderr are captured. This can be useful for including the output of tools like git log, compiler messages, or command-line tool output in your context.

file

The file context type is similar to text, but it reads the text from a file, and the name of the file is associated with the context and visible to the model. The content of the file context is refreshed every time we contact the model, so you can edit the file and the model will see the changes.

project_map

The project map is a special context that is auto-generated by Tenx itself. It's essentially just list of files included in the project, as seen in the tenx files command. Tenx allows a model to request to view or edit files in the project if needed, and the project map is how it knows what files are available.

ruskel

Ruskel is a tool that extracts the public surface area of a Rust project - that is, the public functions, types, traits, and modules - and renders it to syntactically valid Rust code. This is useful for including the API of a Rust module in the context of a session. This can be either local or any crate on crates.io.

See the Working in Rust example for a demonstration of how to use ruskel in practice.

text

The text context type is the simplest - it's just a string of text. tenx ctx text command can load context from a file, or you can provide the text directly through stdin.

url

The url context type fetches the content of a URL and provides it to the model.