Compare commits

..

1 Commits

Author SHA1 Message Date
Claude
416b2c53c5 docs: add permissionMode field to agent development docs
Document the permissionMode agent frontmatter field (added in v2.0.43)
with kebab-case values for consistency:
- default: inherit from parent conversation
- ask: always prompt for permission
- accept-edits: auto-accept file edits

Note backwards compatibility with camelCase 'acceptEdits' while
establishing kebab-case as the preferred format to match CLI flags.
2025-12-12 20:06:00 +00:00
5 changed files with 42 additions and 182 deletions

View File

@@ -1,20 +1,8 @@
# Changelog
## 2.0.69
- Minor bugfixes
## 2.0.68
- Fixed IME (Input Method Editor) support for languages like Chinese, Japanese, and Korean by correctly positioning the composition window at the cursor
- Fixed a bug where disallowed MCP tools were visible to the model
- Fixed an issue where steering messages could be lost while a subagent is working
- Fixed Option+Arrow word navigation treating entire CJK (Chinese, Japanese, Korean) text sequences as a single word instead of navigating by word boundaries
- Improved plan mode exit UX: show simplified yes/no dialog when exiting with empty or missing plan instead of throwing an error
- Add support for enterprise managed settings. Contact your Anthropic account team to enable this feature.
## 2.0.67
- Claude now suggests prompts to speed up your workflow: press Tab to accept or Enter to submit
- Thinking mode is now enabled by default for Opus 4.5
- Thinking mode configuration has moved to /config
- Added search functionality to `/permissions` command with `/` keyboard shortcut for filtering rules by tool name

View File

@@ -42,6 +42,7 @@ assistant: "[How assistant should respond and use this agent]"
model: inherit
color: blue
tools: ["Read", "Write", "Grep"]
permissionMode: default
---
You are [agent role description]...
@@ -159,6 +160,41 @@ tools: ["Read", "Write", "Grep", "Bash"]
- Testing: `["Read", "Bash", "Grep"]`
- Full access: Omit field or use `["*"]`
### permissionMode (optional)
Control how permission prompts are handled for the agent.
**Format:** String
**Options:**
- `default` - Inherit permission mode from parent conversation (default behavior)
- `ask` - Always prompt for permission before tool use
- `accept-edits` - Auto-accept file edits without prompting
```yaml
permissionMode: accept-edits
```
**Default:** If omitted, inherits from parent conversation settings
**Backwards compatibility:** `acceptEdits` is also accepted but `accept-edits` (kebab-case) is preferred for consistency with CLI flags.
**Use cases:**
- Agents performing many file operations: Use `accept-edits`
- Security-sensitive agents: Use `ask` to ensure oversight
- General purpose: Omit field to inherit conversation settings
**Example:**
```yaml
---
name: code-generator
description: Use this agent when...
model: inherit
color: green
permissionMode: accept-edits
---
```
## System Prompt Design
The markdown body becomes the agent's system prompt. Write in second person, addressing the agent directly.
@@ -355,6 +391,7 @@ Output: [What to provide]
| model | Yes | inherit/sonnet/opus/haiku | inherit |
| color | Yes | Color name | blue |
| tools | No | Array of tool names | ["Read", "Grep"] |
| permissionMode | No | default/ask/accept-edits | accept-edits |
### Best Practices

View File

@@ -1,6 +1,6 @@
---
name: Hook Development
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", "teleport hook", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
version: 0.1.0
---
@@ -239,12 +239,7 @@ Execute when user submits a prompt. Use to add context, validate, or block promp
Execute when Claude Code session begins. Use to load context and set environment.
**Matchers for SessionStart:**
- `*` - All session starts
- `teleport` - Only when session started via teleport (web → CLI)
- `fresh` - Only for fresh sessions (not teleported)
**Example (general context loading):**
**Example:**
```json
{
"SessionStart": [
@@ -261,58 +256,12 @@ Execute when Claude Code session begins. Use to load context and set environment
}
```
**Example (teleport-specific setup):**
```json
{
"SessionStart": [
{
"matcher": "teleport",
"hooks": [
{
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/post-teleport.sh"
}
]
}
]
}
```
**Example script (post-teleport.sh):**
```bash
#!/bin/bash
cd "$CLAUDE_PROJECT_DIR" || exit 0
# Pull latest changes from the teleported branch
if [ -d ".git" ]; then
echo "🔄 Pulling latest changes..."
git pull origin "$(git branch --show-current)" 2>/dev/null || true
fi
# Install dependencies if needed
if [ -f "package.json" ]; then
echo "📦 Installing dependencies..."
npm install --silent
fi
# Start dev server (example for common workflow)
if [ -f "package.json" ] && grep -q '"dev"' package.json; then
echo "🚀 Starting dev server..."
npm run dev &
fi
```
**Special capability:** Persist environment variables using `$CLAUDE_ENV_FILE`:
```bash
echo "export PROJECT_TYPE=nodejs" >> "$CLAUDE_ENV_FILE"
```
**Teleport-specific input fields:**
- `is_teleport`: Boolean indicating if this session started via teleport
- `source`: Where the session came from ("web" or "cli") - only present for teleports
- `branch`: The git branch that was teleported - only present for teleports
See `examples/load-context.sh` and `examples/post-teleport.sh` for complete examples.
See `examples/load-context.sh` for complete example.
### SessionEnd
@@ -689,7 +638,7 @@ echo "$output" | jq .
| UserPromptSubmit | User input | Context, validation |
| Stop | Agent stopping | Completeness check |
| SubagentStop | Subagent done | Task validation |
| SessionStart | Session begins | Context loading (use `teleport` matcher for teleport-specific setup) |
| SessionStart | Session begins | Context loading |
| SessionEnd | Session ends | Cleanup, logging |
| PreCompact | Before compact | Preserve context |
| Notification | User notified | Logging, reactions |
@@ -730,7 +679,6 @@ Working examples in `examples/`:
- **`validate-write.sh`** - File write validation example
- **`validate-bash.sh`** - Bash command validation example
- **`load-context.sh`** - SessionStart context loading example
- **`post-teleport.sh`** - SessionStart teleport matcher setup example
### Utility Scripts

View File

@@ -1,52 +0,0 @@
#!/bin/bash
# Example SessionStart hook with "teleport" matcher for setting up environment
# after teleporting from web to CLI. This script pulls changes, installs
# dependencies, and starts the dev server.
set -euo pipefail
# Navigate to project directory
cd "$CLAUDE_PROJECT_DIR" || exit 0
echo "Setting up environment after teleport..."
# Pull latest changes if in a git repository
if [ -d ".git" ]; then
current_branch=$(git branch --show-current)
echo "🔄 Pulling latest changes for branch: $current_branch"
git pull origin "$current_branch" 2>/dev/null || echo "Could not pull (may be offline or no upstream)"
fi
# Install dependencies based on project type
if [ -f "package.json" ]; then
echo "📦 Installing Node.js dependencies..."
npm install --silent 2>/dev/null || npm install
fi
if [ -f "requirements.txt" ]; then
echo "🐍 Installing Python dependencies..."
pip install -r requirements.txt --quiet 2>/dev/null || pip install -r requirements.txt
fi
if [ -f "Cargo.toml" ]; then
echo "🦀 Building Rust project..."
cargo build 2>/dev/null || true
fi
# Start development server if available
if [ -f "package.json" ]; then
# Check for common dev server scripts
if grep -q '"dev:staging"' package.json; then
echo "🚀 Starting staging dev server..."
npm run dev:staging &
elif grep -q '"dev"' package.json; then
echo "🚀 Starting dev server..."
npm run dev &
elif grep -q '"start"' package.json; then
echo "🚀 Starting server..."
npm start &
fi
fi
echo "✅ Teleport complete! Environment ready."
exit 0

View File

@@ -344,64 +344,3 @@ fi
- Per-project settings
- Team-specific rules
- Dynamic validation criteria
## Pattern 11: Teleport Workflow Automation
Automate setup when teleporting sessions from web to CLI using the `teleport` matcher:
**SessionStart hook with teleport matcher:**
```json
{
"SessionStart": [
{
"matcher": "teleport",
"hooks": [
{
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/post-teleport.sh"
}
]
}
]
}
```
**post-teleport.sh:**
```bash
#!/bin/bash
cd "$CLAUDE_PROJECT_DIR" || exit 0
# Pull latest changes
if [ -d ".git" ]; then
echo "🔄 Pulling latest changes..."
git pull origin "$(git branch --show-current)" 2>/dev/null || true
fi
# Install dependencies
if [ -f "package.json" ]; then
echo "📦 Installing dependencies..."
npm install --silent
fi
# Start dev server
if [ -f "package.json" ] && grep -q '"dev:staging"' package.json; then
echo "🚀 Starting staging dev server..."
npm run dev:staging &
elif [ -f "package.json" ] && grep -q '"dev"' package.json; then
echo "🚀 Starting dev server..."
npm run dev &
fi
echo "✅ Teleport complete! Environment ready."
```
**Available matchers for SessionStart:**
- `*` - All session starts (both fresh and teleported)
- `teleport` - Only teleported sessions (web → CLI)
- `fresh` - Only fresh sessions (not teleported)
**Use for:**
- Seamless web-to-CLI workflow transitions
- Automatic dev server startup after teleporting
- Pulling latest changes and installing dependencies
- Running project-specific setup scripts