218 lines
18 KiB
JSON
218 lines
18 KiB
JSON
{
|
|
"_comment": "Per-machine config. config.json is gitignored. bootstrap.sh seeds config.json from this file only when config.json does not exist, and NOTHING writes config.json afterwards — only a human edits it. Pinned engine/tokenizer/GGUF/simplex-chat refs live in the committed pins.json, not here. Every machine keeps its own config.json.",
|
|
"tau": 0.6,
|
|
"max_reentries": 3,
|
|
"creation_approval": false,
|
|
"navigation": {
|
|
"_comment": "Navigation is two-stage at BOTH levels and the guards are the create doors (no threshold gate). Category: the softmax offers each existing category WITH its description (bare names carried no signal) plus create_category; confirm_category_fit then confirms the winner's scope (phase navigate:category_scope, P(covers) >= category_tau) and a rejected winner authors a new category. The `response` catchall and create_category share a boundary arbitrated by the actionability guard confirm_non_action (phase navigate:actionability, P(non_action) >= action_tau): the closed response tree is reached ONLY when the input is not a request, so a request no skill covers (e.g. \"what is 255 * 12?\") authors instead of getting a canned reply. Leaf: the softmax offers only existing skills; confirm_skill_fit then compares the winner's action to the request (phase navigate:intent, P(same) >= intent_tau) and a mismatch authors a new leaf. All three taus are separate from the top-level tau so tuning reuse-vs-create or actionability does not move run assessment/fidelity. The category check is deliberately permissive: with real descriptions in-scope requests score 0.9-1.0, so a borderline over-cover routes into a plausible category and the leaf guard catches it.",
|
|
"intent_tau": 0.6,
|
|
"category_tau": 0.75,
|
|
"action_tau": 0.5
|
|
},
|
|
"queue": {"max_size": 100, "age_rate": 0.01},
|
|
"engine": {
|
|
"_comment": "Per-machine engine settings only. The pinned engine/tokenizer/GGUF refs (semif_repo, semif_ref, gguf_url, gguf_sha256, source, revision) live in the committed pins.json — bumped on update, never per-machine config. The GGUF path is derived from pins.json's engine.gguf_url under .runtime/models/; set `gguf` here only to override it with a custom path.",
|
|
"backend": "llamacpp",
|
|
"context_tokens": 4096,
|
|
"threads": 8
|
|
},
|
|
"llm": {
|
|
"_comment": "Small OpenAI-compatible model that authors a new category/skill title + description (never the runnable body — that is `codegen` below). Deliberately its own endpoint/model, so it can be local and fast even when codegen is remote. Runs on THIS machine's local ollama; bootstrap reads base_url/model from here (a --llm-url/--llm-model flag overrides for that run only) and pulls `model` if it is missing. `model` is required (no default): set it to a model the endpoint serves. Uses the same provider machinery as codegen (real SSE stream, token budget, idle watchdog); short JSON replies. Sampler params (temperature/top_p/presence_penalty/frequency_penalty) are opt-in: an unset value is omitted from the request so the server's model default applies — set them here only when you know the right values for the model. The draft is authored asynchronously by a single-slot worker and the request re-runs when it lands; an unreachable endpoint is graceful (traced, user notified), not fatal. disable_thinking sends reasoning_effort:none so a reasoning model answers the short JSON directly instead of spending the reply budget on hidden chain-of-thought (set false only for an endpoint that rejects the parameter). provider selects the transport: \"ollama\" (default; a local OpenAI-compatible server, context auto-detected via /api/show) or \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code or glm-5.3, and provide api_key or api_key_env; the ollama probe is skipped).",
|
|
"provider": "ollama",
|
|
"base_url": "http://localhost:11434/v1",
|
|
"model": "",
|
|
"api_key": "",
|
|
"api_key_env": "",
|
|
"user_agent": "",
|
|
"timeout": 600,
|
|
"stream": false,
|
|
"idle_warn": 30,
|
|
"idle_timeout": 120,
|
|
"context_window": 0,
|
|
"temperature": 0.2,
|
|
"top_p": 0.9,
|
|
"presence_penalty": 0.0,
|
|
"frequency_penalty": 0.0,
|
|
"disable_thinking": true
|
|
},
|
|
"codegen": {
|
|
"_comment": "OpenAI-compatible model that writes runnable skill bodies. Runs on a REMOTE ollama host (bootstrap reads base_url/model from here; a --codegen-url/--codegen-model flag overrides for that run only); the local small model is `llm` above. `model` is required (no default): set it to a code-capable model the endpoint serves. Bodies perform real actions against the user's configured services via stdlib transports, read every operational value from ctx.config, and declare their integration (INTEGRATION: service/transport/config_vars). Larger/slower than the decision or title/description model. The transport always streams so the client-side token budget (output cap / peak total fill) can abort a runaway in real time; stream only toggles console echo of tokens. timeout is total seconds; idle_warn/idle_timeout surface a silent (wedged) stream. The context window is auto-detected via ollama /api/show; context_window is the manual fallback (0 = auto/default 100000). smart_limit/warn_limit and max_fill_ratio/warn_fill_ratio bound total fill; max_output caps streamed output (>=1 absolute tokens, 0<x<1 fraction of window); chars_per_token converts chars to the token estimate. temperature/top_p/presence_penalty/frequency_penalty are opt-in: an unset value is omitted from the request so the server's model/Modelfile default applies; set them here only when you know the right values for the model. A rejected body retries with a fresh short prompt (max_attempts attempts), reusing the same sampler params. elicitation asks the product owner implementation questions before the body is written (posted to the question queue; every front end defers). After the body lands it is reviewed for real-action fidelity, then the data contract (contract.json) is derived in a separate call, then skill.test.py (hermetic mechanics test: loopback http.server for HTTP bodies, fixtures inline, no external network) in a shared-context call, and the test is auto-run as a subprocess (test_timeout seconds); on failure a 3-option SemIf decision (code/contract/test) regenerates the failing piece, bounded by test_max_attempts. contract_search.enabled auto-populates the skill config.json via SemIf against the global + category config. provider selects the transport: \"ollama\" (default; local OpenAI-compatible server, context auto-detected via /api/show) or \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code, glm-5.3, or deepseek-v4.1-flash, and provide api_key or api_key_env; the ollama probe is skipped).",
|
|
"provider": "ollama",
|
|
"base_url": "http://localhost:11434/v1",
|
|
"model": "",
|
|
"api_key": "",
|
|
"api_key_env": "",
|
|
"user_agent": "",
|
|
"timeout": 3600,
|
|
"stream": true,
|
|
"idle_warn": 60,
|
|
"idle_timeout": 180,
|
|
"context_window": 0,
|
|
"smart_limit": 250000,
|
|
"warn_limit": 500000,
|
|
"max_fill_ratio": 0.9,
|
|
"warn_fill_ratio": 0.7,
|
|
"max_output": 0.85,
|
|
"chars_per_token": 4.0,
|
|
"temperature": 1,
|
|
"top_p": 0.95,
|
|
"presence_penalty": 0,
|
|
"frequency_penalty": 1,
|
|
"max_attempts": 3,
|
|
"elicitation": {
|
|
"_comment": "Ask the product owner implementation questions before the body is written: which service/account, how to connect, where the credential comes from, what success looks like. Every front end defers questions to the questions panel; the single-slot writer asks them one at a time and waits answer_timeout seconds for each (the clock resets on every answer submit, so the user only ever sees the next question after answering the current one; a timeout stops the sequence). wait_timeout is the separate, longer wait for the optional creation-approval gate. Questions never ask for operational data values (collected at first fire) or config-vs-input cadence (the config step owns that).",
|
|
"enabled": true,
|
|
"max_questions": 4,
|
|
"answer_timeout": 30,
|
|
"wait_timeout": 900
|
|
},
|
|
"fidelity": {
|
|
"_comment": "After the body lands, an authoring:fidelity SemIf decision (accept/reconsider, P(reconsider) >= tau or any static finding) checks whether it really performs the action vs simulates it (canned result, fabricated data, draft-by-default). Static INTEGRATION checks (declaration vs code) run alongside. The gate never diagnoses: a rejected body is regenerated with the raw evidence bundle, bounded by max_attempts; a still-fake body is accepted but traced/badged, never a hard authoring failure.",
|
|
"enabled": true,
|
|
"max_attempts": 1
|
|
},
|
|
"repair": {
|
|
"_comment": "A failed real run triggers a logged SemIf repair choice (retry / repair_skill / ask_user / no_repair) surfaced in the REPL and dashboard. Executing a repair is user-confirmed (a codegen write is slow); body repairs are bounded by max_attempts per skill and carry the observed failure into the regeneration.",
|
|
"enabled": true,
|
|
"max_attempts": 1
|
|
},
|
|
"test_timeout": 30,
|
|
"test_max_attempts": 3,
|
|
"contract_search": {
|
|
"_comment": "After the data contract lands, run a SemIf choice per variable to auto-populate the skill config.json from the global config and the category config (data/skills/<category>/config.json). Logged as phase config:search.",
|
|
"enabled": true
|
|
},
|
|
"degeneration": {
|
|
"_comment": "SemIf degeneration watchdog: while the body streams, a 2-option SemIf decision (continue/stop) is made every `interval` chars against the last `window` chars of content+reasoning (once `min_chars` have accumulated); P(stop) >= threshold aborts the write with a graceful stub. Recorded trace-only (kind `codegen`), never in the decision log. Disabled when no engine is available.",
|
|
"enabled": true,
|
|
"threshold": 0.9,
|
|
"interval": 8000,
|
|
"window": 2000,
|
|
"min_chars": 4000
|
|
}
|
|
},
|
|
"skill_bodies": "data/skills",
|
|
"skill_seeds": "seeds",
|
|
"simplex_bridge_url": "http://127.0.0.1:5227",
|
|
"simplex_bridge_token": "",
|
|
"llm_bridge_url": "http://127.0.0.1:5229",
|
|
"llm_bridge_token": "",
|
|
"log": "data/decisions.jsonl",
|
|
"trace": "data/runs.jsonl",
|
|
"category_registry": "data/categories.json",
|
|
"simplex_chat": {
|
|
"_comment": "Per-machine simplex-chat daemon settings. The pinned binary (version/bin_url/sha256) lives in the committed pins.json, not here. The command gateway talks to the daemon on `port` (profile .runtime/simplex/, unit semif-simplex.service). The SimpleX forwarding bridge owns its OWN daemon/profile on `forward_port` (profile .runtime/simplex-forward/, unit semif-simplex-forward.service) so messaging UX never shares the command bot's identity. bootstrap.sh renders both units from these values. gateway.simplex.ws_url must match `port`; bridges.simplex.ws_url must match `forward_port`.",
|
|
"port": 5226,
|
|
"display_name": "semif",
|
|
"forward_port": 5228,
|
|
"forward_display_name": "semif-forward"
|
|
},
|
|
"bridges": {
|
|
"_comment": "Standalone third-party API bridges: a simple, secure local HTTP layer between codegen-authored skill bodies and real system services. Each bridge runs as its own process (`python -m semif_agent.cli bridge [--name NAME]`), one process per service daemon, and never runs inside the command gateway — gateway isolation is non-negotiable (see AGENTS.md). The bridge catalog (names, endpoints, config vars) is injected into the code-generation prompts via `semif_agent.bridges.describe_bridges()`.",
|
|
"simplex": {
|
|
"_comment": "SimpleX forwarding bridge: buffers every inbound DM (no allowlist — the point is to see who reached the bot through its invite link), and serves invite-link / read / send over HTTP. It owns its own simplex-chat daemon/profile (`ws_url`, `forward_port` above), separate from the command gateway's. Skills use the top-level `simplex_bridge_url`; keep it in sync with host/port. Binds localhost only; an optional `token` is required in the X-Semif-Token header when set.",
|
|
"enabled": true,
|
|
"host": "127.0.0.1",
|
|
"port": 5227,
|
|
"token": "",
|
|
"max_inbox": 100,
|
|
"ws_url": "ws://127.0.0.1:5228",
|
|
"user_id": 1,
|
|
"auto_accept": true,
|
|
"reconnect": {"initial": 1.0, "max": 60.0, "jitter": 0.2}
|
|
},
|
|
"llm": {
|
|
"_comment": "LLM bridge: a generic `POST /chat` in front of the agent's configured `llm` model, so skill bodies can ask for short generated text (e.g. an event title + description) over HTTP instead of speaking the OpenAI-compatible protocol. It reuses the top-level `llm` client (endpoint/model/sampler configured once there); this block only carries the local listener. Skills use the top-level `llm_bridge_url`; keep it in sync with host/port. Binds localhost only; an optional `token` is required in the X-Semif-Token header when set. It runs inside the same `semif-bridge.service` process as the other enabled bridges.",
|
|
"enabled": true,
|
|
"host": "127.0.0.1",
|
|
"port": 5229,
|
|
"token": ""
|
|
}
|
|
},
|
|
"gateway": {
|
|
"_comment": "Messenger COMMAND intake — and nothing else. `python -m semif_agent.cli gateway` runs one or more platforms (`--platform simplex,lxmf` or `all`) in a SINGLE process sharing one scheduler/skill store — never run two gateway processes over one store. Each platform feeds authorized DM text through the normal gate/score/queue/dispatch pipeline; results, authoring questions, and repair offers are sent back to the originating chat. It must never read a contact's history, show/create invite links, or compose on the user's behalf — that is the independent bridge services' job (`bridges`). home_channel receives messages whose origin chat is unknown (e.g. a background repair offer). reply_prefix is prepended to every reply. text_batch_delay concatenates rapid-fire messages from one contact.",
|
|
"simplex": {
|
|
"_comment": "SimpleX command adapter. Connects to the command simplex-chat daemon (`simplex_chat.port`) over its JSON WebSocket API. Requires the optional `websockets` package (lazy-imported; the gateway refuses to start without it). allowed_users entries match either a numeric contactId or a display name; default is deny-all unless allow_all_users is set. Groups/attachments are not supported.",
|
|
"enabled": true,
|
|
"ws_url": "ws://127.0.0.1:5226",
|
|
"allowed_users": [],
|
|
"allow_all_users": false,
|
|
"auto_accept": true,
|
|
"home_channel": "",
|
|
"reply_prefix": "",
|
|
"text_batch_delay": 0.8,
|
|
"reconnect": {"initial": 1.0, "max": 60.0, "jitter": 0.2}
|
|
},
|
|
"lxmf": {
|
|
"_comment": "LXMF (Reticulum) command adapter. Runs IN-PROCESS — there is no external daemon; `pip install lxmf` provides the transport (optional, lazy-imported; the gateway refuses to start with an install hint). The bot's reachable address is its LXMF delivery destination hash (32 hex chars), printed on connect. config_dir/storage_path hold Reticulum's config and the persisted identity under .runtime/lxmf/ so the address is stable across restarts (empty = the .runtime/lxmf defaults). allowed_users entries match the peer's LXMF address (32 hex chars) or a best-effort display name; default is deny-all unless allow_all_users is set. desired_method is 'direct' (reliable link) or 'opportunistic' (single packet). propagation_node is an optional LXMF propagation-node address (hex) for store-and-forward.",
|
|
"enabled": false,
|
|
"allowed_users": [],
|
|
"allow_all_users": false,
|
|
"display_name": "semif",
|
|
"announce_interval": 3600,
|
|
"stamp_cost": 8,
|
|
"desired_method": "direct",
|
|
"propagation_node": "",
|
|
"config_dir": "",
|
|
"storage_path": "",
|
|
"home_channel": "",
|
|
"reply_prefix": "",
|
|
"text_batch_delay": 0.8
|
|
},
|
|
"voice": {
|
|
"_comment": "Voice command adapter: a local microphone front end with wake word + speech-to-text + text-to-speech. Requires the optional voice stack (requirements/voice.txt; sounddevice + openwakeword + faster-whisper + piper-tts + onnxruntime; the system needs libportaudio2). Lazy-imported; the gateway refuses to start with an install hint. Runs best in the user's audio session (foreground `gateway --platform voice`), not a headless systemd user service. Audio is 16 kHz mono int16; capture/playback run at the device's native rate and are resampled to/from 16 kHz (capture_sample_rate/output_sample_rate override it; 0 = the device default). wake.model is an openWakeWord model name or path (bootstrap downloads models into the venv, where they resolve by name; model_dir is an optional local dir for a custom model file); stt.model is a faster-whisper size/path (cached under .runtime/hf); tts.voice is a Piper voice id or path (bootstrap downloads it under .runtime/voice/tts). After each reply the next utterance is accepted without the wake word for follow_up_window_s. max_speak_chars truncates long replies before speaking. chat_id identifies the single local session; home_channel defaults to it so timers/repair offers are spoken too.",
|
|
"enabled": false,
|
|
"chat_id": "voice",
|
|
"display_name": "voice",
|
|
"home_channel": "voice",
|
|
"reply_prefix": "",
|
|
"max_speak_chars": 600,
|
|
"follow_up_window_s": 5.0,
|
|
"cue": {
|
|
"_comment": "Audible feedback. A short sine beep plays when the wake word fires so you know you're being heard; set submit_frequency > 0 for a second beep once the utterance is transcribed. volume is 0..1.",
|
|
"enabled": true,
|
|
"frequency": 880,
|
|
"duration_ms": 120,
|
|
"volume": 0.9,
|
|
"submit_frequency": 0,
|
|
"submit_duration_ms": 100
|
|
},
|
|
"wake": {
|
|
"model": "hey_mycroft",
|
|
"threshold": 0.5,
|
|
"inference_framework": "onnx",
|
|
"model_dir": ""
|
|
},
|
|
"stt": {
|
|
"model": "base.en",
|
|
"device": "cpu",
|
|
"compute_type": "int8",
|
|
"language": "en"
|
|
},
|
|
"tts": {
|
|
"voice": "en_US-lessac-medium",
|
|
"voice_dir": "",
|
|
"speaker_id": 0,
|
|
"length_scale": 1.0,
|
|
"volume": 1.0
|
|
},
|
|
"audio": {
|
|
"input_device": "",
|
|
"output_device": "",
|
|
"sample_rate": 16000,
|
|
"frame_ms": 80,
|
|
"capture_sample_rate": 0,
|
|
"output_sample_rate": 0,
|
|
"dc_removal": true
|
|
},
|
|
"vad": {
|
|
"silence_ms": 1000,
|
|
"min_speech_ms": 120,
|
|
"max_utterance_s": 30,
|
|
"aggressiveness": 2,
|
|
"energy_threshold": 200.0
|
|
}
|
|
}
|
|
},
|
|
"dashboard": {"port": 8765, "host": "127.0.0.1"}
|
|
} |