Files
semif-agent/config.example.json
T
Denton Social 98ec4ee5e2 codegen: move bridge specifics into the catalog
Bridge specifics (service, base-URL config var, auth header/token var,
config-var docs, endpoints with error shapes) now live in BridgeInfo and
render through describe_bridges(), which is injected into body, retry,
regen, elicitation, and testgen prompts. SKILL.md/TESTGEN.md carry only
the generic pattern.

- regen prompt regains the catalog (was a dangling reference)
- elicitation integration hint rides body/retry/regen as an advisory
- top-level simplex_bridge_token config var; bootstrap syncs it
- simplex seeds read the token and send X-Semif-Token when set
2026-09-28 23:30:44 -05:00

121 lines
10 KiB
JSON

{
"_comment": "Per-machine config. config.json is gitignored; copy this file to config.json and adjust paths. The box (guppy) keeps its own config.json with local paths.",
"tau": 0.6,
"max_reentries": 3,
"queue": {"max_size": 100, "age_rate": 0.01},
"engine": {
"backend": "llamacpp",
"source": "Qwen/Qwen3.5-4B",
"revision": "851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a",
"gguf": "/home/abby/models/Qwen3.5-4B-Q4_K_M.gguf",
"gguf_url": "https://huggingface.co/bartowski/Qwen_Qwen3.5-4B-GGUF/resolve/main/Qwen_Qwen3.5-4B-Q4_K_M.gguf",
"gguf_sha256": "13c16f426047e2de38cd075bdade4a7bcbc8c774384876f677740cda65f8a983",
"semif_repo": "https://github.com/TheoLeeCJ/SemIf.git",
"semif_ref": "1f2dea3e25379f9dfc98cb83c324f00ab5deda37",
"context_tokens": 4096,
"threads": 8
},
"llm": {
"_comment": "Dormant OpenAI-compatible endpoint. Assessment and fidelity are SemIf decisions now, so the LLM is out of every decision path; this block is retained for backlogged retirement and only `_parse_json` is still borrowed by the authoring parsers. Runs on THIS machine's local ollama; bootstrap sets base_url from --llm-url (default http://127.0.0.1:11434) and pulls `model` if it is missing. Only codegen travels to a remote host.",
"base_url": "http://localhost:11434/v1",
"model": "qwen3.5:4b"
},
"codegen": {
"_comment": "OpenAI-compatible model that writes runnable skill bodies. Runs on a REMOTE ollama host (bootstrap sets base_url from --codegen-url, default guppy http://192.168.8.181:11434); the local small model is `llm` above. 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 self-assessment 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 follow the Qwen3.8 model card's instruct-mode anti-repetition guidance (high presence_penalty, not greedy temperature); generate_skill_body escalates to presence 2.0 / temp 0.5 on retries (max_attempts attempts, fresh short prompt each time). elicitation asks the product owner implementation questions before the body is written (REPL inline; dashboard deferred). 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.",
"base_url": "http://localhost:11434/v1",
"model": "qwen38-iq3s",
"timeout": 1200,
"stream": false,
"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": 0.7,
"top_p": 0.85,
"presence_penalty": 1.5,
"frequency_penalty": 0.2,
"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. The REPL wires an inline asker; the dashboard defers questions to the questions panel and the single-slot writer waits up to wait_timeout seconds. 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,
"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": "",
"log": "data/decisions.jsonl",
"trace": "data/runs.jsonl",
"category_registry": "data/categories.json",
"simplex_chat": {
"_comment": "Pinned simplex-chat daemon(s). 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 downloads this exact binary (sha256 verified) into .runtime/bin/ and renders both units. Bump version/bin_url/sha256 together. gateway.simplex.ws_url must match `port`; bridges.simplex.ws_url must match `forward_port`.",
"version": "v7.0.3",
"bin_url": "https://github.com/simplex-chat/simplex-chat/releases/download/v7.0.3/simplex-chat-ubuntu-24_04-x86_64",
"sha256": "895fb14cfaa662d1c0947f2f871141fc89680fe3e70bff64c366cbe9e59aa4f0",
"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": false,
"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}
}
},
"gateway": {
"_comment": "Messenger COMMAND intake — and nothing else. `python -m semif_agent.cli gateway` connects to the command simplex-chat daemon (`simplex_chat.port`) over its JSON WebSocket API and 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`). 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. home_channel receives messages whose origin chat is unknown (e.g. a background repair offer). text_batch_delay concatenates rapid-fire messages from one contact. Groups/attachments are not supported in this first cut.",
"simplex": {
"enabled": false,
"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}
}
},
"dashboard": {"port": 8765, "host": "0.0.0.0"}
}