opalacoder 0.1.3__tar.gz → 0.1.5__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 (127) hide show
  1. opalacoder-0.1.5/.claude/rules/RULES.md +20 -0
  2. {opalacoder-0.1.3 → opalacoder-0.1.5}/.claude/settings.json +2 -1
  3. {opalacoder-0.1.3 → opalacoder-0.1.5}/CLAUDE.md +1 -2
  4. {opalacoder-0.1.3 → opalacoder-0.1.5}/GEMINI.md +1 -2
  5. opalacoder-0.1.5/PKG-INFO +288 -0
  6. opalacoder-0.1.5/README.md +261 -0
  7. {opalacoder-0.1.3 → opalacoder-0.1.5}/agents.yaml +14 -48
  8. opalacoder-0.1.5/config.yaml +13 -0
  9. opalacoder-0.1.5/docs/specs/01-arquitetura.md +133 -0
  10. opalacoder-0.1.5/docs/specs/02-memgpt-orquestrador.md +103 -0
  11. opalacoder-0.1.5/docs/specs/03-skill-implement-feature.md +146 -0
  12. opalacoder-0.1.5/docs/specs/04-memoria.md +134 -0
  13. opalacoder-0.1.5/docs/specs/05-vcs-sombra.md +94 -0
  14. opalacoder-0.1.5/docs/specs/06-skills-e-plugins.md +260 -0
  15. opalacoder-0.1.5/docs/specs/07-configuracao.md +161 -0
  16. opalacoder-0.1.5/docs/specs/08-ide.md +153 -0
  17. opalacoder-0.1.5/docs/specs/09-ide-projectcreationinterface.md +75 -0
  18. opalacoder-0.1.5/docs/specs/README.md +79 -0
  19. opalacoder-0.1.5/gui_src/index.html +17 -0
  20. opalacoder-0.1.5/gui_src/package-lock.json +2701 -0
  21. opalacoder-0.1.5/gui_src/package.json +30 -0
  22. opalacoder-0.1.5/gui_src/src/App.jsx +1953 -0
  23. opalacoder-0.1.5/gui_src/src/index.css +608 -0
  24. opalacoder-0.1.5/gui_src/src/main.jsx +10 -0
  25. opalacoder-0.1.5/gui_src/vite.config.js +24 -0
  26. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/__init__.py +1 -1
  27. opalacoder-0.1.5/opalacoder/agent_stdin.py +551 -0
  28. opalacoder-0.1.5/opalacoder/agents.py +79 -0
  29. opalacoder-0.1.5/opalacoder/cli.py +278 -0
  30. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/cli_commands.py +83 -54
  31. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/config.py +105 -53
  32. opalacoder-0.1.5/opalacoder/copy_gui.py +20 -0
  33. opalacoder-0.1.5/opalacoder/gui/assets/index-CgWkjlng.js +206 -0
  34. opalacoder-0.1.5/opalacoder/gui/assets/index-JnX7gh-E.css +32 -0
  35. opalacoder-0.1.5/opalacoder/gui/index.html +18 -0
  36. opalacoder-0.1.5/opalacoder/ide_server.py +645 -0
  37. opalacoder-0.1.5/opalacoder/memgpt_runtime.py +345 -0
  38. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/plugins/html_css_js_tools.py +3 -7
  39. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/project.py +81 -8
  40. opalacoder-0.1.5/opalacoder/skills.py +230 -0
  41. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/terminal.py +56 -16
  42. opalacoder-0.1.5/opalacoder/terminal_manager.py +157 -0
  43. opalacoder-0.1.5/opalacoder/vector_index.py +335 -0
  44. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/workflow_orchestrator.py +168 -165
  45. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/workflow_tools.py +73 -5
  46. {opalacoder-0.1.3 → opalacoder-0.1.5}/pyproject.toml +6 -3
  47. opalacoder-0.1.5/requirements.txt +14 -0
  48. opalacoder-0.1.5/skills/chat-orchestrator/SKILL.md +63 -0
  49. opalacoder-0.1.5/skills/command-line/SKILL.md +33 -0
  50. opalacoder-0.1.5/skills/command-line/scripts/command_executor.py +105 -0
  51. opalacoder-0.1.5/skills/skills_store/html-css-js/SKILL.md +48 -0
  52. opalacoder-0.1.5/skills/skills_store/html-css-js/scripts/check_contracts.py +69 -0
  53. opalacoder-0.1.5/skills/skills_store/implement-feature/SKILL.md +46 -0
  54. opalacoder-0.1.5/skills/skills_store/implement-feature/scripts/run_workflow.py +149 -0
  55. opalacoder-0.1.5/tests/test_agent_config.py +62 -0
  56. opalacoder-0.1.5/tests/test_agent_stdin.py +133 -0
  57. opalacoder-0.1.5/tests/test_command_line_skill.py +76 -0
  58. opalacoder-0.1.5/tests/test_file_delete.py +61 -0
  59. opalacoder-0.1.5/tests/test_implement_feature_script.py +60 -0
  60. opalacoder-0.1.5/tests/test_memgpt_runtime.py +106 -0
  61. opalacoder-0.1.5/tests/test_model_commands.py +95 -0
  62. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_planner_output.py +4 -10
  63. opalacoder-0.1.5/tests/test_skills_directory_loader.py +225 -0
  64. opalacoder-0.1.5/tests/test_unhashable_dict_bug.py +168 -0
  65. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_workflow_pipeline.py +0 -136
  66. opalacoder-0.1.3/ARCH_SUMMARY.md +0 -201
  67. opalacoder-0.1.3/FLOW_MAP.md +0 -230
  68. opalacoder-0.1.3/PKG-INFO +0 -222
  69. opalacoder-0.1.3/README.md +0 -197
  70. opalacoder-0.1.3/docs/ALGS.md +0 -257
  71. opalacoder-0.1.3/docs/specs1.md +0 -16
  72. opalacoder-0.1.3/docs/specs2.md +0 -1
  73. opalacoder-0.1.3/docs/specs3.md +0 -0
  74. opalacoder-0.1.3/experiments/direct_gemini_test.py +0 -27
  75. opalacoder-0.1.3/experiments/run_micalc_test.py +0 -145
  76. opalacoder-0.1.3/experiments/test_complexity.py +0 -1
  77. opalacoder-0.1.3/experiments/test_gemini.py +0 -20
  78. opalacoder-0.1.3/experiments/test_gemini_sequences.py +0 -52
  79. opalacoder-0.1.3/experiments/test_gemma4.py +0 -94
  80. opalacoder-0.1.3/experiments/test_llm.py +0 -58
  81. opalacoder-0.1.3/opalacoder/agents.py +0 -267
  82. opalacoder-0.1.3/opalacoder/cli.py +0 -457
  83. opalacoder-0.1.3/opalacoder/memgpt.py +0 -463
  84. opalacoder-0.1.3/opalacoder/plugins/default_reviewer.py +0 -76
  85. opalacoder-0.1.3/opalacoder/skills.py +0 -311
  86. opalacoder-0.1.3/requirements.txt +0 -11
  87. opalacoder-0.1.3/skills/debug.md +0 -36
  88. opalacoder-0.1.3/skills/generaldeveloper.md +0 -52
  89. opalacoder-0.1.3/skills/html_css_js.md +0 -54
  90. opalacoder-0.1.3/skills/opalacoder.md +0 -37
  91. opalacoder-0.1.3/skills/python_subprocess.md +0 -11
  92. opalacoder-0.1.3/skills/react_vite.md +0 -6
  93. opalacoder-0.1.3/tests/test_agent_config.py +0 -98
  94. opalacoder-0.1.3/tests/test_double_inference.py +0 -21
  95. opalacoder-0.1.3/tests/test_intent_classifier.py +0 -178
  96. opalacoder-0.1.3/tests/test_skills_loading.py +0 -226
  97. {opalacoder-0.1.3 → opalacoder-0.1.5}/.github/workflows/publish.yml +0 -0
  98. {opalacoder-0.1.3 → opalacoder-0.1.5}/.gitignore +0 -0
  99. {opalacoder-0.1.3 → opalacoder-0.1.5}/AGENTS.md +0 -0
  100. {opalacoder-0.1.3 → opalacoder-0.1.5}/debug/scratch_tail.py +0 -0
  101. {opalacoder-0.1.3/docs → opalacoder-0.1.5/docs/guide}/analysis_results.md +0 -0
  102. {opalacoder-0.1.3/docs → opalacoder-0.1.5/docs/guide}/figs/logotipo.png +0 -0
  103. {opalacoder-0.1.3/docs → opalacoder-0.1.5/docs/guide}/paper_memplan.md +0 -0
  104. {opalacoder-0.1.3/docs → opalacoder-0.1.5/docs/guide}/skills-plugin-system.md +0 -0
  105. {opalacoder-0.1.3 → opalacoder-0.1.5}/main.py +0 -0
  106. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/api_keys.py +0 -0
  107. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/archival.py +0 -0
  108. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/code_index.py +0 -0
  109. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/embeddings.py +0 -0
  110. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/i18n.py +0 -0
  111. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/orchestrator.py +0 -0
  112. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/planner.py +0 -0
  113. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/plugins/__init__.py +0 -0
  114. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/session.py +0 -0
  115. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/structured.py +0 -0
  116. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/tools.py +0 -0
  117. {opalacoder-0.1.3 → opalacoder-0.1.5}/opalacoder/vcs.py +0 -0
  118. {opalacoder-0.1.3 → opalacoder-0.1.5}/pytest.ini +0 -0
  119. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_code_index_integration.py +0 -0
  120. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_complexity_evaluator.py +0 -0
  121. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_context_guard.py +0 -0
  122. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_i18n_coverage.py +0 -0
  123. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_planner_oracle_live.py +0 -0
  124. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_project_store.py +0 -0
  125. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_refinement_loop.py +0 -0
  126. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_search_bugs.py +0 -0
  127. {opalacoder-0.1.3 → opalacoder-0.1.5}/tests/test_verification_strategies.py +0 -0
@@ -0,0 +1,20 @@
1
+ # Regras para Analises dadas Questões do Usuário
2
+ 1. **Relevância**: As análises devem ser diretamente relevantes à questão do usuário, abordando os pontos específicos levantados e evitando informações desnecessárias.
3
+
4
+ 2. Nunca levante hipóteses ou suposições sem base sólida. Se a questão do usuário for ambígua, peça esclarecimentos antes de fornecer uma análise. Realize testes para validar/excluir/confirmar hipóteses, e baseie suas análises nos resultados desses testes. Não invente testes fáceis de passar ou que não testem o que você diz que testam.
5
+
6
+ # Regras de Diagnóstico de Testes
7
+ 1. **Cobertura de Código**: Assegure-se de que os testes cubram pelo menos 80% do código, incluindo casos de borda e cenários de falha.
8
+
9
+ 2. **Isolamento**: Cada teste deve ser independente e não depender de outros testes ou do estado global. Use mocks e stubs para isolar as unidades de código.
10
+
11
+ 2. **Repetibilidade**: Os testes devem produzir os mesmos resultados em execuções subsequentes, independentemente da ordem de execução ou do ambiente.
12
+
13
+ 3. **Clareza**: Os testes devem ser claros e fáceis de entender. Use nomes descritivos para os testes e organize-os de maneira lógica.
14
+
15
+
16
+ # Regras de Organização de Testes
17
+ Nunca gere arquivos de teste soltos na raiz do projeto. Use o diretório `tests/` para organizar os testes por funcionalidade ou módulo.
18
+
19
+ # Regras de Nomenclatura de Testes
20
+ Siga a convenção de nomenclatura `test_<nome_da_funcionalidade>.py` para arquivos de teste. Dentro dos arquivos, nomeie as funções de teste com o prefixo `test_` seguido de uma descrição clara do que está sendo testado, por exemplo, `test_calculo_soma()`.
@@ -11,7 +11,8 @@
11
11
  "Bash(python -m pytest tests/ -q --ignore=tests/test_planner_output.py --ignore=tests/test_agent_config.py -k \"not llm and asyncio\")",
12
12
  "Bash(python -m pytest tests/ -q --ignore=tests/test_planner_output.py --ignore=tests/test_agent_config.py -k \"not llm\")",
13
13
  "Bash(python -m pytest tests/test_workflow_pipeline.py tests/test_verification_strategies.py -q -k \"asyncio or \\(not llm\\)\")",
14
- "Bash(python -m pytest tests/ -x -q)"
14
+ "Bash(python -m pytest tests/ -x -q)",
15
+ "Bash(python -c \"from opalacoder.cli_commands import _registry, REPLState; print\\('OK'\\); print\\([k for k in _registry._cmds]\\)\")"
15
16
  ],
16
17
  "additionalDirectories": [
17
18
  "/home/gilzamir"
@@ -21,8 +21,7 @@ Key things to understand from that repo:
21
21
 
22
22
  ## Project Context
23
23
 
24
- Read `ARCH_SUMMARY.md` before making changes. It contains the current project status,
25
- known issues, and decisions already made. Do not re-litigate what is documented there.
24
+ Read `docs/specs` before making changes. It contains the current project status, known issues, and decisions already made. Do not re-litigate what is documented there.
26
25
 
27
26
  ## Build & Test Commands
28
27
  Run tests on tests dir after you implement a new feature.
@@ -21,8 +21,7 @@ Key things to understand from that repo:
21
21
 
22
22
  ## Project Context
23
23
 
24
- Read `ARCH_SUMMARY.md` before making changes. It contains the current project status,
25
- known issues, and decisions already made. Do not re-litigate what is documented there.
24
+ Read `docs/specs` before making changes. It contains the current project status, known issues, and decisions already made. Do not re-litigate what is documented there.
26
25
 
27
26
  ## Build & Test Commands
28
27
  Run tests on tests dir after you implement a new feature.
@@ -0,0 +1,288 @@
1
+ Metadata-Version: 2.4
2
+ Name: opalacoder
3
+ Version: 0.1.5
4
+ Summary: Autonomous coding agent with interactive planning and modular execution
5
+ Project-URL: Homepage, https://github.com/gilzamir/OpalaCoder
6
+ Project-URL: Bug Tracker, https://github.com/gilzamir/OpalaCoder/issues
7
+ Author-email: Gil Zamir <gilzamir@example.com>
8
+ License: MIT
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.11
13
+ Requires-Dist: agenticblocks-io>=0.8.37
14
+ Requires-Dist: chromadb>=0.4.0
15
+ Requires-Dist: instructor>=1.15.1
16
+ Requires-Dist: litellm>=1.40.0
17
+ Requires-Dist: numpy>=1.21.0
18
+ Requires-Dist: python-dotenv>=1.0.0
19
+ Requires-Dist: pywebview>=4.0
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Dist: rich>=13.0.0
22
+ Requires-Dist: tree-sitter-language-pack>=1.8.0
23
+ Requires-Dist: tree-sitter>=0.25.0
24
+ Provides-Extra: embeddings
25
+ Requires-Dist: sentence-transformers>=3.0.0; extra == 'embeddings'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # OpalaCoder
29
+
30
+ **OpalaCoder** is an autonomous coding agent built on the **[AgenticBlocks.IO](https://github.com/gilzamir/agenticblocks)** framework. It features a project-centric context model and a modular, skills-oriented architecture optimized to run efficiently with local LLMs.
31
+
32
+ ---
33
+
34
+ ## Core Architecture & Features
35
+
36
+ ### 1. Project-Centric Context
37
+ All operations happen within a named project mapped to a fixed directory. This grounds the agent's workspace, scopes file/terminal access, maintains SQLite-based project memory, and keeps LLM context windows small and focused.
38
+
39
+ ### 2. MemGPT Chat Orchestrator
40
+ The main entry point is a persistent **MemGPT Chat Orchestrator** (`MemGPTAgentBlock`). Rather than running a static intent classifier, the orchestrator converses with the user, manages long-term memory, and dynamically routes complex tasks by invoking active skills via tool-calling (`run_skill`).
41
+
42
+ ### 3. Skills-Oriented Design (Anthropic Standard)
43
+ Capabilities are defined as modular **skills** (defined via `SKILL.md` declarations and optional Level 3 python/bash scripts).
44
+ - **Opt-in Activation**: Projects declare active skills in a local `skills.yaml` file.
45
+ - **Ephemeral Sub-Agents**: When a skill is invoked, the orchestrator spawns a focused sub-agent (`LLMAgentBlock`) dedicated to executing that skill's workflow.
46
+ - **Dialogue Interceptor**: The sub-agent communicates directly with the user, and an interceptor synchronizes the exchange back to the orchestrator's memory.
47
+
48
+ ### 4. Code Generation (`implement-feature` Skill)
49
+ Software development and bug-fixing tasks are handled by the default `implement-feature` skill, running a structured Plan → Execute → Verify loop:
50
+ - **Interactive Planning**: Generates high-level task plans and refines them based on user feedback.
51
+ - **Shadow Git Checkout**: Automatically checkpoints code to an isolated repository (`.opalacoder/.git`) before plan execution, allowing instant rollback via `/undo`.
52
+ - **Auto-Linting**: Validates changes using syntax checkers (`node --check`, `py_compile`) after each file edit, letting the worker self-correct syntax errors autonomously.
53
+
54
+ ### 5. Web-Based IDE GUI (Cross-Platform)
55
+ OpalaCoder features an integrated desktop GUI built using React, Vite, and `pywebview`:
56
+ - **Cross-Platform Support**: Works seamlessly on Linux and Windows. If `pywebview` is not available, it automatically falls back to hosting a local web server and launching the interface in your default browser.
57
+ - **Integrated Terminal**: Includes a real-time xterm.js terminal with shell/PTY integration for running and inspecting commands natively.
58
+ - **Git Source Control Sidebar**: A dedicated panel that tracks file modifications (color-coded as Modified/Untracked/Deleted) and provides a commit interface.
59
+ - **Global Settings Panel**: Customize the editor font size, tab size, and word wrapping, with dynamic toggle support for Light and Dark themes.
60
+ - **About Tab**: Version tracking (currently `0.1.5 alfa`), licensing, and developer details in the settings panel.
61
+
62
+ ### 6. Persistent Projects and CLI Commands
63
+
64
+ | Command | Description |
65
+ |---|---|
66
+ | `/help` | Show available commands |
67
+ | `/clear` | Clear memory and history of the current project |
68
+ | `/rename <name>` | Rename the active project |
69
+ | `/list` | List all saved projects |
70
+ | `/load <name>` | Load an existing project |
71
+ | `/delete <name>` | Delete a project (optionally deletes its directory) |
72
+ | `/skills` | List available skills and active ones for the project |
73
+ | `/addskill <name>` / `/rmskill <name>` | Add or remove skills |
74
+ | `/undo` | Revert the last agent change via shadow VCS |
75
+ | `/commit <msg>` | Manually commit to the shadow git |
76
+ | `/exit` / `/quit` | Exit the application |
77
+
78
+ ### 7. Modular Architecture
79
+
80
+ ```text
81
+ opalacoder/
82
+ ├── cli.py Entrypoint, project loading, REPL loop
83
+ ├── memgpt_runtime.py MemGPT chat orchestrator and run_skill tool integration
84
+ ├── agents.py Agent creation helper functions
85
+ ├── config.py Global settings loader and CLI parser
86
+ ├── skills.py Skill loading, selection, and routing
87
+ ├── project.py SQLite project management and state
88
+ ├── vcs.py Shadow git strategies (auto, hybrid, agent-driven, none)
89
+ ├── ide_server.py Asynchronous HTTP and REST server hosting the IDE GUI
90
+ ├── agent_stdin.py JSON stdin/stdout protocol server for remote control
91
+ ├── code_index.py Multi-language symbol index (SQLite-backed, incremental)
92
+ ├── vector_index.py Vector index of chunks for semantic code lookup
93
+ └── tools.py Shared tool definitions (run_command, memory APIs)
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Requirements
99
+
100
+ ### 1. Core & CLI Requirements
101
+ - **Python 3.11+**
102
+ - **[agenticblocks](https://github.com/gilzamir/agenticblocks)** (install from source)
103
+ - **Local SQLite support** (standard in python)
104
+ - **Local LLM Engine (Recommended: Ollama 0.24.0+)** with models available:
105
+ - **Default & Alternative models**: `ministral-3:14b` (or `gemma4:latest`, `mistral-nemo:latest`)
106
+ - Any model supported by [litellm](https://docs.litellm.ai) works.
107
+
108
+ > [!TIP]
109
+ > **Hardware Acceleration & GPU Drivers:**
110
+ > To run large models (like `gemma4` or `ministral-3:14b`) efficiently on local backends (such as Ollama), it is highly recommended to use GPU hardware acceleration.
111
+ > - **NVIDIA GPUs**: Ensure you have official **NVIDIA Drivers** and the **CUDA Toolkit** installed so that Ollama can offload model layers to GPU VRAM.
112
+ > - **AMD & Apple Silicon**: Ollama also supports ROCm (AMD) and Metal (Apple Silicon) natively. Make sure your local setup is utilizing GPU acceleration to avoid slow CPU execution times.
113
+
114
+ ### 2. Web IDE / GUI Requirements
115
+ - **Desktop Window Mode (Optional)**: Launches a native app window using `pywebview`.
116
+ - **Windows**: Works out of the box using Windows Webview2 (Edge).
117
+ - **Linux**: Requires **WebKit2GTK** python bindings (specifically `python3-gi` and `gir1.2-webkit2-4.1`) or **Qt5/Qt6** (PyQt/PySide) installed on the system.
118
+ - **Browser Fallback**: If desktop window dependencies are missing, OpalaCoder automatically starts the IDE server and opens it in your default web browser (`http://127.0.0.1:3000`).
119
+ - **Frontend Development (Optional)**: If you intend to compile the React/Vite frontend source code under `gui_src/`, you will need **Node.js 18+** and **npm**. (Compiled assets are already bundled in default packages).
120
+
121
+ ---
122
+
123
+ ## Installation
124
+
125
+ Try:
126
+
127
+ ```bash
128
+ pip install opalacoder
129
+ ```
130
+
131
+ ```bash
132
+ git clone https://github.com/gilzamir/OpalaCoder
133
+ cd OpalaCoder
134
+
135
+ python -m venv .env
136
+ source .env/bin/activate # Linux/macOS
137
+ # .env\Scripts\activate # Windows
138
+
139
+ # Install agenticblocks from source first
140
+ pip install -e /path/to/agenticblocks
141
+
142
+ # Install OpalaCoder dependencies
143
+ pip install -r requirements.txt
144
+ ```
145
+
146
+ ### Environment Variables (Optional)
147
+
148
+ ```env
149
+ # Override default model (any litellm-supported string)
150
+ OPALA_MODEL=ollama/ministral-3:14b
151
+ ```
152
+
153
+ ---
154
+
155
+ ## How to Run
156
+
157
+ OpalaCoder supports three main execution modes:
158
+
159
+ ### 1. Interactive CLI REPL (Default)
160
+ Starts the standard CLI terminal planner/execution loop:
161
+ ```bash
162
+ source .env/bin/activate
163
+ python main.py # default (plan mode)
164
+ python main.py --mode auto # run without interruptions
165
+ python main.py --mode edit # confirm sensitive operations
166
+ python main.py --model ollama/gemma4 # override model
167
+ python main.py --db /path/to/db # custom database path
168
+ python main.py --version
169
+ python main.py --help
170
+ ```
171
+
172
+ ### 2. Web-Based IDE GUI
173
+ Launches the integrated React desktop application. It opens as a local app window (via `pywebview`) or falls back to your web browser:
174
+ ```bash
175
+ source .env/bin/activate
176
+ python main.py --gui
177
+ ```
178
+
179
+ ### 3. Stdin/Stdout JSON Protocol Server
180
+ Launches the agent in background headless mode, communicating via single-line JSON messages:
181
+ ```bash
182
+ source .env/bin/activate
183
+ python main.py --stdin
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Compiling Frontend GUI (Optional)
189
+
190
+ If you are developing or making changes to the React GUI, you can recompile the assets:
191
+ ```bash
192
+ cd gui_src
193
+ npm install
194
+ npm run build
195
+ ```
196
+ This builds the SPA bundle and saves it directly into the Python package distribution at `opalacoder/gui/`.
197
+
198
+ ## Project Flow
199
+
200
+ ```text
201
+ main() or `--gui` (server mode)
202
+
203
+ ├── startup_menu() ───────── Load/Create project, discover skills (via skills.yaml)
204
+
205
+ └── repl_loop() ──────────── Instantiate MemGPT chat-orchestrator
206
+
207
+ ├── User enters command (e.g. `/help`, `/undo`) ── Dispatched to CLI commands
208
+
209
+ └── User enters demand ────────────────────────── MemGPT.run(user_input)
210
+
211
+ ├── Direct chat (greetings, project status, general questions)
212
+
213
+ └── Request matches active skill ───────────── run_skill(name, context)
214
+
215
+ ├── Instantiate ephemeral sub-agent (LLMAgentBlock)
216
+ ├── Sub-agent loads SKILL.md and Level 3 scripts (e.g. implement-feature)
217
+ ├── Sub-agent executes with tools, talks to user (dialogue interceptor)
218
+ └── Return result to MemGPT orchestrator
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Configuration (`agents.yaml`)
224
+
225
+ The main configuration file. Key fields and role overrides:
226
+
227
+ ```yaml
228
+ default: ollama/ministral-3:14b # default model for all agents
229
+ alternative: ollama/ministral-3:14b # model for complex tasks
230
+
231
+ llm_defaults:
232
+ temperature: 1.0
233
+ max_tokens: 8128
234
+ num_ctx: 8192
235
+
236
+ agents:
237
+ # The fixed chat-orchestrator of the skills-oriented architecture.
238
+ memgpt:
239
+ temperature: 1.0
240
+ num_ctx: 16384
241
+ max_heartbeats: 20
242
+
243
+ # drives the plan→execute→review loop inside the implement-feature skill
244
+ orchestrator:
245
+ temperature: 1.0
246
+ num_ctx: 16384
247
+ max_heartbeats: 20
248
+ strategy: workflow
249
+
250
+ # executes each task command with code editing tools
251
+ worker:
252
+ temperature: 1.0
253
+ max_tokens: 8128
254
+ num_ctx: 16384
255
+ reasoning_effort: "none" # Must stay "none" for tool-calling integration
256
+ ```
257
+
258
+ Full per-agent overrides for `temperature`, `max_tokens`, `num_ctx`, `reasoning_effort`, and `debug` are supported for every agent role.
259
+
260
+ ---
261
+
262
+ ## Benchmark
263
+
264
+ A JS bug-fix benchmark is included in `scripts/`:
265
+
266
+ ```bash
267
+ # Collect instances from GitHub (requires gh CLI authenticated)
268
+ python scripts/collect_jsbench.py --limit 50 --out datasets/jsbench
269
+
270
+ # Evaluate OpalaCoder on collected instances
271
+ python scripts/eval_jsbench.py --limit 10
272
+ ```
273
+
274
+ Results are written to `datasets/jsbench_results.json` with per-instance pass/fail and a summary fix rate.
275
+
276
+ ---
277
+
278
+ ## Build & Test
279
+
280
+ ```bash
281
+ python -m pytest tests/ -q
282
+ ```
283
+
284
+ ---
285
+
286
+ ## License
287
+
288
+ MIT
@@ -0,0 +1,261 @@
1
+ # OpalaCoder
2
+
3
+ **OpalaCoder** is an autonomous coding agent built on the **[AgenticBlocks.IO](https://github.com/gilzamir/agenticblocks)** framework. It features a project-centric context model and a modular, skills-oriented architecture optimized to run efficiently with local LLMs.
4
+
5
+ ---
6
+
7
+ ## Core Architecture & Features
8
+
9
+ ### 1. Project-Centric Context
10
+ All operations happen within a named project mapped to a fixed directory. This grounds the agent's workspace, scopes file/terminal access, maintains SQLite-based project memory, and keeps LLM context windows small and focused.
11
+
12
+ ### 2. MemGPT Chat Orchestrator
13
+ The main entry point is a persistent **MemGPT Chat Orchestrator** (`MemGPTAgentBlock`). Rather than running a static intent classifier, the orchestrator converses with the user, manages long-term memory, and dynamically routes complex tasks by invoking active skills via tool-calling (`run_skill`).
14
+
15
+ ### 3. Skills-Oriented Design (Anthropic Standard)
16
+ Capabilities are defined as modular **skills** (defined via `SKILL.md` declarations and optional Level 3 python/bash scripts).
17
+ - **Opt-in Activation**: Projects declare active skills in a local `skills.yaml` file.
18
+ - **Ephemeral Sub-Agents**: When a skill is invoked, the orchestrator spawns a focused sub-agent (`LLMAgentBlock`) dedicated to executing that skill's workflow.
19
+ - **Dialogue Interceptor**: The sub-agent communicates directly with the user, and an interceptor synchronizes the exchange back to the orchestrator's memory.
20
+
21
+ ### 4. Code Generation (`implement-feature` Skill)
22
+ Software development and bug-fixing tasks are handled by the default `implement-feature` skill, running a structured Plan → Execute → Verify loop:
23
+ - **Interactive Planning**: Generates high-level task plans and refines them based on user feedback.
24
+ - **Shadow Git Checkout**: Automatically checkpoints code to an isolated repository (`.opalacoder/.git`) before plan execution, allowing instant rollback via `/undo`.
25
+ - **Auto-Linting**: Validates changes using syntax checkers (`node --check`, `py_compile`) after each file edit, letting the worker self-correct syntax errors autonomously.
26
+
27
+ ### 5. Web-Based IDE GUI (Cross-Platform)
28
+ OpalaCoder features an integrated desktop GUI built using React, Vite, and `pywebview`:
29
+ - **Cross-Platform Support**: Works seamlessly on Linux and Windows. If `pywebview` is not available, it automatically falls back to hosting a local web server and launching the interface in your default browser.
30
+ - **Integrated Terminal**: Includes a real-time xterm.js terminal with shell/PTY integration for running and inspecting commands natively.
31
+ - **Git Source Control Sidebar**: A dedicated panel that tracks file modifications (color-coded as Modified/Untracked/Deleted) and provides a commit interface.
32
+ - **Global Settings Panel**: Customize the editor font size, tab size, and word wrapping, with dynamic toggle support for Light and Dark themes.
33
+ - **About Tab**: Version tracking (currently `0.1.5 alfa`), licensing, and developer details in the settings panel.
34
+
35
+ ### 6. Persistent Projects and CLI Commands
36
+
37
+ | Command | Description |
38
+ |---|---|
39
+ | `/help` | Show available commands |
40
+ | `/clear` | Clear memory and history of the current project |
41
+ | `/rename <name>` | Rename the active project |
42
+ | `/list` | List all saved projects |
43
+ | `/load <name>` | Load an existing project |
44
+ | `/delete <name>` | Delete a project (optionally deletes its directory) |
45
+ | `/skills` | List available skills and active ones for the project |
46
+ | `/addskill <name>` / `/rmskill <name>` | Add or remove skills |
47
+ | `/undo` | Revert the last agent change via shadow VCS |
48
+ | `/commit <msg>` | Manually commit to the shadow git |
49
+ | `/exit` / `/quit` | Exit the application |
50
+
51
+ ### 7. Modular Architecture
52
+
53
+ ```text
54
+ opalacoder/
55
+ ├── cli.py Entrypoint, project loading, REPL loop
56
+ ├── memgpt_runtime.py MemGPT chat orchestrator and run_skill tool integration
57
+ ├── agents.py Agent creation helper functions
58
+ ├── config.py Global settings loader and CLI parser
59
+ ├── skills.py Skill loading, selection, and routing
60
+ ├── project.py SQLite project management and state
61
+ ├── vcs.py Shadow git strategies (auto, hybrid, agent-driven, none)
62
+ ├── ide_server.py Asynchronous HTTP and REST server hosting the IDE GUI
63
+ ├── agent_stdin.py JSON stdin/stdout protocol server for remote control
64
+ ├── code_index.py Multi-language symbol index (SQLite-backed, incremental)
65
+ ├── vector_index.py Vector index of chunks for semantic code lookup
66
+ └── tools.py Shared tool definitions (run_command, memory APIs)
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Requirements
72
+
73
+ ### 1. Core & CLI Requirements
74
+ - **Python 3.11+**
75
+ - **[agenticblocks](https://github.com/gilzamir/agenticblocks)** (install from source)
76
+ - **Local SQLite support** (standard in python)
77
+ - **Local LLM Engine (Recommended: Ollama 0.24.0+)** with models available:
78
+ - **Default & Alternative models**: `ministral-3:14b` (or `gemma4:latest`, `mistral-nemo:latest`)
79
+ - Any model supported by [litellm](https://docs.litellm.ai) works.
80
+
81
+ > [!TIP]
82
+ > **Hardware Acceleration & GPU Drivers:**
83
+ > To run large models (like `gemma4` or `ministral-3:14b`) efficiently on local backends (such as Ollama), it is highly recommended to use GPU hardware acceleration.
84
+ > - **NVIDIA GPUs**: Ensure you have official **NVIDIA Drivers** and the **CUDA Toolkit** installed so that Ollama can offload model layers to GPU VRAM.
85
+ > - **AMD & Apple Silicon**: Ollama also supports ROCm (AMD) and Metal (Apple Silicon) natively. Make sure your local setup is utilizing GPU acceleration to avoid slow CPU execution times.
86
+
87
+ ### 2. Web IDE / GUI Requirements
88
+ - **Desktop Window Mode (Optional)**: Launches a native app window using `pywebview`.
89
+ - **Windows**: Works out of the box using Windows Webview2 (Edge).
90
+ - **Linux**: Requires **WebKit2GTK** python bindings (specifically `python3-gi` and `gir1.2-webkit2-4.1`) or **Qt5/Qt6** (PyQt/PySide) installed on the system.
91
+ - **Browser Fallback**: If desktop window dependencies are missing, OpalaCoder automatically starts the IDE server and opens it in your default web browser (`http://127.0.0.1:3000`).
92
+ - **Frontend Development (Optional)**: If you intend to compile the React/Vite frontend source code under `gui_src/`, you will need **Node.js 18+** and **npm**. (Compiled assets are already bundled in default packages).
93
+
94
+ ---
95
+
96
+ ## Installation
97
+
98
+ Try:
99
+
100
+ ```bash
101
+ pip install opalacoder
102
+ ```
103
+
104
+ ```bash
105
+ git clone https://github.com/gilzamir/OpalaCoder
106
+ cd OpalaCoder
107
+
108
+ python -m venv .env
109
+ source .env/bin/activate # Linux/macOS
110
+ # .env\Scripts\activate # Windows
111
+
112
+ # Install agenticblocks from source first
113
+ pip install -e /path/to/agenticblocks
114
+
115
+ # Install OpalaCoder dependencies
116
+ pip install -r requirements.txt
117
+ ```
118
+
119
+ ### Environment Variables (Optional)
120
+
121
+ ```env
122
+ # Override default model (any litellm-supported string)
123
+ OPALA_MODEL=ollama/ministral-3:14b
124
+ ```
125
+
126
+ ---
127
+
128
+ ## How to Run
129
+
130
+ OpalaCoder supports three main execution modes:
131
+
132
+ ### 1. Interactive CLI REPL (Default)
133
+ Starts the standard CLI terminal planner/execution loop:
134
+ ```bash
135
+ source .env/bin/activate
136
+ python main.py # default (plan mode)
137
+ python main.py --mode auto # run without interruptions
138
+ python main.py --mode edit # confirm sensitive operations
139
+ python main.py --model ollama/gemma4 # override model
140
+ python main.py --db /path/to/db # custom database path
141
+ python main.py --version
142
+ python main.py --help
143
+ ```
144
+
145
+ ### 2. Web-Based IDE GUI
146
+ Launches the integrated React desktop application. It opens as a local app window (via `pywebview`) or falls back to your web browser:
147
+ ```bash
148
+ source .env/bin/activate
149
+ python main.py --gui
150
+ ```
151
+
152
+ ### 3. Stdin/Stdout JSON Protocol Server
153
+ Launches the agent in background headless mode, communicating via single-line JSON messages:
154
+ ```bash
155
+ source .env/bin/activate
156
+ python main.py --stdin
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Compiling Frontend GUI (Optional)
162
+
163
+ If you are developing or making changes to the React GUI, you can recompile the assets:
164
+ ```bash
165
+ cd gui_src
166
+ npm install
167
+ npm run build
168
+ ```
169
+ This builds the SPA bundle and saves it directly into the Python package distribution at `opalacoder/gui/`.
170
+
171
+ ## Project Flow
172
+
173
+ ```text
174
+ main() or `--gui` (server mode)
175
+
176
+ ├── startup_menu() ───────── Load/Create project, discover skills (via skills.yaml)
177
+
178
+ └── repl_loop() ──────────── Instantiate MemGPT chat-orchestrator
179
+
180
+ ├── User enters command (e.g. `/help`, `/undo`) ── Dispatched to CLI commands
181
+
182
+ └── User enters demand ────────────────────────── MemGPT.run(user_input)
183
+
184
+ ├── Direct chat (greetings, project status, general questions)
185
+
186
+ └── Request matches active skill ───────────── run_skill(name, context)
187
+
188
+ ├── Instantiate ephemeral sub-agent (LLMAgentBlock)
189
+ ├── Sub-agent loads SKILL.md and Level 3 scripts (e.g. implement-feature)
190
+ ├── Sub-agent executes with tools, talks to user (dialogue interceptor)
191
+ └── Return result to MemGPT orchestrator
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Configuration (`agents.yaml`)
197
+
198
+ The main configuration file. Key fields and role overrides:
199
+
200
+ ```yaml
201
+ default: ollama/ministral-3:14b # default model for all agents
202
+ alternative: ollama/ministral-3:14b # model for complex tasks
203
+
204
+ llm_defaults:
205
+ temperature: 1.0
206
+ max_tokens: 8128
207
+ num_ctx: 8192
208
+
209
+ agents:
210
+ # The fixed chat-orchestrator of the skills-oriented architecture.
211
+ memgpt:
212
+ temperature: 1.0
213
+ num_ctx: 16384
214
+ max_heartbeats: 20
215
+
216
+ # drives the plan→execute→review loop inside the implement-feature skill
217
+ orchestrator:
218
+ temperature: 1.0
219
+ num_ctx: 16384
220
+ max_heartbeats: 20
221
+ strategy: workflow
222
+
223
+ # executes each task command with code editing tools
224
+ worker:
225
+ temperature: 1.0
226
+ max_tokens: 8128
227
+ num_ctx: 16384
228
+ reasoning_effort: "none" # Must stay "none" for tool-calling integration
229
+ ```
230
+
231
+ Full per-agent overrides for `temperature`, `max_tokens`, `num_ctx`, `reasoning_effort`, and `debug` are supported for every agent role.
232
+
233
+ ---
234
+
235
+ ## Benchmark
236
+
237
+ A JS bug-fix benchmark is included in `scripts/`:
238
+
239
+ ```bash
240
+ # Collect instances from GitHub (requires gh CLI authenticated)
241
+ python scripts/collect_jsbench.py --limit 50 --out datasets/jsbench
242
+
243
+ # Evaluate OpalaCoder on collected instances
244
+ python scripts/eval_jsbench.py --limit 10
245
+ ```
246
+
247
+ Results are written to `datasets/jsbench_results.json` with per-instance pass/fail and a summary fix rate.
248
+
249
+ ---
250
+
251
+ ## Build & Test
252
+
253
+ ```bash
254
+ python -m pytest tests/ -q
255
+ ```
256
+
257
+ ---
258
+
259
+ ## License
260
+
261
+ MIT