oh-my-customcode 0.35.2 → 0.36.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.
- package/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +20 -0
- package/templates/.claude/hooks/scripts/content-hash-validator.sh +73 -0
- package/templates/.claude/rules/SHOULD-memory-integration.md +7 -10
- package/templates/CLAUDE.md.en +5 -3
- package/templates/CLAUDE.md.ko +5 -3
- package/templates/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -62,6 +62,16 @@
|
|
|
62
62
|
],
|
|
63
63
|
"description": "Suggest manual compaction at logical intervals"
|
|
64
64
|
},
|
|
65
|
+
{
|
|
66
|
+
"matcher": "tool == \"Edit\"",
|
|
67
|
+
"hooks": [
|
|
68
|
+
{
|
|
69
|
+
"type": "command",
|
|
70
|
+
"command": "bash .claude/hooks/scripts/content-hash-validator.sh"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"description": "Validate file content hash before Edit — advisory staleness warning"
|
|
74
|
+
},
|
|
65
75
|
{
|
|
66
76
|
"matcher": "tool == \"Task\" || tool == \"Agent\"",
|
|
67
77
|
"hooks": [
|
|
@@ -212,6 +222,16 @@
|
|
|
212
222
|
],
|
|
213
223
|
"description": "Context budget advisor — track tool usage patterns and advise ecomode activation"
|
|
214
224
|
},
|
|
225
|
+
{
|
|
226
|
+
"matcher": "tool == \"Read\"",
|
|
227
|
+
"hooks": [
|
|
228
|
+
{
|
|
229
|
+
"type": "command",
|
|
230
|
+
"command": "bash .claude/hooks/scripts/content-hash-validator.sh"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"description": "Store content hashes for Read operations — enables Edit staleness detection"
|
|
234
|
+
},
|
|
215
235
|
{
|
|
216
236
|
"matcher": "tool == \"Edit\" || tool == \"Write\" || tool == \"Bash\" || tool == \"Task\" || tool == \"Agent\"",
|
|
217
237
|
"hooks": [
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Content-Hash Validator — Detect stale file state for Edit operations
|
|
3
|
+
# Trigger: PostToolUse on Read (stores hashes), PreToolUse on Edit (validates)
|
|
4
|
+
# Purpose: Advisory warning when file content changed between Read and Edit
|
|
5
|
+
# Protocol: stdin JSON -> validate -> stdout pass-through
|
|
6
|
+
# Always exits 0 (advisory only, never blocks)
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
input=$(cat)
|
|
11
|
+
|
|
12
|
+
# Hash store (PPID-scoped, session-only)
|
|
13
|
+
HASH_STORE="/tmp/.claude-content-hashes-${PPID}"
|
|
14
|
+
|
|
15
|
+
tool_name=$(echo "$input" | jq -r '.tool_name // "unknown"')
|
|
16
|
+
|
|
17
|
+
case "$tool_name" in
|
|
18
|
+
"Read")
|
|
19
|
+
# Store content hash for the file that was just read
|
|
20
|
+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // ""')
|
|
21
|
+
output=$(echo "$input" | jq -r '.tool_output.output // ""')
|
|
22
|
+
|
|
23
|
+
if [ -n "$file_path" ] && [ -n "$output" ] && [ "$output" != "null" ]; then
|
|
24
|
+
content_hash=$(echo "$output" | md5 2>/dev/null || echo "$output" | md5sum 2>/dev/null | cut -d' ' -f1 || echo "unknown")
|
|
25
|
+
timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
26
|
+
|
|
27
|
+
# Store hash entry (overwrite previous for same file)
|
|
28
|
+
if [ -f "$HASH_STORE" ]; then
|
|
29
|
+
# Remove old entry for this file
|
|
30
|
+
grep -v "\"path\":\"${file_path}\"" "$HASH_STORE" > "${HASH_STORE}.tmp" 2>/dev/null || true
|
|
31
|
+
mv "${HASH_STORE}.tmp" "$HASH_STORE" 2>/dev/null || true
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
jq -cn \
|
|
35
|
+
--arg path "$file_path" \
|
|
36
|
+
--arg hash "$content_hash" \
|
|
37
|
+
--arg ts "$timestamp" \
|
|
38
|
+
'{path: $path, hash: $hash, stored_at: $ts}' >> "$HASH_STORE" 2>/dev/null || true
|
|
39
|
+
fi
|
|
40
|
+
;;
|
|
41
|
+
|
|
42
|
+
"Edit")
|
|
43
|
+
# Validate that file hasn't changed since last Read
|
|
44
|
+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // ""')
|
|
45
|
+
|
|
46
|
+
if [ -n "$file_path" ] && [ -f "$HASH_STORE" ] && [ -f "$file_path" ]; then
|
|
47
|
+
stored_hash=$(grep "\"path\":\"${file_path}\"" "$HASH_STORE" 2>/dev/null | tail -1 | jq -r '.hash // ""' 2>/dev/null || echo "")
|
|
48
|
+
|
|
49
|
+
if [ -n "$stored_hash" ] && [ "$stored_hash" != "unknown" ]; then
|
|
50
|
+
current_hash=$(md5 -q "$file_path" 2>/dev/null || md5sum "$file_path" 2>/dev/null | cut -d' ' -f1 || echo "unknown")
|
|
51
|
+
|
|
52
|
+
if [ "$current_hash" != "unknown" ] && [ "$stored_hash" != "$current_hash" ]; then
|
|
53
|
+
echo "[Content-Hash] WARNING: $(basename "$file_path") may have changed since last Read" >&2
|
|
54
|
+
echo "[Content-Hash] Stored hash: ${stored_hash:0:8}... Current: ${current_hash:0:8}..." >&2
|
|
55
|
+
echo "[Content-Hash] Advisory: re-read the file before editing if unsure" >&2
|
|
56
|
+
fi
|
|
57
|
+
fi
|
|
58
|
+
fi
|
|
59
|
+
;;
|
|
60
|
+
esac
|
|
61
|
+
|
|
62
|
+
# Ring buffer: keep last 200 entries
|
|
63
|
+
if [ -f "$HASH_STORE" ]; then
|
|
64
|
+
line_count=$(wc -l < "$HASH_STORE" 2>/dev/null || echo "0")
|
|
65
|
+
if [ "$line_count" -gt 200 ]; then
|
|
66
|
+
tail -200 "$HASH_STORE" > "${HASH_STORE}.tmp"
|
|
67
|
+
mv "${HASH_STORE}.tmp" "$HASH_STORE"
|
|
68
|
+
fi
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# Always pass through
|
|
72
|
+
echo "$input"
|
|
73
|
+
exit 0
|
|
@@ -157,7 +157,7 @@ User signals session end
|
|
|
157
157
|
3. Return formatted summary to orchestrator
|
|
158
158
|
→ Orchestrator performs MCP saves directly:
|
|
159
159
|
1. claude-mem save (if available via ToolSearch)
|
|
160
|
-
|
|
160
|
+
(episodic-memory auto-indexes after session — no action needed)
|
|
161
161
|
→ Orchestrator confirms to user
|
|
162
162
|
```
|
|
163
163
|
|
|
@@ -170,7 +170,7 @@ MCP tools (claude-mem, episodic-memory) are **orchestrator-scoped** and not inhe
|
|
|
170
170
|
| Session summary collection | sys-memory-keeper | Domain expertise in memory formatting |
|
|
171
171
|
| Native auto-memory (MEMORY.md) | sys-memory-keeper | Has Write access to memory directory |
|
|
172
172
|
| claude-mem MCP save | Orchestrator | MCP tools only available at orchestrator level |
|
|
173
|
-
| episodic-memory
|
|
173
|
+
| episodic-memory | Automatic | Conversations are auto-indexed after session ends — no manual action needed |
|
|
174
174
|
|
|
175
175
|
### Dual-System Save
|
|
176
176
|
|
|
@@ -178,7 +178,7 @@ MCP tools (claude-mem, episodic-memory) are **orchestrator-scoped** and not inhe
|
|
|
178
178
|
|--------|-------|------|--------|----------|
|
|
179
179
|
| Native auto-memory | sys-memory-keeper | Write | Update MEMORY.md with session learnings | Yes |
|
|
180
180
|
| claude-mem | Orchestrator | `mcp__plugin_claude-mem_mcp-search__save_memory` | Save session summary with project, tasks, decisions | No (best-effort) |
|
|
181
|
-
| episodic-memory |
|
|
181
|
+
| episodic-memory | Automatic | (auto-indexed) | No action needed — conversations are indexed automatically after session ends | N/A |
|
|
182
182
|
|
|
183
183
|
### Session-End Self-Check (MANDATORY)
|
|
184
184
|
|
|
@@ -194,12 +194,10 @@ MCP tools (claude-mem, episodic-memory) are **orchestrator-scoped** and not inhe
|
|
|
194
194
|
║ YES → Continue (even if it failed) ║
|
|
195
195
|
║ NO → ToolSearch + save now ║
|
|
196
196
|
║ ║
|
|
197
|
-
║
|
|
198
|
-
║
|
|
199
|
-
║ NO → ToolSearch + verify now ← THIS IS THE COMMONLY ║
|
|
200
|
-
║ SKIPPED STEP. DO NOT SKIP IT. ║
|
|
197
|
+
║ Note: episodic-memory auto-indexes conversations after session ║
|
|
198
|
+
║ ends. No manual action needed — do NOT search as "verification" ║
|
|
201
199
|
║ ║
|
|
202
|
-
║
|
|
200
|
+
║ BOTH steps must be completed before confirming to user. ║
|
|
203
201
|
║ "Attempted" means called the tool — failure is OK, skipping ║
|
|
204
202
|
║ is NOT. ║
|
|
205
203
|
╚══════════════════════════════════════════════════════════════════╝
|
|
@@ -209,5 +207,4 @@ MCP tools (claude-mem, episodic-memory) are **orchestrator-scoped** and not inhe
|
|
|
209
207
|
|
|
210
208
|
- MCP saves are **non-blocking**: memory failure MUST NOT prevent session from ending
|
|
211
209
|
- If claude-mem unavailable: skip, log warning
|
|
212
|
-
-
|
|
213
|
-
- If both unavailable: warn user, proceed with session end
|
|
210
|
+
- episodic-memory: no action needed (auto-indexed after session)
|
package/templates/CLAUDE.md.en
CHANGED
|
@@ -129,6 +129,7 @@ Violation = immediate correction. No exception for "small changes".
|
|
|
129
129
|
| R016 | Continuous Improvement | **ENFORCED** - Update rules when violations occur |
|
|
130
130
|
| R017 | Sync Verification | **ENFORCED** - Verify sync before structural changes |
|
|
131
131
|
| R018 | Agent Teams | **ENFORCED (Conditional)** - Mandatory for qualifying tasks when Agent Teams enabled |
|
|
132
|
+
| R020 | Completion Verification | **ENFORCED** - Verification required before declaring task complete |
|
|
132
133
|
|
|
133
134
|
### SHOULD (Strongly recommended)
|
|
134
135
|
| ID | Rule | Description |
|
|
@@ -157,6 +158,7 @@ Violation = immediate correction. No exception for "small changes".
|
|
|
157
158
|
| `/omcustom:update-external` | Update agents from external sources |
|
|
158
159
|
| `/omcustom:audit-agents` | Audit agent dependencies |
|
|
159
160
|
| `/omcustom:fix-refs` | Fix broken references |
|
|
161
|
+
| `/omcustom:takeover` | Extract canonical spec from existing agent/skill |
|
|
160
162
|
| `/dev-review` | Review code for best practices |
|
|
161
163
|
| `/dev-refactor` | Refactor code |
|
|
162
164
|
| `/memory-save` | Save session context to claude-mem |
|
|
@@ -184,9 +186,9 @@ project/
|
|
|
184
186
|
+-- CLAUDE.md # Entry point
|
|
185
187
|
+-- .claude/
|
|
186
188
|
| +-- agents/ # Subagent definitions (44 files)
|
|
187
|
-
| +-- skills/ # Skills (
|
|
188
|
-
| +-- rules/ # Global rules (R000-
|
|
189
|
-
| +-- hooks/ # Hook scripts (
|
|
189
|
+
| +-- skills/ # Skills (73 directories)
|
|
190
|
+
| +-- rules/ # Global rules (R000-R020)
|
|
191
|
+
| +-- hooks/ # Hook scripts (security, validation, HUD)
|
|
190
192
|
| +-- contexts/ # Context files (ecomode)
|
|
191
193
|
+-- guides/ # Reference docs (25 topics)
|
|
192
194
|
```
|
package/templates/CLAUDE.md.ko
CHANGED
|
@@ -129,6 +129,7 @@ oh-my-customcode로 구동됩니다.
|
|
|
129
129
|
| R016 | 지속적 개선 | **강제** - 위반 발생 시 규칙 업데이트 |
|
|
130
130
|
| R017 | 동기화 검증 | **강제** - 구조 변경 전 검증 |
|
|
131
131
|
| R018 | Agent Teams | **강제(조건부)** - Agent Teams 활성화 시 적합한 작업에 필수 사용 |
|
|
132
|
+
| R020 | 완료 검증 | **강제** - 작업 완료 선언 전 검증 필수 |
|
|
132
133
|
|
|
133
134
|
### SHOULD (강력 권장)
|
|
134
135
|
| ID | 규칙 | 설명 |
|
|
@@ -157,6 +158,7 @@ oh-my-customcode로 구동됩니다.
|
|
|
157
158
|
| `/omcustom:update-external` | 외부 소스에서 에이전트 업데이트 |
|
|
158
159
|
| `/omcustom:audit-agents` | 에이전트 의존성 감사 |
|
|
159
160
|
| `/omcustom:fix-refs` | 깨진 참조 수정 |
|
|
161
|
+
| `/omcustom:takeover` | 기존 에이전트/스킬에서 canonical spec 추출 |
|
|
160
162
|
| `/dev-review` | 코드 베스트 프랙티스 리뷰 |
|
|
161
163
|
| `/dev-refactor` | 코드 리팩토링 |
|
|
162
164
|
| `/memory-save` | 세션 컨텍스트를 claude-mem에 저장 |
|
|
@@ -184,9 +186,9 @@ project/
|
|
|
184
186
|
+-- CLAUDE.md # 진입점
|
|
185
187
|
+-- .claude/
|
|
186
188
|
| +-- agents/ # 서브에이전트 정의 (44 파일)
|
|
187
|
-
| +-- skills/ # 스킬 (
|
|
188
|
-
| +-- rules/ # 전역 규칙 (R000-
|
|
189
|
-
| +-- hooks/ # 훅 스크립트 (
|
|
189
|
+
| +-- skills/ # 스킬 (73 디렉토리)
|
|
190
|
+
| +-- rules/ # 전역 규칙 (R000-R020)
|
|
191
|
+
| +-- hooks/ # 훅 스크립트 (보안, 검증, HUD)
|
|
190
192
|
| +-- contexts/ # 컨텍스트 파일 (ecomode)
|
|
191
193
|
+-- guides/ # 레퍼런스 문서 (25 토픽)
|
|
192
194
|
```
|
package/templates/manifest.json
CHANGED