Skip to content

Commit e1ae1d0

Browse files
committed
docs: expand agent memory, skills, and tools guides
Add missing guidance for memory_notes, reasoning fields, skills/tools best practices, troubleshooting, and highlight the comment-to-memory loop in README. Made-with: Cursor
1 parent 2c6ca0b commit e1ae1d0

File tree

3 files changed

+116
-14
lines changed

3 files changed

+116
-14
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ If you work in security operations, you probably deal with massive volumes of ra
2121
- **All-in-one pipeline** — Input, normalization, enrichment, correlation, and output in one flow; no more glue scripts between Kafka, ES, ClickHouse, and “rule engines”
2222
- **First-class CEP** — Detect ordered event sequences, absence patterns, and multi-source correlations over time with `<sequence>`, `<threshold>`, `<iterator>`, and `<checklist>`
2323
- **LLM agents in the stream** — Drop LLM-powered agents into the same pipeline for alert triage, enrichment, rule authoring, and auto-whitelisting
24+
- **Comment-to-memory learning loop** — Convert reviewer comments from Agent Tools Logs into durable `memory_notes`, auto-commit updates, and continuously improve agent behavior
2425
- **Skills system** — Attach knowledge bases and operational tools to agents via Skills, with progressive disclosure so prompts stay small and fast
2526
- **Rich plugin ecosystem** — Threat intel (VirusTotal, ThreatBook, Shodan), GeoIP, encoding, regex, time/window helpers, LLM calls, and more
2627
- **Production features out of the box** — Cluster mode, health checks, daily stats, sample data, Push Changes / review workflow, and a modern Web UI for rule and project orchestration
@@ -83,7 +84,7 @@ For the full syntax (all operations, modes, and best practices), see the [Comple
8384

8485
### LLM Agents & Skills
8586

86-
Agents are LLM-powered components that sit in the pipeline alongside rulesets. They receive event batches, call an LLM with tool-use support, and forward enriched results downstream.
87+
Agents are LLM-powered components that sit in the pipeline alongside rulesets. They process events independently, call an LLM with tool-use support, and forward enriched results downstream.
8788

8889
```yaml
8990
# Agent: AI-powered alert triage
@@ -93,15 +94,24 @@ system_prompt: |
9394
skills:
9495
- hub_ruleset_expert # Knowledge skill: rules engine reference
9596
tools: all # Expose all plugins as LLM tools
96-
batch:
97-
size: 5
98-
timeout: 30s
97+
max_rounds: 3
98+
timeout: 30s
99+
100+
# Optional long-term memory (recommended as YAML sequence)
101+
memory_notes:
102+
- Keep output JSON compact and stable.
103+
- Treat routine CI scanner traffic as lower priority unless other signals exist.
99104
```
100105
101106
**Skills** provide modular capabilities to agents:
102107
- **Knowledge skills** — Reference docs loaded on-demand (progressive disclosure)
103108
- **Builtin skills** — Go-implemented tools (e.g., `hub_ruleset_editor` for reading/writing rulesets)
104109

110+
Quick production tips:
111+
- Prefer `tools: []` by default and allowlist only needed plugin tools.
112+
- Use `tools: all` only for broad assistant agents (rule-authoring / deep triage).
113+
- In cluster mode, memory write/generate actions must go to the **leader** node.
114+
105115
Use agents in your project like any other component:
106116

107117
```yaml
@@ -110,6 +120,8 @@ content: |
110120
AGENT.alert_reviewer -> OUTPUT.enriched_alerts
111121
```
112122

123+
For full agent details (fields like `reasoning_mode`, `reasoning_budget_tokens`, `memory_notes`, and memory workflow in UI/API), see the [Complete Guide](docs/agentsmith-hub-guide.md#14-agent-syntax-description).
124+
113125
## Built-in Detection Rulesets
114126

115127
AgentSmith-HUB ships with production-ready detection rulesets that you can deploy immediately — no rule-writing required. All rules are mapped to [MITRE ATT&CK](https://attack.mitre.org/) for seamless integration with your security workflows.

docs/agentsmith-hub-guide-zh.md

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,15 @@ tools: [] # 插件工具:"all" 或名称列表;用
384384
385385
max_rounds: 1 # 每条消息最大 ReAct 工具调用轮数(默认: 5)
386386
timeout: 30s # 单条消息处理超时(如 30s、1m)
387+
388+
# 可选:支持“思考/推理”参数的模型可启用
389+
reasoning_mode: auto # disabled | enabled | auto(默认: disabled)
390+
reasoning_budget_tokens: 2048 # 可选:推理预算 token
391+
392+
# 可选:长期记忆,推荐使用 YAML 数组
393+
memory_notes:
394+
- 输出 JSON 字段保持稳定、简短,避免冗余长文本。
395+
- 对 CI 内网扫描流量默认降权,除非出现横向移动特征。
387396
```
388397

389398
#### 字段参考
@@ -398,6 +407,9 @@ timeout: 30s # 单条消息处理超时(如 30s、1m)
398407
| `tools` | 否 | `"all"` 暴露所有插件为工具;`[]` 或名称列表可限制。不需要工具时用 `[]` 可降低延迟。 |
399408
| `max_rounds` | 否 | 每条消息最大 ReAct 轮数(工具调用循环)。默认 `5`。 |
400409
| `timeout` | 否 | 时间字符串。若处理超过此时长会中止 LLM 调用。默认 `30s`。 |
410+
| `reasoning_mode` | 否 | 推理开关:`disabled`(默认)、`enabled`、`auto`(是否发送 provider/model 特定推理参数)。 |
411+
| `reasoning_budget_tokens` | 否 | 推理预算 token(仅对兼容的 provider/model 生效)。 |
412+
| `memory_notes` | 否 | 长期指导信息,会并入有效 system prompt。推荐 YAML 字符串数组;兼容旧版多行字符串。 |
401413

402414
#### 工作原理
403415

@@ -464,6 +476,28 @@ content: |
464476

465477
Agent 支持与 Ruleset 相同的测试流程:打开 Agent 组件,点击测试按钮或使用 **Cmd+D**,填写输入 JSON 后执行。测试会启动临时 Agent 并返回完整事件(原始数据 + `llm` 块),便于核对合并结果。
466478

479+
#### Memory Notes(长期记忆)说明
480+
481+
`memory_notes` 用于沉淀稳定、可复用的长期指导,不是 `system_prompt` 的替代,而是“这个 Agent 学到的经验”。
482+
483+
- 适合写可长期复用的规则:误报/真报判定线索、输出格式约束、置信度口径等。
484+
- 不建议写一次性事件细节(这类信息应放在评论或工单)。
485+
- 推荐使用 YAML 数组:
486+
487+
```yaml
488+
memory_notes:
489+
- 对常见 CI 扫描流量默认判定为低风险,除非出现异常外联或横向移动证据。
490+
- 当 llm_confidence >= 0.7 时,必须给出一句可审计证据说明。
491+
```
492+
493+
为兼容历史配置,旧版多行字符串仍可读取;新配置建议统一用数组格式,便于维护和合并。
494+
495+
#### Memory 工作流(UI / API / 集群)
496+
497+
- **UI 路径**:`Agent Tools Logs` 支持用户评论、从日志生成记忆、提交记忆。
498+
- **API 路径**:可通过 memory 相关接口更新/生成并自动提交组件变更。
499+
- **集群注意**:memory 写入与生成必须在 **leader** 节点执行,follower 会拒绝这类写操作。
500+
467501
#### 示例:告警审核 Agent
468502

469503
```yaml
@@ -564,15 +598,26 @@ skills:
564598
- hub_ruleset_editor # builtin skill: Ruleset 读写操作
565599
566600
tools: all
567-
568-
batch:
569-
size: 1
570-
timeout: 60s
571-
max_rounds: 10
601+
max_rounds: 10
602+
timeout: 60s
572603
```
573604

574605
在此配置中,Agent 同时拥有知识(规则引擎参考文档)和操作能力(Ruleset CRUD)。LLM 可以通过 `get_reference` 查阅语法,列出/读取现有 Ruleset,验证 XML,以及写入变更 —— 全部在 ReAct 循环中完成。
575606

607+
#### Skills / Tools 实操建议
608+
609+
- 默认建议先用 `tools: []`,只按需开放必要插件,降低延迟和误调用概率。
610+
- 仅在通用助手型 Agent(例如规则编写 Copilot)中使用 `tools: all`。
611+
- 需要“会查资料 + 会执行操作”时,组合使用知识型 Skill(`content`)和内置 Skill(`builtin_ref`)。
612+
- 生产环境中,尽量将可写内置技能设置为只读(如 `config.read_only: true`)。
613+
614+
#### Skills / Tools 调用排查
615+
616+
- 工具不触发:在 `system_prompt` 明确“何时必须调用某工具”。
617+
- 工具调用过多:收紧提示词边界,并降低 `max_rounds`。
618+
- 调错插件:把 `tools` 从 `all` 改为明确白名单。
619+
- 集群下写操作失败:确认请求命中 leader,而不是 follower。
620+
576621
## 🔧 第二部分:基本操作指南
577622

578623
### 2.1 临时文件和正式文件

docs/agentsmith-hub-guide.md

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,15 @@ tools: [] # Plugin tools: "all" or list of names; use [
385385
386386
max_rounds: 1 # Max ReAct tool-call rounds per message (default: 5)
387387
timeout: 30s # Per-message processing timeout (e.g. 30s, 1m)
388+
389+
# Optional reasoning params for models/providers that support "thinking" mode
390+
reasoning_mode: auto # disabled | enabled | auto (default: disabled)
391+
reasoning_budget_tokens: 2048 # Optional reasoning token budget
392+
393+
# Optional long-term memory notes; recommended as YAML sequence
394+
memory_notes:
395+
- Prefer compact JSON output with stable field names.
396+
- Reduce false positives for CI internal scanners.
388397
```
389398

390399
#### Field Reference
@@ -399,6 +408,9 @@ timeout: 30s # Per-message processing timeout (e.g. 30s, 1
399408
| `tools` | No | `"all"` exposes all plugins as tools; `[]` or a list of names to limit. Use `[]` when the agent does not need tools to reduce latency. |
400409
| `max_rounds` | No | Max ReAct rounds (tool-call loops) per message. Default `5`. |
401410
| `timeout` | No | Duration string. Aborts the LLM call if processing exceeds this. Default `30s`. |
411+
| `reasoning_mode` | No | Provider/model-specific reasoning toggle: `disabled` (default), `enabled`, or `auto`. |
412+
| `reasoning_budget_tokens` | No | Optional reasoning token budget for compatible providers/models. |
413+
| `memory_notes` | No | Durable guidance merged into the effective system prompt. Recommended format is a YAML string array; legacy multiline string is still accepted. |
402414

403415
#### How It Works
404416

@@ -465,6 +477,28 @@ content: |
465477

466478
Agents support the same test flow as rulesets: open the agent component, use the test button or **Cmd+D**, provide input JSON, and run. The test runs a temporary agent and returns the full event (original + `llm` block) so you can verify the merged result.
467479

480+
#### Memory Notes (Long-term Guidance)
481+
482+
`memory_notes` is for stable, durable guidance distilled from human feedback and run history. It is not a replacement for `system_prompt`; think of it as "what this agent has learned."
483+
484+
- Prefer concise bullets that survive across runs (FP/TP heuristics, output style constraints, escalation thresholds).
485+
- Avoid one-off incident details; put those in comments/tickets instead.
486+
- Recommended YAML format is a sequence:
487+
488+
```yaml
489+
memory_notes:
490+
- Mark routine CI scanner traffic as likely false positive unless lateral movement indicators exist.
491+
- Always include a short evidence sentence for confidence >= 0.7.
492+
```
493+
494+
Legacy multiline string remains supported for backward compatibility, but new configs should use sequences for readability and safer merges.
495+
496+
#### Memory Workflow (UI/API/Cluster)
497+
498+
- **UI path**: `Agent Tools Logs` supports user comments and memory generation/commit workflows.
499+
- **API path**: memory update and generate-from-log endpoints apply changes and auto-commit them as component changes.
500+
- **Cluster rule**: memory write/generate actions must run on the **leader** node; follower nodes reject these write operations.
501+
468502
#### Example: Alert Review Agent
469503

470504
```yaml
@@ -565,15 +599,26 @@ skills:
565599
- hub_ruleset_editor # builtin skill: read/write rulesets
566600
567601
tools: all
568-
569-
batch:
570-
size: 1
571-
timeout: 60s
572-
max_rounds: 10
602+
max_rounds: 10
603+
timeout: 60s
573604
```
574605

575606
In this setup, the agent has access to both knowledge (rules engine reference docs) and action (ruleset CRUD). The LLM can look up syntax via `get_reference`, list/read existing rulesets, verify XML, and write changes — all within the ReAct loop.
576607

608+
#### Skills & Tools Practical Guidance
609+
610+
- Start with `tools: []` and add only the plugin tools you truly need; this reduces latency and accidental tool calls.
611+
- Use `tools: all` only for broad assistant agents (rule-authoring copilots, deep triage assistants).
612+
- Pair a **knowledge skill** (`content`) with a **builtin/action skill** (`builtin_ref`) when the agent both reasons and edits.
613+
- For production safety, set write-capable builtin skills to read-only where possible (for example, `config.read_only: true`).
614+
615+
#### Troubleshooting Skills/Tools Calls
616+
617+
- Tool not called: improve `system_prompt` with explicit "when to call tool X" conditions.
618+
- Tool called too often: tighten prompt constraints and lower `max_rounds`.
619+
- Wrong plugin chosen: restrict `tools` to a short allowlist instead of `all`.
620+
- Write actions rejected in cluster: verify request hits leader node, not follower.
621+
577622
## 🔧 Part 2: Basic Operating Instructions
578623

579624
### 2.1 Temporary and Official Files

0 commit comments

Comments
 (0)