mita-code 0.1.0__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 (66) hide show
  1. mita_code-0.1.0/LICENSE +201 -0
  2. mita_code-0.1.0/PKG-INFO +227 -0
  3. mita_code-0.1.0/README.md +184 -0
  4. mita_code-0.1.0/pyproject.toml +90 -0
  5. mita_code-0.1.0/src/mita/__init__.py +5 -0
  6. mita_code-0.1.0/src/mita/__main__.py +5 -0
  7. mita_code-0.1.0/src/mita/agent/__init__.py +1 -0
  8. mita_code-0.1.0/src/mita/agent/context.py +43 -0
  9. mita_code-0.1.0/src/mita/agent/conversation.py +101 -0
  10. mita_code-0.1.0/src/mita/agent/loop.py +594 -0
  11. mita_code-0.1.0/src/mita/agent/system_prompt.py +75 -0
  12. mita_code-0.1.0/src/mita/cli.py +940 -0
  13. mita_code-0.1.0/src/mita/config/__init__.py +6 -0
  14. mita_code-0.1.0/src/mita/config/defaults.py +41 -0
  15. mita_code-0.1.0/src/mita/config/loader.py +53 -0
  16. mita_code-0.1.0/src/mita/config/schema.py +131 -0
  17. mita_code-0.1.0/src/mita/hooks/__init__.py +1 -0
  18. mita_code-0.1.0/src/mita/hooks/manager.py +94 -0
  19. mita_code-0.1.0/src/mita/hooks/runner.py +145 -0
  20. mita_code-0.1.0/src/mita/index/__init__.py +1 -0
  21. mita_code-0.1.0/src/mita/index/embeddings.py +49 -0
  22. mita_code-0.1.0/src/mita/index/manager.py +170 -0
  23. mita_code-0.1.0/src/mita/index/parser.py +331 -0
  24. mita_code-0.1.0/src/mita/index/retriever.py +53 -0
  25. mita_code-0.1.0/src/mita/index/store.py +143 -0
  26. mita_code-0.1.0/src/mita/llm/__init__.py +1 -0
  27. mita_code-0.1.0/src/mita/llm/client.py +86 -0
  28. mita_code-0.1.0/src/mita/llm/instructor.py +80 -0
  29. mita_code-0.1.0/src/mita/llm/streaming.py +58 -0
  30. mita_code-0.1.0/src/mita/memory/__init__.py +6 -0
  31. mita_code-0.1.0/src/mita/memory/discovery.py +61 -0
  32. mita_code-0.1.0/src/mita/memory/loader.py +76 -0
  33. mita_code-0.1.0/src/mita/memory/manager.py +117 -0
  34. mita_code-0.1.0/src/mita/models/__init__.py +13 -0
  35. mita_code-0.1.0/src/mita/models/hardware.py +289 -0
  36. mita_code-0.1.0/src/mita/models/manager.py +268 -0
  37. mita_code-0.1.0/src/mita/models/ollama_client.py +104 -0
  38. mita_code-0.1.0/src/mita/models/recommender.py +88 -0
  39. mita_code-0.1.0/src/mita/models/registry.py +167 -0
  40. mita_code-0.1.0/src/mita/models/server.py +262 -0
  41. mita_code-0.1.0/src/mita/plugins/__init__.py +1 -0
  42. mita_code-0.1.0/src/mita/plugins/client.py +152 -0
  43. mita_code-0.1.0/src/mita/plugins/manager.py +210 -0
  44. mita_code-0.1.0/src/mita/py.typed +0 -0
  45. mita_code-0.1.0/src/mita/skills/__init__.py +1 -0
  46. mita_code-0.1.0/src/mita/skills/executor.py +84 -0
  47. mita_code-0.1.0/src/mita/skills/loader.py +117 -0
  48. mita_code-0.1.0/src/mita/skills/manager.py +129 -0
  49. mita_code-0.1.0/src/mita/tools/__init__.py +1 -0
  50. mita_code-0.1.0/src/mita/tools/builtins/__init__.py +28 -0
  51. mita_code-0.1.0/src/mita/tools/builtins/file_edit.py +71 -0
  52. mita_code-0.1.0/src/mita/tools/builtins/file_read.py +74 -0
  53. mita_code-0.1.0/src/mita/tools/builtins/file_write.py +42 -0
  54. mita_code-0.1.0/src/mita/tools/builtins/git.py +112 -0
  55. mita_code-0.1.0/src/mita/tools/builtins/glob_tool.py +67 -0
  56. mita_code-0.1.0/src/mita/tools/builtins/grep_tool.py +93 -0
  57. mita_code-0.1.0/src/mita/tools/builtins/shell.py +83 -0
  58. mita_code-0.1.0/src/mita/tools/executor.py +80 -0
  59. mita_code-0.1.0/src/mita/tools/registry.py +69 -0
  60. mita_code-0.1.0/src/mita/tools/safety.py +91 -0
  61. mita_code-0.1.0/src/mita/tools/schema.py +87 -0
  62. mita_code-0.1.0/src/mita/ui/__init__.py +1 -0
  63. mita_code-0.1.0/src/mita/ui/display.py +139 -0
  64. mita_code-0.1.0/src/mita/ui/repl.py +88 -0
  65. mita_code-0.1.0/src/mita/ui/spinner.py +48 -0
  66. mita_code-0.1.0/src/mita/ui/theme.py +23 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: mita-code
3
+ Version: 0.1.0
4
+ Summary: Local-first, terminal-native agentic coding assistant powered by Ollama
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: cli,coding-assistant,ollama,llm,local,agentic
8
+ Author: James Williams
9
+ Author-email: james.williams@jtdub.com
10
+ Requires-Python: >=3.11,<4.0
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: instructor (>=1.14.5,<2.0.0)
23
+ Requires-Dist: lancedb (==0.25.3)
24
+ Requires-Dist: litellm (>=1.82.0,<2.0.0)
25
+ Requires-Dist: mcp (>=1.0.0)
26
+ Requires-Dist: ollama (>=0.3.0)
27
+ Requires-Dist: pandas (>=3.0.1,<4.0.0)
28
+ Requires-Dist: prompt-toolkit (>=3.0.52,<4.0.0)
29
+ Requires-Dist: psutil (>=5.9.0)
30
+ Requires-Dist: pydantic (>=2.0.0)
31
+ Requires-Dist: pyyaml (>=6.0)
32
+ Requires-Dist: rich (>=13.0.0)
33
+ Requires-Dist: tree-sitter (>=0.23.0)
34
+ Requires-Dist: tree-sitter-language-pack (>=0.6.0)
35
+ Requires-Dist: typer (>=0.9.0)
36
+ Project-URL: Changelog, https://github.com/jtdub/mita-code/blob/develop/CHANGELOG.md
37
+ Project-URL: Documentation, https://mita-code.readthedocs.io/
38
+ Project-URL: Homepage, https://github.com/jtdub/mita-code
39
+ Project-URL: Issues, https://github.com/jtdub/mita-code/issues
40
+ Project-URL: Repository, https://github.com/jtdub/mita-code
41
+ Description-Content-Type: text/markdown
42
+
43
+ # Mita Code
44
+
45
+ [![CI](https://github.com/jtdub/mita-code/actions/workflows/ci.yml/badge.svg)](https://github.com/jtdub/mita-code/actions/workflows/ci.yml)
46
+ [![PyPI version](https://img.shields.io/pypi/v/mita-code)](https://pypi.org/project/mita-code/)
47
+ [![Python](https://img.shields.io/pypi/pyversions/mita-code)](https://pypi.org/project/mita-code/)
48
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
49
+ [![Docs](https://readthedocs.org/projects/mita-code/badge/?version=latest)](https://mita-code.readthedocs.io/)
50
+
51
+ A local-first, terminal-native agentic coding assistant that runs LLMs entirely on your machine via [Ollama](https://ollama.com). No API keys. No cloud. No telemetry.
52
+
53
+ ## Features
54
+
55
+ - **100% Local** — All inference runs on your hardware via Ollama. Your code never leaves your machine.
56
+ - **Agentic Tool Loop** — Read/write files, run shell commands, git operations — with confirmation for destructive actions.
57
+ - **Hardware-Aware Model Recommendations** — Detects your RAM, VRAM, and GPU to recommend models that will actually run well.
58
+ - **MCP Plugin System** — Compatible with the existing [Model Context Protocol](https://modelcontextprotocol.io/) ecosystem (stdio and SSE transport).
59
+ - **Skills** — Reusable, parameterized prompt templates stored as Markdown files (e.g., `/commit`, `/review`).
60
+ - **Layered Memory** — `MITA.md` files at global, project, and directory scope are automatically injected into context.
61
+ - **Layered Config** — TOML configuration cascades from global to project level.
62
+ - **Hooks** — Lifecycle shell commands that fire on events like file writes or tool calls.
63
+ - **Codebase Indexing** — Local vector search (LanceDB + Tree-sitter) for RAG over your codebase.
64
+ - **Unix Philosophy** — Composable, pipeable, scriptable.
65
+
66
+ ## Requirements
67
+
68
+ - Python 3.11+
69
+ - [Ollama](https://ollama.com) installed and running
70
+
71
+ ## Installation
72
+
73
+ ```bash
74
+ pipx install mita-code
75
+ ```
76
+
77
+ Or for development:
78
+
79
+ ```bash
80
+ git clone https://github.com/jtdub/mita-code.git
81
+ cd mita-code
82
+ poetry install
83
+ ```
84
+
85
+ ## Quick Start
86
+
87
+ ```bash
88
+ # Start Ollama (if not already running)
89
+ ollama serve
90
+
91
+ # Pull a coding model
92
+ mita models pull qwen2.5-coder:7b
93
+
94
+ # Start an interactive session
95
+ mita chat
96
+
97
+ # Or ask a single question
98
+ mita ask "explain the auth module in this project"
99
+ ```
100
+
101
+ ## Usage
102
+
103
+ ### Interactive Chat
104
+
105
+ ```bash
106
+ mita chat # Start agentic chat session
107
+ mita chat --model deepseek-coder-v2:16b # Use a specific model
108
+ mita chat --no-tools # Pure chat, no tool execution
109
+ ```
110
+
111
+ ### Single-Shot Prompts
112
+
113
+ ```bash
114
+ mita ask "refactor this function to use async"
115
+ cat error.log | mita ask "what went wrong?"
116
+ ```
117
+
118
+ ### Model Management
119
+
120
+ ```bash
121
+ mita models recommend # See what fits your hardware
122
+ mita models list # List installed models
123
+ mita models pull qwen2.5-coder:14b # Pull a model
124
+ mita models default qwen2.5-coder:14b # Set as default
125
+ ```
126
+
127
+ ### Memory
128
+
129
+ ```bash
130
+ mita memory show # View all active memory
131
+ mita memory add "Always use pytest" --project # Add project-level memory
132
+ mita memory edit # Edit nearest MITA.md
133
+ ```
134
+
135
+ ### Codebase Indexing
136
+
137
+ ```bash
138
+ mita index build # Index the current project
139
+ mita index search "database connection" # Search the index
140
+ ```
141
+
142
+ ### Skills
143
+
144
+ ```bash
145
+ mita skills list # List available skills
146
+ # In chat, use /skill_name to invoke:
147
+ # mita> /commit
148
+ # mita> /review
149
+ ```
150
+
151
+ ### Plugins (MCP)
152
+
153
+ ```bash
154
+ mita plugins add filesystem --command "npx @modelcontextprotocol/server-filesystem ."
155
+ mita plugins list # List plugins and their tools
156
+ ```
157
+
158
+ ### Configuration
159
+
160
+ ```bash
161
+ mita config show # Show merged configuration
162
+ mita config edit --global # Edit global config
163
+ mita config set model.default "qwen2.5-coder:14b"
164
+ ```
165
+
166
+ ### Diagnostics
167
+
168
+ ```bash
169
+ mita doctor # Check Ollama, models, config health
170
+ ```
171
+
172
+ ## Configuration
173
+
174
+ Global config lives at `~/.config/mita/config.toml`. Project-level overrides go in `.mita/settings.toml`.
175
+
176
+ ```toml
177
+ [model]
178
+ default = "qwen2.5-coder:7b"
179
+ temperature = 0.1
180
+
181
+ [tools]
182
+ auto_approve = ["file_read", "glob", "grep"]
183
+ confirm_destructive = true
184
+
185
+ [index]
186
+ enabled = true
187
+ top_k = 10
188
+ ```
189
+
190
+ See [PLANNING.md](PLANNING.md) for the full configuration schema.
191
+
192
+ ## Memory System
193
+
194
+ Mita uses layered `MITA.md` files that are automatically discovered and injected into context:
195
+
196
+ | Scope | Location | Purpose |
197
+ |---|---|---|
198
+ | Global | `~/.config/mita/MITA.md` | Preferences across all projects |
199
+ | Project | `<project_root>/MITA.md` | Project-specific conventions |
200
+ | Directory | `<subdir>/MITA.md` | Directory-specific context |
201
+
202
+ Higher-specificity files take priority. Each file is capped at 200 lines.
203
+
204
+ ## Tech Stack
205
+
206
+ | Component | Library |
207
+ |---|---|
208
+ | CLI | [Typer](https://typer.tiangolo.com/) |
209
+ | Terminal UI | [Rich](https://rich.readthedocs.io/) |
210
+ | LLM Runtime | [Ollama](https://ollama.com) |
211
+ | LLM Client | [LiteLLM](https://github.com/BerriAI/litellm) |
212
+ | Structured Output | [Instructor](https://github.com/instructor-ai/instructor) |
213
+ | Vector Store | [LanceDB](https://lancedb.com/) |
214
+ | Code Parsing | [Tree-sitter](https://tree-sitter.github.io/) |
215
+ | Config | TOML (stdlib `tomllib`) |
216
+ | Plugins | [MCP](https://modelcontextprotocol.io/) |
217
+
218
+ ## Contributing
219
+
220
+ See [PLANNING.md](PLANNING.md) for the full project plan, architecture, and build phases.
221
+
222
+ Full documentation is available at [mita-code.readthedocs.io](https://mita-code.readthedocs.io/).
223
+
224
+ ## License
225
+
226
+ Apache 2.0 — see [LICENSE](LICENSE).
227
+
@@ -0,0 +1,184 @@
1
+ # Mita Code
2
+
3
+ [![CI](https://github.com/jtdub/mita-code/actions/workflows/ci.yml/badge.svg)](https://github.com/jtdub/mita-code/actions/workflows/ci.yml)
4
+ [![PyPI version](https://img.shields.io/pypi/v/mita-code)](https://pypi.org/project/mita-code/)
5
+ [![Python](https://img.shields.io/pypi/pyversions/mita-code)](https://pypi.org/project/mita-code/)
6
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
+ [![Docs](https://readthedocs.org/projects/mita-code/badge/?version=latest)](https://mita-code.readthedocs.io/)
8
+
9
+ A local-first, terminal-native agentic coding assistant that runs LLMs entirely on your machine via [Ollama](https://ollama.com). No API keys. No cloud. No telemetry.
10
+
11
+ ## Features
12
+
13
+ - **100% Local** — All inference runs on your hardware via Ollama. Your code never leaves your machine.
14
+ - **Agentic Tool Loop** — Read/write files, run shell commands, git operations — with confirmation for destructive actions.
15
+ - **Hardware-Aware Model Recommendations** — Detects your RAM, VRAM, and GPU to recommend models that will actually run well.
16
+ - **MCP Plugin System** — Compatible with the existing [Model Context Protocol](https://modelcontextprotocol.io/) ecosystem (stdio and SSE transport).
17
+ - **Skills** — Reusable, parameterized prompt templates stored as Markdown files (e.g., `/commit`, `/review`).
18
+ - **Layered Memory** — `MITA.md` files at global, project, and directory scope are automatically injected into context.
19
+ - **Layered Config** — TOML configuration cascades from global to project level.
20
+ - **Hooks** — Lifecycle shell commands that fire on events like file writes or tool calls.
21
+ - **Codebase Indexing** — Local vector search (LanceDB + Tree-sitter) for RAG over your codebase.
22
+ - **Unix Philosophy** — Composable, pipeable, scriptable.
23
+
24
+ ## Requirements
25
+
26
+ - Python 3.11+
27
+ - [Ollama](https://ollama.com) installed and running
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pipx install mita-code
33
+ ```
34
+
35
+ Or for development:
36
+
37
+ ```bash
38
+ git clone https://github.com/jtdub/mita-code.git
39
+ cd mita-code
40
+ poetry install
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ ```bash
46
+ # Start Ollama (if not already running)
47
+ ollama serve
48
+
49
+ # Pull a coding model
50
+ mita models pull qwen2.5-coder:7b
51
+
52
+ # Start an interactive session
53
+ mita chat
54
+
55
+ # Or ask a single question
56
+ mita ask "explain the auth module in this project"
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ ### Interactive Chat
62
+
63
+ ```bash
64
+ mita chat # Start agentic chat session
65
+ mita chat --model deepseek-coder-v2:16b # Use a specific model
66
+ mita chat --no-tools # Pure chat, no tool execution
67
+ ```
68
+
69
+ ### Single-Shot Prompts
70
+
71
+ ```bash
72
+ mita ask "refactor this function to use async"
73
+ cat error.log | mita ask "what went wrong?"
74
+ ```
75
+
76
+ ### Model Management
77
+
78
+ ```bash
79
+ mita models recommend # See what fits your hardware
80
+ mita models list # List installed models
81
+ mita models pull qwen2.5-coder:14b # Pull a model
82
+ mita models default qwen2.5-coder:14b # Set as default
83
+ ```
84
+
85
+ ### Memory
86
+
87
+ ```bash
88
+ mita memory show # View all active memory
89
+ mita memory add "Always use pytest" --project # Add project-level memory
90
+ mita memory edit # Edit nearest MITA.md
91
+ ```
92
+
93
+ ### Codebase Indexing
94
+
95
+ ```bash
96
+ mita index build # Index the current project
97
+ mita index search "database connection" # Search the index
98
+ ```
99
+
100
+ ### Skills
101
+
102
+ ```bash
103
+ mita skills list # List available skills
104
+ # In chat, use /skill_name to invoke:
105
+ # mita> /commit
106
+ # mita> /review
107
+ ```
108
+
109
+ ### Plugins (MCP)
110
+
111
+ ```bash
112
+ mita plugins add filesystem --command "npx @modelcontextprotocol/server-filesystem ."
113
+ mita plugins list # List plugins and their tools
114
+ ```
115
+
116
+ ### Configuration
117
+
118
+ ```bash
119
+ mita config show # Show merged configuration
120
+ mita config edit --global # Edit global config
121
+ mita config set model.default "qwen2.5-coder:14b"
122
+ ```
123
+
124
+ ### Diagnostics
125
+
126
+ ```bash
127
+ mita doctor # Check Ollama, models, config health
128
+ ```
129
+
130
+ ## Configuration
131
+
132
+ Global config lives at `~/.config/mita/config.toml`. Project-level overrides go in `.mita/settings.toml`.
133
+
134
+ ```toml
135
+ [model]
136
+ default = "qwen2.5-coder:7b"
137
+ temperature = 0.1
138
+
139
+ [tools]
140
+ auto_approve = ["file_read", "glob", "grep"]
141
+ confirm_destructive = true
142
+
143
+ [index]
144
+ enabled = true
145
+ top_k = 10
146
+ ```
147
+
148
+ See [PLANNING.md](PLANNING.md) for the full configuration schema.
149
+
150
+ ## Memory System
151
+
152
+ Mita uses layered `MITA.md` files that are automatically discovered and injected into context:
153
+
154
+ | Scope | Location | Purpose |
155
+ |---|---|---|
156
+ | Global | `~/.config/mita/MITA.md` | Preferences across all projects |
157
+ | Project | `<project_root>/MITA.md` | Project-specific conventions |
158
+ | Directory | `<subdir>/MITA.md` | Directory-specific context |
159
+
160
+ Higher-specificity files take priority. Each file is capped at 200 lines.
161
+
162
+ ## Tech Stack
163
+
164
+ | Component | Library |
165
+ |---|---|
166
+ | CLI | [Typer](https://typer.tiangolo.com/) |
167
+ | Terminal UI | [Rich](https://rich.readthedocs.io/) |
168
+ | LLM Runtime | [Ollama](https://ollama.com) |
169
+ | LLM Client | [LiteLLM](https://github.com/BerriAI/litellm) |
170
+ | Structured Output | [Instructor](https://github.com/instructor-ai/instructor) |
171
+ | Vector Store | [LanceDB](https://lancedb.com/) |
172
+ | Code Parsing | [Tree-sitter](https://tree-sitter.github.io/) |
173
+ | Config | TOML (stdlib `tomllib`) |
174
+ | Plugins | [MCP](https://modelcontextprotocol.io/) |
175
+
176
+ ## Contributing
177
+
178
+ See [PLANNING.md](PLANNING.md) for the full project plan, architecture, and build phases.
179
+
180
+ Full documentation is available at [mita-code.readthedocs.io](https://mita-code.readthedocs.io/).
181
+
182
+ ## License
183
+
184
+ Apache 2.0 — see [LICENSE](LICENSE).