@amsterdamdatalabs/enact-extensions 0.1.0 → 0.1.1
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/README.md +94 -20
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +89 -0
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +219 -18
- package/dist/install.js.map +1 -1
- package/dist/validate/index.d.ts +21 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +77 -0
- package/dist/validate/index.js.map +1 -1
- package/extensions/cmux/.agents/plugin.json +37 -0
- package/extensions/cmux/skills/cmux/SKILL.md +82 -0
- package/extensions/cmux/skills/cmux/agents/openai.yaml +4 -0
- package/extensions/cmux/skills/cmux/references/handles-and-identify.md +35 -0
- package/extensions/cmux/skills/cmux/references/panes-surfaces.md +37 -0
- package/extensions/cmux/skills/cmux/references/trigger-flash-and-health.md +23 -0
- package/extensions/cmux/skills/cmux/references/windows-workspaces.md +31 -0
- package/extensions/cmux/skills/cmux-vm-monitor/SKILL.md +122 -0
- package/extensions/cmux/skills/cmux-vm-monitor/agents/openai.yaml +4 -0
- package/extensions/cmux/skills/cmux-vm-monitor/references/cmux-commands.md +66 -0
- package/extensions/cmux/skills/cmux-vm-monitor/scripts/codex_vm_monitor.sh +45 -0
- package/extensions/cmux/skills/cmux-workspace/SKILL.md +93 -0
- package/extensions/dev-state/.agents/plugin.json +35 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/SKILL.md +194 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/agents/openai.yaml +4 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/references/reference.md +130 -0
- package/extensions/devops/.agents/plugin.json +36 -0
- package/extensions/devops/skills/azure-devops-cli/SKILL.md +431 -0
- package/extensions/devops/skills/azure-devops-cli/agents/openai.yaml +4 -0
- package/extensions/devops/skills/ci-pipeline-strategy/SKILL.md +217 -0
- package/extensions/devops/skills/ci-pipeline-strategy/agents/openai.yaml +4 -0
- package/{plugins/net-revenue-management/.codex-plugin → extensions/net-revenue-management/.agents}/plugin.json +10 -6
- package/extensions/plugin-dev/.agents/plugin.json +42 -0
- package/extensions/plugin-dev/.mcp.json +3 -0
- package/extensions/plugin-dev/agents/agent-creator.md +199 -0
- package/extensions/plugin-dev/agents/plugin-validator.md +91 -0
- package/extensions/plugin-dev/agents/skill-reviewer.md +212 -0
- package/extensions/plugin-dev/commands/_archive/create-marketplace.md +427 -0
- package/extensions/plugin-dev/commands/_archive/plugin-dev-guide.md +12 -0
- package/extensions/plugin-dev/commands/create-plugin.md +498 -0
- package/extensions/plugin-dev/commands/start.md +81 -0
- package/extensions/plugin-dev/hooks/hooks.json +3 -0
- package/extensions/plugin-dev/skills/agent-development/SKILL.md +641 -0
- package/extensions/plugin-dev/skills/agent-development/examples/agent-creation-prompt.md +250 -0
- package/extensions/plugin-dev/skills/agent-development/examples/complete-agent-examples.md +461 -0
- package/extensions/plugin-dev/skills/agent-development/references/advanced-agent-fields.md +246 -0
- package/extensions/plugin-dev/skills/agent-development/references/agent-creation-system-prompt.md +216 -0
- package/extensions/plugin-dev/skills/agent-development/references/permission-modes-rules.md +226 -0
- package/extensions/plugin-dev/skills/agent-development/references/system-prompt-design.md +464 -0
- package/extensions/plugin-dev/skills/agent-development/references/triggering-examples.md +474 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/create-agent-skeleton.sh +176 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/test-agent-trigger.sh +227 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/validate-agent.sh +227 -0
- package/extensions/plugin-dev/skills/command-development/SKILL.md +763 -0
- package/extensions/plugin-dev/skills/command-development/examples/plugin-commands.md +612 -0
- package/extensions/plugin-dev/skills/command-development/examples/simple-commands.md +527 -0
- package/extensions/plugin-dev/skills/command-development/references/advanced-workflows.md +762 -0
- package/extensions/plugin-dev/skills/command-development/references/documentation-patterns.md +769 -0
- package/extensions/plugin-dev/skills/command-development/references/frontmatter-reference.md +508 -0
- package/extensions/plugin-dev/skills/command-development/references/interactive-commands.md +966 -0
- package/extensions/plugin-dev/skills/command-development/references/marketplace-considerations.md +943 -0
- package/extensions/plugin-dev/skills/command-development/references/plugin-features-reference.md +637 -0
- package/extensions/plugin-dev/skills/command-development/references/plugin-integration.md +191 -0
- package/extensions/plugin-dev/skills/command-development/references/skill-tool.md +447 -0
- package/extensions/plugin-dev/skills/command-development/references/testing-strategies.md +723 -0
- package/extensions/plugin-dev/skills/command-development/scripts/check-frontmatter.sh +234 -0
- package/extensions/plugin-dev/skills/command-development/scripts/validate-command.sh +160 -0
- package/extensions/plugin-dev/skills/hook-development/SKILL.md +861 -0
- package/extensions/plugin-dev/skills/hook-development/examples/load-context.sh +55 -0
- package/extensions/plugin-dev/skills/hook-development/examples/validate-bash.sh +57 -0
- package/extensions/plugin-dev/skills/hook-development/examples/validate-write.sh +48 -0
- package/extensions/plugin-dev/skills/hook-development/references/advanced.md +871 -0
- package/extensions/plugin-dev/skills/hook-development/references/hook-input-schemas.md +145 -0
- package/extensions/plugin-dev/skills/hook-development/references/migration.md +392 -0
- package/extensions/plugin-dev/skills/hook-development/references/patterns.md +430 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/README.md +181 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/hook-linter.sh +153 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/test-hook.sh +276 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/validate-hook-schema.sh +159 -0
- package/extensions/plugin-dev/skills/mcp-integration/SKILL.md +775 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/http-server.json +20 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/sse-server.json +19 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/stdio-server.json +38 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/ws-server.json +26 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/authentication.md +601 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/server-discovery.md +190 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/server-types.md +572 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/tool-usage.md +623 -0
- package/extensions/plugin-dev/skills/plugin-dev-guide/SKILL.md +222 -0
- package/extensions/plugin-dev/skills/plugin-structure/SKILL.md +705 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/advanced-plugin.md +774 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/minimal-plugin.md +83 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/standard-plugin.md +611 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/advanced-topics.md +289 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/component-patterns.md +592 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/github-actions.md +233 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/headless-ci-mode.md +193 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/manifest-reference.md +625 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/output-styles.md +116 -0
- package/extensions/plugin-dev/skills/skill-development/SKILL.md +564 -0
- package/extensions/plugin-dev/skills/skill-development/examples/complete-skill.md +465 -0
- package/extensions/plugin-dev/skills/skill-development/examples/frontmatter-templates.md +167 -0
- package/extensions/plugin-dev/skills/skill-development/examples/minimal-skill.md +111 -0
- package/extensions/plugin-dev/skills/skill-development/references/advanced-frontmatter.md +225 -0
- package/extensions/plugin-dev/skills/skill-development/references/commands-vs-skills.md +39 -0
- package/extensions/plugin-dev/skills/skill-development/references/skill-creation-workflow.md +379 -0
- package/extensions/plugin-dev/skills/skill-development/references/skill-creator-original.md +210 -0
- package/package.json +8 -11
- package/scripts/enact-extensions.mjs +751 -16
- package/scripts/hooks/session-start-drift-check.mjs +58 -0
- package/scripts/lib/build-index.mjs +50 -0
- package/scripts/lib/bundle-hash.mjs +137 -0
- package/scripts/lib/hooks.mjs +389 -0
- package/scripts/lib/ledger.mjs +162 -0
- package/scripts/lib/list-bundles.mjs +70 -0
- package/scripts/lib/outdated.mjs +144 -0
- package/scripts/lib/provision-mcp.mjs +369 -0
- package/scripts/lib/resolve-bundle.mjs +121 -0
- package/scripts/lib/run-install.mjs +321 -39
- package/scripts/lib/run-uninstall.mjs +220 -0
- package/scripts/lib/run-update.mjs +152 -0
- package/scripts/lib/run-validate.mjs +12 -18
- package/scripts/lib/serve.mjs +454 -0
- package/scripts/postinstall.mjs +63 -0
- package/scripts/setup-enact-context.sh +2 -2
- package/spec/index.json +59 -0
- package/web/assets/README.md +111 -0
- package/web/assets/logo-full.png +0 -0
- package/web/assets/logo-slim.png +0 -0
- package/web/assets/tokens/base.css +45 -0
- package/web/assets/tokens/colors.css +248 -0
- package/web/assets/tokens/effects.css +24 -0
- package/web/assets/tokens/fonts.css +8 -0
- package/web/assets/tokens/index.css +18 -0
- package/web/assets/tokens/spacing.css +50 -0
- package/web/index.html +1188 -0
- package/.agents/plugins/marketplace.json +0 -20
- package/catalog/enact-context.json +0 -9
- package/catalog/enact-factory.json +0 -7
- package/catalog/enact-operator.json +0 -7
- package/catalog/enact-wiki.json +0 -7
- package/catalog/net-revenue-management.json +0 -8
- package/scripts/rename-supervisor-to-operator.pl +0 -66
- package/scripts/sync-manifests.mjs +0 -23
- package/scripts/validate-catalog.mjs +0 -37
- package/scripts/validate-plugin.mjs +0 -10
- /package/{plugins → extensions}/net-revenue-management/.mcp.json +0 -0
- /package/{plugins → extensions}/net-revenue-management/skills/net-revenue-risks/SKILL.md +0 -0
- /package/{plugins → extensions}/net-revenue-management/skills/net-revenue-scenario/SKILL.md +0 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Advanced Agent Fields
|
|
2
|
+
|
|
3
|
+
This reference covers agent frontmatter fields beyond the core fields (name, description, model, color, tools, disallowedTools, skills, permissionMode). These enable turn limits, persistent memory, scoped MCP access, lifecycle hooks, and advanced execution patterns.
|
|
4
|
+
|
|
5
|
+
## maxTurns
|
|
6
|
+
|
|
7
|
+
Limit the maximum number of agentic turns (API round-trips) before the agent stops.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
maxTurns: 50
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Choosing Values
|
|
14
|
+
|
|
15
|
+
| Task Type | Suggested Range | Rationale |
|
|
16
|
+
| ----------------------------- | --------------- | ------------------------------- |
|
|
17
|
+
| Quick checks, linting | 5-15 | Focused, fast completion |
|
|
18
|
+
| Code review, analysis | 20-40 | Needs to read multiple files |
|
|
19
|
+
| Complex refactoring, creation | 50-100 | Multi-file changes with testing |
|
|
20
|
+
|
|
21
|
+
If omitted, the agent runs until it completes or is interrupted. Set `maxTurns` to prevent runaway agents from consuming excessive resources, especially for background agents where there's no user to interrupt.
|
|
22
|
+
|
|
23
|
+
## memory
|
|
24
|
+
|
|
25
|
+
Enable persistent memory that survives across sessions.
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
memory: user
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Scopes
|
|
32
|
+
|
|
33
|
+
| Scope | Directory | Use When |
|
|
34
|
+
| --------- | ------------------------------------------ | -------------------------------- |
|
|
35
|
+
| `user` | `~/.claude/agent-memory/<agent-name>/` | Personal preferences, defaults |
|
|
36
|
+
| `project` | `.claude/agent-memory/<agent-name>/` | Codebase-specific knowledge |
|
|
37
|
+
| `local` | `.claude/agent-memory-local/<agent-name>/` | Gitignored project-specific data |
|
|
38
|
+
|
|
39
|
+
### How It Works
|
|
40
|
+
|
|
41
|
+
When `memory` is set:
|
|
42
|
+
|
|
43
|
+
1. System prompt includes instructions for reading/writing the memory directory
|
|
44
|
+
2. First 200 lines of `MEMORY.md` are auto-injected into the agent's system prompt
|
|
45
|
+
3. Read, Write, and Edit tools are automatically enabled (even if not in `tools` list)
|
|
46
|
+
4. Agent should curate `MEMORY.md` if it exceeds 200 lines
|
|
47
|
+
|
|
48
|
+
### Best Practices
|
|
49
|
+
|
|
50
|
+
- Use `user` scope as the default for most agents
|
|
51
|
+
- Use `project` or `local` for codebase-specific learning
|
|
52
|
+
- Include memory management instructions in the agent's system prompt (e.g., "After completing a task, update your MEMORY.md with key learnings")
|
|
53
|
+
|
|
54
|
+
## mcpServers
|
|
55
|
+
|
|
56
|
+
Scope MCP servers to the agent, controlling which external services it can access.
|
|
57
|
+
|
|
58
|
+
### Reference by Name
|
|
59
|
+
|
|
60
|
+
Reference an already-configured MCP server:
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
mcpServers:
|
|
64
|
+
slack:
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The agent inherits the full configuration of the named server from the project/user MCP settings.
|
|
68
|
+
|
|
69
|
+
### Inline Configuration
|
|
70
|
+
|
|
71
|
+
Provide full server config scoped to the agent:
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
mcpServers:
|
|
75
|
+
custom-api:
|
|
76
|
+
command: "${CLAUDE_PLUGIN_ROOT}/servers/api-server"
|
|
77
|
+
args: ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"]
|
|
78
|
+
env:
|
|
79
|
+
API_KEY: "${API_KEY}"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Use Cases
|
|
83
|
+
|
|
84
|
+
- Restrict a code review agent to only read-only MCP tools
|
|
85
|
+
- Give a deployment agent access to CI/CD servers but not database servers
|
|
86
|
+
- Provide agent-specific server configuration
|
|
87
|
+
|
|
88
|
+
## hooks
|
|
89
|
+
|
|
90
|
+
Define lifecycle hooks scoped to the agent. These hooks activate when the agent starts and deactivate when it finishes.
|
|
91
|
+
|
|
92
|
+
### Format
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
hooks:
|
|
96
|
+
PreToolUse:
|
|
97
|
+
- matcher: Write
|
|
98
|
+
hooks:
|
|
99
|
+
- type: command
|
|
100
|
+
command: "${CLAUDE_PLUGIN_ROOT}/scripts/validate-write.sh"
|
|
101
|
+
timeout: 10
|
|
102
|
+
Stop:
|
|
103
|
+
- hooks:
|
|
104
|
+
- type: prompt
|
|
105
|
+
prompt: "Verify all tasks are complete before stopping."
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Supported Events
|
|
109
|
+
|
|
110
|
+
All hook events are supported in agent frontmatter. Key behavior difference:
|
|
111
|
+
|
|
112
|
+
- **`Stop`** hooks are automatically converted to **`SubagentStop`** at runtime, since agents are subprocesses
|
|
113
|
+
- Hooks only run while the agent is active and are cleaned up when the agent finishes
|
|
114
|
+
|
|
115
|
+
### Comparison with hooks.json
|
|
116
|
+
|
|
117
|
+
| Aspect | `hooks.json` | Agent frontmatter `hooks` |
|
|
118
|
+
| -------- | ------------------------------------------ | ----------------------------------------------- |
|
|
119
|
+
| Scope | Global (always active when plugin enabled) | Agent-specific (active only during agent run) |
|
|
120
|
+
| Events | All hook events | All events (Stop auto-converts to SubagentStop) |
|
|
121
|
+
| Location | `hooks/hooks.json` file | YAML frontmatter in agent .md file |
|
|
122
|
+
| Use case | Plugin-wide validation | Agent-specific safety checks |
|
|
123
|
+
|
|
124
|
+
## Execution Modes
|
|
125
|
+
|
|
126
|
+
### Background vs Foreground
|
|
127
|
+
|
|
128
|
+
- **Foreground** (default): Blocks the main conversation until the agent completes. User can interact if the agent requests permission.
|
|
129
|
+
- **Background**: Runs concurrently with the main conversation. All permissions must be pre-approved at spawn time since the user cannot be prompted.
|
|
130
|
+
|
|
131
|
+
Background agents that encounter an unapproved permission request will fail. Design tool restrictions (`tools`, `permissionMode`) accordingly when agents may run in background.
|
|
132
|
+
|
|
133
|
+
### Resuming Agents
|
|
134
|
+
|
|
135
|
+
Each Task tool invocation creates a new agent instance with a fresh context. To continue with the full prior context preserved, ask Claude to "resume that agent" or "continue that subagent" — it will restore the previous transcript.
|
|
136
|
+
|
|
137
|
+
Agent transcripts are stored at `~/.claude/projects/{project}/{sessionId}/subagents/agent-{agentId}.jsonl`.
|
|
138
|
+
|
|
139
|
+
### Restricting Spawnable Agent Types
|
|
140
|
+
|
|
141
|
+
Use `Task(agent_type1, agent_type2)` syntax in settings.json allow rules to control which agent types can be spawned:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"permissions": {
|
|
146
|
+
"allow": ["Task(code-reviewer, test-runner)"]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- `Task(type1, type2)` — only these agent types can be spawned
|
|
152
|
+
- `Task` (no parentheses) — allow any subagent
|
|
153
|
+
- Omitting `Task` entirely — cannot spawn any subagents
|
|
154
|
+
|
|
155
|
+
## Built-in Agent Types
|
|
156
|
+
|
|
157
|
+
Claude Code includes several built-in agent types that can be referenced in the `agent` field of skills or used as targets for `Task()` restrictions:
|
|
158
|
+
|
|
159
|
+
| Agent Type | Model | Tools | Purpose |
|
|
160
|
+
| ------------------- | ------- | --------- | ----------------------------------- |
|
|
161
|
+
| `Explore` | Haiku | Read-only | Fast codebase exploration/search |
|
|
162
|
+
| `Plan` | Inherit | Read-only | Codebase research during planning |
|
|
163
|
+
| `general-purpose` | Inherit | All | Complex multi-step tasks |
|
|
164
|
+
| `Bash` | Inherit | Bash | Terminal commands in isolation |
|
|
165
|
+
| `statusline-setup` | Haiku | Read/Edit | Status line configuration |
|
|
166
|
+
| `Claude Code Guide` | Haiku | Read-only | Documentation and feature questions |
|
|
167
|
+
|
|
168
|
+
## Agent Teams (Experimental)
|
|
169
|
+
|
|
170
|
+
Agent teams enable multi-agent coordination where a team lead spawns and manages multiple independent Claude Code sessions as teammates. This is an experimental feature requiring `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`.
|
|
171
|
+
|
|
172
|
+
### Key Concepts
|
|
173
|
+
|
|
174
|
+
- **Team lead**: Main session that creates the team, spawns teammates, and coordinates work
|
|
175
|
+
- **Teammates**: Independent Claude Code instances with their own context windows
|
|
176
|
+
- **Shared task list**: Coordinated work items that teammates claim and complete
|
|
177
|
+
- **Messaging**: Direct messages and broadcasts between team members
|
|
178
|
+
|
|
179
|
+
### Designing Team Lead Agents
|
|
180
|
+
|
|
181
|
+
Team leads coordinate work across multiple teammates. Key design considerations:
|
|
182
|
+
|
|
183
|
+
- **Use `permissionMode: delegate`** to restrict the lead to coordination-only tools (spawn, message, shut down teammates, manage tasks). This prevents the lead from implementing tasks directly.
|
|
184
|
+
- **System prompt focus**: Task decomposition, work assignment, progress monitoring, quality review
|
|
185
|
+
- **Tools**: Team leads automatically get access to `TeamCreate`, `TaskCreate`, `TaskUpdate`, `TaskList`, `SendMessage`, and `Task` (for spawning)
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
# Example team lead agent
|
|
189
|
+
permissionMode: delegate
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Permission Inheritance
|
|
193
|
+
|
|
194
|
+
Teammates inherit the team lead's permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates inherit that too. Plan permission modes accordingly — a permissive lead creates permissive teammates.
|
|
195
|
+
|
|
196
|
+
### Context Isolation
|
|
197
|
+
|
|
198
|
+
Teammates load CLAUDE.md, MCP servers, and skills from the project, but do NOT inherit the lead's conversation history. Each teammate starts with a fresh context window; the spawn prompt provides initial task context.
|
|
199
|
+
|
|
200
|
+
### Token Cost
|
|
201
|
+
|
|
202
|
+
Each teammate is a separate Claude Code session with its own context window. Token costs scale linearly with team size. Worth the extra cost for genuinely parallel work, but avoid spawning teammates for tasks that could be done sequentially.
|
|
203
|
+
|
|
204
|
+
### Designing Teammate Agents
|
|
205
|
+
|
|
206
|
+
Teammates are spawned by the team lead and work independently on assigned tasks:
|
|
207
|
+
|
|
208
|
+
- **Self-contained context**: Each teammate has its own context window; don't assume shared state
|
|
209
|
+
- **Task-focused prompts**: System prompt should focus on a specific type of work (e.g., "you are a test writer")
|
|
210
|
+
- **Tool restrictions**: Use `tools` to limit what each teammate can do based on their role
|
|
211
|
+
- **Plan mode for review**: Use `permissionMode: plan` for teammates that should propose changes for lead approval
|
|
212
|
+
|
|
213
|
+
### Display Modes
|
|
214
|
+
|
|
215
|
+
The `teammateMode` setting controls how agent teams display in the terminal:
|
|
216
|
+
|
|
217
|
+
| Mode | Behavior |
|
|
218
|
+
| ------------ | --------------------------------------------------------- |
|
|
219
|
+
| `in-process` | All teammates in main terminal; Shift+Up/Down to navigate |
|
|
220
|
+
| `tmux` | Split panes, each teammate in its own pane |
|
|
221
|
+
| `auto` | Split panes if in tmux, in-process otherwise (default) |
|
|
222
|
+
|
|
223
|
+
### Team Hooks
|
|
224
|
+
|
|
225
|
+
Use hook events to enforce quality standards in team workflows:
|
|
226
|
+
|
|
227
|
+
| Event | Fires When | Use Case |
|
|
228
|
+
| --------------- | ---------------------------- | --------------------------------------------- |
|
|
229
|
+
| `TeammateIdle` | A teammate finishes its turn | Trigger code review, run tests on changes |
|
|
230
|
+
| `TaskCompleted` | A task is marked complete | Validate deliverables, update documentation |
|
|
231
|
+
| `SubagentStart` | A teammate spawns | Log team activity, enforce naming conventions |
|
|
232
|
+
| `SubagentStop` | A teammate finishes | Clean up resources, collect metrics |
|
|
233
|
+
|
|
234
|
+
### Plan Approval Mode
|
|
235
|
+
|
|
236
|
+
Teammates can be configured to require plan approval from the team lead before implementing:
|
|
237
|
+
|
|
238
|
+
1. Teammate uses `permissionMode: plan`
|
|
239
|
+
2. Teammate explores codebase and creates a plan
|
|
240
|
+
3. Teammate calls `ExitPlanMode`, which sends plan to team lead
|
|
241
|
+
4. Team lead reviews and approves/rejects via `SendMessage` with `plan_approval_response`
|
|
242
|
+
5. On approval, teammate exits plan mode and proceeds with implementation
|
|
243
|
+
|
|
244
|
+
This pattern is useful for complex tasks where the lead wants to review approach before execution.
|
|
245
|
+
|
|
246
|
+
For complete documentation, see the [official agent teams guide](https://code.claude.com/docs/en/agent-teams).
|
package/extensions/plugin-dev/skills/agent-development/references/agent-creation-system-prompt.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Agent Creation System Prompt
|
|
2
|
+
|
|
3
|
+
This is the exact system prompt used by Claude Code's agent generation feature, refined through extensive production use.
|
|
4
|
+
|
|
5
|
+
## The Prompt
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
|
|
9
|
+
|
|
10
|
+
**Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
|
|
11
|
+
|
|
12
|
+
When a user describes what they want an agent to do, you will:
|
|
13
|
+
|
|
14
|
+
1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
|
|
15
|
+
|
|
16
|
+
2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
|
|
17
|
+
|
|
18
|
+
3. **Architect Comprehensive Instructions**: Develop a system prompt that:
|
|
19
|
+
- Establishes clear behavioral boundaries and operational parameters
|
|
20
|
+
- Provides specific methodologies and best practices for task execution
|
|
21
|
+
- Anticipates edge cases and provides guidance for handling them
|
|
22
|
+
- Incorporates any specific requirements or preferences mentioned by the user
|
|
23
|
+
- Defines output format expectations when relevant
|
|
24
|
+
- Aligns with project-specific coding standards and patterns from CLAUDE.md
|
|
25
|
+
|
|
26
|
+
4. **Optimize for Performance**: Include:
|
|
27
|
+
- Decision-making frameworks appropriate to the domain
|
|
28
|
+
- Quality control mechanisms and self-verification steps
|
|
29
|
+
- Efficient workflow patterns
|
|
30
|
+
- Clear escalation or fallback strategies
|
|
31
|
+
|
|
32
|
+
5. **Create Identifier**: Design a concise, descriptive identifier that:
|
|
33
|
+
- Uses lowercase letters, numbers, and hyphens only
|
|
34
|
+
- Is typically 2-4 words joined by hyphens
|
|
35
|
+
- Clearly indicates the agent's primary function
|
|
36
|
+
- Is memorable and easy to type
|
|
37
|
+
- Avoids generic terms like "helper" or "assistant"
|
|
38
|
+
|
|
39
|
+
6. **Example agent descriptions**:
|
|
40
|
+
- In the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
|
|
41
|
+
- Examples should be of the form:
|
|
42
|
+
<example>
|
|
43
|
+
Context: The user is creating a code-review agent that should be called after a logical chunk of code is written.
|
|
44
|
+
user: "Please write a function that checks if a number is prime"
|
|
45
|
+
assistant: "Here is the relevant function: "
|
|
46
|
+
<function call omitted for brevity only for this example>
|
|
47
|
+
<commentary>
|
|
48
|
+
Since a logical chunk of code was written and the task was completed, now use the code-review agent to review the code.
|
|
49
|
+
</commentary>
|
|
50
|
+
assistant: "Now let me use the code-reviewer agent to review the code"
|
|
51
|
+
</example>
|
|
52
|
+
- If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
|
|
53
|
+
- NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
|
|
54
|
+
|
|
55
|
+
Your output must be a valid JSON object with exactly these fields:
|
|
56
|
+
{
|
|
57
|
+
"identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'code-reviewer', 'api-docs-writer', 'test-generator')",
|
|
58
|
+
"whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
|
|
59
|
+
"systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Key principles for your system prompts:
|
|
63
|
+
- Be specific rather than generic - avoid vague instructions
|
|
64
|
+
- Include concrete examples when they would clarify behavior
|
|
65
|
+
- Balance comprehensiveness with clarity - every instruction should add value
|
|
66
|
+
- Ensure the agent has enough context to handle variations of the core task
|
|
67
|
+
- Make the agent proactive in seeking clarification when needed
|
|
68
|
+
- Build in quality assurance and self-correction mechanisms
|
|
69
|
+
|
|
70
|
+
Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage Pattern
|
|
74
|
+
|
|
75
|
+
Use this prompt to generate agent configurations:
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
**User input:** "I need an agent that reviews pull requests for code quality issues"
|
|
79
|
+
|
|
80
|
+
**You send to Claude with the system prompt above:**
|
|
81
|
+
Create an agent configuration based on this request: "I need an agent that reviews pull requests for code quality issues"
|
|
82
|
+
|
|
83
|
+
**Claude returns JSON:**
|
|
84
|
+
{
|
|
85
|
+
"identifier": "pr-quality-reviewer",
|
|
86
|
+
"whenToUse": "Use this agent when the user asks to review a pull request, check code quality, or analyze PR changes. Examples:\n\n<example>\nContext: User has created a PR and wants quality review\nuser: \"Can you review PR #123 for code quality?\"\nassistant: \"I'll use the pr-quality-reviewer agent to analyze the PR.\"\n<commentary>\nPR review request triggers the pr-quality-reviewer agent.\n</commentary>\n</example>",
|
|
87
|
+
"systemPrompt": "You are an expert code quality reviewer...\n\n**Your Core Responsibilities:**\n1. Analyze code changes for quality issues\n2. Check adherence to best practices\n..."
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Converting to Agent File
|
|
92
|
+
|
|
93
|
+
Take the JSON output and create the agent markdown file:
|
|
94
|
+
|
|
95
|
+
**agents/pr-quality-reviewer.md:**
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
---
|
|
99
|
+
name: pr-quality-reviewer
|
|
100
|
+
description: Use this agent when the user asks to review a pull request, check code quality, or analyze PR changes. Examples:
|
|
101
|
+
|
|
102
|
+
<example>
|
|
103
|
+
Context: User has created a PR and wants quality review
|
|
104
|
+
user: "Can you review PR #123 for code quality?"
|
|
105
|
+
assistant: "I'll use the pr-quality-reviewer agent to analyze the PR."
|
|
106
|
+
<commentary>
|
|
107
|
+
PR review request triggers the pr-quality-reviewer agent.
|
|
108
|
+
</commentary>
|
|
109
|
+
</example>
|
|
110
|
+
|
|
111
|
+
model: inherit
|
|
112
|
+
color: blue
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
You are an expert code quality reviewer...
|
|
116
|
+
|
|
117
|
+
**Your Core Responsibilities:**
|
|
118
|
+
|
|
119
|
+
1. Analyze code changes for quality issues
|
|
120
|
+
2. Check adherence to best practices
|
|
121
|
+
...
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Customization Tips
|
|
125
|
+
|
|
126
|
+
### Adapt the System Prompt
|
|
127
|
+
|
|
128
|
+
The base prompt is excellent but can be enhanced for specific needs:
|
|
129
|
+
|
|
130
|
+
**For security-focused agents:**
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
Add after "Architect Comprehensive Instructions":
|
|
134
|
+
- Include OWASP top 10 security considerations
|
|
135
|
+
- Check for common vulnerabilities (injection, XSS, etc.)
|
|
136
|
+
- Validate input sanitization
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**For test-generation agents:**
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Add after "Optimize for Performance":
|
|
143
|
+
- Follow AAA pattern (Arrange, Act, Assert)
|
|
144
|
+
- Include edge cases and error scenarios
|
|
145
|
+
- Ensure test isolation and cleanup
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**For documentation agents:**
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
Add after "Design Expert Persona":
|
|
152
|
+
- Use clear, concise language
|
|
153
|
+
- Include code examples
|
|
154
|
+
- Follow project documentation standards from CLAUDE.md
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Best Practices from Internal Implementation
|
|
158
|
+
|
|
159
|
+
### 1. Consider Project Context
|
|
160
|
+
|
|
161
|
+
The prompt specifically mentions using CLAUDE.md context:
|
|
162
|
+
|
|
163
|
+
- Agent should align with project patterns
|
|
164
|
+
- Follow project-specific coding standards
|
|
165
|
+
- Respect established practices
|
|
166
|
+
|
|
167
|
+
### 2. Proactive Agent Design
|
|
168
|
+
|
|
169
|
+
Include examples showing proactive usage:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
<example>
|
|
173
|
+
Context: After writing code, agent should review proactively
|
|
174
|
+
user: "Please write a function..."
|
|
175
|
+
assistant: "[Writes function]"
|
|
176
|
+
<commentary>
|
|
177
|
+
Code written, now use review agent proactively.
|
|
178
|
+
</commentary>
|
|
179
|
+
assistant: "Now let me review this code with the code-reviewer agent"
|
|
180
|
+
</example>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 3. Scope Assumptions
|
|
184
|
+
|
|
185
|
+
For code review agents, assume "recently written code" not entire codebase:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
For agents that review code, assume recent changes unless explicitly
|
|
189
|
+
stated otherwise.
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 4. Output Structure
|
|
193
|
+
|
|
194
|
+
Always define clear output format in system prompt:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
**Output Format:**
|
|
198
|
+
Provide results as:
|
|
199
|
+
1. Summary (2-3 sentences)
|
|
200
|
+
2. Detailed findings (bullet points)
|
|
201
|
+
3. Recommendations (action items)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Integration with Plugin-Dev
|
|
205
|
+
|
|
206
|
+
Use this system prompt when creating agents for your plugins:
|
|
207
|
+
|
|
208
|
+
1. Take user request for agent functionality
|
|
209
|
+
2. Feed to Claude with this system prompt
|
|
210
|
+
3. Get JSON output (identifier, whenToUse, systemPrompt)
|
|
211
|
+
4. Convert to agent markdown file with frontmatter
|
|
212
|
+
5. Validate with agent validation rules
|
|
213
|
+
6. Test triggering conditions
|
|
214
|
+
7. Add to plugin's `agents/` directory
|
|
215
|
+
|
|
216
|
+
This provides AI-assisted agent generation following proven patterns from Claude Code's internal implementation.
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Permission Modes & Rules Reference
|
|
2
|
+
|
|
3
|
+
This reference covers the complete permission system for Claude Code agents, including all permission modes and the permission rule syntax for fine-grained access control.
|
|
4
|
+
|
|
5
|
+
## Permission Modes
|
|
6
|
+
|
|
7
|
+
Agents can specify a `permissionMode` in frontmatter to control how permission requests are handled:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
permissionMode: acceptEdits
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### All Permission Modes
|
|
14
|
+
|
|
15
|
+
| Mode | Behavior | Use Case |
|
|
16
|
+
| ------------------- | ------------------------------------------------------------ | --------------------------------------------------- |
|
|
17
|
+
| `default` | Standard permission model — prompts user for each action | General-purpose agents, untrusted contexts |
|
|
18
|
+
| `acceptEdits` | Auto-accept file edit operations (Write, Edit, NotebookEdit) | Code generation agents that need to write files |
|
|
19
|
+
| `dontAsk` | Skip all permission dialogs | Trusted automation agents, CI/CD agents |
|
|
20
|
+
| `bypassPermissions` | Full bypass of all permission checks | Fully trusted agents only |
|
|
21
|
+
| `plan` | Planning mode — propose changes without executing | Architecture/design agents, review agents |
|
|
22
|
+
| `delegate` | Coordination-only — restricted to team management tools | Team lead agents that should not implement directly |
|
|
23
|
+
|
|
24
|
+
### Mode Details
|
|
25
|
+
|
|
26
|
+
#### default
|
|
27
|
+
|
|
28
|
+
The standard interactive permission model. Claude asks the user before performing actions that require permission. This is the implicit mode when `permissionMode` is not specified.
|
|
29
|
+
|
|
30
|
+
**When to use:** General-purpose agents, agents handling sensitive operations, agents in untrusted contexts.
|
|
31
|
+
|
|
32
|
+
#### acceptEdits
|
|
33
|
+
|
|
34
|
+
Auto-accepts file writing operations (Write, Edit, NotebookEdit) without prompting. Other operations (Bash, etc.) still require user permission.
|
|
35
|
+
|
|
36
|
+
**When to use:** Code generation agents, refactoring agents, documentation generators.
|
|
37
|
+
|
|
38
|
+
#### dontAsk
|
|
39
|
+
|
|
40
|
+
Skips all permission dialogs. The agent proceeds without user confirmation for any action.
|
|
41
|
+
|
|
42
|
+
**When to use:** Trusted automation, background agents, CI/CD pipelines where no user is present.
|
|
43
|
+
|
|
44
|
+
#### bypassPermissions
|
|
45
|
+
|
|
46
|
+
Full permission bypass with no restrictions. More permissive than `dontAsk` as it bypasses even system-level restrictions.
|
|
47
|
+
|
|
48
|
+
**When to use:** Only for fully trusted agents in controlled environments. Never for plugins distributed to unknown users.
|
|
49
|
+
|
|
50
|
+
#### plan
|
|
51
|
+
|
|
52
|
+
Planning mode restricts the agent to read-only operations. The agent can explore the codebase and propose changes but cannot execute them. Requires user approval before any modifications.
|
|
53
|
+
|
|
54
|
+
**When to use:** Architecture planning, design review, impact analysis agents.
|
|
55
|
+
|
|
56
|
+
#### delegate
|
|
57
|
+
|
|
58
|
+
Restricts the agent to team coordination tools only: spawning teammates, sending messages, managing tasks, and shutting down teammates. The agent cannot use implementation tools (Edit, Write, Bash, etc.) directly.
|
|
59
|
+
|
|
60
|
+
**When to use:** Team lead agents that should coordinate work across teammates without implementing tasks themselves.
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
# Team lead agent that only coordinates
|
|
64
|
+
permissionMode: delegate
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Permission Specifier Syntax
|
|
68
|
+
|
|
69
|
+
Permission specifiers define exactly which tool invocations a rule matches. Each tool type has its own pattern syntax.
|
|
70
|
+
|
|
71
|
+
### Bash Patterns
|
|
72
|
+
|
|
73
|
+
| Pattern | Behavior | Example Match | Non-Match |
|
|
74
|
+
| ---------------- | ---------------------------- | ------------------------- | ------------------ |
|
|
75
|
+
| `Bash(npm test)` | Exact match | `npm test` | `npm test --watch` |
|
|
76
|
+
| `Bash(npm *)` | Prefix with word boundary | `npm test`, `npm install` | `npmx build` |
|
|
77
|
+
| `Bash(git*)` | Prefix without word boundary | `git`, `git push`, `gitk` | — |
|
|
78
|
+
|
|
79
|
+
Space before `*` means word boundary: `Bash(ls *)` matches `ls -la` but NOT `lsof`. No space means substring: `Bash(git*)` matches both `git push` and `gitk`.
|
|
80
|
+
|
|
81
|
+
### Path Patterns for Edit/Read/Write
|
|
82
|
+
|
|
83
|
+
Path specifiers follow the gitignore specification:
|
|
84
|
+
|
|
85
|
+
| Pattern | Meaning | Example |
|
|
86
|
+
| -------- | -------------------------------------------- | ---------------------- |
|
|
87
|
+
| `//path` | Absolute from filesystem root | `Edit(//etc/config)` |
|
|
88
|
+
| `~/path` | Relative to home directory | `Read(~/Documents/**)` |
|
|
89
|
+
| `/path` | Relative to settings file location | `Edit(/src/**)` |
|
|
90
|
+
| `./path` | Relative to current directory | `Write(./output/*)` |
|
|
91
|
+
| `path` | Relative to current directory (same as `./`) | `Edit(src/**)` |
|
|
92
|
+
| `*` | Single directory level wildcard | `Read(src/*)` |
|
|
93
|
+
| `**` | Recursive directory wildcard | `Edit(src/**)` |
|
|
94
|
+
|
|
95
|
+
### WebFetch Patterns
|
|
96
|
+
|
|
97
|
+
Restrict by domain:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
WebFetch(domain:example.com)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### MCP Tool Patterns
|
|
104
|
+
|
|
105
|
+
| Pattern | Matches |
|
|
106
|
+
| ------------------- | ------------------------- |
|
|
107
|
+
| `mcp__server` | All tools from server |
|
|
108
|
+
| `mcp__server__*` | All tools from server |
|
|
109
|
+
| `mcp__server__tool` | Specific tool from server |
|
|
110
|
+
|
|
111
|
+
### Task (Agent) Patterns
|
|
112
|
+
|
|
113
|
+
| Pattern | Matches |
|
|
114
|
+
| -------------------- | ---------------------------- |
|
|
115
|
+
| `Task(agent-name)` | Only the named agent type |
|
|
116
|
+
| `Task(name1, name2)` | Only listed agent types |
|
|
117
|
+
| `Task` | All subagent types |
|
|
118
|
+
| _(omit entirely)_ | No subagent spawning allowed |
|
|
119
|
+
|
|
120
|
+
### Skill Patterns
|
|
121
|
+
|
|
122
|
+
| Pattern | Matches |
|
|
123
|
+
| --------------- | --------------------------- |
|
|
124
|
+
| `Skill(name)` | Exact skill name match |
|
|
125
|
+
| `Skill(name *)` | Prefix match with arguments |
|
|
126
|
+
|
|
127
|
+
### Evaluation Order
|
|
128
|
+
|
|
129
|
+
Rules are evaluated in a strict order — first match wins within each tier:
|
|
130
|
+
|
|
131
|
+
1. **Deny** rules checked first
|
|
132
|
+
2. **Ask** rules checked second
|
|
133
|
+
3. **Allow** rules checked last
|
|
134
|
+
|
|
135
|
+
### Default Permission Tiers
|
|
136
|
+
|
|
137
|
+
Tools fall into three default permission tiers:
|
|
138
|
+
|
|
139
|
+
| Tier | Tools | Behavior |
|
|
140
|
+
| ----------------- | ------------------------- | -------------------------------------------------- |
|
|
141
|
+
| Read-only | Read, Glob, Grep | No approval needed |
|
|
142
|
+
| Bash commands | Bash | Manual approval on first use per directory/command |
|
|
143
|
+
| File modification | Write, Edit, NotebookEdit | Approval required per session |
|
|
144
|
+
|
|
145
|
+
## Permission Rules
|
|
146
|
+
|
|
147
|
+
Permission rules provide fine-grained control over specific tool access. They are configured in settings files (not agent frontmatter) and apply based on precedence.
|
|
148
|
+
|
|
149
|
+
### Rule Syntax
|
|
150
|
+
|
|
151
|
+
Rules are specified in `settings.json` under `permissions`:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"permissions": {
|
|
156
|
+
"allow": ["Read", "Bash(npm test)", "Edit(src/**)"],
|
|
157
|
+
"deny": ["Bash(rm *)", "Bash(git push --force*)"]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Tool Specifiers
|
|
163
|
+
|
|
164
|
+
| Pattern | Matches | Example |
|
|
165
|
+
| -------------------- | ------------------------------- | ------------------------------------ |
|
|
166
|
+
| `ToolName` | Any use of that tool | `Read` — all file reads |
|
|
167
|
+
| `ToolName(argument)` | Tool with specific argument | `Bash(npm test)` — only this command |
|
|
168
|
+
| `ToolName(pattern*)` | Tool with wildcard argument | `Bash(npm *)` — any npm command |
|
|
169
|
+
| `Edit(path)` | Edit with gitignore-style path | `Edit(src/**)` — edits in src/ |
|
|
170
|
+
| `Write(path)` | Write with gitignore-style path | `Write(tests/**)` — writes in tests/ |
|
|
171
|
+
|
|
172
|
+
### MCP Tool Patterns
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"permissions": {
|
|
177
|
+
"allow": ["mcp__servername__toolname", "mcp__servername__*"]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- `mcp__server__tool` — specific MCP tool
|
|
183
|
+
- `mcp__server__*` — all tools from a server
|
|
184
|
+
- `mcp__*` — all MCP tools (use sparingly)
|
|
185
|
+
|
|
186
|
+
### Task (Agent) Patterns
|
|
187
|
+
|
|
188
|
+
Control which agent types can be spawned:
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"permissions": {
|
|
193
|
+
"allow": ["Task(code-reviewer, test-runner)"]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- `Task(type1, type2)` — only listed agent types
|
|
199
|
+
- `Task` — allow any subagent
|
|
200
|
+
- Omitting `Task` — no subagent spawning
|
|
201
|
+
|
|
202
|
+
### Rule Precedence
|
|
203
|
+
|
|
204
|
+
When multiple rules match:
|
|
205
|
+
|
|
206
|
+
1. **deny** rules always take precedence over **allow** rules
|
|
207
|
+
2. More specific rules take precedence over general ones
|
|
208
|
+
3. Explicit rules override `permissionMode` settings
|
|
209
|
+
|
|
210
|
+
### Plugin Developer Guidance
|
|
211
|
+
|
|
212
|
+
**Document required permissions:** If your plugin's agents need specific tool access, document the minimum required permissions in your README:
|
|
213
|
+
|
|
214
|
+
```markdown
|
|
215
|
+
## Required Permissions
|
|
216
|
+
|
|
217
|
+
This plugin's agents need:
|
|
218
|
+
|
|
219
|
+
- `Edit(src/**)` — to modify source files
|
|
220
|
+
- `Bash(npm test)` — to run tests
|
|
221
|
+
- `mcp__plugin_myserver__*` — for MCP tool access
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Configure agent permissions:** Use `permissionMode` in agent frontmatter for broad access control. For fine-grained restrictions, document the settings users should configure.
|
|
225
|
+
|
|
226
|
+
**Principle of least privilege:** Request only the permissions your agent actually needs. Use `acceptEdits` over `dontAsk` when only file writes are needed.
|