Skip to content

Param302/Pocket-Coder

Repository files navigation

Pocket Coder

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.

Ollama Model Hugging Face


Prerequisites

Before you start, ensure you have the following installed:

  1. Ollama: For running the model engine locally.
  2. uv: Python package and project manager. (Install via curl -LsSf https://astral.sh/uv/install.sh | sh or pip install uv).

Setup & Installation

Step 1: Get the Model

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.)

Step 2: Set up the Environment

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/activate

The Jupyter Magic Command (Flagship Feature)

The 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.

1. Link the Kernel

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)"

2. Launch & Load

Start your Jupyter server from inside the cloned Pocket-Coder directory:

jupyter notebook
  1. Create a new notebook and set the kernel to Python (Pocket Coder).
  2. In the very first cell, load the extension:
    %load_ext jupyter_magic

3. Usage

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!


Advanced Integrations

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:

  1. Ensure your uv environment is active.
  2. Run the MCP server in the background:
    python mcp_server.py
  3. Add the following to your VS Code MCP Configuration JSON (adjust the paths to match your local machine):

    Basically, create .vscode/mcp.json file

    {
      "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.py

Check the main.py file to see how to implement standard synchronous generation and streaming using the ollama Python library.


Raw Weights & Hugging Face

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.


Contributing 🤝

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.

  1. Fork the project.
  2. Create your feature branch (git checkout -b feature).
  3. Commit your changes (git commit -m 'Add some Amazing Feature').
  4. Push to the branch (git push origin feature).
  5. Open a Pull Request.

📫 Contact

Built by Parampreet Singh.

Let's connect!

About

A zero-latency, local 1.2B AI coding copilot for Jupyter Notebooks and VS Code via Ollama.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors