pub struct CodeHealthConfig {
pub cognitive_threshold: u32,
pub gate: String,
pub annotate_reads: bool,
pub naming: bool,
pub coupling: 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.
coupling: boolCompute module-coupling metrics.
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§impl<'de> Deserialize<'de> for CodeHealthConfigwhere
CodeHealthConfig: Default,
impl<'de> Deserialize<'de> for CodeHealthConfigwhere
CodeHealthConfig: Default,
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>,
Auto Trait Implementations§
impl Freeze for CodeHealthConfig
impl RefUnwindSafe for CodeHealthConfig
impl Send for CodeHealthConfig
impl Sync for CodeHealthConfig
impl Unpin for CodeHealthConfig
impl UnsafeUnpin for CodeHealthConfig
impl UnwindSafe for CodeHealthConfig
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>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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