|
| 1 | +# ClaudeREPL.jl |
| 2 | + |
| 3 | +A Julia REPL mode for interacting with Claude AI directly from the Julia REPL. Provides secure, rate-limited communication with proper error handling and memory management. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Seamless REPL Integration**: Press `c` to enter Claude mode, backspace to exit |
| 8 | +- **Conversation History**: Maintains context across interactions with automatic memory management |
| 9 | +- **Error Handling**: Robust error handling for network issues and API errors |
| 10 | +- **Rate Limiting**: Built-in protection against API abuse |
| 11 | +- **Memory Management**: Automatic conversation history trimming to prevent memory leaks |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +```julia |
| 16 | +using Pkg |
| 17 | +Pkg.add("ClaudeREPL") |
| 18 | +``` |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +### Basic Usage |
| 23 | + |
| 24 | +1. Load the package: |
| 25 | +```julia |
| 26 | +using ClaudeREPL |
| 27 | +``` |
| 28 | + |
| 29 | +2. The Claude REPL mode is automatically initialized. Enter Claude mode by pressing `c` at the beginning of a line: |
| 30 | +``` |
| 31 | +julia> c |
| 32 | +claude> Hello, can you help me with Julia? |
| 33 | +``` |
| 34 | + |
| 35 | +3. Exit Claude mode by pressing backspace at an empty prompt or typing `exit`. |
| 36 | + |
| 37 | +### Special Commands |
| 38 | + |
| 39 | +- `help`: Display help message |
| 40 | +- `clear`: Clear conversation history |
| 41 | +- `exit`: Exit Claude mode |
| 42 | + |
| 43 | +### Manual Mode Switching |
| 44 | + |
| 45 | +```julia |
| 46 | +# Switch to Claude mode programmatically |
| 47 | +claude_mode!() |
| 48 | + |
| 49 | +# Clear conversation history |
| 50 | +clear_conversation_history!() |
| 51 | + |
| 52 | +# Get conversation statistics |
| 53 | +print_conversation_stats() |
| 54 | +``` |
| 55 | + |
| 56 | +## Requirements |
| 57 | + |
| 58 | +- Julia 1.10+ |
| 59 | +- ClaudeCodeSDK 0.1.0 |
| 60 | +- Active Claude Code CLI installation |
| 61 | + |
| 62 | +## Dependencies |
| 63 | + |
| 64 | +- [ClaudeCodeSDK.jl](https://github.com/AtelierArith/ClaudeCodeSDK): Core integration with Claude Code |
| 65 | +- JSON3.jl: JSON handling |
| 66 | +- REPL: Julia REPL system integration |
| 67 | + |
| 68 | +## Architecture |
| 69 | + |
| 70 | +The package consists of three main components: |
| 71 | + |
| 72 | +- **ClaudeREPL.jl**: Main module with exports and initialization |
| 73 | +- **repl.jl**: REPL mode implementation with key bindings and prompt handling |
| 74 | +- **claude.jl**: Claude AI communication layer with conversation management |
| 75 | + |
| 76 | +## Configuration |
| 77 | + |
| 78 | +The package uses the following default settings: |
| 79 | + |
| 80 | +- Maximum conversation history: 100 messages |
| 81 | +- Maximum input length: 10,000 characters |
| 82 | +- Automatic history trimming to prevent memory leaks |
| 83 | + |
| 84 | +## Error Handling |
| 85 | + |
| 86 | +The package handles various error conditions: |
| 87 | + |
| 88 | +- **ClaudeSDKError**: General SDK-related errors |
| 89 | +- **CLIConnectionError**: Claude CLI connection issues |
| 90 | +- **CLINotFoundError**: Missing Claude CLI installation |
| 91 | + |
| 92 | +## Contributing |
| 93 | + |
| 94 | +1. Fork the repository |
| 95 | +2. Create a feature branch |
| 96 | +3. Make your changes |
| 97 | +4. Add tests if applicable |
| 98 | +5. Submit a pull request |
| 99 | + |
| 100 | +## Testing |
| 101 | + |
| 102 | +```bash |
| 103 | +julia --project=. -e "using Pkg; Pkg.test()" |
| 104 | +``` |
| 105 | + |
| 106 | +## License |
| 107 | + |
| 108 | +This project is licensed under the MIT License. |
| 109 | + |
| 110 | +## Authors |
| 111 | + |
| 112 | +- Claude Code and Satoshi Terasaki |
0 commit comments