export type CheckStatus = 'pass' | 'warn' | 'fail' | 'skip';
export interface DiagnosticResult {
    name: string;
    status: CheckStatus;
    message: string;
    remediation?: string;
}
export declare function checkConfig(cwd: string): DiagnosticResult;
export declare function checkCompiledRules(cwd: string, totemDir?: string): DiagnosticResult;
export declare function checkGitHooks(cwd: string): DiagnosticResult;
export declare function checkEmbeddingConfig(cwd: string): DiagnosticResult;
/**
 * Probe whether the Ollama daemon is reachable. Surfaces the floor-embedder
 * expectation diagnostically (mmnto-ai/totem#1851) so consumers don't perceive
 * the well-formed `LazyEmbedder` `TotemConfigError` as a crash and reach for
 * a vendor-coupling workaround. Always probes regardless of configured
 * provider — Ollama IS the floor per Tenet 16.
 *
 * Reads `embedding.baseUrl` from config when `provider: 'ollama'` is
 * configured with a custom URL; otherwise probes the default
 * (`http://localhost:11434`). The configured-but-unreachable case for
 * `provider: 'ollama'` produces the same `warn` here as it does for any
 * other provider; the false-`pass` in `checkEmbeddingConfig` for that
 * exact scenario is tracked separately and intentionally left untouched
 * to keep this PR additive.
 */
export declare function checkOllama(config?: {
    embedding?: {
        provider?: string;
        baseUrl?: string;
    };
}): Promise<DiagnosticResult>;
export declare function checkIndex(cwd: string, lanceDir?: string): DiagnosticResult;
export declare function checkLinkedIndexes(cwd: string): DiagnosticResult;
/**
 * Strategy-root resolver diagnostic (mmnto-ai/totem#1710).
 *
 * Runs `resolveStrategyRoot` and reports which precedence layer matched.
 * Advisory only: `warn` (not `fail`) on unresolved so a freshly-cloned
 * project without a strategy repo doesn't fail the doctor pass.
 *
 * Affected consumer surfaces if unresolved: MCP `describe_project`
 * rich-state pointer, `totem proposal new` / `totem adr new`, federated
 * search via the auto-injected strategy linkedIndex, the bench scripts
 * under `scripts/`.
 *
 * Async + dynamic import to keep `@mmnto/totem` off the CLI cold-start
 * graph (matches `checkSecretLeaks` and the rest of the diagnostics that
 * need core).
 */
export declare function checkStrategyRoot(cwd: string, config?: {
    strategyRoot?: string;
}): Promise<DiagnosticResult>;
export declare function checkSecretLeaks(cwd: string, totemDir?: string): Promise<DiagnosticResult>;
export declare function checkSecretsFileTracked(cwd: string, totemDir?: string): DiagnosticResult;
/**
 * Maximum byte size for a `CLAUDE.md` that's purely a thin redirect to
 * `AGENTS.md`. Anchored to Proposal 272 § 6.7. Empirical headroom:
 * the largest post-migration cohort redirect is 558 bytes.
 */
export declare const CLAUDE_MD_REDIRECT_MAX_BYTES = 600;
/**
 * Minimal shape signature for a `CLAUDE.md` redirect to `AGENTS.md`
 * per ADR-038. The canonical phrase plus the link target is load-bearing;
 * surrounding wording is intentionally unconstrained so future template
 * tweaks survive without breaking every consumer.
 */
export declare const AGENTS_MD_REDIRECT_PATTERN: RegExp;
export declare function checkAgentsMdCanonical(cwd: string): DiagnosticResult;
/**
 * Pure helper: scan compiled rules + metrics and return structured upgrade candidates.
 * Used by both `checkUpgradeCandidates` (read-only diagnostic) and `runSelfHealing`
 * (auto-recompile phase). Returns null if rules/metrics cannot be loaded.
 *
 * IMPORTANT: Uses `contextCounts` (per-context match buckets), NOT `triggerCount`
 * (the rolled-up total). `triggerCount` includes ALL matches, not just code matches.
 */
export declare function findUpgradeCandidates(cwd: string, totemDir?: string): Promise<UpgradeCandidate[] | null>;
/**
 * Find regex/ast rules whose telemetry shows >NON_CODE_THRESHOLD of matches landing
 * in non-code contexts (strings, comments, regex literals). These are good candidates
 * for being upgraded to structural ast-grep patterns via `totem lesson compile --upgrade`.
 */
export declare function checkUpgradeCandidates(cwd: string, totemDir?: string): Promise<DiagnosticResult>;
/** Bypass rate above which a rule is considered "struggling" and eligible for downgrade. */
export declare const BYPASS_THRESHOLD = 0.3;
/** Minimum total events (triggers + bypasses) required before acting on a rule. */
export declare const MIN_EVENTS = 5;
/** Non-code match ratio above which a regex/ast rule is flagged for ast-grep upgrade. */
export declare const NON_CODE_THRESHOLD = 0.2;
/** Minimum total context events required before flagging a rule as an upgrade candidate. */
export declare const MIN_CONTEXT_EVENTS = 5;
export interface UpgradeCandidate {
    lessonHash: string;
    heading: string;
    /**
     * Always `'regex'` — `findUpgradeCandidates` filters to regex rules only
     * because only they carry trustworthy non-code telemetry. Narrowed from
     * the broader engine union so the type matches the implementation.
     */
    engine: 'regex';
    total: number;
    codeCount: number;
    nonCodeRatio: number;
}
/**
 * Pure helper signature: a staleness candidate as returned by
 * `findStaleRules`. The `severity` distinction lets the formatter label
 * security rules visually distinct from standard rules without the caller
 * needing to re-derive the category from the compiled rule.
 */
export interface StaleRuleCandidate {
    lessonHash: string;
    heading: string;
    evaluationCount: number;
    severity: 'standard' | 'security';
    /** The recommended next step surfaced in the advisory text. */
    recommendation: string;
    /** Compile-metadata flags relevant to the advisory. */
    flags: {
        unverified?: boolean;
        immutable?: boolean;
        category?: string;
    };
}
/**
 * Pure helper: scan compiled rules + metrics and return structured
 * stale-rule candidates. A rule is stale when it has accrued at least
 * `staleRuleWindow` evaluations over its lifetime and has never landed a
 * match in code context (`contextCounts.code === 0`).
 *
 * Security rules (`category === 'security'` OR `immutable === true`) get
 * flagged with the `security` severity so the formatter can mark them
 * with a higher-severity label. Per the design doc, doctor never
 * recommends archival for security rules.
 */
export declare function findStaleRules(cwd: string, totemDir?: string, thresholds?: {
    staleRuleWindow: number;
}): Promise<StaleRuleCandidate[] | null>;
/**
 * Stale-rule advisory diagnostic. Returns a single DiagnosticResult
 * regardless of how many rules were flagged; the details list is
 * serialized into the `message` + `remediation` fields. Per the design
 * doc, this is advisory-only — no auto-archive, no side effects on the
 * rules file.
 */
export declare function checkStaleRules(cwd: string, totemDir?: string, thresholds?: {
    staleRuleWindow: number;
}): Promise<DiagnosticResult>;
/**
 * ISO timestamp for the 1.13.0 ship date. Rules whose vintage timestamp
 * precedes this never saw the ADR-088 Phase 1 substrate fields
 * (`badExample`, `goodExample`, `unverified`) during their compile. Used
 * by `findLegacyGrandfatheredRules` to categorize the pre-zero-trust
 * cohort the 2026-04-20 audit measured at 357 of 378 active rules.
 */
export declare const V_1_13_0_SHIP_DATE_ISO = "2026-04-07T00:00:00.000Z";
export type GrandfatheredReasonCode = 'vintage-pre-1.13.0' | 'no-badExample' | 'no-goodExample';
export interface GrandfatheredRuleCandidate {
    lessonHash: string;
    heading: string;
    /** Non-empty: rules with zero applicable reasons are not returned. */
    reasons: GrandfatheredReasonCode[];
    /** `createdAt` when present, `compiledAt` otherwise; used for the vintage check. */
    vintage: string;
}
/**
 * Pure helper: scan compiled rules and return the grandfathered
 * pre-zero-trust cohort categorized by reason. A rule is a candidate
 * when it is active (`status !== 'archived'`) and lacks the `unverified`
 * flag from ADR-089 part 1 (mmnto-ai/totem#1581). Each candidate gets
 * every reason that applies:
 *
 *   - `vintage-pre-1.13.0`: vintage timestamp precedes the 1.13.0 ship date.
 *   - `no-badExample`: empty or absent `badExample` field.
 *   - `no-goodExample`: empty or absent `goodExample` field.
 *
 * Rules with at least one reason are returned; rules that satisfy all
 * three substrate checks are omitted.
 *
 * Returns `null` when `compiled-rules.json` is missing or unreadable,
 * matching the fallback convention used by `findStaleRules` so the
 * caller can render a `skip` diagnostic rather than fail the pipeline.
 */
export declare function findLegacyGrandfatheredRules(cwd: string, totemDir?: string): Promise<GrandfatheredRuleCandidate[] | null>;
/**
 * Grandfathered-rule advisory diagnostic. Summarizes the pre-zero-trust
 * cohort by reason code. Advisory-only (`warn`): ADR-091 Stage 4
 * Codebase Verifier (1.16.0, mmnto-ai/totem#1504) is the empirical
 * audit path; this check gives users a triage-able surface until that
 * ships.
 */
export declare function checkGrandfatheredRules(cwd: string, totemDir?: string): Promise<DiagnosticResult>;
export interface DoctorOptions {
    pr?: boolean;
    /**
     * When true, callers should treat any `fail` diagnostic as a gating
     * condition (exit non-zero). The flag itself doesn't change what
     * `doctorCommand` returns — the exit-code decision lives at the CLI edge
     * so this function stays composable and free of process-exit side effects.
     *
     * Reference: mmnto-ai/totem#1908 (Proposal 273 § 6 Q2 / § 7 routing matrix
     * row 5).
     */
    strict?: boolean;
}
export declare function runSelfHealing(cwd: string): Promise<void>;
/**
 * Sensor-only freeze surfacing (strategy#584 read half, mmnto-ai/totem#2167). Renders the
 * effective freeze union (repo-local ∪ distributed cohort) with per-source
 * channel status — absent-package / absent-file / corrupt / genuinely-none
 * stay distinct (codex W1). NEVER emits 'fail': freezes are sensed state, not
 * drift, and doctor `--strict` gates on fail — a freeze (or a broken channel)
 * must report loudly without gating (Tenet 13; the gate consumer is
 * verify-manifest, not doctor).
 */
export declare function checkFreezes(cwd: string, totemDir?: string): Promise<DiagnosticResult>;
export declare function doctorCommand(options?: DoctorOptions): Promise<DiagnosticResult[]>;
//# sourceMappingURL=doctor.d.ts.map