Compare commits

...

2 Commits

Author SHA1 Message Date
Χγφτ Kompanion 45a6540cc4 docs: memory plan (sqlite+faiss) 2025-10-13 00:07:53 +13:00
Χγφτ Kompanion 0abb798aac feat(docker): add Compose (tor+ollama+runner) and runtime 2025-10-13 00:07:18 +13:00
5 changed files with 46 additions and 12 deletions

View File

@ -1,18 +1,30 @@
version: "3.9"
services:
tor:
image: dperson/torproxy:latest
command: -n
restart: unless-stopped
ollama:
image: ollama/ollama:latest
volumes:
- ollama:/root/.ollama
restart: unless-stopped
runner:
image: python:3.11-slim
command: ["/bin/sh","-lc","pip install requests pyyaml && python /app/kom_runner.py"]
build:
context: ..
dockerfile: docker/runner/Dockerfile
environment:
XDG_STATE_HOME: /state
XDG_CONFIG_HOME: /config
XDG_CACHE_HOME: /cache
OLLAMA_BASE_URL: http://ollama:11434
ALL_PROXY: socks5h://tor:9050
NO_PROXY: localhost,127.0.0.1,ollama
volumes:
- /home/kompanion/.local/state/kompanion:/state
- /home/kompanion/.config/kompanion:/config:ro
- /home/kompanion/metal-kompanion-runtime:/app:ro
environment:
- XDG_STATE_HOME=/home/kompanion/.local/state
- XDG_CONFIG_HOME=/home/kompanion/.config
network_mode: "host"
restart: unless-stopped
tor:
image: dperson/torproxy
ports: ["9050:9050"]
- /home/kompanion/.config/kompanion:/config
- /home/kompanion/.cache/kompanion:/cache
depends_on: [ollama, tor]
restart: unless-stopped
volumes:
ollama:

12
docker/runner/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM
python:3.11-slim
RUN useradd -m -u 1000 app && mkdir -p /app
WORKDIR
/app
COPY runtime/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY runtime/kom_runner.py /app/kom_runner.py
USER
app
ENV XDG_STATE_HOME=/state XDG_CONFIG_HOME=/config XDG_CACHE_HOME=/cache OLLAMA_BASE_URL=http://ollama:11434 NO_PROXY=localhost,127.0.0.1,ollama
CMD ["python", "-u", "/app/kom_runner.py"]

5
docs/MEMORY.md Normal file
View File

@ -0,0 +1,5 @@
# Memory Plan (sqlite + FAISS)
- sqlite: embeddings.db with tables: chunks(id, file, sha, lineno, text, ts), vectors(id, dim, data BLOB)
- faiss: faiss.index for fast ANN; sqlite is source of truth
- provenance mandatory; ripgrep is canonical text source
- journal is never overwritten; only append

3
runtime/kom_runner.py Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env python3
import time
while True: time.sleep(3600)

2
runtime/requirements.txt Normal file
View File

@ -0,0 +1,2 @@
requests
pyyaml