sinapse-ai 7.1.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.sinapse-ai/data/entity-registry.yaml +749 -757
  2. package/.sinapse-ai/install-manifest.yaml +4 -4
  3. package/bin/cli.js +116 -75
  4. package/package.json +2 -1
  5. package/squads/claude-code-mastery/CHANGELOG.md +22 -0
  6. package/squads/claude-code-mastery/README.md +146 -0
  7. package/squads/claude-code-mastery/agents/claude-mastery-chief.md +554 -0
  8. package/squads/claude-code-mastery/agents/config-engineer.md +865 -0
  9. package/squads/claude-code-mastery/agents/hooks-architect.md +1013 -0
  10. package/squads/claude-code-mastery/agents/mcp-integrator.md +791 -0
  11. package/squads/claude-code-mastery/agents/project-integrator.md +1196 -0
  12. package/squads/claude-code-mastery/agents/roadmap-sentinel.md +931 -0
  13. package/squads/claude-code-mastery/agents/skill-craftsman.md +1250 -0
  14. package/squads/claude-code-mastery/agents/swarm-orqx.md +1008 -0
  15. package/squads/claude-code-mastery/checklists/agent-team-readiness-checklist.md +88 -0
  16. package/squads/claude-code-mastery/checklists/brownfield-readiness-checklist.md +91 -0
  17. package/squads/claude-code-mastery/checklists/change-checklist.md +75 -0
  18. package/squads/claude-code-mastery/checklists/context-rot-checklist.md +114 -0
  19. package/squads/claude-code-mastery/checklists/integration-audit-checklist.md +104 -0
  20. package/squads/claude-code-mastery/checklists/multi-agent-review-checklist.md +77 -0
  21. package/squads/claude-code-mastery/checklists/pre-push-checklist.md +79 -0
  22. package/squads/claude-code-mastery/data/ci-cd-patterns.yaml +412 -0
  23. package/squads/claude-code-mastery/data/claude-code-quick-ref.yaml +314 -0
  24. package/squads/claude-code-mastery/data/hook-patterns.yaml +512 -0
  25. package/squads/claude-code-mastery/data/mcp-integration-catalog.yaml +323 -0
  26. package/squads/claude-code-mastery/data/project-type-signatures.yaml +335 -0
  27. package/squads/claude-code-mastery/scripts/validate-setup.js +163 -0
  28. package/squads/claude-code-mastery/squad.yaml +205 -0
  29. package/squads/claude-code-mastery/tasks/audit-integration.md +219 -0
  30. package/squads/claude-code-mastery/tasks/audit-settings.md +206 -0
  31. package/squads/claude-code-mastery/tasks/audit-setup.md +225 -0
  32. package/squads/claude-code-mastery/tasks/brownfield-setup.md +322 -0
  33. package/squads/claude-code-mastery/tasks/ci-cd-setup.md +335 -0
  34. package/squads/claude-code-mastery/tasks/claude-md-engineer.md +334 -0
  35. package/squads/claude-code-mastery/tasks/configure-claude-code.md +215 -0
  36. package/squads/claude-code-mastery/tasks/context-rot-audit.md +329 -0
  37. package/squads/claude-code-mastery/tasks/create-agent-definition.md +278 -0
  38. package/squads/claude-code-mastery/tasks/create-rules.md +206 -0
  39. package/squads/claude-code-mastery/tasks/create-team-topology.md +258 -0
  40. package/squads/claude-code-mastery/tasks/diagnose.md +166 -0
  41. package/squads/claude-code-mastery/tasks/enterprise-config.md +346 -0
  42. package/squads/claude-code-mastery/tasks/hook-designer.md +272 -0
  43. package/squads/claude-code-mastery/tasks/integrate-project.md +304 -0
  44. package/squads/claude-code-mastery/tasks/mcp-integration-plan.md +229 -0
  45. package/squads/claude-code-mastery/tasks/mcp-workflow.md +285 -0
  46. package/squads/claude-code-mastery/tasks/multi-project-setup.md +228 -0
  47. package/squads/claude-code-mastery/tasks/optimize-context.md +217 -0
  48. package/squads/claude-code-mastery/tasks/optimize-workflow.md +226 -0
  49. package/squads/claude-code-mastery/tasks/parallel-decomposition.md +293 -0
  50. package/squads/claude-code-mastery/tasks/permission-strategy.md +266 -0
  51. package/squads/claude-code-mastery/tasks/sandbox-setup.md +279 -0
  52. package/squads/claude-code-mastery/tasks/setup-repository.md +230 -0
  53. package/squads/claude-code-mastery/tasks/setup-wizard.md +236 -0
  54. package/squads/claude-code-mastery/tasks/worktree-strategy.md +320 -0
  55. package/squads/claude-code-mastery/templates/claude-md-fullstack.md +147 -0
  56. package/squads/claude-code-mastery/templates/claude-md-library.md +175 -0
  57. package/squads/claude-code-mastery/templates/claude-md-microservices.md +186 -0
  58. package/squads/claude-code-mastery/templates/claude-md-mobile.md +198 -0
  59. package/squads/claude-code-mastery/templates/claude-md-monorepo.md +139 -0
  60. package/squads/claude-code-mastery/templates/github-actions-claude-ci.yml +348 -0
  61. package/squads/claude-code-mastery/templates/github-actions-claude-review.yml +179 -0
  62. package/squads/claude-code-mastery/workflows/wf-audit-complete.yaml +140 -0
  63. package/squads/claude-code-mastery/workflows/wf-knowledge-update.yaml +165 -0
  64. package/squads/claude-code-mastery/workflows/wf-project-setup.yaml +192 -0
@@ -0,0 +1,217 @@
1
+ # Task: Optimize Context Window Usage
2
+
3
+ **Task ID:** CCM-CONFIG-004
4
+ **Version:** 1.0.0
5
+ **Command:** `*optimize-context`
6
+ **Orchestrator:** Sigil (config-engineer)
7
+ **Purpose:** Optimize context window usage by analyzing CLAUDE.md size, moving detailed instructions to conditional `.claude/rules/`, configuring auto-compaction, and reviewing auto-memory files for efficiency.
8
+
9
+ ---
10
+
11
+ ## Overview
12
+
13
+ ```
14
+ +------------------+ +------------------+ +------------------+
15
+ | 1. Analyze | --> | 2. Move Detailed | --> | 3. Configure |
16
+ | CLAUDE.md | | Instructions | | Conditional |
17
+ | Size | | to rules/ | | Loading |
18
+ +------------------+ +------------------+ +------------------+
19
+ | |
20
+ v v
21
+ +------------------+ +------------------+ +------------------+
22
+ | 4. Review Auto- | --> | 5. Configure | --> | BUDGET |
23
+ | Memory Files | | Compaction | | REPORT |
24
+ +------------------+ +------------------+ +------------------+
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Inputs
30
+
31
+ | Field | Type | Source | Required | Validation |
32
+ |-------|------|--------|----------|------------|
33
+ | project_root | string | Working directory | Yes | Must contain CLAUDE.md or .claude/CLAUDE.md |
34
+ | target_lines | number | User parameter | No | Target max lines for CLAUDE.md (default: 200) |
35
+ | dry_run | boolean | User parameter | No | If true, only report without making changes |
36
+
37
+ ---
38
+
39
+ ## Preconditions
40
+
41
+ - At least one CLAUDE.md file exists (project root or .claude/)
42
+ - Read access to .claude/rules/ directory
43
+ - Read access to auto-memory directory (~/.claude/projects/)
44
+
45
+ ---
46
+
47
+ ## Execution Phases
48
+
49
+ ### Phase 1: Analyze CLAUDE.md Size
50
+
51
+ 1. Locate all CLAUDE.md files:
52
+ - `./CLAUDE.md` (project root)
53
+ - `./.claude/CLAUDE.md` (claude directory)
54
+ - `./CLAUDE.local.md` (local overrides)
55
+ - `~/.claude/CLAUDE.md` (user-level)
56
+ 2. For each file, measure:
57
+ - Total line count
58
+ - Section count (by markdown headers)
59
+ - Estimated token count (lines x ~4 tokens average)
60
+ - @import count and what they reference
61
+ 3. Categorize content sections by purpose:
62
+ - **Core instructions** (must stay): Project overview, key commands, agent system
63
+ - **Conditional content** (can move to rules/): Framework-specific, path-scoped
64
+ - **Reference material** (should use @imports): Architecture docs, API specs
65
+ - **Redundant content** (can remove): Duplicated across files, outdated
66
+ 4. Generate the analysis table:
67
+
68
+ | Section | Lines | Category | Recommendation |
69
+ |---------|-------|----------|----------------|
70
+ | {header} | {N} | {core/conditional/reference/redundant} | {keep/move/import/remove} |
71
+
72
+ ### Phase 2: Move Detailed Instructions to .claude/rules/
73
+
74
+ For each section categorized as "conditional":
75
+
76
+ 1. Identify the file paths this section applies to:
77
+ - API instructions -> `src/api/**`, `server/**`
78
+ - Component patterns -> `src/components/**/*.tsx`
79
+ - Test conventions -> `tests/**`, `**/*.test.*`
80
+ - Database rules -> `migrations/**`, `supabase/**`
81
+ 2. Create a new `.claude/rules/{section-name}.md` file:
82
+ - Add `paths:` YAML frontmatter with appropriate glob patterns
83
+ - Move the section content into the rule file
84
+ - Preserve formatting and code examples
85
+ 3. Remove the moved section from CLAUDE.md
86
+ 4. Add a brief reference comment where the section was:
87
+ ```markdown
88
+ <!-- API conventions: see .claude/rules/api-conventions.md -->
89
+ ```
90
+
91
+ ### Phase 3: Configure Conditional Loading
92
+
93
+ 1. Verify all new rule files have proper frontmatter:
94
+ ```yaml
95
+ ---
96
+ paths:
97
+ - "src/api/**/*.ts"
98
+ ---
99
+ ```
100
+ 2. Test glob patterns match actual project files
101
+ 3. Organize rules into subdirectories if many rules exist:
102
+ ```
103
+ .claude/rules/
104
+ frontend/
105
+ component-patterns.md
106
+ styling-rules.md
107
+ backend/
108
+ api-conventions.md
109
+ database-rules.md
110
+ testing/
111
+ test-patterns.md
112
+ ```
113
+ 4. Remove any existing always-on rules that should be conditional
114
+
115
+ ### Phase 4: Review Auto-Memory Files
116
+
117
+ 1. Check the auto-memory directory:
118
+ - `~/.claude/projects/{project-hash}/memory/`
119
+ 2. If auto-memory files exist:
120
+ - List all memory files and their sizes
121
+ - Check for outdated or irrelevant memories
122
+ - Flag memories that duplicate CLAUDE.md content
123
+ - Suggest cleanup of stale memories
124
+ 3. If auto-memory is not active:
125
+ - Inform the user about auto-memory (Claude creates it automatically)
126
+ - No action needed
127
+
128
+ ### Phase 5: Configure Compaction
129
+
130
+ 1. Assess the current compaction settings:
131
+ - Check for `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` env variable
132
+ - Default trigger is ~95% context capacity
133
+ 2. Recommend compaction threshold based on project size:
134
+
135
+ | Project Size | CLAUDE.md Lines | Recommended PCT | Rationale |
136
+ |-------------|----------------|-----------------|-----------|
137
+ | Small (<100 files) | <100 | Default (95%) | Rarely hits limit |
138
+ | Medium (100-500 files) | 100-200 | 80% | Some headroom needed |
139
+ | Large (500+ files) | 200+ | 50-60% | Frequent compaction needed |
140
+
141
+ 3. Check for PreCompact hook:
142
+ - If missing: recommend adding one for context preservation
143
+ - If present: verify it has reasonable timeout (5-10 seconds)
144
+ 4. Check `CLAUDE_CODE_MAX_OUTPUT_TOKENS` setting:
145
+ - Default: 32000, Maximum: 64000
146
+ - Higher values reduce available context window
147
+ - Recommend default unless user needs long outputs
148
+
149
+ ---
150
+
151
+ ## Output Format
152
+
153
+ ```markdown
154
+ ## Context Optimization Report
155
+
156
+ **Project:** {project-name}
157
+ **Date:** {YYYY-MM-DD}
158
+ **Mode:** {dry-run | applied}
159
+
160
+ ### CLAUDE.md Analysis
161
+
162
+ | Metric | Before | After | Change |
163
+ |--------|--------|-------|--------|
164
+ | Total lines | {N} | {N} | {-N (-X%)} |
165
+ | Sections | {N} | {N} | {-N} |
166
+ | Est. tokens | {N} | {N} | {-N (-X%)} |
167
+ | @imports | {N} | {N} | {+N} |
168
+
169
+ ### Content Redistribution
170
+
171
+ | Section | Lines | Action | Destination |
172
+ |---------|-------|--------|-------------|
173
+ | {section} | {N} | {moved/imported/removed/kept} | {.claude/rules/X.md | @import | --} |
174
+
175
+ ### Context Budget
176
+
177
+ | Component | Lines | Tokens (est.) | Loading |
178
+ |-----------|-------|---------------|---------|
179
+ | CLAUDE.md | {N} | {N} | Always |
180
+ | .claude/rules/ (total) | {N} | {N} | Conditional |
181
+ | Auto-memory | {N} | {N} | Always |
182
+ | **Total always-loaded** | {N} | {N} | -- |
183
+
184
+ ### Compaction Settings
185
+
186
+ - **Current trigger:** {N}% (default | override)
187
+ - **Recommended trigger:** {N}%
188
+ - **PreCompact hook:** {configured | missing}
189
+ - **Max output tokens:** {N}
190
+
191
+ ### Savings Summary
192
+
193
+ - **Context saved per interaction:** ~{N} tokens ({X}% reduction)
194
+ - **Conditional content:** {N} lines loaded only when relevant
195
+ - **Files optimized:** {N}
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Veto Conditions
201
+
202
+ - **NEVER** delete content from CLAUDE.md without moving it to .claude/rules/ or confirming with the user that it is redundant.
203
+ - **NEVER** set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE below 30. Values too low cause excessive compaction that degrades session quality.
204
+ - **NEVER** create always-on rules for content that is path-specific. Always use paths: frontmatter for conditional loading.
205
+ - **NEVER** modify auto-memory files directly. They are managed by Claude Code automatically.
206
+ - **NEVER** reduce CLAUDE.md below a functional minimum. Core instructions (project overview, key commands, essential conventions) must remain.
207
+
208
+ ---
209
+
210
+ ## Completion Criteria
211
+
212
+ - [ ] All CLAUDE.md files analyzed with line counts and section categorization
213
+ - [ ] Conditional content identified and moved to .claude/rules/
214
+ - [ ] Glob patterns validated against project structure
215
+ - [ ] Auto-memory files reviewed for staleness
216
+ - [ ] Compaction threshold recommended with rationale
217
+ - [ ] Before/after comparison generated showing token savings
@@ -0,0 +1,226 @@
1
+ # Task: Optimize Claude Code Workflow
2
+
3
+ **Task ID:** CCM-PI-003
4
+ **Version:** 1.0.0
5
+ **Command:** `*optimize-workflow`
6
+ **Agent:** Conduit (project-integrator)
7
+ **Purpose:** Optimize Claude Code workflow for maximum productivity by analyzing usage patterns, identifying bottlenecks, and configuring permissions, shortcuts, and automation.
8
+
9
+ ---
10
+
11
+ ## Overview
12
+
13
+ ```
14
+ Current Setup
15
+ |
16
+ v
17
+ +---------------------+
18
+ | 1. Analyze Usage |
19
+ | Patterns |
20
+ +---------------------+
21
+ |
22
+ v
23
+ +---------------------+
24
+ | 2. Identify |
25
+ | Bottlenecks |
26
+ +---------------------+
27
+ |
28
+ v
29
+ +---------------------+
30
+ | 3. Optimize |
31
+ | Permissions |
32
+ +---------------------+
33
+ |
34
+ v
35
+ +---------------------+
36
+ | 4. Set Up Keyboard |
37
+ | Shortcuts |
38
+ +---------------------+
39
+ |
40
+ v
41
+ +---------------------+
42
+ | 5. Configure |
43
+ | Auto-Memory |
44
+ +---------------------+
45
+ |
46
+ v
47
+ +---------------------+
48
+ | 6. Generate |
49
+ | Optimization Plan |
50
+ +---------------------+
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Inputs
56
+
57
+ | Field | Type | Source | Required | Validation |
58
+ |-------|------|--------|----------|------------|
59
+ | project_path | string | User or cwd | Yes | Must contain .claude/ directory |
60
+ | pain_points | string[] | User | No | Described bottlenecks (e.g., "too many permission prompts") |
61
+ | workflow_type | enum | User | No | `solo-dev`, `team-review`, `ci-cd`, `exploratory` |
62
+
63
+ ---
64
+
65
+ ## Preconditions
66
+
67
+ - Claude Code integration exists (.claude/ directory present)
68
+ - User has used Claude Code on this project at least once
69
+
70
+ ---
71
+
72
+ ## Execution Phases
73
+
74
+ ### Phase 1: Analyze Usage Patterns
75
+
76
+ Examine current configuration to infer usage patterns:
77
+
78
+ 1. **CLAUDE.md analysis**: what instructions are present, what is missing
79
+ 2. **settings.json review**: current allow/deny rules, how restrictive
80
+ 3. **Rules inventory**: how many rules, what domains they cover
81
+ 4. **Hook presence**: what automation exists
82
+ 5. **Command/skill inventory**: custom commands and skills defined
83
+ 6. **Project size estimation**: file count, language distribution
84
+
85
+ Classify the current configuration maturity:
86
+ | Level | Description | Typical Signs |
87
+ |-------|-------------|---------------|
88
+ | Starter | Minimal setup | Only CLAUDE.md, no rules, no hooks |
89
+ | Intermediate | Functional | CLAUDE.md + settings + some rules |
90
+ | Advanced | Optimized | Full rules, hooks, skills, MCP configured |
91
+ | Expert | Fully automated | CI/CD integration, custom hooks, agent teams |
92
+
93
+ ### Phase 2: Identify Bottlenecks
94
+
95
+ Check for common productivity killers:
96
+
97
+ 1. **Permission prompts**: overly restrictive settings forcing repeated approvals
98
+ - Look for missing allow rules for common commands (npm, git, build tools)
99
+ - Check if `Bash` tool has no allows (causes prompt on every command)
100
+ 2. **Slow tool execution**: MCP servers with high latency, missing caching
101
+ 3. **Context bloat**: CLAUDE.md over 150 lines, too many always-loaded rules
102
+ 4. **Missing automation**: repetitive tasks that could be hooks or skills
103
+ 5. **Context rot**: long sessions without compaction strategy
104
+ 6. **Redundant instructions**: duplicated guidance between CLAUDE.md and rules
105
+
106
+ For each bottleneck found, estimate impact: HIGH, MEDIUM, LOW.
107
+
108
+ ### Phase 3: Optimize Permission Strategy
109
+
110
+ Design a permission strategy that balances safety and speed:
111
+
112
+ 1. **Safe allows** (add to settings.json allow list):
113
+ - Build commands: `npm run build`, `npm run dev`, `npm test`
114
+ - Lint commands: `npm run lint`, `npm run typecheck`
115
+ - Git read commands: `git status`, `git diff`, `git log`
116
+ - Language servers and formatters
117
+ 2. **Smart denies** (keep or add to deny list):
118
+ - Destructive commands: `rm -rf`, `DROP`, `git push --force`
119
+ - Production access: database URLs, deployment commands
120
+ - Sensitive paths: `.env`, credentials, secrets
121
+ 3. **Contextual permissions**: use path-based rules for directory-specific allows
122
+
123
+ Present before/after comparison of expected permission prompts.
124
+
125
+ ### Phase 4: Set Up Keyboard Shortcuts
126
+
127
+ Recommend keyboard shortcut configuration for the user's workflow:
128
+
129
+ 1. **Essential shortcuts** (all workflows):
130
+ - Quick escape: cancel current operation
131
+ - Accept suggestion: fast-approve tool use
132
+ - Compact context: trigger manual compaction
133
+ 2. **Development shortcuts**:
134
+ - Run tests: one-key test execution
135
+ - Quick commit: stage + commit flow
136
+ - Toggle agent: switch between agent modes
137
+ 3. **Review shortcuts**:
138
+ - Next file: navigate changed files
139
+ - Approve/reject: fast review actions
140
+
141
+ Provide configuration snippets for VS Code keybindings.json if applicable.
142
+
143
+ ### Phase 5: Configure Auto-Memory
144
+
145
+ Set up persistent memory for cross-session efficiency:
146
+
147
+ 1. **Agent memory**: create `.claude/agent-memory/` structure
148
+ - MEMORY.md for session-persistent patterns
149
+ - Topic files for domain knowledge
150
+ 2. **Memory hygiene rules**:
151
+ - What to save: confirmed patterns, user preferences, debugging solutions
152
+ - What NOT to save: session-specific state, speculative conclusions
153
+ - Size limits: MEMORY.md under 200 lines
154
+ 3. **Memory templates**: pre-populate with project conventions if detectable
155
+
156
+ ### Phase 6: Generate Optimization Plan
157
+
158
+ Produce a prioritized optimization plan:
159
+
160
+ 1. Sort all recommendations by impact (HIGH first)
161
+ 2. Group by effort: Quick Wins (< 5 min), Medium (5-30 min), Investment (30+ min)
162
+ 3. For each recommendation, provide exact implementation steps
163
+ 4. Estimate total time saved per week after optimization
164
+
165
+ ---
166
+
167
+ ## Output Format
168
+
169
+ ```markdown
170
+ ## Workflow Optimization Report
171
+
172
+ **Project:** {project_path}
173
+ **Current Maturity:** {level}
174
+ **Estimated Improvement:** {X}% fewer interruptions
175
+
176
+ ### Bottlenecks Found
177
+
178
+ | Bottleneck | Impact | Fix Effort |
179
+ |------------|--------|------------|
180
+ | {description} | HIGH/MED/LOW | Quick/Medium/Investment |
181
+
182
+ ### Quick Wins (Apply Now)
183
+
184
+ 1. **{title}**: {description}
185
+ ```json
186
+ // Exact config change
187
+ ```
188
+
189
+ ### Medium Effort
190
+
191
+ 1. **{title}**: {description}
192
+ - Step 1: ...
193
+ - Step 2: ...
194
+
195
+ ### Investment Items
196
+
197
+ 1. **{title}**: {description}
198
+ - Estimated time: {X} minutes
199
+ - Expected benefit: {description}
200
+
201
+ ### Permission Optimization
202
+
203
+ **Before:** {N} expected prompts per session
204
+ **After:** {M} expected prompts per session
205
+ **Reduction:** {X}%
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Veto Conditions
211
+
212
+ - **NEVER** add allow rules for destructive operations to reduce prompts
213
+ - **NEVER** disable security hooks for convenience
214
+ - **NEVER** remove deny rules without explaining the security tradeoff
215
+ - **NEVER** make changes without presenting the plan first -- this task produces a plan, user applies it
216
+
217
+ ---
218
+
219
+ ## Completion Criteria
220
+
221
+ - [ ] Usage patterns analyzed and maturity level classified
222
+ - [ ] Bottlenecks identified with impact assessment
223
+ - [ ] Permission strategy designed with before/after comparison
224
+ - [ ] Keyboard shortcuts recommended for workflow type
225
+ - [ ] Memory configuration suggested
226
+ - [ ] Prioritized optimization plan delivered