Documentation
¶
Overview ¶
Package config is the machine-local wiring file (ADR-0021): which Claude profile runs, where the truth DB lives, which local perception server (Ollama / MLX LM, ADR-0029) serves perception. It deliberately lives OUTSIDE the experience DB — the SQLite file is the portable experience (ADR-0018: 住む・持ち運べる形), while paths and profiles describe this machine and must not travel with it.
Every read site resolves flag > env > config: config is the durable choice `tomobit setup` writes, env is a session-scoped override (one shell, one daemon unit, one test — without touching the durable choice), a flag is a one-run override.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
ClaudeConfigDir *string `json:"claude_config_dir,omitempty"`
ClaudeArgs []string `json:"claude_args,omitempty"`
DB string `json:"db,omitempty"`
OllamaURL string `json:"ollama_url,omitempty"`
OllamaModel string `json:"ollama_model,omitempty"`
// PerceiveBackend selects the local perception server (ADR-0029): "ollama"
// or "mlx-lm". A plain string (not a pointer) is enough here — unlike
// ClaudeConfigDir, the domain has no valid empty value to confuse with
// absence, so "" unambiguously means "let ResolveBackend decide".
PerceiveBackend string `json:"perceive_backend,omitempty"`
MLXURL string `json:"mlx_url,omitempty"`
MLXModel string `json:"mlx_model,omitempty"`
// FaceAutoLaunch is a pointer for the same absent-vs-set reason as
// ClaudeConfigDir: nil = never chosen, so the ADR-0025 default (on) holds;
// an explicit false is the user turning the face window off. A plain bool
// could not tell "left at the default" from "deliberately disabled".
FaceAutoLaunch *bool `json:"face_auto_launch,omitempty"`
// FaceResident is the same absent-vs-set pointer, orthogonal to
// FaceAutoLaunch (ADR-0027): the latter is "open the window", this is "keep
// the window after the conversation ends". nil = the default, which is
// false = ephemeral (the window self-closes once no chat/do is alive); an
// explicit true keeps the old ADR-0025 behavior (stays until Esc/Q).
FaceResident *bool `json:"face_resident,omitempty"`
// SplitProtocol is the ADR-0028 kill switch (Decision 1). A pointer for the
// same absent-vs-set reason as the face fields, but the default is on: nil =
// key absent = the split protocol rides every eligible do (always-on), and an
// explicit false is the opt-out that stops it without reverting to opt-in
// (judgment stays zero — a machine either splits by Provider judgment or not
// at all). A plain bool's zero value would read a config that predates the
// key as "disabled", silently downgrading every existing machine.
SplitProtocol *bool `json:"split_protocol,omitempty"`
// QuotaObserve gates the ADR-0044 route-A observers (ADR-0049). A pointer
// for the same absent-vs-set reason as the others, but unlike SplitProtocol
// the default is OFF: nil = key absent = do not read the Keychain and do not
// call the vendor usage endpoint. The asymmetry is deliberate — this is the
// one organ that reads a credential and touches a network endpoint the
// vendor never documented, so "the user never said yes" must not mean yes.
QuotaObserve *bool `json:"quota_observe,omitempty"`
// IsolateProtocol is the ADR-0050 kill switch, shaped exactly like
// SplitProtocol and defaulting the same way: nil = key absent = the
// isolation protocol rides every eligible run, an explicit false stops it.
// Opt-out, not a reversion to opt-in — a machine either asks Providers to
// split their workspace off or it does not, and that is not a per-run
// judgment anyone should have to make.
IsolateProtocol *bool `json:"isolate_protocol,omitempty"`
// ParallelSubtasks is the ADR-0056 kill switch, shaped like the two above.
// nil = key absent = a group the Provider declared independent runs in
// parallel without asking; an explicit false makes every split sequential.
//
// The switch exists even though ADR-0056 chose to trust the declaration:
// deciding to trust and being able to stop are different things. An explicit
// false is exactly the 「信じない」 position that ADR was weighed against, so
// reverting needs no redesign — only this key.
ParallelSubtasks *bool `json:"parallel_subtasks,omitempty"`
// TestCommands maps a working directory to the command that observes whether
// its tests pass (ADR-0052 Decision 2). "How this project runs its tests" is
// wiring, in the same sense ADR-0047 gave the word: it describes this machine
// and this checkout, not an experience, so it lives here and never in the DB.
//
// tomobit holds one string per place and knows no test runner — `go`, `npm`
// and `pytest` are outside its vocabulary, the way ADR-0050 keeps VCS names
// outside it. An absent map (or no matching place) means nothing runs: the
// feature is opt-in by construction, so silence stays silence (ADR-0049).
//
// The command runs at every task boundary of a matching place, through
// `sh -c`, and only its exit code is read.
TestCommands map[string]string `json:"test_commands,omitempty"`
// TestTimeoutSec bounds that command (ADR-0052 Decision 4 / 実装時ノブ). 0 or
// absent means the default; a timeout records nothing, since a runner that
// never finished observed nothing about the deliverable.
TestTimeoutSec int `json:"test_timeout_sec,omitempty"`
}
Config is the file's whole shape (v1). ClaudeConfigDir is a pointer because absent and empty mean different things: nil = never chosen, so `do` refuses to launch claude-code (ADR-0006 実装追記); "" = explicitly inherit the parent environment.
func Load ¶
Load reads Path. A missing file is not an error — it is the zero Config (nothing configured yet). A present-but-broken file IS an error, so a typo never silently downgrades the machine to defaults.
func (Config) QuotaObserveEnabled ¶
QuotaObserveEnabled resolves the ADR-0049 gate: absent key = off. Kept on Config (not in cmd/) because both the CLI and any future renderer must read the same answer — a second copy of this default is a second place to get the "silence means no" wrong.
func (Config) ResolveBackend ¶
ResolveBackend picks which perception backend serves this machine (ADR-0029 Decision 3). goos is injected (rather than read from runtime.GOOS here) so the "unwired machine" branch is pinnable in a test without actually running on darwin.