Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ Add your API credentials inside `plugins.entries.graph-memory.config`:
"baseURL": "https://api.openai.com/v1",
"model": "gpt-4o-mini"
},
"llmMonthlyCallBudget": 90000,
"llmMonthlyCommunitySummaryBudget": 3000,
"llmMonthlyFinalizeBudget": 3000,
"llmBudgetTimeZone": "Asia/Shanghai",
"embedding": {
"apiKey": "your-embedding-api-key",
"baseURL": "https://api.openai.com/v1",
Expand All @@ -266,6 +270,14 @@ Add your API credentials inside `plugins.entries.graph-memory.config`:

**LLM** (`config.llm`) — Required. Used for knowledge extraction and community summaries. Any OpenAI-compatible endpoint works. Use a cheap/fast model.

**Virtual monthly LLM plan** (`llmMonthlyCallBudget`) — Optional but recommended for call-count-limited plans such as CodePlan. graph-memory tracks its own LLM calls in SQLite by month (`YYYY-MM`) and computes each day's dynamic allowance as:

```
remaining monthly calls / remaining days in the month, including today
```

Quiet days automatically increase the allowance for later days. If you start using this mid-month, set `llmMonthlyCallBudget` to your remaining calls for the current month; next month you can set it back to your full plan size.

**Embedding** (`config.embedding`) — Optional but recommended. Enables semantic vector search, community-level recall, and vector dedup. Without it, falls back to FTS5 full-text search (still works, just keyword-based).

> **⚠️ Important**: `pnpm openclaw plugins install` may reset your config. Always verify `config.llm` and `config.embedding` are present after reinstalling.
Expand Down Expand Up @@ -346,6 +358,17 @@ All parameters have defaults. Only set what you want to override.
| `compactTurnCount` | `7` | Turns between maintenance cycles (PageRank + community + summaries) |
| `recallMaxNodes` | `6` | Max nodes injected per recall |
| `recallMaxDepth` | `2` | Graph traversal hops from seed nodes |
| `llmMonthlyCallBudget` | `90000` | Virtual monthly LLM call plan. Daily allowance is computed from remaining monthly calls / remaining days |
| `llmMonthlyCommunitySummaryBudget` | `3000` | Monthly sub-budget for community summary LLM calls |
| `llmMonthlyFinalizeBudget` | `3000` | Monthly sub-budget for session-end finalize LLM calls |
| `llmBudgetTimeZone` | `Asia/Shanghai` | Time zone used to roll monthly/daily budget counters |
| `extractBatchMinMessages` | `6` | Pending meaningful messages before normal extraction runs |
| `extractBatchMinChars` | `1600` | Pending meaningful characters before normal extraction runs |
| `extractTrivialMaxChars` | `40` | Low-signal short confirmations at or below this length are skipped |
| `extractMaxMessageChars` | `600` | Max text kept per message in extraction prompts |
| `extractMaxBatchMessages` | `30` | Max unextracted messages sent to one extraction call |
| `extractDebounceMs` | `45000` | Quiet period before normal pending messages are flushed |
| `extractFlushIntervalMs` | `120000` | Periodic fallback flush interval for pending messages |
| `dedupThreshold` | `0.90` | Cosine similarity threshold for node dedup |
| `pagerankDamping` | `0.85` | PPR damping factor |
| `pagerankIterations` | `20` | PPR iteration count |
Expand Down
23 changes: 23 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ pnpm openclaw plugins install .
"baseURL": "https://api.openai.com/v1",
"model": "gpt-4o-mini"
},
"llmMonthlyCallBudget": 90000,
"llmMonthlyCommunitySummaryBudget": 3000,
"llmMonthlyFinalizeBudget": 3000,
"llmBudgetTimeZone": "Asia/Shanghai",
"embedding": {
"apiKey": "你的Embedding-API密钥",
"baseURL": "https://api.openai.com/v1",
Expand All @@ -268,6 +272,14 @@ pnpm openclaw plugins install .

**LLM**(`config.llm`)— 必填。用于知识提取和社区摘要生成。支持任何 OpenAI 兼容端点。建议用便宜/快速的模型。

**虚拟月调用计划**(`llmMonthlyCallBudget`)— 可选但推荐,适合 CodePlan 这类按调用次数限制的套餐。graph-memory 会在 SQLite 中按月份(`YYYY-MM`)记录自己的 LLM 调用次数,并按下面的公式动态计算当天额度:

```
本月剩余调用次数 / 含今天在内的本月剩余天数
```

某几天少用,后面每天的可用额度会自动变高。若你在月中启用,建议先把 `llmMonthlyCallBudget` 设置成本月剩余调用次数;下个月再改回完整套餐额度。

**Embedding**(`config.embedding`)— 可选但推荐。启用语义向量搜索、社区级召回和向量去重。不配则降级为 FTS5 全文搜索(仍然可用,只是基于关键词匹配)。

> **⚠️ 注意**:`pnpm openclaw plugins install` 可能会重置你的配置。每次重装插件后请检查 `config.llm` 和 `config.embedding` 是否还在。
Expand Down Expand Up @@ -348,6 +360,17 @@ sqlite3 ~/.openclaw/graph-memory.db "SELECT id, summary FROM gm_communities;"
| `compactTurnCount` | `7` | 维护周期(每隔多少轮触发 PageRank + 社区检测 + 摘要) |
| `recallMaxNodes` | `6` | 每次召回最多注入的节点数 |
| `recallMaxDepth` | `2` | 图遍历跳数 |
| `llmMonthlyCallBudget` | `90000` | 虚拟月调用计划。每日额度按本月剩余调用数 / 本月剩余天数动态计算 |
| `llmMonthlyCommunitySummaryBudget` | `3000` | 社区摘要 LLM 调用的月度子预算 |
| `llmMonthlyFinalizeBudget` | `3000` | 会话结束整理 LLM 调用的月度子预算 |
| `llmBudgetTimeZone` | `Asia/Shanghai` | 月度/每日预算计数切换使用的时区 |
| `extractBatchMinMessages` | `6` | 普通内容累计多少条消息后触发知识提取 |
| `extractBatchMinChars` | `1600` | 普通内容累计多少字符后触发知识提取 |
| `extractTrivialMaxChars` | `40` | 低价值短确认/寒暄消息在该长度内会跳过 LLM 提取 |
| `extractMaxMessageChars` | `600` | 知识提取时每条消息最多保留的字符数 |
| `extractMaxBatchMessages` | `30` | 单次知识提取最多处理的未提取消息数 |
| `extractDebounceMs` | `45000` | 普通消息安静多久后合批抽取 |
| `extractFlushIntervalMs` | `120000` | 定时兜底 flush 间隔,避免普通消息长期不抽取 |
| `dedupThreshold` | `0.90` | 向量去重的余弦相似度阈值 |
| `pagerankDamping` | `0.85` | PPR 阻尼系数 |
| `pagerankIterations` | `20` | PPR 迭代次数 |
Expand Down
Loading