Operations and deployment运维与部署
Supervision, scheduling, logs, backups, and recovery, so the system runs when nobody is watching.进程守护、调度、日志、备份和恢复,让系统在没人盯着的时候也能运行。
What it is and why it exists它是什么,为什么需要它
What是什么
Operations covers how services start and restart, how background work yields to live traffic, how you see what is up, and how data is backed up and restored.运维涵盖:服务如何启动和重启、后台任务如何给实时流量让路、如何查看哪些服务在运行,以及数据如何备份和恢复。
Why为什么
An agent that works in a terminal session and dies on reboot is a demo. Most of the reference build's lost time came from operational causes: a stripped service environment, a noisy probe, single-writer stores, backups on the volume they protected.只能在终端会话里运行、一重启就挂掉的智能体只是个演示。参考系统损失的大部分时间都源于运维问题:服务启动环境被精简、探针产生大量噪音、单写入方存储、备份放在它要保护的同一个卷上。
How it works工作原理
- Every long-running service is under the OS supervisor with keep-alive and absolute paths.每个长期运行的服务都交给操作系统的进程守护来管理,开启自动重启,并使用绝对路径。
- A status command probes every service and prints one screen.一条状态命令探测所有服务,并输出一屏结果。
- A busy marker tells background jobs that a live request is in flight. The scheduler checks it between units of work.忙碌标记告诉后台任务有实时请求正在处理。调度器在每个工作单元之间检查它。
- Backups copy what cannot be reproduced, and a restore test runs after every backup.备份只复制无法重新生成的东西,并且每次备份后都运行恢复测试。
Where it sits in the build order它在搭建顺序中的位置
Needs first前置模块
- Inference engineering推理工程The engine is the first service to supervise, and its memory limits decide what may run at the same time.引擎是第一个需要守护的服务,它的内存上限决定了哪些东西可以同时运行。Build out of order不按顺序搭建 Stand in with:可用以下替代: Start services by hand in terminal tabs.在终端标签页里手动启动服务。
- Harness engineeringHarness 工程The agent server is the main service. Its health path and busy marker are what the supervisor and scheduler read.智能体服务是主服务。守护进程和调度器读取的正是它的健康检查路径和忙碌标记。Build out of order不按顺序搭建 Stand in with:可用以下替代: Supervise the engine alone.只守护引擎。
- Evaluation评估Scheduled evals and the daily report are how you learn that a change made things worse.定时评估和每日报告,是你得知某次改动让情况变糟的途径。Build out of order不按顺序搭建 Stand in with:可用以下替代: A manual smoke test after each change.每次改动之后手动做一次冒烟测试。
Unlocks解锁
Nothing depends on this. It is an end point of the map.没有模块依赖它。它是地图上的一个终点。
In the reference build在参考系统中
| Path路径 | Role作用 |
|---|---|
| Install-Autostart.command | Installs supervised services.安装受守护的服务。 |
| Check-All-LLM-Status.command | One-screen status of every service and model.一屏显示所有服务和模型的状态。 |
| apps/agent-server/nightly/scheduler.py | Duty cycle and preemption.占空比控制和抢占。 |
| apps/ops/pg_backup.sh | Database backup, with a restore test beside it.数据库备份,旁边配有恢复测试。 |
| SOP-LLM-OPERATIONS.md | Operating procedures.操作规程。 |
Process map流程图
A background unit of work meets a live request后台工作单元遇上实时请求
- 1Window opens时间窗开启The scheduler starts at a set hour with a list of small units.调度器在设定的时刻启动,带着一串小的工作单元。
- 2Busy?忙吗?Before each unit, check the marker file.每个单元开始前,检查标记文件。
- 3Wait等待A live request holds the marker until its answer is fully sent.实时请求在回答完全发出之前一直持有标记。
- 4Run one unit运行一个单元Small enough to finish in seconds.足够小,几秒内就能完成。
- 5Budget预算Stop when the duty share or the window is used up.占空比或时间窗用完时停止。
- 6Report报告What ran, what waited, what was skipped.运行了什么、等待了什么、跳过了什么。
Build steps搭建步骤
Follow them in order the first time. Each step names what it uses from earlier steps and what it leaves for later ones. Code is read from the lab files, and output is what the lab printed when it was run.第一次请按顺序做。每一步都写明它用到前面步骤的什么成果,又为后面的步骤留下什么。代码直接读取自 lab 文件,输出是 lab 实际运行时打印的内容。
- 1List every service, its port, and its interpreter列出每个服务、它的端口和解释器
- 2Put each service under the supervisor把每个服务交给守护进程
- 3Write one status command写一条状态命令
- 4Add the busy marker to the server给服务加上忙碌标记
- 5Schedule background work with preemption and a duty cycle用抢占和占空比来调度后台任务
- 6Back up what cannot be reproduced, and test the restore备份无法重新生成的东西,并测试恢复
- 7Rotate logs and keep signal apart from noise轮转日志,并把信号与噪音分开
- 8Wire the nightly window把夜间时间窗串起来
- 9Adopt a change discipline建立改动纪律
01List every service, its port, and its interpreter列出每个服务、它的端口和解释器
- the engine process引擎进程 ← Inference engineering推理工程 2: Install the engine and put weights on a dedicated volume安装引擎,把权重放到专用卷上
- the gateway process网关进程 ← API and gatewayAPI 与网关 3: Write the gateway handler编写网关处理函数
Do this操作
- For each long-running process write: name, port, the absolute path of its interpreter, its working directory, its log file.为每个长期运行的进程写下:名称、端口、解释器的绝对路径、工作目录、日志文件。
- Note which virtual environment each uses. A service started with the wrong one fails at launch.注明每个服务使用哪个虚拟环境。用错环境启动的服务会在启动时失败。
- Operations and deployment运维与部署 2: Put each service under the supervisor把每个服务交给守护进程 (paths, ports, and environments路径、端口和运行环境)
02Put each service under the supervisor把每个服务交给守护进程Not executed in the labslab 中未执行
- paths, ports, and environments路径、端口和运行环境 ← Operations and deployment运维与部署 1: List every service, its port, and its interpreter列出每个服务、它的端口和解释器
Do this操作
- Write one unit file per service from the inventory.根据清单为每个服务写一个单元文件。
- Use absolute paths everywhere. The supervisor starts with a minimal PATH and no shell profile.所有地方都用绝对路径。守护进程启动时 PATH 很精简,也不会加载 shell 配置。
- Turn on keep-alive and run-at-load.开启自动重启和开机自启。
- Kill the process and confirm it restarts.杀掉进程,确认它自动重启。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- macOS. Copy to ~/Library/LaunchAgents/, replace AGENT_HOME, then:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.agent-server.plist
launchd starts services with a minimal PATH and no shell profile, so every path here is absolute. -->
<plist version="1.0"><dict>
<key>Label</key><string>com.example.agent-server</string>
<key>ProgramArguments</key>
<array>
<string>AGENT_HOME/venv/bin/python3</string>
<string>-m</string><string>uvicorn</string><string>main:app</string>
<string>--host</string><string>127.0.0.1</string><string>--port</string><string>8788</string>
</array>
<key>WorkingDirectory</key><string>AGENT_HOME</string>
<key>EnvironmentVariables</key>
<dict><key>PATH</key><string>/opt/homebrew/bin:/usr/bin:/bin</string></dict>
<key>KeepAlive</key><true/>
<key>RunAtLoad</key><true/>
<key>StandardOutPath</key><string>AGENT_HOME/logs/agent-server.log</string>
<key>StandardErrorPath</key><string>AGENT_HOME/logs/agent-server.log</string>
</dict></plist>The Linux equivalents are in the same folder: a systemd service and a timer.Linux 下的对应文件在同一目录:一个 systemd service 和一个 timer。
This step describes work on your own machine or account. Its commands were not run when the labs were tested.这一步描述的是在你自己的机器或账号上的操作。测试 lab 时没有运行这些命令。
python3 labs/machine/check.py --write03Write one status command写一条状态命令
- the unauthenticated health path无认证的健康检查路径 ← API and gatewayAPI 与网关 3: Write the gateway handler编写网关处理函数
Do this操作
- Probe each service's unauthenticated health path with a short timeout.用较短的超时探测每个服务的无认证健康检查路径。
- Print one line per service: up or down, and the reason.每个服务输出一行:在线或离线,以及原因。
- Never send a key from the probe. Liveness needs none.探针里绝不发送密钥。存活检查不需要它。
def probe(url: str, timeout: float = 3.0) -> dict:
t0 = time.time()
try:
with urllib.request.urlopen(url, timeout=timeout) as r:
return {"url": url, "up": 200 <= r.status < 300, "ms": int((time.time() - t0) * 1000), "detail": r.status}
except Exception as e: # noqa: BLE001
return {"url": url, "up": False, "ms": int((time.time() - t0) * 1000), "detail": type(e).__name__}
def report(services: dict) -> str:
lines = []
for name, url in services.items():
p = probe(url)
lines.append(f"{'UP ' if p['up'] else 'DOWN'} {name:14s} {p['detail']}")
return "\n".join(lines)python3 -m labs.m15_ops.demo1 status:
UP gateway 200
DOWN engine URLError- Operations and deployment运维与部署 9: Adopt a change discipline建立改动纪律 (the post-deploy check部署后的检查)
04Add the busy marker to the server给服务加上忙碌标记
- the request path to wrap要包裹的请求路径 ← Harness engineeringHarness 工程 7: Assemble run(): guard, retry, log, record组装 run():护栏、重试、日志、记录
Do this操作
- Wrap every live request in a context manager that creates a file and removes it afterward.用一个上下文管理器包裹每个实时请求:开始时创建文件,结束后删除。
- Hold it for the whole streamed answer, not only until the first token.在整个流式回答期间都要持有它,而不是只到第一个 token。
- Treat a marker older than a few minutes as left by a crash.把存在超过几分钟的标记视为崩溃遗留的。
@contextmanager
def busy(marker: Path):
"""Wrap every live request in this."""
marker.write_text(str(time.time()))
try:
yield
finally:
marker.unlink(missing_ok=True)
def is_busy(marker: Path, stale_after: float = 600) -> bool:
"""A marker older than stale_after is from a crashed request and is ignored."""
try:
return time.time() - marker.stat().st_mtime < stale_after
except FileNotFoundError:
return False05Schedule background work with preemption and a duty cycle用抢占和占空比来调度后台任务
- is_busy()is_busy() ← Operations and deployment运维与部署 4: Add the busy marker to the server给服务加上忙碌标记
Do this操作
- Break every job into units that finish in seconds.把每个任务拆成几秒内就能完成的单元。
- Before each unit: wait while the marker is present.每个单元开始前:只要标记存在就等待。
- Stop starting units when the duty share of the window is spent, or the window has closed.当时间窗内的占空比用完或时间窗关闭时,不再启动新单元。
- Log what ran, waited, and was skipped.记录哪些运行了、哪些等待了、哪些被跳过。
def run_window(jobs: Iterable, marker: Path, window_s: float, duty: float = 0.5,
clock: Callable = time.time, sleep: Callable = time.sleep) -> list:
"""jobs yields (name, unit_fn). Each unit is small enough to finish in seconds.
duty share of the window background work may use; the rest stays idle
preempt before every unit, if a live request is in flight, wait
"""
log, start, worked = [], clock(), 0.0
for name, unit in jobs:
while is_busy(marker):
log.append((name, "waited: live request"))
sleep(0.05)
if clock() - start >= window_s:
log.append((name, "skipped: window closed"))
continue
if worked >= duty * window_s:
log.append((name, "skipped: duty budget spent"))
continue
t0 = clock()
unit()
worked += clock() - t0
log.append((name, "ran"))
return log2 scheduler: units run [0, 1, 2, 3, 4, 5] | paused yes while a live request held the marker
3 duty 50% of a 0.2 s window: ['ran', 'ran', 'ran', 'ran', 'skipped', 'skipped']- Evaluation评估 10: Schedule the evals and print one line each给评估排上日程,每项输出一行 (a scheduler that yields to live traffic一个会给实时流量让路的调度器)
- Operations and deployment运维与部署 8: Wire the nightly window把夜间时间窗串起来 (run_window()run_window())
06Back up what cannot be reproduced, and test the restore备份无法重新生成的东西,并测试恢复
- the tables to count要统计行数的表 ← State and storage状态与存储 3: Create the schema, grouped by owner按归属分组建表
- the key store, which is irreplaceable密钥库,它是不可替代的 ← API and gatewayAPI 与网关 2: Build the key store建立密钥库
Do this操作
- List what is irreplaceable: databases, keys, prompts, skills, eval sets, scripts.列出不可替代的东西:数据库、密钥、提示词、技能、评估集、脚本。
- Skip what can be downloaded again: model weights, source documents.跳过可以重新下载的东西:模型权重、原始文档。
- Use the database's online backup so a copy taken during writes is consistent.使用数据库的在线备份功能,保证写入过程中取得的副本是一致的。
- After each backup: open it, run an integrity check, compare row counts with the live database.每次备份之后:打开它,运行完整性检查,把行数与在线数据库比较。
- Send one encrypted copy off the machine.把一份加密副本发送到机器之外。
def backup(db_path: Path, dest_dir: Path, keep: int = 7) -> Path:
"""Online backup: consistent even while the database is being written."""
dest_dir.mkdir(parents=True, exist_ok=True)
dest = dest_dir / f"{db_path.stem}-{time.strftime('%Y%m%d-%H%M%S')}.db"
src, out = sqlite3.connect(str(db_path)), sqlite3.connect(str(dest))
with out:
src.backup(out)
src.close()
out.close()
for old in sorted(dest_dir.glob(f"{db_path.stem}-*.db"))[:-keep]: # keep the newest N
old.unlink()
return dest
def restore_test(live: Path, backup_file: Path, tables: list) -> dict:
"""A backup that was never restored is a hope. Open it, check integrity, compare row counts."""
a, b = sqlite3.connect(str(live)), sqlite3.connect(str(backup_file))
ok = b.execute("PRAGMA integrity_check").fetchone()[0] == "ok"
counts = {t: (a.execute(f"SELECT count(*) FROM {t}").fetchone()[0],
b.execute(f"SELECT count(*) FROM {t}").fetchone()[0]) for t in tables}
a.close()
b.close()
return {"integrity": ok, "counts": counts, "match": ok and all(x == y for x, y in counts.values())}4 backup: agent-202...db | restore test: {'integrity': True, 'counts': {'kb_chunks': (20, 20), 'kb_edges': (18, 18)}, 'match': True}07Rotate logs and keep signal apart from noise轮转日志,并把信号与噪音分开
- the two structured logs两份结构化日志 ← Harness engineeringHarness 工程 7: Assemble run(): guard, retry, log, record组装 run():护栏、重试、日志、记录
- cursors that must survive rotation需要在轮转后依然有效的游标 ← State and storage状态与存储 6: Give every background job a cursor给每个后台任务一个游标
Do this操作
- Keep structured request and tool logs in their own files, apart from server output.把结构化的请求日志和工具日志放在独立的文件里,与服务输出分开。
- Rotate by size or date on a schedule.按大小或日期定时轮转。
- When a probe or a test fills a log, fix the probe. Do not filter the log.当某个探针或测试把日志刷满时,修的是探针,而不是去过滤日志。
def rotate(log: Path, keep: int = 3, max_bytes: int = 2_000) -> bool:
"""Size-based copytruncate. log -> log.1 -> log.2 ... oldest dropped. Returns True if rotated."""
if not log.exists() or log.stat().st_size < max_bytes:
return False
for i in range(keep - 1, 0, -1):
older = log.with_name(f"{log.name}.{i}")
if older.exists():
older.replace(log.with_name(f"{log.name}.{i + 1}"))
shutil.copy2(log, log.with_name(log.name + ".1"))
with log.open("r+") as f:
f.truncate(0)
return True# /etc/logrotate.d/agent
/srv/agent/logs/*.log /srv/agent/logs/*.jsonl {
daily
rotate 14
compress
missingok
copytruncate
}With copytruncate a job that tracks a byte offset must reset its cursor when the file shrinks.使用 copytruncate 时,按字节偏移量跟踪的任务必须在文件变小时重置游标。
python3 -m labs.m15_ops.logs1 tool log 40 lines, only tool calls | server log 800 lines of probe noise kept apart
2 first read: naive cursor 40 lines, fixed cursor 40 lines
3 rotated: True | size now 0 bytes | kept ['tool_calls.jsonl.1']
4 after rotation and 3 new calls: naive cursor read 0 | fixed cursor read 3
5 five more rotations: files ['tool_calls.jsonl', 'tool_calls.jsonl.1', 'tool_calls.jsonl.2', 'tool_calls.jsonl.3'] | largest 2270 bytes08Wire the nightly window把夜间时间窗串起来Not executed in the labslab 中未执行
- run_window()run_window() ← Operations and deployment运维与部署 5: Schedule background work with preemption and a duty cycle用抢占和占空比来调度后台任务
- the backup unit备份单元 ← Operations and deployment运维与部署 6: Back up what cannot be reproduced, and test the restore备份无法重新生成的东西,并测试恢复
- the retrieval eval unit检索评估单元 ← Evaluation评估 5: Run variants and append history运行变体并追加历史
- the learning loop unit学习循环单元 ← Self-evolving agents自进化智能体 4: Assemble the nightly loop with the eval gate组装夜间循环,并加上评估关卡
Do this操作
- Create a timer that opens the window at a quiet hour.创建一个定时器,在空闲时段开启时间窗。
- In the window run, in order: backup, retrieval eval, the learning loop in report mode, the agent eval weekly.在时间窗内按顺序运行:备份、检索评估、报告模式的学习循环、每周一次的智能体评估。
- Write one report with a line per job: latest value, previous value, anything skipped.生成一份报告,每个任务一行:最新值、上一次的值、被跳过的内容。
# Linux. Pair with an agent-nightly.service that runs the nightly loop once.
[Unit]
Description=Nightly learning window
[Timer]
OnCalendar=*-*-* 01:00:00
Persistent=true
[Install]
WantedBy=timers.targetThis step describes work on your own machine or account. Its commands were not run when the labs were tested.这一步描述的是在你自己的机器或账号上的操作。测试 lab 时没有运行这些命令。
python3 labs/machine/check.py --write09Adopt a change discipline建立改动纪律Not executed in the labslab 中未执行
- flags and the history file开关和历史文件 ← Evaluation评估 5: Run variants and append history运行变体并追加历史
- the post-deploy check部署后的检查 ← Operations and deployment运维与部署 3: Write one status command写一条状态命令
Do this操作
- Before editing a running file, save a dated copy beside it.编辑正在运行的文件之前,在旁边保存一份带日期的副本。
- One change per commit. Write the commit subject as what was learned.每次提交只做一个改动。提交标题写的是学到了什么。
- Put new behavior behind a flag, run the eval both ways, then change the default.新行为放在开关后面,开和关各跑一次评估,再改默认值。
- After a deploy, run the status command and the smoke questions.部署之后,运行状态命令和冒烟问题。
This step describes work on your own machine or account. Its commands were not run when the labs were tested.这一步描述的是在你自己的机器或账号上的操作。测试 lab 时没有运行这些命令。
python3 labs/machine/check.py --writeHow it works with the other parts它如何与其他部分协作
- API and gatewayAPI 与网关The watchdog probes the gateway's liveness path. Keys are in the backup set.看门狗探测网关的存活检查路径。密钥在备份范围内。
- Evaluation评估Evals are units in the nightly window and lines in the daily report.评估是夜间时间窗里的工作单元,也是每日报告里的若干行。
- Self-evolving agents自进化智能体The learning loop runs through the scheduler and pauses for live requests.学习循环通过调度器运行,遇到实时请求时暂停。
- Inference engineering推理工程Background jobs that load a model compete for resident slots, so the window is at a quiet hour.需要加载模型的后台任务会争抢驻留名额,所以时间窗设在空闲时段。
What went wrong in the real build真实搭建中踩过的坑
A service that ran by hand and failed under the supervisor手动能跑、交给守护进程就失败的服务
- What happened发生了什么
- The supervisor's minimal PATH hid a binary, and a unit pointed at the wrong virtual environment.守护进程精简的 PATH 让某个可执行文件找不到,另一个单元文件指向了错误的虚拟环境。
- Fix修复
- Absolute paths in every unit, and the interpreter path recorded in the inventory.所有单元文件都用绝对路径,并在清单里记录解释器路径。
- Lesson教训
- The supervisor's environment is not your shell's.守护进程的运行环境和你的 shell 不是一回事。
Backups on the volume they protected备份放在它要保护的那个卷上
- What happened发生了什么
- Backups covered accidental deletion and would not have survived a drive failure.这样的备份能应对误删,却扛不住磁盘损坏。
- Fix修复
- An encrypted offsite copy on a schedule, and a restore test.定时生成加密的异地副本,并做恢复测试。
- Lesson教训
- Name the failure each backup protects against.每一份备份防的是哪种故障,要明确写出来。
The learner ran through a chat answer学习任务在聊天回答期间照常运行
- What happened发生了什么
- The busy marker was released when the response started, so background work resumed while tokens were still streaming.忙碌标记在响应开始时就被释放了,于是 token 还在流式输出时后台任务就恢复了。
- Fix修复
- Hold the marker until the streamed response finishes.把标记一直持有到流式响应结束。
- Lesson教训
- Busy means until the user has the whole answer.“忙”的意思是:直到用户拿到完整的回答为止。
A helper process that grew to 71 GB一个辅助进程涨到了 71 GB
- What happened发生了什么
- A reranker's buffer cache grew without bound and took memory from the models.某个重排模型的缓冲区缓存无限增长,占用了模型所需的内存。
- Fix修复
- Cap and release the cache, and include process memory in the status command.给缓存设上限并定期释放,同时在状态命令里加入进程内存。
- Lesson教训
- Every process on the machine is part of the memory budget.机器上的每个进程都属于内存预算的一部分。
The same idea on other platforms同样的思路在其他平台上
| Platform平台 | How this module maps本模块如何对应 |
|---|---|
| Databricks | Agent Runtime, Jobs, and Apps are supervised by the platform. You own versions, permissions, cost alerts, and promotion between workspaces with asset bundles.Agent Runtime、Jobs 和 Apps 由平台负责守护。你负责的是版本、权限、成本告警,以及用 asset bundle 在工作区之间做发布。 |
| IBM watsonx | The platform runs the services. You own environments, deployment spaces, and promotion between them.服务由平台运行。你负责的是环境、deployment space 以及它们之间的发布。 |
| Codex | Operations here means CI: headless runs, sandbox settings, and secrets handling for the agent.这里的运维指的是 CI:无界面运行、沙箱设置以及智能体的密钥管理。 |
| Cursor | Same: team rules in the repo, background agent settings, and secrets.同理:仓库里的团队规则、后台智能体的设置和密钥。 |
| Claude Code / Agent SDK | Headless runs in CI, managed settings, and permission policies. A service built on the SDK is operated like any other service.CI 中的无界面运行、集中管理的设置和权限策略。基于 SDK 构建的服务,运维方式与其他服务一样。 |
| Another machine | systemd units and timers in place of launchd. The lab's scheduler, status, and backup code is plain Python.用 systemd 的 unit 和 timer 代替 launchd。lab 的调度器、状态检查和备份代码都是纯 Python。 |
Step-by-step guides per platform各平台的分步指南
Explain it back讲给自己听
Answer aloud first. Then open the answer and compare.先自己说一遍答案,再展开对照。
Which files do you back up, and which do you not?哪些文件要备份,哪些不用?
A service runs fine by hand and fails under the supervisor. What is the usual cause?一个服务手动运行正常,交给守护进程就失败。通常是什么原因?
Why does the busy marker come before the scheduler?为什么忙碌标记要先于调度器?
What happens in the nightly window, in what order, and why that order?夜间时间窗里发生什么?按什么顺序?为什么?
Terms术语
| Supervisor进程守护 | The OS service that starts processes and restarts them when they exit.操作系统中负责启动进程、并在其退出后重启的服务。 |
| Duty cycle占空比 | The share of a window background work may use.后台任务在时间窗内可以占用的比例。 |
| Preemption抢占 | Pausing background work when live work arrives.实时任务到来时暂停后台任务。 |
| Restore test恢复测试 | Opening a backup and checking it, on a schedule.定期打开备份并对其进行检查。 |
From the live build来自实时构建
Recent changes and files the sync job filed under this module. These lines are in English as written in the build.同步任务归到本模块下的近期变更和文件。这些内容保留了构建系统中的英文原文。
- Gateway answers the watchdog probe; guard: no-tool check on data turns only, strict first draft; wiki samples start, middle and end; collector tuner floor and restored cadences
- Chain audit: files removed from disk are counted separately, not as awaiting ingest
- Daily report: unreadable learning store is one explicit problem, never zeros; backfill status merges per collection; collector pause expires before the same-hour run
- Audit fixes: self-gap dedupe, SQLite stores in the nightly backup; agent quiz
- Fixes applied — 2026-09-07
- AI Local Server → Vercel Integration Guide
- SOP — Operating the Local LLM Server
- AIDATA Local AI Server — Master Guide (Phased Plan)
- BUILD-HOST — Operations Runbook
- 06 — Improvement Roadmap
- run the agent-server regression scripts (2026-09-30). Each is a plain script that exits non-zero on failure. Writes logs/tests.status.json. Safe: the brain test uses a throwaway <db>_test database and the endpoint tests use /tmp and stub model servers.
- nightly dump of the knowledge store (2026-09-30). WHAT: pg_dump --format=custom of the whole build-host database (brain.* learned atoms, kb.* file ledger, kb_finance / kb_k12 chunk vectors).
- Backup-AI-Offsite.command [destination] [full] Writes ONE encrypted file containing everything on this Mac that cannot be recreated, to somewhere that is not this Mac. WHY THIS EXISTS AND Backup-AI.command DOES NOT REPLACE IT.
- pg_restore_test.sh <dumpfile> — prove a dump restores (2026-09-30). Restores brain.*, kb.* and kb_k12.* from the dump into a throwaway database (build-host_restoretest), compares row counts with the live database, checks a K12 vector search works on the restored copy, then ...
- let Backup-AI-Offsite.command run unattended (2026-09-30). Targeted edits, each asserted to match exactly once: * pause(): `read -k 1` becomes a no-op when NONINTERACTIVE is set * passphrase from the login Keychain when OFFSITE_KEYCHAIN_SERVICE is set (item created only by ...
- Double-click button: stops and restarts the NEW agent-server harness (apps/agent-server/main.py, FastAPI + agent_loop.py, port 8788).
- Install-Autostart.command GOAL: after a power cut, a reboot, a sleep/wake, or a crash, every LLM service comes back BY ITSELF. No double-clicking anything. WHAT IS ALREADY TRUE (since the 2026-08-09 migration): six services are supervised by launchd with KeepAlive.
- REWRITTEN by Install-Autostart.command. The services this script used to nohup are now launchd jobs, so starting them means LOADING them, not spawning a second copy.