Skip to content

fix(recall): dedupe self-exemption text between rendered CLAUDE.md and rule file - #914

Closed
jung0han wants to merge 2 commits into
Tencent:mainfrom
dongwoo-labs:task/recall-marker-and-dedup
Closed

jung0han wants to merge 2 commits into
Tencent:mainfrom
dongwoo-labs:task/recall-marker-and-dedup

Conversation

@jung0han

@jung0han jung0han commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

변경 요약

이 PR은 렌더된 CLAUDE.md와 teamai-recall.md 규칙 파일에 영어·중국어 self-exemption 문단이 중복되는 문제만 해결합니다. CLI 명령이나 옵션은 추가하지 않습니다.

  • builtin-rules.ts에 TEAMAI_RECALL_SELF_EXEMPTION 공통 상수를 추출합니다. 문단 내용은 바꾸지 않습니다.
  • compileRecallRulesBlock(recallRulePath?)는 해당 도구에 규칙 파일이 실제 배포돼 있으면 긴 self-exemption 문단 대신 상대경로 링크를 넣습니다. 규칙 파일이 없으면 원래 본문을 inline fallback으로 유지합니다.
  • 사용자 작성 문구와 나머지 recall 정책(skip 조건, Candidate change files 안내, recall 실행 순서, Explore 경계)은 보존합니다.
  • 최초 pull에서도 링크 대상이 먼저 존재하도록 규칙 배포 후 recall 블록을 주입합니다.
  • recall-toggle.ts의 중복 주입 루프를 injectRecallBlockIntoTools 호출로 통합하고, enable 직후 갱신된 설정을 전달합니다.

기준 커밋은 upstream/main의 3a9a24a6f439ec63f4de7ed1de0a6459a6c5315b입니다. 최종 diff에서 hook-handlers.ts와 그 단위 테스트는 upstream과 동일합니다.

검증 결과

최종 소스 상태에서 실행했습니다. Node v24.9.0, npm 11.6.0, Vitest 3.2.7; dependencies는 upstream lockfile로 npm ci --no-audit --no-fund 설치했습니다.

검사 결과
npx tsc --noEmit 통과
npm run lint 통과
npm run build 통과
관련 5개 테스트 파일 155/155 통과
whitelist 실제 CLI E2E 1/1 통과
격리 HOME에서 실제 빌드 CLI pull 두 번 상대경로 링크·규칙 대상·사용자 문구 보존, 반복 결과 byte-identical

관련 테스트 명령:

npx vitest run src/__tests__/hook-handlers.test.ts src/__tests__/recall-rules.test.ts src/__tests__/builtin-rules.test.ts src/__tests__/pull-skip-sync.test.ts src/__tests__/recall-toggle.test.ts
npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/enabled-agents-whitelist.test.ts

whitelist E2E의 self-exemption 관련 assertions는 유지했습니다. 실제 CLI 검증은 self-mode, remote 없는 샘플 HOME을 사용했고, E2E의 Git remote도 로컬 fixture입니다. 외부 provider나 실제 AI 도구 세션을 검증한 것은 아닙니다.

전체 suite와 upstream baseline 비교

전체 suite를 통과했다고 주장하지 않습니다. 실행 간 변동을 포함한 실제 결과는 다음과 같습니다.

실행 통과 실패 Skip 실패 내용
이 PR, npx vitest run 1회차 5480 18 1 init.test.ts 17개 + index-import-help.test.ts 1개
이 PR, npx vitest run 2회차 5479 19 1 init.test.ts 17개 + index-codebase-help.test.ts 2개
upstream baseline, 앞선 전체 실행 5476 17 1 init.test.ts 17개
upstream baseline, 이번 전체 재실행 5475 18 1 동일 init 17개 + commands-reference.test.ts의 일시적인 /src/index.js 모듈 해석 실패 1개

Baseline은 git archive 3a9a24a6f439ec63f4de7ed1de0a6459a6c5315b로 추출한 별도 디렉터리에 같은 dependencies를 연결해 실행했습니다. 변경하지 않은 baseline의 init.test.ts도 이번에 별도로 재실행했고, 동일한 17개 실패와 36개 통과를 확인했습니다.

추가 help 실패는 테스트 환경 격리 문제와 일치합니다. upstream의 commands-reference.test.ts는 TEAMAI_COMMAND_TABLE_ONLY=1을 설정한 뒤 해제하지 않으며, index.ts는 이 값이 있으면 CLI 실행을 생략합니다. help 테스트는 import 시 CLI 실행을 기대합니다. 두 help 파일과 CLI entry는 이 PR에서 변경하지 않았습니다.

  • 두 help 파일을 정상 환경에서 별도 실행: 3/3 통과.
  • 환경 누수를 명시적으로 재현한 아래 명령: 이 PR과 수정하지 않은 upstream에서 같은 help 테스트 3개가 모두 같은 방식으로 실패.
TEAMAI_COMMAND_TABLE_ONLY=1 npx vitest run src/__tests__/index-import-help.test.ts src/__tests__/index-codebase-help.test.ts

이 제어된 재현과 baseline 전체 실행의 모듈 해석 실패는 별개 증거입니다. fresh baseline 전체 실행에서 help 실패 자체가 발생했다고 주장하지 않습니다. 집중 테스트는 안정적으로 통과했으며, 범위 밖 테스트 격리 문제는 이 PR에서 수정하지 않았습니다.

Generated with Claude Code

@jung0han

Copy link
Copy Markdown
Contributor Author

Task-claim: orch-teamai-cli badef4ec 2026-09-29T12:52:07Z

Task-claim: orch-teamai-cli badef4ec 2026-09-29T12:52:07Z
@jung0han
jung0han force-pushed the task/recall-marker-and-dedup branch from 923e851 to 1d20fe5 Compare September 29, 2026 21:57
@jung0han jung0han changed the title fix(recall): enforce final-message marker nudge + dedupe self-exemption text fix(recall): dedupe self-exemption text between rendered CLAUDE.md and rule file Sep 29, 2026
@jung0han jung0han closed this Sep 29, 2026
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