homelab-codex-ws/codex_context.yaml

96 lines
5.9 KiB
YAML

SESSION_STATE:
meta:
goal: "Maintain compressed lossless session memory in ./codex_context.yaml"
environment:
cwd: "/home/oskar/projects/homelab-codex-ws"
shell: "zsh"
date: "2026-04-22"
tz: "Europe/Warsaw"
systems:
S1:
name: "session_state"
file: "./codex_context.yaml"
format: "YAML"
root: "SESSION_STATE"
ops:
save: "overwrite after every meaningful change/decision"
load: "on startup if file exists"
export: "print file content only"
import: "load user-provided YAML"
constraints:
- "lossless"
- "compressed"
- "valid_yaml"
- "no_fluff"
- "dedupe"
- "use_ids"
- "never_delete_unless_explicit"
- "no_confirm_on_save"
S2:
name: "saturn_tailscale_llm_check"
obs:
O1: "SATURN hostname=saturn; ts_ipv4=100.121.168.72."
O2: "tailscale status: piha=100.108.208.3 active relay:waw; solaria=100.100.231.104 listed; DNS health warning."
O3: "tailscale ping piha: DERP(waw) 230/33/47ms; no direct; exit=1."
O4: "tailscale ping solaria: DERP(waw) 223/66/32ms; no direct; exit=1."
O5: "direct curl 100.100.231.104:11434/api/tags: run1 http=200 total=0.323280s connect=0.273345s size=690; run2 http=200 total=0.118377s connect=0.064582s size=690."
O6: "gateway curl 100.108.208.3:8080/api/tags: run1 exit=7 http=000 total=0.247810s; run2 exit=7 http=000 total=0.063145s."
O7: "direct response models: deepseek-coder:latest, deepcoder:14b."
configs:
CFG1:
name: "local_model_gateway"
base_url: "http://piha:8080"
preflight: "GET /"
routes:
coding: "/api/code"
general: "/api/chat"
body:
prompt: "<task>"
stream: false
constraints:
- "use_piha_only"
- "never_call_solaria_direct"
- "never_call_localhost_direct"
- "retry_once_on_failure"
- "report_endpoint_summary_errors"
output:
- "endpoint_used"
- "result_summary"
- "errors"
decisions:
D1: "No prior codex_context.yaml existed; initialized state file."
D2: "User requested commit; include current repo changes: ./codex_context.yaml, ./.gitignore, ./codex_context."
D3: "Git commit created with message: Add session context state."
D4: "User requested SATURN network verification: Tailscale active, piha/solaria reachable, test direct LLM 100.100.231.104:11434 and gateway 100.108.208.3:8080; no remote modifications."
D5: "Created ./start-codex.sh launcher to start Codex with embedded SESSION_STATE policy prompt and auto-load ./codex_context.yaml when present."
D6: "Startup 2026-04-21: loaded user-provided SESSION_STATE as authoritative memory; retained prior entries."
D7: "Gateway policy set: use http://piha:8080 only; coding->POST /api/code; general->POST /api/chat; preflight GET / before tasks; retry once on failure."
D8: "Startup 2026-04-22: loaded provided SESSION_STATE, verified disk state parity, refreshed meta.environment.date, overwrote ./codex_context.yaml."
D9: "Created ./ollama_client.py: minimal Python Ollama client using POST http://localhost:11434/api/chat, model=deepseek-coder, stream=false, ask(prompt)->message.content, with inline test call."
D10: "Updated ./ollama_client.py for reliability: urlopen timeout=10, try/except guards for HTTPError, URLError, JSONDecodeError, invalid response shape, fallback Exception; errors return 'ERROR: <message>'."
D11: "Created ./deploy_agent.py: imports ask from ollama_client; generate_compose(service)->strict YAML-only prompt; propagates 'ERROR:' responses; inline test generate_compose('nginx')."
D12: "User requested git commit on 2026-04-22; commit scope includes ./codex_context.yaml, ./ollama_client.py, ./deploy_agent.py, ./start-codex.sh."
D13: "Git commit created on 2026-04-22: 4cf42fc 'Add local Ollama automation scripts'."
D14: "Updated ./deploy_agent.py: added PyYAML validation, requires top-level services key, retries invalid output up to 2 times with corrective prompt, returns 'ERROR: invalid docker-compose' after exhaustion."
D15: "Extended ./deploy_agent.py with deploy_service(service): generates compose, writes ./deployments/<service[-n]>/docker-compose.yml without overwriting existing directories, runs 'docker compose up -d' via subprocess, returns DEPLOYED or ERROR."
D16: "Updated ./deploy_agent.py with get_service_status(path), post-deploy 'docker compose ps' verification requiring 'Up', error outputs including ps output when available, and pre-deploy 'docker ps' port-80 check that adds prompt note 'Use a different port than 80'."
D17: "User requested git commit on 2026-04-22; commit scope includes ./deploy_agent.py and ./codex_context.yaml for deployment status and safety updates."
todos:
T1: "For all future meaningful changes/decisions, update and overwrite ./codex_context.yaml."
T2: "DONE: Commit current changes."
T3: "DONE: Tailscale active."
T4: "DONE: piha and solaria reachable via DERP(waw); direct TS path not established."
T5: "DONE: direct vs gateway /api/tags measured."
T6: "DONE: Add local launcher script for Codex session memory bootstrap."
T7: "DONE: Add minimal local Ollama Python client."
T8: "DONE: Harden local Ollama Python client error handling."
T9: "DONE: Add compose-generation agent using local LLM client."
T10: "DONE: Commit local Ollama automation scripts."
T11: "DONE: Add docker-compose YAML validation and retry logic."
T12: "DONE: Add automatic service deployment workflow."
T13: "DONE: Add deployment status verification and basic port-80 safety check."
issues:
I1: "Tailscale DNS health warning: configured DNS servers unreachable."
I2: "Preferred gateway path unavailable: 100.108.208.3:8080 connection failed."
I3: "Prior direct solaria/gateway-IP checks remain historical only; current policy forbids direct solaria/localhost use."