quickstart.zh.md
docs/i18n/quickstart.zh.md
快速入门
<!-- translations:start -->
English · 한국어 · 中文 · 日本語 · Русский · Español · Français · Deutsch
<!-- translations:end --> 本页展示从一个已有的项目目录到可浏览的 Tesserae 的最短路径。
命令总览
CLI 是分组的:顶层是少数几个日常动词,其余归入分组(sessions、vault、export、code、config、projects、integrations、lab)。运行 tesserae --help 查看整棵命令树:
usage: tesserae <command> [options]
EVERYDAY
init Set up .tesserae (wizard by default; --yes non-interactive)
compile Rebuild the knowledge graph (compile [paths] = ad-hoc ingest)
ingest Ingest a document file or URL into the knowledge base
context Compile agent-ready context for a query
ask LLM answer over the knowledge graph (planned retrieval)
serve Browse the compiled site (auto-builds if missing)
status Node/edge counts, last compile, vault state
AUTOMATION
engine Refresh daemon: watch sessions/sources, coalesced recompiles
refresh One-shot: import sessions + compile + sync vault
research Autonomous research mode: investigate a query
ANALYSIS
query raw retrieval: BM25/semantic + explicit backends
lint Graph lint report (--fix-trivial, --severity, --json)
doctor Health checks: init/graph/registry/staleness/locks (--fix = safe repairs only)
summary Daily/weekly activity digest (sessions, findings, commits, PRs, docs)
decisions Decisions across projects + time (human AskUserQuestion + agent)
GROUPS
sessions import | discover | list | chunk-backfill — agent session history
vault sync | sync-all | set-root | export | prune — Obsidian projection
export harness | graphiti | site — artifact exports
code ingest | sync — CodeGraph ⇄ project graph (hook-invoked)
setup Machine-wide setup: LLM defaults + optional deps (interactive by default)
config llm | deps | show | status | clip-token — LLM backend defaults + resolved view & liveness ping
projects register | list | unregister | mcp-config — registry
sources add | list | remove — manage compile source dirs (local & global)
federation status | explain — inspect cross-project federation
integrations refresh raganything
extract Low-level: extract a typed graph from markdown paths
LAB
lab evolve | schema-drift — experimental LLM ops
Run `tesserae <command> --help` for command details.
运行 tesserae <command> --help(例如 tesserae compile --help)查看任意单个命令的标志。
1. 运行设置向导
在你想要索引的项目里:
cd /path/to/my-project
tesserae init
tesserae init 是唯一的入门步骤。向导会检测常见来源,如 README.md、docs、src、lib、app、packages 和 data,探测哪些 LLM CLI 已安装且已登录,让你选择 LLM 提供方,并写入 .tesserae/config.json。可选的 RAG-Anything 内存后端默认关闭;之后可在配置的 memory_backends 中启用,并通过 tesserae query --backend raganything 显式查询。
对于非交互式设置(CI、脚本),传入 --yes 接受检测出的默认值而不发出提示(所有可选集成均为 OFF):
tesserae init --yes
LLM 提供方配置
向导的提供方选择(或等价的标志)会持久化以下配置键:
| 配置键 | 标志 | 含义 |
|---|---|---|
llm_provider | --llm-provider {claude,codex,anthropic,custom} | LLM 客户端的后端:claude/codex 通过 OAuth 使用已登录的 CLI;anthropic 直接使用 API;custom 指向任意 claude 兼容端点。 |
llm_model | --llm-model | 合成/洞见 LLM 客户端使用的模型。 |
llm_base_url | --llm-base-url | anthropic/custom 的端点基础 URL。 |
llm_api_key | --llm-api-key | anthropic/custom 的 API key。 |
明文警告。
llm_api_key以明文存储在.tesserae/config.json中。请优先使用环境变量:ANTHROPIC_API_KEY(密钥)、ANTHROPIC_BASE_URL(端点)和TESSERAE_LLM_MODEL(模型)。解析顺序为 env → 项目配置 → 机器级配置(~/.tesserae/config.json,由tesserae setup写入)→ 内置默认值。
在已有项目上重新运行 init 会合并——你已配置的 sources 和 memory_backends 会被保留,而不是被覆盖。
非交互式提供方设置示例:
tesserae init --yes --llm-provider codex
tesserae init --yes --llm-provider custom \
--llm-base-url https://llm.internal.example/v1 \
--llm-model my-model # key via ANTHROPIC_API_KEY
跳过向导。
tesserae init --bare写入一个最小化的.tesserae/config.json,不做来源检测或后端探测——当你想在首次编译前手工编辑配置时很方便。
2. 编译图谱与投影
tesserae compile
compile 写出持久产物:
.tesserae/
config.json
graph.json
manifest.json
sqlite.db
temporal_facts.jsonl
graphiti_episodes.jsonl
report.md
competitive_report.md
markdown_projection/
obsidian_vault/
agent_harness/
harness_sessions/
site/
首次运行之后使用 --changed-only 可跳过未变化的 markdown 文件,在没有文件变化时保留之前的图谱。
若要在不触及已配置来源的情况下临时摄取额外路径,把它们作为位置参数传入:tesserae compile path/to/extra.md docs/。
集成开关现在位于配置中
tesserae compile 被刻意限制在日常标志上(位置路径参数加上 --project、--changed-only、--limit、--refresh-integrations、--sessions/--no-sessions,以及三个 LLM 标志)。其余所有旧编译标志都移入了 .tesserae/config.json 的 compile_options 块;旧的 argparse 默认值仍是回退值。在那里设置某个键即可改变行为:
compile_options 键 | 旧标志 | 默认值 | 作用 |
|---|---|---|---|
source_kind | --source-kind | (无) | 覆盖已配置的来源类型。 |
trends | --trends | false | 添加语料级 Trend 节点。 |
min_trend_sources | --min-trend-sources | 2 | 生成 Trend 节点所需的最少来源数。 |
exclude_data | --exclude-data | false | 跳过隐式的 project_root/data 自动包含。 |
no_vault_pull | --no-vault-pull | false | 编译前不回拉已有的 vault 编辑。 |
use_extraction_feedback | --use-extraction-feedback | false | 将先前的提取结果反馈进本次运行。 |
sessions_llm | --sessions-llm | (auto) | LLM 会话提取模式(auto/true/false)。 |
sessions_model | --sessions-model | (无) | 覆盖用于会话提取的 LLM 模型。 |
Cognee 已在 0.19 中移除。 cognee 后端在 0.18 中被降级,且从未真正 参与图谱构建。仍带有
memory_backends.cognee配置段(或cognee_*编译选项)的配置依然可以加载——该段会被忽略,并给出一行提示。
一步式流水线。
tesserae refresh在进程内运行整条循环——它导入任何新的 agent 会话、编译并同步 vault,一条命令完成。传入--changed-only启用可选的增量编译。
3. 构建并启动静态前端
serve 在站点缺失时会自动构建,因此一条命令就能得到可浏览的 Tesserae。不带参数的 serve 会在一个服务器下服务每个已注册的项目——/ 是项目落地页,每个项目位于 /<alias>/,页头有一个 Projects 切换器可在项目间跳转。页内的 ask 小组件在两种模式下都可实时使用,会路由到你所在页面对应的项目:
tesserae serve --port 8765 # all registered projects
tesserae serve --project . --port 8765 # just this one
打开:
http://127.0.0.1:8765/
若要显式构建站点(例如部署而不启动服务),使用 export site;当你想浏览之前构建的站点而不重新构建时,给 serve 传入 --no-build:
tesserae export site
tesserae serve --no-build --port 8765
<!-- BEGIN: subagent-r-watch -->
保存时自动重建
将开发服务器与内置监视器搭配使用,使 data/ 和 docs/ 下的编辑触发增量重编译:
# terminal 1
python3 -m http.server 56821 --directory .tesserae/site
# terminal 2
tesserae export site --watch
export site --watch 每 2 秒轮询一次、去抖 1 秒,并运行 compile --changed-only。使用 --once 做 cron 风格的重建(对照 .tesserae/.watch-cache.json 做快照),--paths <dir> 添加自定义监视目录,--interval / --debounce 调整节奏。 <!-- END: subagent-r-watch -->
运行刷新守护进程
想要一个常驻的 engine 自行保持知识库新鲜——监视你的来源、合并编辑突发并自动重编译——就启动受监督的守护进程:
tesserae engine
engine 是长期运行的监督器:它每 2 秒轮询一次,并在每次重建前等待 1 秒的静默窗口。用 --interval 和 --debounce 调整节奏,用 --project 指向另一个项目,或传入 --once 运行单次确定性的排空周期后退出(适用于 cron 或 CI)。这是 export site --watch 的免操心版本:让它一直运行,图谱、vault 和站点就会随着你和你的 agent 的工作保持最新。
要查看每条可见路由的注释导览——home、sources、concepts、entities、papers、repos、topics、syntheses、questions、timeline、graph,以及各个 AI 兄弟文件——参见