/** * Forgen v1 — Rule Store * * Structured Rule CRUD. render_key 기반 dedupe는 renderer 책임. * Authoritative schema: docs/plans/2026-04-03-forgen-data-model-storage-spec.md §3 */ import type { Rule, RuleCategory, RuleScope, RuleStrength, RuleSource, RuleStatus } from './types.js'; export declare function createRule(params: { category: RuleCategory; scope: RuleScope; trigger: string; policy: string; strength: RuleStrength; source: RuleSource; evidence_refs?: string[]; render_key: string; }): Rule; export declare function saveRule(rule: Rule): void; /** * ADR-002 T5 — rule 저장 + 기존 active rules 와 자연어 충돌 감지 + 양쪽 conflict_refs 기록. * * saveRule 과의 차이: * - 저장 직후 T5 detect 실행 → 충돌 발견 시 신규 rule + 반대편 rule 모두 conflict_refs 업데이트. * - auto-merge 안 함 (ADR-002 §Risks — 사용자 수동 해소). * - T5 감지 실패는 저장 자체를 막지 않음 (fail-open). * * 반환: 저장된 rule + 감지된 충돌 rule_id 목록. */ export declare function appendRule(rule: Rule): Promise<{ saved: true; conflicts_with: string[]; }>; export declare function loadRule(ruleId: string): Rule | null; export declare function loadAllRules(): Rule[]; export declare function loadActiveRules(): Rule[]; /** * ADR-002 Meta signal — rule 들이 프롬프트에 inject 되었음을 기록. * rule.lifecycle.inject_count +1, last_inject_at = now. * lifecycle 없던 rule 은 auto-init 하고 phase='active'. * Meta promotion (B→A) 의 rolling window 집계가 이 카운터를 소비한다. */ export declare function markRulesInjected(ruleIds: string[], nowIso?: string): void; export declare function updateRuleStatus(ruleId: string, status: RuleStatus): boolean; /** * 현재 세션 ID와 다른 scope:'session' 규칙을 비활성화. * 이전 세션의 임시 규칙이 새 세션에서 영향을 미치지 않도록 정리. */ export declare function cleanupStaleSessionRules(_currentSessionId: string): number;