/** * Minimal session trace passed in by the caller. * Callers populate what they have — all fields are optional except the session * length heuristics (turnCount, hadErrors, containsCode). */ export type SessionTrace = { userInitialRequest: string; /** Number of back-and-forth turns (user + assistant messages combined). */ turnCount: number; /** Whether any tool errors or self-corrections occurred. */ hadErrors: boolean; /** Whether the session contained code or shell commands. */ containsCode: boolean; /** Flat list of tool names called during the session (Write, Edit, Bash, …). */ toolCalls?: string[]; /** Steps where the agent recovered from an error. */ errorRecoveries?: string[]; /** Final assistant reply. */ finalReply?: string; }; /** * Returns true when the session is worth turning into a reusable skill. * * Two qualifying patterns: * A. Code-producing workflow (the original heuristic): * - 4+ turns, completed without unrecovered errors, contained code or * commands, and the initial request is substantive (≥ 20 chars) * * B. Multi-step tool orchestration (new): * - 3+ turns with at least 2 distinct tool calls * - the same root task across turns (no error recoveries) * - useful for flows like Telegram login, OAuth setup, vendor handshakes * where there is little or no produced code but the procedure itself * is reusable */ export declare function isWorthSkillifying(session: SessionTrace): boolean; /** * Slugify a title into a valid directory name. * "Add retry logic to Postgres queries" → "add-retry-logic-to-postgres-queries" */ export declare function slugify(title: string): string; /** * After a complex multi-turn session, attempt to generate and save a new skill. * * - Checks heuristics via `isWorthSkillifying` * - Calls `klaw infer model run` to generate a SKILL.md draft * - If a skill with the same slug already exists, writes a .proposed.md instead * - Notifies the user when a new skill is created * * Fire-and-forget safe — catches all errors internally. */ export declare function maybeCreateSkill(session: SessionTrace): Promise;