Metadata-Version: 2.4
Name: memla
Version: 0.1.0
Summary: Memla CLI for bounded coding and math runtimes.
Author-email: Jackfarmer2328 <samatarsalahudeen@gmail.com>
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: requests<3,>=2.31
Requires-Dist: torch>=2.1
Requires-Dist: transformers>=4.40
Requires-Dist: peft>=0.7
Requires-Dist: safetensors>=0.4
Requires-Dist: sentence-transformers>=2.2
Requires-Dist: fastapi>=0.100
Requires-Dist: uvicorn>=0.20
Requires-Dist: fastmcp>=2.0
Requires-Dist: bitsandbytes>=0.41
Requires-Dist: accelerate>=0.25
Requires-Dist: sympy>=1.12

# Memla CLI

Memla is a bounded runtime that helps smaller local models make better technical decisions inside verifier-backed loops.

This public repo is the CLI-first version of Memla:
- local coding workflow planning and execution
- coding benchmarks for patch execution and compile/backtest loops
- bounded math benchmarks for decision-layer proof
- a small proof packet showing the current strongest results

It is intentionally narrower than the internal research repo.

## What is here

- `memla.py`
  - top-level CLI entry point
- `memory_system/`
  - the runtime, coding session, patch benchmark, compile benchmark, math benchmark, and pack builders
- `cases/`
  - small bundled case files for quick benchmark runs
- `proof/`
  - the current proof packet and key benchmark artifacts
- `tests/`
  - focused tests for the coding, math, and CLI surfaces

## Current claim

The current public proof packet is in:
- `proof/current_pack/`

Current strongest bounded claim:
- on coding, `qwen3.5:9b + Memla` beat local `qwen2.5:32b` raw on execution outcome in the OAuth patch benchmark
- on math, `qwen3.5:4b + Memla` matched `qwen2.5:32b` raw on the bounded harder pack
- on ambiguous math decision states, Memla lifted both `4b` and `9b` to perfect choice accuracy on the tested slice

This is not a claim of universal model parity. It is a claim about bounded runtimes with verifiers.

## Quick start

Prerequisites:
- Python 3.11+
- Ollama running locally
- one or more local models already pulled

Install:

```bash
py -3 -m pip install .
```

Smoke-check the CLI:

```bash
memla --help
```

Run a local environment check:

```bash
memla doctor --repo-root . --model qwen3.5:9b
```

## Main commands

Build a workflow plan inside a repo:

```bash
memla coding plan --prompt "Fix the auth regression" --repo-root .
```

Run a bounded coding turn with optional verification:

```bash
memla coding run --prompt "Repair the failing auth tests" --repo-root . --test-command "pytest -q"
```

Run the patch execution benchmark:

```bash
memla coding benchmark-patch --pack path\\to\\git_history_case_pack.json --raw-model qwen2.5:32b --memla-model qwen3.5:9b
```

Run the compile-loop benchmark:

```bash
memla coding benchmark-compile --cases cases\\coding_eval_cases.jsonl --repo-root . --model qwen3.5:9b
```

Run the bounded math benchmark:

```bash
memla math benchmark --cases cases\\math_linear_c2a_v2_harder.jsonl --teacher-model qwen2.5:32b --student-models qwen3.5:4b qwen3.5:9b --executor-mode stepwise_rerank --teacher-trace-source hybrid
```

Rebuild the proof packet:

```bash
memla pack thesis --coding proof\\current_pack\\frozen\\coding_patch_execution_report.json --math-rerank proof\\current_pack\\frozen\\math_step_rerank_report.json --math-progress proof\\current_pack\\frozen\\math_progress_report.json
```

Benchmark commands write report bundles under `./memla_reports/` by default.

Publish the current proof pack to the repo root for Vercel:

```bash
memla pack publish-site --source proof\\current_pack --out-dir .
```

## Proof artifacts

Main public proof packet:
- `proof/current_pack/`

Supporting reports:
- `proof/reports/coding_oauth_patch/`
- `proof/reports/coding_fastapi_patch/`
- `proof/reports/coding_fastapi_compile/`
- `proof/reports/math_qwen32b_rerank/`
- `proof/reports/math_qwen32b_stepwise/`

## Tests

Focused verification:

```bash
py -3 -m pytest -q tests\\test_step13_coding_compile_loop.py tests\\test_step14_compile_loop_benchmark.py tests\\test_step15_patch_execution_benchmark.py tests\\test_step16_math_c2a_benchmark.py tests\\test_step17_memla_cli.py
```

## Product direction

Memla is being packaged as:
- a local/private coding runtime for smaller models
- a CLI first, not a chat app first
- a verifier-backed system, not a prompt wrapper

The wedge is simple:

**make local 9b/14b/32b coding models more execution-capable than their raw form.**

## GitHub and Vercel

This repo is set up so GitHub and Vercel can work together cleanly:
- GitHub Actions runs the focused CLI/benchmark test suite on push and pull request
- `memla pack publish-site --source proof\\current_pack --out-dir .` syncs the current proof pack to the repo root
- the root `vercel.json` is written as a static deployment config so Vercel can deploy the proof site directly from the repo root

Practical flow:
1. update proof artifacts
2. run `memla pack publish-site`
3. push to GitHub
4. let Vercel redeploy from the latest commit
