panopticon-cli 0.4.6 → 0.4.8
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 +3 -2
- package/scripts/heartbeat-hook +149 -0
- package/scripts/install-git-hooks.sh +66 -0
- package/scripts/notify-complete +79 -0
- package/scripts/postinstall.mjs +49 -0
- package/scripts/pre-tool-hook +60 -0
- package/scripts/record-cost-event.js +94 -0
- package/scripts/record-cost-event.ts +113 -0
- package/scripts/restart-dashboard.sh +59 -0
- package/scripts/setup-certs.sh +66 -0
- package/scripts/specialist-stop-hook +106 -0
- package/scripts/stop-hook +58 -0
- package/scripts/validate-merge.sh +119 -0
- package/skills/beads/README.md +120 -0
- package/skills/beads/SKILL.md +214 -0
- package/skills/beads/adr/0001-bd-prime-as-source-of-truth.md +59 -0
- package/skills/beads/resources/AGENTS.md +62 -0
- package/skills/beads/resources/ASYNC_GATES.md +168 -0
- package/skills/beads/resources/BOUNDARIES.md +469 -0
- package/skills/beads/resources/CHEMISTRY_PATTERNS.md +197 -0
- package/skills/beads/resources/CLI_REFERENCE.md +558 -0
- package/skills/beads/resources/DEPENDENCIES.md +747 -0
- package/skills/beads/resources/INTEGRATION_PATTERNS.md +407 -0
- package/skills/beads/resources/ISSUE_CREATION.md +139 -0
- package/skills/beads/resources/MOLECULES.md +354 -0
- package/skills/beads/resources/PATTERNS.md +341 -0
- package/skills/beads/resources/RESUMABILITY.md +207 -0
- package/skills/beads/resources/STATIC_DATA.md +54 -0
- package/skills/beads/resources/TROUBLESHOOTING.md +489 -0
- package/skills/beads/resources/WORKFLOWS.md +623 -0
- package/skills/beads/resources/WORKTREES.md +94 -0
- package/skills/beads-completion-check/SKILL.md +90 -0
- package/skills/beads-panopticon-guide/SKILL.md +171 -0
- package/skills/bug-fix/SKILL.md +32 -0
- package/skills/clear-writing/SKILL.md +105 -0
- package/skills/clear-writing/references/elements-of-style/01-introductory.md +3 -0
- package/skills/clear-writing/references/elements-of-style/02-elementary-rules-of-usage.md +214 -0
- package/skills/clear-writing/references/elements-of-style/03-elementary-principles-of-composition.md +398 -0
- package/skills/clear-writing/references/elements-of-style/04-a-few-matters-of-form.md +89 -0
- package/skills/clear-writing/references/elements-of-style/05-words-and-expressions-commonly-misused.md +342 -0
- package/skills/clear-writing/references/signs-of-ai-writing.md +901 -0
- package/skills/code-review/SKILL.md +37 -0
- package/skills/code-review-performance/SKILL.md +53 -0
- package/skills/code-review-security/SKILL.md +35 -0
- package/skills/dependency-update/SKILL.md +30 -0
- package/skills/feature-work/SKILL.md +39 -0
- package/skills/incident-response/SKILL.md +32 -0
- package/skills/knowledge-capture/SKILL.md +463 -0
- package/skills/onboard-codebase/SKILL.md +34 -0
- package/skills/opus-plan/SKILL.md +400 -0
- package/skills/pan-approve/SKILL.md +136 -0
- package/skills/pan-code-review/SKILL.md +249 -0
- package/skills/pan-config/SKILL.md +164 -0
- package/skills/pan-convoy-synthesis/SKILL.md +249 -0
- package/skills/pan-diagnose/SKILL.md +360 -0
- package/skills/pan-docker/SKILL.md +279 -0
- package/skills/pan-docs/SKILL.md +113 -0
- package/skills/pan-down/SKILL.md +434 -0
- package/skills/pan-health/SKILL.md +240 -0
- package/skills/pan-help/SKILL.md +237 -0
- package/skills/pan-install/SKILL.md +339 -0
- package/skills/pan-issue/SKILL.md +596 -0
- package/skills/pan-kill/SKILL.md +172 -0
- package/skills/pan-logs/SKILL.md +255 -0
- package/skills/pan-network/SKILL.md +320 -0
- package/skills/pan-oversee/SKILL.md +290 -0
- package/skills/pan-plan/SKILL.md +521 -0
- package/skills/pan-projects/SKILL.md +239 -0
- package/skills/pan-quickstart/SKILL.md +440 -0
- package/skills/pan-reload/SKILL.md +44 -0
- package/skills/pan-rescue/SKILL.md +271 -0
- package/skills/pan-restart/SKILL.md +53 -0
- package/skills/pan-setup/SKILL.md +478 -0
- package/skills/pan-skill-creator/SKILL.md +168 -0
- package/skills/pan-skill-creator/references/output-patterns.md +141 -0
- package/skills/pan-skill-creator/references/workflows.md +90 -0
- package/skills/pan-skill-creator/scripts/init_skill.py +176 -0
- package/skills/pan-status/SKILL.md +493 -0
- package/skills/pan-subagent-creator/SKILL.md +295 -0
- package/skills/pan-subagent-creator/assets/validate-readonly-query.sh +35 -0
- package/skills/pan-subagent-creator/references/example-agents.md +308 -0
- package/skills/pan-subagent-creator/scripts/init_agent.py +126 -0
- package/skills/pan-sync/SKILL.md +272 -0
- package/skills/pan-tell/SKILL.md +157 -0
- package/skills/pan-test-config/SKILL.md +208 -0
- package/skills/pan-tracker/SKILL.md +288 -0
- package/skills/pan-up/SKILL.md +458 -0
- package/skills/pan-workspace-config/SKILL.md +303 -0
- package/skills/refactor/SKILL.md +30 -0
- package/skills/refactor-radar/SKILL.md +475 -0
- package/skills/release/SKILL.md +25 -0
- package/skills/send-feedback-to-agent/SKILL.md +98 -0
- package/skills/session-health/SKILL.md +76 -0
- package/skills/session-health/scripts/check_sessions.py +166 -0
- package/skills/skill-creator/SKILL.md +92 -0
- package/skills/skill-creator/scripts/init_skill.py +152 -0
- package/skills/skill-creator/scripts/package_skill.py +123 -0
- package/skills/stitch-design-md/README.md +34 -0
- package/skills/stitch-design-md/SKILL.md +172 -0
- package/skills/stitch-design-md/examples/DESIGN.md +154 -0
- package/skills/stitch-react-components/README.md +36 -0
- package/skills/stitch-react-components/SKILL.md +47 -0
- package/skills/stitch-react-components/examples/gold-standard-card.tsx +80 -0
- package/skills/stitch-react-components/package-lock.json +231 -0
- package/skills/stitch-react-components/package.json +16 -0
- package/skills/stitch-react-components/resources/architecture-checklist.md +15 -0
- package/skills/stitch-react-components/resources/component-template.tsx +37 -0
- package/skills/stitch-react-components/resources/stitch-api-reference.md +14 -0
- package/skills/stitch-react-components/resources/style-guide.json +27 -0
- package/skills/stitch-react-components/scripts/fetch-stitch.sh +30 -0
- package/skills/stitch-react-components/scripts/validate.js +68 -0
- package/skills/stitch-setup/SKILL.md +94 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/skills/work-complete/SKILL.md +79 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Comprehensive code review covering correctness, security, performance
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review
|
|
7
|
+
|
|
8
|
+
When reviewing code, examine these areas:
|
|
9
|
+
|
|
10
|
+
## Correctness
|
|
11
|
+
- Logic errors, off-by-one, null handling
|
|
12
|
+
- Edge cases and boundary conditions
|
|
13
|
+
- Race conditions in concurrent code
|
|
14
|
+
|
|
15
|
+
## Security
|
|
16
|
+
- Input validation gaps
|
|
17
|
+
- Injection vulnerabilities (SQL, XSS, command)
|
|
18
|
+
- Authentication/authorization bypasses
|
|
19
|
+
- Sensitive data exposure
|
|
20
|
+
|
|
21
|
+
## Performance
|
|
22
|
+
- O(n^2) where O(n) is possible
|
|
23
|
+
- N+1 query patterns
|
|
24
|
+
- Unnecessary allocations in hot paths
|
|
25
|
+
- Missing caching opportunities
|
|
26
|
+
|
|
27
|
+
## Design
|
|
28
|
+
- Clear abstractions and naming
|
|
29
|
+
- Single responsibility principle
|
|
30
|
+
- Appropriate coupling/cohesion
|
|
31
|
+
|
|
32
|
+
## Output Format
|
|
33
|
+
Provide findings as:
|
|
34
|
+
- **P0 (Critical)**: Must fix before merge
|
|
35
|
+
- **P1 (Major)**: Should fix before merge
|
|
36
|
+
- **P2 (Minor)**: Nice to fix
|
|
37
|
+
- **Observations**: Non-blocking notes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review-performance
|
|
3
|
+
description: Deep performance analysis focusing on algorithms and resources
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Performance Review
|
|
7
|
+
|
|
8
|
+
## Algorithm Complexity
|
|
9
|
+
- Identify O(n^2) or worse algorithms
|
|
10
|
+
- Look for unnecessary iterations
|
|
11
|
+
- Check for opportunities to use better data structures
|
|
12
|
+
|
|
13
|
+
## Database/API Patterns
|
|
14
|
+
- N+1 query detection
|
|
15
|
+
- Missing indexes (check query patterns)
|
|
16
|
+
- Unbounded queries (missing LIMIT)
|
|
17
|
+
- Connection pool exhaustion risks
|
|
18
|
+
|
|
19
|
+
## Memory & Resources
|
|
20
|
+
- Memory leaks (unclosed resources)
|
|
21
|
+
- Unbounded caches or buffers
|
|
22
|
+
- Large object allocations in loops
|
|
23
|
+
|
|
24
|
+
## Concurrency
|
|
25
|
+
- Lock contention hotspots
|
|
26
|
+
- Blocking operations in async contexts
|
|
27
|
+
- Thread pool exhaustion
|
|
28
|
+
|
|
29
|
+
## Blocking Operations (CRITICAL for Node.js)
|
|
30
|
+
- **execSync/spawnSync** - These BLOCK the event loop and cause UI freezes
|
|
31
|
+
- Search for: `execSync`, `spawnSync`, `readFileSync` in hot paths
|
|
32
|
+
- **ALWAYS flag as HIGH IMPACT** - causes perceived hangs and latency spikes
|
|
33
|
+
|
|
34
|
+
**Fix pattern to recommend:**
|
|
35
|
+
```typescript
|
|
36
|
+
// Replace execSync with async version
|
|
37
|
+
import { exec } from 'child_process';
|
|
38
|
+
import { promisify } from 'util';
|
|
39
|
+
const execAsync = promisify(exec);
|
|
40
|
+
const { stdout } = await execAsync('command here');
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Common offenders in this codebase:
|
|
44
|
+
- `tmux capture-pane` / `tmux send-keys` / `tmux has-session`
|
|
45
|
+
- `git branch` / `git status` / `git log`
|
|
46
|
+
- `bd list` / `bd show` (beads commands)
|
|
47
|
+
|
|
48
|
+
## Output Format
|
|
49
|
+
For each finding:
|
|
50
|
+
- **Impact**: High/Medium/Low
|
|
51
|
+
- **Scale factor**: "At 10x load, this will..."
|
|
52
|
+
- **Location**: file:line
|
|
53
|
+
- **Suggested optimization**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review-security
|
|
3
|
+
description: Deep security analysis focusing on OWASP Top 10
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Security Review
|
|
7
|
+
|
|
8
|
+
Deep security analysis focus:
|
|
9
|
+
|
|
10
|
+
## OWASP Top 10 Checklist
|
|
11
|
+
- [ ] Injection (SQL, NoSQL, OS, LDAP)
|
|
12
|
+
- [ ] Broken Authentication
|
|
13
|
+
- [ ] Sensitive Data Exposure
|
|
14
|
+
- [ ] XML External Entities (XXE)
|
|
15
|
+
- [ ] Broken Access Control
|
|
16
|
+
- [ ] Security Misconfiguration
|
|
17
|
+
- [ ] Cross-Site Scripting (XSS)
|
|
18
|
+
- [ ] Insecure Deserialization
|
|
19
|
+
- [ ] Using Components with Known Vulnerabilities
|
|
20
|
+
- [ ] Insufficient Logging & Monitoring
|
|
21
|
+
|
|
22
|
+
## Additional Checks
|
|
23
|
+
- Hardcoded secrets or credentials
|
|
24
|
+
- Path traversal vulnerabilities
|
|
25
|
+
- SSRF (Server-Side Request Forgery)
|
|
26
|
+
- Cryptographic weaknesses
|
|
27
|
+
- Rate limiting gaps
|
|
28
|
+
|
|
29
|
+
## Output Format
|
|
30
|
+
For each finding:
|
|
31
|
+
- **Severity**: Critical/High/Medium/Low
|
|
32
|
+
- **Location**: file:line
|
|
33
|
+
- **Description**: What's wrong
|
|
34
|
+
- **Impact**: What could happen
|
|
35
|
+
- **Remediation**: How to fix
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dependency-update
|
|
3
|
+
description: Safe approach to updating dependencies
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Dependency Update
|
|
7
|
+
|
|
8
|
+
## 1. Audit Current State
|
|
9
|
+
```bash
|
|
10
|
+
npm outdated # See what's outdated
|
|
11
|
+
npm audit # Check for vulnerabilities
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 2. Update Strategy
|
|
15
|
+
- **Patch versions**: Usually safe, batch update
|
|
16
|
+
- **Minor versions**: Update one at a time, test
|
|
17
|
+
- **Major versions**: Update individually, read changelog
|
|
18
|
+
|
|
19
|
+
## 3. For Each Update
|
|
20
|
+
```bash
|
|
21
|
+
npm install package@version
|
|
22
|
+
npm test
|
|
23
|
+
# If tests pass, commit
|
|
24
|
+
# If tests fail, investigate or rollback
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 4. Verify
|
|
28
|
+
- Run full test suite
|
|
29
|
+
- Smoke test critical paths
|
|
30
|
+
- Check bundle size (for frontend)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feature-work
|
|
3
|
+
description: Standard workflow for implementing new features with testing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Feature Work
|
|
7
|
+
|
|
8
|
+
When implementing a new feature:
|
|
9
|
+
|
|
10
|
+
## 1. Understand Requirements
|
|
11
|
+
- Read the Linear/GitHub issue thoroughly
|
|
12
|
+
- Check for associated PRD in `docs/prds/`
|
|
13
|
+
- Identify acceptance criteria
|
|
14
|
+
- Clarify ambiguities BEFORE coding
|
|
15
|
+
|
|
16
|
+
## 2. Design Approach
|
|
17
|
+
- Identify files that need changes
|
|
18
|
+
- Consider existing patterns in codebase
|
|
19
|
+
- Plan implementation (don't gold-plate)
|
|
20
|
+
|
|
21
|
+
## 3. Implement
|
|
22
|
+
- Follow existing code conventions
|
|
23
|
+
- Make atomic, focused commits
|
|
24
|
+
- Keep changes scoped to the issue
|
|
25
|
+
- Commit format: `feat: description (ISSUE-XXX)`
|
|
26
|
+
|
|
27
|
+
## 4. Test
|
|
28
|
+
- Add tests for new functionality
|
|
29
|
+
- Run full test suite
|
|
30
|
+
- All tests must pass before proceeding
|
|
31
|
+
|
|
32
|
+
## 5. Self-Review
|
|
33
|
+
- Review your diff: `git diff origin/main...HEAD`
|
|
34
|
+
- Check for: bugs, security issues, style, cruft
|
|
35
|
+
- Fix issues found (don't just note them)
|
|
36
|
+
|
|
37
|
+
## 6. Submit
|
|
38
|
+
- Push branch: `git push -u origin $(git branch --show-current)`
|
|
39
|
+
- Create MR/PR with clear description
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: incident-response
|
|
3
|
+
description: Structured approach to production incidents
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Incident Response
|
|
7
|
+
|
|
8
|
+
## 1. Assess (First 5 minutes)
|
|
9
|
+
- What is the impact? (users affected, severity)
|
|
10
|
+
- What is the blast radius? (which services/regions)
|
|
11
|
+
- Is it getting worse or stable?
|
|
12
|
+
|
|
13
|
+
## 2. Mitigate (Stop the bleeding)
|
|
14
|
+
- Can we rollback?
|
|
15
|
+
- Can we feature-flag it off?
|
|
16
|
+
- Can we scale/redirect traffic?
|
|
17
|
+
- Communicate status to stakeholders
|
|
18
|
+
|
|
19
|
+
## 3. Investigate (Once stable)
|
|
20
|
+
- Gather logs, metrics, traces
|
|
21
|
+
- Identify root cause
|
|
22
|
+
- Document timeline of events
|
|
23
|
+
|
|
24
|
+
## 4. Fix
|
|
25
|
+
- Implement permanent fix
|
|
26
|
+
- Test thoroughly before deploying
|
|
27
|
+
- Deploy with extra monitoring
|
|
28
|
+
|
|
29
|
+
## 5. Postmortem
|
|
30
|
+
- Document: What happened, why, how we fixed it
|
|
31
|
+
- Identify: What would have prevented this
|
|
32
|
+
- Action items: Concrete improvements
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: knowledge-capture
|
|
3
|
+
description: >
|
|
4
|
+
AI self-monitoring skill. Triggers proactively when AI detects confusion or makes corrected mistakes
|
|
5
|
+
(wrong DB schema, incorrect assumptions, user corrections on key insights). Prompts to capture
|
|
6
|
+
learnings as project-specific skills. NOT user-invoked - AI should reference this when confused.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Knowledge Capture
|
|
10
|
+
|
|
11
|
+
This skill helps AI assistants recognize their own confusion and systematically capture project-specific knowledge to prevent repeated mistakes.
|
|
12
|
+
|
|
13
|
+
## When to Trigger (Self-Assessment)
|
|
14
|
+
|
|
15
|
+
**IMPORTANT:** This skill is NOT user-invoked. As the AI, you should proactively invoke this when you detect ANY of these situations:
|
|
16
|
+
|
|
17
|
+
### High-Confidence Triggers (Always Invoke)
|
|
18
|
+
|
|
19
|
+
1. **Database Schema Mistakes** [category: `database`]
|
|
20
|
+
- Queried a column that doesn't exist
|
|
21
|
+
- Used wrong column name (e.g., `user_id` vs `userId` vs `owner_id`)
|
|
22
|
+
- Assumed an index exists that doesn't
|
|
23
|
+
- Got foreign key relationships wrong
|
|
24
|
+
- Example: "SELECT created_at FROM users" → Error: column "created_at" doesn't exist (it's "createdAt")
|
|
25
|
+
|
|
26
|
+
2. **User Corrections on Architecture** [category: `architecture`]
|
|
27
|
+
- User corrects you on how a system component works
|
|
28
|
+
- User explains a non-obvious design pattern in use
|
|
29
|
+
- User clarifies that "we don't do it that way here"
|
|
30
|
+
- Example: "Actually, we use event sourcing here, not direct DB updates"
|
|
31
|
+
|
|
32
|
+
3. **API/Interface Misunderstandings** [category: `api`]
|
|
33
|
+
- Called an API endpoint that doesn't exist
|
|
34
|
+
- Used wrong HTTP method or payload structure
|
|
35
|
+
- Misunderstood authentication flow
|
|
36
|
+
- Example: Assumed REST when it's GraphQL
|
|
37
|
+
|
|
38
|
+
4. **Build/Deploy Confusion** [category: `build`]
|
|
39
|
+
- Wrong build commands for this project
|
|
40
|
+
- Incorrect environment variable names
|
|
41
|
+
- Misunderstood the deployment pipeline
|
|
42
|
+
- Example: "npm run build" fails because project uses "pnpm build:prod"
|
|
43
|
+
|
|
44
|
+
### Medium-Confidence Triggers (Invoke After 2+ Occurrences)
|
|
45
|
+
|
|
46
|
+
5. **Naming Convention Mismatches** [category: `naming`]
|
|
47
|
+
- Used camelCase when project uses snake_case (or vice versa)
|
|
48
|
+
- Got file naming patterns wrong
|
|
49
|
+
- Misnamed components/modules
|
|
50
|
+
|
|
51
|
+
6. **Testing Approach Misalignment** [category: `testing`]
|
|
52
|
+
- Wrote unit tests when project prefers integration tests
|
|
53
|
+
- Used wrong test framework or patterns
|
|
54
|
+
- Missed required test coverage patterns
|
|
55
|
+
|
|
56
|
+
7. **Code Style Conflicts** [category: `style`]
|
|
57
|
+
- Used patterns the codebase explicitly avoids
|
|
58
|
+
- Suggested dependencies the project doesn't allow
|
|
59
|
+
- Architectural patterns that conflict with project conventions
|
|
60
|
+
|
|
61
|
+
### Low-Confidence Triggers (Check Config First)
|
|
62
|
+
|
|
63
|
+
8. **Minor Corrections** [category: `preferences`]
|
|
64
|
+
- Small preference corrections from user
|
|
65
|
+
- "We prefer X over Y" statements
|
|
66
|
+
- Style guide clarifications
|
|
67
|
+
|
|
68
|
+
## Invocation Protocol
|
|
69
|
+
|
|
70
|
+
### Step 0: Check for Permanent Override
|
|
71
|
+
|
|
72
|
+
**FIRST**, check if user has permanently disabled this skill:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# If project has override skill, this skill is permanently disabled
|
|
76
|
+
if [ -f ".claude/skills/knowledge-capture/SKILL.md" ]; then
|
|
77
|
+
# User has "shut up forever" - do nothing
|
|
78
|
+
exit 0
|
|
79
|
+
fi
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If override exists, **do not prompt** - the user has explicitly disabled this skill.
|
|
83
|
+
|
|
84
|
+
### Step 0.5: Check User Preferences for Category Exclusions
|
|
85
|
+
|
|
86
|
+
Check `~/.claude/CLAUDE.md` for excluded categories:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
grep -A 20 "## AI Suggestion Preferences" ~/.claude/CLAUDE.md 2>/dev/null
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Look for sections like:
|
|
93
|
+
```markdown
|
|
94
|
+
## AI Suggestion Preferences
|
|
95
|
+
|
|
96
|
+
### knowledge-capture
|
|
97
|
+
skip: database, authentication, infrastructure
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
If the current trigger category is in the skip list, **do not prompt**.
|
|
101
|
+
|
|
102
|
+
### Step 1: Check Configuration
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
cat .panopticon/knowledge-capture.json 2>/dev/null || echo "{}"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Default configuration** (if file doesn't exist):
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"enabled": true,
|
|
112
|
+
"mode": "normal",
|
|
113
|
+
"promptCooldownMinutes": 30,
|
|
114
|
+
"lastPromptTimestamp": null,
|
|
115
|
+
"capturedCount": 0,
|
|
116
|
+
"dismissedCount": 0,
|
|
117
|
+
"sessionDismissals": 0
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Mode settings:**
|
|
122
|
+
- `"aggressive"` - Prompt on every trigger
|
|
123
|
+
- `"normal"` - Prompt on high/medium triggers, respect cooldown
|
|
124
|
+
- `"minimal"` - Only high-confidence triggers, longer cooldown
|
|
125
|
+
- `"silent"` - Log but never prompt (user said "shut up")
|
|
126
|
+
- `"disabled"` - Completely off
|
|
127
|
+
|
|
128
|
+
### Step 2: Respect Cooldowns and Dismissals
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
// Pseudocode for decision
|
|
132
|
+
if (mode === "disabled") return; // Do nothing
|
|
133
|
+
if (mode === "silent") { logInternally(); return; }
|
|
134
|
+
if (sessionDismissals >= 3) return; // User said "not now" 3 times
|
|
135
|
+
if (Date.now() - lastPromptTimestamp < cooldownMinutes * 60000) return;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Step 3: Present to User
|
|
139
|
+
|
|
140
|
+
When conditions are met, present the learning opportunity:
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
**Knowledge Capture Opportunity** [category: {CATEGORY}]
|
|
145
|
+
|
|
146
|
+
I just encountered confusion about **[SPECIFIC THING]**:
|
|
147
|
+
- What I assumed: [YOUR ASSUMPTION]
|
|
148
|
+
- What's actually true: [THE CORRECTION]
|
|
149
|
+
|
|
150
|
+
This seems like project-specific knowledge that would help me (and other AI assistants) avoid this mistake in the future.
|
|
151
|
+
|
|
152
|
+
**Would you like to capture this as project documentation?**
|
|
153
|
+
|
|
154
|
+
| Option | What happens |
|
|
155
|
+
|--------|--------------|
|
|
156
|
+
| **Yes, create skill** | I'll draft a project-specific skill with this knowledge |
|
|
157
|
+
| **Yes, add to CLAUDE.md** | I'll add a note to the project's CLAUDE.md file |
|
|
158
|
+
| **Not now** | Skip this time (I'll ask less frequently) |
|
|
159
|
+
| **Skip this category** | Never prompt about {CATEGORY} issues (updates your ~/.claude/CLAUDE.md) |
|
|
160
|
+
| **Too frequent** | Reduce how often I ask (switch to minimal mode) |
|
|
161
|
+
| **Stop asking** | Turn off prompts for this project (silent mode) |
|
|
162
|
+
| **Shut up forever** | Permanently disable for this project (creates override) |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### Step 4: Handle Response
|
|
167
|
+
|
|
168
|
+
**If "Yes, create skill":**
|
|
169
|
+
1. Create `.claude/skills/project-knowledge/SKILL.md` (or add to existing)
|
|
170
|
+
2. Document the specific confusion and correct behavior
|
|
171
|
+
3. Include examples
|
|
172
|
+
4. Update config: `capturedCount++`
|
|
173
|
+
|
|
174
|
+
**If "Yes, add to CLAUDE.md":**
|
|
175
|
+
1. Add section to project's `.claude/CLAUDE.md` (create if needed)
|
|
176
|
+
2. Document under "## Project-Specific Notes" or similar
|
|
177
|
+
3. Update config: `capturedCount++`
|
|
178
|
+
|
|
179
|
+
**If "Not now":**
|
|
180
|
+
1. Update config: `sessionDismissals++`, `lastPromptTimestamp = now`
|
|
181
|
+
2. Continue working
|
|
182
|
+
|
|
183
|
+
**If "Skip this category":**
|
|
184
|
+
1. Update `~/.claude/CLAUDE.md` to add category to skip list
|
|
185
|
+
2. Acknowledge: "Got it - I won't prompt about {CATEGORY} issues anymore. You can edit ~/.claude/CLAUDE.md to change this."
|
|
186
|
+
|
|
187
|
+
**If "Too frequent":**
|
|
188
|
+
1. Update config: `mode = "minimal"`, `promptCooldownMinutes = 120`
|
|
189
|
+
2. Acknowledge: "Got it - I'll only prompt for significant confusions."
|
|
190
|
+
|
|
191
|
+
**If "Stop asking":**
|
|
192
|
+
1. Update config: `mode = "silent"`
|
|
193
|
+
2. Acknowledge: "Understood - I'll stop prompting but continue to work normally. Say 're-enable knowledge capture' to turn prompts back on."
|
|
194
|
+
|
|
195
|
+
**If "Shut up forever":**
|
|
196
|
+
1. Create override skill to permanently disable:
|
|
197
|
+
```bash
|
|
198
|
+
mkdir -p .claude/skills/knowledge-capture
|
|
199
|
+
cat > .claude/skills/knowledge-capture/SKILL.md << 'EOF'
|
|
200
|
+
---
|
|
201
|
+
name: knowledge-capture
|
|
202
|
+
description: disabled-override-Qx7nR3
|
|
203
|
+
---
|
|
204
|
+
Disabled by user.
|
|
205
|
+
EOF
|
|
206
|
+
```
|
|
207
|
+
2. Acknowledge: "Knowledge Capture permanently disabled for this project. Delete `.claude/skills/knowledge-capture/` to re-enable."
|
|
208
|
+
|
|
209
|
+
### Step 5: Update Configuration
|
|
210
|
+
|
|
211
|
+
After any interaction, update the config file:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# Ensure directory exists
|
|
215
|
+
mkdir -p .panopticon
|
|
216
|
+
|
|
217
|
+
# Write updated config
|
|
218
|
+
cat > .panopticon/knowledge-capture.json << 'EOF'
|
|
219
|
+
{
|
|
220
|
+
"enabled": true,
|
|
221
|
+
"mode": "normal",
|
|
222
|
+
"promptCooldownMinutes": 30,
|
|
223
|
+
"lastPromptTimestamp": "2024-01-15T10:30:00Z",
|
|
224
|
+
"capturedCount": 3,
|
|
225
|
+
"dismissedCount": 1,
|
|
226
|
+
"sessionDismissals": 0
|
|
227
|
+
}
|
|
228
|
+
EOF
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## User Preferences in ~/.claude/CLAUDE.md
|
|
232
|
+
|
|
233
|
+
Users can exclude specific categories globally by adding to their personal `~/.claude/CLAUDE.md`:
|
|
234
|
+
|
|
235
|
+
```markdown
|
|
236
|
+
## AI Suggestion Preferences
|
|
237
|
+
|
|
238
|
+
### knowledge-capture
|
|
239
|
+
skip: database, authentication, infrastructure
|
|
240
|
+
|
|
241
|
+
### refactor-radar
|
|
242
|
+
skip: database-migrations, build-system
|
|
243
|
+
welcome: naming, code-organization, testing
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Available Categories
|
|
247
|
+
|
|
248
|
+
| Category | What it covers |
|
|
249
|
+
|----------|----------------|
|
|
250
|
+
| `database` | Schema mistakes, column names, indexes, relationships |
|
|
251
|
+
| `architecture` | System design, patterns, component interactions |
|
|
252
|
+
| `api` | Endpoints, HTTP methods, payloads, auth flows |
|
|
253
|
+
| `build` | Build commands, env vars, deployment pipelines |
|
|
254
|
+
| `naming` | Naming conventions, file patterns |
|
|
255
|
+
| `testing` | Test frameworks, patterns, coverage |
|
|
256
|
+
| `style` | Code style, dependencies, patterns to avoid |
|
|
257
|
+
| `preferences` | Minor user preferences |
|
|
258
|
+
| `authentication` | Auth-specific confusions (subset of api/architecture) |
|
|
259
|
+
| `infrastructure` | DevOps, CI/CD, cloud config |
|
|
260
|
+
|
|
261
|
+
### Why Skip Categories?
|
|
262
|
+
|
|
263
|
+
**Database:** "Our DBA handles all schema work - I don't need AI help here."
|
|
264
|
+
|
|
265
|
+
**Authentication:** "Auth is locked down by security team - any changes go through them."
|
|
266
|
+
|
|
267
|
+
**Infrastructure:** "We have a dedicated platform team - I just write application code."
|
|
268
|
+
|
|
269
|
+
**Build:** "Build system is stable and rarely changes - not worth documenting."
|
|
270
|
+
|
|
271
|
+
### Updating Preferences
|
|
272
|
+
|
|
273
|
+
To add a category exclusion:
|
|
274
|
+
```bash
|
|
275
|
+
# AI will add this section if it doesn't exist
|
|
276
|
+
cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
277
|
+
|
|
278
|
+
## AI Suggestion Preferences
|
|
279
|
+
|
|
280
|
+
### knowledge-capture
|
|
281
|
+
skip: database
|
|
282
|
+
EOF
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
To modify:
|
|
286
|
+
```bash
|
|
287
|
+
# Edit directly
|
|
288
|
+
nano ~/.claude/CLAUDE.md
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
To remove all exclusions:
|
|
292
|
+
```bash
|
|
293
|
+
# Remove the AI Suggestion Preferences section
|
|
294
|
+
sed -i '/## AI Suggestion Preferences/,/^## /d' ~/.claude/CLAUDE.md
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## User Commands (Escalating Silence)
|
|
298
|
+
|
|
299
|
+
Users can control this skill via natural language, from gentle to nuclear:
|
|
300
|
+
|
|
301
|
+
| Command | Effect | Scope | Reversible? |
|
|
302
|
+
|---------|--------|-------|-------------|
|
|
303
|
+
| "Not now" / "Skip" | Skip this prompt | This session | Yes (automatic) |
|
|
304
|
+
| "Skip database suggestions" | Add to skip list | All projects | Yes (edit CLAUDE.md) |
|
|
305
|
+
| "Ask less often" | Minimal mode | This project | Yes |
|
|
306
|
+
| "Stop asking" / "Silent mode" | Never prompt | This project | Yes |
|
|
307
|
+
| "Disable knowledge capture" | Completely off | This project | Yes |
|
|
308
|
+
| "Shut up forever" | Create override | This project | Yes (delete file) |
|
|
309
|
+
|
|
310
|
+
**To re-enable after "shut up forever":**
|
|
311
|
+
```bash
|
|
312
|
+
rm -rf .claude/skills/knowledge-capture/
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Example Captured Knowledge
|
|
316
|
+
|
|
317
|
+
### Example 1: Database Schema
|
|
318
|
+
|
|
319
|
+
**Trigger:** AI queried `users.created_at` but column is `users.createdAt`
|
|
320
|
+
|
|
321
|
+
**Captured skill content:**
|
|
322
|
+
```markdown
|
|
323
|
+
## Database Conventions
|
|
324
|
+
|
|
325
|
+
This project uses **camelCase** for all database columns, not snake_case.
|
|
326
|
+
|
|
327
|
+
| Wrong | Correct |
|
|
328
|
+
|-------|---------|
|
|
329
|
+
| created_at | createdAt |
|
|
330
|
+
| user_id | userId |
|
|
331
|
+
| is_active | isActive |
|
|
332
|
+
|
|
333
|
+
The ORM is Prisma with `@map` directives for legacy compatibility.
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Example 2: Build System
|
|
337
|
+
|
|
338
|
+
**Trigger:** AI ran `npm run build` but project uses pnpm workspaces
|
|
339
|
+
|
|
340
|
+
**Captured skill content:**
|
|
341
|
+
```markdown
|
|
342
|
+
## Build Commands
|
|
343
|
+
|
|
344
|
+
This is a **pnpm monorepo**. Never use npm directly.
|
|
345
|
+
|
|
346
|
+
| Task | Command |
|
|
347
|
+
|------|---------|
|
|
348
|
+
| Install | `pnpm install` |
|
|
349
|
+
| Build all | `pnpm build` |
|
|
350
|
+
| Build specific | `pnpm --filter @app/backend build` |
|
|
351
|
+
| Dev mode | `pnpm dev` |
|
|
352
|
+
| Tests | `pnpm test` |
|
|
353
|
+
|
|
354
|
+
Root package.json scripts are workspace-aware.
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Example 3: Architecture Pattern
|
|
358
|
+
|
|
359
|
+
**Trigger:** User corrected AI about direct DB access: "We use CQRS here"
|
|
360
|
+
|
|
361
|
+
**Captured skill content:**
|
|
362
|
+
```markdown
|
|
363
|
+
## Architecture: CQRS Pattern
|
|
364
|
+
|
|
365
|
+
This project uses **Command Query Responsibility Segregation**.
|
|
366
|
+
|
|
367
|
+
**Commands** (writes): Go through `src/commands/` handlers
|
|
368
|
+
**Queries** (reads): Go through `src/queries/` with read models
|
|
369
|
+
|
|
370
|
+
NEVER:
|
|
371
|
+
- Write directly to DB from API handlers
|
|
372
|
+
- Mix read and write operations in same service
|
|
373
|
+
- Query the write models directly
|
|
374
|
+
|
|
375
|
+
Event flow: Command → Handler → Event → Projector → Read Model
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Example 4: Testing Approach
|
|
379
|
+
|
|
380
|
+
**Trigger:** AI wrote unit tests but project prefers E2E
|
|
381
|
+
|
|
382
|
+
**Captured skill content:**
|
|
383
|
+
```markdown
|
|
384
|
+
## Testing Philosophy
|
|
385
|
+
|
|
386
|
+
This project prioritizes **E2E tests over unit tests**.
|
|
387
|
+
|
|
388
|
+
- Use Playwright for all user-facing features
|
|
389
|
+
- Unit tests only for pure utility functions
|
|
390
|
+
- No mocking of database - use test fixtures
|
|
391
|
+
- All tests must be deterministic (no Math.random, Date.now)
|
|
392
|
+
|
|
393
|
+
Test location: `tests/e2e/` not `__tests__/` or `*.test.ts`
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## For New/Legacy Codebases
|
|
397
|
+
|
|
398
|
+
When joining a new or legacy codebase, be **more aggressive** with knowledge capture:
|
|
399
|
+
|
|
400
|
+
1. Set mode to "aggressive" initially
|
|
401
|
+
2. After 5+ captures, suggest switching to "normal"
|
|
402
|
+
3. The goal is rapid knowledge accumulation in the first sessions
|
|
403
|
+
|
|
404
|
+
Prompt the user early:
|
|
405
|
+
|
|
406
|
+
> "I'm new to this codebase. Would you like me to actively capture project-specific patterns I learn? This helps me (and other AI assistants) get up to speed faster. I can prompt you when I discover non-obvious conventions."
|
|
407
|
+
|
|
408
|
+
## File Locations
|
|
409
|
+
|
|
410
|
+
| File | Purpose |
|
|
411
|
+
|------|---------|
|
|
412
|
+
| `~/.claude/CLAUDE.md` | User preferences (category exclusions) |
|
|
413
|
+
| `.panopticon/knowledge-capture.json` | Per-project configuration |
|
|
414
|
+
| `.claude/skills/project-knowledge/SKILL.md` | Captured knowledge as skill |
|
|
415
|
+
| `.claude/skills/knowledge-capture/SKILL.md` | Override to permanently disable |
|
|
416
|
+
| `.claude/CLAUDE.md` | Project-specific notes |
|
|
417
|
+
|
|
418
|
+
## Reset / Clean Slate
|
|
419
|
+
|
|
420
|
+
To reset knowledge capture for a project:
|
|
421
|
+
```bash
|
|
422
|
+
rm .panopticon/knowledge-capture.json
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
To remove captured knowledge:
|
|
426
|
+
```bash
|
|
427
|
+
rm -rf .claude/skills/project-knowledge/
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
To re-enable after permanent disable:
|
|
431
|
+
```bash
|
|
432
|
+
rm -rf .claude/skills/knowledge-capture/
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
To clear all category exclusions:
|
|
436
|
+
```bash
|
|
437
|
+
# Edit ~/.claude/CLAUDE.md and remove the "AI Suggestion Preferences" section
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## Integration with Other Skills
|
|
441
|
+
|
|
442
|
+
**With refactor-radar:** If the same issue triggers both skills:
|
|
443
|
+
- knowledge-capture: "Here's how to work around this confusion"
|
|
444
|
+
- refactor-radar: "Here's how to fix the codebase so this confusion doesn't happen"
|
|
445
|
+
- Prefer refactor-radar for systemic issues, knowledge-capture for workarounds
|
|
446
|
+
- Both skills share the same category exclusion system in ~/.claude/CLAUDE.md
|
|
447
|
+
|
|
448
|
+
**With pan-skill-creator:** When invoked, suggest consolidating:
|
|
449
|
+
> "You have 7 captured knowledge items in project-knowledge. Would you like me to organize these into a proper project skill?"
|
|
450
|
+
|
|
451
|
+
## Override Skill Format
|
|
452
|
+
|
|
453
|
+
The override skill is intentionally minimal to save context:
|
|
454
|
+
|
|
455
|
+
```yaml
|
|
456
|
+
---
|
|
457
|
+
name: knowledge-capture
|
|
458
|
+
description: disabled-override-Qx7nR3
|
|
459
|
+
---
|
|
460
|
+
Disabled by user.
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
The obscure description (`disabled-override-Qx7nR3`) ensures it never triggers on any user input. The body is minimal (3 words) to minimize context usage.
|