pub enum SystemPrompt {
Replace(String),
Append(String),
}Expand description
What a host says on top of what the workspace says.
basis ships no system prompt of its own and this does not give it one: the
text is the host’s, and a build that never names this type behaves exactly
as it did. What it removes is the workaround — an embedding host that wanted
its product to have a voice, or to say for my runs, answer in Chinese, had
to write into the user’s repository’s AGENTS.md, which is the one file
that is not the host’s to edit.
One enum rather than two builder methods, because the two are alternatives and not layers: a host either replaces what the workspace said or adds to it, and asking the type system to hold that is cheaper than documenting what happens when both are set.
Both scopes already had their weakest end covered — the global AGENTS.md
is a personal append below every workspace file. Neither variant touches
the skills block: mentra appends that itself, after whatever basis hands it.
Variants§
Replace(String)
The host’s text alone. Discovered context files stay out of the prompt entirely — including the global one — which is what makes this usable for a host whose product is not “an agent that reads your repository”.
They are still reported: run_started names what discovery found,
because that question — which files does this workspace have — has one
true answer regardless of what the host did with them, and the host that
replaced the prompt is the one party that already knows it did.
Replacing with nothing is not an error. It is the way to say no system
prompt at all, and it renders as None for the same reason an empty
workspace does.
Append(String)
The host’s text after the rendered context, as the strongest block.
Last because the rendered block tells the model that later blocks are
more specific and take precedence, and the host’s text is more specific
than any file on disk: it is the statement of the program actually
running this agent, about this deployment, which no repository can know
about — and a knob that a repository could override by writing a file is
not a knob. It is appended verbatim, outside the <context> framing,
because it did not come from a file and giving it a path would say it
did.
Appending nothing is a no-op rather than an error: there is one obvious meaning and it is the one the workspace already had.
Trait Implementations§
Source§impl Clone for SystemPrompt
impl Clone for SystemPrompt
Source§fn clone(&self) -> SystemPrompt
fn clone(&self) -> SystemPrompt
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SystemPrompt
impl Debug for SystemPrompt
Source§impl<'de> Deserialize<'de> for SystemPrompt
impl<'de> Deserialize<'de> for SystemPrompt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SystemPrompt
Source§impl PartialEq for SystemPrompt
impl PartialEq for SystemPrompt
Source§impl Serialize for SystemPrompt
impl Serialize for SystemPrompt
impl StructuralPartialEq for SystemPrompt
Auto Trait Implementations§
impl Freeze for SystemPrompt
impl RefUnwindSafe for SystemPrompt
impl Send for SystemPrompt
impl Sync for SystemPrompt
impl Unpin for SystemPrompt
impl UnsafeUnpin for SystemPrompt
impl UnwindSafe for SystemPrompt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.