pub struct ContextConfig {
pub file_name: String,
pub global_dir: Option<PathBuf>,
pub walk_parents: bool,
}Expand description
How to look for context files. Every knob has a convention-shaped default; none of them encode a task.
Fields§
§file_name: StringFile name to look for in each candidate directory.
A bare name and nothing else: this is joined onto every candidate
directory, so a .. or a leading / here would make each of them
contribute a document from elsewhere while still being reported under
that directory’s scope. A path is refused at discovery with
ContextError::ContextFileNameNotBare rather than followed; a host
that wants a file from somewhere else names a
global_dir or supplies a
SystemPrompt instead. Empty is
none: no name, so nothing is looked for.
Left at DEFAULT_CONTEXT_FILE this is the first of two names —
see file_names for the fallback and for why
renaming opts out of it.
global_dir: Option<PathBuf>Directory holding the user-global context file, if any.
A directory, so it may be anywhere — naming a path is a host taking
responsibility for it, the same latitude
MemoryConfig’s roots have.
walk_parents: boolWhether to walk from the workspace root up to the filesystem root.
Implementations§
Source§impl ContextConfig
impl ContextConfig
Sourcepub fn none() -> Self
pub fn none() -> Self
No context discovery at all (decision D9): AGENTS.md and CLAUDE.md
are simply not read, in the workspace, in any ancestor, or in the
global config directory.
Workspace validation still happens. WorkspaceContext::discover_with
resolves and checks the path before it ever looks at file_names —
a workspace that does not exist, is not a directory, or cannot be
canonicalized still fails open the
same way it would with discovery on. What stops is reading files: no
document is collected, so WorkspaceContext::render is always
None and the system prompt is whatever else supplied one —
SystemPrompt, the memory index, or nothing.
Reuses the fields rather than adding a fourth: an empty file_name
is what file_names treats as no name to look
for, so no candidate is ever found in any directory regardless of
global_dir or
walk_parents — set to their least-surprising
values here rather than left at whatever the caller had, so a Debug
print of this value does not suggest a knob that still does something.
Who wants this: a host with its own opinion about what an agent should
be told and no interest in a repository’s (SystemPrompt::Replace
already drops discovery from the prompt, but still pays for reading
the files to report them; this skips the read too) — or a test that
wants a result independent of whatever AGENTS.md the machine
running it happens to carry.
Sourcepub fn file_names(&self) -> Vec<&str>
pub fn file_names(&self) -> Vec<&str>
The names to try in one directory, strongest first. The first that is there is the document that directory contributes; the rest are not read.
The fallback belongs to the default name rather than to any name. A
host that renamed the convention has said which file it wants, and
reading CLAUDE.md behind that name would be basis loading instructions
from a file the host never named — the one thing a discovery knob exists
to prevent.
Empty is ContextConfig::none’s doing: no name to look for is no
candidate ever found, in any directory.
Trait Implementations§
Source§impl Clone for ContextConfig
impl Clone for ContextConfig
Source§impl Debug for ContextConfig
impl Debug for ContextConfig
Source§impl Default for ContextConfig
impl Default for ContextConfig
impl Eq for ContextConfig
Source§impl PartialEq for ContextConfig
impl PartialEq for ContextConfig
impl StructuralPartialEq for ContextConfig
Auto Trait Implementations§
impl Freeze for ContextConfig
impl RefUnwindSafe for ContextConfig
impl Send for ContextConfig
impl Sync for ContextConfig
impl Unpin for ContextConfig
impl UnsafeUnpin for ContextConfig
impl UnwindSafe for ContextConfig
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§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.