LocalAgent is a local coding backend for OpenCode and other OpenAI-compatible clients.
It combines:
- Go for the service layer
- Pebble-backed
github.com/fgrzl/kvsearch and index storage - Ollama for local models
- a workspace indexer that chunks files into searchable entities
- mux for the HTTP API layer
- Scans a local workspace and indexes text files into Pebble through
github.com/fgrzl/kv - Exposes keyword search at
/api/search - Exposes OpenAI-compatible chat completions at
/v1/chat/completions - Injects relevant indexed workspace context into chat prompts automatically
- Advertises a curated chat model catalog through
/v1/modelsand proxies Ollama embeddings
Defaults are chosen for local Docker use:
LOCALAGENT_HTTP_ADDR=:8080LOCALAGENT_OLLAMA_URL=http://ollama:11434LOCALAGENT_WORKSPACE_DIR=/workspaceLOCALAGENT_DATA_DIR=/dataLOCALAGENT_CHAT_MODEL=qwen2.5-coder:7b-instructLOCALAGENT_SUPPORTED_CHAT_MODELS=qwen2.5-coder:7b-instruct,qwen2.5-coder:14b-instructLOCALAGENT_EMBEDDING_MODEL=nomic-embed-textLOCALAGENT_SEARCH_HIT_LIMIT=8LOCALAGENT_CONTEXT_CHUNK_LIMIT=4LOCALAGENT_REQUEST_TIMEOUT=90s
docker compose up --buildPull the chat models Rudy advertises before starting the app if they are not already present in your Ollama volume:
docker compose exec ollama ollama pull qwen2.5-coder:7b-instruct
docker compose exec ollama ollama pull qwen2.5-coder:14b-instruct
docker compose exec ollama ollama pull nomic-embed-textThe app container mounts:
./workspacefor the code you want indexed./datafor Pebble data and the local index manifest
If you run Ollama outside Docker Compose, pull the models Rudy advertises before using OpenCode:
docker compose exec ollama ollama pull qwen2.5-coder:7b-instruct
docker compose exec ollama ollama pull qwen2.5-coder:14b-instruct
docker compose exec ollama ollama pull nomic-embed-textOpenCode is the primary coding client for this repo. Point it at http://localhost:8080/v1 and use the same chat model as the service defaults.
See opencode/README.md for the exact setup.
GET /healthzGET /api/search?q=golangPOST /api/index/rebuildPOST /api/index/filePOST /v1/chat/completions
- Add file watching for incremental reindexing
- Improve snippets around matched text
- Add optional semantic/vector retrieval