neurastream 0.2.65 → 0.2.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,12 +5,13 @@
5
5
  // ones), so tests record argv and never run systemctl or the tailscale binary.
6
6
 
7
7
  import { spawnSync } from "node:child_process";
8
- import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
9
- import { homedir, tmpdir } from "node:os";
8
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
9
+ import { homedir } from "node:os";
10
10
  import { dirname, join } from "node:path";
11
11
  import { fileURLToPath } from "node:url";
12
12
  import { ConfigError, configFile, loadConfig } from "./config.ts";
13
13
  import { realTailscale, type Tailscale } from "./tailscale.ts";
14
+ import { checkEdited, setConfigKeys } from "./config-edit.ts";
14
15
 
15
16
  const HERE = dirname(fileURLToPath(import.meta.url));
16
17
  export const UI_UNIT_TEMPLATE = join(HERE, "../../templates/systemd/neurastream-ui.service");
@@ -28,6 +29,29 @@ export const systemRunner: Runner = args => {
28
29
  return { status: r.status, stderr: r.stderr ?? "" };
29
30
  };
30
31
 
32
+ export interface Terminal {
33
+ /** Prints the question on the terminal and returns the answer line. */
34
+ ask(question: string): string;
35
+ /** Opens a URL in the default browser. */
36
+ open(url: string): void;
37
+ }
38
+
39
+ // Production terminal. sh reads the answer from the inherited terminal, so uiOn stays synchronous.
40
+ export const systemTerminal: Terminal = {
41
+ ask(question) {
42
+ const r = spawnSync("sh", ["-c", 'printf "%s" "$1" >&2; read -r answer; printf "%s" "$answer"', "sh", question], { encoding: "utf8", stdio: ["inherit", "pipe", "inherit"] });
43
+ return r.stdout ?? "";
44
+ },
45
+ open(url) {
46
+ spawnSync(process.platform === "darwin" ? "open" : "xdg-open", [url], { stdio: "ignore" });
47
+ },
48
+ };
49
+
50
+ const TAILSCALE_DOWNLOAD = "https://tailscale.com/download";
51
+ const TAILSCALE_MISSING = "The phone page needs Tailscale (free, private network for your devices). Install it: Linux `curl -fsSL https://tailscale.com/install.sh | sh` (asks for your password), macOS: the App Store app, others: https://tailscale.com/download. Then run `neurastream ui on` again.";
52
+ const TAILSCALE_STOPPED = "Tailscale is installed but not connected. Run `sudo tailscale up` (Linux) or open the Tailscale app (macOS), then run this again.";
53
+ export { TAILSCALE_MISSING, TAILSCALE_STOPPED };
54
+
31
55
  export interface UiSetupOptions {
32
56
  /** HOME the config file and the user unit resolve against. Default: the real home. */
33
57
  home?: string;
@@ -43,64 +67,8 @@ export interface UiOnOptions extends UiSetupOptions {
43
67
  login: string;
44
68
  /** The --port N of the command line; null leaves the config's ui.port in place. */
45
69
  port?: number | null;
46
- }
47
-
48
- // Line-based edit of the top-level `ui:` block: replaces only the enabled/owner_login/port
49
- // lines inside it, keeps every other line of the file byte-for-byte (comments, order, other
50
- // sections), and appends a fresh block when the config has none. Never re-serialises YAML.
51
- function editUiBlock(text: string | null, values: { enabled: boolean; owner_login: string | null; port: number | null }): string {
52
- const fresh = ["ui:", ` enabled: ${values.enabled}`];
53
- if (values.owner_login !== null) fresh.push(` owner_login: ${values.owner_login}`);
54
- if (values.port !== null) fresh.push(` port: ${values.port}`);
55
- if (text === null) return `${fresh.join("\n")}\n`;
56
- const lines = text.split("\n");
57
- let start = -1;
58
- for (let i = 0; i < lines.length; i++) {
59
- if (/^ui\s*:(\s*(?:#.*)?)?$/.test(lines[i] ?? "")) {
60
- start = i;
61
- break;
62
- }
63
- }
64
- if (start === -1) {
65
- const base = text === "" || text.endsWith("\n") ? text : `${text}\n`;
66
- return `${base}${fresh.join("\n")}\n`;
67
- }
68
- let end = start + 1;
69
- while (end < lines.length && (lines[end] === "" || /^[ \t]/.test(lines[end]!))) end++;
70
- const setKey = (key: string, value: string): void => {
71
- const re = new RegExp(`^([ \\t]+)${key}\\s*:.*$`);
72
- for (let i = start + 1; i < end; i++) {
73
- const line = lines[i]!;
74
- if (re.test(line)) {
75
- lines[i] = line.replace(re, `$1${key}: ${value}`);
76
- return;
77
- }
78
- }
79
- // The block has no such key: insert after its last non-blank line, at two-space indent.
80
- let at = start + 1;
81
- for (let i = start + 1; i < end; i++) if (lines[i]!.trim() !== "") at = i + 1;
82
- lines.splice(at, 0, ` ${key}: ${value}`);
83
- };
84
- setKey("enabled", String(values.enabled));
85
- if (values.owner_login !== null) setKey("owner_login", values.owner_login);
86
- if (values.port !== null) setKey("port", String(values.port));
87
- return lines.join("\n");
88
- }
89
-
90
- // Validates the edited text through loadConfig before anything is written: if it would not
91
- // load, nothing is written and the caller reports the error (the real file stays untouched).
92
- function checkEdited(edited: string, home: string, what: string, error: (line: string) => void): boolean {
93
- const check = join(tmpdir(), `neurastream-ui-${what}-check-${process.pid}.yml`);
94
- try {
95
- writeFileSync(check, edited);
96
- loadConfig({ file: check, home });
97
- return true;
98
- } catch (err) {
99
- error(err instanceof ConfigError ? err.message : String(err));
100
- return false;
101
- } finally {
102
- rmSync(check, { force: true });
103
- }
70
+ /** Terminal seam for the missing-tailscale question. Absent: no question, only the message. src/cli/ui.ts passes the real one on a TTY. */
71
+ terminal?: Terminal;
104
72
  }
105
73
 
106
74
  export function uiOn(opts: UiOnOptions): number {
@@ -109,6 +77,18 @@ export function uiOn(opts: UiOnOptions): number {
109
77
  const tailscale = opts.tailscale ?? realTailscale;
110
78
  const print = opts.print ?? console.log;
111
79
  const error = opts.error ?? console.error;
80
+ // Tailscale comes first (plan 20261028_2356 P2): nothing is read, written or run unless it is up.
81
+ const state = tailscale.state();
82
+ if (state === "missing") {
83
+ error(`neurastream ui: ${TAILSCALE_MISSING}`);
84
+ const terminal = opts.terminal;
85
+ if (terminal && terminal.ask("Open the Tailscale download page now? [y/N] ").trim().toLowerCase() === "y") terminal.open(TAILSCALE_DOWNLOAD);
86
+ return 1;
87
+ }
88
+ if (state === "stopped") {
89
+ error(`neurastream ui: ${TAILSCALE_STOPPED}`);
90
+ return 1;
91
+ }
112
92
  const file = configFile(home);
113
93
  let cfg;
114
94
  try {
@@ -125,8 +105,16 @@ export function uiOn(opts: UiOnOptions): number {
125
105
  return 1;
126
106
  }
127
107
  const original = existsSync(file) ? readFileSync(file, "utf8") : null;
128
- const edited = editUiBlock(original, { enabled: true, owner_login: opts.login, port: opts.port ?? null });
129
- if (!checkEdited(edited, home, "on", error)) return 1;
108
+ const values: Record<string, string> = { "ui.enabled": "true", "ui.owner_login": opts.login };
109
+ if (typeof opts.port === "number") values["ui.port"] = String(opts.port);
110
+ let edited: string;
111
+ try {
112
+ edited = setConfigKeys(original, values);
113
+ } catch (err) {
114
+ error(err instanceof ConfigError ? err.message : String(err));
115
+ return 1;
116
+ }
117
+ if (!checkEdited(edited, home, error)) return 1;
130
118
  const unitPath = join(home, ".config", "systemd", "user", "neurastream-ui.service");
131
119
  mkdirSync(dirname(unitPath), { recursive: true });
132
120
  copyFileSync(UI_UNIT_TEMPLATE, unitPath);
@@ -165,8 +153,8 @@ export function uiOff(opts: UiSetupOptions): number {
165
153
  }
166
154
  const file = configFile(home);
167
155
  if (existsSync(file)) {
168
- const edited = editUiBlock(readFileSync(file, "utf8"), { enabled: false, owner_login: null, port: null });
169
- if (!checkEdited(edited, home, "off", error)) return 1;
156
+ const edited = setConfigKeys(readFileSync(file, "utf8"), { "ui.enabled": "false" });
157
+ if (!checkEdited(edited, home, error)) return 1;
170
158
  writeFileSync(file, edited);
171
159
  }
172
160
  return 0;
@@ -1,61 +1,61 @@
1
1
  paths:
2
- home: "~"
2
+ home: "~" # the HOME every other path expands from
3
3
  work_roots: [] # set your own roots
4
- config_dir: "~/.config/neurastream"
5
- agent_dir: "~/.config/neurastream"
6
- score_state: "~/.local/state/agent-score"
7
- queue_state: "~/.local/state/queue"
8
- queue_index: "~/.config/neurastream/INDEX.md"
9
- blockers: "~/.config/neurastream/blockers"
10
- notes: "~/.config/neurastream/notes"
11
- ranking_board: "~/.config/neurastream/notes/subagent-ranking.md"
12
- subagents: "~/.config/neurastream/notes/subagents.md"
13
- cancelled: "~/.config/neurastream/CANCELLED.md"
14
- unlock: "~/.config/neurastream/.guard-unlock"
15
- guard_log: "~/.local/state/main-guard.log"
16
- plan_guard_log: "~/.local/state/plan-guard.log"
17
- heavy_lock: "~/.local/state/neurastream/heavy-run.lock"
18
- heavy_owner: "~/.local/state/neurastream/heavy-run.owner"
19
- heavy_log: "~/.local/state/neurastream/heavy-run.log"
20
- heavy_idle_state: "~/.local/state/neurastream/heavy-run.idle-state"
21
- alert_state: "~/.cache/resource-alerts"
22
- snapshot_lock: "~/.cache/tmp-snapshot.lock"
4
+ config_dir: "~/.config/neurastream" # the config file's dir
5
+ agent_dir: "~/.config/neurastream" # the index, notes and blockers dir
6
+ score_state: "~/.local/state/agent-score" # agent-score state dir
7
+ queue_state: "~/.local/state/queue" # queue state dir (mr-cache.json lives here)
8
+ queue_index: "~/.config/neurastream/INDEX.md" # the main queue index
9
+ blockers: "~/.config/neurastream/blockers" # blocker files dir
10
+ notes: "~/.config/neurastream/notes" # notes dir
11
+ ranking_board: "~/.config/neurastream/notes/subagent-ranking.md" # subagent ranking board
12
+ subagents: "~/.config/neurastream/notes/subagents.md" # subagent allow-list (## Allowed)
13
+ cancelled: "~/.config/neurastream/CANCELLED.md" # cancelled-work log
14
+ unlock: "~/.config/neurastream/.guard-unlock" # guard unlock file
15
+ guard_log: "~/.local/state/main-guard.log" # main-guard log
16
+ plan_guard_log: "~/.local/state/plan-guard.log" # plan-guard log
17
+ heavy_lock: "~/.local/state/neurastream/heavy-run.lock" # heavy-run lock file
18
+ heavy_owner: "~/.local/state/neurastream/heavy-run.owner" # heavy-run owner record
19
+ heavy_log: "~/.local/state/neurastream/heavy-run.log" # heavy-run log
20
+ heavy_idle_state: "~/.local/state/neurastream/heavy-run.idle-state" # heavy-run idle state
21
+ alert_state: "~/.cache/resource-alerts" # resource-alert cooldown state
22
+ snapshot_lock: "~/.cache/tmp-snapshot.lock" # tmp-snapshot lock
23
23
 
24
24
  # Which adapter (docs/adapter.md) serves runs, traces, launch, install and doctor.
25
- harness: omp
25
+ harness: omp # the adapter that serves runs, traces, launch, install and doctor
26
26
 
27
27
  # Live project rules (src/core/repo-rules.ts): the repo's own AGENTS.md, handed to the agent that
28
28
  # works in it — a subagent on its plan's repo, Main the first time a session touches the repo.
29
29
  # max_bytes caps the injected text; past it the text is cut and one line names the file to read.
30
30
  rules:
31
- max_bytes: 24000
31
+ max_bytes: 24000 # cap on the injected repo-rules text
32
32
 
33
33
  score:
34
- default_repo: ""
34
+ default_repo: "" # default repo for agent-score (empty = none)
35
35
  default_branch: "" # no default: pass --branch (agent-score refuses to guess a branch)
36
36
  penalties:
37
- false-claim: 5
38
- rule-break: 2
39
- escaped-defect: 8
40
- unreported-finding: 5
41
- diagnose_weight: 4
42
- gate_days: 7
43
- board_days: 7
44
- min_dollars: 0.01
37
+ false-claim: 5 # score penalty per false claim
38
+ rule-break: 2 # score penalty per rule break
39
+ escaped-defect: 8 # score penalty per escaped defect
40
+ unreported-finding: 5 # score penalty per unreported finding
41
+ diagnose_weight: 4 # rank weight of diagnose findings
42
+ gate_days: 7 # days of history the spawn gate reads
43
+ board_days: 7 # days of history on the board
44
+ min_dollars: 0.01 # spend below this is not ranked
45
45
  waste_weight: 0 # rank multiplier for wasted-call rate (0 disables)
46
- min_hours: 0.05
46
+ min_hours: 0.05 # hours below this are not ranked
47
47
 
48
48
  ledger:
49
- default_hours: 24
50
- idle_show_min: 5
51
- idle_not_live_min: 60
52
- max_running_per_provider: 2
53
- max_slots: 2
49
+ default_hours: 24 # the ledger's default window in hours
50
+ idle_show_min: 5 # idle minutes before a run is shown
51
+ idle_not_live_min: 60 # idle minutes before a run that is not live is flagged
52
+ max_running_per_provider: 2 # concurrent running agents allowed per provider
53
+ max_slots: 2 # concurrent agent slots
54
54
  # The owner's pick order (plan 20261025_1700 P3): agent names, first = preferred; empty = off.
55
55
  # The spawn gates refuse a later agent while an earlier one is free and under its provider cap
56
56
  # unless the brief carries "Pick note: <why>"; agent-score gate ranks inside this order.
57
- prefer: []
58
- providers:
57
+ prefer: [] # agent names in preferred order (empty = off)
58
+ providers: # providers the agents run on
59
59
  - zai
60
60
  - openai-codex
61
61
  - anthropic
@@ -66,13 +66,13 @@ ledger:
66
66
 
67
67
  brief:
68
68
  method_marker: "" # empty = no method read required
69
- heavy_marker: "heavy-run"
70
- max_keys: 10
71
- warn_chars: 12000
72
- aim_chars: 8000
73
- path_prefixes: ["$HOME/"]
74
- method_read: ""
75
- heavy_path: "heavy-run"
69
+ heavy_marker: "heavy-run" # brief text that marks a heavy run
70
+ max_keys: 10 # keys a brief may name
71
+ warn_chars: 12000 # brief length that draws a warning
72
+ aim_chars: 8000 # target brief length
73
+ path_prefixes: ["$HOME/"] # path prefixes a brief may cite
74
+ method_read: "" # method file a brief must read (empty = none)
75
+ heavy_path: "heavy-run" # path of the heavy-run bin in a brief
76
76
  repo_rules: [] # optional repo-specific lint rules; each fires when `match` (regex, whole brief) hits and the body lacks `require`:
77
77
  # - match: 'legacy-api' # trigger anywhere in the brief (case-insensitive)
78
78
  # first: 'Refactor' # optional: also require this on the title line
@@ -81,70 +81,71 @@ brief:
81
81
  # message: 'legacy-api work must name its regression test'
82
82
 
83
83
  oc:
84
- model_prefix: "opencode/"
85
- tail_lines: 40
86
- tail_chars: 600
84
+ model_prefix: "opencode/" # prefix that routes a model to oc-run
85
+ tail_lines: 40 # output lines kept from an oc run
86
+ tail_chars: 600 # output chars kept from an oc run
87
87
 
88
88
  wip:
89
- limit: 6
90
- days: 14
89
+ limit: 6 # open WIP items the check allows
90
+ days: 14 # WIP age window in days
91
91
  backup_url: "" # your own private backup repo; wip-backup refuses to invent one
92
- backup_log: "~/.local/state/neurastream/WIP-BACKUP.md"
92
+ backup_log: "~/.local/state/neurastream/WIP-BACKUP.md" # backup log file
93
93
  backup_hook_off: [] # origin name fragments whose pre-push hook wip-backup may bypass
94
- backup_max_repo_mb: 1000
95
- secret_gate: "~/.local/bin/git-secret-gate"
96
- snapshot_max_mb: 5
97
- status_log: "~/.local/state/neurastream/WIP-STATUS.md"
98
- secret_file: '(?i)(^|/)(\.env(\.(?!example$|sample$|template$|dist$)[\w-]+)?|[^/]*\.env|env\.json|[^/]*\.(pem|p12|pfx|jks|keystore|key)|id_(rsa|dsa|ecdsa|ed25519)|credentials(\.json)?|\.netrc|\.pgpass|\.htpasswd|local-run\.env)$'
94
+ backup_max_repo_mb: 1000 # largest repo wip-backup will back up
95
+ secret_gate: "~/.local/bin/git-secret-gate" # secret scanner run before a backup
96
+ snapshot_max_mb: 5 # largest file a snapshot keeps
97
+ status_log: "~/.local/state/neurastream/WIP-STATUS.md" # WIP status file
98
+ secret_file: '(?i)(^|/)(\.env(\.(?!example$|sample$|template$|dist$)[\w-]+)?|[^/]*\.env|env\.json|[^/]*\.(pem|p12|pfx|jks|keystore|key)|id_(rsa|dsa|ecdsa|ed25519)|credentials(\.json)?|\.netrc|\.pgpass|\.htpasswd|local-run\.env)$' # file names that count as secrets
99
99
 
100
100
  health:
101
- warn_ctx: 150000
102
- tail_calls: 50
103
- default_hours: 12
101
+ warn_ctx: 150000 # context size that draws a health warning
102
+ tail_calls: 50 # calls in the health tail
103
+ default_hours: 12 # default health window in hours
104
104
 
105
105
  queue:
106
- archive_days: 30
107
- background_max_lines: 40
108
- progress_keep: 6
109
- priority_id: '^[A-Z]{2}[0-9]{2}$'
110
- cancel_min_words: 3
111
- auto_close_min: 15
112
- repo_index: "INDEX.md"
113
- cancelled_rel: "docs/plans/CANCELLED.md"
114
- # Minutes without a heartbeat before a Main's plan claim frees (src/core/claims.ts).
115
- claim_ttl_min: 30
106
+ archive_days: 30 # days before a queue item is archived
107
+ background_max_lines: 40 # declared only; no code reads it yet
108
+ progress_keep: 6 # progress entries kept
109
+ priority_id: '^[A-Z]{2}[0-9]{2}$' # declared only; no code reads it yet
110
+ cancel_min_words: 3 # declared only; no code reads it yet
111
+ auto_close_min: 15 # minutes before an item auto-closes
112
+ repo_index: "INDEX.md" # declared only; no code reads it yet
113
+ cancelled_rel: "docs/plans/CANCELLED.md" # declared only; no code reads it yet
116
114
  waiting_check_ttl_sec: 600 # a hold's `still true if` result is reused this long (key: plan mtime, command, HEAD)
117
115
  waiting_check_timeout_sec: 60 # one check may run this long; a timeout is "unknown" (card stays, no incident)
116
+ claim_ttl_min: 30 # minutes without a claim heartbeat before another Main may take the plan
118
117
 
119
118
  guards:
120
- sub_warn_calls: 90
121
- sub_max_calls: 100
122
- sub_max_calls_cap: 200
119
+ sub_warn_calls: 90 # subagent tool calls that draw the wrap-up warning
120
+ sub_max_calls: 100 # subagent tool calls before refusal
121
+ sub_max_calls_cap: 200 # ceiling for sub_max_calls
123
122
  main_warn_calls: 12 # Main tool calls per turn that draw the wrap-up warning
124
123
  main_max_calls: 15 # Main tool calls per turn before refusal; 0 = off
125
124
  main_call_exempt_tools: [task, todo, ask, wait] # never counted, never refused at the cap: delegating, tracking and asking stay open
126
- main_edit_limit: 5
127
- main_window_min: 15
128
- unlock_minutes: 30
125
+ main_edit_limit: 5 # Main project-file edits allowed per main_window_min
126
+ main_window_min: 15 # window in minutes for the edit limit
127
+ unlock_minutes: 30 # minutes a guard unlock lasts
129
128
  chat_unlock: false # the owner's whole chat message "unlock"/"unlock N"/"lock" moves the guard unlock file
130
- plan_read_max_hours: 24
131
- idle_stops: 3
129
+ plan_read_max_hours: 24 # hours a plan read stays valid
130
+ idle_stops: 3 # idle stops before the guard intervenes
132
131
  plan_offer: 'want me to (write|make) a plan|should i plan|shall i plan|if you want, i(''ll)? plan|plan it or|\bi will\b|\bi(''|’)ll\b' # refused: don't promise or offer it — do it now, or write the plan and index it
133
132
  rate_limit:
134
133
  patterns: ["429", "rate_limit", "rate limit", "overloaded", "529"] # error-text substrings (case-insensitive) that mark a provider rate limit
135
- default_wait_s: 300 # wait when the error text names no retry-after
136
- max_wait_s: 3600 # cap for the parsed (or doubled) wait, before slack
137
134
  slack_s: 15 # added on top of every wait
138
- blocker_timeout_ms: 10000
139
- skip_tools: [todo, wait, ask, web_search, job, cancel_job]
140
- read_tools: [read, grep, glob, find]
141
- shell_tools: [bash, eval]
142
- write_tools: [write, edit, ast_edit]
143
- free_ext: '\.(md|txt)$'
135
+ probe_interval_s: 300 # probe the provider this often (s) while it names no reset
136
+ max_probes: 288 # probes before the episode gives up (288 x 300 s = 24 h)
137
+ probe_timeout_s: 90 # kill a probe that runs longer than this (s)
138
+ probe_cmd: "omp -p --no-extensions --no-session --model {model} 'reply ok'" # {model} is replaced by the shell-quoted model; exit 0 = the provider answered
139
+ blocker_timeout_ms: 10000 # timeout for blocker checks in milliseconds
140
+ skip_tools: [todo, wait, ask, web_search, job, cancel_job] # tools the guard never counts
141
+ read_tools: [read, grep, glob, find] # tools counted as reads
142
+ shell_tools: [bash, eval] # tools counted as shell calls
143
+ write_tools: [write, edit, ast_edit] # tools counted as writes
144
+ free_ext: '\.(md|txt)$' # file extensions the write guard always allows
144
145
  free_prefixes: [] # path prefixes the write guard allows without an unlock
145
- bypass_spawn: ["opencode run"]
146
- protected: []
147
- ledger_command: "agent-ledger --hours 12"
146
+ bypass_spawn: ["opencode run"] # spawn command prefixes the guard lets through
147
+ protected: [] # paths the write guard protects (empty = none)
148
+ ledger_command: "agent-ledger --hours 12" # command the guard runs for the ledger
148
149
 
149
150
  autonomy:
150
151
  tier: opinionated # strict | opinionated | full: how much Main does without asking; the owner moves it with `tier <name>` in chat or a button on the phone page
@@ -163,27 +164,27 @@ approval: # plan approval hard gate (plan 20261029_1455 P3): do
163
164
 
164
165
  ui:
165
166
  enabled: false # the owner's phone page (neurastream ui); binds the tailnet address only
166
- port: 7787
167
+ port: 7787 # owner page port (neurastream ui)
167
168
  owner_login: "" # the tailscale login that may open the page; empty = the page refuses to start
168
169
  allow_this_machine: false # admit this machine (loopback and its own tailnet IP) as the owner; any local process can then press the buttons
169
170
 
170
171
 
171
172
  pages:
172
- enabled: false
173
- port: 7788
174
- dir: "~/.local/share/neurastream/pages"
173
+ enabled: false # the pages server (neurastream pages on|off)
174
+ port: 7788 # pages server port
175
+ dir: "~/.local/share/neurastream/pages" # published pages dir
175
176
  keep_days: 15 # delete a published page this many days later; publish --keep is permanent
176
177
  knowledge: # repo-local HTML explainers (docs/knowledge/<topic>.html) on the phone page's Knowledge tab
177
178
  roots: ["$HOME/projects", "$HOME/Work"] # scanned for git repos; $HOME expands to the config's home
178
179
  max_age_s: 300 # rebuild the topic list when older, so a git pull shows up on the next reload
179
180
  rollover:
180
- enabled: true
181
- max_session_mb: 5
182
- exit_grace_s: 20
181
+ enabled: true # session rollover on or off
182
+ max_session_mb: 5 # session size that triggers a rollover
183
+ exit_grace_s: 20 # seconds allowed for a clean exit
183
184
 
184
185
  metrics:
185
- report_days: 7
186
- correction_patterns: ['\bno\b', 'wrong', 'why did', 'properly', 'not what', 'stop', 'bullshit', 'fuck']
186
+ report_days: 7 # days in the metrics report
187
+ correction_patterns: ['\bno\b', 'wrong', 'why did', 'properly', 'not what', 'stop', 'bullshit', 'fuck'] # regexes that count a correction
187
188
  ci_pipelines_cmd: "" # command run in the repo dir with {mr} replaced; stdout must be a JSON array; "" = not set
188
189
  product_cmds: {} # {<repo path>: {<name>: shell command printing one number}}, run in that repo after every `metrics ci` merge
189
190
  # product_cmds:
@@ -222,21 +223,21 @@ watch: # the watcher (src/core/watch.ts): heartbeats, fail
222
223
  release_min_calls: 300 # release verdict: fewer Main tool calls on either side reads "not enough data yet", no verdict
223
224
 
224
225
  machine:
225
- load_over_cores: 4
226
- load_max: 0
227
- avail_min_mb: 3072
228
- disk_min_gb: 15
229
- disk_path: "$HOME"
230
- tmp_max_mb: 4096
231
- idle_max_min: 20
232
- idle_min_ticks: 300
233
- watch_sec: 60
234
- watch_streak: 3
226
+ load_over_cores: 4 # load above the core count that draws a warning (used when load_max is 0)
227
+ load_max: 0 # load ceiling; 0 = core count + load_over_cores
228
+ avail_min_mb: 3072 # minimum available memory in MB
229
+ disk_min_gb: 15 # minimum free disk in GB
230
+ disk_path: "$HOME" # path whose free space is checked
231
+ tmp_max_mb: 4096 # /tmp size limit in MB
232
+ idle_max_min: 20 # minutes idle before the machine is flagged
233
+ idle_min_ticks: 300 # idle ticks before the flag
234
+ watch_sec: 60 # seconds between machine watches
235
+ watch_streak: 3 # consecutive watches before the flag
235
236
 
236
237
  quota:
237
- reset_tz: "Asia/Shanghai"
238
- reset_pattern: 'reset at (\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(?::\d{2})?)\s*(Z|UTC|GMT|[+-]\d{2}:?\d{2}|[A-Z]{2,5}\b)?'
239
- label: "quota"
238
+ reset_tz: "Asia/Shanghai" # timezone of the quota reset time
239
+ reset_pattern: 'reset at (\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(?::\d{2})?)\s*(Z|UTC|GMT|[+-]\d{2}:?\d{2}|[A-Z]{2,5}\b)?' # regex that reads the reset time from the error text
240
+ label: "quota" # label used in quota messages
240
241
 
241
242
  notify:
242
243
  discord_webhook_file: "" # file holding the Discord webhook URL; "" = off (README: Notify the owner)
@@ -256,7 +257,7 @@ write_check: # write-time lint checks (src/core/write-check.ts):
256
257
  timeout_ms: 5000 # per linter run; a timeout, crash or missing linter allows the edit and logs a note
257
258
  suppress: '(#|//|/\*)\s*(noqa|type:\s*ignore|oxlint-disable|eslint-disable|biome-ignore|@ts-ignore|@ts-expect-error|@ts-nocheck)' # a new match counts as a new problem; the word only counts inside a comment
258
259
  defer_rules: ["no-unused-vars", "F401", "F841"] # a new finding of one of these rules is allowed with a logged note and only reported at turn end if still present (I-20261028-166); [] turns the deferral off
259
- linters:
260
+ linters: # linters run on each edit
260
261
  - ext: [".py"]
261
262
  argv: ["ruff", "check", "--no-cache", "--output-format=concise", "{file}"]
262
263
  pattern: '^.+?:\d+:\d+: (?<rule>\S+) (?<message>.+)$'
@@ -267,19 +268,19 @@ write_check: # write-time lint checks (src/core/write-check.ts):
267
268
  only_with_config: [".oxlintrc.json", ".oxlintrc.jsonc", ".oxlintrc.js", ".oxlintrc.mjs", ".oxlintrc.cjs", "eslint.config.js", "eslint.config.mjs", "eslint.config.cjs", "eslint.config.mts", "eslint.config.cts"]
268
269
 
269
270
  priority:
270
- sleep_sec: 120
271
+ sleep_sec: 120 # seconds between priority checks
271
272
 
272
273
  alerts:
273
- temp_c: 90
274
- mem_psi: 30
275
- io_psi: 40
276
- cooldown_sec: 600
274
+ temp_c: 90 # temperature alert threshold in C
275
+ mem_psi: 30 # memory pressure alert threshold (PSI)
276
+ io_psi: 40 # IO pressure alert threshold (PSI)
277
+ cooldown_sec: 600 # seconds between repeat alerts
277
278
 
278
279
  snapshot:
279
- tmp_dest: "~/.local/state/neurastream/tmp-snapshot"
280
+ tmp_dest: "~/.local/state/neurastream/tmp-snapshot" # where the tmp snapshot lands
280
281
  git_repo: "" # optional: a repo whose git worktrees get patch snapshots (git worktree list)
281
282
  git_backup: "" # where the patch snapshot lands (only used when snapshot.git_repo is set)
282
- excludes:
283
+ excludes: # names the snapshot skips
283
284
  - "playwright-transform-cache-*"
284
285
  - "pytest-of-*"
285
286
  - "systemd-private-*"
@@ -298,9 +299,9 @@ traces:
298
299
  # sampled defaults live in README.md. prices maps a model to $ per million tokens; a model
299
300
  # without an entry is not priced. allow_tools: tools a run may call even when no result in
300
301
  # the run proves the tool was offered.
301
- id_patterns: {}
302
- prices: {}
303
- allow_tools: []
302
+ id_patterns: {} # provider id patterns (empty = none)
303
+ prices: {} # model prices per million tokens (empty = none)
304
+ allow_tools: [] # tools a run may call without a proof of being offered
304
305
  allowed_hosts: # hosts a network command may touch without a finding
305
306
  - localhost
306
307
  - 127.0.0.1
@@ -310,14 +311,14 @@ traces:
310
311
  # prompt (input + cacheRead + cacheWrite tokens) a healthy run may open with. Any call
311
312
  # whose prompt passes ratio_of_limit × its model's context_limits entry is bloat too; a
312
313
  # model without an entry is not limit-checked (the map is open: add your models).
313
- first_call_max: 150000
314
- ratio_of_limit: 0.8
315
- context_limits: {}
314
+ first_call_max: 150000 # largest first-call prompt a healthy run may open with
315
+ ratio_of_limit: 0.8 # share of a model's context limit that counts as bloat
316
+ context_limits: {} # model context limits in tokens (empty = none)
316
317
  # APIs whose usage aggregates multiple internal calls; these are not per-call sizes.
317
- aggregate_apis: ["cursor-agent"]
318
+ aggregate_apis: ["cursor-agent"] # APIs whose usage aggregates many calls
318
319
  # Bloat breakdown: the first capture of this regex on a tool name names its group
319
320
  # (no match = "builtin"). The leading _? keeps underscore-prefixed MCP names grouped.
320
- tool_group: '^_?mcp__([A-Za-z0-9]+)_'
321
+ tool_group: '^_?mcp__([A-Za-z0-9]+)_' # regex that names a tool's group
321
322
  owned_repos: [] # product names another product's run may not read quietly; the intended list lives in docs/config.md
322
323
  actions:
323
324
  secret_globs: # a read matching any glob is a high finding; evidence is masked either way
@@ -342,8 +343,8 @@ traces:
342
343
  - "main-guard:"
343
344
  poll_pattern: '^\s*(sleep\s+\d|ps\b|pgrep\b)' # shell commands that poll while nothing else runs
344
345
  briefs: # brief-quality rules (src/core/trace-briefs.ts): what a spawn brief names, and the report's length buckets
345
- verify_pattern: '\b(?:bun test|bun run typecheck|pytest|npm test|go test|cargo test)\b'
346
- phase_pattern: '\bP\d+[a-z]?\b'
347
- plan_pattern: 'docs/plans/\S+\.md'
346
+ verify_pattern: '\b(?:bun test|bun run typecheck|pytest|npm test|go test|cargo test)\b' # regex that spots a verify command in a brief
347
+ phase_pattern: '\bP\d+[a-z]?\b' # regex that spots a phase label
348
+ plan_pattern: 'docs/plans/\S+\.md' # regex that spots a plan path
348
349
  char_buckets: [1500, 4000] # brief length edges: <1500, 1500-3999, >=4000
349
350
  min_n: 5 # the report shows a mean only with at least this many rows on that side