pub struct CodeHealthConfig {
pub cognitive_threshold: u32,
pub gate: String,
pub annotate_reads: bool,
pub naming: bool,
pub inject_context: bool,
}Expand description
Code-health engine ([code_health]): clean code as a token-cost lever.
Cognitive complexity, naming quality, and coupling are computed once during indexing and surfaced at read- and edit-time. These switches tune the thresholds and how assertively findings are surfaced.
Fields§
§cognitive_threshold: u32Cognitive-complexity threshold above which a function is a hotspot.
Mirrors core::code_health::DEFAULT_COGNITIVE_THRESHOLD (15).
gate: StringEdit-gate behavior on complexity drift: "warn" (annotate, default),
"block" (refuse clean→over-threshold edits), or "off".
annotate_reads: boolAnnotate over-threshold functions inline in ctx_read output.
naming: boolRun the naming-quality heuristic.
inject_context: boolInject [CODE HEALTH] notices as additionalContext in PostToolUse stdout.
Default: false — prevents prompt-cache invalidation on Anthropic models
(#778: each injection causes 440-520k tokens of cache re-bills when Claude
Code strips stale system-reminders retroactively).
When false, notices route to ctx_knowledge + dashboard instead.
Trait Implementations§
Source§impl Clone for CodeHealthConfig
impl Clone for CodeHealthConfig
Source§fn clone(&self) -> CodeHealthConfig
fn clone(&self) -> CodeHealthConfig
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 CodeHealthConfig
impl Debug for CodeHealthConfig
Source§impl Default for CodeHealthConfig
impl Default for CodeHealthConfig
Source§fn default() -> CodeHealthConfig
fn default() -> CodeHealthConfig
Source§impl<'de> Deserialize<'de> for CodeHealthConfigwhere
CodeHealthConfig: Default,
impl<'de> Deserialize<'de> for CodeHealthConfigwhere
CodeHealthConfig: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CodeHealthConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CodeHealthConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for CodeHealthConfig
impl Serialize for CodeHealthConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Forget for CodeHealthConfig
impl Freeze for CodeHealthConfig
impl Move for CodeHealthConfig
impl RefUnwindSafe for CodeHealthConfig
impl Send for CodeHealthConfigwhere
RawVecInner: Send,
impl Sync for CodeHealthConfigwhere
RawVecInner: Sync,
impl Unpin for CodeHealthConfig
impl UnsafeUnpin for CodeHealthConfig
impl UnwindSafe for CodeHealthConfigwhere
RawVecInner: UnwindSafe,
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<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