A lightning-fast, 1.2B parameter local coding assistant designed to run flawlessly on CPUs & GPUs.
Pocket Coder is a fully offline, edge-optimized AI ecosystem. Fine-tuned on a custom code-instruction dataset (based on LiquidAI's LFM 2.5), it acts as a zero-latency copilot right inside your Jupyter Notebooks and VS Code, completely bypassing the need for cloud APIs.
Before you start, ensure you have the following installed:
- Ollama: For running the model engine locally.
- uv: Python package and project manager. (Install via
curl -LsSf https://astral.sh/uv/install.sh | shorpip install uv).
The easiest way to get the model is pulling it directly from the Ollama registry. Open your terminal and run:
ollama run param302/pocket-coder(Type /bye to exit the chat once it downloads. The model is now cached on your machine.)
Clone this repository and set up the isolated Python environment using uv:
# Clone the repository
git clone [https://github.com/Param302/Pocket-Coder.git](https://github.com/Param302/Pocket-Coder.git)
cd Pocket-Coder
# Sync dependencies and create the virtual environment
uv sync
# Activate the environment
# On Windows: .venv\Scripts\activate
# On Mac/Linux:
source .venv/bin/activateThe core feature of this project is the %%code Jupyter Magic command. It allows you to write natural language in a Jupyter cell and watch Pocket Coder stream the Python code directly into a new, executable cell below it.
To let your global Jupyter Notebook use this isolated uv environment, install it as a custom kernel:
python -m ipykernel install --user --name=pocket-coder-env --display-name "Python (Pocket Coder)"Start your Jupyter server from inside the cloned Pocket-Coder directory:
jupyter notebook- Create a new notebook and set the kernel to Python (Pocket Coder).
- In the very first cell, load the extension:
%load_ext jupyter_magic
In any cell, use the %%code magic command followed by your prompt:
%%code
Write a pandas script to generate 100 rows of fake sales data, group by month, and plot a bar chart.
Hit Shift + Enter. The model will query your local CPU/GPU and instantly inject the requested code into a new cell below!
VS Code MCP Server (Agentic Copilot)
Pocket Coder includes a Model Context Protocol (MCP) server. This allows AI assistants in VS Code (like Cline or Claude Desktop) to delegate coding tasks directly to your local GPU, saving API costs.
Usage:
- Ensure your
uvenvironment is active. - Run the MCP server in the background:
python mcp_server.py
- Add the following to your VS Code MCP Configuration JSON (adjust the paths to match your local machine):
Basically, create
.vscode/mcp.jsonfile{ "mcpServers": { "pocket-coder-local": { "command": "C:/Path/To/Pocket-Coder/.venv/Scripts/python.exe", "args": ["C:/Path/To/Pocket-Coder/mcp_server.py"] } } }
Basic Ollama API (main.py)
If you want to integrate Pocket Coder into your own custom scripts, you can use the barebones Ollama Python client integration.
Usage:
python main.pyCheck the main.py file to see how to implement standard synchronous generation and streaming using the ollama Python library.
For Machine Learning Engineers who want to inspect the raw quantized files, or use a different inference engine (like llama.cpp or LM Studio), the raw .gguf weights are hosted on Hugging Face.
- Repository: param302/Pocket-Code-1.2B-GGUF
- Recommended File:
LFM2.5-1.2B-Instruct.Q4_K_M.gguf(Best balance of size and performance).
Contributions are welcome! If you want to add new features, improve the Jupyter extraction logic, or port the MCP server to HTTP/SSE, feel free to open a Pull Request.
- Fork the project.
- Create your feature branch (
git checkout -b feature). - Commit your changes (
git commit -m 'Add some Amazing Feature'). - Push to the branch (
git push origin feature). - Open a Pull Request.
Built by Parampreet Singh.
Let's connect!
- Email: connectwithparam.30@gmail.com
- X (Twitter): @Param3021
- Hugging Face: param302