Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

docs(claude-code): describe session-start profile injection (#1914) (#1962)

Evob88b9c3baf80
diff --git a/docs/en/agent-integrations/02-claude-code.md b/docs/en/agent-integrations/02-claude-code.md
index e31da85b0..e7af8ae33 100644
--- a/docs/en/agent-integrations/02-claude-code.md
+++ b/docs/en/agent-integrations/02-claude-code.md
@@ -162,7 +162,7 @@ This plugin **complements** Claude Code's native memory system, it doesn't repla
|-----------------------|--------------------------------------------|---------------------------------------------------------------------------------------------------|
| `UserPromptSubmit` | Each user turn | Search OV → rank → inject `<openviking-context>` block within a token budget |
| `Stop` | Claude finishes a response | Parse transcript → push new user turns to OV session → commit when pending tokens cross threshold |
-| `SessionStart` | New / resumed / post-compact session | On `resume`/`compact`, fetch the latest archive overview and inject it as additional context |
+| `SessionStart` | New / resumed / post-compact session | Every source (startup/clear/resume/compact): inject the user's `profile.md` and an annotated listing of `preferences/` + `entities/`, capped by `OPENVIKING_PROFILE_TOKEN_BUDGET` (default `10000` tokens, CJK-aware; set `OPENVIKING_NO_AUTO_INJECT=1` to skip). On `resume`/`compact` additionally fetch the persistent session's latest archive overview + pre-archive abstracts. Both halves compose into a single `<openviking-context>` envelope. |
| `PreCompact` | Before Claude Code rewrites the transcript | Commit pending messages so they become an archive before CC mutates the transcript |
| `SessionEnd` | Claude Code session closes | Final commit so the last window is archived |
| `SubagentStart` | Parent spawns a subagent via Task tool | Derive an isolated OV session ID for the subagent, persist start state |
diff --git a/docs/zh/agent-integrations/02-claude-code.md b/docs/zh/agent-integrations/02-claude-code.md
index 02b3b9d91..aa0009dec 100644
--- a/docs/zh/agent-integrations/02-claude-code.md
+++ b/docs/zh/agent-integrations/02-claude-code.md
@@ -162,7 +162,7 @@ hook 脚本把每轮的小快照写到 `~/.openviking/state/`;statusline 脚
|-----------------------|-----------------------------------------|---------------------------------------------------------------------------------------------------|
| `UserPromptSubmit` | 每次用户输入 | 搜索 OV → 排序 → 在 token 预算内注入 `<openviking-context>` 块 |
| `Stop` | Claude 完成一次回复 | 解析 transcript → 把新的用户轮推入 OV session → pending tokens 超阈值时 commit |
-| `SessionStart` | 新建 / 恢复 / compact 后的 session | 在 `resume`/`compact` 场景,拉取最新归档摘要并注入为额外上下文 |
+| `SessionStart` | 新建 / 恢复 / compact 后的 session | 每次启动(startup/clear/resume/compact):注入用户 `profile.md` 及 `preferences/` + `entities/` 的带描述目录清单,受 `OPENVIKING_PROFILE_TOKEN_BUDGET` 限制(默认 `10000` tokens,CJK-aware;设 `OPENVIKING_NO_AUTO_INJECT=1` 可跳过)。`resume`/`compact` 场景额外拉取持久化 session 的最新归档摘要 + pre-archive abstracts。两部分合成单一 `<openviking-context>` 信封。 |
| `PreCompact` | Claude Code 重写 transcript 之前 | 在 CC 改写前,把待写入消息 commit 成归档 |
| `SessionEnd` | Claude Code session 关闭 | 最终 commit,让最后一个窗口归档 |
| `SubagentStart` | 父 agent 通过 Task 工具派生 subagent | 为 subagent 派生隔离的 OV session ID,持久化启动状态 |