Files
Claude-Code-Workflow/ccw/src/core/memory-v2-config.ts
catlog22 99ee4e7d36 feat: unified task.json schema migration and multi-module updates
- Create task-schema.json (JSON Schema draft-07) with 10 field blocks fusing
  Unified JSONL, 6-field Task JSON, and Solution Schema advantages
- Migrate unified-execute-with-file from JSONL to .task/*.json directory scanning
- Migrate 3 producers (lite-plan, plan-converter, collaborative-plan) to
  .task/*.json multi-file output
- Add review-cycle Phase 7.5 export-to-tasks (FIX-*.json) and issue-resolve
  --export-tasks option
- Add schema compatibility annotations to action-planning-agent, workflow-plan,
  and tdd-plan
- Add spec-generator skill phases and templates
- Add memory v2 pipeline (consolidation, extraction, job scheduler, embedder)
- Add secret-redactor utility and core-memory enhancements
- Add codex-lens accuracy benchmarks and staged env config overrides
2026-02-11 17:40:56 +08:00

85 lines
2.4 KiB
TypeScript

/**
* Memory V2 Configuration Constants
*
* All tuning parameters for the two-phase memory extraction and consolidation pipeline.
* Phase 1: Per-session extraction (transcript -> structured memory)
* Phase 2: Global consolidation (structured memories -> MEMORY.md)
*/
// -- Batch orchestration --
/** Maximum sessions to process per startup/trigger */
export const MAX_SESSIONS_PER_STARTUP = 64;
/** Maximum concurrent Phase 1 extraction jobs */
export const PHASE_ONE_CONCURRENCY = 64;
// -- Session eligibility --
/** Maximum session age in days to consider for extraction */
export const MAX_SESSION_AGE_DAYS = 30;
/** Minimum idle hours before a session becomes eligible */
export const MIN_IDLE_HOURS = 12;
// -- Job scheduler --
/** Default lease duration in seconds (1 hour) */
export const LEASE_SECONDS = 3600;
/** Delay in seconds before retrying a failed job */
export const RETRY_DELAY_SECONDS = 3600;
/** Maximum retry attempts for a failed job */
export const MAX_RETRIES = 3;
/** Interval in seconds between heartbeat renewals */
export const HEARTBEAT_INTERVAL_SECONDS = 30;
// -- Content size limits --
/** Maximum characters for raw_memory field in stage1_outputs */
export const MAX_RAW_MEMORY_CHARS = 300_000;
/** Maximum characters for rollout_summary field in stage1_outputs */
export const MAX_SUMMARY_CHARS = 1200;
/** Maximum bytes of transcript to send to LLM for extraction */
export const MAX_ROLLOUT_BYTES_FOR_PROMPT = 1_000_000;
/** Maximum number of raw memories included in global consolidation input */
export const MAX_RAW_MEMORIES_FOR_GLOBAL = 64;
// -- Typed configuration object --
export interface MemoryV2Config {
MAX_SESSIONS_PER_STARTUP: number;
PHASE_ONE_CONCURRENCY: number;
MAX_SESSION_AGE_DAYS: number;
MIN_IDLE_HOURS: number;
LEASE_SECONDS: number;
RETRY_DELAY_SECONDS: number;
MAX_RETRIES: number;
HEARTBEAT_INTERVAL_SECONDS: number;
MAX_RAW_MEMORY_CHARS: number;
MAX_SUMMARY_CHARS: number;
MAX_ROLLOUT_BYTES_FOR_PROMPT: number;
MAX_RAW_MEMORIES_FOR_GLOBAL: number;
}
/** Default configuration object - use individual exports for direct access */
export const MEMORY_V2_DEFAULTS: Readonly<MemoryV2Config> = {
MAX_SESSIONS_PER_STARTUP,
PHASE_ONE_CONCURRENCY,
MAX_SESSION_AGE_DAYS,
MIN_IDLE_HOURS,
LEASE_SECONDS,
RETRY_DELAY_SECONDS,
MAX_RETRIES,
MAX_RAW_MEMORY_CHARS,
MAX_SUMMARY_CHARS,
MAX_ROLLOUT_BYTES_FOR_PROMPT,
MAX_RAW_MEMORIES_FOR_GLOBAL,
HEARTBEAT_INTERVAL_SECONDS,
} as const;