For Claude Code Agents: How to use AEA autonomously and safely
This guide explains what agents (like you!) should do when encountering AEA messages.
- Your Role as an Agent
- Decision Tree: Should I Auto-Process?
- What Auto-Processing Means
- Message Type Guidelines
- Priority Guidelines
- Safety Rules
- Response Guidelines
- Common Patterns
- What NOT to Do
Your job:
- β Process routine, safe messages autonomously
- β Provide information and answer questions
- β Coordinate with other agents on technical matters
- β Keep the user informed of important messages
NOT your job:
- β Make business decisions without user approval
- β Write code that could break things
- β Commit changes without user review
- β Spend significant user time without permission
"Would the user be surprised if I did this without asking?"
If YES β Ask for approval If NO β Process automatically
New Message Received
β
βΌ
βββββββββ
β What β
β type? β
βββββ¬ββββ
β
ββ question βββββ
ββ update βββββββΌββΆ Is priority β€ normal? ββYESββΆ AUTO-PROCESS β
ββ request ββββββ€ β
ββ response βββββ NO
β
βΌ
ASK USER β οΈ
β
ββ issue ββββββββΆ Is priority = urgent? ββYESββΆ ASK USER β οΈ
β β
β NO
β β
β βΌ
β AUTO-PROCESS β
β
ββ handoff ββββββΆ ALWAYS ASK USER β οΈ
| Message Type | Priority | Auto-Process? | Action |
|---|---|---|---|
| question | low/normal | β YES | Answer if you have expertise |
| question | high/urgent | Notify user, wait for approval | |
| issue | low/normal | β YES | Acknowledge, provide info |
| issue | high/urgent | Alert user immediately | |
| update | any | β YES | Acknowledge receipt |
| request | low/normal | β YES | Analyze and respond with plan |
| request | high/urgent | Notify user, wait for approval | |
| handoff | any | Summarize and request approval | |
| response | any | β YES | Read and acknowledge |
When you auto-process a message, you should:
π¬ Message from repo-backend:
Type: question
Subject: How does the authentication flow work?
Body: Can you explain the auth flow so I can integrate it?
For questions:
- Search codebase for relevant information
- Read relevant files
- Compile a clear, accurate answer
For updates:
- Acknowledge receipt
- Note any action items for the user
For requests:
- Analyze feasibility
- Provide implementation approach
- Do NOT implement - just respond with plan
{
"protocol_version": "0.1.0",
"message_type": "response",
"in_reply_to": "original-message-id",
"content": {
"subject": "Re: How does the authentication flow work?",
"body": "The authentication flow works as follows:\n\n1. User submits credentials to /api/auth/login\n2. Server validates against database (src/auth/validator.ts:45)\n3. JWT token generated (src/auth/tokens.ts:12)\n4. Token returned with 24h expiry\n\nKey files:\n- src/auth/login.ts - Login endpoint\n- src/auth/validator.ts - Credential validation\n- src/auth/tokens.ts - JWT generation\n\nLet me know if you need more details!"
}
}bash .aea/scripts/aea-send.sh \
--to repo-backend \
--type response \
--in-reply-to original-message-id \
--subject "Re: How does the authentication flow work?" \
--message "..."touch .aea/.processed/message-original.jsonAll actions are automatically logged to .aea/agent.log for audit.
Auto-process if:
- Priority is low or normal
- You have access to the answer (in codebase, docs, or knowledge)
- Answering won't take significant time (< 2 minutes of work)
- No code changes needed
Example auto-processable:
Q: "What port does the API server run on?"
A: Search codebase β Find in config β Respond
Example requiring approval:
Q: "Should we migrate to PostgreSQL?"
A: Architecture decision β ASK USER
What to do:
- Search codebase for relevant info
- Read relevant files
- Compile clear, accurate answer
- Send response with file references (file:line)
- If unsure, acknowledge and say "Let me ask my user"
Auto-process if:
- Priority is low or normal
- Just acknowledging receipt
- You can provide helpful debugging info without code changes
Example auto-processable:
Issue: "Getting 404 on /api/users endpoint"
Response: "I checked and that endpoint was removed in commit abc123.
It's now /api/v2/users. See migration guide in docs/api-v2.md"
Example requiring approval:
Issue: "π¨ URGENT: Production database is down"
Action: ALERT USER IMMEDIATELY, wait for instructions
What to do:
- Acknowledge the issue
- Provide any relevant information (logs, recent changes, etc.)
- If urgent/high priority β Notify user
- Do NOT fix bugs automatically without approval
Always auto-process
What to do:
- Read the update
- Acknowledge receipt
- Note any action items for the user
- If
requires_response: true, send brief acknowledgment
Example:
Update: "Deployed v2.1.0 to staging"
Response: "Update acknowledged. Staging deployment noted."
Auto-process if:
- Priority is low or normal
- You're only providing analysis, not implementing
- Clear and specific request
What to do:
- Analyze the request
- Provide implementation approach
- Estimate complexity
- List any concerns or blockers
- Do NOT implement - just respond with plan
Example:
Request: "Add rate limiting to API"
Response:
"Implementation approach for rate limiting:
1. Install express-rate-limit package
2. Add middleware in src/middleware/rateLimit.ts
3. Configure limits (suggest: 100 req/15min)
4. Add to routes in src/routes/api.ts
Estimated effort: 1-2 hours
Considerations:
- May need Redis for distributed rate limiting
- Should add tests
- Need to handle rate limit errors gracefully
Ready to implement when you are. Let me know if you'd like me to proceed."
Always ask user approval
What to do:
- Read the handoff details
- Summarize what was done and what's next
- Present to user for review
- Wait for user to approve before proceeding
Example:
Handoff: "Auth refactoring complete, ready for frontend integration"
You say to user:
"π¬ Handoff from backend-repo:
- Auth refactoring completed
- New endpoints: /api/v2/auth/*
- Breaking changes: Old /api/auth/* deprecated
- Next steps: Update frontend to use new endpoints
Would you like me to:
1. Review the changes?
2. Start the frontend integration?
3. Something else?"
Always auto-process
What to do:
- Read the response
- Acknowledge receipt
- Present key info to user if relevant
- Mark as processed
- Auto-process freely
- No time pressure
- Nice-to-have information
- Auto-process if safe
- Regular workflow
- Most messages are normal
β οΈ Notify user- May auto-process simple questions
- Use judgment - when in doubt, ask
β οΈ ALWAYS notify user- Never auto-process
- Alert user immediately
- Wait for explicit approval
β Reading files β Searching codebase β Analyzing code β Providing information β Answering questions β Creating implementation plans β Acknowledging messages
β Writing/editing code without approval
β Committing changes
β Running commands that modify state
β Making architecture decisions
β Spending significant user time
β Anything with urgent priority
β Messages of type handoff
Default to asking the user.
Better to ask unnecessarily than to act inappropriately.
Bad:
"I can help with that."
Good:
"The authentication endpoint is at src/api/auth.ts:45.
It expects { username: string, password: string }
and returns { token: string, expiresIn: number }"
Always include file references:
"See the implementation in src/auth/login.ts:23-45"
"Configuration is in config/database.yaml:12"
If you don't know:
"I don't have enough information to answer that.
Let me ask my user for clarification."
If it requires user decision:
"This is an architecture decision that requires user input.
Here are the options: [...]
I'll ask my user to decide."
Use:
- Numbered lists for steps
- Code blocks for code
- Bullet points for lists
- Clear headings
Incoming: "What format does your API expect?"
Your response:
1. Search for API endpoint
2. Read endpoint implementation
3. Extract request/response format
4. Send detailed response with examples
Incoming: "Getting error when calling /api/users"
Your response:
1. Search for endpoint implementation
2. Check recent changes (git log)
3. Review error handling
4. Respond with:
- What might be wrong
- Recent changes that could affect it
- Debugging suggestions
- Offer to investigate further if needed
Incoming: "Need to integrate with your auth service"
Your response:
1. Find authentication documentation
2. Identify integration points
3. Respond with:
- Authentication flow diagram
- Required endpoints
- Example code
- Configuration needed
- Offer to help with integration
Incoming: "Deployed v2.0 to production"
Your response:
1. Acknowledge deployment
2. Note any implications for your codebase
3. Check if any updates needed
4. Respond with brief acknowledgment
Bad:
Message: "The API is slow"
Agent: *rewrites entire API without asking*
Good:
Message: "The API is slow"
Agent: "I can analyze performance. Would you like me to:
1. Profile the slow endpoints?
2. Suggest optimizations?
3. Something else?"
Bad:
Message: "How does caching work?"
Agent: *spends 30 minutes reading every file*
Good:
Message: "How does caching work?"
Agent: *quick search* "Caching is handled in src/cache/redis.ts.
Want more details?"
Bad:
Message: "π¨ URGENT: Production is down"
Priority: urgent
Agent: *processes automatically without user knowledge*
Good:
Message: "π¨ URGENT: Production is down"
Priority: urgent
Agent: "β οΈ URGENT MESSAGE from backend-repo:
Production is down. Needs immediate attention.
Message details: [...]"
Bad:
Message: "Should we migrate to microservices?"
Agent: "Yes, here's my 5000-word architectural plan..."
Good:
Message: "Should we migrate to microservices?"
Agent: "This is an architecture decision for the user.
Let me present the question to them."
Message Type: question
Priority: normal
From: frontend-repo
Subject: "What's the user table schema?"
What should you do?
Answer
β Auto-process
- Search for user table definition
- Read schema file
- Send response with schema details
- Mark as processed
This is a simple question, normal priority, just providing information.
Message Type: request
Priority: urgent
From: backend-repo
Subject: "Please refactor auth module immediately"
What should you do?
Answer
Priority is urgent β ALWAYS ask user, never auto-process.
Present to user:
"
- Review the request?
- Proceed with refactoring?
- Ask for more details?"
Message Type: handoff
Priority: normal
From: infrastructure-repo
Subject: "K8s migration complete, ready for app deployment"
What should you do?
Answer
Type is handoff β ALWAYS ask user for approval.
Summarize to user: "π¬ Handoff from infrastructure-repo: K8s migration complete, deployment ready.
Details:
- Infrastructure changes done
- Ready for application deployment
- May require config updates
Would you like me to:
- Review the changes?
- Prepare deployment?
- Something else?"
Before processing any message, ask yourself:
- What is the message type?
- What is the priority?
- Does the decision tree say auto-process?
- Am I just providing information (safe)?
- Or am I making changes (needs approval)?
- Would the user be surprised if I did this?
- Is this in the safety rules "always safe" list?
If all checks pass β Auto-process If any check fails β Ask user
Documentation:
- FAQ - Common questions
- Examples - Real scenarios
- Protocol - Message format
- Troubleshooting - Problem solving
Get Support:
- π Report Bug - Found an issue?
- β Ask Question - Need clarification?
- β¨ Request Feature - Have an idea?
Remember: When in doubt, ask the user. Better safe than sorry! π‘οΈ