lathe-agent 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.
- lathe_agent-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- lathe_agent-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
- lathe_agent-0.1.0/.github/pull_request_template.md +22 -0
- lathe_agent-0.1.0/.github/workflows/ci.yml +54 -0
- lathe_agent-0.1.0/.github/workflows/docs.yml +31 -0
- lathe_agent-0.1.0/.github/workflows/release.yml +121 -0
- lathe_agent-0.1.0/.gitignore +59 -0
- lathe_agent-0.1.0/.pre-commit-config.yaml +19 -0
- lathe_agent-0.1.0/.python-version +1 -0
- lathe_agent-0.1.0/ARCHITECTURE.md +100 -0
- lathe_agent-0.1.0/CHANGELOG.md +59 -0
- lathe_agent-0.1.0/CODE_OF_CONDUCT.md +45 -0
- lathe_agent-0.1.0/CONTRIBUTING.md +75 -0
- lathe_agent-0.1.0/LICENSE +19 -0
- lathe_agent-0.1.0/Makefile +27 -0
- lathe_agent-0.1.0/PKG-INFO +627 -0
- lathe_agent-0.1.0/README.md +572 -0
- lathe_agent-0.1.0/SECURITY.md +75 -0
- lathe_agent-0.1.0/assets/banner.svg +127 -0
- lathe_agent-0.1.0/assets/bench.png +0 -0
- lathe_agent-0.1.0/assets/demo.gif +0 -0
- lathe_agent-0.1.0/assets/demo.svg +91 -0
- lathe_agent-0.1.0/assets/merge.svg +159 -0
- lathe_agent-0.1.0/assets/transformer.svg +135 -0
- lathe_agent-0.1.0/bench/results/2026-11-23.json/20261123_120000.json +73 -0
- lathe_agent-0.1.0/demo.tape +58 -0
- lathe_agent-0.1.0/docs/choosing-models.md +56 -0
- lathe_agent-0.1.0/docs/configuration.md +115 -0
- lathe_agent-0.1.0/docs/contributing.md +80 -0
- lathe_agent-0.1.0/docs/dual-llm-mode.md +114 -0
- lathe_agent-0.1.0/docs/getting-started.md +104 -0
- lathe_agent-0.1.0/docs/huggingface-setup.md +72 -0
- lathe_agent-0.1.0/docs/index.md +52 -0
- lathe_agent-0.1.0/docs/model-merging.md +76 -0
- lathe_agent-0.1.0/docs/safety.md +92 -0
- lathe_agent-0.1.0/install.ps1 +68 -0
- lathe_agent-0.1.0/install.sh +77 -0
- lathe_agent-0.1.0/lathe.toml +27 -0
- lathe_agent-0.1.0/merges/qwen-1.5b/README.md +69 -0
- lathe_agent-0.1.0/merges/qwen-1.5b/config.yaml +10 -0
- lathe_agent-0.1.0/merges/qwen-1.5b/merge_qwen-1.5b.ipynb +93 -0
- lathe_agent-0.1.0/mkdocs.yml +64 -0
- lathe_agent-0.1.0/pyproject.toml +146 -0
- lathe_agent-0.1.0/src/lathe/__init__.py +4 -0
- lathe_agent-0.1.0/src/lathe/__main__.py +6 -0
- lathe_agent-0.1.0/src/lathe/bench/__init__.py +43 -0
- lathe_agent-0.1.0/src/lathe/bench/evaluator.py +176 -0
- lathe_agent-0.1.0/src/lathe/bench/models.py +69 -0
- lathe_agent-0.1.0/src/lathe/bench/report.py +241 -0
- lathe_agent-0.1.0/src/lathe/bench/runner.py +185 -0
- lathe_agent-0.1.0/src/lathe/bench/tasks/__init__.py +540 -0
- lathe_agent-0.1.0/src/lathe/cli.py +868 -0
- lathe_agent-0.1.0/src/lathe/config.py +483 -0
- lathe_agent-0.1.0/src/lathe/context/__init__.py +45 -0
- lathe_agent-0.1.0/src/lathe/context/budget.py +526 -0
- lathe_agent-0.1.0/src/lathe/context/index.py +721 -0
- lathe_agent-0.1.0/src/lathe/context/repomap.py +599 -0
- lathe_agent-0.1.0/src/lathe/llm/__init__.py +21 -0
- lathe_agent-0.1.0/src/lathe/llm/base.py +67 -0
- lathe_agent-0.1.0/src/lathe/llm/factory.py +88 -0
- lathe_agent-0.1.0/src/lathe/llm/hf.py +294 -0
- lathe_agent-0.1.0/src/lathe/llm/ollama.py +208 -0
- lathe_agent-0.1.0/src/lathe/llm/openai_compat.py +237 -0
- lathe_agent-0.1.0/src/lathe/llm/types.py +86 -0
- lathe_agent-0.1.0/src/lathe/memory/__init__.py +45 -0
- lathe_agent-0.1.0/src/lathe/memory/commands.py +162 -0
- lathe_agent-0.1.0/src/lathe/memory/instructions.py +326 -0
- lathe_agent-0.1.0/src/lathe/memory/mcp.py +319 -0
- lathe_agent-0.1.0/src/lathe/memory/sessions.py +291 -0
- lathe_agent-0.1.0/src/lathe/merge/__init__.py +85 -0
- lathe_agent-0.1.0/src/lathe/merge/colab.py +123 -0
- lathe_agent-0.1.0/src/lathe/merge/compatibility.py +315 -0
- lathe_agent-0.1.0/src/lathe/merge/generator.py +175 -0
- lathe_agent-0.1.0/src/lathe/merge/gguf.py +362 -0
- lathe_agent-0.1.0/src/lathe/merge/hub.py +130 -0
- lathe_agent-0.1.0/src/lathe/merge/models.py +109 -0
- lathe_agent-0.1.0/src/lathe/merge/resources.py +221 -0
- lathe_agent-0.1.0/src/lathe/merge/runner.py +161 -0
- lathe_agent-0.1.0/src/lathe/merge/wizard.py +256 -0
- lathe_agent-0.1.0/src/lathe/orchestrator/__init__.py +86 -0
- lathe_agent-0.1.0/src/lathe/orchestrator/agent.py +533 -0
- lathe_agent-0.1.0/src/lathe/orchestrator/dual.py +825 -0
- lathe_agent-0.1.0/src/lathe/orchestrator/events.py +182 -0
- lathe_agent-0.1.0/src/lathe/orchestrator/review.py +173 -0
- lathe_agent-0.1.0/src/lathe/orchestrator/router.py +869 -0
- lathe_agent-0.1.0/src/lathe/prompts/__init__.py +34 -0
- lathe_agent-0.1.0/src/lathe/prompts/agent.md +62 -0
- lathe_agent-0.1.0/src/lathe/prompts/review.md +47 -0
- lathe_agent-0.1.0/src/lathe/safety/__init__.py +67 -0
- lathe_agent-0.1.0/src/lathe/safety/checkpoints.py +564 -0
- lathe_agent-0.1.0/src/lathe/safety/permissions.py +397 -0
- lathe_agent-0.1.0/src/lathe/safety/workspace.py +287 -0
- lathe_agent-0.1.0/src/lathe/session.py +33 -0
- lathe_agent-0.1.0/src/lathe/tools/__init__.py +159 -0
- lathe_agent-0.1.0/src/lathe/tools/base.py +207 -0
- lathe_agent-0.1.0/src/lathe/tools/edit.py +385 -0
- lathe_agent-0.1.0/src/lathe/tools/files.py +514 -0
- lathe_agent-0.1.0/src/lathe/tools/git.py +357 -0
- lathe_agent-0.1.0/src/lathe/tools/protocol.py +136 -0
- lathe_agent-0.1.0/src/lathe/tools/registry.py +103 -0
- lathe_agent-0.1.0/src/lathe/tools/search.py +344 -0
- lathe_agent-0.1.0/src/lathe/tools/shell.py +164 -0
- lathe_agent-0.1.0/src/lathe/tools/tests.py +379 -0
- lathe_agent-0.1.0/src/lathe/ui/__init__.py +27 -0
- lathe_agent-0.1.0/src/lathe/ui/agent_view.py +308 -0
- lathe_agent-0.1.0/src/lathe/ui/banner.py +58 -0
- lathe_agent-0.1.0/src/lathe/ui/commands.py +701 -0
- lathe_agent-0.1.0/src/lathe/ui/completer.py +113 -0
- lathe_agent-0.1.0/src/lathe/ui/diff.py +40 -0
- lathe_agent-0.1.0/src/lathe/ui/repl.py +398 -0
- lathe_agent-0.1.0/src/lathe/ui/status.py +84 -0
- lathe_agent-0.1.0/src/lathe/ui/theme.py +35 -0
- lathe_agent-0.1.0/tests/__init__.py +1 -0
- lathe_agent-0.1.0/tests/agent/__init__.py +1 -0
- lathe_agent-0.1.0/tests/agent/test_agent.py +25 -0
- lathe_agent-0.1.0/tests/bench/test_bench_runner.py +93 -0
- lathe_agent-0.1.0/tests/bench/test_cli.py +48 -0
- lathe_agent-0.1.0/tests/bench/test_evaluator.py +116 -0
- lathe_agent-0.1.0/tests/bench/test_report.py +82 -0
- lathe_agent-0.1.0/tests/bench/test_tasks.py +57 -0
- lathe_agent-0.1.0/tests/checkpoint/__init__.py +1 -0
- lathe_agent-0.1.0/tests/checkpoint/test_checkpoint.py +21 -0
- lathe_agent-0.1.0/tests/checkpoints/__init__.py +1 -0
- lathe_agent-0.1.0/tests/checkpoints/test_checkpoints.py +21 -0
- lathe_agent-0.1.0/tests/conftest.py +90 -0
- lathe_agent-0.1.0/tests/context/__init__.py +1 -0
- lathe_agent-0.1.0/tests/context/test_budget.py +233 -0
- lathe_agent-0.1.0/tests/context/test_context_coverage.py +127 -0
- lathe_agent-0.1.0/tests/context/test_index.py +222 -0
- lathe_agent-0.1.0/tests/context/test_repomap.py +279 -0
- lathe_agent-0.1.0/tests/e2e/__init__.py +1 -0
- lathe_agent-0.1.0/tests/e2e/test_ollama_smoke.py +70 -0
- lathe_agent-0.1.0/tests/e2e/test_scenarios.py +420 -0
- lathe_agent-0.1.0/tests/git/__init__.py +1 -0
- lathe_agent-0.1.0/tests/git/test_git.py +19 -0
- lathe_agent-0.1.0/tests/memory/test_commands.py +50 -0
- lathe_agent-0.1.0/tests/memory/test_instructions.py +139 -0
- lathe_agent-0.1.0/tests/memory/test_mcp.py +81 -0
- lathe_agent-0.1.0/tests/memory/test_sessions.py +85 -0
- lathe_agent-0.1.0/tests/memory/test_slash_commands.py +69 -0
- lathe_agent-0.1.0/tests/merge/test_colab.py +39 -0
- lathe_agent-0.1.0/tests/merge/test_compatibility.py +161 -0
- lathe_agent-0.1.0/tests/merge/test_generator.py +134 -0
- lathe_agent-0.1.0/tests/merge/test_gguf.py +130 -0
- lathe_agent-0.1.0/tests/merge/test_hub.py +74 -0
- lathe_agent-0.1.0/tests/merge/test_resources.py +58 -0
- lathe_agent-0.1.0/tests/merge/test_runner.py +75 -0
- lathe_agent-0.1.0/tests/merge/test_wizard.py +85 -0
- lathe_agent-0.1.0/tests/orchestrator/__init__.py +1 -0
- lathe_agent-0.1.0/tests/orchestrator/test_agent.py +431 -0
- lathe_agent-0.1.0/tests/orchestrator/test_dual.py +483 -0
- lathe_agent-0.1.0/tests/orchestrator/test_orchestrator_coverage.py +215 -0
- lathe_agent-0.1.0/tests/orchestrator/test_review.py +441 -0
- lathe_agent-0.1.0/tests/orchestrator/test_router.py +402 -0
- lathe_agent-0.1.0/tests/repomap/__init__.py +1 -0
- lathe_agent-0.1.0/tests/repomap/test_repomap.py +23 -0
- lathe_agent-0.1.0/tests/safety/__init__.py +1 -0
- lathe_agent-0.1.0/tests/safety/test_checkpoints.py +185 -0
- lathe_agent-0.1.0/tests/safety/test_permissions.py +266 -0
- lathe_agent-0.1.0/tests/safety/test_prompt_injection.py +155 -0
- lathe_agent-0.1.0/tests/safety/test_safety_coverage.py +224 -0
- lathe_agent-0.1.0/tests/safety/test_workspace.py +163 -0
- lathe_agent-0.1.0/tests/search/__init__.py +1 -0
- lathe_agent-0.1.0/tests/search/test_search.py +3 -0
- lathe_agent-0.1.0/tests/test_agent.py +25 -0
- lathe_agent-0.1.0/tests/test_backends.py +334 -0
- lathe_agent-0.1.0/tests/test_bench.py +7 -0
- lathe_agent-0.1.0/tests/test_budget.py +3 -0
- lathe_agent-0.1.0/tests/test_checkpoints.py +21 -0
- lathe_agent-0.1.0/tests/test_cli.py +67 -0
- lathe_agent-0.1.0/tests/test_config.py +231 -0
- lathe_agent-0.1.0/tests/test_dual.py +3 -0
- lathe_agent-0.1.0/tests/test_e2e.py +3 -0
- lathe_agent-0.1.0/tests/test_git.py +19 -0
- lathe_agent-0.1.0/tests/test_index.py +3 -0
- lathe_agent-0.1.0/tests/test_llm.py +304 -0
- lathe_agent-0.1.0/tests/test_memory.py +7 -0
- lathe_agent-0.1.0/tests/test_merge.py +9 -0
- lathe_agent-0.1.0/tests/test_models.py +344 -0
- lathe_agent-0.1.0/tests/test_repomap.py +23 -0
- lathe_agent-0.1.0/tests/test_review.py +3 -0
- lathe_agent-0.1.0/tests/test_router.py +3 -0
- lathe_agent-0.1.0/tests/test_safety.py +4 -0
- lathe_agent-0.1.0/tests/test_search.py +3 -0
- lathe_agent-0.1.0/tests/test_tests.py +3 -0
- lathe_agent-0.1.0/tests/test_tools.py +3 -0
- lathe_agent-0.1.0/tests/test_ui.py +241 -0
- lathe_agent-0.1.0/tests/tools/test_edit_tool.py +420 -0
- lathe_agent-0.1.0/tests/tools/test_file_tools.py +544 -0
- lathe_agent-0.1.0/tests/tools/test_git.py +146 -0
- lathe_agent-0.1.0/tests/tools/test_search.py +188 -0
- lathe_agent-0.1.0/tests/tools/test_shell_permissions.py +363 -0
- lathe_agent-0.1.0/tests/tools/test_tests.py +177 -0
- lathe_agent-0.1.0/tests/tools/test_tools.py +331 -0
- lathe_agent-0.1.0/tests/tools/test_tools_coverage.py +281 -0
- lathe_agent-0.1.0/uv.lock +3396 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
description: Create a report to help us improve Lathe
|
|
4
|
+
title: "[BUG] <concise description>"
|
|
5
|
+
labels: ["bug"]
|
|
6
|
+
assignees: []
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Describe the bug**
|
|
10
|
+
A clear and concise description of what the bug is.
|
|
11
|
+
|
|
12
|
+
**To Reproduce**
|
|
13
|
+
Steps to reproduce the behavior:
|
|
14
|
+
1. Run command: `lathe ...`
|
|
15
|
+
2. Enter prompt: `...`
|
|
16
|
+
3. See error: `...`
|
|
17
|
+
|
|
18
|
+
**Expected behavior**
|
|
19
|
+
A clear and concise description of what you expected to happen.
|
|
20
|
+
|
|
21
|
+
**Environment (please complete the following information):**
|
|
22
|
+
- OS: [e.g. macOS 14.5, Ubuntu 22.04, Windows 11]
|
|
23
|
+
- Python Version: [e.g. 3.12.2]
|
|
24
|
+
- Lathe Version: [e.g. 0.1.0]
|
|
25
|
+
- Local Runtime: [e.g. Ollama 0.5.0, Hugging Face API]
|
|
26
|
+
- Models: [e.g. coder=qwen2.5-coder:7b, planner=deepseek-r1:8b]
|
|
27
|
+
|
|
28
|
+
**Additional context**
|
|
29
|
+
Add any other context about the problem here, including terminal logs or screenshots.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
description: Suggest an idea or enhancement for Lathe
|
|
4
|
+
title: "[FEAT] <concise proposal>"
|
|
5
|
+
labels: ["enhancement"]
|
|
6
|
+
assignees: []
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Is your feature request related to a problem? Please describe.**
|
|
10
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
11
|
+
|
|
12
|
+
**Describe the solution you'd like**
|
|
13
|
+
A clear and concise description of what you want to happen.
|
|
14
|
+
|
|
15
|
+
**Describe alternatives you've considered**
|
|
16
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
17
|
+
|
|
18
|
+
**Target Phase / Component**
|
|
19
|
+
- [ ] Orchestrator (`lathe.orchestrator`)
|
|
20
|
+
- [ ] Tool Framework (`lathe.tools`)
|
|
21
|
+
- [ ] Memory & Context (`lathe.context`, `lathe.memory`)
|
|
22
|
+
- [ ] Safety System (`lathe.safety`)
|
|
23
|
+
- [ ] Model Merging & Quantization (`lathe.merge`)
|
|
24
|
+
- [ ] CLI / Terminal UI (`lathe.ui`, `lathe.cli`)
|
|
25
|
+
|
|
26
|
+
**Additional context**
|
|
27
|
+
Add any other context, mockup diagrams, or examples here.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
Provide a clear and concise summary of the changes introduced in this PR.
|
|
4
|
+
|
|
5
|
+
Fixes #(issue number)
|
|
6
|
+
|
|
7
|
+
## Type of Change
|
|
8
|
+
|
|
9
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
10
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
11
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
12
|
+
- [ ] Documentation update
|
|
13
|
+
- [ ] Refactoring / Performance improvement
|
|
14
|
+
|
|
15
|
+
## Checklist
|
|
16
|
+
|
|
17
|
+
- [ ] My code adheres to the project's style guidelines (`uv run ruff check .` and `uv run ruff format --check .`)
|
|
18
|
+
- [ ] My code passes strict type checking (`uv run mypy src`) with 0 errors
|
|
19
|
+
- [ ] I have added unit tests proving my fix is effective or that my feature works
|
|
20
|
+
- [ ] New and existing unit tests pass locally (`uv run pytest`)
|
|
21
|
+
- [ ] I have updated corresponding documentation in `docs/` and `ARCHITECTURE.md` if applicable
|
|
22
|
+
- [ ] I have added an entry to `CHANGELOG.md` under `[Unreleased]`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master, "phase-*"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: ${{ matrix.os }} · py${{ matrix.python-version }}
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout repository
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
cache: "pip"
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install -e ".[dev]" pytest-cov
|
|
33
|
+
|
|
34
|
+
- name: Run Ruff Lint Check
|
|
35
|
+
run: |
|
|
36
|
+
ruff check .
|
|
37
|
+
|
|
38
|
+
- name: Run Ruff Format Check
|
|
39
|
+
run: |
|
|
40
|
+
ruff format --check .
|
|
41
|
+
|
|
42
|
+
- name: Run Mypy Type Check
|
|
43
|
+
run: |
|
|
44
|
+
mypy src
|
|
45
|
+
|
|
46
|
+
- name: Run Pytest Suite with Coverage
|
|
47
|
+
run: |
|
|
48
|
+
pytest -m "not slow" \
|
|
49
|
+
--cov=src/lathe/tools \
|
|
50
|
+
--cov=src/lathe/safety \
|
|
51
|
+
--cov=src/lathe/orchestrator \
|
|
52
|
+
--cov=src/lathe/context \
|
|
53
|
+
--cov-report=term \
|
|
54
|
+
--cov-report=xml:coverage.xml
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Deploy Docs to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
deploy:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout repository
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
cache: "pip"
|
|
23
|
+
|
|
24
|
+
- name: Install documentation dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install mkdocs-material mkdocs
|
|
28
|
+
|
|
29
|
+
- name: Build and deploy documentation
|
|
30
|
+
run: |
|
|
31
|
+
mkdocs gh-deploy --force
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
tag:
|
|
10
|
+
description: "Release tag to trigger (e.g. v0.1.0)"
|
|
11
|
+
required: true
|
|
12
|
+
type: string
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
name: Build Distribution Packages
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
cache: "pip"
|
|
33
|
+
|
|
34
|
+
- name: Install build dependencies
|
|
35
|
+
run: |
|
|
36
|
+
python -m pip install --upgrade pip
|
|
37
|
+
pip install build twine
|
|
38
|
+
|
|
39
|
+
- name: Build wheel and sdist
|
|
40
|
+
run: |
|
|
41
|
+
python -m build
|
|
42
|
+
|
|
43
|
+
- name: Validate package distribution
|
|
44
|
+
run: |
|
|
45
|
+
twine check dist/*
|
|
46
|
+
|
|
47
|
+
- name: Upload build artifacts
|
|
48
|
+
uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: dist
|
|
51
|
+
path: dist/
|
|
52
|
+
retention-days: 7
|
|
53
|
+
|
|
54
|
+
publish-pypi:
|
|
55
|
+
name: Publish to PyPI (OIDC Trusted Publishing)
|
|
56
|
+
needs: [build]
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
environment:
|
|
59
|
+
name: pypi
|
|
60
|
+
url: https://pypi.org/p/lathe-agent
|
|
61
|
+
permissions:
|
|
62
|
+
id-token: write
|
|
63
|
+
steps:
|
|
64
|
+
- name: Download distribution artifacts
|
|
65
|
+
uses: actions/download-artifact@v4
|
|
66
|
+
with:
|
|
67
|
+
name: dist
|
|
68
|
+
path: dist/
|
|
69
|
+
|
|
70
|
+
- name: Publish package distributions to PyPI
|
|
71
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
72
|
+
with:
|
|
73
|
+
packages-dir: dist/
|
|
74
|
+
skip-existing: true
|
|
75
|
+
|
|
76
|
+
github-release:
|
|
77
|
+
name: Create GitHub Release
|
|
78
|
+
needs: [build]
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
permissions:
|
|
81
|
+
contents: write
|
|
82
|
+
steps:
|
|
83
|
+
- name: Checkout repository
|
|
84
|
+
uses: actions/checkout@v4
|
|
85
|
+
|
|
86
|
+
- name: Download distribution artifacts
|
|
87
|
+
uses: actions/download-artifact@v4
|
|
88
|
+
with:
|
|
89
|
+
name: dist
|
|
90
|
+
path: dist/
|
|
91
|
+
|
|
92
|
+
- name: Extract Release Notes from CHANGELOG
|
|
93
|
+
id: extract_notes
|
|
94
|
+
run: |
|
|
95
|
+
VERSION="${GITHUB_REF_NAME#v}"
|
|
96
|
+
# Extract section from CHANGELOG.md matching version header
|
|
97
|
+
python -c "
|
|
98
|
+
import re
|
|
99
|
+
version = '${VERSION}'
|
|
100
|
+
with open('CHANGELOG.md', 'r', encoding='utf-8') as f:
|
|
101
|
+
content = f.read()
|
|
102
|
+
# Match section from ## [version] to next ## [
|
|
103
|
+
pattern = rf'## \[{re.escape(version)}\].*?(?=\n## \[|\Z)'
|
|
104
|
+
match = re.search(pattern, content, re.DOTALL)
|
|
105
|
+
if match:
|
|
106
|
+
notes = match.group(0).strip()
|
|
107
|
+
else:
|
|
108
|
+
notes = f'Release {version} of Lathe Agent.'
|
|
109
|
+
with open('release_notes.md', 'w', encoding='utf-8') as out:
|
|
110
|
+
out.write(notes)
|
|
111
|
+
"
|
|
112
|
+
echo "Notes extracted successfully."
|
|
113
|
+
|
|
114
|
+
- name: Create GitHub Release
|
|
115
|
+
uses: softprops/action-gh-release@v2
|
|
116
|
+
with:
|
|
117
|
+
body_path: release_notes.md
|
|
118
|
+
files: dist/*
|
|
119
|
+
draft: false
|
|
120
|
+
prerelease: false
|
|
121
|
+
generate_release_notes: false
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# Virtual environments
|
|
30
|
+
venv/
|
|
31
|
+
.venv/
|
|
32
|
+
env/
|
|
33
|
+
ENV/
|
|
34
|
+
|
|
35
|
+
# Lathe specific & LLM weights
|
|
36
|
+
.lathe/
|
|
37
|
+
models/
|
|
38
|
+
*.gguf
|
|
39
|
+
*.safetensors
|
|
40
|
+
*.bin
|
|
41
|
+
|
|
42
|
+
# Environment & secrets
|
|
43
|
+
.env
|
|
44
|
+
.env.local
|
|
45
|
+
.env.*.local
|
|
46
|
+
|
|
47
|
+
# IDE & OS
|
|
48
|
+
.DS_Store
|
|
49
|
+
.vscode/
|
|
50
|
+
.idea/
|
|
51
|
+
|
|
52
|
+
# Testing & Coverage
|
|
53
|
+
.coverage
|
|
54
|
+
.coverage.*
|
|
55
|
+
coverage.xml
|
|
56
|
+
htmlcov/
|
|
57
|
+
.pytest_cache/
|
|
58
|
+
site/
|
|
59
|
+
*.swp
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.9.6
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
9
|
+
rev: v1.15.0
|
|
10
|
+
hooks:
|
|
11
|
+
- id: mypy
|
|
12
|
+
additional_dependencies:
|
|
13
|
+
- pydantic>=2.10.0
|
|
14
|
+
- typer>=0.15.0
|
|
15
|
+
- rich>=13.9.0
|
|
16
|
+
- pytest>=8.0.0
|
|
17
|
+
- pytest-asyncio>=0.23.0
|
|
18
|
+
- pytest-cov>=5.0.0
|
|
19
|
+
args: [--strict, --config-file=pyproject.toml]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Lathe Architecture
|
|
2
|
+
|
|
3
|
+
Lathe is an open-source terminal AI coding agent built around dual-model orchestration, local GGUF runtimes, and automated weight merging. This document details each architectural package and the internal dependency structure.
|
|
4
|
+
|
|
5
|
+
## Modules
|
|
6
|
+
|
|
7
|
+
### `lathe.cli`
|
|
8
|
+
The command-line interface entry point parsed via Typer and styled with Rich. It dispatches global options like `--version`, executes utility commands like `lathe doctor`, `lathe config`, and `lathe merge`, and triggers interactive or headless agent sessions.
|
|
9
|
+
|
|
10
|
+
### `lathe.config`
|
|
11
|
+
Configuration management system handling two-level TOML settings (global `~/.config/lathe/lathe.toml` and project `./lathe.toml`). It validates roles (planner, coder, reviewer, router) and operational parameters with Pydantic while isolating API tokens (`HF_TOKEN`) exclusively to environment variables.
|
|
12
|
+
|
|
13
|
+
### `lathe.session`
|
|
14
|
+
Manages the active developer session lifecycle. It maintains conversational state, registers active workspace settings, and serializes checkpoint history across agent interactions.
|
|
15
|
+
|
|
16
|
+
### `lathe.orchestrator`
|
|
17
|
+
The core agent reasoning and execution engine. It coordinates single-agent tool loops (`lathe.orchestrator.agent.Agent`), dual-model orchestration (`lathe.orchestrator.dual.DualAgent`), automated code review verification (`lathe.orchestrator.review.StepReviewer`), and intelligent task routing with per-role performance telemetry (`lathe.orchestrator.router.TaskRouter` and `StatsCollector`). The task router classifies user requests into three categories: `chat` (questions, explanations, greetings, no code changes), `simple` (localized single-file edits), or `complex` (multi-file changes, new features, refactoring, architectural overhaul). It evaluates cheap rule-based heuristics first (length, number of `@file` mentions, keywords like `refactor`, `build`, `migrate`), falling back to the router model with a tiny JSON prompt. Routing dispatches requests dynamically: `chat` routes to an agent restricted exclusively to read and search tools (`read_file`, `list_dir`, `glob`, `grep_search`, `semantic_search`), `simple` routes to single mode with the coder model, and `complex` routes to dual mode. It renders routing decisions in a dim indicator line (`routed: complex → dual mode`), allows manual override via `/mode single|dual|auto`, and powers cheap internal jobs (summaries for compaction, Conventional Commits messages, task titles). The `StatsCollector` tracks per-role telemetry (calls, input/output tokens, latency, tokens/sec), renders structured Rich inspection tables via `/stats`, and automatically serializes session metrics to `.lathe/sessions/<id>/stats.json`. The single-agent loop governs the coder model under system guidelines in `src/lathe/prompts/agent.md` (read before editing, make the smallest change, run tests after changes, never guess file contents, explain briefly then act), inspecting tool calls, validating permissions, snapshotting working tree checkpoints, executing parallel read tools, detecting call loops, enforcing step budgets, and offering an optional post-execution `self_check` that runs project tests and self-corrects failures. The dual-model orchestrator pairs a reasoning planner model with a code execution model: (1) the planner synthesizes tasks, repo maps, and code search results into Pydantic-validated JSON plans (`goal`, `steps`, `risks`) with automatic single-retry correction on malformed JSON; (2) the plan is presented as an interactive live checklist for user approval, `$EDITOR` JSON modification, or rejection; (3) each step runs the coder agent in a focused context containing only step instructions, target files, repo map, and prior step summaries; (4) after each step, the reviewer role (defaults to the planner model) evaluates the step diff and test suite results against the five review rubric criteria in `src/lathe/prompts/review.md` (correctness, matches the step, no unrelated changes, no secrets, tests pass), returning a structured JSON verdict (`approve` or `revise` with file, line, problem, and suggestion); (5) on `revise`, the coder retries the step with reviewer feedback (up to 2 retries), prompting the user with `[k]eep`, `[u]ndo this step`, or `[t]ake over` if retries exceed 2; (6) the planner reviews step outcomes to revise, reorder, or insert remaining steps. All loops stream decoupled events (`ThinkingEvent`, `ToolStartEvent`, `ToolEndEvent`, `DiffEvent`, `NudgeEvent`, `AgentHaltEvent`, `FinalAnswerEvent`, `PlanCreatedEvent`, `StepStartedEvent`, `StepDoneEvent`, `PlanRevisedEvent`, `StepReviewedEvent`) over `EventBus` to `TerminalAgentUI`, supporting both one-shot execution (`lathe "task"`, `lathe --dual "task"`) and REPL conversations toggled via `/mode single`, `/mode dual`, and `/mode auto`.
|
|
18
|
+
|
|
19
|
+
### `lathe.llm`
|
|
20
|
+
Unified provider abstraction layer handling prompt dispatch, streaming token generation, and response parsing. It abstracts local inference through Ollama (GGUF) and cloud inference via the Hugging Face Inference Providers API or OpenAI-compatible backends.
|
|
21
|
+
|
|
22
|
+
### `lathe.tools`
|
|
23
|
+
The sandboxed tool framework and registry. It defines the abstract `Tool` base class with Pydantic argument schemas auto-converted to JSON Schema, risk level classification (`read`, `write`, `execute`, `network`), structured error feedback for LLM self-correction, and configurable output truncation. It provides read-side and create-side workspace file tools (`read_file` with line numbering, binary detection, and size limits; `list_dir` with compact ASCII tree generation and depth limits; `glob` for pattern matching; `write_file` for creating new files with automatic parent directories and overwrite prevention), search tools (`grep_search` using ripgrep with pure Python fallback for exact/regex search with 2 lines of context; `semantic_search` for natural language conceptual queries against indexed vector chunks), the atomic `edit_file` tool supporting exact and whitespace-insensitive matching, ambiguous match detection with line numbers, multi-edit atomic rollback, unified diff generation, and encoding/newline (LF/CRLF) preservation, the `run_shell` execution tool that runs commands strictly in the workspace root, streams live standard output and error to the UI, enforces process group termination (`SIGKILL`) on timeout or cancellation, and truncates trailing output history, model git tools (`git_status`, `git_diff` staged/unstaged/path, `git_log`, `git_commit` with write authorization), and the `run_tests` tool (`RunTestsTool`) auto-detecting test runners (`pytest`, `npm test`, `pnpm test`, `yarn test`, `cargo test`, `go test ./...`, `ctest`, `make test`) or configured `[project].test_command` from `lathe.toml`, parsing pass/fail metrics and extracting the first failing test section for model self-correction. It provides the `@tool` decorator, `ToolRegistry`, and dual tool-calling protocols: native provider function calling and a fault-tolerant `<tool_call>` parser that handles messy model formatting (trailing commas, code fences, single quotes), selected dynamically from cached model capabilities.
|
|
24
|
+
|
|
25
|
+
### `lathe.context`
|
|
26
|
+
Responsible for token budgeting, workspace awareness, code structure indexing, semantic vector retrieval, and context compaction. It implements `lathe.context.repomap.RepoMap` using `tree-sitter` (`tree-sitter-language-pack`) to parse source code across Python, JavaScript/TypeScript, C/C++, Go, Rust, and Java into symbol definitions (classes, functions, methods, structs, interfaces, types) preserving signatures only without bodies, constructing a cross-file reference graph and ranking symbols via Personalized PageRank with power iteration ($d=0.85$). It also implements `lathe.context.index.CodeIndex` which chunks code by function/class via tree-sitter AST, generates normalized embeddings through Ollama (`nomic-embed-text`), local `sentence-transformers` (`BAAI/bge-small-en-v1.5`), or Hugging Face, stores vectors in `.lathe/index/code_index.db` (SQLite + numpy cosine similarity), performs incremental updates (re-embedding only modified chunks while reusing untouched chunk hashes), powers the `lathe index [--rebuild] [--stats]` CLI command with a Rich progress bar, and automatically refreshes stale files before semantic queries. Furthermore, it provides `lathe.context.budget.TokenCounter` for accurate token counting using model Hugging Face tokenizers via the `tokenizers` library with disk caching and heuristic fallback (`len(text)/3.5`), `BudgetAllocator` managing categorical shares (system: 10%, repomap: 15%, pinned files: 20%, conversation: 35%, tool results: 20%, reserving output capacity for model replies) and rendering visual colored bar charts, and two-stage compaction (`compact_context`) triggered at 75% capacity that compresses old tool outputs into one-line summaries and synthesizes older conversation history into a "session so far" note using the router model while strictly protecting the user's task, active plans, unresolved errors, and the latest 4 turns verbatim.
|
|
27
|
+
|
|
28
|
+
### `lathe.safety`
|
|
29
|
+
Permission engine, workspace boundary security system, and working tree checkpoints. It features the `Workspace` path security manager that resolves every path against the repository root, strictly prevents directory traversal attacks (`../`, absolute paths outside, symlinks pointing out), and respects `.gitignore` and `.latheignore` rules alongside default ignored directories (`node_modules`, `.venv`, `.git`, build directories). It includes the `PermissionEngine` enforcing a multi-tiered authorization hierarchy (`read` = auto-allow; `write`/`execute` = interactive prompt with `[y]es`, `[n]o`, `[a]lways for this pattern`, `[e]dit command`, and `[d]eny with message`). It persists wildcard rules in `.lathe/permissions.json`, purges sensitive secrets and API keys via environment scrubbing (`scrub_env`), enforces a regex-based hard security blocklist (`rm -rf /`, `rm -rf ~`, `sudo`, `mkfs`, raw device `dd`, `curl|sh`, `git push --force`, `chmod -R 777`, fork bombs) that cannot be bypassed even in `--yolo` mode, and supports `--auto` and `--yolo` operational flags. It includes the `CheckpointManager` that snapshots working trees before every mutating file tool or shell command into isolated refs (`refs/lathe/checkpoints/<session>/<n>`) using temporary indices (`git write-tree`/`commit-tree`) without touching the user's branch or index, providing non-destructive undo and restore, session diffs, and optional Conventional Commits auto-commit.
|
|
30
|
+
|
|
31
|
+
### `lathe.memory`
|
|
32
|
+
Short-term and persistent project memory engine. It manages project-specific instruction files (`LATHE.md` auto-loaded from repo root and globally from `~/.config/lathe/LATHE.md` into the agent's system prompt and planner context), autonomous repository exploration and template initialization (`/init`), quick fact and convention appendation under `## Notes` (`/remember <fact>`), structured session lifecycle persistence (`.lathe/sessions/<id>/` containing `session.json`, `messages.json`, `plan.json`, `checkpoints.json`, and `stats.json`), session resumption and continuation (`lathe --resume` interactive picker and `lathe --continue` last-session continuation), dynamic markdown custom slash commands (`.lathe/commands/<name>.md` with `$ARGS` and `$1`..`$9` substitution), and stdio Model Context Protocol (MCP) client tool bridging (`StdioMcpClient`, `McpTool`) exposing external MCP servers configured under `[mcp]` in `lathe.toml` with unified permission validation.
|
|
33
|
+
|
|
34
|
+
### `lathe.ui`
|
|
35
|
+
Terminal presentation layer implemented with prompt_toolkit and Rich. It powers the interactive REPL with persistent history, Alt+Enter multiline editing, @file repository path autocompletion, dynamic bottom status bar toolbar (repository, git branch, mode, active role models, session tokens), slash command framework (/help, /model, /mode, /clear, /tokens, /compact, /exit, /undo, /checkpoints, /restore, /diff), unified theme palette (matching the README), and live streaming Markdown responses with syntax-highlighted code blocks and Ctrl+C generation cancellation.
|
|
36
|
+
|
|
37
|
+
### `lathe.merge`
|
|
38
|
+
Model combination pipeline integrating `mergekit` (optional extra: `lathe-agent[merge]`). It provides the `lathe merge` interactive wizard:
|
|
39
|
+
1. Model selection: supports tested presets (e.g. `Qwen/Qwen2.5-Coder-1.5B` + `Qwen/Qwen2.5-1.5B-Instruct` for laptops) or custom Hugging Face safetensors repositories (safetensors required; GGUF repositories strictly rejected).
|
|
40
|
+
2. Architecture compatibility checking: fetches remote `config.json` and `tokenizer_config.json` via `huggingface_hub` without downloading full model weights, comparing `model_type`, `hidden_size`, `num_hidden_layers`, `vocab_size`, and tokenizer specifications; renders structured Rich comparison tables and refuses incompatible model pairs.
|
|
41
|
+
3. Merge methods & YAML generation: generates validated mergekit YAML configurations saved into `merges/<name>/config.yaml` supporting SLERP (with parameter $t$ and optional layer-wise gradient for `self_attn` vs `mlp`), TIES and DARE-TIES (with designated base model, density, and weight coefficients), and Linear averaging.
|
|
42
|
+
4. Resource estimation: calculates parameter counts, computes FP16 memory requirements (`params * 2` bytes per model), checks available system RAM and disk capacity, and emits clear warnings when hardware limits are constrained.
|
|
43
|
+
5. Local execution & Model Cards: executes `mergekit-yaml` using lazy loading and low-memory flags (`--lazy-unpickle`, `--allow-crimes`, `--low-cpu-memory`, `--copy-tokenizer`), streaming real-time output, and auto-generates a comprehensive model card (`merges/<name>/README.md`) with YAML frontmatter, source model links, and GGUF deployment instructions.
|
|
44
|
+
6. Cloud execution: `lathe merge --colab` generates self-contained, GPU-accelerated Google Colab Jupyter notebooks (`.ipynb`) that install mergekit, execute the YAML configuration, and upload the merged weights directly to Hugging Face.
|
|
45
|
+
7. Hub publishing: `lathe merge push <name>` uploads merged directories to the Hugging Face Hub via `huggingface_hub.HfApi` with interactive confirmation and default private repository visibility.
|
|
46
|
+
8. GGUF quantization & local deployment: `lathe merge gguf <name> [--quant Q4_K_M]` converts merged safetensors into GGUF format via `llama.cpp` (`convert_hf_to_gguf.py`, cloned into `~/.cache/lathe/llama.cpp` pinned to a release tag), quantizes using `llama-quantize`, constructs an Ollama Modelfile preserving extracted Jinja chat templates from parent tokenizer configs, executes `ollama create lathe-<name>`, and automatically executes `lathe models probe` to calibrate tool-calling protocols.
|
|
47
|
+
|
|
48
|
+
### `lathe.bench`
|
|
49
|
+
Local evaluation harness assessing candidate model pairs on syntax accuracy, refactoring correctness, throughput, and unit test pass rates. Built around the 30-task Lathe mini-bench suite (`src/lathe/bench/tasks/`) spanning Python algorithms, C systems code, and structured tool-calling validations. The evaluation engine benchmarks candidate models in isolated subshells, calculating pass@1 accuracy, generation throughput (tokens/sec), completion latency, and tool-call format success. It displays comparative Rich inspection tables, serializes structured JSON telemetry to `bench/results/<timestamp>.json`, and outputs multi-metric comparative bar chart visualizations to `assets/bench.png`. All results are explicitly documented as illustrative evaluations under the Lathe mini-bench specification.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Module Dependency Graph
|
|
54
|
+
|
|
55
|
+
```mermaid
|
|
56
|
+
flowchart TD
|
|
57
|
+
classDef entry fill:#1e293b,stroke:#38bdf8,stroke-width:2px,color:#f8fafc;
|
|
58
|
+
classDef core fill:#1e1b4b,stroke:#818cf8,stroke-width:2px,color:#f8fafc;
|
|
59
|
+
classDef provider fill:#701a75,stroke:#f472b6,stroke-width:2px,color:#f8fafc;
|
|
60
|
+
classDef support fill:#78350f,stroke:#fbbf24,stroke-width:2px,color:#f8fafc;
|
|
61
|
+
classDef infra fill:#064e3b,stroke:#34d399,stroke-width:2px,color:#f8fafc;
|
|
62
|
+
|
|
63
|
+
CLI["lathe.cli"]:::entry
|
|
64
|
+
Config["lathe.config"]:::entry
|
|
65
|
+
Session["lathe.session"]:::entry
|
|
66
|
+
UI["lathe.ui"]:::entry
|
|
67
|
+
|
|
68
|
+
Orchestrator["lathe.orchestrator"]:::core
|
|
69
|
+
Safety["lathe.safety"]:::core
|
|
70
|
+
Memory["lathe.memory"]:::core
|
|
71
|
+
Context["lathe.context"]:::core
|
|
72
|
+
|
|
73
|
+
LLM["lathe.llm"]:::provider
|
|
74
|
+
Tools["lathe.tools"]:::support
|
|
75
|
+
|
|
76
|
+
Merge["lathe.merge"]:::infra
|
|
77
|
+
Bench["lathe.bench"]:::infra
|
|
78
|
+
|
|
79
|
+
CLI --> Config
|
|
80
|
+
CLI --> Session
|
|
81
|
+
CLI --> UI
|
|
82
|
+
CLI --> Merge
|
|
83
|
+
CLI --> Bench
|
|
84
|
+
|
|
85
|
+
Session --> Config
|
|
86
|
+
Session --> Orchestrator
|
|
87
|
+
Session --> Memory
|
|
88
|
+
Session --> UI
|
|
89
|
+
|
|
90
|
+
Orchestrator --> Config
|
|
91
|
+
Orchestrator --> LLM
|
|
92
|
+
Orchestrator --> Tools
|
|
93
|
+
Orchestrator --> Safety
|
|
94
|
+
Orchestrator --> Context
|
|
95
|
+
Orchestrator --> UI
|
|
96
|
+
|
|
97
|
+
Tools --> Safety
|
|
98
|
+
Context --> Memory
|
|
99
|
+
Bench --> LLM
|
|
100
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Lathe are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-11-23
|
|
11
|
+
|
|
12
|
+
Initial public release of Lathe — an autonomous terminal AI coding agent powered by dual-model orchestration, local GGUF runtimes, and automated model merging.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
#### Core Orchestration & Reasoning
|
|
17
|
+
- **Dual-Model Orchestrator** (`lathe.orchestrator.dual`): Pairs a reasoning Planner model (`DeepSeek-R1`) with an execution Coder model (`Qwen2.5-Coder`). Generates Pydantic-validated structured JSON plans with automated single-retry recovery on malformed output. *(Phase 17)*
|
|
18
|
+
- **Interactive Plan Checklist**: Live Rich terminal checklist allowing developers to approve `[y]`, edit in `$EDITOR` `[e]`, or reject `[n]` plans prior to execution. *(Phase 17)*
|
|
19
|
+
- **Focused Context Windows**: Each plan step passes only focused instructions, target files, and prior step summaries to the coder. *(Phase 17)*
|
|
20
|
+
- **Automated Code Reviewer** (`lathe.orchestrator.review`): `StepReviewer` audits step diffs and test results against a five-point rubric (correctness, step match, no unrelated changes, no secrets, tests pass). Returns structured JSON verdicts (`approve` or `revise`). *(Phase 18)*
|
|
21
|
+
- **Intelligent Task Router** (`lathe.orchestrator.router`): Categorizes user prompts into `chat`, `simple`, or `complex` using fast rule heuristics and a lightweight router model. Dispatches requests to read-only tools, single mode, or dual mode. *(Phase 19)*
|
|
22
|
+
- **Per-Role Telemetry & Session Stats**: `StatsCollector` records calls, tokens, latency, and tokens/sec per role; renders Rich inspection tables via `/stats` and serializes metrics to `.lathe/sessions/<id>/stats.json`. *(Phase 19)*
|
|
23
|
+
- **Autonomous Agent Loop** (`lathe.orchestrator.agent`): Single-agent autonomous execution supporting tool calling, loop detection, thinking events, and optional post-run test `self_check`. *(Phase 13)*
|
|
24
|
+
|
|
25
|
+
#### Tools & Sandboxing
|
|
26
|
+
- **Workspace File Operations** (`lathe.tools.files`): `read_file` with line numbering and size caps; `write_file` with overwrite guards; `list_dir` with ASCII tree rendering; `glob` pattern search. *(Phase 7)*
|
|
27
|
+
- **Atomic File Editing** (`lathe.tools.edit`): `edit_file` with exact and whitespace-relaxed matching, ambiguous match detection, unified diff preview, and encoding/newline preservation. *(Phase 10)*
|
|
28
|
+
- **Shell Tool** (`lathe.tools.shell`): `run_shell` executes commands within the workspace root, streams live output, and terminates process groups (`SIGKILL`) on timeout. *(Phase 8)*
|
|
29
|
+
- **Git Tools** (`lathe.tools.git`): `git_status`, `git_diff`, `git_log`, and `git_commit` with write authorization checks. *(Phase 6)*
|
|
30
|
+
- **Test Runner Tool** (`lathe.tools.tests`): `run_tests` auto-detects test runners (`pytest`, `npm test`, `cargo test`, `go test`, `ctest`, `make test`) and extracts failing test blocks for self-correction. *(Phase 18)*
|
|
31
|
+
- **Exact & Semantic Search** (`lathe.tools.search`): `grep_search` using ripgrep with Python fallback; `semantic_search` powered by local SQLite vector index. *(Phase 15)*
|
|
32
|
+
- **Model Context Protocol (MCP)** (`lathe.memory.mcp`): Stdio MCP client bridging external tools configured under `[mcp]` in `lathe.toml`. *(Phase 9, Phase 22)*
|
|
33
|
+
|
|
34
|
+
#### Context, Indexing & Memory
|
|
35
|
+
- **AST Symbol Indexing** (`lathe.context.repomap`): Tree-sitter parsing for Python, JS/TS, Go, Rust, and C/C++ with Personalized PageRank symbol ranking. *(Phase 11)*
|
|
36
|
+
- **Code Chunking & Vector Index** (`lathe.context.index`): Incremental function/class chunking, vector embedding, SQLite storage, and `lathe index` CLI tool. *(Phase 15)*
|
|
37
|
+
- **Token Counting & Budgeting** (`lathe.context.budget`): Hugging Face tokenizer loading with disk cache, categorical budget allocation, colored `/tokens` bar chart, and two-stage 75% compaction. *(Phase 16)*
|
|
38
|
+
- **Project Memory & Instructions** (`lathe.memory`): `LATHE.md` project rules loading, `/init` repo exploration, `/remember` fact recording, session resumption (`lathe --resume`, `lathe --continue`), and custom slash commands (`.lathe/commands/<name>.md`). *(Phase 22)*
|
|
39
|
+
|
|
40
|
+
#### Model Merging & Evaluation
|
|
41
|
+
- **Interactive Model Merge Wizard** (`lathe.merge`): Combines safetensors models via `mergekit` using SLERP, TIES, DARE-TIES, or Linear averaging. *(Phase 20)*
|
|
42
|
+
- **Architecture Compatibility Checks**: Pre-verifies `model_type`, `hidden_size`, `num_hidden_layers`, and tokenizers via `huggingface_hub` before downloading weights. *(Phase 20)*
|
|
43
|
+
- **Google Colab Generation**: `lathe merge --colab` produces self-contained GPU notebooks for cloud execution. *(Phase 20)*
|
|
44
|
+
- **GGUF Quantization & Ollama Modelfiles**: `lathe merge gguf` converts safetensors with `llama.cpp`, quantizes, generates chat-template Modelfiles, and registers local Ollama models. *(Phase 21)*
|
|
45
|
+
- **Lathe Mini-Bench** (`lathe.bench`): 30-task evaluation benchmark measuring pass@1 accuracy, throughput, and tool-call success rates with comparative chart generation (`assets/bench.png`). *(Phase 21)*
|
|
46
|
+
|
|
47
|
+
#### Safety & Security Hardening
|
|
48
|
+
- **Hard Security Blocklist** (`lathe.safety.permissions`): Unconditionally blocks catastrophic commands (`rm -rf /`, `sudo`, piped remote scripts `curl|sh`, `mkfs`, fork bombs). *(Phase 5, Phase 23)*
|
|
49
|
+
- **Prompt-Injection Delimiters**: Encloses file contents in `[UNTRUSTED REPOSITORY CONTENT]` structural delimiters to prevent indirect injection attacks. *(Phase 23)*
|
|
50
|
+
- **Secret Scrubbing**: `scrub_env` strips API keys and credentials before spawning subprocesses. *(Phase 5, Phase 23)*
|
|
51
|
+
- **Workspace Confinement**: `Workspace.resolve_path()` prevents directory traversal and symlink escapes. *(Phase 4)*
|
|
52
|
+
- **Non-Destructive Git Checkpoints** (`lathe.safety.checkpoints`): Automatically snapshots working trees before mutations for instant rollback with `lathe undo` or `/undo`. *(Phase 14)*
|
|
53
|
+
|
|
54
|
+
#### Developer Experience & Distribution
|
|
55
|
+
- **Interactive Terminal UI** (`lathe.ui`): `prompt_toolkit` REPL with syntax highlighting, multiline editing (`Alt+Enter`), `@file` autocompletion, status bar, and live streaming markdown. *(Phase 12)*
|
|
56
|
+
- **CLI Commands** (`lathe.cli`): `lathe doctor`, `lathe config`, `lathe models`, `lathe merge`, `lathe bench`, `lathe index`, `lathe undo`. *(Phase 1-22)*
|
|
57
|
+
- **One-Liner Installers**: Cross-platform `install.sh` (Linux/macOS) and `install.ps1` (Windows). *(Phase 24)*
|
|
58
|
+
- **Documentation Site**: Complete MkDocs Material documentation site in `docs/` with automated GitHub Pages deployment workflow. *(Phase 24)*
|
|
59
|
+
- **Release Automation**: GitHub Actions workflow for PyPI trusted publishing and automated GitHub Releases. *(Phase 24)*
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
* Public or private harassment
|
|
24
|
+
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [conduct@lathe.ai](mailto:conduct@lathe.ai). All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
+
|
|
43
|
+
## Attribution
|
|
44
|
+
|
|
45
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|