@uzysjung/agent-harness 26.149.0 → 26.151.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.ko.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/{chunk-YSW3OLH4.js → chunk-3QBHZUVB.js} +164 -66
  4. package/dist/chunk-3QBHZUVB.js.map +1 -0
  5. package/dist/index.js +397 -293
  6. package/dist/index.js.map +1 -1
  7. package/dist/trust-tier-drift.js +5 -1
  8. package/dist/trust-tier-drift.js.map +1 -1
  9. package/package.json +1 -1
  10. package/templates/CLAUDE.md +145 -164
  11. package/templates/agents/build-error-resolver.md +1 -1
  12. package/templates/agents/plan-checker.md +1 -1
  13. package/templates/agents/reviewer.md +4 -5
  14. package/templates/antigravity/AGENTS.md.template +3 -23
  15. package/templates/codex/AGENTS.md.template +5 -56
  16. package/templates/hooks/protect-files.sh +4 -0
  17. package/templates/hooks/session-start.sh +57 -3
  18. package/templates/opencode/AGENTS.md.template +4 -52
  19. package/templates/opencode/opencode.json.template +0 -8
  20. package/templates/rules/change-management.md +0 -1
  21. package/templates/rules/cli-development.md +1 -1
  22. package/templates/rules/doc-governance.md +2 -0
  23. package/templates/rules/git-policy.md +1 -1
  24. package/templates/rules/ship-checklist.md +3 -3
  25. package/templates/rules/test-policy.md +3 -8
  26. package/templates/settings.json +1 -16
  27. package/templates/skills/agent-introspection-debugging/SKILL.md +1 -1
  28. package/templates/skills/audit-harness-fit/README.md +113 -0
  29. package/templates/skills/audit-harness-fit/SKILL.md +64 -433
  30. package/templates/skills/audit-harness-fit/evals/scenarios.yaml +222 -0
  31. package/templates/skills/audit-harness-fit/references/apply.md +66 -0
  32. package/templates/skills/audit-harness-fit/references/audit.md +160 -0
  33. package/templates/skills/audit-harness-fit/references/populate.md +74 -0
  34. package/templates/skills/audit-harness-fit/references/verification.md +123 -0
  35. package/templates/skills/audit-service-gaps/SKILL.md +6 -7
  36. package/templates/skills/clear-korean-communication/SKILL.md +8 -13
  37. package/templates/skills/compaction-handoff/SKILL.md +29 -12
  38. package/templates/skills/external-model-consult/SKILL.md +13 -24
  39. package/templates/skills/model-orchestration/SKILL.md +18 -15
  40. package/templates/skills/natural-korean/SKILL.md +45 -0
  41. package/templates/skills/north-star/SKILL.md +4 -6
  42. package/templates/skills/north-star/references/roadmap-method.md +2 -2
  43. package/templates/skills/{task-brief → objective-brief}/SKILL.md +17 -18
  44. package/templates/skills/recurrence-prevention/SKILL.md +16 -16
  45. package/dist/chunk-YSW3OLH4.js.map +0 -1
  46. package/templates/agents/code-reviewer.md +0 -237
  47. package/templates/agents/security-reviewer.md +0 -108
  48. package/templates/hooks/task-brief-nudge.sh +0 -57
  49. package/templates/skills/audit-harness-fit/references/official-criteria.md +0 -367
  50. package/templates/skills/continuous-learning-v2/SKILL.md +0 -361
  51. package/templates/skills/continuous-learning-v2/agents/observer-loop.sh +0 -362
  52. package/templates/skills/continuous-learning-v2/agents/observer.md +0 -189
  53. package/templates/skills/continuous-learning-v2/agents/session-guardian.sh +0 -150
  54. package/templates/skills/continuous-learning-v2/agents/start-observer.sh +0 -252
  55. package/templates/skills/continuous-learning-v2/config.json +0 -8
  56. package/templates/skills/continuous-learning-v2/hooks/observe.sh +0 -585
  57. package/templates/skills/continuous-learning-v2/scripts/detect-project.sh +0 -322
  58. package/templates/skills/continuous-learning-v2/scripts/instinct-cli.py +0 -1956
  59. package/templates/skills/continuous-learning-v2/scripts/lib/homunculus-dir.sh +0 -31
  60. package/templates/skills/continuous-learning-v2/scripts/migrate-homunculus.sh +0 -68
  61. package/templates/skills/continuous-learning-v2/scripts/test_parse_instinct.py +0 -1420
  62. package/templates/skills/humanize-korean/SKILL.md +0 -228
  63. package/templates/skills/spec-scaling/SKILL.md +0 -89
  64. package/templates/skills/strategic-compact/SKILL.md +0 -145
  65. package/templates/skills/strategic-compact/suggest-compact.sh +0 -54
@@ -1,228 +0,0 @@
1
- ---
2
- name: humanize-korean
3
- description: 한국어 글에서 실제로 어색한 문체 문제를 진단하고, 근거가 있는 부분만 최소 수정해 자연스럽게 다듬는다. 번역투, AI 상투구, 기계적 구조, 접속사·형식명사·완곡 표현의 반복, 불필요한 영어 장식 등을 다루며 의미·사실·수치·전문용어·말투는 보존한다. "AI 티 없애줘", "자연스럽게 다듬어줘", "번역투 고쳐줘", "사람이 쓴 글처럼", "문체 진단 후 고쳐줘" 같은 요청에 사용한다.
4
- ---
5
-
6
- # Humanize Korean
7
-
8
- ## 목적
9
-
10
- 글을 많이 바꾸는 것이 목적이 아니다.
11
-
12
- **어디가 실제로 어색한지 먼저 진단하고, 왜 문제인지 근거를 잡은 뒤, 필요한 부분만 고친다.**
13
-
14
- 기본 흐름:
15
-
16
- > **진단 → 최소 수정 → 의미 검증**
17
-
18
- ---
19
-
20
- ## 핵심 원칙
21
-
22
- 1. **진단 없이 전면 재작성하지 않는다.**
23
- 2. **문제로 확인된 부분만 수정한다.**
24
- 3. **표현 하나가 존재한다는 이유만으로 AI 티라고 판단하지 않는다.**
25
- 4. **사실·주장·수치·고유명사·인용·전문용어·논리관계는 보존한다.**
26
- 5. **장르와 말투(register)를 유지한다.**
27
- 6. **원문에 없던 주장·근거·감정·비유·상투구를 추가하지 않는다.**
28
- 7. **이미 자연스러운 문장은 그대로 둔다.**
29
-
30
- ---
31
-
32
- ## 1. 진단
33
-
34
- 글 전체를 먼저 읽고 **체감되는 문제만 최대 3~6개** 고른다.
35
-
36
- 각 finding에는 반드시 다음이 있어야 한다.
37
-
38
- - **문제**: 무엇이 어색한가
39
- - **근거**: 실제 표현 또는 반복되는 구조
40
- - **영향**: 왜 글이 번역투·기계적·과장된 느낌을 주는가
41
- - **수정 방향**: 어떻게 고칠 것인가
42
-
43
- 다음 중 하나에도 해당하지 않으면 문제로 올리지 않는다.
44
-
45
- - 한국어 문장으로 명백히 부자연스럽다.
46
- - 같은 표현이나 문형이 반복돼 기계적인 리듬을 만든다.
47
- - 내용보다 형식·수사 장치가 앞선다.
48
- - 불필요하게 간접적이어서 의미 전달을 약하게 만든다.
49
- - 장르·독자·목적에 맞지 않는다.
50
-
51
- ### 우선순위
52
-
53
- - **P1**: 의미 전달을 방해하는 번역투·비문·직역, 반복되는 강한 상투구
54
- - **P2**: 반복될 때 거슬리는 접속사·완곡 표현·형식명사·영어 병기·기계적 구조
55
- - **P3**: 취향 차이 수준의 표현
56
-
57
- P3만 있다면 **큰 문제 없음**으로 판단하고 과도하게 수정하지 않는다.
58
-
59
- ---
60
-
61
- ## 2. 주요 진단 관점
62
-
63
- 아래는 탐지 목록이 아니라 **판단 관점**이다. 존재 자체가 아니라 문맥과 반복을 본다.
64
-
65
- ### 번역투·직역
66
-
67
- 예:
68
- - "~에 있어서", "~와 관련하여"처럼 불필요하게 긴 연결
69
- - "~에 의해" 중심의 부자연스러운 피동
70
- - "판단되어진다" 같은 이중 피동
71
- - "경쟁력을 가지고 있다", "회의를 가지다" 같은 직역
72
- - "~에서의", "~으로의"처럼 조사가 겹쳐 무거운 문장
73
- - "~에 대해", "~를 통해", "~을 기반으로"가 만능 연결어처럼 반복되는 경우
74
-
75
- 수정:
76
- - 주어·목적어·동사를 직접 연결한다.
77
- - 명사화보다 자연스러운 동사형을 우선한다.
78
- - 피동은 필요한 경우만 유지한다.
79
- - 긴 수식은 필요할 때만 나눈다.
80
-
81
- ### AI 상투구·과장
82
-
83
- 예:
84
- - "결론적으로", "요약하면", "정리하자면"
85
- - "시사하는 바가 크다", "주목할 만하다"
86
- - "크게 세 가지로 나눌 수 있다"
87
- - 근거 없는 "혁신적", "획기적", "압도적"
88
- - "~할 때다", "X를 넘어 Y로" 같은 공식형 표현의 반복
89
-
90
- 수정:
91
- - 라벨을 지우고 내용을 직접 말한다.
92
- - 중요하다고 설명하지 말고 이유나 사실을 남긴다.
93
- - 과장 수식은 삭제하거나 구체 근거가 있을 때만 유지한다.
94
-
95
- ### 기계적인 구조
96
-
97
- 예:
98
- - "첫째/둘째/셋째"가 필요 이상으로 반복
99
- - 모든 문단이 같은 방식으로 시작·종결
100
- - "A가 아니라 B", "A인가 B인가" 같은 대구의 반복
101
- - 불필요한 불릿·헤딩·볼드·이모지·따옴표
102
-
103
- 수정:
104
- - 정보 구조에 실제로 도움이 되는 목록과 헤딩은 보존한다.
105
- - 장식용 구조와 반복되는 문형만 줄인다.
106
- - 보고서·기술 문서의 구조를 억지로 산문화하지 않는다.
107
-
108
- ### 간접 표현·반복
109
-
110
- 예:
111
- - 문장마다 "또한", "따라서", "즉", "나아가"로 시작
112
- - "이 점에서", "이 관점에서", "이는"의 반복
113
- - "~라는 것이다", "~라는 점이다", "~할 필요가 있다"의 반복
114
- - 같은 종결어미·문장 구조가 길게 연속
115
-
116
- 수정:
117
- - 문맥으로 충분한 연결어는 삭제한다.
118
- - 형식명사를 걷어내고 핵심 동사로 직접 쓴다.
119
- - 반복되는 구조만 자연스럽게 분산한다.
120
- - 리듬을 만들기 위해 문장 길이나 종결어미를 인위적으로 조작하지 않는다.
121
-
122
- ### 영어·전문용어
123
-
124
- - 같은 용어의 한글/영어 병기를 반복하지 않는다.
125
- - 불필요한 buzzword는 줄인다.
126
- - API, LLM, GPU, prompt처럼 업계에서 원어가 자연스러운 용어는 유지한다.
127
- - 전문용어를 억지로 한국어화하지 않는다.
128
-
129
- ---
130
-
131
- ## 자동으로 문제라고 보지 말 것
132
-
133
- 다음은 **그 자체로 AI 티가 아니다.**
134
-
135
- - "~를 통해"
136
- - "~할 수 있다"
137
- - "~것이다"
138
- - "~적", "~성", "~화"
139
- - 피동문
140
- - 불릿과 헤딩
141
- - 볼드와 대시
142
- - 영어 전문용어
143
- - 격식 있는 문체
144
- - 비슷한 길이의 문장
145
-
146
- **반복·밀도·문맥·장르상 실제 문제가 있을 때만 수정한다.**
147
-
148
- 특히 금지:
149
-
150
- - 패턴 매칭만으로 정상 문장 수정
151
- - 모든 피동을 능동으로 변경
152
- - 모든 불릿을 산문으로 변경
153
- - 모든 영어를 번역
154
- - 가능성 표현을 임의로 단정
155
- - 문장 길이를 일부러 들쭉날쭉하게 만들기
156
- - 감탄·반문·구어체를 새로 넣어 "사람처럼" 보이게 만들기
157
- - 원문보다 더 문학적이거나 더 격식 있게 만들기
158
-
159
- ---
160
-
161
- ## 3. 수정
162
-
163
- P1부터 고치고, P2는 실제로 반복이 거슬리는 범위까지만 고친다.
164
-
165
- 기본 수정 단위는 **표현 또는 문장**이다.
166
-
167
- 우선순위:
168
-
169
- 1. 불필요한 표현 삭제
170
- 2. 직접적인 한국어 구문으로 단순화
171
- 3. 반복되는 표현 분산
172
- 4. 필요한 경우에만 문장 분리·병합
173
- 5. 마지막으로 어휘 교체
174
-
175
- 문단 전체 재작성은 최소화한다.
176
-
177
- ---
178
-
179
- ## 4. 의미 검증
180
-
181
- 수정 후 반드시 원문과 다시 대조한다.
182
-
183
- 확인:
184
-
185
- - 정보가 빠지거나 새로 생기지 않았는가
186
- - 사실·수치·고유명사·인용이 유지됐는가
187
- - 인과·조건·부정/긍정이 바뀌지 않았는가
188
- - 가능성·추정의 강도가 달라지지 않았는가
189
- - 장르와 말투가 유지됐는가
190
- - 처음 진단한 문제가 실제로 줄었는가
191
- - 문제 없던 부분까지 과도하게 다시 쓰지 않았는가
192
- - 수정하면서 새로운 상투구나 과장을 만들지 않았는가
193
-
194
- 문제가 생긴 수정은 전체를 다시 쓰지 말고 **해당 edit만 롤백**한다.
195
-
196
- ---
197
-
198
- ## 출력
199
-
200
- 기본 출력:
201
-
202
- ### 진단
203
- 최대 3~6개.
204
-
205
- | 우선순위 | 문제 | 근거 | 수정 방향 |
206
- |---|---|---|---|
207
- | P1/P2 | 문제 유형 | 실제 표현 또는 반복 구조 | 수정 원칙 |
208
-
209
- 문제가 거의 없으면 표를 억지로 채우지 말고 **큰 문제 없음**이라고 말한다.
210
-
211
- ### 수정본
212
- 진단을 반영한 전체 글을 제공한다.
213
-
214
- - 사용자가 **진단만** 요청하면 수정하지 않는다.
215
- - 사용자가 **결과만** 요청하면 진단은 내부적으로 수행하고 수정본만 보여준다.
216
- - taxonomy ID, AI 확률, 등급, 변경률 같은 메타데이터는 요청이 없으면 출력하지 않는다.
217
-
218
- ---
219
-
220
- ## 성공 기준
221
-
222
- 좋은 결과는 많이 바뀐 글이 아니다.
223
-
224
- - 무엇이 문제였는지 설명할 수 있다.
225
- - 모든 수정에 원문 근거가 있다.
226
- - 핵심 문제는 줄고 글의 목적·개성·말투는 유지된다.
227
- - 원문에 없던 정보나 수사가 생기지 않는다.
228
- - 이미 좋았던 부분은 거의 그대로다.
@@ -1,89 +0,0 @@
1
- ---
2
- name: spec-scaling
3
- description: "Detects when SPEC.md or PRD.md exceeds 300 lines and proposes feature-based splitting with a master route document. Use when SPEC.md grows too large to be effectively used as a single document."
4
- ---
5
-
6
- # Spec Scaling
7
-
8
- ## When to Use
9
-
10
- SPEC.md 또는 PRD.md가 300줄을 초과했을 때 자동 트리거.
11
-
12
- ## Process
13
-
14
- 1. 현재 SPEC.md/PRD.md의 줄 수를 확인한다.
15
- 2. 300줄 초과 시 기능별 분리를 제안한다 (SPEC와 PRD 둘 다 동일 패턴):
16
-
17
- ### SPEC 분리 (기능별)
18
- ```
19
- docs/
20
- ├── SPEC.md # 마스터 — 공통 규칙 + 각 기능 파일 라우트
21
- ├── specs/
22
- │ ├── auth.md # 인증/인가 기능 스펙
23
- │ ├── dashboard.md # 대시보드 기능 스펙
24
- │ └── payment.md # 결제 기능 스펙
25
- ```
26
-
27
- ### PRD 분리 (제품 영역별)
28
- ```
29
- docs/
30
- ├── PRD.md # 마스터 — 비전, 사용자, 큰 그림 + 영역 파일 라우트
31
- └── PRD/ # 영역별 세부 사양
32
- ├── platform-common.md # 플랫폼 공통 (인증, 권한, 인프라)
33
- ├── feature-screener.md # 스크리너 영역
34
- ├── feature-portfolio.md # 포트폴리오 영역
35
- └── feature-simulator.md # 시뮬레이터 영역
36
- ```
37
-
38
- > 도메인 비종속 구조. 본 패턴에서는 `docs/PRD/` 하위에 위치.
39
- > 두 패턴 모두 **마스터 = 인덱스 + 공통**, **하위 = 독립 참조 가능 단위** 원칙.
40
-
41
- 3. 마스터 SPEC.md 구조:
42
-
43
- ```markdown
44
- # SPEC: [프로젝트명]
45
-
46
- ## 공통 규칙
47
- [전체 적용 Boundaries, Tech Stack, DO NOT CHANGE]
48
-
49
- ## 기능별 스펙
50
- - [인증/인가](specs/auth.md)
51
- - [대시보드](specs/dashboard.md)
52
- - [결제](specs/payment.md)
53
- ```
54
-
55
- 4. 마스터 PRD.md 구조:
56
-
57
- ```markdown
58
- # PRD: [프로젝트명]
59
-
60
- ## 1. 비전 / Personas / NSM
61
- [North Star 요약 (없으면 생략)]
62
-
63
- ## 2. 영역별 사양
64
- - [Platform Common](PRD/platform-common.md) — 인증/권한/인프라
65
- - [Feature: Screener](PRD/feature-screener.md)
66
- - [Feature: Portfolio](PRD/feature-portfolio.md)
67
-
68
- ## 3. 영역 간 의존성
69
- - Screener → Portfolio (선택 결과 전달)
70
- - All → Platform Common (인증 의존)
71
- ```
72
-
73
- 5. **인간 승인 후에만 분리 실행**. 자동 분리 금지.
74
-
75
- ## Rules
76
-
77
- - 공통 규칙(Boundaries, Tech Stack, DO NOT CHANGE)은 마스터에 유지.
78
- - 각 하위 파일은 독립적으로 참조 가능해야 한다 — 다른 파일을 읽지 않아도 의미 통해야 함.
79
- - 영역/기능 간 의존성은 마스터에 명시.
80
- - 분리 후 기존 SPEC.md/PRD.md는 마스터로 변환 (삭제 아님).
81
- - 하위 파일도 다시 300줄 초과하면 sub-area로 추가 분리 (재귀 적용).
82
-
83
- ## When to Split SPEC vs PRD
84
-
85
- | 경우 | 분리 대상 |
86
- |------|---------|
87
- | 비즈니스 맥락 / 사용자 시나리오가 큰 비중 | PRD 우선 분리 |
88
- | 기술 스펙이 핵심 (API, 데이터 모델, AC) | SPEC 우선 분리 |
89
- | 둘 다 큰 경우 | PRD를 영역별로, SPEC를 기능별로 (서로 cross-link) |
@@ -1,145 +0,0 @@
1
- ---
2
- name: strategic-compact
3
- description: Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
4
- origin: ECC
5
- ---
6
-
7
- # Strategic Compact Skill
8
-
9
- Suggests manual `/compact` at strategic points in your workflow rather than relying on arbitrary auto-compaction.
10
-
11
- ## When to Activate
12
-
13
- - Running long sessions that approach context limits (200K+ tokens)
14
- - Working on multi-phase tasks (research → plan → implement → test)
15
- - Switching between unrelated tasks within the same session
16
- - After completing a major milestone and starting new work
17
- - When responses slow down or become less coherent (context pressure)
18
-
19
- ## Why Strategic Compaction?
20
-
21
- Auto-compaction triggers at arbitrary points:
22
- - Often mid-task, losing important context
23
- - No awareness of logical task boundaries
24
- - Can interrupt complex multi-step operations
25
-
26
- Strategic compaction at logical boundaries:
27
- - **After exploration, before execution** — Compact research context, keep implementation plan
28
- - **After completing a milestone** — Fresh start for next phase
29
- - **Before major context shifts** — Clear exploration context before different task
30
-
31
- ## How It Works
32
-
33
- The `suggest-compact.sh` script runs on PreToolUse (Write|Edit) and:
34
-
35
- 1. **Tracks tool calls** — Counts tool invocations in session
36
- 2. **Threshold detection** — Suggests at configurable threshold (default: 50 calls)
37
- 3. **Periodic reminders** — Reminds every 25 calls after threshold
38
-
39
- ## Hook Setup
40
-
41
- **The harness wires this for you** — installing this skill also writes the hook into the project's
42
- `.claude/settings.json`. Do not paste the block below on top of that; two registrations mean the
43
- counter advances twice per tool call and the suggestion fires at half the threshold.
44
-
45
- What the installer writes, for reference (project scope, alongside `protect-files.sh` on the same
46
- matcher):
47
-
48
- ```json
49
- {
50
- "hooks": {
51
- "PreToolUse": [
52
- {
53
- "matcher": "Write|Edit",
54
- "hooks": [
55
- {
56
- "type": "command",
57
- "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/skills/strategic-compact/suggest-compact.sh\"",
58
- "async": true,
59
- "timeout": 5
60
- }
61
- ]
62
- }
63
- ]
64
- }
65
- }
66
- ```
67
-
68
- Copy it only if you are wiring the skill by hand outside the installer — and check the file for an
69
- existing entry first.
70
-
71
- ## Configuration
72
-
73
- Environment variables:
74
- - `COMPACT_THRESHOLD` — Tool calls before first suggestion (default: 50)
75
-
76
- ## Compaction Decision Guide
77
-
78
- Use this table to decide when to compact:
79
-
80
- | Phase Transition | Compact? | Why |
81
- |-----------------|----------|-----|
82
- | Research → Planning | Yes | Research context is bulky; plan is the distilled output |
83
- | Planning → Implementation | Yes | Plan is in TodoWrite or a file; free up context for code |
84
- | Implementation → Testing | Maybe | Keep if tests reference recent code; compact if switching focus |
85
- | Debugging → Next feature | Yes | Debug traces pollute context for unrelated work |
86
- | Mid-implementation | No | Losing variable names, file paths, and partial state is costly |
87
- | After a failed approach | Yes | Clear the dead-end reasoning before trying a new approach |
88
-
89
- ## What Survives Compaction
90
-
91
- Understanding what persists helps you compact with confidence:
92
-
93
- | Persists | Lost |
94
- |----------|------|
95
- | CLAUDE.md instructions | Intermediate reasoning and analysis |
96
- | TodoWrite task list | File contents you previously read |
97
- | Memory files (`~/.claude/memory/`) | Multi-step conversation context |
98
- | Git state (commits, branches) | Tool call history and counts |
99
- | Files on disk | Nuanced user preferences stated verbally |
100
-
101
- ## Best Practices
102
-
103
- 1. **Compact after planning** — Once plan is finalized in TodoWrite, compact to start fresh
104
- 2. **Compact after debugging** — Clear error-resolution context before continuing
105
- 3. **Don't compact mid-implementation** — Preserve context for related changes
106
- 4. **Read the suggestion** — The hook tells you *when*, you decide *if*
107
- 5. **Write before compacting** — Save important context to files or memory before compacting
108
- 6. **Use `/compact` with a summary** — Add a custom message: `/compact Focus on implementing auth middleware next`
109
-
110
- ## Token Optimization Patterns
111
-
112
- ### Trigger-Table Lazy Loading
113
- Instead of loading full skill content at session start, use a trigger table that maps keywords to skill paths. Skills then cost their descriptor while resident and their body only when triggered. How much that saves depends entirely on which skills you have installed — measure yours with `npm run cost:report` rather than assuming a ratio:
114
-
115
- | Trigger | Skill | Load When |
116
- |---------|-------|-----------|
117
- | "test", "tdd", "coverage" | tdd-workflow | User mentions testing |
118
- | "security", "auth", "xss" | security-review | Security-related work |
119
- | "deploy", "ci/cd" | deployment-patterns | Deployment context |
120
-
121
- ### Context Composition Awareness
122
- Monitor what's consuming your context window:
123
- - **CLAUDE.md files** — Always loaded, keep lean
124
- - **Loaded skills** — Each skill adds 1-5K tokens
125
- - **Conversation history** — Grows with each exchange
126
- - **Tool results** — File reads, search results add bulk
127
-
128
- ### Duplicate Instruction Detection
129
- Common sources of duplicate context:
130
- - Same rules in both `~/.claude/rules/` and project `.claude/rules/`
131
- - Skills that repeat CLAUDE.md instructions
132
- - Multiple skills covering overlapping domains
133
-
134
- ### Context Optimization Tools
135
- - `token-optimizer` MCP — content deduplication
136
- - `context-mode` — context virtualization
137
-
138
- Both are third-party tools this harness does not ship, measure, or vouch for. Their vendors publish
139
- dramatic reduction figures; treat those as marketing until you have measured your own workload.
140
-
141
- ## Related
142
-
143
- - [The Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) — Token optimization section
144
- - Memory persistence hooks — For state that survives compaction
145
- - `continuous-learning-v2` skill — observes sessions into instincts (v1 was deprecated upstream)
@@ -1,54 +0,0 @@
1
- #!/bin/bash
2
- # Strategic Compact Suggester
3
- # Runs on PreToolUse or periodically to suggest manual compaction at logical intervals
4
- #
5
- # Why manual over auto-compact:
6
- # - Auto-compact happens at arbitrary points, often mid-task
7
- # - Strategic compacting preserves context through logical phases
8
- # - Compact after exploration, before execution
9
- # - Compact after completing a milestone, before starting next
10
- #
11
- # Hook config (in ~/.claude/settings.json):
12
- # {
13
- # "hooks": {
14
- # "PreToolUse": [{
15
- # "matcher": "Edit|Write",
16
- # "hooks": [{
17
- # "type": "command",
18
- # "command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
19
- # }]
20
- # }]
21
- # }
22
- # }
23
- #
24
- # Criteria for suggesting compact:
25
- # - Session has been running for extended period
26
- # - Large number of tool calls made
27
- # - Transitioning from research/exploration to implementation
28
- # - Plan has been finalized
29
-
30
- # Track tool call count (increment in a temp file)
31
- # Use CLAUDE_SESSION_ID for session-specific counter (not $$ which changes per invocation)
32
- SESSION_ID="${CLAUDE_SESSION_ID:-${PPID:-default}}"
33
- COUNTER_FILE="/tmp/claude-tool-count-${SESSION_ID}"
34
- THRESHOLD=${COMPACT_THRESHOLD:-50}
35
-
36
- # Initialize or increment counter
37
- if [ -f "$COUNTER_FILE" ]; then
38
- count=$(cat "$COUNTER_FILE")
39
- count=$((count + 1))
40
- echo "$count" > "$COUNTER_FILE"
41
- else
42
- echo "1" > "$COUNTER_FILE"
43
- count=1
44
- fi
45
-
46
- # Suggest compact after threshold tool calls
47
- if [ "$count" -eq "$THRESHOLD" ]; then
48
- echo "[StrategicCompact] $THRESHOLD tool calls reached - consider /compact if transitioning phases" >&2
49
- fi
50
-
51
- # Suggest at regular intervals after threshold
52
- if [ "$count" -gt "$THRESHOLD" ] && [ $((count % 25)) -eq 0 ]; then
53
- echo "[StrategicCompact] $count tool calls - good checkpoint for /compact if context is stale" >&2
54
- fi