claude-code-pilot 2.0.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 +151 -0
- package/bin/install.js +431 -0
- package/docs/agent-guides/architecture.md +107 -0
- package/ecc/agents/architect.md +211 -0
- package/ecc/agents/code-reviewer.md +237 -0
- package/ecc/agents/doc-updater.md +107 -0
- package/ecc/agents/e2e-runner.md +107 -0
- package/ecc/agents/security-reviewer.md +108 -0
- package/ecc/agents/tdd-guide.md +91 -0
- package/ecc/commands/checkpoint.md +74 -0
- package/ecc/commands/evolve.md +178 -0
- package/ecc/commands/learn.md +70 -0
- package/ecc/commands/model-route.md +26 -0
- package/ecc/commands/quality-gate.md +29 -0
- package/ecc/commands/resume-session.md +155 -0
- package/ecc/commands/save-session.md +275 -0
- package/ecc/commands/sessions.md +305 -0
- package/ecc/commands/verify.md +59 -0
- package/ecc/contexts/dev.md +20 -0
- package/ecc/contexts/research.md +26 -0
- package/ecc/contexts/review.md +22 -0
- package/ecc/examples/CLAUDE.md +100 -0
- package/ecc/examples/django-api-CLAUDE.md +308 -0
- package/ecc/examples/go-microservice-CLAUDE.md +267 -0
- package/ecc/examples/rust-api-CLAUDE.md +285 -0
- package/ecc/examples/saas-nextjs-CLAUDE.md +166 -0
- package/ecc/examples/user-CLAUDE.md +109 -0
- package/ecc/rules/common/agents.md +49 -0
- package/ecc/rules/common/coding-style.md +48 -0
- package/ecc/rules/common/development-workflow.md +37 -0
- package/ecc/rules/common/git-workflow.md +24 -0
- package/ecc/rules/common/hooks.md +30 -0
- package/ecc/rules/common/patterns.md +31 -0
- package/ecc/rules/common/performance.md +55 -0
- package/ecc/rules/common/security.md +29 -0
- package/ecc/rules/common/testing.md +29 -0
- package/ecc/rules/golang/coding-style.md +32 -0
- package/ecc/rules/golang/hooks.md +17 -0
- package/ecc/rules/golang/patterns.md +45 -0
- package/ecc/rules/golang/security.md +34 -0
- package/ecc/rules/golang/testing.md +31 -0
- package/ecc/rules/kotlin/coding-style.md +86 -0
- package/ecc/rules/kotlin/patterns.md +146 -0
- package/ecc/rules/kotlin/security.md +82 -0
- package/ecc/rules/kotlin/testing.md +128 -0
- package/ecc/rules/perl/coding-style.md +46 -0
- package/ecc/rules/perl/hooks.md +22 -0
- package/ecc/rules/perl/patterns.md +76 -0
- package/ecc/rules/perl/security.md +69 -0
- package/ecc/rules/perl/testing.md +54 -0
- package/ecc/rules/php/coding-style.md +35 -0
- package/ecc/rules/php/hooks.md +24 -0
- package/ecc/rules/php/patterns.md +32 -0
- package/ecc/rules/php/security.md +33 -0
- package/ecc/rules/php/testing.md +34 -0
- package/ecc/rules/python/coding-style.md +42 -0
- package/ecc/rules/python/hooks.md +19 -0
- package/ecc/rules/python/patterns.md +39 -0
- package/ecc/rules/python/security.md +30 -0
- package/ecc/rules/python/testing.md +38 -0
- package/ecc/rules/swift/coding-style.md +47 -0
- package/ecc/rules/swift/hooks.md +20 -0
- package/ecc/rules/swift/patterns.md +66 -0
- package/ecc/rules/swift/security.md +33 -0
- package/ecc/rules/swift/testing.md +45 -0
- package/ecc/rules/typescript/coding-style.md +199 -0
- package/ecc/rules/typescript/hooks.md +22 -0
- package/ecc/rules/typescript/patterns.md +52 -0
- package/ecc/rules/typescript/security.md +28 -0
- package/ecc/rules/typescript/testing.md +18 -0
- package/ecc/scripts/hooks/check-hook-enabled.js +12 -0
- package/ecc/scripts/hooks/evaluate-session.js +100 -0
- package/ecc/scripts/hooks/pre-compact.js +48 -0
- package/ecc/scripts/hooks/run-with-flags-shell.sh +32 -0
- package/ecc/scripts/hooks/run-with-flags.js +120 -0
- package/ecc/scripts/hooks/session-end-marker.js +15 -0
- package/ecc/scripts/hooks/session-end.js +258 -0
- package/ecc/scripts/hooks/session-start.js +97 -0
- package/ecc/scripts/hooks/suggest-compact.js +80 -0
- package/ecc/scripts/lib/hook-flags.js +74 -0
- package/ecc/scripts/lib/package-manager.d.ts +119 -0
- package/ecc/scripts/lib/package-manager.js +431 -0
- package/ecc/scripts/lib/project-detect.js +428 -0
- package/ecc/scripts/lib/resolve-formatter.js +185 -0
- package/ecc/scripts/lib/session-aliases.d.ts +136 -0
- package/ecc/scripts/lib/session-aliases.js +481 -0
- package/ecc/scripts/lib/session-manager.d.ts +131 -0
- package/ecc/scripts/lib/session-manager.js +444 -0
- package/ecc/scripts/lib/shell-split.js +86 -0
- package/ecc/scripts/lib/utils.d.ts +183 -0
- package/ecc/scripts/lib/utils.js +543 -0
- package/ecc/skills/continuous-learning-v2/SKILL.md +365 -0
- package/ecc/skills/continuous-learning-v2/agents/observer-loop.sh +144 -0
- package/ecc/skills/continuous-learning-v2/agents/observer.md +198 -0
- package/ecc/skills/continuous-learning-v2/agents/start-observer.sh +194 -0
- package/ecc/skills/continuous-learning-v2/config.json +8 -0
- package/ecc/skills/continuous-learning-v2/hooks/observe.sh +246 -0
- package/ecc/skills/continuous-learning-v2/scripts/detect-project.sh +218 -0
- package/ecc/skills/continuous-learning-v2/scripts/instinct-cli.py +1148 -0
- package/ecc/skills/continuous-learning-v2/scripts/test_parse_instinct.py +984 -0
- package/ecc/skills/strategic-compact/SKILL.md +103 -0
- package/ecc/skills/strategic-compact/suggest-compact.sh +54 -0
- package/ecc/skills/verification-loop-SKILL.md +126 -0
- package/gsd/LICENSE +21 -0
- package/gsd/agents/gsd-codebase-mapper.md +772 -0
- package/gsd/agents/gsd-debugger.md +1257 -0
- package/gsd/agents/gsd-executor.md +489 -0
- package/gsd/agents/gsd-integration-checker.md +445 -0
- package/gsd/agents/gsd-nyquist-auditor.md +178 -0
- package/gsd/agents/gsd-phase-researcher.md +555 -0
- package/gsd/agents/gsd-plan-checker.md +708 -0
- package/gsd/agents/gsd-planner.md +1309 -0
- package/gsd/agents/gsd-project-researcher.md +631 -0
- package/gsd/agents/gsd-research-synthesizer.md +249 -0
- package/gsd/agents/gsd-roadmapper.md +652 -0
- package/gsd/agents/gsd-verifier.md +581 -0
- package/gsd/commands-gsd/add-phase.md +43 -0
- package/gsd/commands-gsd/add-tests.md +41 -0
- package/gsd/commands-gsd/add-todo.md +47 -0
- package/gsd/commands-gsd/audit-milestone.md +36 -0
- package/gsd/commands-gsd/check-todos.md +45 -0
- package/gsd/commands-gsd/cleanup.md +18 -0
- package/gsd/commands-gsd/complete-milestone.md +136 -0
- package/gsd/commands-gsd/debug.md +168 -0
- package/gsd/commands-gsd/discuss-phase.md +90 -0
- package/gsd/commands-gsd/execute-phase.md +41 -0
- package/gsd/commands-gsd/health.md +22 -0
- package/gsd/commands-gsd/help.md +22 -0
- package/gsd/commands-gsd/insert-phase.md +32 -0
- package/gsd/commands-gsd/join-discord.md +18 -0
- package/gsd/commands-gsd/list-phase-assumptions.md +46 -0
- package/gsd/commands-gsd/map-codebase.md +71 -0
- package/gsd/commands-gsd/new-milestone.md +44 -0
- package/gsd/commands-gsd/new-project.md +42 -0
- package/gsd/commands-gsd/pause-work.md +38 -0
- package/gsd/commands-gsd/plan-milestone-gaps.md +34 -0
- package/gsd/commands-gsd/plan-phase.md +45 -0
- package/gsd/commands-gsd/progress.md +24 -0
- package/gsd/commands-gsd/quick.md +45 -0
- package/gsd/commands-gsd/reapply-patches.md +123 -0
- package/gsd/commands-gsd/remove-phase.md +31 -0
- package/gsd/commands-gsd/research-phase.md +190 -0
- package/gsd/commands-gsd/resume-work.md +40 -0
- package/gsd/commands-gsd/set-profile.md +34 -0
- package/gsd/commands-gsd/settings.md +36 -0
- package/gsd/commands-gsd/update.md +37 -0
- package/gsd/commands-gsd/validate-phase.md +35 -0
- package/gsd/commands-gsd/verify-work.md +38 -0
- package/gsd/get-shit-done/bin/gsd-tools.cjs +592 -0
- package/gsd/get-shit-done/bin/lib/commands.cjs +548 -0
- package/gsd/get-shit-done/bin/lib/config.cjs +169 -0
- package/gsd/get-shit-done/bin/lib/core.cjs +492 -0
- package/gsd/get-shit-done/bin/lib/frontmatter.cjs +299 -0
- package/gsd/get-shit-done/bin/lib/init.cjs +710 -0
- package/gsd/get-shit-done/bin/lib/milestone.cjs +241 -0
- package/gsd/get-shit-done/bin/lib/phase.cjs +901 -0
- package/gsd/get-shit-done/bin/lib/roadmap.cjs +298 -0
- package/gsd/get-shit-done/bin/lib/state.cjs +721 -0
- package/gsd/get-shit-done/bin/lib/template.cjs +222 -0
- package/gsd/get-shit-done/bin/lib/verify.cjs +820 -0
- package/gsd/get-shit-done/references/checkpoints.md +776 -0
- package/gsd/get-shit-done/references/continuation-format.md +249 -0
- package/gsd/get-shit-done/references/decimal-phase-calculation.md +65 -0
- package/gsd/get-shit-done/references/git-integration.md +248 -0
- package/gsd/get-shit-done/references/git-planning-commit.md +38 -0
- package/gsd/get-shit-done/references/model-profile-resolution.md +34 -0
- package/gsd/get-shit-done/references/model-profiles.md +93 -0
- package/gsd/get-shit-done/references/phase-argument-parsing.md +61 -0
- package/gsd/get-shit-done/references/planning-config.md +200 -0
- package/gsd/get-shit-done/references/questioning.md +162 -0
- package/gsd/get-shit-done/references/tdd.md +263 -0
- package/gsd/get-shit-done/references/ui-brand.md +160 -0
- package/gsd/get-shit-done/references/verification-patterns.md +612 -0
- package/gsd/get-shit-done/templates/DEBUG.md +164 -0
- package/gsd/get-shit-done/templates/UAT.md +247 -0
- package/gsd/get-shit-done/templates/VALIDATION.md +76 -0
- package/gsd/get-shit-done/templates/codebase/architecture.md +255 -0
- package/gsd/get-shit-done/templates/codebase/concerns.md +310 -0
- package/gsd/get-shit-done/templates/codebase/conventions.md +307 -0
- package/gsd/get-shit-done/templates/codebase/integrations.md +280 -0
- package/gsd/get-shit-done/templates/codebase/stack.md +186 -0
- package/gsd/get-shit-done/templates/codebase/structure.md +285 -0
- package/gsd/get-shit-done/templates/codebase/testing.md +480 -0
- package/gsd/get-shit-done/templates/config.json +37 -0
- package/gsd/get-shit-done/templates/context.md +297 -0
- package/gsd/get-shit-done/templates/continue-here.md +78 -0
- package/gsd/get-shit-done/templates/debug-subagent-prompt.md +91 -0
- package/gsd/get-shit-done/templates/discovery.md +146 -0
- package/gsd/get-shit-done/templates/milestone-archive.md +123 -0
- package/gsd/get-shit-done/templates/milestone.md +115 -0
- package/gsd/get-shit-done/templates/phase-prompt.md +569 -0
- package/gsd/get-shit-done/templates/planner-subagent-prompt.md +117 -0
- package/gsd/get-shit-done/templates/project.md +184 -0
- package/gsd/get-shit-done/templates/requirements.md +231 -0
- package/gsd/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
- package/gsd/get-shit-done/templates/research-project/FEATURES.md +147 -0
- package/gsd/get-shit-done/templates/research-project/PITFALLS.md +200 -0
- package/gsd/get-shit-done/templates/research-project/STACK.md +120 -0
- package/gsd/get-shit-done/templates/research-project/SUMMARY.md +170 -0
- package/gsd/get-shit-done/templates/research.md +552 -0
- package/gsd/get-shit-done/templates/retrospective.md +54 -0
- package/gsd/get-shit-done/templates/roadmap.md +202 -0
- package/gsd/get-shit-done/templates/state.md +176 -0
- package/gsd/get-shit-done/templates/summary-complex.md +59 -0
- package/gsd/get-shit-done/templates/summary-minimal.md +41 -0
- package/gsd/get-shit-done/templates/summary-standard.md +48 -0
- package/gsd/get-shit-done/templates/summary.md +248 -0
- package/gsd/get-shit-done/templates/user-setup.md +311 -0
- package/gsd/get-shit-done/templates/verification-report.md +322 -0
- package/gsd/get-shit-done/workflows/add-phase.md +112 -0
- package/gsd/get-shit-done/workflows/add-tests.md +351 -0
- package/gsd/get-shit-done/workflows/add-todo.md +158 -0
- package/gsd/get-shit-done/workflows/audit-milestone.md +332 -0
- package/gsd/get-shit-done/workflows/check-todos.md +177 -0
- package/gsd/get-shit-done/workflows/cleanup.md +152 -0
- package/gsd/get-shit-done/workflows/complete-milestone.md +764 -0
- package/gsd/get-shit-done/workflows/diagnose-issues.md +219 -0
- package/gsd/get-shit-done/workflows/discovery-phase.md +289 -0
- package/gsd/get-shit-done/workflows/discuss-phase.md +676 -0
- package/gsd/get-shit-done/workflows/execute-phase.md +459 -0
- package/gsd/get-shit-done/workflows/execute-plan.md +449 -0
- package/gsd/get-shit-done/workflows/health.md +159 -0
- package/gsd/get-shit-done/workflows/help.md +489 -0
- package/gsd/get-shit-done/workflows/insert-phase.md +130 -0
- package/gsd/get-shit-done/workflows/list-phase-assumptions.md +178 -0
- package/gsd/get-shit-done/workflows/map-codebase.md +316 -0
- package/gsd/get-shit-done/workflows/new-milestone.md +384 -0
- package/gsd/get-shit-done/workflows/new-project.md +1111 -0
- package/gsd/get-shit-done/workflows/pause-work.md +122 -0
- package/gsd/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
- package/gsd/get-shit-done/workflows/plan-phase.md +560 -0
- package/gsd/get-shit-done/workflows/progress.md +382 -0
- package/gsd/get-shit-done/workflows/quick.md +601 -0
- package/gsd/get-shit-done/workflows/remove-phase.md +155 -0
- package/gsd/get-shit-done/workflows/research-phase.md +74 -0
- package/gsd/get-shit-done/workflows/resume-project.md +307 -0
- package/gsd/get-shit-done/workflows/set-profile.md +81 -0
- package/gsd/get-shit-done/workflows/settings.md +214 -0
- package/gsd/get-shit-done/workflows/transition.md +544 -0
- package/gsd/get-shit-done/workflows/update.md +240 -0
- package/gsd/get-shit-done/workflows/validate-phase.md +167 -0
- package/gsd/get-shit-done/workflows/verify-phase.md +243 -0
- package/gsd/get-shit-done/workflows/verify-work.md +583 -0
- package/gsd/hooks/gsd-check-update.js +81 -0
- package/gsd/hooks/gsd-context-monitor.js +141 -0
- package/gsd/hooks/gsd-statusline.js +115 -0
- package/kit/CLAUDE.md +43 -0
- package/kit/commands/kit/update.md +46 -0
- package/kit/commands/setup-refresh.md +50 -0
- package/kit/commands/setup.md +579 -0
- package/kit/commands/tool-guide.md +44 -0
- package/kit/hooks/kit-check-update.js +54 -0
- package/kit/mcp.json +10 -0
- package/kit/rules/code-style.md +24 -0
- package/manifest.json +30 -0
- package/package.json +36 -0
|
@@ -0,0 +1,103 @@
|
|
|
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.js` script runs on PreToolUse (Edit/Write) 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
|
+
Add to your `~/.claude/settings.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"hooks": {
|
|
46
|
+
"PreToolUse": [
|
|
47
|
+
{
|
|
48
|
+
"matcher": "Edit",
|
|
49
|
+
"hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"matcher": "Write",
|
|
53
|
+
"hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
Environment variables:
|
|
63
|
+
- `COMPACT_THRESHOLD` — Tool calls before first suggestion (default: 50)
|
|
64
|
+
|
|
65
|
+
## Compaction Decision Guide
|
|
66
|
+
|
|
67
|
+
Use this table to decide when to compact:
|
|
68
|
+
|
|
69
|
+
| Phase Transition | Compact? | Why |
|
|
70
|
+
|-----------------|----------|-----|
|
|
71
|
+
| Research → Planning | Yes | Research context is bulky; plan is the distilled output |
|
|
72
|
+
| Planning → Implementation | Yes | Plan is in TodoWrite or a file; free up context for code |
|
|
73
|
+
| Implementation → Testing | Maybe | Keep if tests reference recent code; compact if switching focus |
|
|
74
|
+
| Debugging → Next feature | Yes | Debug traces pollute context for unrelated work |
|
|
75
|
+
| Mid-implementation | No | Losing variable names, file paths, and partial state is costly |
|
|
76
|
+
| After a failed approach | Yes | Clear the dead-end reasoning before trying a new approach |
|
|
77
|
+
|
|
78
|
+
## What Survives Compaction
|
|
79
|
+
|
|
80
|
+
Understanding what persists helps you compact with confidence:
|
|
81
|
+
|
|
82
|
+
| Persists | Lost |
|
|
83
|
+
|----------|------|
|
|
84
|
+
| CLAUDE.md instructions | Intermediate reasoning and analysis |
|
|
85
|
+
| TodoWrite task list | File contents you previously read |
|
|
86
|
+
| Memory files (`~/.claude/memory/`) | Multi-step conversation context |
|
|
87
|
+
| Git state (commits, branches) | Tool call history and counts |
|
|
88
|
+
| Files on disk | Nuanced user preferences stated verbally |
|
|
89
|
+
|
|
90
|
+
## Best Practices
|
|
91
|
+
|
|
92
|
+
1. **Compact after planning** — Once plan is finalized in TodoWrite, compact to start fresh
|
|
93
|
+
2. **Compact after debugging** — Clear error-resolution context before continuing
|
|
94
|
+
3. **Don't compact mid-implementation** — Preserve context for related changes
|
|
95
|
+
4. **Read the suggestion** — The hook tells you *when*, you decide *if*
|
|
96
|
+
5. **Write before compacting** — Save important context to files or memory before compacting
|
|
97
|
+
6. **Use `/compact` with a summary** — Add a custom message: `/compact Focus on implementing auth middleware next`
|
|
98
|
+
|
|
99
|
+
## Related
|
|
100
|
+
|
|
101
|
+
- [The Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) — Token optimization section
|
|
102
|
+
- Memory persistence hooks — For state that survives compaction
|
|
103
|
+
- `continuous-learning` skill — Extracts patterns before session ends
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-loop
|
|
3
|
+
description: "A comprehensive verification system for Claude Code sessions."
|
|
4
|
+
origin: ECC
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Verification Loop Skill
|
|
8
|
+
|
|
9
|
+
A comprehensive verification system for Claude Code sessions.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
Invoke this skill:
|
|
14
|
+
- After completing a feature or significant code change
|
|
15
|
+
- Before creating a PR
|
|
16
|
+
- When you want to ensure quality gates pass
|
|
17
|
+
- After refactoring
|
|
18
|
+
|
|
19
|
+
## Verification Phases
|
|
20
|
+
|
|
21
|
+
### Phase 1: Build Verification
|
|
22
|
+
```bash
|
|
23
|
+
# Check if project builds
|
|
24
|
+
npm run build 2>&1 | tail -20
|
|
25
|
+
# OR
|
|
26
|
+
pnpm build 2>&1 | tail -20
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If build fails, STOP and fix before continuing.
|
|
30
|
+
|
|
31
|
+
### Phase 2: Type Check
|
|
32
|
+
```bash
|
|
33
|
+
# TypeScript projects
|
|
34
|
+
npx tsc --noEmit 2>&1 | head -30
|
|
35
|
+
|
|
36
|
+
# Python projects
|
|
37
|
+
pyright . 2>&1 | head -30
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Report all type errors. Fix critical ones before continuing.
|
|
41
|
+
|
|
42
|
+
### Phase 3: Lint Check
|
|
43
|
+
```bash
|
|
44
|
+
# JavaScript/TypeScript
|
|
45
|
+
npm run lint 2>&1 | head -30
|
|
46
|
+
|
|
47
|
+
# Python
|
|
48
|
+
ruff check . 2>&1 | head -30
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Phase 4: Test Suite
|
|
52
|
+
```bash
|
|
53
|
+
# Run tests with coverage
|
|
54
|
+
npm run test -- --coverage 2>&1 | tail -50
|
|
55
|
+
|
|
56
|
+
# Check coverage threshold
|
|
57
|
+
# Target: 80% minimum
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Report:
|
|
61
|
+
- Total tests: X
|
|
62
|
+
- Passed: X
|
|
63
|
+
- Failed: X
|
|
64
|
+
- Coverage: X%
|
|
65
|
+
|
|
66
|
+
### Phase 5: Security Scan
|
|
67
|
+
```bash
|
|
68
|
+
# Check for secrets
|
|
69
|
+
grep -rn "sk-" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
|
|
70
|
+
grep -rn "api_key" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
|
|
71
|
+
|
|
72
|
+
# Check for console.log
|
|
73
|
+
grep -rn "console.log" --include="*.ts" --include="*.tsx" src/ 2>/dev/null | head -10
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Phase 6: Diff Review
|
|
77
|
+
```bash
|
|
78
|
+
# Show what changed
|
|
79
|
+
git diff --stat
|
|
80
|
+
git diff HEAD~1 --name-only
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Review each changed file for:
|
|
84
|
+
- Unintended changes
|
|
85
|
+
- Missing error handling
|
|
86
|
+
- Potential edge cases
|
|
87
|
+
|
|
88
|
+
## Output Format
|
|
89
|
+
|
|
90
|
+
After running all phases, produce a verification report:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
VERIFICATION REPORT
|
|
94
|
+
==================
|
|
95
|
+
|
|
96
|
+
Build: [PASS/FAIL]
|
|
97
|
+
Types: [PASS/FAIL] (X errors)
|
|
98
|
+
Lint: [PASS/FAIL] (X warnings)
|
|
99
|
+
Tests: [PASS/FAIL] (X/Y passed, Z% coverage)
|
|
100
|
+
Security: [PASS/FAIL] (X issues)
|
|
101
|
+
Diff: [X files changed]
|
|
102
|
+
|
|
103
|
+
Overall: [READY/NOT READY] for PR
|
|
104
|
+
|
|
105
|
+
Issues to Fix:
|
|
106
|
+
1. ...
|
|
107
|
+
2. ...
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Continuous Mode
|
|
111
|
+
|
|
112
|
+
For long sessions, run verification every 15 minutes or after major changes:
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
Set a mental checkpoint:
|
|
116
|
+
- After completing each function
|
|
117
|
+
- After finishing a component
|
|
118
|
+
- Before moving to next task
|
|
119
|
+
|
|
120
|
+
Run: /verify
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Integration with Hooks
|
|
124
|
+
|
|
125
|
+
This skill complements PostToolUse hooks but provides deeper verification.
|
|
126
|
+
Hooks catch issues immediately; this skill provides comprehensive review.
|
package/gsd/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Lex Christopherson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|