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:
- Each of
:files, in order, with its version. - The
:filesnot written yet. - The names of the other files at the top of the agent's tree.
- 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:filesto read in total.16_384unless 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
@spec text(WardrikWorkspace.Spec.t(), [String.t()], pos_integer()) :: String.t()
Returns the workspace text for spec's agent, reading files within budget bytes.