Start here for any issue — run the health check first.
遇到任何问题,请先运行健康检查:
contextgo health
bash scripts/context_healthcheck.sh- Slow initial indexing
- Viewer not reachable
- Search returns no results
- Permission or path errors
- Daemon not capturing sessions
- Native binary not found
- Smoke test failures
- Installed runtime issues
- Pre-release validation checklist
首次索引慢
Symptom / 症状: health or search takes noticeably long on first run.
Cause / 原因: session_index.py scans all available session history and builds the SQLite index from scratch. This is a one-time cost.
Resolution / 解决方法:
-
Run
healthonce to completion before issuing search queries; the index builds incrementally afterward. -
Confirm index files exist:
ls ~/.contextgo/index/ # Expected: session_index.db memory_index.db
-
Verify the resolved storage root if you have overridden it:
python3 -c "from contextgo.context_config import storage_root; print(storage_root())" -
Measure the actual bottleneck:
python3 -m benchmarks --iterations 1 --warmup 0 --query benchmark
Viewer 无法访问
Symptom / 症状: After running contextgo serve, http://127.0.0.1:37677/api/health returns a connection error.
Cause / 原因: Port conflict, stale process, or server bound to a non-loopback address without a token.
Resolution / 解决方法:
-
Verify the CLI is healthy before starting the viewer:
contextgo health
-
Check for port conflicts and kill any stale process:
lsof -iTCP:37677 kill <PID> # if a process is listed
-
Start the viewer and probe it:
contextgo serve --host 127.0.0.1 --port 37677 curl http://127.0.0.1:37677/api/health
-
Run the smoke test, which includes the viewer health check:
contextgo smoke --sandbox
搜索无结果
Symptom / 症状: contextgo search "..." returns empty results for sessions you expect to find.
Cause / 原因: The daemon has not written recent sessions yet, source directories are not being watched, or the index has not been refreshed.
Resolution / 解决方法:
-
Confirm data is present in the storage root:
ls ~/.contextgo/raw/ ls ~/.contextgo/index/
-
Verify that common source paths exist on disk:
~/.codex/sessions/~/.claude/projects/~/.zsh_history~/.bash_history
-
Force an index refresh:
contextgo health
-
If using a custom storage root, confirm it is correctly set:
echo $CONTEXTGO_STORAGE_ROOT python3 -c "from contextgo.context_config import storage_root; print(storage_root())"
-
Run the quality gate for a full diagnostic:
python3 scripts/e2e_quality_gate.py
权限或路径错误
Symptom / 症状: PermissionError, FileNotFoundError, or OSError when reading or writing index files.
Resolution / 解决方法:
-
Check that the storage root is owned by the current user:
ls -ld ~/.contextgo ~/.contextgo/index ~/.contextgo/raw stat ~/.contextgo; whoami
-
Run the deep health check:
bash scripts/context_healthcheck.sh --deep
-
If the storage root was moved or deleted, recreate it:
mkdir -p ~/.contextgo/index ~/.contextgo/raw contextgo smoke
-
If using a custom path, confirm it is writable:
test -w "$CONTEXTGO_STORAGE_ROOT" && echo "writable" || echo "not writable"
Daemon 未采集会话
Symptom / 症状: New terminal or agent sessions do not appear in search results even after running health.
Cause / 原因: The daemon process is not running, or source paths are not in the expected locations.
Resolution / 解决方法:
-
Check whether the daemon is running:
ps aux | grep context_daemon -
Start the daemon if it is not running:
python3 src/contextgo/context_daemon.py & -
Verify the daemon can write to the storage root:
contextgo health ls ~/.contextgo/raw/ -
For persistent background operation, install via the provided service template:
ls docs/templates/ # launchd template for macOS, systemd-user template for Linux bash scripts/unified_context_deploy.sh
找不到 native 二进制
Symptom / 症状: health or native-scan reports the native backend is unavailable, or context_native.py logs a warning that no binary was found.
Cause / 原因: The Rust or Go binary has not been built, was removed, or is not in the expected path.
Resolution / 解决方法:
-
Check native backend status:
contextgo health contextgo native-scan --backend auto --query test -
Build the Go binary:
cd native/session_scan_go go build -o session_scan_go .
-
Build the Rust binary:
cd native/session_scan CARGO_TARGET_DIR="${CONTEXTGO_NATIVE_TARGET_DIR:-$HOME/.cache/contextgo/target}" \ cargo build --release
-
Verify the binary is discoverable:
python3 src/contextgo/context_native.py
-
The health probe result is cached (default TTL 30 s). To disable caching during development:
export CONTEXTGO_NATIVE_HEALTH_CACHE_TTL_SEC=0
Smoke 测试失败
Symptom / 症状: contextgo smoke --sandbox exits with a non-zero code.
The smoke test runs these steps in order:
Smoke 测试按以下顺序执行:
contextgo health- e2e quality gate
- write / read / export / import
- semantic pipeline
- viewer serve
Resolution / 解决方法:
-
Isolate with just the health step:
contextgo health
-
Check for syntax errors in recently changed scripts:
python3 -m py_compile src/contextgo/*.py -
Run individual test files to narrow down the failure:
python3 -m pytest tests/test_context_cli.py -v python3 -m pytest tests/test_context_core.py -v python3 -m pytest tests/test_session_index.py -v python3 -m pytest tests/test_context_native.py -v python3 -m pytest tests/test_context_smoke.py -v
-
Confirm the storage root is writable and index files exist:
ls -la ~/.contextgo/index/
已安装运行时问题
Symptom / 症状: smoke_installed_runtime.py fails, or scripts are missing from the installed location.
Default installed path / 默认安装路径: ~/.local/share/contextgo
Resolution / 解决方法:
-
Verify required files exist at the installed path:
ls ~/.local/share/contextgo/src/contextgo/context_cli.py ls ~/.local/share/contextgo/scripts/e2e_quality_gate.py
-
Confirm
CONTEXTGO_INSTALL_ROOTif you use a custom install location:echo $CONTEXTGO_INSTALL_ROOT
-
Re-run the deployment script to restore missing files:
bash scripts/unified_context_deploy.sh
-
Re-run the installed smoke:
contextgo smoke
发布前验证清单
Run this full sequence before tagging a release. All commands assume the current user has read/write access to ~/.contextgo (or $CONTEXTGO_STORAGE_ROOT if overridden).
发布打 tag 前运行以下完整序列。所有命令要求当前用户对 ~/.contextgo(或 $CONTEXTGO_STORAGE_ROOT)有读写权限。
# 1. Syntax checks / 语法检查
bash -n scripts/*.sh
python3 -m py_compile src/contextgo/*.py
# 2. Unit and integration tests / 单元与集成测试
python3 -m pytest tests/
# 3. End-to-end quality gate / 端到端质量门控
python3 scripts/e2e_quality_gate.py
# 4. Performance baseline / 性能基线
python3 -m benchmarks --iterations 1 --warmup 0 --query benchmark
# 5. Smoke tests / Smoke 测试
contextgo smoke --sandbox
python3 scripts/smoke_installed_runtime.py
# 6. Health check / 健康检查
bash scripts/context_healthcheck.sh
# 7. Native tests / native 测试
cd native/session_scan_go && go test ./...
cd native/session_scan && CARGO_INCREMENTAL=0 cargo test