Skip to main content

Overview

Magic commands are AI-powered automation features that streamline common development workflows. Each command uses customizable prompts and can be configured with specific models, backends, and providers.

Available Commands

Jean includes 14 magic commands, each with a dedicated prompt template:

GitHub Investigation

Investigate Issue

Trigger: Click “Investigate” on GitHub issue What it does:
  1. Creates worktree for the issue
  2. Loads issue description and comments
  3. Analyzes problem and proposes solution
  4. Identifies root cause
  5. Checks for regressions
  6. Suggests implementation approach
Default prompt structure:
Configuration:

Investigate PR

Trigger: Click “Investigate” on pull request What it does:
  1. Checks out PR branch as worktree
  2. Loads PR description, reviews, and comments
  3. Analyzes changes and approach
  4. Security review - checks for malicious code
  5. Identifies action items from reviews
  6. Proposes next steps
Security checks include:
  • Malicious or obfuscated code
  • Suspicious dependency changes
  • Hardcoded secrets or credentials
  • Backdoors or unauthorized access
  • Injection vulnerabilities
  • Weakened authentication/permissions
Configuration:

Investigate Workflow Run

Trigger: Click “Investigate” on failed CI workflow What it does:
  1. Fetches workflow run logs via gh run view {runId} --log-failed
  2. Analyzes error output
  3. Explores relevant code
  4. Determines if code issue, config issue, or flaky test
  5. Proposes fix with specific changes
Default prompt:

Security Analysis

Investigate Security Alert

Trigger: View Dependabot vulnerability alerts What it does:
  1. Reads vulnerability details (CVE, GHSA, severity)
  2. Identifies affected dependency and version range
  3. Searches codebase for package usage
  4. Assesses actual impact (is vulnerable code used?)
  5. Evaluates remediation options
  6. Proposes fix with compatibility assessment
Key focus:
  • Is the vulnerability actually exploitable?
  • Is the vulnerable function/API used?
  • Breaking changes in patched version?
Configuration:

Investigate Advisory

Trigger: View repository security advisories What it does:
  1. Reads full vulnerability details (GHSA, CVE, CWE)
  2. Understands vulnerability type and preconditions
  3. Locates vulnerable code in repository
  4. Develops comprehensive fix
  5. Verifies completeness across codebase
  6. Documents vulnerability and remediation
Security-first approach:
  • Think like an attacker
  • Check for bypass attempts
  • Look for same pattern elsewhere
Configuration:

Investigate Linear Issue

Trigger: Click “Investigate” on Linear issue What it does: Similar to GitHub issue investigation but for Linear:
  1. Loads Linear issue context (embedded in prompt)
  2. Analyzes problem
  3. Explores codebase
  4. Identifies root cause
  5. Proposes solution
Note: Linear context is embedded in the prompt since Claude CLI cannot access Linear API directly.

Git Operations

Commit Message

Trigger: Toolbar → Commit button What it does:
  1. Runs git status --porcelain
  2. Gets staged diff
  3. Reads recent commits for style
  4. Generates concise commit message
  5. Creates commit with AI message
  6. Optionally pushes to remote
Uses JSON schema for structured output:
Configuration:
Response structure:

PR Content

Trigger: Toolbar → Open PR button What it does:
  1. Collects branch info and commit history
  2. Gets diff between branches
  3. Generates PR title and description
  4. Creates PR on GitHub via gh pr create
  5. Links PR to worktree
Default prompt:
JSON schema output:
Configuration:

Code Review

Trigger: Toolbar → Review button What it does:
  1. Collects branch info and commits
  2. Gets diff and uncommitted changes
  3. Performs comprehensive code review
  4. Returns structured findings
  5. Provides approval status
Review focus areas:
  • Security & supply-chain risks
  • Performance issues
  • Code quality and maintainability
  • Potential bugs
  • Best practices violations
Structured output:
UI integration:
  • Findings displayed in ReviewResultsPanel
  • Track which findings have been fixed
  • Persisted in UI state
Configuration:

Resolve Conflicts

Trigger: Automatic when merge/rebase conflicts detected What it does:
  1. Appends conflict resolution prompt to message
  2. Shows conflict diff
  3. AI explains what’s conflicting
  4. Guides through resolving each conflict
  5. Stages files with git add
  6. Continues operation until complete
Default prompt:
Configuration:

Release Notes

Trigger: Manual invocation What it does:
  1. Lists commits since last release
  2. Fetches previous release info via gh release list
  3. Generates structured release notes
  4. Groups into categories (Features, Fixes, etc.)
  5. Filters out merge commits and trivial changes
Default prompt:
Configuration:

Session Management

Session Naming

Trigger: Automatic on first message (if enabled) What it does:
  1. Analyzes first user message
  2. Generates 4-5 word session name
  3. Updates session title
  4. Uses sentence case
  5. Avoids generic names
Rules:
  • Maximum 4-5 words
  • Sentence case only
  • Descriptive and concise
  • No special characters
  • No commit-style prefixes (Add, Fix, Update)
JSON schema output:
Configuration:

Session Recap

Trigger: Returning to unfocused session (if enabled) What it does:
  1. Summarizes entire conversation
  2. Extracts main goal and status
  3. Highlights last completed action
  4. Shows in popup before resuming
Structured output:
Configuration:

Context Summary

Trigger: Toolbar → Save Context What it does:
  1. Summarizes entire conversation
  2. Extracts key decisions and rationale
  3. Documents trade-offs considered
  4. Lists problems solved
  5. Notes current state and next steps
  6. Saves as markdown file
Output format:
Configuration:

System Prompts

Global System Prompt

Application: Appended to every chat session Default content:
  • Plan mode guidelines
  • Subagent strategy
  • Self-improvement loop (.ai/lessons.md)
  • Verification requirements
  • Code elegance standards
  • Autonomous bug fixing
Configuration:

Parallel Execution

Application: Encourages parallel sub-agent usage What it does:
  • Suggests structuring plans for parallelism
  • Recommends launching Task agents in single message
  • Groups independent work items
Configuration:

How to Use

Customizing Prompts

Access magic prompts:
  1. Settings (Cmd/Ctrl + ,)
  2. AI section
  3. Magic Prompts tab
  4. Select prompt to customize
Editing:
  1. Click “Edit” next to prompt
  2. Modify template in text editor
  3. Use placeholders: {variable}
  4. Save changes
  5. Set to null to use app default
Template variables:
  • {issueRefs}, {prRefs}: Reference numbers
  • {workflowName}, {branch}: Context info
  • {commits}, {diff}: Git data
  • {message}: User input

Configuring Models

Per-prompt model selection:
  1. Settings → AI → Magic Prompts
  2. Find prompt in list
  3. Click model dropdown
  4. Choose from available models
  5. Presets: Claude, Codex, OpenCode
Model defaults:

Backend & Provider Overrides

Per-prompt backend:
  1. Settings → AI → Magic Prompts
  2. Advanced options
  3. Select backend for each prompt
  4. null = use session backend
Per-prompt provider:
  1. Same location as backend
  2. Choose provider profile
  3. null = use session provider
Use cases:
  • Route expensive operations to specific backend
  • Use regional models for certain tasks
  • Cost optimization
  • Performance tuning

Using Magic Commands

Issue investigation:
  1. Open project
  2. Click GitHub icon in sidebar
  3. Browse issues
  4. Click “Investigate” button
  5. Worktree creates and AI starts analysis
PR investigation:
  1. Find PR in GitHub panel
  2. Click “Investigate”
  3. Worktree checks out PR branch
  4. AI analyzes changes and reviews
Commit creation:
  1. Stage changes with git
  2. Click Commit button in toolbar
  3. AI generates message
  4. Review and confirm
  5. Optionally push
Code review:
  1. Complete feature work
  2. Click Review button
  3. AI analyzes all changes
  4. Findings shown in panel
  5. Fix issues and re-review

Configuration Options

Magic Prompt Settings

All prompts stored in AppPreferences.magic_prompts:

Model Overrides

Backend Overrides

Provider Overrides

Best Practices

Prompt Design

Structure prompts clearly:
Use placeholders:
  • {variable}: Required data
  • Document what each placeholder contains
  • Test with sample data
Keep prompts focused:
  • One clear objective
  • Specific output format
  • Actionable instructions

Model Selection

By task complexity:
Cost vs. quality:
  • Haiku: Fast and cheap, good enough for most
  • Sonnet: Balanced, best default
  • Opus: Expensive, use for critical tasks

Security Best Practices

For PR investigation:
  • Always enable security checks
  • Review AI findings carefully
  • Don’t auto-merge based on AI approval
  • Use as one input in review process
For security alerts:
  • Verify AI’s impact assessment
  • Check if vulnerability actually applies
  • Test patches before deploying
  • Document remediation decisions

Performance Optimization

Choose appropriate models:
  • Don’t use Opus for commit messages
  • Haiku is often sufficient
  • Measure response times
  • Adjust based on results
Backend selection:
  • Use fastest backend for frequent operations
  • Route expensive tasks to powerful models
  • Balance cost and performance

Workflow Integration

Issue-driven development:
PR review workflow:

Custom Prompt Examples

Commit message with conventional commits:
PR content with jira links:
Code review with custom standards: