WardrikWorkspace.Context (wardrik_workspace v0.1.0-rc.1)

Copy Markdown

Middleware that reads workspace files into the agent's instructions as each turn begins.

middleware: [{WardrikWorkspace.Context, store: store, tree: tree, files: ["MEMORY.md"]}]

It appends a # Your workspace section to the instructions. The section holds:

  1. Each of :files, in order, with its version.
  2. The :files not written yet.
  3. The names of the other files at the top of the agent's tree.
  4. The trees shared with the agent.

The instructions are restored after the turn.

Options

Takes WardrikWorkspace's options, plus:

  • :files - paths to read into each turn. [] unless set.
  • :max_bytes - how much of :files to read in total. 16_384 unless set.

Budget

The budget is shared out smallest file first, so one long file can't crowd out the others. A file over its share is cut to its start and end. If it's in the agent's own tree, the agent is asked to rewrite it shorter.

Labels

The labels of the files read are added to the turn's latest message, so the run carries them.

Summary

Functions

Returns the workspace text for spec's agent, reading files within budget bytes.

Functions

text(spec, files, budget)

Returns the workspace text for spec's agent, reading files within budget bytes.