pub struct RoleProfile {
pub prompt: String,
pub role: Option<String>,
pub tools: Option<Vec<String>>,
pub skills: Option<Vec<String>>,
pub caveats: Option<CaveatProfile>,
pub model: Option<String>,
pub tier: Option<Tier>,
pub altitude: Option<Altitude>,
}Expand description
A parsed role profile: a system-prompt overlay plus the optional toolset / capability / router policy declared in TOML front-matter.
prompt is always the markdown body (front-matter stripped). Every other
field is Some only when the front-matter declared it; a profile with no
front-matter has all-None non-prompt fields and behaves exactly like
today’s prompt-only persona.
Fields§
§prompt: StringThe markdown body (front-matter removed). Injected as the persona overlay exactly as today.
role: Option<String>Declared role name (e.g. "dragon-rider", "worker"). Independent of
the persona file’s stem, so a file can name the role it embodies.
tools: Option<Vec<String>>Allow-list of tool names this role may use. None = unconstrained
(today’s behavior); enforcement is a follow-up.
skills: Option<Vec<String>>Skill names (matching a SKILL.md name under skill_search_dirs)
this role binds on activation (FR-4, #1041). None = no bound
skills — today’s behavior, unaffected.
caveats: Option<CaveatProfile>Capability profile (agent-bridle caveats) this role carries.
model: Option<String>Preferred backend model id (router policy hint).
tier: Option<Tier>Preferred router tier (router policy hint).
altitude: Option<Altitude>Operating ALTITUDE — act (doer, the default) vs advise (coach). Selected
in front-matter as altitude = "coach". None = doer. Drives which base
identity the system prompt installs (FR-5, #999): a Coach altitude
REPLACES DEFAULT_SOUL with COACH_SOUL so a coaching persona doesn’t
ship two contradictory identities (doer soul + advise overlay).
Implementations§
Source§impl RoleProfile
impl RoleProfile
Sourcepub fn parse(text: &str) -> Result<Self>
pub fn parse(text: &str) -> Result<Self>
Parse a role-profile .md file’s full text into a RoleProfile.
If the text begins with a +++ fence line, everything up to the closing
+++ line is parsed as TOML front-matter and the remainder is the
prompt body. Otherwise the whole text is the prompt and every other
field is None (prompt-only — today’s behavior).
§Errors
Returns an error if a front-matter fence is opened but never closed, or if the front-matter is not valid TOML for the expected shape.
Sourcepub fn is_role_bound(&self) -> bool
pub fn is_role_bound(&self) -> bool
true when this profile declares more than a prompt (i.e. front-matter
bound a role, tools, skills, caveats, model, or tier). A prompt-only
persona returns false.
Sourcepub fn load_from_dir(name: &str, dir: &Path) -> Result<Self>
pub fn load_from_dir(name: &str, dir: &Path) -> Result<Self>
Load a named persona .md file from dir (#1021 PR 5.2 — the
headless counterpart of newt-tui’s PersonaStore::load).
Deliberately does not seed a shipped default when the file is
missing — PersonaStore’s per-file-idempotent seeding (FR-16, #1000)
is correct first-run UX for an interactive session, but a stdio
server silently writing files into ~/.newt/personas/ on every
startup is a footgun under CI/systemd. A headless caller with an
unresolvable --persona <name> should fail loudly instead.
§Errors
Returns an error if name isn’t a valid persona name (letters,
numbers, -, _ only — the same rule PersonaStore enforces, kept
in sync deliberately rather than shared, since crossing the
newt-core/newt-tui boundary for an 8-line check isn’t worth the
coupling), if the file doesn’t exist, or if it fails to parse.
Trait Implementations§
Source§impl Clone for RoleProfile
impl Clone for RoleProfile
Source§fn clone(&self) -> RoleProfile
fn clone(&self) -> RoleProfile
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 RoleProfile
impl Debug for RoleProfile
Source§impl Default for RoleProfile
impl Default for RoleProfile
Source§fn default() -> RoleProfile
fn default() -> RoleProfile
impl Eq for RoleProfile
Source§impl PartialEq for RoleProfile
impl PartialEq for RoleProfile
impl StructuralPartialEq for RoleProfile
Auto Trait Implementations§
impl Freeze for RoleProfile
impl RefUnwindSafe for RoleProfile
impl Send for RoleProfile
impl Sync for RoleProfile
impl Unpin for RoleProfile
impl UnsafeUnpin for RoleProfile
impl UnwindSafe for RoleProfile
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,
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.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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more