patchpal 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {patchpal-0.1.0/patchpal.egg-info → patchpal-0.1.2}/PKG-INFO +84 -11
  2. {patchpal-0.1.0 → patchpal-0.1.2}/README.md +83 -10
  3. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/__init__.py +1 -1
  4. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/agent.py +16 -0
  5. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/tools.py +1 -1
  6. {patchpal-0.1.0 → patchpal-0.1.2/patchpal.egg-info}/PKG-INFO +84 -11
  7. {patchpal-0.1.0 → patchpal-0.1.2}/LICENSE +0 -0
  8. {patchpal-0.1.0 → patchpal-0.1.2}/MANIFEST.in +0 -0
  9. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/cli.py +0 -0
  10. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/context.py +0 -0
  11. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/permissions.py +0 -0
  12. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/skills.py +0 -0
  13. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal/system_prompt.md +0 -0
  14. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal.egg-info/SOURCES.txt +0 -0
  15. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal.egg-info/dependency_links.txt +0 -0
  16. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal.egg-info/entry_points.txt +0 -0
  17. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal.egg-info/requires.txt +0 -0
  18. {patchpal-0.1.0 → patchpal-0.1.2}/patchpal.egg-info/top_level.txt +0 -0
  19. {patchpal-0.1.0 → patchpal-0.1.2}/pyproject.toml +0 -0
  20. {patchpal-0.1.0 → patchpal-0.1.2}/setup.cfg +0 -0
  21. {patchpal-0.1.0 → patchpal-0.1.2}/tests/test_agent.py +0 -0
  22. {patchpal-0.1.0 → patchpal-0.1.2}/tests/test_cli.py +0 -0
  23. {patchpal-0.1.0 → patchpal-0.1.2}/tests/test_context.py +0 -0
  24. {patchpal-0.1.0 → patchpal-0.1.2}/tests/test_guardrails.py +0 -0
  25. {patchpal-0.1.0 → patchpal-0.1.2}/tests/test_operational_safety.py +0 -0
  26. {patchpal-0.1.0 → patchpal-0.1.2}/tests/test_skills.py +0 -0
  27. {patchpal-0.1.0 → patchpal-0.1.2}/tests/test_tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchpal
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A lean Claude Code clone in pure Python
5
5
  Author: PatchPal Contributors
6
6
  License-Expression: Apache-2.0
@@ -37,7 +37,7 @@ Dynamic: license-file
37
37
  # PatchPal — A Claude Code–Style Agent in Python
38
38
 
39
39
  <!--![PatchPal Screenshot](patchpal_screenshot.png)-->
40
- <img src="patchpal_screenshot.png" alt="PatchPal Screenshot" width="650"/>
40
+ <img src="https://raw.githubusercontent.com/amaiya/patchpal/refs/heads/main/patchpal_screenshot.png" alt="PatchPal Screenshot" width="650"/>
41
41
 
42
42
  > A lightweight Claude Code–inspired coding and automation assistant -- supports both local and cloud LLMs.
43
43
 
@@ -69,7 +69,7 @@ pip install patchpal
69
69
  - **[Cloud]** For Anthropic models (default): Sign up at https://console.anthropic.com/
70
70
  - **[Cloud]** For OpenAI models: Get a key from https://platform.openai.com/
71
71
  - **[Local]** For vLLM: Install from https://docs.vllm.ai/ (free - no API charges) **Recommended for Local Use**
72
- - **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ not well-suited for agents - use vLLM)
72
+ - **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ requires `OLLAMA_CONTEXT_LENGTH=32768` - see Ollama section below)
73
73
  - For other providers: Check the [LiteLLM documentation](https://docs.litellm.ai/docs/providers)
74
74
 
75
75
  2. **Set up your API key as environment variable**:
@@ -103,8 +103,9 @@ export HOSTED_VLLM_API_BASE=http://localhost:8000
103
103
  export HOSTED_VLLM_API_KEY=token-abc123
104
104
  patchpal --model hosted_vllm/openai/gpt-oss-20b
105
105
 
106
- # Use Ollama (local, ⚠️ not recommended - use vLLM)
107
- patchpal --model ollama_chat/qwen3:32b # vLLM is better for agents
106
+ # Use Ollama (local - requires OLLAMA_CONTEXT_LENGTH=32768)
107
+ export OLLAMA_CONTEXT_LENGTH=32768
108
+ patchpal --model ollama_chat/qwen3:32b
108
109
 
109
110
  # Or set the model via environment variable
110
111
  export PATCHPAL_MODEL=openai/gpt-5
@@ -401,14 +402,86 @@ Different models require different parsers. Common parsers include: `qwen3_xml`,
401
402
 
402
403
  #### Ollama
403
404
 
404
- We find that Ollama models do not work well in agentic settings. For instance, while [gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b) works well in vLLM, the [Ollama version](https://ollama.com/library/gpt-oss) of the same model performs poorly. vLLM is recommended for local deployments.
405
+ Ollama v0.14+ supports tool calling for agentic workflows. However, proper configuration is **critical** for reliable operation.
406
+
407
+ **Requirements:**
408
+
409
+ 1. **Ollama v0.14.0 or later** - Required for tool calling support
410
+ 2. **Sufficient context window** - Default 4096 tokens is too small; increase to at least 32K
411
+
412
+ **Setup Instructions:**
413
+
414
+ **For Native Ollama Installation:**
415
+
416
+ ```bash
417
+ # Set context window size (required!)
418
+ export OLLAMA_CONTEXT_LENGTH=32768
419
+
420
+ # Start Ollama server
421
+ ollama serve
422
+
423
+ # In another terminal, use with PatchPal
424
+ patchpal --model ollama_chat/gpt-oss:20b
425
+ ```
426
+
427
+ **For Docker:**
428
+
429
+ ```bash
430
+ # Stop existing container (if running)
431
+ docker stop ollama
432
+ docker rm ollama
433
+
434
+ # Start with proper configuration
435
+ docker run -d \
436
+ -e OLLAMA_CONTEXT_LENGTH=32768 \
437
+ -v ollama:/root/.ollama \
438
+ -p 11434:11434 \
439
+ --name ollama \
440
+ ollama/ollama
441
+
442
+ # Verify configuration
443
+ docker exec -it ollama ollama run gpt-oss:20b
444
+ # In the Ollama prompt, type: /show parameters
445
+ # Should show num_ctx much larger than default 4096
446
+
447
+ # Use with PatchPal
448
+ patchpal --model ollama_chat/gpt-oss:20b
449
+ ```
450
+
451
+ **Verifying Context Window Size:**
452
+
453
+ ```bash
454
+ # Check your Ollama container configuration
455
+ docker inspect ollama | grep OLLAMA_CONTEXT_LENGTH
456
+
457
+ # Or run a model and check parameters
458
+ docker exec -it ollama ollama run gpt-oss:20b
459
+ >>> /show parameters
460
+ ```
461
+
462
+ **Recommended Models for Tool Calling:**
463
+
464
+ - `gpt-oss:20b` - OpenAI's open-source model, excellent tool calling
465
+ - `qwen3:32b` - Qwen3 model with good agentic capabilities
466
+ - `qwen3-coder` - Specialized for coding tasks
467
+
468
+ **Performance Note:**
469
+
470
+ While Ollama now works with proper configuration, vLLM is still recommended for production use due to:
471
+ - 3-10x faster inference
472
+ - More robust tool calling implementation
473
+ - Better memory management
405
474
 
406
475
  **Examples:**
407
476
 
408
477
  ```bash
409
- patchpal --model ollama_chat/qwen3:32b # local model: performs poorly
410
- patchpal --model ollama_chat/gpt-oss:20b # local model: performs poorly
411
- patchpal --model hosted_vllm/openai/gpt-oss-20b # local model: performs well
478
+ # Ollama (works with proper configuration)
479
+ export OLLAMA_CONTEXT_LENGTH=32768
480
+ patchpal --model ollama_chat/qwen3:32b
481
+ patchpal --model ollama_chat/gpt-oss:20b
482
+
483
+ # vLLM (recommended for production)
484
+ patchpal --model hosted_vllm/openai/gpt-oss-20b
412
485
  ```
413
486
 
414
487
  ### Air-Gapped and Offline Environments
@@ -526,7 +599,7 @@ PatchPal includes comprehensive security protections enabled by default:
526
599
  - **Command history**: User commands saved to `~/.patchpal/<repo-name>/history.txt` (last 1000 commands)
527
600
  - Clean, user-friendly format for reviewing past interactions
528
601
  - **Automatic backups**: Optional auto-backup of files to `~/.patchpal/<repo-name>/backups/` before modification
529
- - **Resource limits**: Configurable operation counter prevents infinite loops (1000 operations default)
602
+ - **Resource limits**: Configurable operation counter prevents infinite loops (10000 operations default)
530
603
  - **Git state awareness**: Warns when modifying files with uncommitted changes
531
604
 
532
605
  **Configuration via environment variables:**
@@ -543,7 +616,7 @@ export PATCHPAL_ALLOW_SENSITIVE=true # Allow access to .env, credentials, A
543
616
  # Operational Safety Controls
544
617
  export PATCHPAL_AUDIT_LOG=false # Log all operations to ~/.patchpal/<repo-name>/audit.log (default: true)
545
618
  export PATCHPAL_ENABLE_BACKUPS=true # Auto-backup files to ~/.patchpal/<repo-name>/backups/ before modification (default: false)
546
- export PATCHPAL_MAX_OPERATIONS=5000 # Maximum operations per session to prevent infinite loops (default: 1000)
619
+ export PATCHPAL_MAX_OPERATIONS=5000 # Maximum operations per session to prevent infinite loops (default: 10000)
547
620
  export PATCHPAL_MAX_ITERATIONS=150 # Maximum agent iterations per task (default: 100)
548
621
  # Increase for very complex multi-file tasks, decrease for testing
549
622
 
@@ -1,7 +1,7 @@
1
1
  # PatchPal — A Claude Code–Style Agent in Python
2
2
 
3
3
  <!--![PatchPal Screenshot](patchpal_screenshot.png)-->
4
- <img src="patchpal_screenshot.png" alt="PatchPal Screenshot" width="650"/>
4
+ <img src="https://raw.githubusercontent.com/amaiya/patchpal/refs/heads/main/patchpal_screenshot.png" alt="PatchPal Screenshot" width="650"/>
5
5
 
6
6
  > A lightweight Claude Code–inspired coding and automation assistant -- supports both local and cloud LLMs.
7
7
 
@@ -33,7 +33,7 @@ pip install patchpal
33
33
  - **[Cloud]** For Anthropic models (default): Sign up at https://console.anthropic.com/
34
34
  - **[Cloud]** For OpenAI models: Get a key from https://platform.openai.com/
35
35
  - **[Local]** For vLLM: Install from https://docs.vllm.ai/ (free - no API charges) **Recommended for Local Use**
36
- - **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ not well-suited for agents - use vLLM)
36
+ - **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ requires `OLLAMA_CONTEXT_LENGTH=32768` - see Ollama section below)
37
37
  - For other providers: Check the [LiteLLM documentation](https://docs.litellm.ai/docs/providers)
38
38
 
39
39
  2. **Set up your API key as environment variable**:
@@ -67,8 +67,9 @@ export HOSTED_VLLM_API_BASE=http://localhost:8000
67
67
  export HOSTED_VLLM_API_KEY=token-abc123
68
68
  patchpal --model hosted_vllm/openai/gpt-oss-20b
69
69
 
70
- # Use Ollama (local, ⚠️ not recommended - use vLLM)
71
- patchpal --model ollama_chat/qwen3:32b # vLLM is better for agents
70
+ # Use Ollama (local - requires OLLAMA_CONTEXT_LENGTH=32768)
71
+ export OLLAMA_CONTEXT_LENGTH=32768
72
+ patchpal --model ollama_chat/qwen3:32b
72
73
 
73
74
  # Or set the model via environment variable
74
75
  export PATCHPAL_MODEL=openai/gpt-5
@@ -365,14 +366,86 @@ Different models require different parsers. Common parsers include: `qwen3_xml`,
365
366
 
366
367
  #### Ollama
367
368
 
368
- We find that Ollama models do not work well in agentic settings. For instance, while [gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b) works well in vLLM, the [Ollama version](https://ollama.com/library/gpt-oss) of the same model performs poorly. vLLM is recommended for local deployments.
369
+ Ollama v0.14+ supports tool calling for agentic workflows. However, proper configuration is **critical** for reliable operation.
370
+
371
+ **Requirements:**
372
+
373
+ 1. **Ollama v0.14.0 or later** - Required for tool calling support
374
+ 2. **Sufficient context window** - Default 4096 tokens is too small; increase to at least 32K
375
+
376
+ **Setup Instructions:**
377
+
378
+ **For Native Ollama Installation:**
379
+
380
+ ```bash
381
+ # Set context window size (required!)
382
+ export OLLAMA_CONTEXT_LENGTH=32768
383
+
384
+ # Start Ollama server
385
+ ollama serve
386
+
387
+ # In another terminal, use with PatchPal
388
+ patchpal --model ollama_chat/gpt-oss:20b
389
+ ```
390
+
391
+ **For Docker:**
392
+
393
+ ```bash
394
+ # Stop existing container (if running)
395
+ docker stop ollama
396
+ docker rm ollama
397
+
398
+ # Start with proper configuration
399
+ docker run -d \
400
+ -e OLLAMA_CONTEXT_LENGTH=32768 \
401
+ -v ollama:/root/.ollama \
402
+ -p 11434:11434 \
403
+ --name ollama \
404
+ ollama/ollama
405
+
406
+ # Verify configuration
407
+ docker exec -it ollama ollama run gpt-oss:20b
408
+ # In the Ollama prompt, type: /show parameters
409
+ # Should show num_ctx much larger than default 4096
410
+
411
+ # Use with PatchPal
412
+ patchpal --model ollama_chat/gpt-oss:20b
413
+ ```
414
+
415
+ **Verifying Context Window Size:**
416
+
417
+ ```bash
418
+ # Check your Ollama container configuration
419
+ docker inspect ollama | grep OLLAMA_CONTEXT_LENGTH
420
+
421
+ # Or run a model and check parameters
422
+ docker exec -it ollama ollama run gpt-oss:20b
423
+ >>> /show parameters
424
+ ```
425
+
426
+ **Recommended Models for Tool Calling:**
427
+
428
+ - `gpt-oss:20b` - OpenAI's open-source model, excellent tool calling
429
+ - `qwen3:32b` - Qwen3 model with good agentic capabilities
430
+ - `qwen3-coder` - Specialized for coding tasks
431
+
432
+ **Performance Note:**
433
+
434
+ While Ollama now works with proper configuration, vLLM is still recommended for production use due to:
435
+ - 3-10x faster inference
436
+ - More robust tool calling implementation
437
+ - Better memory management
369
438
 
370
439
  **Examples:**
371
440
 
372
441
  ```bash
373
- patchpal --model ollama_chat/qwen3:32b # local model: performs poorly
374
- patchpal --model ollama_chat/gpt-oss:20b # local model: performs poorly
375
- patchpal --model hosted_vllm/openai/gpt-oss-20b # local model: performs well
442
+ # Ollama (works with proper configuration)
443
+ export OLLAMA_CONTEXT_LENGTH=32768
444
+ patchpal --model ollama_chat/qwen3:32b
445
+ patchpal --model ollama_chat/gpt-oss:20b
446
+
447
+ # vLLM (recommended for production)
448
+ patchpal --model hosted_vllm/openai/gpt-oss-20b
376
449
  ```
377
450
 
378
451
  ### Air-Gapped and Offline Environments
@@ -490,7 +563,7 @@ PatchPal includes comprehensive security protections enabled by default:
490
563
  - **Command history**: User commands saved to `~/.patchpal/<repo-name>/history.txt` (last 1000 commands)
491
564
  - Clean, user-friendly format for reviewing past interactions
492
565
  - **Automatic backups**: Optional auto-backup of files to `~/.patchpal/<repo-name>/backups/` before modification
493
- - **Resource limits**: Configurable operation counter prevents infinite loops (1000 operations default)
566
+ - **Resource limits**: Configurable operation counter prevents infinite loops (10000 operations default)
494
567
  - **Git state awareness**: Warns when modifying files with uncommitted changes
495
568
 
496
569
  **Configuration via environment variables:**
@@ -507,7 +580,7 @@ export PATCHPAL_ALLOW_SENSITIVE=true # Allow access to .env, credentials, A
507
580
  # Operational Safety Controls
508
581
  export PATCHPAL_AUDIT_LOG=false # Log all operations to ~/.patchpal/<repo-name>/audit.log (default: true)
509
582
  export PATCHPAL_ENABLE_BACKUPS=true # Auto-backup files to ~/.patchpal/<repo-name>/backups/ before modification (default: false)
510
- export PATCHPAL_MAX_OPERATIONS=5000 # Maximum operations per session to prevent infinite loops (default: 1000)
583
+ export PATCHPAL_MAX_OPERATIONS=5000 # Maximum operations per session to prevent infinite loops (default: 10000)
511
584
  export PATCHPAL_MAX_ITERATIONS=150 # Maximum agent iterations per task (default: 100)
512
585
  # Increase for very complex multi-file tasks, decrease for testing
513
586
 
@@ -1,6 +1,6 @@
1
1
  """PatchPal - An open-source Claude Code clone implemented purely in Python."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.2"
4
4
 
5
5
  from patchpal.agent import create_agent
6
6
  from patchpal.tools import (
@@ -540,6 +540,22 @@ class PatchPalAgent:
540
540
 
541
541
  self.model_id = _normalize_bedrock_model_id(model_id)
542
542
 
543
+ # Register Ollama models as supporting native function calling
544
+ # LiteLLM defaults to JSON mode if not explicitly registered
545
+ if self.model_id.startswith("ollama_chat/"):
546
+ # Suppress verbose output from register_model
547
+ import sys
548
+ from io import StringIO
549
+
550
+ old_stdout = sys.stdout
551
+ sys.stdout = StringIO()
552
+ try:
553
+ litellm.register_model(
554
+ {"model_cost": {self.model_id: {"supports_function_calling": True}}}
555
+ )
556
+ finally:
557
+ sys.stdout = old_stdout
558
+
543
559
  # Set up Bedrock environment if needed
544
560
  if self.model_id.startswith("bedrock/"):
545
561
  _setup_bedrock_env()
@@ -79,7 +79,7 @@ READ_ONLY_MODE = os.getenv("PATCHPAL_READ_ONLY", "false").lower() == "true"
79
79
  ALLOW_SENSITIVE = os.getenv("PATCHPAL_ALLOW_SENSITIVE", "false").lower() == "true"
80
80
  ENABLE_AUDIT_LOG = os.getenv("PATCHPAL_AUDIT_LOG", "true").lower() == "true"
81
81
  ENABLE_BACKUPS = os.getenv("PATCHPAL_ENABLE_BACKUPS", "false").lower() == "true"
82
- MAX_OPERATIONS = int(os.getenv("PATCHPAL_MAX_OPERATIONS", 1000))
82
+ MAX_OPERATIONS = int(os.getenv("PATCHPAL_MAX_OPERATIONS", 10000))
83
83
 
84
84
  # Web request configuration
85
85
  WEB_REQUEST_TIMEOUT = int(os.getenv("PATCHPAL_WEB_TIMEOUT", 30)) # 30 seconds
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchpal
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A lean Claude Code clone in pure Python
5
5
  Author: PatchPal Contributors
6
6
  License-Expression: Apache-2.0
@@ -37,7 +37,7 @@ Dynamic: license-file
37
37
  # PatchPal — A Claude Code–Style Agent in Python
38
38
 
39
39
  <!--![PatchPal Screenshot](patchpal_screenshot.png)-->
40
- <img src="patchpal_screenshot.png" alt="PatchPal Screenshot" width="650"/>
40
+ <img src="https://raw.githubusercontent.com/amaiya/patchpal/refs/heads/main/patchpal_screenshot.png" alt="PatchPal Screenshot" width="650"/>
41
41
 
42
42
  > A lightweight Claude Code–inspired coding and automation assistant -- supports both local and cloud LLMs.
43
43
 
@@ -69,7 +69,7 @@ pip install patchpal
69
69
  - **[Cloud]** For Anthropic models (default): Sign up at https://console.anthropic.com/
70
70
  - **[Cloud]** For OpenAI models: Get a key from https://platform.openai.com/
71
71
  - **[Local]** For vLLM: Install from https://docs.vllm.ai/ (free - no API charges) **Recommended for Local Use**
72
- - **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ not well-suited for agents - use vLLM)
72
+ - **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ requires `OLLAMA_CONTEXT_LENGTH=32768` - see Ollama section below)
73
73
  - For other providers: Check the [LiteLLM documentation](https://docs.litellm.ai/docs/providers)
74
74
 
75
75
  2. **Set up your API key as environment variable**:
@@ -103,8 +103,9 @@ export HOSTED_VLLM_API_BASE=http://localhost:8000
103
103
  export HOSTED_VLLM_API_KEY=token-abc123
104
104
  patchpal --model hosted_vllm/openai/gpt-oss-20b
105
105
 
106
- # Use Ollama (local, ⚠️ not recommended - use vLLM)
107
- patchpal --model ollama_chat/qwen3:32b # vLLM is better for agents
106
+ # Use Ollama (local - requires OLLAMA_CONTEXT_LENGTH=32768)
107
+ export OLLAMA_CONTEXT_LENGTH=32768
108
+ patchpal --model ollama_chat/qwen3:32b
108
109
 
109
110
  # Or set the model via environment variable
110
111
  export PATCHPAL_MODEL=openai/gpt-5
@@ -401,14 +402,86 @@ Different models require different parsers. Common parsers include: `qwen3_xml`,
401
402
 
402
403
  #### Ollama
403
404
 
404
- We find that Ollama models do not work well in agentic settings. For instance, while [gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b) works well in vLLM, the [Ollama version](https://ollama.com/library/gpt-oss) of the same model performs poorly. vLLM is recommended for local deployments.
405
+ Ollama v0.14+ supports tool calling for agentic workflows. However, proper configuration is **critical** for reliable operation.
406
+
407
+ **Requirements:**
408
+
409
+ 1. **Ollama v0.14.0 or later** - Required for tool calling support
410
+ 2. **Sufficient context window** - Default 4096 tokens is too small; increase to at least 32K
411
+
412
+ **Setup Instructions:**
413
+
414
+ **For Native Ollama Installation:**
415
+
416
+ ```bash
417
+ # Set context window size (required!)
418
+ export OLLAMA_CONTEXT_LENGTH=32768
419
+
420
+ # Start Ollama server
421
+ ollama serve
422
+
423
+ # In another terminal, use with PatchPal
424
+ patchpal --model ollama_chat/gpt-oss:20b
425
+ ```
426
+
427
+ **For Docker:**
428
+
429
+ ```bash
430
+ # Stop existing container (if running)
431
+ docker stop ollama
432
+ docker rm ollama
433
+
434
+ # Start with proper configuration
435
+ docker run -d \
436
+ -e OLLAMA_CONTEXT_LENGTH=32768 \
437
+ -v ollama:/root/.ollama \
438
+ -p 11434:11434 \
439
+ --name ollama \
440
+ ollama/ollama
441
+
442
+ # Verify configuration
443
+ docker exec -it ollama ollama run gpt-oss:20b
444
+ # In the Ollama prompt, type: /show parameters
445
+ # Should show num_ctx much larger than default 4096
446
+
447
+ # Use with PatchPal
448
+ patchpal --model ollama_chat/gpt-oss:20b
449
+ ```
450
+
451
+ **Verifying Context Window Size:**
452
+
453
+ ```bash
454
+ # Check your Ollama container configuration
455
+ docker inspect ollama | grep OLLAMA_CONTEXT_LENGTH
456
+
457
+ # Or run a model and check parameters
458
+ docker exec -it ollama ollama run gpt-oss:20b
459
+ >>> /show parameters
460
+ ```
461
+
462
+ **Recommended Models for Tool Calling:**
463
+
464
+ - `gpt-oss:20b` - OpenAI's open-source model, excellent tool calling
465
+ - `qwen3:32b` - Qwen3 model with good agentic capabilities
466
+ - `qwen3-coder` - Specialized for coding tasks
467
+
468
+ **Performance Note:**
469
+
470
+ While Ollama now works with proper configuration, vLLM is still recommended for production use due to:
471
+ - 3-10x faster inference
472
+ - More robust tool calling implementation
473
+ - Better memory management
405
474
 
406
475
  **Examples:**
407
476
 
408
477
  ```bash
409
- patchpal --model ollama_chat/qwen3:32b # local model: performs poorly
410
- patchpal --model ollama_chat/gpt-oss:20b # local model: performs poorly
411
- patchpal --model hosted_vllm/openai/gpt-oss-20b # local model: performs well
478
+ # Ollama (works with proper configuration)
479
+ export OLLAMA_CONTEXT_LENGTH=32768
480
+ patchpal --model ollama_chat/qwen3:32b
481
+ patchpal --model ollama_chat/gpt-oss:20b
482
+
483
+ # vLLM (recommended for production)
484
+ patchpal --model hosted_vllm/openai/gpt-oss-20b
412
485
  ```
413
486
 
414
487
  ### Air-Gapped and Offline Environments
@@ -526,7 +599,7 @@ PatchPal includes comprehensive security protections enabled by default:
526
599
  - **Command history**: User commands saved to `~/.patchpal/<repo-name>/history.txt` (last 1000 commands)
527
600
  - Clean, user-friendly format for reviewing past interactions
528
601
  - **Automatic backups**: Optional auto-backup of files to `~/.patchpal/<repo-name>/backups/` before modification
529
- - **Resource limits**: Configurable operation counter prevents infinite loops (1000 operations default)
602
+ - **Resource limits**: Configurable operation counter prevents infinite loops (10000 operations default)
530
603
  - **Git state awareness**: Warns when modifying files with uncommitted changes
531
604
 
532
605
  **Configuration via environment variables:**
@@ -543,7 +616,7 @@ export PATCHPAL_ALLOW_SENSITIVE=true # Allow access to .env, credentials, A
543
616
  # Operational Safety Controls
544
617
  export PATCHPAL_AUDIT_LOG=false # Log all operations to ~/.patchpal/<repo-name>/audit.log (default: true)
545
618
  export PATCHPAL_ENABLE_BACKUPS=true # Auto-backup files to ~/.patchpal/<repo-name>/backups/ before modification (default: false)
546
- export PATCHPAL_MAX_OPERATIONS=5000 # Maximum operations per session to prevent infinite loops (default: 1000)
619
+ export PATCHPAL_MAX_OPERATIONS=5000 # Maximum operations per session to prevent infinite loops (default: 10000)
547
620
  export PATCHPAL_MAX_ITERATIONS=150 # Maximum agent iterations per task (default: 100)
548
621
  # Increase for very complex multi-file tasks, decrease for testing
549
622
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes