/** * Lean-change rules for spawn prompts and the `cleo lean` verbs (T13422, T13663). * * The core rules of the `ct-lean` skill (adapted from Ponytail 5.1.0, * DietrichGebert, MIT), emitted at every spawn tier so workers that never load * the skill still get them. The skill holds the full text; this block is the * part a worker needs on every task. * * The rules run at a level (`off`, `lite`, `full`, `ultra`). The level * resolves from `CLEO_LEAN_LEVEL`, then the session-scoped level written by * `cleo lean level --session`, then the `lean.level` config key, then * `full`. * * @task T13422 * @task T13663 */ import type { LeanLevel, LeanLevelSource } from '@cleocode/contracts'; /** Every lean level, in increasing strictness. */ export declare const LEAN_LEVELS: readonly LeanLevel[]; /** One-paragraph lean-change rule (level `full`); the full rules are in the `ct-lean` skill. */ export declare const LEAN_CHANGE_LINE = "Make the smallest complete change: skip anything nobody asked for (name it in one line); reuse a helper, contract or chokepoint already in the repo before writing new code; add no abstraction, option or dependency for later; fix a bug once at its root after grepping every caller; finish every caller, test and fixture the change breaks; leave one small test for new non-trivial logic. Never cut validation, data-loss error handling, security, privacy, evidence gates, type safety or the package boundary. End with one line on what you skipped or did not check. Full rules: the `ct-lean` skill."; /** * Whether `value` (trimmed, any case) names a lean level. * * @param value - e.g. `process.env.CLEO_LEAN_LEVEL`. */ export declare function isLeanLevel(value: string | undefined | null): boolean; /** * The lean rule paragraph for a level, or `null` for `off`. * * @param level - the resolved level. */ export declare function leanChangeLine(level?: LeanLevel): string | null; /** * Build the `## Lean Change (ct-lean)` spawn-prompt block, or `null` at level `off`. * * @param level - the resolved level (default `full`). */ export declare function buildLeanChangeBlock(level?: LeanLevel): string | null; /** A resolved lean level and where it came from. */ export interface ResolvedLeanLevel { /** The effective level. */ readonly level: LeanLevel; /** Which layer set it. */ readonly source: LeanLevelSource; } /** * Resolve the effective level from its layers: env, then session, then * config, then `full`. Unknown values are ignored. * * @param layers - the raw value of each layer. * @returns the level and its source. */ export declare function resolveLeanLevel(layers: { readonly env?: string | null; readonly session?: string | null; readonly config?: string | null; }): ResolvedLeanLevel; /** The session-scoped level file (gitignored by `.cleo/.gitignore`, deny-by-default). */ export declare function leanSessionFile(projectRoot: string): string; /** * The session-scoped level, when it was set for `sessionId`. A level set in * another session is ignored, so it ends with the session that set it. * * @param projectRoot - the project root. * @param sessionId - the current CLEO session id, if known. */ export declare function readSessionLeanLevel(projectRoot: string, sessionId: string | null | undefined): LeanLevel | undefined; /** * Set the level for one session only. * * @param projectRoot - the project root. * @param sessionId - the session the level belongs to. * @param level - the level. */ export declare function writeSessionLeanLevel(projectRoot: string, sessionId: string, level: LeanLevel): Promise; /** * `lean.level` from the merged global + project config, or `undefined` when * unset, invalid or unreadable. * * @param projectRoot - the project root. */ export declare function configuredLeanLevel(projectRoot: string): Promise; /** * The effective level for a project and session: `CLEO_LEAN_LEVEL`, then the * session level, then `lean.level`, then `full`. * * @param opts - project root, session id and environment. */ export declare function effectiveLeanLevel(opts: { readonly projectRoot: string; readonly sessionId?: string | null; readonly env?: Readonly>; }): Promise; /** Where `cleo lean level ` writes the level. */ export type LeanLevelScope = 'session' | 'project' | 'global'; /** * Persist a level: for one session (`session`, needs `sessionId`), or as the * `lean.level` key of the project or global config. * * @param opts - project root, level, scope and (for `session`) the session id. * @returns the level and scope written. * @throws Error when `scope` is `session` and no session id is given. */ export declare function setLeanLevel(opts: { readonly projectRoot: string; readonly level: LeanLevel; readonly scope: LeanLevelScope; readonly sessionId?: string | null; }): Promise<{ readonly level: LeanLevel; readonly scope: LeanLevelScope; }>; //# sourceMappingURL=lean-change.d.ts.map