oh-my-customcode 0.1.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/LICENSE +21 -0
- package/README.md +287 -0
- package/dist/cli/index.js +13299 -0
- package/dist/index.js +927 -0
- package/package.json +74 -0
- package/templates/.claude/contexts/dev.md +20 -0
- package/templates/.claude/contexts/ecomode.md +63 -0
- package/templates/.claude/contexts/index.yaml +41 -0
- package/templates/.claude/contexts/research.md +28 -0
- package/templates/.claude/contexts/review.md +23 -0
- package/templates/.claude/hooks/hooks.json +185 -0
- package/templates/.claude/hooks/hud/index.yaml +27 -0
- package/templates/.claude/hooks/hud/update-status.sh +32 -0
- package/templates/.claude/hooks/index.yaml +46 -0
- package/templates/.claude/hooks/memory-persistence/pre-compact.sh +37 -0
- package/templates/.claude/hooks/memory-persistence/session-end.sh +64 -0
- package/templates/.claude/hooks/memory-persistence/session-start.sh +41 -0
- package/templates/.claude/hooks/strategic-compact/suggest-compact.sh +50 -0
- package/templates/.claude/install-hooks.sh +100 -0
- package/templates/.claude/rules/MAY-optimization.md +93 -0
- package/templates/.claude/rules/MUST-agent-design.md +107 -0
- package/templates/.claude/rules/MUST-agent-identification.md +108 -0
- package/templates/.claude/rules/MUST-continuous-improvement.md +132 -0
- package/templates/.claude/rules/MUST-intent-transparency.md +199 -0
- package/templates/.claude/rules/MUST-language-policy.md +62 -0
- package/templates/.claude/rules/MUST-orchestrator-coordination.md +266 -0
- package/templates/.claude/rules/MUST-parallel-execution.md +341 -0
- package/templates/.claude/rules/MUST-permissions.md +84 -0
- package/templates/.claude/rules/MUST-safety.md +69 -0
- package/templates/.claude/rules/MUST-sync-verification.md +219 -0
- package/templates/.claude/rules/MUST-tool-identification.md +112 -0
- package/templates/.claude/rules/SHOULD-ecomode.md +145 -0
- package/templates/.claude/rules/SHOULD-error-handling.md +102 -0
- package/templates/.claude/rules/SHOULD-hud-statusline.md +89 -0
- package/templates/.claude/rules/SHOULD-interaction.md +103 -0
- package/templates/.claude/rules/SHOULD-memory-integration.md +114 -0
- package/templates/.claude/rules/SHOULD-pipeline-mode.md +165 -0
- package/templates/.claude/rules/index.yaml +125 -0
- package/templates/.claude/uninstall-hooks.sh +52 -0
- package/templates/CLAUDE.md.en +259 -0
- package/templates/CLAUDE.md.ko +259 -0
- package/templates/agents/index.yaml +237 -0
- package/templates/agents/infra-engineer/aws-expert/AGENT.md +47 -0
- package/templates/agents/infra-engineer/aws-expert/index.yaml +27 -0
- package/templates/agents/infra-engineer/docker-expert/AGENT.md +47 -0
- package/templates/agents/infra-engineer/docker-expert/index.yaml +27 -0
- package/templates/agents/manager/creator/AGENT.md +274 -0
- package/templates/agents/manager/creator/index.yaml +66 -0
- package/templates/agents/manager/gitnerd/AGENT.md +91 -0
- package/templates/agents/manager/gitnerd/index.yaml +55 -0
- package/templates/agents/manager/sauron/AGENT.md +153 -0
- package/templates/agents/manager/sauron/index.yaml +52 -0
- package/templates/agents/manager/supplier/AGENT.md +142 -0
- package/templates/agents/manager/supplier/index.yaml +31 -0
- package/templates/agents/manager/sync-checker/AGENT.md +34 -0
- package/templates/agents/manager/sync-checker/index.yaml +32 -0
- package/templates/agents/manager/updater/AGENT.md +125 -0
- package/templates/agents/manager/updater/index.yaml +31 -0
- package/templates/agents/orchestrator/dev-lead/AGENT.md +116 -0
- package/templates/agents/orchestrator/dev-lead/index.yaml +73 -0
- package/templates/agents/orchestrator/planner/AGENT.md +102 -0
- package/templates/agents/orchestrator/planner/index.yaml +38 -0
- package/templates/agents/orchestrator/qa-lead/AGENT.md +92 -0
- package/templates/agents/orchestrator/qa-lead/index.yaml +40 -0
- package/templates/agents/orchestrator/secretary/AGENT.md +132 -0
- package/templates/agents/orchestrator/secretary/index.yaml +55 -0
- package/templates/agents/qa-team/qa-engineer/AGENT.md +98 -0
- package/templates/agents/qa-team/qa-engineer/index.yaml +59 -0
- package/templates/agents/qa-team/qa-planner/AGENT.md +75 -0
- package/templates/agents/qa-team/qa-planner/index.yaml +47 -0
- package/templates/agents/qa-team/qa-writer/AGENT.md +98 -0
- package/templates/agents/qa-team/qa-writer/index.yaml +44 -0
- package/templates/agents/sw-architect/documenter/AGENT.md +120 -0
- package/templates/agents/sw-architect/documenter/index.yaml +39 -0
- package/templates/agents/sw-architect/speckit-agent/AGENT.md +127 -0
- package/templates/agents/sw-architect/speckit-agent/index.yaml +78 -0
- package/templates/agents/sw-engineer/backend/express-expert/AGENT.md +132 -0
- package/templates/agents/sw-engineer/backend/express-expert/index.yaml +36 -0
- package/templates/agents/sw-engineer/backend/fastapi-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/backend/fastapi-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/backend/go-backend-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/backend/go-backend-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/backend/nestjs-expert/AGENT.md +107 -0
- package/templates/agents/sw-engineer/backend/nestjs-expert/index.yaml +43 -0
- package/templates/agents/sw-engineer/backend/springboot-expert/AGENT.md +103 -0
- package/templates/agents/sw-engineer/backend/springboot-expert/index.yaml +69 -0
- package/templates/agents/sw-engineer/frontend/svelte-agent/AGENT.md +71 -0
- package/templates/agents/sw-engineer/frontend/svelte-agent/index.yaml +41 -0
- package/templates/agents/sw-engineer/frontend/vercel-agent/AGENT.md +67 -0
- package/templates/agents/sw-engineer/frontend/vercel-agent/index.yaml +43 -0
- package/templates/agents/sw-engineer/frontend/vuejs-agent/AGENT.md +71 -0
- package/templates/agents/sw-engineer/frontend/vuejs-agent/index.yaml +48 -0
- package/templates/agents/sw-engineer/language/golang-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/golang-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/java21-expert/AGENT.md +122 -0
- package/templates/agents/sw-engineer/language/java21-expert/index.yaml +51 -0
- package/templates/agents/sw-engineer/language/kotlin-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/kotlin-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/python-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/python-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/rust-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/rust-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/language/typescript-expert/AGENT.md +47 -0
- package/templates/agents/sw-engineer/language/typescript-expert/index.yaml +27 -0
- package/templates/agents/sw-engineer/tooling/bun-expert/AGENT.md +73 -0
- package/templates/agents/sw-engineer/tooling/bun-expert/index.yaml +46 -0
- package/templates/agents/sw-engineer/tooling/npm-expert/AGENT.md +160 -0
- package/templates/agents/sw-engineer/tooling/npm-expert/index.yaml +45 -0
- package/templates/agents/sw-engineer/tooling/optimizer/AGENT.md +170 -0
- package/templates/agents/sw-engineer/tooling/optimizer/index.yaml +45 -0
- package/templates/agents/system/memory-keeper/AGENT.md +126 -0
- package/templates/agents/system/memory-keeper/index.yaml +45 -0
- package/templates/agents/system/naggy/AGENT.md +72 -0
- package/templates/agents/system/naggy/index.yaml +35 -0
- package/templates/commands/COMMANDS.md +136 -0
- package/templates/commands/creator/agent.md +121 -0
- package/templates/commands/dev/refactor.md +126 -0
- package/templates/commands/dev/review.md +82 -0
- package/templates/commands/git/branch.yaml +8 -0
- package/templates/commands/git/commit.yaml +4 -0
- package/templates/commands/git/pr.yaml +4 -0
- package/templates/commands/git/status.yaml +4 -0
- package/templates/commands/git/sync.yaml +4 -0
- package/templates/commands/index.yaml +225 -0
- package/templates/commands/intent/explain.md +144 -0
- package/templates/commands/memory/recall.md +164 -0
- package/templates/commands/memory/save.md +128 -0
- package/templates/commands/naggy/add.yaml +8 -0
- package/templates/commands/naggy/done.yaml +8 -0
- package/templates/commands/naggy/list.yaml +4 -0
- package/templates/commands/naggy/priority.yaml +11 -0
- package/templates/commands/naggy/remind.yaml +4 -0
- package/templates/commands/npm/audit.yaml +62 -0
- package/templates/commands/npm/publish.yaml +52 -0
- package/templates/commands/npm/version.yaml +62 -0
- package/templates/commands/optimize/analyze.yaml +34 -0
- package/templates/commands/optimize/bundle.yaml +50 -0
- package/templates/commands/optimize/report.yaml +56 -0
- package/templates/commands/pipeline/list.md +81 -0
- package/templates/commands/pipeline/run.md +127 -0
- package/templates/commands/sauron/quick.yaml +4 -0
- package/templates/commands/sauron/report.yaml +4 -0
- package/templates/commands/sauron/watch.yaml +4 -0
- package/templates/commands/supplier/audit.md +133 -0
- package/templates/commands/supplier/fix.md +121 -0
- package/templates/commands/sync/agents.yaml +4 -0
- package/templates/commands/sync/check.yaml +4 -0
- package/templates/commands/sync/commands.yaml +4 -0
- package/templates/commands/sync/docs.yaml +4 -0
- package/templates/commands/sync/fix.yaml +4 -0
- package/templates/commands/system/help.md +137 -0
- package/templates/commands/system/lists.md +86 -0
- package/templates/commands/system/status.md +163 -0
- package/templates/commands/updater/docs.md +165 -0
- package/templates/commands/updater/external.md +214 -0
- package/templates/guides/aws/common-patterns.md +169 -0
- package/templates/guides/aws/index.yaml +26 -0
- package/templates/guides/aws/well-architected.md +143 -0
- package/templates/guides/claude-code/01-overview.md +42 -0
- package/templates/guides/claude-code/03-tools.md +107 -0
- package/templates/guides/claude-code/04-agent-skills.md +90 -0
- package/templates/guides/claude-code/05-agent-sdk.md +129 -0
- package/templates/guides/claude-code/06-mcp.md +165 -0
- package/templates/guides/claude-code/07-prompt-engineering.md +100 -0
- package/templates/guides/claude-code/08-testing.md +58 -0
- package/templates/guides/claude-code/09-guardrails.md +80 -0
- package/templates/guides/claude-code/10-monitoring.md +89 -0
- package/templates/guides/claude-code/index.yaml +51 -0
- package/templates/guides/docker/compose-best-practices.md +284 -0
- package/templates/guides/docker/dockerfile-best-practices.md +262 -0
- package/templates/guides/docker/index.yaml +26 -0
- package/templates/guides/fastapi/best-practices.md +232 -0
- package/templates/guides/fastapi/index.yaml +21 -0
- package/templates/guides/go-backend/index.yaml +26 -0
- package/templates/guides/go-backend/project-layout.md +243 -0
- package/templates/guides/go-backend/uber-style.md +212 -0
- package/templates/guides/golang/concurrency.md +282 -0
- package/templates/guides/golang/effective-go.md +309 -0
- package/templates/guides/golang/error-handling.md +250 -0
- package/templates/guides/golang/index.yaml +27 -0
- package/templates/guides/index.yaml +101 -0
- package/templates/guides/kotlin/coding-conventions.md +247 -0
- package/templates/guides/kotlin/idioms.md +234 -0
- package/templates/guides/kotlin/index.yaml +26 -0
- package/templates/guides/python/index.yaml +26 -0
- package/templates/guides/python/pep8-style-guide.md +202 -0
- package/templates/guides/python/zen-of-python.md +79 -0
- package/templates/guides/rust/error-handling.md +262 -0
- package/templates/guides/rust/index.yaml +26 -0
- package/templates/guides/rust/ownership.md +180 -0
- package/templates/guides/springboot/best-practices.md +361 -0
- package/templates/guides/springboot/index.yaml +22 -0
- package/templates/guides/typescript/advanced-types.md +225 -0
- package/templates/guides/typescript/index.yaml +26 -0
- package/templates/guides/typescript/type-system.md +219 -0
- package/templates/guides/web-design/accessibility.md +66 -0
- package/templates/guides/web-design/index.yaml +20 -0
- package/templates/guides/web-design/performance.md +102 -0
- package/templates/pipelines/examples/code-review.yaml +66 -0
- package/templates/pipelines/index.yaml +18 -0
- package/templates/pipelines/templates/pipeline-template.yaml +50 -0
- package/templates/skills/backend/fastapi-best-practices/SKILL.md +269 -0
- package/templates/skills/backend/fastapi-best-practices/index.yaml +25 -0
- package/templates/skills/backend/go-backend-best-practices/SKILL.md +337 -0
- package/templates/skills/backend/go-backend-best-practices/index.yaml +26 -0
- package/templates/skills/backend/springboot-best-practices/SKILL.md +356 -0
- package/templates/skills/backend/springboot-best-practices/index.yaml +27 -0
- package/templates/skills/development/go-best-practices/SKILL.md +202 -0
- package/templates/skills/development/go-best-practices/index.yaml +25 -0
- package/templates/skills/development/kotlin-best-practices/SKILL.md +255 -0
- package/templates/skills/development/kotlin-best-practices/index.yaml +27 -0
- package/templates/skills/development/python-best-practices/SKILL.md +221 -0
- package/templates/skills/development/python-best-practices/index.yaml +25 -0
- package/templates/skills/development/react-best-practices/SKILL.md +100 -0
- package/templates/skills/development/react-best-practices/index.yaml +39 -0
- package/templates/skills/development/rust-best-practices/SKILL.md +266 -0
- package/templates/skills/development/rust-best-practices/index.yaml +26 -0
- package/templates/skills/development/typescript-best-practices/SKILL.md +320 -0
- package/templates/skills/development/typescript-best-practices/index.yaml +28 -0
- package/templates/skills/development/vercel-deploy/SKILL.md +73 -0
- package/templates/skills/development/vercel-deploy/index.yaml +30 -0
- package/templates/skills/development/web-design-guidelines/SKILL.md +117 -0
- package/templates/skills/development/web-design-guidelines/index.yaml +34 -0
- package/templates/skills/index.yaml +129 -0
- package/templates/skills/infrastructure/aws-best-practices/SKILL.md +279 -0
- package/templates/skills/infrastructure/aws-best-practices/index.yaml +27 -0
- package/templates/skills/infrastructure/docker-best-practices/SKILL.md +274 -0
- package/templates/skills/infrastructure/docker-best-practices/index.yaml +26 -0
- package/templates/skills/orchestration/intent-detection/SKILL.md +214 -0
- package/templates/skills/orchestration/intent-detection/index.yaml +30 -0
- package/templates/skills/orchestration/intent-detection/patterns/agent-triggers.yaml +333 -0
- package/templates/skills/orchestration/pipeline-execution/SKILL.md +188 -0
- package/templates/skills/orchestration/pipeline-execution/index.yaml +27 -0
- package/templates/skills/system/memory-management/SKILL.md +194 -0
- package/templates/skills/system/memory-management/index.yaml +30 -0
- package/templates/skills/system/result-aggregation/SKILL.md +163 -0
- package/templates/skills/system/result-aggregation/index.yaml +36 -0
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "oh-my-customcode",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Batteries-included agent harness for Claude Code",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"omcc": "./dist/cli/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"templates"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public",
|
|
23
|
+
"registry": "https://registry.npmjs.org/"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "bun run src/cli/index.ts",
|
|
27
|
+
"build": "bun build src/cli/index.ts --outdir dist/cli --target node && bun build src/index.ts --outdir dist --target node",
|
|
28
|
+
"test": "bun test",
|
|
29
|
+
"test:unit": "bun test tests/unit",
|
|
30
|
+
"test:integration": "bun test tests/integration",
|
|
31
|
+
"test:e2e": "bun test tests/e2e",
|
|
32
|
+
"test:coverage": "bun test --coverage",
|
|
33
|
+
"lint": "biome check .",
|
|
34
|
+
"lint:fix": "biome check --write .",
|
|
35
|
+
"format": "biome format --write .",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"docs:dev": "vitepress dev docs",
|
|
38
|
+
"docs:build": "vitepress build docs",
|
|
39
|
+
"prepare": "sh scripts/setup-hooks.sh || true",
|
|
40
|
+
"setup:hooks": "sh scripts/setup-hooks.sh",
|
|
41
|
+
"prepublishOnly": "bun run build && bun run test"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"commander": "^12.1.0",
|
|
45
|
+
"i18next": "^24.2.2",
|
|
46
|
+
"yaml": "^2.8.2"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@biomejs/biome": "^1.9.4",
|
|
50
|
+
"@types/bun": "^1.2.4",
|
|
51
|
+
"typescript": "^5.7.3",
|
|
52
|
+
"vitepress": "^1.6.3"
|
|
53
|
+
},
|
|
54
|
+
"keywords": [
|
|
55
|
+
"claude",
|
|
56
|
+
"claude-code",
|
|
57
|
+
"ai",
|
|
58
|
+
"agent",
|
|
59
|
+
"cli"
|
|
60
|
+
],
|
|
61
|
+
"author": "baekenough",
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "git+https://github.com/baekenough/oh-my-customcode.git"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/baekenough/oh-my-customcode/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/baekenough/oh-my-customcode#readme",
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=18.0.0"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Development Context
|
|
2
|
+
|
|
3
|
+
Mode: Active development
|
|
4
|
+
Focus: Implementation, coding, building features
|
|
5
|
+
|
|
6
|
+
## Behavior
|
|
7
|
+
- Write code first, explain after
|
|
8
|
+
- Prefer working solutions over perfect solutions
|
|
9
|
+
- Run tests after changes
|
|
10
|
+
- Keep commits atomic
|
|
11
|
+
|
|
12
|
+
## Priorities
|
|
13
|
+
1. Get it working
|
|
14
|
+
2. Get it right
|
|
15
|
+
3. Get it clean
|
|
16
|
+
|
|
17
|
+
## Tools to favor
|
|
18
|
+
- Edit, Write for code changes
|
|
19
|
+
- Bash for running tests/builds
|
|
20
|
+
- Grep, Glob for finding code
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Ecomode Context
|
|
2
|
+
|
|
3
|
+
> Activated when token efficiency is critical
|
|
4
|
+
|
|
5
|
+
## When Active
|
|
6
|
+
|
|
7
|
+
This context is loaded when ecomode is activated (4+ parallel tasks, batch operations, or near compaction).
|
|
8
|
+
|
|
9
|
+
## Instructions for Agents
|
|
10
|
+
|
|
11
|
+
### Output Rules
|
|
12
|
+
|
|
13
|
+
1. **Status first**: Always start with status indicator
|
|
14
|
+
2. **One-liner summary**: Compress results to 1-2 sentences
|
|
15
|
+
3. **Skip verbose**: No intermediate steps, no repeated context
|
|
16
|
+
4. **Use references**: File paths instead of contents
|
|
17
|
+
|
|
18
|
+
### Format Template
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
[{agent-name}] {status_icon} {target}: {summary}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Status Icons
|
|
25
|
+
|
|
26
|
+
| Icon | Meaning |
|
|
27
|
+
|------|---------|
|
|
28
|
+
| ✓ | Success |
|
|
29
|
+
| ✗ | Failed |
|
|
30
|
+
| ⚠ | Partial/Warning |
|
|
31
|
+
| ⏳ | In progress |
|
|
32
|
+
|
|
33
|
+
### Examples
|
|
34
|
+
|
|
35
|
+
Good (ecomode):
|
|
36
|
+
```
|
|
37
|
+
[golang-expert] ✓ src/main.go: 3 issues found (2 style, 1 error handling)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Bad (verbose):
|
|
41
|
+
```
|
|
42
|
+
I have completed the review of src/main.go. The file contains...
|
|
43
|
+
[long explanation]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Aggregation
|
|
47
|
+
|
|
48
|
+
When secretary aggregates results:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
[Batch Complete] 4/4
|
|
52
|
+
├── golang-expert: ✓ 3 issues in 2 files
|
|
53
|
+
├── python-expert: ✓ Clean, no issues
|
|
54
|
+
├── rust-expert: ⚠ 1 warning (unsafe block)
|
|
55
|
+
└── typescript-expert: ✓ 5 suggestions
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Exit Conditions
|
|
59
|
+
|
|
60
|
+
Ecomode deactivates when:
|
|
61
|
+
- User requests "verbose" or "full details"
|
|
62
|
+
- Single task execution
|
|
63
|
+
- Explicit "ecomode off"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Claude Code Contexts Configuration
|
|
2
|
+
# Source: https://github.com/affaan-m/everything-claude-code
|
|
3
|
+
|
|
4
|
+
contexts:
|
|
5
|
+
dev:
|
|
6
|
+
file: dev.md
|
|
7
|
+
mode: Active development
|
|
8
|
+
focus: Implementation, coding, building features
|
|
9
|
+
priority: Working > Correct > Clean
|
|
10
|
+
|
|
11
|
+
review:
|
|
12
|
+
file: review.md
|
|
13
|
+
mode: PR review and code analysis
|
|
14
|
+
focus: Quality, security, maintainability
|
|
15
|
+
checklist:
|
|
16
|
+
- Logic correctness
|
|
17
|
+
- Error handling
|
|
18
|
+
- Security
|
|
19
|
+
- Performance
|
|
20
|
+
- Readability
|
|
21
|
+
- Test coverage
|
|
22
|
+
|
|
23
|
+
research:
|
|
24
|
+
file: research.md
|
|
25
|
+
mode: Exploration and investigation
|
|
26
|
+
focus: Understanding before acting
|
|
27
|
+
process:
|
|
28
|
+
- Understand question
|
|
29
|
+
- Explore code/docs
|
|
30
|
+
- Form hypotheses
|
|
31
|
+
- Validate with evidence
|
|
32
|
+
- Summarize findings
|
|
33
|
+
|
|
34
|
+
usage:
|
|
35
|
+
description: |
|
|
36
|
+
Use contexts to change Claude's behavior mode.
|
|
37
|
+
Include the context file content in your prompt or
|
|
38
|
+
reference it at the start of a session.
|
|
39
|
+
example: |
|
|
40
|
+
"Using review context, analyze this PR..."
|
|
41
|
+
"In dev mode, implement this feature..."
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Research Context
|
|
2
|
+
|
|
3
|
+
Mode: Exploration and investigation
|
|
4
|
+
Focus: Understanding before acting
|
|
5
|
+
|
|
6
|
+
## Behavior
|
|
7
|
+
- Read widely before concluding
|
|
8
|
+
- Ask clarifying questions
|
|
9
|
+
- Document findings as you go
|
|
10
|
+
- Understand before writing code
|
|
11
|
+
|
|
12
|
+
## Research Process
|
|
13
|
+
1. Understand the question
|
|
14
|
+
2. Explore relevant code/docs
|
|
15
|
+
3. Form hypotheses
|
|
16
|
+
4. Validate with evidence
|
|
17
|
+
5. Summarize findings
|
|
18
|
+
|
|
19
|
+
## Tools to favor
|
|
20
|
+
- Read for understanding code
|
|
21
|
+
- Grep, Glob for pattern discovery
|
|
22
|
+
- WebFetch for external docs
|
|
23
|
+
- Task (Explore) for codebase queries
|
|
24
|
+
|
|
25
|
+
## Output Format
|
|
26
|
+
- Findings first
|
|
27
|
+
- Recommendations second
|
|
28
|
+
- Uncertainties noted
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Code Review Context
|
|
2
|
+
|
|
3
|
+
Mode: PR review and code analysis
|
|
4
|
+
Focus: Quality, security, maintainability
|
|
5
|
+
|
|
6
|
+
## Behavior
|
|
7
|
+
- Read thoroughly before commenting
|
|
8
|
+
- Organize findings by severity
|
|
9
|
+
- Suggest fixes, not just problems
|
|
10
|
+
- Check for security vulnerabilities
|
|
11
|
+
|
|
12
|
+
## Review Checklist
|
|
13
|
+
1. Logic correctness and edge cases
|
|
14
|
+
2. Error handling and exceptions
|
|
15
|
+
3. Security concerns (injection, credentials)
|
|
16
|
+
4. Performance implications
|
|
17
|
+
5. Code readability
|
|
18
|
+
6. Test coverage
|
|
19
|
+
|
|
20
|
+
## Output Format
|
|
21
|
+
- Group by file
|
|
22
|
+
- Sort by severity (critical > high > medium > low)
|
|
23
|
+
- Provide actionable suggestions
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"PreToolUse": [
|
|
5
|
+
{
|
|
6
|
+
"matcher": "tool == \"Bash\" && tool_input.command matches \"(npm run dev|pnpm( run)? dev|yarn dev|bun run dev)\"",
|
|
7
|
+
"hooks": [
|
|
8
|
+
{
|
|
9
|
+
"type": "command",
|
|
10
|
+
"command": "#!/bin/bash\ninput=$(cat)\ncmd=$(echo \"$input\" | jq -r '.tool_input.command // \"\"')\n\n# Block dev servers that aren't run in tmux\necho '[Hook] BLOCKED: Dev server must run in tmux for log access' >&2\necho '[Hook] Use this command instead:' >&2\necho \"[Hook] tmux new-session -d -s dev 'npm run dev'\" >&2\necho '[Hook] Then: tmux attach -t dev' >&2\nexit 1"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"description": "Block dev servers outside tmux - ensures you can access logs"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"matcher": "tool == \"Bash\" && tool_input.command matches \"(npm (install|test)|pnpm (install|test)|yarn (install|test)|bun (install|test)|cargo build|make|docker|pytest|vitest|playwright)\"",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "#!/bin/bash\ninput=$(cat)\nif [ -z \"$TMUX\" ]; then\n echo '[Hook] Consider running in tmux for session persistence' >&2\n echo '[Hook] tmux new -s dev | tmux attach -t dev' >&2\nfi\necho \"$input\""
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"description": "Reminder to use tmux for long-running commands"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"matcher": "tool == \"Bash\" && tool_input.command matches \"git push\"",
|
|
27
|
+
"hooks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "#!/bin/bash\necho '[Hook] Review changes before push...' >&2\necho '[Hook] Press Enter to continue with push or Ctrl+C to abort...' >&2\nread -r"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"description": "Pause before git push to review changes"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"matcher": "tool == \"Write\" && tool_input.file_path matches \"\\\\.(md|txt)$\" && !(tool_input.file_path matches \"README\\\\.md|CLAUDE\\\\.md|AGENT\\\\.md|SKILL\\\\.md\")",
|
|
37
|
+
"hooks": [
|
|
38
|
+
{
|
|
39
|
+
"type": "command",
|
|
40
|
+
"command": "#!/bin/bash\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [[ \"$file_path\" =~ \\.(md|txt)$ ]] && [[ ! \"$file_path\" =~ (README|CLAUDE|AGENT|SKILL)\\.md$ ]]; then\n echo \"[Hook] BLOCKED: Unnecessary documentation file creation\" >&2\n echo \"[Hook] File: $file_path\" >&2\n echo \"[Hook] Use README.md or AGENT.md for documentation instead\" >&2\n exit 1\nfi\n\necho \"$input\""
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"description": "Block creation of random .md files - keeps docs consolidated"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"matcher": "tool == \"Edit\" || tool == \"Write\"",
|
|
47
|
+
"hooks": [
|
|
48
|
+
{
|
|
49
|
+
"type": "command",
|
|
50
|
+
"command": "~/.claude/hooks/strategic-compact/suggest-compact.sh"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"description": "Suggest manual compaction at logical intervals"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"matcher": "tool == \"Task\"",
|
|
57
|
+
"hooks": [
|
|
58
|
+
{
|
|
59
|
+
"type": "command",
|
|
60
|
+
"command": "#!/bin/bash\ninput=$(cat)\nagent=$(echo \"$input\" | jq -r '.tool_input.description // \"agent\"' | head -c 30)\n~/.claude/hooks/hud/update-status.sh \"$agent\" \"\" \"1\"\necho \"$input\""
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"description": "HUD statusline - show agent spawn via Task tool"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"PreCompact": [
|
|
67
|
+
{
|
|
68
|
+
"matcher": "*",
|
|
69
|
+
"hooks": [
|
|
70
|
+
{
|
|
71
|
+
"type": "command",
|
|
72
|
+
"command": "~/.claude/hooks/memory-persistence/pre-compact.sh"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"description": "Save state before context compaction"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"SessionStart": [
|
|
79
|
+
{
|
|
80
|
+
"matcher": "*",
|
|
81
|
+
"hooks": [
|
|
82
|
+
{
|
|
83
|
+
"type": "command",
|
|
84
|
+
"command": "~/.claude/hooks/memory-persistence/session-start.sh"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"description": "Load previous context on new session"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"PostToolUse": [
|
|
91
|
+
{
|
|
92
|
+
"matcher": "tool == \"Bash\"",
|
|
93
|
+
"hooks": [
|
|
94
|
+
{
|
|
95
|
+
"type": "command",
|
|
96
|
+
"command": "#!/bin/bash\ninput=$(cat)\ncmd=$(echo \"$input\" | jq -r '.tool_input.command')\n\nif echo \"$cmd\" | grep -qE 'gh pr create'; then\n output=$(echo \"$input\" | jq -r '.tool_output.output // \"\"')\n pr_url=$(echo \"$output\" | grep -oE 'https://github.com/[^/]+/[^/]+/pull/[0-9]+')\n \n if [ -n \"$pr_url\" ]; then\n echo \"[Hook] PR created: $pr_url\" >&2\n echo \"[Hook] Checking GitHub Actions status...\" >&2\n repo=$(echo \"$pr_url\" | sed -E 's|https://github.com/([^/]+/[^/]+)/pull/[0-9]+|\\1|')\n pr_num=$(echo \"$pr_url\" | sed -E 's|.*/pull/([0-9]+)|\\1|')\n echo \"[Hook] To review PR: gh pr review $pr_num --repo $repo\" >&2\n fi\nfi\n\necho \"$input\""
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"description": "Log PR URL and provide review command after PR creation"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
|
|
103
|
+
"hooks": [
|
|
104
|
+
{
|
|
105
|
+
"type": "command",
|
|
106
|
+
"command": "#!/bin/bash\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n if command -v prettier >/dev/null 2>&1; then\n prettier --write \"$file_path\" 2>&1 | head -5 >&2\n fi\nfi\n\necho \"$input\""
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"description": "Auto-format JS/TS files with Prettier after edits"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx)$\"",
|
|
113
|
+
"hooks": [
|
|
114
|
+
{
|
|
115
|
+
"type": "command",
|
|
116
|
+
"command": "#!/bin/bash\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n dir=$(dirname \"$file_path\")\n project_root=\"$dir\"\n while [ \"$project_root\" != \"/\" ] && [ ! -f \"$project_root/package.json\" ]; do\n project_root=$(dirname \"$project_root\")\n done\n \n if [ -f \"$project_root/tsconfig.json\" ]; then\n cd \"$project_root\" && npx tsc --noEmit --pretty false 2>&1 | grep \"$file_path\" | head -10 >&2 || true\n fi\nfi\n\necho \"$input\""
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"description": "TypeScript check after editing .ts/.tsx files"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
|
|
123
|
+
"hooks": [
|
|
124
|
+
{
|
|
125
|
+
"type": "command",
|
|
126
|
+
"command": "#!/bin/bash\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n console_logs=$(grep -n \"console\\\\.log\" \"$file_path\" 2>/dev/null || true)\n \n if [ -n \"$console_logs\" ]; then\n echo \"[Hook] WARNING: console.log found in $file_path\" >&2\n echo \"$console_logs\" | head -5 >&2\n echo \"[Hook] Remove console.log before committing\" >&2\n fi\nfi\n\necho \"$input\""
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"description": "Warn about console.log statements after edits"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(go)$\"",
|
|
133
|
+
"hooks": [
|
|
134
|
+
{
|
|
135
|
+
"type": "command",
|
|
136
|
+
"command": "#!/bin/bash\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n if command -v gofmt >/dev/null 2>&1; then\n gofmt -w \"$file_path\" 2>&1 >&2\n fi\nfi\n\necho \"$input\""
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"description": "Auto-format Go files with gofmt after edits"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(py)$\"",
|
|
143
|
+
"hooks": [
|
|
144
|
+
{
|
|
145
|
+
"type": "command",
|
|
146
|
+
"command": "#!/bin/bash\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n # Format with ruff\n if command -v ruff >/dev/null 2>&1; then\n ruff format --quiet \"$file_path\" 2>&1 >&2\n ruff check --fix --quiet \"$file_path\" 2>&1 >&2 || true\n echo \"[Hook] Python formatted with ruff\" >&2\n fi\nfi\n\necho \"$input\""
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"description": "Auto-format and lint Python files with ruff after edits"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(py)$\"",
|
|
153
|
+
"hooks": [
|
|
154
|
+
{
|
|
155
|
+
"type": "command",
|
|
156
|
+
"command": "#!/bin/bash\ninput=$(cat)\nfile_path=$(echo \"$input\" | jq -r '.tool_input.file_path // \"\"')\n\nif [ -n \"$file_path\" ] && [ -f \"$file_path\" ]; then\n # Type check with ty\n if command -v ty >/dev/null 2>&1; then\n dir=$(dirname \"$file_path\")\n project_root=\"$dir\"\n while [ \"$project_root\" != \"/\" ] && [ ! -f \"$project_root/pyproject.toml\" ]; do\n project_root=$(dirname \"$project_root\")\n done\n \n if [ -f \"$project_root/pyproject.toml\" ]; then\n cd \"$project_root\" && ty check \"$file_path\" 2>&1 | head -10 >&2 || true\n else\n ty check \"$file_path\" 2>&1 | head -10 >&2 || true\n fi\n fi\nfi\n\necho \"$input\""
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"description": "Type check Python files with ty after edits"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"Stop": [
|
|
163
|
+
{
|
|
164
|
+
"matcher": "*",
|
|
165
|
+
"hooks": [
|
|
166
|
+
{
|
|
167
|
+
"type": "command",
|
|
168
|
+
"command": "#!/bin/bash\ninput=$(cat)\n\nif git rev-parse --git-dir > /dev/null 2>&1; then\n modified_files=$(git diff --name-only HEAD 2>/dev/null | grep -E '\\.(ts|tsx|js|jsx)$' || true)\n \n if [ -n \"$modified_files\" ]; then\n has_console=false\n while IFS= read -r file; do\n if [ -f \"$file\" ]; then\n if grep -q \"console\\.log\" \"$file\" 2>/dev/null; then\n echo \"[Hook] WARNING: console.log found in $file\" >&2\n has_console=true\n fi\n fi\n done <<< \"$modified_files\"\n \n if [ \"$has_console\" = true ]; then\n echo \"[Hook] Remove console.log statements before committing\" >&2\n fi\n fi\nfi\n\necho \"$input\""
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"description": "Final audit for console.log in modified files before session ends"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"matcher": "*",
|
|
175
|
+
"hooks": [
|
|
176
|
+
{
|
|
177
|
+
"type": "command",
|
|
178
|
+
"command": "~/.claude/hooks/memory-persistence/session-end.sh"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"description": "Persist session state on end"
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# HUD Statusline Hooks
|
|
2
|
+
# Provides real-time status display during agent operations
|
|
3
|
+
|
|
4
|
+
name: hud-statusline
|
|
5
|
+
description: Real-time status display during operations
|
|
6
|
+
rule: R012 (SHOULD-hud-statusline)
|
|
7
|
+
|
|
8
|
+
scripts:
|
|
9
|
+
- name: update-status
|
|
10
|
+
path: ./update-status.sh
|
|
11
|
+
description: Update HUD statusline with agent/progress/parallel info
|
|
12
|
+
usage: update-status.sh <agent> [progress] [parallel_count]
|
|
13
|
+
|
|
14
|
+
triggers:
|
|
15
|
+
- PreToolUse (Task)
|
|
16
|
+
- PostToolUse (Task)
|
|
17
|
+
- Agent activation
|
|
18
|
+
- Parallel spawn/complete
|
|
19
|
+
|
|
20
|
+
components:
|
|
21
|
+
agent: Current agent name
|
|
22
|
+
progress: Task progress (n/total)
|
|
23
|
+
parallel: Parallel instance count
|
|
24
|
+
|
|
25
|
+
installation:
|
|
26
|
+
step1: "chmod +x ~/.claude/hooks/hud/update-status.sh"
|
|
27
|
+
step2: "Hook is called automatically or manually via script"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# HUD Statusline Hook - Update status display
|
|
3
|
+
#
|
|
4
|
+
# Displays real-time status information during agent operations.
|
|
5
|
+
# Output via stderr to avoid polluting tool output.
|
|
6
|
+
#
|
|
7
|
+
# Usage: update-status.sh <agent> [progress] [parallel_count]
|
|
8
|
+
#
|
|
9
|
+
# Examples:
|
|
10
|
+
# update-status.sh "creator" "1/3"
|
|
11
|
+
# update-status.sh "secretary" "0/4" "4"
|
|
12
|
+
# update-status.sh "golang-expert"
|
|
13
|
+
|
|
14
|
+
AGENT="${1:-claude}"
|
|
15
|
+
PROGRESS="${2:-}"
|
|
16
|
+
PARALLEL="${3:-0}"
|
|
17
|
+
|
|
18
|
+
# Build status line
|
|
19
|
+
STATUS="[Agent] $AGENT"
|
|
20
|
+
|
|
21
|
+
# Add progress if provided
|
|
22
|
+
if [ -n "$PROGRESS" ]; then
|
|
23
|
+
STATUS="$STATUS | [Progress] $PROGRESS"
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Add parallel count if > 0
|
|
27
|
+
if [ "$PARALLEL" -gt 0 ] 2>/dev/null; then
|
|
28
|
+
STATUS="$STATUS | [Parallel] $PARALLEL"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Output to stderr to avoid polluting tool output
|
|
32
|
+
echo "─── $STATUS ───" >&2
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Claude Code Hooks Configuration
|
|
2
|
+
# Source: https://github.com/affaan-m/everything-claude-code
|
|
3
|
+
|
|
4
|
+
hooks:
|
|
5
|
+
PreToolUse:
|
|
6
|
+
- dev-server-tmux-guard
|
|
7
|
+
- long-running-tmux-reminder
|
|
8
|
+
- git-push-review-pause
|
|
9
|
+
- md-file-creation-block
|
|
10
|
+
- strategic-compact-suggester
|
|
11
|
+
- hud-statusline (Task)
|
|
12
|
+
|
|
13
|
+
PreCompact:
|
|
14
|
+
- memory-persistence/pre-compact
|
|
15
|
+
|
|
16
|
+
SessionStart:
|
|
17
|
+
- memory-persistence/session-start
|
|
18
|
+
|
|
19
|
+
PostToolUse:
|
|
20
|
+
- pr-creation-logger
|
|
21
|
+
- prettier-auto-format (js/ts)
|
|
22
|
+
- typescript-checker
|
|
23
|
+
- console-log-warner
|
|
24
|
+
- gofmt-auto-format (go)
|
|
25
|
+
- ruff-format-and-lint (python)
|
|
26
|
+
- ty-type-check (python)
|
|
27
|
+
|
|
28
|
+
Stop:
|
|
29
|
+
- console-log-final-audit
|
|
30
|
+
- memory-persistence/session-end
|
|
31
|
+
|
|
32
|
+
scripts:
|
|
33
|
+
memory-persistence:
|
|
34
|
+
- pre-compact.sh
|
|
35
|
+
- session-start.sh
|
|
36
|
+
- session-end.sh
|
|
37
|
+
strategic-compact:
|
|
38
|
+
- suggest-compact.sh
|
|
39
|
+
hud:
|
|
40
|
+
- update-status.sh
|
|
41
|
+
|
|
42
|
+
installation:
|
|
43
|
+
step1: "Copy hooks.json content to ~/.claude/settings.json"
|
|
44
|
+
step2: "Copy scripts to ~/.claude/hooks/"
|
|
45
|
+
step3: "chmod +x ~/.claude/hooks/**/*.sh"
|
|
46
|
+
step4: "Create ~/.claude/sessions/ and ~/.claude/skills/learned/"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PreCompact Hook - Save state before context compaction
|
|
3
|
+
#
|
|
4
|
+
# Runs before Claude compacts context. Logs the event and marks
|
|
5
|
+
# active session files so you know when compaction occurred.
|
|
6
|
+
#
|
|
7
|
+
# Hook config (in ~/.claude/settings.json):
|
|
8
|
+
# {
|
|
9
|
+
# "hooks": {
|
|
10
|
+
# "PreCompact": [{
|
|
11
|
+
# "matcher": "*",
|
|
12
|
+
# "hooks": [{
|
|
13
|
+
# "type": "command",
|
|
14
|
+
# "command": "~/.claude/hooks/memory-persistence/pre-compact.sh"
|
|
15
|
+
# }]
|
|
16
|
+
# }]
|
|
17
|
+
# }
|
|
18
|
+
# }
|
|
19
|
+
|
|
20
|
+
SESSIONS_DIR="${HOME}/.claude/sessions"
|
|
21
|
+
LOG_FILE="${SESSIONS_DIR}/compaction-log.txt"
|
|
22
|
+
|
|
23
|
+
mkdir -p "$SESSIONS_DIR"
|
|
24
|
+
|
|
25
|
+
# Log the compaction event
|
|
26
|
+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Context compaction triggered" >> "$LOG_FILE"
|
|
27
|
+
|
|
28
|
+
# Find and mark active session file
|
|
29
|
+
ACTIVE_SESSION=$(find "$SESSIONS_DIR" -name "*.tmp" -mmin -60 2>/dev/null | head -1)
|
|
30
|
+
if [ -n "$ACTIVE_SESSION" ] && [ -f "$ACTIVE_SESSION" ]; then
|
|
31
|
+
echo "" >> "$ACTIVE_SESSION"
|
|
32
|
+
echo "---" >> "$ACTIVE_SESSION"
|
|
33
|
+
echo "**[COMPACTION]** Context compacted at $(date '+%H:%M')" >> "$ACTIVE_SESSION"
|
|
34
|
+
echo "---" >> "$ACTIVE_SESSION"
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
echo "[PreCompact] State preserved before compaction" >&2
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Stop Hook (Session End) - Persist learnings when session ends
|
|
3
|
+
#
|
|
4
|
+
# Runs when Claude session ends. Creates/updates session log file
|
|
5
|
+
# with timestamp for continuity tracking.
|
|
6
|
+
#
|
|
7
|
+
# Hook config (in ~/.claude/settings.json):
|
|
8
|
+
# {
|
|
9
|
+
# "hooks": {
|
|
10
|
+
# "Stop": [{
|
|
11
|
+
# "matcher": "*",
|
|
12
|
+
# "hooks": [{
|
|
13
|
+
# "type": "command",
|
|
14
|
+
# "command": "~/.claude/hooks/memory-persistence/session-end.sh"
|
|
15
|
+
# }]
|
|
16
|
+
# }]
|
|
17
|
+
# }
|
|
18
|
+
# }
|
|
19
|
+
|
|
20
|
+
SESSIONS_DIR="${HOME}/.claude/sessions"
|
|
21
|
+
TODAY=$(date '+%Y-%m-%d')
|
|
22
|
+
SESSION_FILE="${SESSIONS_DIR}/${TODAY}-session.tmp"
|
|
23
|
+
|
|
24
|
+
mkdir -p "$SESSIONS_DIR"
|
|
25
|
+
|
|
26
|
+
# If session file exists for today, update the end time
|
|
27
|
+
if [ -f "$SESSION_FILE" ]; then
|
|
28
|
+
# Update Last Updated timestamp (macOS and Linux compatible)
|
|
29
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
30
|
+
sed -i '' "s/\*\*Last Updated:\*\*.*/\*\*Last Updated:\*\* $(date '+%H:%M')/" "$SESSION_FILE" 2>/dev/null
|
|
31
|
+
else
|
|
32
|
+
sed -i "s/\*\*Last Updated:\*\*.*/\*\*Last Updated:\*\* $(date '+%H:%M')/" "$SESSION_FILE" 2>/dev/null
|
|
33
|
+
fi
|
|
34
|
+
echo "[SessionEnd] Updated session file: $SESSION_FILE" >&2
|
|
35
|
+
else
|
|
36
|
+
# Create new session file with template
|
|
37
|
+
cat > "$SESSION_FILE" << EOF
|
|
38
|
+
# Session: $(date '+%Y-%m-%d')
|
|
39
|
+
**Date:** $TODAY
|
|
40
|
+
**Started:** $(date '+%H:%M')
|
|
41
|
+
**Last Updated:** $(date '+%H:%M')
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Current State
|
|
46
|
+
|
|
47
|
+
[Session context goes here]
|
|
48
|
+
|
|
49
|
+
### Completed
|
|
50
|
+
- [ ]
|
|
51
|
+
|
|
52
|
+
### In Progress
|
|
53
|
+
- [ ]
|
|
54
|
+
|
|
55
|
+
### Notes for Next Session
|
|
56
|
+
-
|
|
57
|
+
|
|
58
|
+
### Context to Load
|
|
59
|
+
\`\`\`
|
|
60
|
+
[relevant files]
|
|
61
|
+
\`\`\`
|
|
62
|
+
EOF
|
|
63
|
+
echo "[SessionEnd] Created session file: $SESSION_FILE" >&2
|
|
64
|
+
fi
|