π
ββββββ ββ ββ ββββ βββββ
ββββββ ββ ββ βββββ ββββ
ββββββ βββββ ββ βββββ βββββA local-first IDE wrapper for Ollama models. Chat naturally. Edit code with diffs. Read/write documents. All permission-gated. All local.
Slice is a beautiful terminal IDE that wraps local Ollama models with practical coding tools. Built with Python and the Rich library, it provides streaming chat, code editing with diffs, document operations, and git integration - all sandboxed to your project directory.
- π― Skills System - Create custom slash commands with predefined instructions
- Define skills in
slice-skills/directory - Invoke with
/skill-namefor common workflows - Example skills included:
/test,/hello,/status - Full documentation in
slice-skills/README.md
- Define skills in
- π― Enhanced Model Behavior - Major improvements to tool calling across models
- Fixed critical system message issues preventing models from using tools correctly
- Models now properly create Python apps with bash (not write_document)
- Better tool calling behavior for gemma4, granite4, and other models
- Added explicit guidance for creating executable files
- Improved sequential tool execution (create file β run file)
- Note: llama3.1 8B has poor tool calling support; use gemma4 or granite4 instead
- π Convert to Markdown - New
convert_to_markdowntool for document conversion- Convert Excel, CSV, Word (with tables), and PDF files to Markdown format
- Tables automatically formatted with Markdown table syntax (| separators)
- Example:
convert budget.xlsx to budget.md
- π Word Document Table Extraction - Tables in Word documents are now extracted alongside paragraphs
- π Large File Support - New
convert_to_jsontool handles massive files efficiently - π§ Dedicated Conversion Tool - Replaces error-prone bash one-liners with proper error handling
- π Universal File to JSON Conversion - Convert Excel, CSV, Word, and PDF files to JSON seamlessly
- π Fixed UI Issues - Removed
<tool_call>tags appearing in model output - π¬ Better Tool Response - Fixed models not responding after reading documents
- π§Ή Cleaner UI - All spinners properly clean up after completion
- π PDF Writing Enabled - Create and edit PDFs directly
- π Enhanced Spreadsheet Support - Improved tool guidance for better Excel/CSV editing
- π Universal Document Editing - ALL file types editable (PDF, Word, Excel, PowerPoint, CSV, Markdown, code)
- β‘ Cross-Format Operations - Move data between formats (PDFβExcel, WordβMarkdown, etc.)
Slice brings IDE-like capabilities to local Ollama models through a permission-gated interface:
- π¬ Natural conversation - Ask questions, discuss code, get explanations
- βοΈ Code editing with diffs - Propose changes, review side-by-side diffs, apply with approval
- π Universal document editing - Read/write PDF, Word, Excel, PowerPoint, CSV, Markdown, and ANY text-based file
- π§ Bash execution - Run commands after approval
- π³ Git integration - Stage, commit, create branches (never auto-pushes)
- π Directory sandboxing - All operations confined to current directory
- π Beautiful terminal UI - Streaming responses with Rich styling
Before installing Slice, you need:
-
Python 3.9 or higher
python3 --version # Should show 3.9+ -
Ollama installed and running
- Download from ollama.ai
- Install for your OS (macOS, Linux, Windows)
-
At least one Ollama model downloaded
# Recommended models for best results: ollama pull gemma4 # Best for mixed chat/actions ollama pull mistral # Fast and reliable ollama pull qwen2 # Great multilingual support # Or try llama3.1 (works well for code tasks) ollama pull llama3.1
# Clone the repository
git clone https://github.com/caspiras/Slice.git
cd Slice
# Install Python package
pip install -e .# Uninstall the package
pip uninstall sliceUpgrading from v1.0 (slice-agent)?
# Uninstall old version first
pip uninstall slice-agent -y
# Then install new version
pip install -e .# Start Slice
slice- Select a model using arrow keys (β/β) and press Enter
- Start chatting at the π prompt
- Ask it to do things - it will request permission before executing
- Switch models anytime by typing
/model - Exit gracefully with Ctrl+C (twice)
Slice v1.5.0 introduces skills - custom slash commands that provide the AI with predefined instructions for common tasks.
Skills are instruction sets stored in markdown files that you can invoke with /skill-name. When invoked, Slice feeds the instructions to the AI model, guiding it through specific workflows.
Built-in example skills:
π /hello # Greeting with system information
π /test # Test the skills system
π /status # Git repository status
Create your own skills:
- Create a
slice-skills/directory in your project - Add a
.mdfile with this format:
---
name: deploy
description: Deploy the application
---
# Deployment Instructions
When invoked:
1. Run tests with `pytest`
2. Build with `npm run build`
3. Deploy with `./deploy.sh`
4. Verify deployment- Invoke with
/deployin Slice
See slice-skills/README.md for complete documentation.
π what is Python?
The AI answers directly from knowledge - no commands, just conversation.
π create a file called notes.txt
You'll see:
π§ Action Requested
To create a new text file
ββ Command βββββββββββββ
β touch notes.txt β
ββββββββββββββββββββββββ
Execute this command? (y/N): y
β Command completed successfully
Code editing with diffs:
π read main.py and fix the typo where it says "resposne" instead of "response"
Shows a syntax-highlighted diff for your approval before applying changes.
Document operations:
π what's the total in the budget.xlsx file for Q2?
π create a PDF report called summary.pdf with our Q1 findings
π read contract.pdf and extract the key terms into a spreadsheet
Read/write ANY document type - PDF, Excel, Word, CSV, Markdown, etc.
File format conversion:
π convert budget.xlsx to budget.json
π convert report.docx to report.json
π convert contract.pdf to contract.json
π convert data.csv to data.json
Seamlessly convert Excel, Word, PDF, and CSV files to JSON format.
Git workflows:
π check git status and create a commit with my changes
Stages files and creates commits (never auto-pushes without explicit request).
File operations:
- "Create a folder called src"
- "List all Python files in this directory"
- "Search for TODO comments in my code"
Code exploration:
- "Find all functions that use the requests library"
- "Show me files modified in the last 24 hours"
- "What's the overall structure of this project?"
π /model
Use arrow keys to pick a new model. Your conversation history is preserved!
Slice is designed with security first. Multiple layers protect your system:
By default, all commands are restricted to the directory where you started slice.
π‘ Best Practice: Always start Slice inside a specific project folder, not in your home directory or system root. This provides natural boundaries for operations:
# β
Good - Start in a specific project
cd ~/projects/my-app
slice
# β Avoid - Starting in home directory or root
cd ~
sliceCommands attempting to access files outside trigger a red warning:
β οΈ SANDBOX ESCAPE DETECTED
This command tries to access paths outside: /your/current/directory
Suspicious paths:
β’ /etc/hosts (absolute path)
β’ ~/Documents (home directory)
β’ ../../../file.txt (parent directory)
β οΈ Are you SURE you want to execute this? (yes/N):
Protected patterns:
- β Absolute paths:
/tmp/file,/etc/hosts - β Home directory:
~/Documents/file - β Parent traversal:
../../sensitive/file - β Directory changes:
cd /tmp
Override when needed:
- Normal commands: Type y to approve
- Sandbox escapes: Type yes (full word) to explicitly approve
- Slice can't silently access files outside your starting directory
-
Permission prompts for EVERY command
- See exactly what will run before it executes
- Includes the reason/context from the AI
- Easy to review and deny
-
Dangerous command detection
- Patterns like
rm -rf /,mkfs,dd if=trigger warnings - Requires explicit "yes" confirmation
- Patterns like
-
30-second execution timeout
- Prevents runaway or hanging commands
- Automatically kills commands that take too long
-
No automatic execution
- The AI can't run anything without your approval
- Even if the model tries, you see the prompt first
- β 100% local: Everything runs on your machine via Ollama
- β No cloud API calls: Your conversations never leave your computer
- β No data persistence: Conversation history only exists while running
- β No telemetry: No tracking, logging, or data collection
Slice is built entirely in Python using the Rich library for beautiful terminal UX:
ββββββββββββββββββββββββββββββββββββββββ
β Slice (Python) β
β ββ Rich Terminal UI β¨ β
β ββ Ollama API Client β
β ββ Chat Session Manager β
β ββ Code Editor (with diffs) β
β ββ Document Reader/Writer β
β ββ Command Executor & Sandboxing β
β ββ Permission Prompt System β
ββββββββββββββββββββββββββββββββββββββββ
Core capabilities:
- Rich terminal UI - Beautiful panels, spinners, syntax highlighting
- Ollama integration - Streaming chat with tool calling support
- Skills system - Custom slash commands with predefined instructions
- Code editing - Read files, generate diffs, apply changes with approval
- Document operations - Read/write PDF, Word, Excel, PowerPoint, CSV
- Command execution - Sandboxed bash with 30-second timeout
- Git operations - Stage, commit, branch (never auto-pushes)
- Permission gates - Every action requires explicit user approval
slice_agent/
βββ src/slice/
β βββ main.py # CLI entry point & startup
β βββ ui.py # Rich terminal UI components
β βββ chat.py # Chat session & tool execution
β βββ skills.py # Skills loader & parser
β βββ executor.py # Command executor & sandboxing
β βββ document_reader.py # PDF/Word/Excel/CSV reading
β βββ document_writer.py # Document writing operations
βββ slice-skills/ # Custom slash commands (optional)
β βββ README.md # Skills documentation
β βββ *.md # Skill definition files
βββ pyproject.toml # Python dependencies & metadata
# Install Python dependencies with dev tools
pip install -e ".[dev]"
# Run Python tests
pytest
# Format Python code
black src/
# Lint Python code
ruff check src/Python:
- rich - Beautiful terminal UI with panels, spinners, syntax highlighting
- prompt-toolkit - Interactive prompts with command history
- ollama - Python client for Ollama API
- pypdf, reportlab - PDF reading and writing
- python-docx, openpyxl, python-pptx - Word, Excel, PowerPoint operations
-
π― Skills System (NEW in v1.5.0)
- Create custom slash commands with predefined instructions
- Store skills in
slice-skills/directory as markdown files - Invoke with
/skill-namefor common workflows - Example skills included:
/hello,/test,/status - Full documentation in
slice-skills/README.md
-
βοΈ Code Editing with Diffs
- Read source files and propose changes
- Syntax-highlighted diff preview before applying
- User approval required for every edit
-
π Document Operations
- Read: PDF, Word (.docx), Excel (.xlsx), PowerPoint, CSV, text
- Write: PDF, Word, Excel, PowerPoint, CSV, text
- All document types in the directory are editable
- Truncates large documents automatically for efficiency
-
π³ Git Integration
- Safe read-only operations (status, log, diff)
- Local operations with approval (add, commit, branch)
- Never auto-pushes without explicit user request
-
π Beautiful Terminal UI
- Pizza emoji (π) prompt cursor
- "baking..." spinner while AI thinks
- Streaming responses (see text appear word-by-word)
- Clean panels for commands and output
-
π Model Switching
- Interactive arrow-key selection at startup
- Switch models anytime with
/modelcommand - Conversation history preserved when switching
-
β¨οΈ Great UX
- Double Ctrl+C to exit (with warning on first press)
- Interruption support during streaming
- Clear success/failure indicators
-
π Security First
- Directory sandboxing with escape detection
- Permission gates for all commands
- Dangerous pattern warnings
- 30-second command timeout
Different models behave differently. Choose based on your task:
- gemma4 - Excellent at knowing when to chat vs. execute commands
- mistral - Fast, reliable, good tool calling judgment
- qwen2 - Great multilingual support with smart tool use
ollama pull gemma4- llama3.1, llama3.2, llama3.3 - Trained heavily for tool use
- May try to execute commands for general knowledge questions
- Works perfectly for file operations and coding workflows
ollama pull llama3.1π‘ Tip: Models marked with [tools β] in the selector support function calling.
- Make sure Ollama is running:
ollama listshould show your models - Download a model:
ollama pull gemma4 - Verify Ollama service is active
- This usually means a permission prompt is waiting
- The latest version fixes display issues - update if needed
- Try pressing Ctrl+C to cancel and restart
- This is model-specific behavior (common with llama3.1/3.2/3.3)
- These models are trained heavily for tool use
- Switch to gemma4, mistral, or qwen2 for better chat/action balance
- Use
/modelcommand to switch without restarting
- The command took too long and was automatically killed for safety
- Try breaking the task into smaller commands
- Some operations (large builds, downloads) may need to be run manually
- Press Ctrl+C twice (first shows warning, second exits)
- If stuck in a prompt, Ctrl+C cancels it first, then exit normally
- Make sure you're pressing Ctrl+C, not Ctrl+D
- Update to the latest version - older versions had display issues
- The prompt should appear after the "baking..." spinner stops
Contributions are welcome! This is an open-source project.
Ideas for contributions:
- Support for additional Ollama models
- New safety/security features
- UI/UX improvements
- Bug fixes and performance improvements
- Documentation improvements
To contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source. See the repository for license details.
- Built with Ollama for local AI model hosting
- Beautiful terminal UI powered by Rich
- Interactive prompts via prompt-toolkit
- Document handling with pypdf, reportlab, python-docx, openpyxl, python-pptx
- Inspired by the need for safe, permission-gated AI coding tools
Made with π by the community