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.
- package/.sinapse-ai/data/entity-registry.yaml +749 -757
- package/.sinapse-ai/install-manifest.yaml +4 -4
- package/bin/cli.js +116 -75
- package/package.json +2 -1
- package/squads/claude-code-mastery/CHANGELOG.md +22 -0
- package/squads/claude-code-mastery/README.md +146 -0
- package/squads/claude-code-mastery/agents/claude-mastery-chief.md +554 -0
- package/squads/claude-code-mastery/agents/config-engineer.md +865 -0
- package/squads/claude-code-mastery/agents/hooks-architect.md +1013 -0
- package/squads/claude-code-mastery/agents/mcp-integrator.md +791 -0
- package/squads/claude-code-mastery/agents/project-integrator.md +1196 -0
- package/squads/claude-code-mastery/agents/roadmap-sentinel.md +931 -0
- package/squads/claude-code-mastery/agents/skill-craftsman.md +1250 -0
- package/squads/claude-code-mastery/agents/swarm-orqx.md +1008 -0
- package/squads/claude-code-mastery/checklists/agent-team-readiness-checklist.md +88 -0
- package/squads/claude-code-mastery/checklists/brownfield-readiness-checklist.md +91 -0
- package/squads/claude-code-mastery/checklists/change-checklist.md +75 -0
- package/squads/claude-code-mastery/checklists/context-rot-checklist.md +114 -0
- package/squads/claude-code-mastery/checklists/integration-audit-checklist.md +104 -0
- package/squads/claude-code-mastery/checklists/multi-agent-review-checklist.md +77 -0
- package/squads/claude-code-mastery/checklists/pre-push-checklist.md +79 -0
- package/squads/claude-code-mastery/data/ci-cd-patterns.yaml +412 -0
- package/squads/claude-code-mastery/data/claude-code-quick-ref.yaml +314 -0
- package/squads/claude-code-mastery/data/hook-patterns.yaml +512 -0
- package/squads/claude-code-mastery/data/mcp-integration-catalog.yaml +323 -0
- package/squads/claude-code-mastery/data/project-type-signatures.yaml +335 -0
- package/squads/claude-code-mastery/scripts/validate-setup.js +163 -0
- package/squads/claude-code-mastery/squad.yaml +205 -0
- package/squads/claude-code-mastery/tasks/audit-integration.md +219 -0
- package/squads/claude-code-mastery/tasks/audit-settings.md +206 -0
- package/squads/claude-code-mastery/tasks/audit-setup.md +225 -0
- package/squads/claude-code-mastery/tasks/brownfield-setup.md +322 -0
- package/squads/claude-code-mastery/tasks/ci-cd-setup.md +335 -0
- package/squads/claude-code-mastery/tasks/claude-md-engineer.md +334 -0
- package/squads/claude-code-mastery/tasks/configure-claude-code.md +215 -0
- package/squads/claude-code-mastery/tasks/context-rot-audit.md +329 -0
- package/squads/claude-code-mastery/tasks/create-agent-definition.md +278 -0
- package/squads/claude-code-mastery/tasks/create-rules.md +206 -0
- package/squads/claude-code-mastery/tasks/create-team-topology.md +258 -0
- package/squads/claude-code-mastery/tasks/diagnose.md +166 -0
- package/squads/claude-code-mastery/tasks/enterprise-config.md +346 -0
- package/squads/claude-code-mastery/tasks/hook-designer.md +272 -0
- package/squads/claude-code-mastery/tasks/integrate-project.md +304 -0
- package/squads/claude-code-mastery/tasks/mcp-integration-plan.md +229 -0
- package/squads/claude-code-mastery/tasks/mcp-workflow.md +285 -0
- package/squads/claude-code-mastery/tasks/multi-project-setup.md +228 -0
- package/squads/claude-code-mastery/tasks/optimize-context.md +217 -0
- package/squads/claude-code-mastery/tasks/optimize-workflow.md +226 -0
- package/squads/claude-code-mastery/tasks/parallel-decomposition.md +293 -0
- package/squads/claude-code-mastery/tasks/permission-strategy.md +266 -0
- package/squads/claude-code-mastery/tasks/sandbox-setup.md +279 -0
- package/squads/claude-code-mastery/tasks/setup-repository.md +230 -0
- package/squads/claude-code-mastery/tasks/setup-wizard.md +236 -0
- package/squads/claude-code-mastery/tasks/worktree-strategy.md +320 -0
- package/squads/claude-code-mastery/templates/claude-md-fullstack.md +147 -0
- package/squads/claude-code-mastery/templates/claude-md-library.md +175 -0
- package/squads/claude-code-mastery/templates/claude-md-microservices.md +186 -0
- package/squads/claude-code-mastery/templates/claude-md-mobile.md +198 -0
- package/squads/claude-code-mastery/templates/claude-md-monorepo.md +139 -0
- package/squads/claude-code-mastery/templates/github-actions-claude-ci.yml +348 -0
- package/squads/claude-code-mastery/templates/github-actions-claude-review.yml +179 -0
- package/squads/claude-code-mastery/workflows/wf-audit-complete.yaml +140 -0
- package/squads/claude-code-mastery/workflows/wf-knowledge-update.yaml +165 -0
- package/squads/claude-code-mastery/workflows/wf-project-setup.yaml +192 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Task: Parallel Task Decomposition for Agent Execution
|
|
2
|
+
|
|
3
|
+
**Task ID:** parallel-decomposition
|
|
4
|
+
**Version:** 1.0
|
|
5
|
+
**Purpose:** Decompose a complex task into subtasks for parallel multi-agent execution
|
|
6
|
+
**Orchestrator:** @swarm-orqx (Nexus)
|
|
7
|
+
**Mode:** Interactive (elicit: true)
|
|
8
|
+
**Quality Standard:** Dependency graph validated, no circular dependencies, merge strategy tested
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
This task analyzes a workload, identifies independent subtasks, designs a parallel execution plan, and configures agents for simultaneous execution. The key insight: **maximum parallelism comes from minimizing dependencies, not maximizing agents**.
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
INPUT (task_description + constraints)
|
|
18
|
+
|
|
|
19
|
+
[PHASE 1: TASK ANALYSIS]
|
|
20
|
+
-> Break task into atomic subtasks
|
|
21
|
+
-> Classify each subtask's complexity
|
|
22
|
+
-> Estimate execution time per subtask
|
|
23
|
+
|
|
|
24
|
+
[PHASE 2: DEPENDENCY MAPPING]
|
|
25
|
+
-> Identify data dependencies between subtasks
|
|
26
|
+
-> Identify resource conflicts (same files, same APIs)
|
|
27
|
+
-> Build dependency graph
|
|
28
|
+
|
|
|
29
|
+
[PHASE 3: EXECUTION PLAN]
|
|
30
|
+
-> Group independent subtasks into waves
|
|
31
|
+
-> Assign agents to each wave
|
|
32
|
+
-> Configure foreground vs background execution
|
|
33
|
+
|
|
|
34
|
+
[PHASE 4: AGENT CONFIGURATION]
|
|
35
|
+
-> Create or select agent definitions
|
|
36
|
+
-> Set model tiers per subtask complexity
|
|
37
|
+
-> Configure tool permissions
|
|
38
|
+
|
|
|
39
|
+
[PHASE 5: MERGE STRATEGY]
|
|
40
|
+
-> Define how agent outputs combine
|
|
41
|
+
-> Handle conflicting changes
|
|
42
|
+
-> Plan integration verification
|
|
43
|
+
|
|
|
44
|
+
[PHASE 6: MONITORING]
|
|
45
|
+
-> Set up progress tracking
|
|
46
|
+
-> Define timeout thresholds
|
|
47
|
+
-> Plan failure recovery
|
|
48
|
+
|
|
|
49
|
+
OUTPUT: Execution plan + dependency graph + agent configs + merge strategy
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Inputs
|
|
55
|
+
|
|
56
|
+
| Field | Type | Source | Required | Validation |
|
|
57
|
+
|-------|------|--------|----------|------------|
|
|
58
|
+
| task_description | string | User | yes | Full description of the work to parallelize |
|
|
59
|
+
| max_parallel_agents | number | User or default | no | Maximum simultaneous agents (default: 4) |
|
|
60
|
+
| isolation_mode | enum | User | no | shared / worktree / branch (default: shared) |
|
|
61
|
+
| time_constraint | string | User | no | Target completion time |
|
|
62
|
+
| cost_constraint | enum | User | no | low / medium / high (affects model selection) |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Preconditions
|
|
67
|
+
|
|
68
|
+
1. Task is large enough to benefit from parallelization (2+ independent subtasks)
|
|
69
|
+
2. Claude Code is operational with Agent tool available
|
|
70
|
+
3. Sufficient API rate limits for parallel agent calls
|
|
71
|
+
4. Git repository is clean (no uncommitted changes) if using worktree isolation
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Phase 1: Task Analysis
|
|
76
|
+
|
|
77
|
+
**Goal:** Break the task into the smallest independent units of work.
|
|
78
|
+
|
|
79
|
+
### Steps
|
|
80
|
+
|
|
81
|
+
1.1. Read the full task description.
|
|
82
|
+
1.2. Identify atomic subtasks -- each should be:
|
|
83
|
+
- Completable by a single agent
|
|
84
|
+
- Testable independently
|
|
85
|
+
- Producing a clear output artifact
|
|
86
|
+
1.3. Classify each subtask:
|
|
87
|
+
|
|
88
|
+
| Complexity | Lines of Change | Model | Estimated Time |
|
|
89
|
+
|------------|----------------|-------|----------------|
|
|
90
|
+
| Trivial | < 20 lines | haiku | 1-2 min |
|
|
91
|
+
| Simple | 20-100 lines | sonnet | 3-5 min |
|
|
92
|
+
| Standard | 100-500 lines | sonnet | 5-15 min |
|
|
93
|
+
| Complex | 500+ lines | opus | 15-30 min |
|
|
94
|
+
|
|
95
|
+
1.4. Create a subtask inventory table:
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
| ID | Subtask | Complexity | Est. Time | Dependencies |
|
|
99
|
+
|----|---------|-----------|-----------|--------------|
|
|
100
|
+
| S1 | ... | simple | 3 min | none |
|
|
101
|
+
| S2 | ... | standard | 10 min | S1 |
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Phase 2: Dependency Mapping
|
|
107
|
+
|
|
108
|
+
**Goal:** Build a dependency graph to identify parallelization opportunities.
|
|
109
|
+
|
|
110
|
+
### Dependency Types
|
|
111
|
+
|
|
112
|
+
| Type | Description | Impact |
|
|
113
|
+
|------|-------------|--------|
|
|
114
|
+
| **Data** | S2 needs output from S1 | Must sequence |
|
|
115
|
+
| **Resource** | S1 and S3 modify same file | Must sequence or isolate |
|
|
116
|
+
| **Semantic** | S2 should know what S1 decided | Can use shared context file |
|
|
117
|
+
| **None** | S1 and S4 are fully independent | Can parallelize |
|
|
118
|
+
|
|
119
|
+
### Steps
|
|
120
|
+
|
|
121
|
+
2.1. For each subtask pair, determine dependency type.
|
|
122
|
+
2.2. Build a dependency graph:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Dependency Graph Template:
|
|
126
|
+
|
|
127
|
+
S1 -----> S3 -----> S5
|
|
128
|
+
\ ^
|
|
129
|
+
\ /
|
|
130
|
+
S2 -----> S4 -----
|
|
131
|
+
|
|
132
|
+
Legend: Arrow = "must complete before"
|
|
133
|
+
Parallel: {S1, S2} can run together
|
|
134
|
+
Sequential: S3 waits for S1, S4 waits for S2
|
|
135
|
+
Join: S5 waits for S3 and S4
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
2.3. Detect circular dependencies (VETO if found).
|
|
139
|
+
2.4. Calculate critical path (longest sequential chain).
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Phase 3: Execution Plan
|
|
144
|
+
|
|
145
|
+
**Goal:** Group subtasks into parallel execution waves.
|
|
146
|
+
|
|
147
|
+
### Parallelization Patterns
|
|
148
|
+
|
|
149
|
+
| Pattern | Description | Use When |
|
|
150
|
+
|---------|-------------|----------|
|
|
151
|
+
| **Fan-Out/Fan-In** | Dispatch N agents, collect all results | Independent subtasks with shared merge |
|
|
152
|
+
| **Pipeline** | Chain agents A -> B -> C | Sequential transformation |
|
|
153
|
+
| **Scatter-Gather** | Dispatch same task to N agents, pick best | Need diverse approaches to same problem |
|
|
154
|
+
| **Wave** | Groups of parallel tasks with sync points | Mixed dependencies |
|
|
155
|
+
|
|
156
|
+
### Wave Planning
|
|
157
|
+
|
|
158
|
+
3.1. Assign subtasks to waves based on dependency graph:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Wave 1: [S1, S2] -- no dependencies, run parallel
|
|
162
|
+
Wave 2: [S3, S4] -- depend on Wave 1, run parallel
|
|
163
|
+
Wave 3: [S5] -- depends on Wave 2
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
3.2. For each wave, determine execution mode:
|
|
167
|
+
|
|
168
|
+
| Mode | Mechanism | When to Use |
|
|
169
|
+
|------|-----------|-------------|
|
|
170
|
+
| **Background** | Agent tool with background flag | Fire-and-forget subtasks |
|
|
171
|
+
| **Foreground** | Sequential Agent tool calls | Need result before next step |
|
|
172
|
+
| **Parallel foreground** | Multiple Agent calls in same message | Independent subtasks, need all results |
|
|
173
|
+
|
|
174
|
+
3.3. Document the execution timeline:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
Time ->
|
|
178
|
+
[==S1==] [====S3====] [==S5==]
|
|
179
|
+
[===S2===] [==S4==]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Phase 4: Agent Configuration
|
|
185
|
+
|
|
186
|
+
**Goal:** Create or assign agents for each subtask.
|
|
187
|
+
|
|
188
|
+
### Steps
|
|
189
|
+
|
|
190
|
+
4.1. For each subtask, decide:
|
|
191
|
+
- Use existing agent definition? (search `.claude/agents/`)
|
|
192
|
+
- Create new agent? (use create-agent-definition task)
|
|
193
|
+
- Use generic Agent tool with inline prompt?
|
|
194
|
+
|
|
195
|
+
4.2. Configure model per subtask based on complexity from Phase 1.
|
|
196
|
+
4.3. Set tool permissions -- restrict to minimum needed:
|
|
197
|
+
- Read-only subtasks: Explore-type agent
|
|
198
|
+
- Code modification: General-purpose with Write/Edit
|
|
199
|
+
- Research: Explore-type with Bash for web tools
|
|
200
|
+
|
|
201
|
+
4.4. Set `max_turns` per agent based on complexity:
|
|
202
|
+
- Trivial: 5 turns
|
|
203
|
+
- Simple: 10 turns
|
|
204
|
+
- Standard: 20 turns
|
|
205
|
+
- Complex: 40 turns
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Phase 5: Merge Strategy
|
|
210
|
+
|
|
211
|
+
**Goal:** Define how parallel agent outputs combine into a final result.
|
|
212
|
+
|
|
213
|
+
### Merge Strategies
|
|
214
|
+
|
|
215
|
+
| Strategy | Description | Conflict Risk |
|
|
216
|
+
|----------|-------------|--------------|
|
|
217
|
+
| **File ownership** | Each agent owns specific files | None |
|
|
218
|
+
| **Directory ownership** | Each agent owns a directory | None |
|
|
219
|
+
| **Git merge** | Each agent on a branch, merge at end | Medium |
|
|
220
|
+
| **Manual review** | Human reviews and merges | Low (but slow) |
|
|
221
|
+
| **Automated merge** | Script merges outputs by convention | Low |
|
|
222
|
+
|
|
223
|
+
### Steps
|
|
224
|
+
|
|
225
|
+
5.1. Assign file/directory ownership to each agent.
|
|
226
|
+
5.2. Define the merge process:
|
|
227
|
+
- Collect outputs from all agents
|
|
228
|
+
- Verify no conflicts (same file modified by 2+ agents)
|
|
229
|
+
- If conflicts exist, apply resolution strategy
|
|
230
|
+
- Run integration tests on merged result
|
|
231
|
+
5.3. If using worktree isolation, plan the branch merge sequence.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Phase 6: Monitoring
|
|
236
|
+
|
|
237
|
+
**Goal:** Track progress and handle failures.
|
|
238
|
+
|
|
239
|
+
### Steps
|
|
240
|
+
|
|
241
|
+
6.1. Define progress checkpoints:
|
|
242
|
+
- Each agent writes status to a shared progress file
|
|
243
|
+
- Wave completion triggers next wave
|
|
244
|
+
6.2. Set timeout thresholds per subtask (2x estimated time).
|
|
245
|
+
6.3. Define failure handling:
|
|
246
|
+
- Agent timeout: Kill and report partial results
|
|
247
|
+
- Agent error: Retry once with same config
|
|
248
|
+
- Repeated failure: Escalate to human
|
|
249
|
+
6.4. Plan rollback if merge fails:
|
|
250
|
+
- Revert to pre-execution state
|
|
251
|
+
- Report which subtasks succeeded vs failed
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Output Format
|
|
256
|
+
|
|
257
|
+
```yaml
|
|
258
|
+
parallel_decomposition_result:
|
|
259
|
+
total_subtasks: 5
|
|
260
|
+
total_waves: 3
|
|
261
|
+
estimated_sequential_time: "35 min"
|
|
262
|
+
estimated_parallel_time: "15 min"
|
|
263
|
+
speedup: "2.3x"
|
|
264
|
+
critical_path: ["S1", "S3", "S5"]
|
|
265
|
+
waves:
|
|
266
|
+
- wave: 1
|
|
267
|
+
subtasks: ["S1", "S2"]
|
|
268
|
+
mode: "parallel-foreground"
|
|
269
|
+
- wave: 2
|
|
270
|
+
subtasks: ["S3", "S4"]
|
|
271
|
+
mode: "parallel-foreground"
|
|
272
|
+
- wave: 3
|
|
273
|
+
subtasks: ["S5"]
|
|
274
|
+
mode: "foreground"
|
|
275
|
+
merge_strategy: "file-ownership"
|
|
276
|
+
agents_created: [...]
|
|
277
|
+
dependency_graph: |
|
|
278
|
+
S1 -> S3 -> S5
|
|
279
|
+
S2 -> S4 -> S5
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Veto Conditions
|
|
285
|
+
|
|
286
|
+
| Condition | Action |
|
|
287
|
+
|-----------|--------|
|
|
288
|
+
| Circular dependency detected in graph | HALT -- restructure subtasks to break cycle |
|
|
289
|
+
| All subtasks are sequentially dependent | HALT -- no parallelization benefit, use single agent |
|
|
290
|
+
| Subtask count exceeds 10 | HALT -- group into higher-level units first |
|
|
291
|
+
| Multiple agents must write to same file | HALT -- redesign with file ownership or worktree |
|
|
292
|
+
| Critical path time exceeds time constraint | WARN -- consider decomposing critical path subtasks further |
|
|
293
|
+
| Estimated cost exceeds budget | HALT -- downgrade models or reduce parallelism |
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Task: Design Permission Strategy
|
|
2
|
+
|
|
3
|
+
**Task ID:** CCM-CONFIG-005
|
|
4
|
+
**Version:** 1.0.0
|
|
5
|
+
**Command:** `*permission-strategy`
|
|
6
|
+
**Orchestrator:** Sigil (config-engineer)
|
|
7
|
+
**Purpose:** Design a comprehensive permission strategy for a project by assessing security needs, selecting the appropriate permission mode, and engineering precise allow/ask/deny rules using Claude Code's `Tool(specifier)` syntax.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
+------------------+ +------------------+ +------------------+
|
|
15
|
+
| 1. Assess | --> | 2. Choose | --> | 3. Configure |
|
|
16
|
+
| Security | | Permission | | Allow Rules |
|
|
17
|
+
| Needs | | Mode | | |
|
|
18
|
+
+------------------+ +------------------+ +------------------+
|
|
19
|
+
| |
|
|
20
|
+
v v
|
|
21
|
+
+------------------+ +------------------+ +------------------+
|
|
22
|
+
| 4. Configure | --> | 5. Set MCP | --> | STRATEGY |
|
|
23
|
+
| Deny Rules | | Tool | | DOCUMENT |
|
|
24
|
+
+------------------+ | Permissions | +------------------+
|
|
25
|
+
+------------------+
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Inputs
|
|
31
|
+
|
|
32
|
+
| Field | Type | Source | Required | Validation |
|
|
33
|
+
|-------|------|--------|----------|------------|
|
|
34
|
+
| project_root | string | Working directory | Yes | Valid project directory |
|
|
35
|
+
| team_size | string | User parameter | No | `solo`, `small` (2-5), `team` (6+), `enterprise` |
|
|
36
|
+
| sensitivity | string | User parameter | No | `low`, `standard` (default), `high`, `regulated` |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Preconditions
|
|
41
|
+
|
|
42
|
+
- Understanding of the project's technology stack
|
|
43
|
+
- Knowledge of team composition and access patterns
|
|
44
|
+
- Awareness of any compliance requirements (SOC2, HIPAA, etc.)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Execution Phases
|
|
49
|
+
|
|
50
|
+
### Phase 1: Assess Project Security Needs
|
|
51
|
+
|
|
52
|
+
1. Determine the sensitivity profile:
|
|
53
|
+
|
|
54
|
+
| Factor | Weight | Assessment |
|
|
55
|
+
|--------|--------|------------|
|
|
56
|
+
| Handles PII/PHI data | HIGH | Check for user data, health records |
|
|
57
|
+
| Has production credentials | HIGH | .env files, secret managers |
|
|
58
|
+
| External API integrations | MEDIUM | Third-party services, webhooks |
|
|
59
|
+
| Financial transactions | HIGH | Payment processing, billing |
|
|
60
|
+
| Open source project | LOW | Public code, no secrets |
|
|
61
|
+
| Internal tool | MEDIUM | Company data, internal APIs |
|
|
62
|
+
|
|
63
|
+
2. Scan for sensitive file patterns:
|
|
64
|
+
- `.env`, `.env.*` -- environment variables
|
|
65
|
+
- `*.pem`, `*.key`, `*.p12` -- certificates and keys
|
|
66
|
+
- `secrets/`, `credentials/`, `private/` -- secret directories
|
|
67
|
+
- `*.tfvars`, `*.tfstate` -- Terraform state with secrets
|
|
68
|
+
- `docker-compose.*.yml` -- may contain credentials
|
|
69
|
+
3. Identify safe operation patterns:
|
|
70
|
+
- Read-only operations (git diff, git log, cat)
|
|
71
|
+
- Build/test operations (npm run, pytest)
|
|
72
|
+
- Development servers (npm run dev, next dev)
|
|
73
|
+
|
|
74
|
+
### Phase 2: Choose Permission Mode
|
|
75
|
+
|
|
76
|
+
Select the base mode based on assessment:
|
|
77
|
+
|
|
78
|
+
| Mode | Use When | Friction Level | Security Level |
|
|
79
|
+
|------|----------|----------------|----------------|
|
|
80
|
+
| askAlways | Regulated environments, onboarding, high sensitivity | High | Maximum |
|
|
81
|
+
| acceptEdits | Standard development, trusted codebase, medium sensitivity | Medium | Balanced |
|
|
82
|
+
| autoApprove | Solo developer, low sensitivity, personal projects | Low | Minimum |
|
|
83
|
+
| plan | Complex workflows requiring upfront approval (managed only) | Medium | High |
|
|
84
|
+
|
|
85
|
+
**Decision tree:**
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Is this regulated (SOC2, HIPAA)?
|
|
89
|
+
YES -> askAlways + strict deny rules
|
|
90
|
+
NO -> Is it a team project?
|
|
91
|
+
YES -> acceptEdits + comprehensive deny/allow
|
|
92
|
+
NO -> Is it high sensitivity?
|
|
93
|
+
YES -> acceptEdits + strict deny rules
|
|
94
|
+
NO -> autoApprove + basic deny rules (still deny secrets)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Present recommendation with rationale. Allow user override.
|
|
98
|
+
|
|
99
|
+
### Phase 3: Configure Allow Rules
|
|
100
|
+
|
|
101
|
+
Build the allow list using `Tool(specifier)` syntax:
|
|
102
|
+
|
|
103
|
+
**Evaluation order reminder:** deny -> ask -> allow (first match wins).
|
|
104
|
+
|
|
105
|
+
**Common allow patterns by tool:**
|
|
106
|
+
|
|
107
|
+
| Tool | Pattern | Purpose |
|
|
108
|
+
|------|---------|---------|
|
|
109
|
+
| `Bash(npm run *)` | Allow all npm scripts | Development workflow |
|
|
110
|
+
| `Bash(npx *)` | Allow npx execution | Tool execution |
|
|
111
|
+
| `Bash(git status)` | Git status check | Version control |
|
|
112
|
+
| `Bash(git diff *)` | Git diff viewing | Code review |
|
|
113
|
+
| `Bash(git log *)` | Git history | Version control |
|
|
114
|
+
| `Bash(git add *)` | Git staging | Version control |
|
|
115
|
+
| `Bash(git commit *)` | Git commits | Version control |
|
|
116
|
+
| `Bash(node *)` | Node.js execution | Development |
|
|
117
|
+
| `Bash(python *)` | Python execution | Development |
|
|
118
|
+
| `Bash(pytest *)` | Python testing | Testing |
|
|
119
|
+
| `Read(src/**)` | Read source code | Development |
|
|
120
|
+
| `Read(docs/**)` | Read documentation | Reference |
|
|
121
|
+
| `Read(tests/**)` | Read test files | Testing |
|
|
122
|
+
| `Edit(src/**)` | Edit source code | Development |
|
|
123
|
+
| `Edit(tests/**)` | Edit test files | Testing |
|
|
124
|
+
| `WebFetch(domain:*.npmjs.org)` | NPM registry | Package info |
|
|
125
|
+
| `WebFetch(domain:api.github.com)` | GitHub API | Repository info |
|
|
126
|
+
| `MCP(context7)` | Library docs | Documentation |
|
|
127
|
+
| `Agent(Explore)` | Exploration subagent | Analysis |
|
|
128
|
+
|
|
129
|
+
Customize based on detected project needs.
|
|
130
|
+
|
|
131
|
+
### Phase 4: Configure Deny Rules
|
|
132
|
+
|
|
133
|
+
Build the deny list (evaluated first, highest priority):
|
|
134
|
+
|
|
135
|
+
**Mandatory deny rules (always include):**
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"deny": [
|
|
140
|
+
"Read(./.env)",
|
|
141
|
+
"Read(./.env.*)",
|
|
142
|
+
"Read(./.env.local)",
|
|
143
|
+
"Read(./secrets/**)",
|
|
144
|
+
"Read(./**/*.pem)",
|
|
145
|
+
"Read(./**/*.key)",
|
|
146
|
+
"Read(./**/*.p12)",
|
|
147
|
+
"Bash(rm -rf /)",
|
|
148
|
+
"Bash(rm -rf ~)",
|
|
149
|
+
"Bash(curl * | bash)",
|
|
150
|
+
"Bash(wget * | bash)",
|
|
151
|
+
"Bash(> /dev/sda)"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Project-specific deny rules:**
|
|
157
|
+
|
|
158
|
+
| Project Type | Additional Deny Rules |
|
|
159
|
+
|-------------|----------------------|
|
|
160
|
+
| SINAPSE | `Edit(.sinapse-ai/core/**)`, `Edit(.sinapse-ai/constitution.md)`, `Edit(bin/sinapse.js)` |
|
|
161
|
+
| Infrastructure | `Bash(terraform apply *)`, `Bash(terraform destroy *)` |
|
|
162
|
+
| Database | `Bash(psql * DROP *)`, `Bash(mysql * DROP *)` |
|
|
163
|
+
| Docker | `Bash(docker rm -f *)`, `Bash(docker system prune *)` |
|
|
164
|
+
|
|
165
|
+
**Ask rules (prompt before executing):**
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"ask": [
|
|
170
|
+
"Bash(git push *)",
|
|
171
|
+
"Bash(git checkout -- *)",
|
|
172
|
+
"Bash(git reset --hard *)",
|
|
173
|
+
"Edit(./package.json)",
|
|
174
|
+
"Edit(./tsconfig.json)",
|
|
175
|
+
"Bash(npm install *)",
|
|
176
|
+
"Bash(npm uninstall *)"
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Phase 5: Set MCP Tool Permissions
|
|
182
|
+
|
|
183
|
+
1. For each configured MCP server, add appropriate permission rules:
|
|
184
|
+
- Trusted servers: add to allow list (e.g., `MCP(context7)`)
|
|
185
|
+
- Semi-trusted: add to ask list (e.g., `MCP(filesystem)`)
|
|
186
|
+
- Blocked: add to deny list (e.g., `MCP(untrusted-server)`)
|
|
187
|
+
2. If enterprise: check `allowedMcpServers` / `deniedMcpServers` managed lists
|
|
188
|
+
3. For Agent permissions:
|
|
189
|
+
- Allow known safe subagents: `Agent(Explore)`, `Agent(Plan)`
|
|
190
|
+
- Custom agents: add to allow if trusted, ask if new
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Output Format
|
|
195
|
+
|
|
196
|
+
```markdown
|
|
197
|
+
## Permission Strategy
|
|
198
|
+
|
|
199
|
+
**Project:** {project-name}
|
|
200
|
+
**Sensitivity:** {level}
|
|
201
|
+
**Team:** {size}
|
|
202
|
+
**Mode:** {selected-mode}
|
|
203
|
+
|
|
204
|
+
### Rule Summary
|
|
205
|
+
|
|
206
|
+
| Category | Count | Examples |
|
|
207
|
+
|----------|-------|---------|
|
|
208
|
+
| deny | {N} | .env, secrets, destructive commands |
|
|
209
|
+
| ask | {N} | git push, package.json changes |
|
|
210
|
+
| allow | {N} | npm scripts, git read-only, src/ access |
|
|
211
|
+
|
|
212
|
+
### Complete Configuration
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"permissions": {
|
|
217
|
+
"deny": [ ... ],
|
|
218
|
+
"ask": [ ... ],
|
|
219
|
+
"allow": [ ... ],
|
|
220
|
+
"defaultMode": "{mode}"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Evaluation Examples
|
|
226
|
+
|
|
227
|
+
Show how specific operations will be handled:
|
|
228
|
+
|
|
229
|
+
| Operation | Matches | Category | Result |
|
|
230
|
+
|-----------|---------|----------|--------|
|
|
231
|
+
| `cat .env` | `Read(./.env)` | deny | BLOCKED |
|
|
232
|
+
| `npm run test` | `Bash(npm run *)` | allow | AUTO-APPROVED |
|
|
233
|
+
| `git push origin main` | `Bash(git push *)` | ask | PROMPTS USER |
|
|
234
|
+
| `edit src/app.ts` | `Edit(src/**)` | allow | AUTO-APPROVED |
|
|
235
|
+
|
|
236
|
+
### Security Coverage
|
|
237
|
+
|
|
238
|
+
- [x] Environment files protected
|
|
239
|
+
- [x] Secret directories blocked
|
|
240
|
+
- [x] Destructive commands blocked
|
|
241
|
+
- [x] Pipe-to-shell attacks blocked
|
|
242
|
+
- [x] Certificate/key files protected
|
|
243
|
+
- [ ] {Any gaps flagged here}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Veto Conditions
|
|
249
|
+
|
|
250
|
+
- **NEVER** design a strategy without deny rules for .env and secrets. These are non-negotiable security baselines.
|
|
251
|
+
- **NEVER** add destructive bash commands (rm -rf, format, mkfs) to the allow list.
|
|
252
|
+
- **NEVER** recommend `bypassPermissions` mode for team or enterprise environments.
|
|
253
|
+
- **NEVER** allow `Bash(curl * | bash)` or `Bash(wget * | bash)` patterns -- pipe-to-shell is a known attack vector.
|
|
254
|
+
- **NEVER** put the same pattern in both deny and allow without explaining that deny always wins.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Completion Criteria
|
|
259
|
+
|
|
260
|
+
- [ ] Security assessment completed with sensitivity profile
|
|
261
|
+
- [ ] Permission mode selected with documented rationale
|
|
262
|
+
- [ ] Deny rules cover all mandatory sensitive patterns
|
|
263
|
+
- [ ] Allow rules enable detected development workflows
|
|
264
|
+
- [ ] Ask rules protect modification of critical config files
|
|
265
|
+
- [ ] MCP tool permissions set for all configured servers
|
|
266
|
+
- [ ] Evaluation examples show how common operations are handled
|