Agent Mitosis is a white-label appliance for LLM operators and automation teams. When a request, specification, or prompt is too large for one run, it detects the risk, splits the work into bounded subtasks, plans dependency order, executes each piece with timeout and retry, then recombines the outputs with a run manifest.
Honest Promise
The deterministic core works without any LLM key or connected CLI. It handles oversize detection, boundary-aware splitting, dependency ordering, timeout, retry/backoff, bounded recursive re-splitting, deterministic execution, merging, and manifest writing. A BYO local LLM CLI is optional and only improves semantic splitting, subtask execution, or merge synthesis.
LLM vs Deterministic
| Capability | Deterministic core | Optional BYO LLM |
|---|---|---|
| Oversize detection | Yes: words, sections, steps, deliverables | Not required |
| Split on declared structure | Yes: headings, numbered steps, paragraphs | Not required |
| Split implicit unstructured text | Basic word/paragraph fallback | Can propose semantic chunks |
| Dependency planning | Yes: simple DAG and topological ordering | Not required |
| Timeout and retry | Yes | Applies around LLM calls too |
| Recursive re-split | Yes, bounded by max depth | Can help choose child chunks |
| Subtask execution | Deterministic evidence slice | Can perform task-specific work |
| Merge | Deterministic concatenation with headings | Can synthesize final response |
| Run manifest | Yes | Same manifest |
Pipeline
oversized request
|
v
+-----------------------+
| detect size/boundary |
+-----------------------+
|
v
+-----------------------+
| split at boundaries |-- optional LLM semantic split
+-----------------------+
|
v
+-----------------------+
| plan DAG/toposort |
+-----------------------+
|
v
+-----------------------+
| orchestrate subtasks |-- timeout, retry, bounded re-split
+-----------------------+
|
v
+-----------------------+
| merge + manifest |
+-----------------------+
Quick Start
cd agent-mitosis-v1
python3 agent.py --help
python3 agent.py demo --manifest /tmp/mitosis-manifest.json
python3 test_agent.py
bash smoke_test.sh
Use your own input:
python3 agent.py run --input big_spec.md --output result.md --manifest run.json --deterministic
Optional BYO LLM execution uses llm_adapter.py and any connected local CLI:
PACK_LLM=claude python3 agent.py run --input big_spec.md --manifest run.json
PACK_LLM=codex python3 agent.py run --input big_spec.md --manifest run.json
Public Target
This pack is for LLM platform operators, automation consultants, internal tools teams, prompt engineers, and agencies that receive large jobs that regularly hit context limits, timeouts, truncation, or brittle one-shot runs.
Outputs
The merged output is human-readable Markdown. The manifest records the run id, configuration, detection reasons, each subtask, attempts, failures, bounded re-splits, and whether the run used deterministic mode or a detected LLM CLI.
Use a local model (Ollama)
The optional LLM step can also run on your own machine through Ollama, so no text leaves your server. No account and no API key.
ollama pull <model> # any chat model you like
export PACK_LLM=ollama # prefer Ollama even if a coding-agent CLI is installed
export PACK_OLLAMA_MODEL=<model> # optional: default is the first chat model the server lists
python3 -c "import llm_adapter; print(llm_adapter.detect())" # prints: ollama
PACK_OLLAMA_HOSTpoints to another server (defaulthttp://127.0.0.1:11434);OLLAMA_HOSTis also read whenPACK_LLM=ollama.PACK_OLLAMA_NUM_CTXsets the context size if your reports or prompts are long.- Without
PACK_LLM, a local Ollama server is used only when no Claude Code, Kimi Code or Codex CLI is found. - If the server is down or the model is missing, the pack keeps working in its deterministic mode.
Learning memory (local and private)
Every LLM call this pack makes is journaled in ./.pack_memory/ next to the code, so the pack can improve for you. Nothing is ever sent anywhere.
- What is kept: the task name, the masked input, the masked answer, status and latency. Keys, tokens, e-mails, phone numbers, IP addresses, card and IBAN numbers and personal paths are masked before writing; the system prompt is never stored.
- Teach it:
python3 pack_memory.py feedback last okconfirms a result,python3 pack_memory.py feedback last bad --fix "the right answer"corrects it. Confirmed and corrected runs are reused as validated examples when a similar input comes in. Unrated runs are never injected into a prompt. - Find similar cases:
python3 pack_memory.py similar "some text"andpython3 pack_memory.py clusters(groups of near-identical failures) work in plain Python, no model needed. Optional meaning-based matching uses an embedding model you already run locally:python3 pack_memory.py enable-semantic(Ollama on this machine only). - Share, only if you want:
python3 pack_memory.py exportwrites an anonymised summary (counts, statuses, size buckets, no text) for you to review. - Control:
PACK_MEMORY=0turns it off,PACK_MEMORY_STORE_TEXT=0keeps fingerprints only,python3 pack_memory.py purge --yeswipes it.
