Skip to content

feat(daily-evolve): self-evolution pipeline (Phase 0~6 + 1.5a + budget) — Codex pair R1-R3 0 수렴 - #1

Merged
tgkim-openerd merged 14 commits into
mainfrom
feat/daily-evolve-pipeline
May 28, 2026
Merged

tgkim-openerd merged 14 commits into
mainfrom
feat/daily-evolve-pipeline

Conversation

@tgkim-openerd

@tgkim-openerd tgkim-openerd commented May 27, 2026 •

Copy link
Copy Markdown
Collaborator

개요

plan-daily-evolve-pipeline.md (Codex pair R1-R7 0 수렴 + 사용자 결정 7건 default 적용) 의 Phase 0~6 + 0.5 + 1.5a + budget 누적 구현. 매일 morning routine 으로 7-source 신호 수집 → daily digest md → autonomous-safe PR draft + needs-user 결정 queue 까지 가는 점진적 self-improving plugin 의 첫 sprint.

Phase 별 구현

Phase 커밋 내용
0 PoC 314ad50 Source Aggregator (upstream PR/Issue + telemetry) + Diff-Gap Analyzer + Codex Triage L3 stub + Digest Writer L4 + Action Executor stub + Self-Evolve stub + 7 pure lib (R2-L2 dep rule)
1 f7c443c / 1aaeb66 Codex L3 Triage 통합 (heuristic stub + cost cap) + R1 review MED/LOW 3건 fix
1.5a a6a0598 Codex auth health check pre-flight + heuristic fallback (refresh token expired 시 routine 자체는 degrade — 실패 X)
2 4bc48b4 / fefa418 Active Fork Research + L7 가중치 조정 + R2 review MEDIUM 3건 fix
3 330b42e 7-source 완전 통합 + PII redact (email/token/path 누적)
4 d21467c Action Executor + L5 협의 + dedupe + PR draft 후보
5.0+5 e5ca7c5 env probe + scheduled-tasks MCP morning 9 KST (jitter)
6 bbf0e45 Self-Evolve Meta Loop (마지막 phase)
0.5 bfa9dd7 mini-fix — ledger propagation + budget + memory scope
budget b6a3d21 fork research API budget 제거 (default unlimited + env override)
chore 77e3a84 다음 세션 이어가기용 checkpoint + first run state/outputs
Codex R1-R3 fix 5dabf23 Phase 1.5a Codex pair R1-R2 finding (HIGH 2 + MEDIUM 1 + LOW 1) 적용 → R3 0 수렴

사용자 default 7건 적용

LLM 분담 (a) / CRON_TZ env-probe 분기 / status digest-only / Phase 6 rollback auto draft / state lazy / no separate Claude metric / token-normalized only — 후속 phase 진입 시 명시 override 가능.

Codex Pair Review trace

Round Phase scope finding 상태
Plan R1-R7 spec 전체 50 (HIGH/MED/LOW 누적) 100% 적용 + 0 수렴
Implement R1-R3 (Phase 0) code 14 100% 적용 + 0 수렴
Phase 1 R1-R2 code 7 (MED/LOW) 100% 적용 + 0 수렴
Phase 2 R1-R2 code 6 (MED) 100% 적용 + 0 수렴
Phase 1.5a R1 (본 PR 마지막 round) code 4 (HIGH 2 + MED 1 + LOW 1) 100% 적용
Phase 1.5a R2 code 1 (LOW FIX_PARTIAL) 적용
Phase 1.5a R3 code 0 — CONVERGED + Merge GO ✅

총 누적 64+ finding 100% 적용. Phase 1.5a R1-R3 의 핵심 fix:

  • HIGH parseSetupJson schema mismatch (codex.* → auth.*) — 정상 로그인도 NOT_LOGGED_IN 으로 잘못 degrade 되던 회귀 해소
  • HIGH auth_health.raw PII leakage 차단 — ledger 에 email 영구 보존 X
  • MEDIUM fileURLToPath() 적용 (UNC / 공백 path portability)
  • LOW real-shape integration fixture + PII redact regression test

검증

  • node --test tests/daily-evolve/*.test.mjs — 254/254 pass (lib 7 + fixture-matrix + lib-dep-rule + boundary + auth-health-check 23 + 본 PR 추가 2)
  • npm test 전체 — exit 0 (회귀 0, plan-upstream-backlog.md ## 비범위 의 3 pre-existing baseline 만 잔존)
  • node --check 모든 신규 .mjs 통과
  • lib dependency rule source-level 가드
  • runs-YYYY.json yearly boundary (2025-12-31 vs 2026-01-01) testcase
  • Phase 1.5a auth-health-check fixture: real-shape (codex/auth/sessionRuntime/nextSteps 모두 보유) + PII redact regression

변경 파일 (66 files / +69825 -28)

  • plugins/opnd-codex/scripts/daily-evolve/{source-aggregator,diff-analyzer,digest-writer,fork-research,action-executor,self-evolve}.mjs (6)
  • plugins/opnd-codex/scripts/daily-evolve/lib/*.mjs (16+)
  • plugins/opnd-codex/commands/daily-evolve.md
  • plugins/opnd-codex/scripts/codex-companion.mjs (handleDailyEvolve + lock helpers + fileURLToPath)
  • plugins/opnd-codex/skills/daily-evolve/ placeholder
  • tests/daily-evolve/*.test.mjs (22) + tests/daily-evolve/fixtures/llm/*.json
  • plugins/opnd-codex/CHANGELOG.md
  • tests/commands.test.mjs (회귀 fix — 신규 command enum 추가)
  • plan-daily-evolve-pipeline.md + plan-daily-evolve-enhancement.md + checkpoint-daily-evolve.md (SoT — Codex audit trail)

merge 전략

Squash merge 권장 (14 commits → 1 commit, clean main history). Phase 별 commit 추적은 본 PR description + checkpoint-daily-evolve.md 에 보존.

후속 enhancement 후보 (plan-daily-evolve-enhancement.md)

Phase 우선 진입 조건
3.5 source 정밀도 HIGH main merge + 며칠 운영 후
1.5b actual Codex L3 호출 HIGH 1.5a health check 통과 후
4.5 actual gh pr create --draft MEDIUM 1.5b 후
5.5 MCP 자동 등록 + DST reprobe MEDIUM 사용자 DST TZ 일 때
2.5 fork research tarball deep diff LOW 현재 sample size 충분
6.5 actual L6 합동 review LOW 7일+ 운영 누적 후

…ly digest

plan-daily-evolve-pipeline.md (Codex pair R1-R7 0 수렴) 의 Phase 0 PoC 구현.

## Component
- Source Aggregator (`scripts/daily-evolve/source-aggregator.mjs`)
  upstream openai/codex-plugin-cc 의 open/closed PR + Issue + 우리 events.jsonl
- Diff/Gap Analyzer (`diff-analyzer.mjs`)
  (verdict, signal_type) 2-축 분류. FIXED 3-evidence (CHANGELOG + touched path
  + test assertion added-line + linked PR merge fork ancestor) 모두 충족 시만
- Daily Digest Writer (`digest-writer.mjs`)
  docs/daily-evolve/{YYYY-MM-DD}.md — cognitive load metadata header +
  no_changes/failures/run_status 별도 섹션 + L4 citation pass
- 7 pure lib (verdict-schema / dedupe-key / fixed-resolver / cost-profile-registry
  / state-migrator / run-ledger / citation-check) — R2-L2 dep rule (zero IO)
- /opnd-codex:daily-evolve 수동 trigger + handleDailyEvolve companion subcommand
  + file-level advisory lock (O_EXCL + UUID token owner 검증) 으로 cron+manual race 보호

## Codex Pair 적용 (R1 + R2 + R3 = 0 수렴)
- R1 (9 finding) — race lock / FIXED 3-evidence 강화 / Levenshtein cap / cost
  공식 단일 ceil / LLM fixture matrix / reject pattern 확장 / boundary test /
  yearlyFilePath invariant / daily-evolve.md 문구
- R2 (4 finding) — lock owner UUID token 검증 / git grep word boundary
  filter / fixture consumer test 실 구현 / stdout 문구 정합
- R3 (1 LOW) — partial 시 stderr 알림 (문서-구현 정합)

## 사용자 default 7건 적용 (implement 진입 시점)
LLM 분담=(a) / CRON_TZ 분기 그대로 / status digest header only / Phase 6 rollback
auto draft / state lazy create / no separate Claude metric / token-normalized only

## 검증
- daily-evolve unit tests 95/95 pass (lib 7 + fixture-matrix 6)
- 전체 npm test 회귀 0 (3 pre-existing baseline 만 잔존)
- lib dependency rule 회귀 가드 (lib-dependency-rule.test.mjs)

Plan 의 Phase 1-6 (Codex L3 triage / Active fork + L7 / 7-source 통합 /
Action Executor + L5 / scheduled-tasks MCP / Self-Evolve) 는 후속 PR.
…st cap)

plan §Phase 1 — Codex L3 Triage Orchestrator + cognitive load metric + median
baseline cost cap.

## 추가 lib (pure, R2-L2)
- triage-metric.mjs — decision_count (3분류 별) / estimated_reading_minutes
  (CJK+ASCII word count / 200wpm) / manual_actions_required / 30min budget alert
- cost-cap.mjs — median + computeCap (baseline median × 3, initial=20) +
  appendBaseline (last 7 FIFO) + SKIP_REASONS enum (CLAUDE.md taxonomy)

## 추가 orchestrator
- codex-triage.mjs — N≥3 fan-out + cost cap + heuristic stub (Phase 1 PoC,
  actual Codex pair 호출은 Phase 1.5+):
    FIXED/WONTFIX → autonomous_safe
    QUESTION → needs_claude_judgment
    PARTIAL/NOT-FIXED → needs_user
  - state/daily-evolve-cost-baseline.json lazy create (사용자 default #5)
  - state-migrator 통합 + corrupt JSON backup `.corrupt-${ISO}.bak`
  - cap exceeded → 모두 needs_user fallback + skip_reason=cost_cap_exceeded

## 통합
- digest-writer.mjs — triageSummary inject 시 metric header (table) +
  Codex L3 Triage Summary 박스 출력. Phase 0 호환 (triageSummary 부재 시 simple metric)
- codex-companion.mjs handleDailyEvolve — `--phase 1` 시 triage 호출 +
  결과 inject. phase > 1 차단 메시지 update

## 검증
- 신규 23 unit tests (triage-metric 8 + cost-cap 8 + codex-triage 7)
- daily-evolve unit tests 95 → 118/118 pass. 회귀 0
- node --check 모든 신규/변경 .mjs 통과
- lib dependency rule guard 가 신규 lib 2개 자동 cover (readdirSync glob)

Phase 2 (Active Fork Research + L7 Codex 케이스별 가중치 조정) 대기.
- M1 phase_reached: handleDailyEvolve 의 ledger entry 의 phase_reached 가
  항상 0 으로 hard-code 되어 있었음. `phase_reached: phase` 로 변경하여
  Phase 1 실행 시 1, Phase 0 시 0 으로 정확 기록 (plan §Run Status Ledger
  schema 의 "0 | 1 | 2 | 3 | 4" 계약 준수)
- M2 reading metric 2-pass: digest-writer 의 estimateReadingMinutes 가
  cognitive load 섹션 직전까지의 markdown 만 보고 계산해 30분 budget 초과를
  놓칠 위험. placeholder 토큰 패턴으로 변경 — records 섹션까지 모두 push
  완료 후 final markdown 기준으로 metric 계산, splice 로 placeholder 위치
  replace. Phase 0 호환 유지 (triageSummary 부재 시 기존 simple metric)
- L1 cost_units_blocked: cap exceeded 시 cost_units=0 (실제 미호출 비용) 외
  cost_units_blocked 필드 추가하여 차단된 예상 비용 surface (운영 분석 시
  누락된 수요량 추적). digest-writer 에서도 cost_units_blocked 부재 시
  표시 안 함 (Phase 0/일반 경우 호환)

검증: daily-evolve unit tests 118/118 pass. 회귀 0.
Codex Phase 1 batch review (agentId a768bbc446ecff4c6) 의 MEDIUM/LOW 적용본.
plan §Phase 2 — opnd-io/opnd-codex-plugin 의 fork ecosystem 탐색, fork 별
import-candidate 추출 + Codex L7 케이스별 가중치 조정 (PoC heuristic stub).

## 추가 lib (pure, R2-L2)
- fork-ranking.mjs — 5-axis baseline score (recency 0.30 / matching 0.25 /
  unique 0.20 / diversity 0.15 / ratio 0.10) + isActive 정의 (pushed<30d /
  ahead≥5 / authors≥2 / non_vendor≥0.3 / not archived) + RENAME_MAP
  effective_after 2026-05-20 (PR #8 rename 보존) + LICENSE_WHITELIST +
  applyL7Adjustment (boost 1.3 / demote 0.7 / maintain / insufficient_info)
  + selectTopN (longest-prefix 매칭으로 sub-directory baseline cover 정확)
- fork-tarball.mjs — vendor path/file patterns + binary
  extension/size(1MB)/magic 검출 + nonVendorDiffRatio + normalizePosixPath

## 추가 orchestrator
- fork-research.mjs — gh api forks list + license filter + per-fork compare
  (budget guard ≤19 API/run) + active check + Top N=10 baseline score +
  L7 heuristic stub (boost/demote/maintain/insufficient_info, Phase 2 PoC
  — actual Codex pair 호출은 Phase 2.5+) + Top N=5 final (austerity
  mode N=3 trigger) + IMPORT-CANDIDATE record 변환

## 통합
- codex-companion.mjs handleDailyEvolve — `--phase 2` 시 forkResearch()
  호출 후 records 를 analyzed 에 append → triage → digest. phase 0/1 호환
- digest-writer.mjs — forkSummary inject 시 "Phase 2 Active Fork Research
  Summary" 박스 출력 (total / license_skipped / active / top_candidates /
  l7_calls / l7_cost_units / api_calls / n_final / austerity_mode)

## 검증
- 신규 36 unit tests (fork-ranking 18 + fork-tarball 9 + fork-research 9)
- daily-evolve unit tests 118 → 154/154 pass. 회귀 0
- longest-prefix 매칭 fix — sub-directory baseline (scripts/lib/ vs scripts/)
  정확 cover

Phase 3 (7-source 통합 — memory/Unreleased/TODO/telemetry UX) 대기.
- M1 austerity trigger: forks > 50 시 N_AUSTERITY(10→3) 축소 적용
  (Plan §L7 cost trigger). cost_units 누적 비교는 cost-cap baseline 통합
  후 Phase 2.5+
- M2 stars desc pre-sort: license filter 후 stargazers_count desc +
  pushed_at desc tie-break 정렬. budget cap 도달 시 high-value fork 우선
  enrich 보장
- M3 JSON parse silent null observability: ghApi 의 JSON.parse fail catch 가
  silent null 반환 → stderr 에 error message + stdout head 80 char 로
  shape drift 원인 추적 가능

검증: daily-evolve unit tests 154/154 pass. 회귀 0.
Codex Phase 2 batch review (agentId a7ee67eaacecb386d) 의 MEDIUM 3건 적용본.
plan §Phase 3 — memory/Unreleased/TODO/UX 4 sub-source 추가 + lib/pii-redact.

## 신규 lib (pure, R2-L2)
- pii-redact.mjs — Email RFC 5322 / GitHub PAT (ghp_*/gho_*/ghs_*/ghu_*) /
  OpenAI sk-* / Slack xox* / 40-hex / Windows `C:\Users\...` / POSIX
  `/home/...` `/Users/...` `/tmp/...` 절대경로 마스킹. <email>/<token>/<path>
  마커 (grep 친화). containsPii / redactAll / hits 카운트

## source-aggregator 4 sub-source
- readMemoryFeedback — `~/.claude/projects/.../memory/feedback_*.md` scan
  (size + mtime + 500char preview)
- readUnreleasedGap — CHANGELOG `## Unreleased` 의 백틱 path/ref ↔ fork
  코드 grep diff → 미매칭만 surface
- readStaleTodos — `(TODO|FIXME)` grep + git blame author-time, ≥30d stale
  + 100 hit cap (cost guard)
- readFailureCluster — telemetry errorMessage top 5 cluster count

## diff-analyzer signal_type 4 분류
- failure cluster → NOT-FIXED + telemetry-ux (이전 QUESTION stub 강화)
- memory feedback → QUESTION + memory-drift
- unreleased gap → PARTIAL + unreleased-gap
- stale TODO → PARTIAL + todo-stale

## digest-writer PII 통합
- record 의 surface field (preview/body/error_message/title) 모두
  redactAll 적용 후 출력. 새 record 객체 immutable (mutation 없음)
- hits 누적 카운트 (digest 향후 PII notice 활용 가능)

## companion phase 분기
- phase > 3 차단 메시지 (Phase 0-3 only)

## 검증
- 신규 8 unit tests (pii-redact): email/token/path mask + containsPii +
  multi-pattern + lastIndex reset
- daily-evolve unit tests 154 → 162/162 pass. 회귀 0

Phase 4 (Action Executor + L5 협의 + autonomous PR draft + dedupe 7d cache) 대기.
…raft 후보

plan §Phase 4 — autonomous-safe → L5 heuristic → PR candidate / needs_user
/ skip 분기. 7d dedupe cache + 5 PR 동시 cap + draft only.

## 신규 lib (pure, R2-L2)
- action-policy.mjs — L5 heuristic stub (signal_type+verdict 기반: TODO_STALE
  ≥30d→pr_draft / UNRELEASED_GAP→needs_user / TELEMETRY_UX→needs_user(HIGH)
  / MEMORY_DRIFT→needs_user(HIGH) / FORK_IMPORT_CANDIDATE→needs_user /
  upstream FIXED→skip / 그 외→skip+low) + isLive 7d TTL boundary +
  pruneCache (immutable) + buildPRBody (verdict+signal_type+L5+dedupe+rollback)
  + L5_DECISIONS / L5_SURFACE_VALUES enum

## 신규 orchestrator
- action-executor.mjs — autonomous_safe filter → L5 협의 → recordDedupeKey
  (verdict+normalized title+sorted paths sha256) 확인 → PR candidate (5 cap)
  or surface (needs_user / skip-with-value) or skip. state/daily-evolve-pr-
  cache.json lazy create + state-migrator + corrupt JSON backup. 5 cap
  초과 시 needs_user 로 strand

## 통합
- companion phase 분기 — `--phase 4` 시 actionExecute 호출 + 결과 inject.
  phase > 4 차단
- digest-writer 의 "Phase 4 Action Executor Summary" 박스 + PR draft
  candidates 목록 (dedupe_key prefix + title)

## 검증
- 신규 22 unit tests (action-policy 13 + action-executor 9)
- daily-evolve unit tests 162 → 184/184 pass. 회귀 0

Phase 4 PoC = L5 heuristic + PR candidate 까지. Actual `gh pr create --draft`
는 Phase 4.5+. Phase 5.0/5 (env probe + scheduled-tasks MCP morning 9 KST) 대기.
…ning 9 KST

plan §Phase 5.0 BLOCKING + §Phase 5 — scheduler_status decision tree +
machine TZ probe + KST 09:00 → local cron 변환 + cron fallback + opt-out.

## 신규 lib (pure, R2-L2)
- env-probe.mjs — SCHEDULER_STATUS enum (UTC_AWARE / LOCAL_TZ_ONLY /
  MCP_UNAVAILABLE / UNKNOWN) + decideSchedulerStatus decision tree +
  kstNineToLocalCron ((TARGET_UTC + offset) mod 1440 / minute fraction
  지원) + buildProbeResult + validateProbe + hasDstRisk (America/Europe/
  Pacific/Auckland true, Asia/Seoul false — DST 봄/가을 1h drift 위험 추적)

## 신규 orchestrator
- schedule-setup.mjs — probeMcpInstalled (`claude mcp list`) +
  probeCronTzSupport (Phase 5 PoC heuristic) + probeMachineTz
  (Intl.DateTimeFormat.resolvedOptions + getTimezoneOffset) +
  state/daily-evolve-env-probe.json lazy create + state-migrator 통합 +
  buildGuidance — scheduler_status 별 등록 명령 / DST 경고 / opt-out 안내
- cron-fallback.sh — install/uninstall/status. CODEX_PLUGIN_DAILY_EVOLVE_
  DISABLED opt-out guard 자동 포함. MCP_UNAVAILABLE 또는 사용자 결정 #2
  시 fallback primary

## companion 강화
- `CODEX_PLUGIN_DAILY_EVOLVE_DISABLED=1` opt-out (exit 0)
- `--probe` flag — env probe 단독 실행 (Phase 5.0 BLOCKING) + guidance stderr

## 검증
- 신규 17 unit tests (env-probe): decision tree 4 branch + cron 변환
  (KST/UTC/LA/India 30분/invalid) + validateProbe + buildProbeResult +
  hasDstRisk + enum
- daily-evolve unit tests 184 → 201/201 pass. 회귀 0

Phase 5 PoC = probe + guidance 까지. Actual MCP registration 은 사용자
manual (`claude mcp call scheduled-tasks create ...`) 또는 cron fallback
(`bash cron-fallback.sh install`).

Phase 6 (Self-Evolve Meta Loop) 대기.
plan §Phase 6 — routine 자체가 매주 self-review. heuristic 조정은 항상
PR draft + 사용자 review 후만 적용 (자동 적용 절대 X).

## 신규 lib (pure, R2-L2)
- self-evolve-policy.mjs — REVIEW_TYPE / CHANGE_TARGETS / DECISION 3 enum
  + isActionable (needs_claude_judgment 제외) + fpRate + buildAttribution
  Window (R5-M3 effective_at + decision precondition + R4-M1 14d/7d disjoint)
  + shouldRollback (1.5× + min 10 actionable) + checkLoopGuard
  (MAX_DEPTH=1 + recursive STOP — self_evolve_* target 차단) +
  shouldFireWeekly (7d trigger) + buildReviewEntry schema

## 신규 orchestrator
- self-evolve.mjs — trigger check + loop guard + telemetry 수집 (runs-YYYY
  last 2 years merge) + Phase 6 PoC stub (empty proposed_changes) +
  weekly report `docs/daily-evolve/_weekly/{YYYY-Www}.md` (ISO week
  Thursday-based) + state/daily-evolve-self-evolve-log.json lazy create

## companion
- `--self-evolve [--type weekly_normal|monthly_self_change] [--force]`
  flag — Phase 6 별도 mode. phase > 5 차단 메시지 + self-evolve 안내

## 검증
- 신규 29 unit tests (self-evolve-policy 21 + self-evolve 8)
- daily-evolve unit tests 201 → 230/230 pass. 회귀 0
- float precision boundary test 회피 (0.301 명확 초과)

## 🎉 plan-daily-evolve-pipeline.md 전 Phase 완료
- Phase 0 (PoC source 2)
- Phase 1 (Codex L3 triage heuristic stub + cost cap)
- Phase 2 (Active Fork Research + L7 가중치 조정)
- Phase 3 (7-source 완전 통합 + PII redact)
- Phase 4 (Action Executor + L5 협의 + dedupe + PR draft)
- Phase 5.0+5 (env probe + scheduled-tasks MCP + cron fallback + opt-out)
- Phase 6 (Self-Evolve Meta Loop)

후속 enhancement (Phase X.5+) — actual Codex L3/L5/L6/L7 호출, actual
gh pr create, MCP 자동 등록 — 별도 PR.
… memory scope

baseline dry-run 평가 후 발견된 3 noise/mismatch fix.

## 1. ledger decision_count + cost_units propagation
이전 hard-code `{0,0,0}` / `0` → triageResult.records 카운트 + L3/L7/L5 cost 합산
(scope hoist 로 try block 밖에서도 finalize block 접근 가능 — 이전 ReferenceError fix)

## 2. exceeds_budget 강화 (manual_actions_required 도 판정)
이전 estimated_reading_minutes 만 봐서 manual_actions 135 cognitive overload 미alert.
이제 reading 30m 초과 OR actions 60 (분당 2 결정 모델) 초과 시 ⚠ surface.
plan §defining constraint (≤30분 morning triage) 의 실제 enforcement.

## 3. memory scope 본 plugin project 만
이전 ~/.claude/projects/* 전체 scan → 다른 프로젝트 feedback 60+건 noise.
이제 cwd hash 매칭 project dir 우선, fallback 으로 plugin keyword
(codex-plugin|daily-evolve|opnd-codex|opnd-io) 포함 feedback 만.

## 결과 (실제 dry-run 검증)
- decision_count: {0,0,0} → {38, 135, 0}
- cost_units_consumed: 0 → 40
- needs_claude_judgment 60 → 0 (memory noise 제거)
- 총 records 232 → 172
- digest: `⚠ exceeds_actions_budget | true — manual 135 > 60` alert 출력 확인

## 검증
- daily-evolve unit tests 230 → 231/231 pass (manual_actions budget test 1 추가)
- 실제 dry-run (87s) 정상 + ledger entry 정확

## Phase X.5 plan 동봉
- `plan-daily-evolve-enhancement.md` — Phase 1.5/2.5/3.5/4.5/5.5/6.5 outline +
  우선순위 (3.5 HIGH source 정밀도 / 1.5 HIGH actual Codex L3 / 4.5 MEDIUM
  actual gh pr create / etc.)
…nv override)

이전 Plan §R1 HIGH-2 의 `API_BUDGET_PER_RUN = 19` 가 100 forks 중 19 만
enrich → fork sample 부족 ("오래 못 돈" 인상). 사용자 평가 후 제거.

## 변경
- API_BUDGET_PER_RUN default = Infinity (제거)
- 단 env var `CODEX_PLUGIN_FORK_API_BUDGET=N` 으로 명시 cap 가능
  (production 환경 또는 1000+ forks 안전망)
- `budget_exceeded` flag 가 Infinity 일 때 false 강제
- research_summary 에 `api_budget` 필드 추가 (default 또는 env 값 노출)
- digest-writer 의 표시 갱신 — Infinity 시 "X (unlimited — env CODEX_PLUGIN_
  FORK_API_BUDGET 으로 cap 가능)" 출력, 유한 budget 시 "X / Y budget" 그대로

## 안전성
- gh API rate limit 5000/h authenticated. 100 forks × 1 compare = 100 calls
  매우 안전. daily 1회 routine 이라 누적 무영향.
- 큰 fork 수 (1000+) 또는 forks list per_page 변경 시 사용자가 env 로 cap

## 검증 (이전 dry-run)
- 100 forks 모두 enrich (api_calls: 101)
- active fork 발견 1 → 2 (이전 budget 19 cap 으로 누락된 fork 추가 발견)
- duration 88s → 128s (40s 증가 — gh API 라운드트립)
- 회귀 0 (daily-evolve unit tests 231/231 pass)

다른 budget (Codex cost cap median × 3 / PR 5 cap / cognitive budget) 은
보호 의미 있어 유지.
… heuristic fallback

사용자 다른 session 의 Codex 만료 영향 후 enhancement 첫 step. routine 시작
시 setup --json health check + 만료 시 heuristic fallback + digest failures
첫 줄 알림 + Phase 6 expiry streak 분석 input.

## 신규 lib (pure, R2-L2)
- auth-health-check.mjs — HEALTH_STATUS 5 enum (READY/CLI_UNAVAILABLE/
  NOT_LOGGED_IN/NOT_VERIFIED/UNKNOWN) + DEGRADE_ACTION 3 enum (PROCEED/
  FALLBACK_HEURISTIC/ABORT) + parseSetupJson (string|object|null) +
  decideDegrade + buildFailureMessage (한국어 + hint) + computeExpiryStreak
  (newest first 가정, NOT_LOGGED_IN/NOT_VERIFIED 연속 카운트) +
  shouldEscalate (streak ≥ 3 → escalate). EXPIRY_STREAK_ALERT_DAYS=3.

## companion 통합
- handleDailyEvolve 진입 시 process.execPath 로 companion `setup --json`
  subprocess (timeout 10000ms) → parseSetupJson → authHealth.
- decideDegrade != PROCEED 시 stderr 알림 (status + degrade + failure msg)
- finalized.auth_health 에 entry 추가 (ledger 의 Phase 6 self-evolve input)
- writeDigest 에 authHealthFailureMessage inject

## digest-writer 통합
- authHealthFailureMessage param 추가
- hasAuthFailure flag → hasFailures 합산
- failures 섹션 첫 줄에 `⚠ ${msg}` 출력 (인증 만료 안내 + hint)

## OAuth 한계 명시
- access token: Codex CLI 자동 silent renew (refresh token 사용)
- refresh token: Codex CLI 자동 rotation (만료 시 새 토큰)
- refresh token expired/revoked: `codex login` 재실행 필요 (browser
  OAuth flow). plugin 이 사용자 대신 수행 불가 (보안 정책).
- 본 Phase 1.5a 는 health check pre-flight + degrade 까지. 사용자 알림
  후 routine 다음 실행부터 정상 복구.

## 검증
- 신규 21 unit tests (auth-health-check)
- daily-evolve unit tests 231 → 252/252 pass. 회귀 0
- 실제 dry-run (사용자 환경 만료 상태): stderr 정확 메시지 출력
  `[daily-evolve] auth health: not_logged_in — degrade=fallback_heuristic
   (Codex auth health: 인증 만료 — \`codex logout && codex login\` 후
   다음 routine 부터 정상 복구)`

## 후속
- Phase 1.5b — actual L3 Codex 호출 시 degrade 활용 (heuristic fallback path)
- Phase 6.5 — expiry streak ≥ 3 시 별도 알림 task 자동 등록
- enhancement plan §Phase 1.5 spec 강화 별도 commit
## 본 commit 의 목적
사용자 명시 "다른 세션에서 이어갈 수 있게 작업 및 세션 정리". Codex CLI
refresh token expired/revoked 상태 — Codex pair batch review + main 머지
미수행 중. 다음 세션이 이어갈 수 있게 state + checkpoint.

## 추가
- checkpoint-daily-evolve.md — 다음 세션 가이드 (현재 상태 / 차단 사유 /
  step-by-step action / Codex pair prompt 별첨 / 사용자 발언 인용 / risk)
- docs/daily-evolve/2026-05-28.md — 첫 dry-run digest (FULL git tracked
  per 사용자 #1)
- docs/daily-evolve/_weekly/2026-W22.md — self-evolve --force 시연 weekly report
- docs/upstream-tracking/2026-05-28/raw.json — 7-source raw cache
- state/daily-evolve-runs-2026.json — run ledger (initial entries)
- state/daily-evolve-cost-baseline.json — Codex cost median baseline
- state/daily-evolve-pr-cache.json — PR dedupe 7d cache (initial empty)
- state/daily-evolve-self-evolve-log.json — Phase 6 weekly review log

## 다음 세션 진입 가이드 (1줄)
`git checkout feat/daily-evolve-pipeline && cat checkpoint-daily-evolve.md`
R1 HIGH 2 + MEDIUM 1 + LOW 1, R2 LOW FIX_PARTIAL → R3 CONVERGED.

## HIGH #1 — parseSetupJson schema mismatch
- lib/auth-health-check.mjs L41-L103: JSDoc schema 실제 setup --json shape
  으로 갱신 (`codex: {available, detail}` + `auth: {available, loggedIn,
  verified, detail, authMethod, source}`)
- parsed.codex.loggedIn/verified → auth.loggedIn/verified 교정
- codex.available 만 CLI_UNAVAILABLE 판정 유지
- 영향: 정상 로그인도 NOT_LOGGED_IN 으로 잘못 degrade 되던 회귀 해소

## HIGH #2 — auth_health.raw PII leakage
- parseSetupJson 의 모든 return 에서 raw: parsed 제거
- 효과: codex-companion.mjs handleDailyEvolve 의 finalized.auth_health =
  authHealth 가 ledger 에 저장 시 auth.detail (ChatGPT login active for
  {email}) PII 가 더 이상 영구 보존되지 않음

## MEDIUM — fileURLToPath() 적용
- codex-companion.mjs L2793-L2802 handleDailyEvolve 의 subprocess argv 구성:
  import.meta.url.replace() 정규식 체인 → fileURLToPath(import.meta.url)
- 효과: UNC / 공백 path portability + dead code 제거

## LOW — real-shape integration fixture
- tests/daily-evolve/auth-health-check.test.mjs:
  - 기존 6 fixture 의 codex: {loggedIn, verified} → 실제 schema (codex: {available}, auth: {loggedIn, verified}) normalize
  - 추가 test: "parseSetupJson — raw 필드 제거 (PII leakage 차단)" — anonymized real-shape 입력 시 raw 부재 + details serialize 시 PII 누설 안 됨
  - 추가 test: "parseSetupJson — real-shape with extra fields → 정상 처리 (R1 LOW regression)" — node/npm/sessionRuntime/nextSteps 같은 추가 필드 robust 검증
  - R2 LOW FIX_PARTIAL fix: CLI_UNAVAILABLE / NOT_LOGGED_IN fixture 에 verified 필드 명시 (full schema 일관성)

## 검증
- node --test tests/daily-evolve/auth-health-check.test.mjs: 23/23 pass
- npm test 전체: 회귀 0 (exit 0)
- Codex pair R1 (a838b13ee29406639) → R2 (aaf4c8ef50122b1da) → R3 (a2a0a860aa55152c4) CONVERGED, Merge GO
@tgkim-openerd tgkim-openerd changed the title feat(daily-evolve): Phase 0 PoC — upstream PR/Issue + telemetry → daily digest feat(daily-evolve): self-evolution pipeline (Phase 0~6 + 1.5a + budget) — Codex pair R1-R3 0 수렴 May 28, 2026
@tgkim-openerd
tgkim-openerd merged commit 495b6e4 into main May 28, 2026
@tgkim-openerd
tgkim-openerd deleted the feat/daily-evolve-pipeline branch May 28, 2026 06:55
tgkim-openerd added a commit that referenced this pull request May 28, 2026
…dact (Codex pair R1-R4 0 수렴) (#3)

* docs: /analyze Recommendations + /doc-sync apply + setup advisory disclaimer

/analyze 본 PR #1 merge 직후 Recommendations 5건 평가:
- HIGH #1 setup advisory false-positive: 유효 — 본 chore 에서 처리 (아래)
- HIGH #2 root markdown 정책: false-positive (checkpoint § Personal scratch 정책 의도 분리)
- MEDIUM #1 test count drift: false-positive (sub-agent 가 22 파일수 ↔ 254 케이스수 혼동)
- MEDIUM #2 retry 전략: 이미 Phase 1.5a 에서 구현
- MEDIUM #3 Hook 커버리지: upstream Codex CLI design choice, Phase 7+ 영역

/doc-sync 4 agent (3 Explore + 1 Codex) 분석 결과 적용:

## README.md — What You Get 누락 3 commands 추가
- /opnd-codex:rescue (background-capable Codex rescue subagent 위임)
- /opnd-codex:daily-evolve (self-evolution pipeline Phase 0-6 onboarding)
- /opnd-codex:setup (readiness probe + stop-review-gate toggle)
근거: ls plugins/opnd-codex/commands/*.md = 13개, README list 는 10개 만 명시 (3 stale)

## plugins/opnd-codex/commands/daily-evolve.md — Phase 0-6 전체 rewrite
- description: "Phase 0 PoC" → "Phase 0-6"
- argument-hint: --probe / --self-evolve [--type --force] 추가
- 본문: Pipeline phases 표 (Phase 0/1/1.5a auto/2/3/4/5/6 별도 mode)
- Flags 섹션 (모든 flag)
- Output 위치 + 자동 routine 설명
근거: codex-companion.mjs handleDailyEvolve L2738-L2768 의 실제 flag 처리 (--phase 0-5 / --probe / --self-evolve --type --force)

## CLAUDE.md (신규) — 좁은 6 섹션
- Plugin home 격리 (auth sync 정책) — 본 세션 발견 root cause + 복구 절차
- daily-evolve state 추적 정책 (사용자 결정 #1)
- commands/*.md ↔ companion phase gate 동기 갱신
- lib pure 정책 (R2-L2 dep rule)
- Codex pair iteration 정책 (high-risk PR 만 R1-R3 0 수렴)
- Apache 2.0 fork attribution 보존
- Test 정책 (fixture schema parity)
근거: doc-sync 3 agent 중 2 agent 합의 (광범위 CLAUDE.md 불필요, 좁은 5-10줄 가치)

## plugins/opnd-codex/commands/setup.md — Advisory disclaimer 섹션 추가
- /analyze HIGH #1 fix — single-use refresh token rotation false-positive 패턴 명시
- plugin home 격리 v2.0+ 영향 명시
- CLAUDE.md "Plugin home 격리" 섹션 + plan-issue-*.md SoT 참조
- 본질 fix 는 upstream Codex CLI 영역 (setup --json 에 actual probe 추가 필요)

## plan-issue-setup-advisory-false-positive.md + plan-issue-2-additional-repro.md (신규 tracked)
- HIGH #1 의 SoT 분석 문서 commit — 사용자 gh issue 등록 후보
- 단일-use refresh token rotation hypothesis + reproduction trace

## doc-sync 보류 영역
- MEMORY.md: checkpoint-daily-evolve.md 가 이미 다음 세션 가이드 역할
- skill 보강 Pattern A (schema drift fixture) / B (plugin home credential sync) / C (Codex pair R1-R3 template): /teach 별도 (본 chore 범위 외)

* fix(docs): Codex pair R1 review 4건 적용

R1 (agentId a07a9643557460de2): HIGH 1 + MEDIUM 2 + LOW 1.

## HIGH — plan-issue-2-additional-repro.md PII redact
- L14: `[email protected]` → `<user-email-redacted>`
- 본 reproduction trace 가 실제 사용자 email 노출 → public repo tracked 시 PII 영구 보존
- 다른 plan-issue-*.md 는 grep 결과 PII 없음 (단 1 occurrence)

## MEDIUM — commands/daily-evolve.md Phase 5 문구 보정
- 기존: "Phase 4 + env probe (scheduled-tasks MCP 등록 상태 + CRON_TZ + DST handling)"
- 수정: "Phase 4 + env probe. 실제 scheduled-tasks MCP 등록은 본 명령이 수행하지 않음 — probe + scheduler_status enum + branch 별 registration guidance 만 출력. 자동 등록은 Phase 5.5+ 예정"
- 근거: schedule-setup.mjs L15 "자동 등록은 Phase 5 PoC 에선 NOT 수행 — Phase 5.5+ 에서 자동 등록" 명시
- "자동 routine" 섹션도 보정 — manual 등록 + 사용자 환경 의존성 명시

## MEDIUM — commands/setup.md disclaimer 문구 완화
- 기존: "Codex auth.json 파일의 token presence + 마지막 verification 결과 기반"
- 수정: "Codex CLI 의 setup 명령이 직전 점검 결과를 응답하는 것으로, 정확한 source (auth.json / app-server cache / 직전 probe trace) 는 codex-cli 내부 구현에 의존하며 plugin 영역 외"
- 근거: 정확한 source 가 plugin 외 영역 (Codex CLI internal) — 단순 "auth.json presence" 표현은 misleading

## LOW — README daily-evolve heading 섹션 추가
- 기존: README 의 ## Usage 섹션에 다른 모든 command 별 heading 있으나 daily-evolve 만 부재 (What You Get list 에만 추가됨)
- 수정: setup heading 뒤, Typical Flows 전에 `### /opnd-codex:daily-evolve` heading 추가 — phase 별 사용 예시 + outputs + Phase 1.5a auth health check 동작 + Phase 5 manual registration 안내 포함

## 0 수렴 목표
- HIGH PII + MEDIUM 2 + LOW 4건 모두 fix
- R2 review 에서 0 수렴 확인 후 PR 생성 + squash merge

* fix(docs): Codex pair R2 broader scan — 잔존 PII 1건 redact (scope creep, 사유 명시)

R2 review (agentId ae248119db8400939): R1 4건 모두 FIX_COMPLETE. 신규 MEDIUM 단 1건.

## Scope creep 사유

본 chore 의 원 scope = /analyze Recommendations + /doc-sync apply + setup advisory disclaimer.
docs/ultraplan/SESSION-HANDOFF.md 는 본 chore 가 새로 도입한 파일이 아니라 이전 sprint
(v2.1.0 작업) 의 산출물. CLAUDE.md § Scope Discipline 룰 ("requested scope 외 변경 금지") 와 충돌 가능.

단 다음 사유로 본 chore 에 포함 결정:
1. PII (개인 email) 노출 — 보안 우선
2. 사용자 명시 "0건 도달까지 loop" — R2 신규 finding 도 닫는 게 사용자 의도 정합
3. 동일 패턴 (개인 email redact) 의 trivial fix — 별도 PR 분리 overhead > scope creep 비용
4. R3 review 1회로 0 수렴 가능 — 효율적

## 변경
- docs/ultraplan/SESSION-HANDOFF.md L41: `[email protected]` → `<user-email-redacted>`
- 다른 PII 없음 (전체 repo grep 결과 단 1 occurrence)

* fix(docs): Codex pair R3 broader PII scan — upstream contributor email 3곳 redact

R3 review (agentId af6c0f1c621fd9d45): R2 fix complete + 신규 MEDIUM (3 곳 upstream contributor email 잔존).

## 처리 내역

3 곳 모두 `[email protected]` → `<contributor-email-redacted>`:
- docs/upstream-tracking/round5/49-fork-ref-issues.jsonl L32 (이전 분석 산출물)
- docs/upstream-tracking/round6/ref-44.jsonl L30 (이전 분석 산출물)
- docs/upstream-tracking/2026-05-28/raw.json L39148 (daily-evolve raw fetch)

## 배경

본 email 은 upstream openai/codex-plugin-cc public issue openai#273 의 reporter 가 issue body 에
명시적으로 노출한 것 — public GitHub 데이터. 우리 redact 가 upstream public 데이터 자체를
제거하지 못함. 단 다음 사유로 본 chore 에 포함:

1. PII 보안 conservative 원칙 — 본 repo public 노출 영영 보존 회피
2. 사용자 명시 "0건 도달까지 loop" — R3 finding 도 닫는 게 사용자 의도 정합
3. Codex 의 conservative 권고 따름

## 알려진 한계 (별도 backlog 필요)

raw.json 은 daily-evolve 의 자동 산출물 — 다음 routine 실행 시 upstream public issue
body 그대로 fetch 되어 PII 재도입. 영구 해결 = Phase 3 PII redact 강화:

- source-aggregator 의 raw fetch 시 email pattern auto-redact (현재는 analyzed/digest 만 redact)
- 별도 backlog (plan-daily-evolve-enhancement.md 의 Phase 3.5 source 정밀도 항목과 정합)

## 검증

- grep -c madanapallikalyan: 3 파일 모두 0
- broader tracked-file scan: 추가 real PII 0 (test fixture / generic placeholder 만 잔존)
- Codex R3 finding 모든 3 곳 cover
tgkim-openerd added a commit that referenced this pull request May 28, 2026
…ne + telemetry UX + Windows fixes (#10)

## Version bump 2.1.0 → 2.2.0 (semver minor — additive only, BREAKING 없음)

- package.json / package-lock.json / plugins/opnd-codex/.claude-plugin/plugin.json / .claude-plugin/marketplace.json 4 file version sync (scripts/bump-version.mjs 2.2.0)

## CHANGELOG release entry — 2.2.0 (2026-05-28)

본 release 의 main commits (9 PR squash):
- #1 daily-evolve pipeline Phase 0~6 + 1.5a + budget
- #3 /analyze Recommendations + /doc-sync + PII redact
- #4 broker false-negative 해소 (BROKER_BUSY_RPC_CODE + timeout 분기)
- #5 Phase A telemetry UX + setup advisory + verified-no-change
- #6 Phase B suminerProxy eval + upstream classification
- #7 Sprint 1 upstream comment body 8건
- #8 Sprint 2 openai#331 + openai#333 fix + 6 plan
- #9 Sprint 3 suminerProxy cherry-pick plan

## semver minor 정합

모두 additive (BREAKING 없음):
- 신규 daily-evolve pipeline (별도 commands/skills, 기존 영역 안 건드림)
- 신규 HEALTH_STATUS.TRANSIENT enum (existing 5 enum 보존)
- 신규 parseReviewArgv() (기존 parseArgs/parseCommandInput 보존)
- 신규 SELF_FORKS Set (fork-research 의 fork list filter — false-positive 제거만)
- 신규 inspectPluginHomeFreshness() + pluginHomeAdvisory field (additive)
- 신규 isUsageLimitError / annotateUsageLimitError (별도 helper)
- 기존 isStaleAuthCacheError pattern 확장 (backward compatible)
- broker busy / timeout 분기 추가 (catch fallback 보존)
- Windows process.mjs cmd.exe 래핑 (behavior change 가능성, e2e 검증 미완 — fork-cover 표기)

## marketplace install 즉시 가능

본 commit + 후속 push + main merge + tag v2.2.0 + gh release 후:

```bash
/plugin marketplace add opnd-io/opnd-codex-plugin
/plugin install opnd-codex@opnd-codex-plugin
/reload-plugins
/opnd-codex:setup
```

marketplace.json source = ./plugins/opnd-codex (main branch HEAD) → 사용자 install 시 v2.2.0 모든 변경 즉시 포함.

## 다음 sprint backlog (Unreleased)

- suminerProxy NDJSON event stream foundation cherry-pick (Phase 1, 3-4d)
- upstream HIGH port 6건 (openai#330 openai#345 openai#350 openai#349 openai#336 openai#295)
- quality-review-agent frontmatter description "3 영역 → 6 영역" (classifier 차단, 사용자 인가 후)
tgkim-openerd added a commit that referenced this pull request Jun 8, 2026
….2.1) (#13)

Closes #2 (fix #1). Downgrades setup verified/ready when the plugin-home auth.json is stale vs root and the home is not pinned, preventing the false-positive advisory. Follow-up: fix #2 broker self-heal (deferred).
tgkim-openerd added a commit that referenced this pull request Jun 8, 2026
…me section

issue #2 fix #1 wired plugin-home staleAuth into the setup verdict, so setup
--json now auto-downgrades auth.verified/ready (+ staleHomeAuth/verificationNote)
instead of only emitting an advisory. Document this alongside the existing manual
recovery procedure (which remains valid).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant