AGENTS.md@infrastructure/llm/cli · git:20260612.8db3bb9 · 2026-06-12 · sha256 5960df4095727a08
AGENTS.md@infrastructure/llm/cli git:20260612.8db3bb9A
Immutable. This exact content is served forever at /api/v1/blob/5960df4095727a08.
# LLM CLI Module
## Purpose
`infrastructure/llm/cli/` is the thin command-line wrapper around the local Ollama-backed LLM modules. It should stay focused on parsing arguments, loading config, and printing results.
## Layout
```mermaid
flowchart LR
CLI[infrastructure/llm/cli/]
CLI --> META[AGENTS.md · README.md]
CLI --> INIT[__init__.py]
CLI --> MAIN[main.py]
classDef d fill:#0f172a,stroke:#0f172a,color:#fff
classDef code fill:#1e3a8a,stroke:#0f172a,color:#fff
classDef doc fill:#0f766e,stroke:#0f172a,color:#fff
class CLI d
class INIT,MAIN code
class META doc
```
## Entry Point
Run the CLI with:
```bash
uv run python -m infrastructure.llm.cli
```
## Implementation Surface
`main.py` defines:
- `CLIError`
- `query_command(args: argparse.Namespace) -> None`
- `check_command(args: argparse.Namespace) -> None`
- `models_command(args: argparse.Namespace) -> None`
- `template_command(args: argparse.Namespace) -> None`
- `create_parser() -> argparse.ArgumentParser`
- `main() -> None`
## Commands
### `query`
Uses `OllamaClientConfig.from_env()` and `LLMClient` to send a prompt to the configured Ollama endpoint.
Flags:
- `--short`
- `--long`
- `--stream`
- `--model`
- `--temperature`
- `--max-tokens`
- `--seed`
### `check`
Verifies that the configured Ollama endpoint is reachable.
### `models`
Lists available models from the local Ollama daemon.
### `template`
Applies a prompt template from `infrastructure.llm.templates`. Supports `--list` and `--input`.
## Dependencies
The CLI imports:
- `LLMClient`
- `GenerationOptions`
- `OllamaClientConfig`
- `select_best_model`
- `is_ollama_running`
- `TEMPLATES`
- `get_template`
## Testing
- Deterministic tests should cover parser wiring and command behavior.
- Real-daemon smoke tests should use `@pytest.mark.requires_ollama`.
- End-to-end CLI tests should run through `uv run python -m infrastructure.llm.cli ...`.
## Related Docs
- `README.md`
- `../README.md`
- `../AGENTS.md`
- `../core/README.md`
- `../utils/README.md`
- `../../../docs/operational/troubleshooting/llm-review.md`