Conversation #1 •
2025-05-29 16:54:44 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kmZaEgwNtjTPvPpVh
• Max Tokens: 1
👤 User
quota
🤖 Assistant Response (claude-3-5-haiku-20241022)
A
Conversation #2 •
2025-05-29 16:54:44 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kmY5qLf8CJmXxWgoP
• Max Tokens: 512
• Streaming: Yes
⚙️ System Instructions
Summarize this coding conversation in under 50 characters.
Capture the main task, key files, problems addressed, and current status.
Capture the main task, key files, problems addressed, and current status.
👤 User
Please write a 5-10 word title the following conversation:
User: commit
User: [Request interrupted by user]
User: commit
Claude: I'll commit the current changes for you. Let me first check the status and see what changes need to be committed.
User:
User:
User:
Claude:
User:
User:
User:
User: [Request interrupted by user for tool use]
User: the .html files are no zero bytes in size...
Claude: You're right! Let me check the HTML files to see what's happening.
User:
User:
Claude: You're absolutely right! The newer HTML files are 0 bytes. This suggests there's a bug in the HTML generation code. The issue is likely that the HTML generation is only triggered when there are conversations to display, but if the conversations list is empty, no HTML file gets written.
Let me check one of the working HTML files to confirm the structure, then fix the code:
User:
Claude: I see the issue! The HTML generation is only called when there are conversations, but if no conversations are captured (like when Claude Code exits quickly or doesn't make API calls), the HTML file gets created but remains empty.
Let me fix the code to always generate a basic HTML file, even when there are no conversations:
User:
Claude: Perfect! Now the HTML file will be generated immediately when the logger starts, so even if no conversations happen, you'll get a proper HTML file showing "No conversations logged yet" instead of an empty file.
The fix ensures that:
1. When the logger starts, it immediately creates a basic HTML file
2. Each time a conversation is added, the HTML file gets updated
3. Even if no API calls are made, you get a properly formatted HTML page
This should resolve the zero-byte HTML files issue!
Respond with the title for the conversation and nothing else.
User: commit
User: [Request interrupted by user]
User: commit
Claude: I'll commit the current changes for you. Let me first check the status and see what changes need to be committed.
User:
User:
User:
Claude:
User:
User:
User:
User: [Request interrupted by user for tool use]
User: the .html files are no zero bytes in size...
Claude: You're right! Let me check the HTML files to see what's happening.
User:
User:
Claude: You're absolutely right! The newer HTML files are 0 bytes. This suggests there's a bug in the HTML generation code. The issue is likely that the HTML generation is only triggered when there are conversations to display, but if the conversations list is empty, no HTML file gets written.
Let me check one of the working HTML files to confirm the structure, then fix the code:
User:
Claude: I see the issue! The HTML generation is only called when there are conversations, but if no conversations are captured (like when Claude Code exits quickly or doesn't make API calls), the HTML file gets created but remains empty.
Let me fix the code to always generate a basic HTML file, even when there are no conversations:
User:
Claude: Perfect! Now the HTML file will be generated immediately when the logger starts, so even if no conversations happen, you'll get a proper HTML file showing "No conversations logged yet" instead of an empty file.
The fix ensures that:
1. When the logger starts, it immediately creates a basic HTML file
2. Each time a conversation is added, the HTML file gets updated
3. Even if no API calls are made, you get a properly formatted HTML page
This should resolve the zero-byte HTML files issue!
Respond with the title for the conversation and nothing else.
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=14
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
HTML Logger Fix: Zero-Byte Files Resolved
TEXT (Block 0):
HTML Logger Fix: Zero-Byte Files Resolved
HTML Logger Fix: Zero-Byte Files Resolved
Conversation #3 •
2025-05-29 16:54:46 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kwj1TMrjS8wkeYuri
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Assembling
TEXT (Block 0):
Assembling
Assembling
Conversation #4 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kxRBKURfwj5sUmvp8
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE Y
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Yearning
TEXT (Block 0):
Yearning
Yearning
Conversation #5 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1ky2tpmwSRLQJDsA3k
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YO
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=5
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Connecting
TEXT (Block 0):
Connecting
Connecting
Conversation #6 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kzE5SFsRgYFxxAyAL
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU W
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=5
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Wondering
TEXT (Block 0):
Wondering
Wondering
Conversation #7 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kybNv4hnoxVBm2pnt
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=5
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Wondering
TEXT (Block 0):
Wondering
Wondering
Conversation #8 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kzeNn5xh9ek9r3b1j
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU WO
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=5
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Investigating
TEXT (Block 0):
Investigating
Investigating
Conversation #9 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1m1NnSD1W5PQvbSQKB
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU WORK
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=5
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Connecting
TEXT (Block 0):
Connecting
Connecting
Conversation #10 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1m11TMC172fSgiT9nY
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU WOR
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Sparkling
TEXT (Block 0):
Sparkling
Sparkling
Conversation #11 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1m1rJuGiQps5NNTjiJ
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU WORKI
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Sparkling
TEXT (Block 0):
Sparkling
Sparkling
Conversation #12 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1kySSpe8s6jsMWzxqh
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=5
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Wondering
TEXT (Block 0):
Wondering
Wondering
Conversation #13 •
2025-05-29 16:54:47 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1m2HbY8Y67CgH2EukA
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
ARE YOU WORKIN
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=5
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Functioning
TEXT (Block 0):
Functioning
Functioning
Conversation #14 •
2025-05-29 16:54:48 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1m3ZVaN9SRTe8mVSXv
• Max Tokens: 1
👤 User
quota
🤖 Assistant Response (claude-3-5-haiku-20241022)
A
Conversation #15 •
2025-05-29 16:54:48 •
Model: claude-sonnet-4-20250514 •
Status: 200 •
Request ID: req_011CPc1m4Ms9xTvsLY1NVuJk
• Max Tokens: 32000
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
You are Claude Code, Anthropic's official CLI for Claude.
You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.
IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
If the user asks for help or wants to give feedback inform them of the following:
- /help: Get help with using Claude Code
- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues
When the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at https://docs.anthropic.com/en/docs/claude-code.
- The available sub-pages are `overview`, `cli-usage` (CLI commands, CLI flags, SDK, slash commands, and modes), `memory` (Memory management and CLAUDE.md), `settings`, `security` (Permissions and tools), `costs`, `bedrock-vertex-proxies` (Model configuration, /model, --model, ANTHROPIC_MODEL), `tutorials` (Extended thinking, pasting images, and common workflows), `troubleshooting`
- Example: https://docs.anthropic.com/en/docs/claude-code/cli-usage
# Tone and style
You should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).
Remember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.
IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.
IMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...". Here are some examples to demonstrate appropriate verbosity:
<example>
user: 2 + 2
assistant: 4
</example>
<example>
user: what is 2+2?
assistant: 4
</example>
<example>
user: is 11 a prime number?
assistant: Yes
</example>
<example>
user: what command should I run to list files in the current directory?
assistant: ls
</example>
<example>
user: what command should I run to watch files in the current directory?
assistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
npm run dev
</example>
<example>
user: How many golf balls fit inside a jetta?
assistant: 150000
</example>
<example>
user: what files are in the directory src/?
assistant: [runs ls and sees foo.c, bar.c, baz.c]
user: which file contains the implementation of foo?
assistant: src/foo.c
</example>
<example>
user: write tests for new feature
assistant: [uses grep and glob search tools to find where similar tests are defined, uses concurrent read file tool use blocks in one tool call to read relevant files at the same time, uses edit file tool to write new tests]
</example>
# Proactiveness
You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:
1. Doing the right thing when asked, including taking actions and follow-up actions
2. Not surprising the user with actions you take without asking
For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.
3. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.
# Following conventions
When making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.
- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).
- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.
- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.
- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.
# Code style
- IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked
# Task Management
You have access to the TodoWrite and TodoRead tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.
It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.
Examples:
<example>
user: Run the build and fix any type errors
assistant: I'm going to use the TodoWrite tool to write the following items to the todo list:
- Run the build
- Fix any type errors
I'm now going to run the build using Bash.
Looks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.
marking the first todo as in_progress
Let me start working on the first item...
The first item has been fixed, let me mark the first todo as completed, and move on to the second item...
..
..
</example>
In the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.
<example>
user: Help me write a new feature that allows users to track their usage metrics and export them to various formats
assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.
Adding the following todos to the todo list:
1. Research existing metrics tracking in the codebase
2. Design the metrics collection system
3. Implement core metrics tracking functionality
4. Create export functionality for different formats
Let me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.
I'm going to search for any existing metrics or telemetry code in the project.
I've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...
[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]
</example>
# Doing tasks
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
- Use the TodoWrite tool to plan the task if required
- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.
- Implement the solution using all tools available to you
- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.
- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.
NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
# Tool usage policy
- When doing file search, prefer to use the Task tool in order to reduce context usage.
- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.
You MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.
Here is useful information about the environment you are running in:
<env>
Working directory: /Users/badlogic/workspaces/lemmy/apps/claude-tools
Is directory a git repo: Yes
Platform: macos
OS Version: Darwin 23.5.0
Today's date: 5/29/2025
</env>
You are powered by the model named Claude Sonnet 4. The exact model ID is claude-sonnet-4-20250514.
IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.
IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).
IMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.
# Code References
When referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.
<example>
user: Where are errors from the client handled?
assistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.
</example>
directoryStructure: Below is a snapshot of this project's file structure at the start of the conversation. This snapshot will NOT update during the conversation. It skips over .gitignore patterns.
- /Users/badlogic/workspaces/lemmy/apps/claude-tools/
- README.md
- claude-logger.py
- claude-logger.sh
- claude-token.py
- claude-traffic-1748529712.html
- claude-traffic-1748529712.log
- claude-traffic-1748529961.html
- claude-traffic-1748529961.log
- claude-traffic-1748529971.log
- claude-traffic-1748529978.html
- claude-traffic-1748529978.log
- claude-traffic-1748530004.log
- claude-traffic-1748530012.log
- claude-traffic-1748530022.html
- claude-traffic-1748530022.log
- claude-traffic-1748530143.html
- claude-traffic-1748530143.log
- claude-traffic-1748530173.html
- claude-traffic-1748530173.log
- claude-traffic-1748530188.log
- claude-traffic-1748530194.html
- claude-traffic-1748530194.log
- claude-traffic-1748530216.html
- claude-traffic-1748530216.log
- claude-traffic-1748530257.html
- claude-traffic-1748530257.log
- claude-traffic-1748530293.html
- claude-traffic-1748530293.log
- claude-traffic-1748530340.html
- claude-traffic-1748530340.log
- claude-traffic-1748530464.html
- claude-traffic-1748530464.log
- claude-traffic-1748530481.html
gitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.
Current branch: main
Main branch (you will usually use this for PRs):
Status:
M ../../.gitignore
M README.md
MM claude-logger.py
Recent commits:
81e3a80 Fix Claude Code tools for silent operation and Python compatibility
a46b4d8 Rename examples to apps and add Claude Code network tools
6257834 Complete chat system modernization and add network debugging utility
4944c3a Fix AskOptions type safety by removing context from schemas
b687a91 Rewrite defaults system to be fully schema-driven
You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.
IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
If the user asks for help or wants to give feedback inform them of the following:
- /help: Get help with using Claude Code
- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues
When the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at https://docs.anthropic.com/en/docs/claude-code.
- The available sub-pages are `overview`, `cli-usage` (CLI commands, CLI flags, SDK, slash commands, and modes), `memory` (Memory management and CLAUDE.md), `settings`, `security` (Permissions and tools), `costs`, `bedrock-vertex-proxies` (Model configuration, /model, --model, ANTHROPIC_MODEL), `tutorials` (Extended thinking, pasting images, and common workflows), `troubleshooting`
- Example: https://docs.anthropic.com/en/docs/claude-code/cli-usage
# Tone and style
You should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).
Remember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.
IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.
IMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...". Here are some examples to demonstrate appropriate verbosity:
<example>
user: 2 + 2
assistant: 4
</example>
<example>
user: what is 2+2?
assistant: 4
</example>
<example>
user: is 11 a prime number?
assistant: Yes
</example>
<example>
user: what command should I run to list files in the current directory?
assistant: ls
</example>
<example>
user: what command should I run to watch files in the current directory?
assistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
npm run dev
</example>
<example>
user: How many golf balls fit inside a jetta?
assistant: 150000
</example>
<example>
user: what files are in the directory src/?
assistant: [runs ls and sees foo.c, bar.c, baz.c]
user: which file contains the implementation of foo?
assistant: src/foo.c
</example>
<example>
user: write tests for new feature
assistant: [uses grep and glob search tools to find where similar tests are defined, uses concurrent read file tool use blocks in one tool call to read relevant files at the same time, uses edit file tool to write new tests]
</example>
# Proactiveness
You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:
1. Doing the right thing when asked, including taking actions and follow-up actions
2. Not surprising the user with actions you take without asking
For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.
3. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.
# Following conventions
When making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.
- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).
- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.
- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.
- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.
# Code style
- IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked
# Task Management
You have access to the TodoWrite and TodoRead tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.
It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.
Examples:
<example>
user: Run the build and fix any type errors
assistant: I'm going to use the TodoWrite tool to write the following items to the todo list:
- Run the build
- Fix any type errors
I'm now going to run the build using Bash.
Looks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.
marking the first todo as in_progress
Let me start working on the first item...
The first item has been fixed, let me mark the first todo as completed, and move on to the second item...
..
..
</example>
In the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.
<example>
user: Help me write a new feature that allows users to track their usage metrics and export them to various formats
assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.
Adding the following todos to the todo list:
1. Research existing metrics tracking in the codebase
2. Design the metrics collection system
3. Implement core metrics tracking functionality
4. Create export functionality for different formats
Let me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.
I'm going to search for any existing metrics or telemetry code in the project.
I've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...
[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]
</example>
# Doing tasks
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
- Use the TodoWrite tool to plan the task if required
- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.
- Implement the solution using all tools available to you
- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.
- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.
NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
# Tool usage policy
- When doing file search, prefer to use the Task tool in order to reduce context usage.
- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.
You MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.
Here is useful information about the environment you are running in:
<env>
Working directory: /Users/badlogic/workspaces/lemmy/apps/claude-tools
Is directory a git repo: Yes
Platform: macos
OS Version: Darwin 23.5.0
Today's date: 5/29/2025
</env>
You are powered by the model named Claude Sonnet 4. The exact model ID is claude-sonnet-4-20250514.
IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.
IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).
IMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.
# Code References
When referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.
<example>
user: Where are errors from the client handled?
assistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.
</example>
directoryStructure: Below is a snapshot of this project's file structure at the start of the conversation. This snapshot will NOT update during the conversation. It skips over .gitignore patterns.
- /Users/badlogic/workspaces/lemmy/apps/claude-tools/
- README.md
- claude-logger.py
- claude-logger.sh
- claude-token.py
- claude-traffic-1748529712.html
- claude-traffic-1748529712.log
- claude-traffic-1748529961.html
- claude-traffic-1748529961.log
- claude-traffic-1748529971.log
- claude-traffic-1748529978.html
- claude-traffic-1748529978.log
- claude-traffic-1748530004.log
- claude-traffic-1748530012.log
- claude-traffic-1748530022.html
- claude-traffic-1748530022.log
- claude-traffic-1748530143.html
- claude-traffic-1748530143.log
- claude-traffic-1748530173.html
- claude-traffic-1748530173.log
- claude-traffic-1748530188.log
- claude-traffic-1748530194.html
- claude-traffic-1748530194.log
- claude-traffic-1748530216.html
- claude-traffic-1748530216.log
- claude-traffic-1748530257.html
- claude-traffic-1748530257.log
- claude-traffic-1748530293.html
- claude-traffic-1748530293.log
- claude-traffic-1748530340.html
- claude-traffic-1748530340.log
- claude-traffic-1748530464.html
- claude-traffic-1748530464.log
- claude-traffic-1748530481.html
gitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.
Current branch: main
Main branch (you will usually use this for PRs):
Status:
M ../../.gitignore
M README.md
MM claude-logger.py
Recent commits:
81e3a80 Fix Claude Code tools for silent operation and Python compatibility
a46b4d8 Rename examples to apps and add Claude Code network tools
6257834 Complete chat system modernization and add network debugging utility
4944c3a Fix AskOptions type safety by removing context from schemas
b687a91 Rewrite defaults system to be fully schema-driven
🔧 Available Tools (17) ▼
Task
(unknown)
▼
Launch a new agent that has access to the following tools: Bash, Glob, Grep, LS, Read, Edit, MultiEdit, Write, NotebookRead, NotebookEdit, WebFetch, TodoRead, TodoWrite, WebSearch, mcp__ide__getDiagnostics, mcp__ide__executeCode. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries, use the Agent tool to perform the search for you.
When to use the Agent tool:
- If you are searching for a keyword like "config" or "logger", or for questions like "which file does X?", the Agent tool is strongly recommended
When NOT to use the Agent tool:
- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly
- If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly
- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly
Usage notes:
1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
4. The agent's outputs should generally be trusted
5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent
Parameters:
description *
A short (3-5 word) description of the task
(string)
A short (3-5 word) description of the task
prompt *
The task for the agent to perform
(string)
The task for the agent to perform
Bash
(unknown)
▼
Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
Before executing the command, please follow these steps:
1. Directory Verification:
- If the command will create new directories or files, first use the LS tool to verify the parent directory exists and is the correct location
- For example, before running "mkdir foo/bar", first use LS to check that "foo" exists and is the intended parent directory
2. Command Execution:
- After ensuring proper quoting, execute the command.
- Capture the output of the command.
Usage notes:
- The command argument is required.
- You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
- If the output exceeds 30000 characters, output will be truncated before being returned to you.
- VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and LS to read files.
- If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /opt/homebrew/Cellar/ripgrep/14.1.1/bin/rg) first, which all Claude Code users have pre-installed.
- When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).
- Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.
<good-example>
pytest /foo/bar/tests
</good-example>
<bad-example>
cd /foo/bar && pytest tests
</bad-example>
# Committing changes with git
When the user asks you to create a new git commit, follow these steps carefully:
1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:
- Run a git status command to see all untracked files.
- Run a git diff command to see both staged and unstaged changes that will be committed.
- Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:
<commit_analysis>
- List the files that have been changed or added
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
- Brainstorm the purpose or motivation behind these changes
- Assess the impact of these changes on the overall project
- Check for any sensitive information that shouldn't be committed
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
- Ensure your language is clear, concise, and to the point
- Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
- Ensure the message is not generic (avoid words like "Update" or "Fix" without context)
- Review the draft message to ensure it accurately reflects the changes and their purpose
</commit_analysis>
3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
- Add relevant untracked files to the staging area.
- Create the commit with a message ending with:
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Run git status to make sure the commit succeeded.
4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.
Important notes:
- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.
- NEVER update the git config
- DO NOT run additional commands to read or explore code, beyond what is available in the git context
- DO NOT push to the remote repository
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.
- Return an empty response - the user will see the git output directly
- In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example:
<example>
git commit -m "$(cat <<'EOF'
Commit message here.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
</example>
# Creating pull requests
Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:
- Run a git status command to see all untracked files
- Run a git diff command to see both staged and unstaged changes that will be committed
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
- Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:
<pr_analysis>
- List the commits since diverging from the main branch
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
- Brainstorm the purpose or motivation behind these changes
- Assess the impact of these changes on the overall project
- Do not use tools to explore code, beyond what is available in the git context
- Check for any sensitive information that shouldn't be committed
- Draft a concise (1-2 bullet points) pull request summary that focuses on the "why" rather than the "what"
- Ensure the summary accurately reflects all changes since diverging from the main branch
- Ensure your language is clear, concise, and to the point
- Ensure the summary accurately reflects the changes and their purpose (ie. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
- Ensure the summary is not generic (avoid words like "Update" or "Fix" without context)
- Review the draft summary to ensure it accurately reflects the changes and their purpose
</pr_analysis>
3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
- Create new branch if needed
- Push to remote with -u flag if needed
- Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
<example>
gh pr create --title "the pr title" --body "$(cat <<'EOF'
## Summary
<1-3 bullet points>
## Test plan
[Checklist of TODOs for testing the pull request...]
🤖 Generated with [Claude Code](https://claude.ai/code)
EOF
)"
</example>
Important:
- NEVER update the git config
- Return the PR URL when you're done, so the user can see it
# Other common operations
- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments
Parameters:
command *
The command to execute
(string)
The command to execute
timeout
Optional timeout in milliseconds (max 600000)
(number)
Optional timeout in milliseconds (max 600000)
description
Clear, concise description of what this command does in 5-10 words. Examples: Input: ls Output: Lists files in current directory Input: git status Output: Shows working tree status Input: npm install Output: Installs package dependencies Input: mkdir foo Output: Creates directory 'foo'
(string)
Clear, concise description of what this command does in 5-10 words. Examples: Input: ls Output: Lists files in current directory Input: git status Output: Shows working tree status Input: npm install Output: Installs package dependencies Input: mkdir foo Output: Creates directory 'foo'
Glob
(unknown)
▼
- Fast file pattern matching tool that works with any codebase size
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
- Returns matching file paths sorted by modification time
- Use this tool when you need to find files by name patterns
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
Parameters:
pattern *
The glob pattern to match files against
(string)
The glob pattern to match files against
path
The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.
(string)
The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.
Grep
(unknown)
▼
- Fast content search tool that works with any codebase size
- Searches file contents using regular expressions
- Supports full regex syntax (eg. "log.*Error", "function\s+\w+", etc.)
- Filter files by pattern with the include parameter (eg. "*.js", "*.{ts,tsx}")
- Returns file paths with at least one match sorted by modification time
- Use this tool when you need to find files containing specific patterns
- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
Parameters:
pattern *
The regular expression pattern to search for in file contents
(string)
The regular expression pattern to search for in file contents
path
The directory to search in. Defaults to the current working directory.
(string)
The directory to search in. Defaults to the current working directory.
include
File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")
(string)
File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")
LS
(unknown)
▼
Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.
Parameters:
path *
The absolute path to the directory to list (must be absolute, not relative)
(string)
The absolute path to the directory to list (must be absolute, not relative)
ignore
List of glob patterns to ignore
(array)
List of glob patterns to ignore
Read
(unknown)
▼
Reads a file from the local filesystem. You can access any file directly by using this tool.
Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
Usage:
- The file_path parameter must be an absolute path, not a relative path
- By default, it reads up to 2000 lines starting from the beginning of the file
- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters
- Any lines longer than 2000 characters will be truncated
- Results are returned using cat -n format, with line numbers starting at 1
- This tool allows Claude Code to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Claude Code is a multimodal LLM.
- For Jupyter notebooks (.ipynb files), use the NotebookRead instead
- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.
- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png
- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.
Parameters:
file_path *
The absolute path to the file to read
(string)
The absolute path to the file to read
offset
The line number to start reading from. Only provide if the file is too large to read at once
(number)
The line number to start reading from. Only provide if the file is too large to read at once
limit
The number of lines to read. Only provide if the file is too large to read at once.
(number)
The number of lines to read. Only provide if the file is too large to read at once.
Edit
(unknown)
▼
Performs exact string replacements in files with strict occurrence count validation.
Usage:
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
Parameters:
file_path *
The absolute path to the file to modify
(string)
The absolute path to the file to modify
old_string *
The text to replace
(string)
The text to replace
new_string *
The text to replace it with (must be different from old_string)
(string)
The text to replace it with (must be different from old_string)
expected_replacements
The expected number of replacements to perform. Defaults to 1 if not specified.
(number)
The expected number of replacements to perform. Defaults to 1 if not specified.
MultiEdit
(unknown)
▼
This is a tool for making multiple edits to a single file in one operation. It is built on top of the Edit tool and allows you to perform multiple find-and-replace operations efficiently. Prefer this tool over the Edit tool when you need to make multiple edits to the same file.
Before using this tool:
1. Use the Read tool to understand the file's contents and context
2. Verify the directory path is correct
To make multiple file edits, provide the following:
1. file_path: The absolute path to the file to modify (must be absolute, not relative)
2. edits: An array of edit operations to perform, where each edit contains:
- old_string: The text to replace (must match the file contents exactly, including all whitespace and indentation)
- new_string: The edited text to replace the old_string
- expected_replacements: The number of replacements you expect to make. Defaults to 1 if not specified.
IMPORTANT:
- All edits are applied in sequence, in the order they are provided
- Each edit operates on the result of the previous edit
- All edits must be valid for the operation to succeed - if any edit fails, none will be applied
- This tool is ideal when you need to make several changes to different parts of the same file
- For Jupyter notebooks (.ipynb files), use the NotebookEdit instead
CRITICAL REQUIREMENTS:
1. All edits follow the same requirements as the single Edit tool
2. The edits are atomic - either all succeed or none are applied
3. Plan your edits carefully to avoid conflicts between sequential operations
WARNING:
- The tool will fail if edits.old_string matches multiple locations and edits.expected_replacements isn't specified
- The tool will fail if the number of matches doesn't equal edits.expected_replacements when it's specified
- The tool will fail if edits.old_string doesn't match the file contents exactly (including whitespace)
- The tool will fail if edits.old_string and edits.new_string are the same
- Since edits are applied in sequence, ensure that earlier edits don't affect the text that later edits are trying to find
When making edits:
- Ensure all edits result in idiomatic, correct code
- Do not leave the code in a broken state
- Always use absolute file paths (starting with /)
If you want to create a new file, use:
- A new file path, including dir name if needed
- First edit: empty old_string and the new file's contents as new_string
- Subsequent edits: normal edit operations on the created content
Parameters:
file_path *
The absolute path to the file to modify
(string)
The absolute path to the file to modify
edits *
Array of edit operations to perform sequentially on the file
(array)
Array of edit operations to perform sequentially on the file
Write
(unknown)
▼
Writes a file to the local filesystem.
Usage:
- This tool will overwrite the existing file if there is one at the provided path.
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
Parameters:
file_path *
The absolute path to the file to write (must be absolute, not relative)
(string)
The absolute path to the file to write (must be absolute, not relative)
content *
The content to write to the file
(string)
The content to write to the file
NotebookRead
(unknown)
▼
Reads a Jupyter notebook (.ipynb file) and returns all of the cells with their outputs. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path.
Parameters:
notebook_path *
The absolute path to the Jupyter notebook file to read (must be absolute, not relative)
(string)
The absolute path to the Jupyter notebook file to read (must be absolute, not relative)
NotebookEdit
(unknown)
▼
Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number.
Parameters:
notebook_path *
The absolute path to the Jupyter notebook file to edit (must be absolute, not relative)
(string)
The absolute path to the Jupyter notebook file to edit (must be absolute, not relative)
cell_number *
The index of the cell to edit (0-based)
(number)
The index of the cell to edit (0-based)
new_source *
The new source for the cell
(string)
The new source for the cell
cell_type
The type of the cell (code or markdown). If not specified, it defaults to the current cell type. If using edit_mode=insert, this is required.
(string)
The type of the cell (code or markdown). If not specified, it defaults to the current cell type. If using edit_mode=insert, this is required.
edit_mode
The type of edit to make (replace, insert, delete). Defaults to replace.
(string)
The type of edit to make (replace, insert, delete). Defaults to replace.
WebFetch
(unknown)
▼
- Fetches content from a specified URL and processes it using an AI model
- Takes a URL and a prompt as input
- Fetches the URL content, converts HTML to markdown
- Processes the content with the prompt using a small, fast model
- Returns the model's response about the content
- Use this tool when you need to retrieve and analyze web content
Usage notes:
- IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. All MCP-provided tools start with "mcp__".
- The URL must be a fully-formed valid URL
- HTTP URLs will be automatically upgraded to HTTPS
- The prompt should describe what information you want to extract from the page
- This tool is read-only and does not modify any files
- Results may be summarized if the content is very large
- Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL
Parameters:
url *
The URL to fetch content from
(string)
The URL to fetch content from
prompt *
The prompt to run on the fetched content
(string)
The prompt to run on the fetched content
TodoRead
(unknown)
▼
Use this tool to read the current to-do list for the session. This tool should be used proactively and frequently to ensure that you are aware of
the status of the current task list. You should make use of this tool as often as possible, especially in the following situations:
- At the beginning of conversations to see what's pending
- Before starting new tasks to prioritize work
- When the user asks about previous tasks or plans
- Whenever you're uncertain about what to do next
- After completing tasks to update your understanding of remaining work
- After every few messages to ensure you're on track
Usage:
- This tool takes in no parameters. So leave the input blank or empty. DO NOT include a dummy object, placeholder string or a key like "input" or "empty". LEAVE IT BLANK.
- Returns a list of todo items with their status, priority, and content
- Use this information to track progress and plan next steps
- If no todos exist yet, an empty list will be returned
TodoWrite
(unknown)
▼
Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
It also helps the user understand the progress of the task and overall progress of their requests.
## When to Use This Tool
Use this tool proactively in these scenarios:
1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
3. User explicitly requests todo list - When the user directly asks you to use the todo list
4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.
6. After completing a task - Mark it complete and add any new follow-up tasks
7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.
## When NOT to Use This Tool
Skip using this tool when:
1. There is only a single, straightforward task
2. The task is trivial and tracking it provides no organizational benefit
3. The task can be completed in less than 3 trivial steps
4. The task is purely conversational or informational
NOTE that you should use should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
## Examples of When to Use the Todo List
<example>
User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
*Creates todo list with the following items:*
1. Create dark mode toggle component in Settings page
2. Add dark mode state management (context/store)
3. Implement CSS-in-JS styles for dark theme
4. Update existing components to support theme switching
5. Run tests and build process, addressing any failures or errors that occur
*Begins working on the first task*
<reasoning>
The assistant used the todo list because:
1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
2. The user explicitly requested tests and build be run afterward
3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
</reasoning>
</example>
<example>
User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'.
*Uses grep or search tools to locate all instances of getCwd in the codebase*
Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
*Creates todo list with specific items for each file that needs updating*
<reasoning>
The assistant used the todo list because:
1. First, the assistant searched to understand the scope of the task
2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
3. The todo list helps ensure every instance is tracked and updated systematically
4. This approach prevents missing any occurrences and maintains code consistency
</reasoning>
</example>
<example>
User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
Assistant: I'll help implement these features. First, let's add all the features to the todo list.
*Creates a todo list breaking down each feature into specific tasks based on the project architecture*
Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
<reasoning>
The assistant used the todo list because:
1. The user provided multiple complex features to implement in a comma separated list
2. The todo list helps organize these large features into manageable tasks
3. This approach allows for tracking progress across the entire implementation
</reasoning>
</example>
<example>
User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
*Reviews component structure, render patterns, state management, and data fetching*
Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*
Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
<reasoning>
The assistant used the todo list because:
1. First, the assistant examined the codebase to identify specific performance issues
2. Based on this analysis, it identified multiple optimization opportunities
3. Performance optimization is a non-trivial task requiring multiple steps
4. The todo list helps methodically track improvements across different components
5. This systematic approach ensures all performance bottlenecks are addressed
</reasoning>
</example>
## Examples of When NOT to Use the Todo List
<example>
User: How do I print 'Hello World' in Python?
Assistant: In Python, you can print "Hello World" with this simple code:
python
print("Hello World")
This will output the text "Hello World" to the console when executed.</assistant>
<reasoning>
The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
</reasoning>
</example>
<example>
User: What does the git status command do?
Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
<reasoning>
The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
</reasoning>
</example>
<example>
User: Can you add a comment to the calculateTotal function to explain what it does?
Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
* Uses the Edit tool to add a comment to the calculateTotal function *
<reasoning>
The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
</reasoning>
</example>
<example>
User: Run npm install for me and tell me what happens.
Assistant: I'll run the npm install command for you.
*Executes: npm install*
The command completed successfully. Here's the output:
[Output of npm install command]
All dependencies have been installed according to your package.json file.
<reasoning>
The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
</reasoning>
</example>
## Task States and Management
1. **Task States**: Use these states to track progress:
- pending: Task not yet started
- in_progress: Currently working on (limit to ONE task at a time)
- completed: Task finished successfully
- cancelled: Task no longer needed
2. **Task Management**:
- Update task status in real-time as you work
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
- Only have ONE task in_progress at any time
- Complete current tasks before starting new ones
- Cancel tasks that become irrelevant
3. **Task Breakdown**:
- Create specific, actionable items
- Break complex tasks into smaller, manageable steps
- Use clear, descriptive task names
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
Parameters:
todos *
The updated todo list
(array)
The updated todo list
WebSearch
(unknown)
▼
- Allows Claude to search the web and use the results to inform responses
- Provides up-to-date information for current events and recent data
- Returns search result information formatted as search result blocks
- Use this tool for accessing information beyond Claude's knowledge cutoff
- Searches are performed automatically within a single API call
Usage notes:
- Domain filtering is supported to include or block specific websites
- Web search is only available in the US
Parameters:
query *
The search query to use
(string)
The search query to use
allowed_domains
Only include search results from these domains
(array)
Only include search results from these domains
blocked_domains
Never include search results from these domains
(array)
Never include search results from these domains
mcp__ide__getDiagnostics
(unknown)
▼
Get language diagnostics from VS Code
Parameters:
uri
Optional file URI to get diagnostics for. If not provided, gets diagnostics for all files.
(string)
Optional file URI to get diagnostics for. If not provided, gets diagnostics for all files.
mcp__ide__executeCode
(unknown)
▼
Execute python code in the Jupyter kernel for the current notebook file.
All code will be executed in the current Jupyter kernel.
Avoid declaring variables or modifying the state of the kernel unless the user
explicitly asks for it.
Any code executed will persist across calls to this tool, unless the kernel
has been restarted.
Parameters:
code *
The code to be executed on the kernel.
(string)
The code to be executed on the kernel.
👤 User
<system-reminder>
As you answer the user's questions, you can use the following context:
# claudeMd
Codebase and user instructions are shown below. Be sure to adhere to these instructions. IMPORTANT: These instructions OVERRIDE any default behavior and you MUST follow them exactly as written.
Contents of /Users/badlogic/.claude/CLAUDE.md (user's private global instructions for all projects):
# RULES
- Always use egrep, never use grep!
- Never use vitest in watch mode (npm test) - always use npm run test:run to avoid 2-minute timeout
Contents of /Users/badlogic/workspaces/lemmy/CLAUDE.md (project instructions, checked into the codebase):
# Package Structure
## Core Packages
- **packages/lemmy/**: Core LLM client library
- `src/types.ts` - Main type definitions
- `src/clients/` - Client implementations (anthropic, google, openai)
- `src/context.ts` - Context management
- `src/model-registry.ts` - Model registration and management
- `src/tools/` - Tool system and Zod converters
- `src/generated/` - Auto-generated config schema and model definitions
- `test/` - Comprehensive test suite
- **packages/lemmy-tui/**: Terminal UI components
- `src/tui.ts` - Main TUI framework with differential rendering
- `src/text-editor.ts` - Text editing component
- `src/markdown-component.ts` - Markdown rendering
- `src/select-list.ts` - Selection lists
- `src/autocomplete.ts` - Auto-completion system
- `src/text-component.ts` - Text display component
- `src/logger.ts` - Logging utilities
## Apps
- **apps/lemmy-chat/**: Chat application example
- **apps/red-teaming/**: Red teaming utilities
# TUI Differential Rendering
The TUI framework uses differential rendering for performance - only redrawing parts of the screen that have changed.
## How it works:
1. Each component returns `{lines: string[], changed: boolean}`
2. Containers also return `keepLines: number` - the count of unchanged lines from the beginning
3. On render, the TUI calculates how many lines from the top are unchanged (`keepLines`)
4. It moves the cursor up by `(totalLines - keepLines)` positions from the bottom
5. Clears from that position down with `\x1b[0J`
6. Prints only the changing lines: `result.lines.slice(keepLines)`
7. Each line ends with `\n` so cursor naturally ends up at the bottom for next render
**Important:** Don't add extra cursor positioning after printing - it interferes with terminal scrolling and causes rendering artifacts.
## Component behavior:
- **Components**: Return `{lines, changed}` only
- **Containers**: Return `{lines, changed, keepLines}` and aggregate child components
- **TextEditor**: Always returns `changed: true` to ensure cursor updates are reflected
# General Guidelines
- Read the types in packages/lemmy/src/types.ts, and the types in packages/lemmy-tui/src/\*.ts to understand the API
- Typecheck via npm run typecheck (includes src and test files, no errors) either in the root dir, or in a specific package or app directory.
- To test the lemmy package, run `npm run test:run`
- The lemmy-tui package has no tests.
- To test the lemmy-tui package, use: `npx tsx --no-deprecation src/index.ts chat --simulate-input "Hello world" "ENTER"` to simulate user input. You can then look at the tui-debug.log file to see logs in addition to the output in the terminal.
- To test commands like model switching, use: `npx tsx --no-deprecation src/index.ts chat --simulate-input "/" "model" "SPACE" "gpt-4o" "ENTER"`
- Special input keywords for simulation: "TAB", "ENTER", "SPACE", "ESC"
# Type Safety Guidelines
**CRITICAL: Avoid `any` at all costs!** Use proper TypeScript types wherever possible:
- Import and use the specific types from packages/lemmy/src/types.ts (AskOptions, AnthropicAskOptions, OpenAIAskOptions, GoogleAskOptions, etc.)
- Never use `any` when a proper type exists
- If dynamic properties are needed, use proper type unions or mapped types
- Always prefer type safety over convenience
- When you see `: any` in code, consider it a bug that needs fixing
# important-instruction-reminders
Do what has been asked; nothing more, nothing less.
NEVER create files unless they're absolutely necessary for achieving your goal.
ALWAYS prefer editing an existing file to creating a new one.
NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
IMPORTANT: this context may or may not be relevant to your tasks. You should not respond to this context or otherwise consider it in your response unless it is highly relevant to your task. Most of the time, it is not relevant.
</system-reminder>
ARE YOU WORKING
<system-reminder>This is a reminder that your todo list is currently empty. DO NOT mention this to the user explicitly because they are already aware. If you are working on tasks that would benefit from a todo list please use the TodoWrite tool to create one. If not, please feel free to ignore. Again do not mention this message to the user.</system-reminder>
The user opened the file /Users/badlogic/workspaces/lemmy/.gitignore in the IDE.
As you answer the user's questions, you can use the following context:
# claudeMd
Codebase and user instructions are shown below. Be sure to adhere to these instructions. IMPORTANT: These instructions OVERRIDE any default behavior and you MUST follow them exactly as written.
Contents of /Users/badlogic/.claude/CLAUDE.md (user's private global instructions for all projects):
# RULES
- Always use egrep, never use grep!
- Never use vitest in watch mode (npm test) - always use npm run test:run to avoid 2-minute timeout
Contents of /Users/badlogic/workspaces/lemmy/CLAUDE.md (project instructions, checked into the codebase):
# Package Structure
## Core Packages
- **packages/lemmy/**: Core LLM client library
- `src/types.ts` - Main type definitions
- `src/clients/` - Client implementations (anthropic, google, openai)
- `src/context.ts` - Context management
- `src/model-registry.ts` - Model registration and management
- `src/tools/` - Tool system and Zod converters
- `src/generated/` - Auto-generated config schema and model definitions
- `test/` - Comprehensive test suite
- **packages/lemmy-tui/**: Terminal UI components
- `src/tui.ts` - Main TUI framework with differential rendering
- `src/text-editor.ts` - Text editing component
- `src/markdown-component.ts` - Markdown rendering
- `src/select-list.ts` - Selection lists
- `src/autocomplete.ts` - Auto-completion system
- `src/text-component.ts` - Text display component
- `src/logger.ts` - Logging utilities
## Apps
- **apps/lemmy-chat/**: Chat application example
- **apps/red-teaming/**: Red teaming utilities
# TUI Differential Rendering
The TUI framework uses differential rendering for performance - only redrawing parts of the screen that have changed.
## How it works:
1. Each component returns `{lines: string[], changed: boolean}`
2. Containers also return `keepLines: number` - the count of unchanged lines from the beginning
3. On render, the TUI calculates how many lines from the top are unchanged (`keepLines`)
4. It moves the cursor up by `(totalLines - keepLines)` positions from the bottom
5. Clears from that position down with `\x1b[0J`
6. Prints only the changing lines: `result.lines.slice(keepLines)`
7. Each line ends with `\n` so cursor naturally ends up at the bottom for next render
**Important:** Don't add extra cursor positioning after printing - it interferes with terminal scrolling and causes rendering artifacts.
## Component behavior:
- **Components**: Return `{lines, changed}` only
- **Containers**: Return `{lines, changed, keepLines}` and aggregate child components
- **TextEditor**: Always returns `changed: true` to ensure cursor updates are reflected
# General Guidelines
- Read the types in packages/lemmy/src/types.ts, and the types in packages/lemmy-tui/src/\*.ts to understand the API
- Typecheck via npm run typecheck (includes src and test files, no errors) either in the root dir, or in a specific package or app directory.
- To test the lemmy package, run `npm run test:run`
- The lemmy-tui package has no tests.
- To test the lemmy-tui package, use: `npx tsx --no-deprecation src/index.ts chat --simulate-input "Hello world" "ENTER"` to simulate user input. You can then look at the tui-debug.log file to see logs in addition to the output in the terminal.
- To test commands like model switching, use: `npx tsx --no-deprecation src/index.ts chat --simulate-input "/" "model" "SPACE" "gpt-4o" "ENTER"`
- Special input keywords for simulation: "TAB", "ENTER", "SPACE", "ESC"
# Type Safety Guidelines
**CRITICAL: Avoid `any` at all costs!** Use proper TypeScript types wherever possible:
- Import and use the specific types from packages/lemmy/src/types.ts (AskOptions, AnthropicAskOptions, OpenAIAskOptions, GoogleAskOptions, etc.)
- Never use `any` when a proper type exists
- If dynamic properties are needed, use proper type unions or mapped types
- Always prefer type safety over convenience
- When you see `: any` in code, consider it a bug that needs fixing
# important-instruction-reminders
Do what has been asked; nothing more, nothing less.
NEVER create files unless they're absolutely necessary for achieving your goal.
ALWAYS prefer editing an existing file to creating a new one.
NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
IMPORTANT: this context may or may not be relevant to your tasks. You should not respond to this context or otherwise consider it in your response unless it is highly relevant to your task. Most of the time, it is not relevant.
</system-reminder>
ARE YOU WORKING
<system-reminder>This is a reminder that your todo list is currently empty. DO NOT mention this to the user explicitly because they are already aware. If you are working on tasks that would benefit from a todo list please use the TodoWrite tool to create one. If not, please feel free to ignore. Again do not mention this message to the user.</system-reminder>
The user opened the file /Users/badlogic/workspaces/lemmy/.gitignore in the IDE.
🤖 Assistant Response (claude-sonnet-4-20250514)
💾 Tokens: Output=37
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Yes, I'm working and ready to help! I can see you've opened the `.gitignore` file. What would you like me to do with it?
TEXT (Block 0):
Yes, I'm working and ready to help! I can see you've opened the `.gitignore` file. What would you like me to do with it?
Yes, I'm working and ready to help! I can see you've opened the `.gitignore` file. What would you like me to do with it?
Conversation #16 •
2025-05-29 16:57:38 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1ydE8rGzjgqc5d73bd
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
upload
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Soaring
TEXT (Block 0):
Soaring
Soaring
Conversation #17 •
2025-05-29 16:57:39 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1yeaVZbzXRzkWYDshj
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
upload claude-traffic-1748530481.html
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Transferring
TEXT (Block 0):
Transferring
Transferring
Conversation #18 •
2025-05-29 16:57:39 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1ygcnAy53WecaQoZjb
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
upload claude-traffic-1748530481.html
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Uploading
TEXT (Block 0):
Uploading
Uploading
Conversation #19 •
2025-05-29 16:57:39 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1yhBm5UFoA4ft1oriq
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
upload claude-traffic-1748530481.html t
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Transferring
TEXT (Block 0):
Transferring
Transferring
Conversation #20 •
2025-05-29 16:57:39 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1yi5axYa9idRvAKd2v
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
upload claude-traffic-1748530481.html to
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Uploading
TEXT (Block 0):
Uploading
Uploading
Conversation #21 •
2025-05-29 16:57:39 •
Model: claude-3-5-haiku-20241022 •
Status: 200 •
Request ID: req_011CPc1yhmyeacpWjyS2PGnB
• Max Tokens: 512
• Temperature: 1
• Streaming: Yes
⚙️ System Instructions
Analyze this message and come up with a single positive, cheerful and delightful verb in gerund form that's related to the message. Only include the word with no other text or punctuation. The word should have the first letter capitalized. Add some whimsy and surprise to entertain the user. Ensure the word is highly relevant to the user's message. Synonyms are welcome, including obscure words. Be careful to avoid words that might look alarming or concerning to the software engineer seeing it as a status notification, such as Connecting, Disconnecting, Retrying, Lagging, Freezing, etc. NEVER use a destructive word, such as Terminating, Killing, Deleting, Destroying, Stopping, Exiting, or similar. NEVER use a word that may be derogatory, offensive, or inappropriate in a non-coding context, such as Penetrating.
👤 User
upload claude-traffic-1748530481.html to
🤖 Assistant Response (claude-3-5-haiku-20241022)
💾 Tokens: Output=6
🛑 Stop Reason: end_turn
⚠️ Unknown Event: message_stop
{ "type": "message_stop" }
Uploading
TEXT (Block 0):
Uploading
Uploading