Inject local context (git state, project structure, etc.) into the system prompt.
Runs a bash detection script via backend.execute() on first interaction
and again after each summarization event, stores the result in state, and
appends it to the system prompt on every model call.
Because the script runs inside the backend, it works for both local shells and remote sandboxes.
LocalContextMiddleware(
self,
backend: _ExecutableBackend,
)| Name | Type | Description |
|---|---|---|
backend* | _ExecutableBackend | Backend instance that provides shell command execution. |
| Name | Type |
|---|---|
| backend | _ExecutableBackend |
Run context detection on first interaction and refresh after summarization.
On the first invocation, runs the detection script and stores the result.
After a summarization event (indicated by a new _summarization_event
in state), re-runs the script to capture any environment changes that
occurred during the session.
Inject local context into system prompt.
Inject local context into system prompt (async).