User gives alert + workspace ID. Follow these steps in exact order:
Step 1: Get workspace context
bash
curl -s "$API/workspaces/{workspaceId}" -H "Authorization: Bearer $KEY"
Note the
(splunk/elastic/sentinel),
,
, and
.
Step 2: ALWAYS submit alert to the queue first
Every investigation MUST go through the queue — even if the user pasted the alert directly in the CLI. This ensures the Agent Dashboard on the frontend tracks all investigations in real-time.
bash
curl -s -X POST "$API/workspaces/{workspaceId}/queue" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"alertId": "{alertId}", "alertTitle": "{alertTitle}", "alertSeverity": "{severity}", "alertData": "{full alert text}"}'
Save the returned
as
(queue item ID).
Step 3: Claim the alert
bash
curl -s -X PATCH "$API/queue/{QID}/claim" -H "Authorization: Bearer $KEY"
The frontend Agent Dashboard now shows this alert as "Processing".
Step 4: Check for cached context from prior investigations
Check if the workspace already has a cached schema from a prior queue item:
bash
curl -s "$API/workspaces/{workspaceId}/queue?status=completed" -H "Authorization: Bearer $KEY"
If a completed alert exists with the same workspace, its context (including schema) can be reused. Otherwise, proceed to schema discovery.
Step 5: MANDATORY schema discovery
This step is NON-NEGOTIABLE. You MUST do this before ANY investigation query. Post progress to the queue so the dashboard shows what you're doing:
Ask the user directly based on the SIEM provider from Step 1:
Splunk:
Please run this query in Splunk and paste the full results:
index=* NOT index=_* earliest=-30d | head 10000 | fieldsummary maxvals=10 | sort -count | head 60
This will show me what indexes, sourcetypes, and fields exist so I can write accurate queries.
Note:
limits to the last 30 days — good for production SIEMs to avoid scanning too much data. For TryHackMe labs or historical investigations where events may be older, the autonomous mode uses
(All time) instead.
Elastic:
Please go to Kibana Discover, select the relevant index pattern, and paste 5-10 sample events as JSON. I need the actual field names to write correct ES|QL queries.
Sentinel:
Please run this in Azure Monitor Logs and paste the results:
search * | summarize count() by $table | sort by count_ desc | take 20
Then paste 3-5 sample events from the most relevant table.
After the user provides schema results:
- Parse carefully — extract index names, sourcetypes, field names, event counts
- Save immediately to the queue item context:
bash
curl -s -X PATCH "$API/queue/{QID}/context" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"schema": {"provider": "splunk", "indexes": [...], "sourcetypes": [...], "fields": [...], "rawSchemaOutput": "..."}, "investigationPhase": "schema_complete"}'
- Post progress so the dashboard shows schema discovery is done:
bash
curl -s -X PATCH "$API/queue/{QID}/progress" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"step": "schema_discovery", "status": "complete", "title": "Schema discovery complete", "detail": "Found index=main, sourcetype=_json, 595 events"}'
- ALL subsequent queries MUST use names from the schema. Never guess or use defaults.
Step 6: Investigation loop
NOW you can formulate queries — using ONLY field names, indexes, and sourcetypes from the schema.
For each query:
- Verify the fields exist in the schema
- Use the correct index and sourcetype from the schema
HITL mode (default): Ask the user to run each query:
Please run this {SPL/KQL/ESQL} query and paste the results:
{query using schema-verified field names}
Purpose: {why this query matters}
Autonomous mode: Run each query yourself via Chrome — type the query in the SIEM search bar, execute it, and read the results directly.
Analyze results. Apply the classification framework after 1-3 initial queries.
Step 7: Save IOCs and MITRE techniques to the queue item
bash
curl -s -X PATCH "$API/queue/{QID}/iocs" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"iocs": [{"value": "...", "type": "ip", "verdict": "malicious", "context": "C2 server"}], "append": true}'
curl -s -X PATCH "$API/queue/{QID}/mitre" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"techniques": [{"techniqueId": "T1053.005", "name": "Scheduled Task", "tactic": "Persistence"}], "append": true}'
Step 8: Save report to the queue item (use heredoc + Node.js for Windows paths — see "Posting multi-line content" above)
Write the 9-section report (see
references/report-format.md
), then:
bash
curl -s -X PATCH "$API/queue/{QID}/report" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d @"$PAYLOAD_PATH"
Where payload JSON is
{"report": "# Investigation Report..."}
.
Step 9: Mark complete with verdict
bash
curl -s -X PATCH "$API/queue/{QID}/complete" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"verdict": "True Positive", "verdictConfidence": 92, "escalationRequired": true, "classificationRationale": "...", "queriesExecuted": 5, "agentSource": "claude-code"}'
Valid verdicts:
,
,
,
Requires Further Investigation
,
Step 10: Check queue for more alerts
bash
curl -s "$API/workspaces/{workspaceId}/queue/next" -H "Authorization: Bearer $KEY"
If
→ "All alerts processed."
If an alert exists → go to Step 3 (claim it).
用户提供告警+工作区ID。请严格按照以下顺序执行步骤:
步骤1:获取工作区上下文
bash
curl -s "$API/workspaces/{workspaceId}" -H "Authorization: Bearer $KEY"
记录
(splunk/elastic/sentinel)、
、
和
。
步骤2:必须首先将告警提交到队列
每一项调查都必须经过队列——即使用户直接在CLI中粘贴了告警。这可确保前端的Agent Dashboard实时跟踪所有调查。
bash
curl -s -X POST "$API/workspaces/{workspaceId}/queue" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"alertId": "{alertId}", "alertTitle": "{alertTitle}", "alertSeverity": "{severity}", "alertData": "{full alert text}"}'
步骤3:认领告警
bash
curl -s -X PATCH "$API/queue/{QID}/claim" -H "Authorization: Bearer $KEY"
前端Agent Dashboard现在会将该告警显示为"处理中"。
步骤4:检查是否有来自之前调查的缓存上下文
检查工作区是否已有来自之前队列项的缓存Schema:
bash
curl -s "$API/workspaces/{workspaceId}/queue?status=completed" -H "Authorization: Bearer $KEY"
如果存在同一工作区的已完成告警,则可以复用其上下文(包括Schema)。否则,继续进行Schema发现。
步骤5:必须进行Schema发现
此步骤是不可协商的。在执行任何调查查询之前,必须完成此步骤。向队列提交进度,以便Dashboard显示你正在进行的工作:
根据步骤1中的SIEM提供商直接询问用户:
Splunk:
请在Splunk中运行以下查询并粘贴完整结果:
index=* NOT index=_* earliest=-30d | head 10000 | fieldsummary maxvals=10 | sort -count | head 60
这将向我展示存在哪些索引、源类型和字段,以便我编写准确的查询语句。
注意:
限制为最近30天——适用于生产环境SIEM,避免扫描过多数据。对于TryHackMe实验室或事件可能较旧的历史调查,自主模式会使用
(所有时间)。
Elastic:
请进入Kibana Discover,选择相关的索引模式,然后粘贴5-10个示例事件的JSON格式内容。我需要实际的字段名称来编写正确的ES|QL查询语句。
Sentinel:
请在Azure Monitor日志中运行以下查询并粘贴结果:
search * | summarize count() by $table | sort by count_ desc | take 20
然后粘贴最相关表中的3-5个示例事件。
用户提供Schema结果后:
- 仔细解析——提取索引名称、源类型、字段名称、事件数量
- 立即保存到队列项上下文中:
bash
curl -s -X PATCH "$API/queue/{QID}/context" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"schema": {"provider": "splunk", "indexes": [...], "sourcetypes": [...], "fields": [...], "rawSchemaOutput": "..."}, "investigationPhase": "schema_complete"}'
- 提交进度,以便Dashboard显示Schema发现已完成:
bash
curl -s -X PATCH "$API/queue/{QID}/progress" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"step": "schema_discovery", "status": "complete", "title": "Schema发现完成", "detail": "发现index=main, sourcetype=_json, 595个事件"}'
- 所有后续查询必须使用Schema中的名称。请勿猜测或使用默认值。
步骤6:调查循环
现在你可以制定查询语句了——只能使用Schema中的字段名称、索引和源类型。
对于每个查询:
- 验证字段是否存在于Schema中
- 使用Schema中的正确索引和源类型
HITL模式(默认): 要求用户运行每个查询:
请运行此{SPL/KQL/ESQL}查询并粘贴结果:
{使用Schema验证后的字段名称编写的查询语句}
目的: {此查询的重要性}
自主模式: 通过Chrome自行运行每个查询——在SIEM搜索栏中输入查询语句,执行并直接读取结果。
分析结果。在1-3次初始查询后应用分类框架。
步骤7:将IOC和MITRE技术保存到队列项
bash
curl -s -X PATCH "$API/queue/{QID}/iocs" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"iocs": [{"value": "...", "type": "ip", "verdict": "malicious", "context": "C2 server"}], "append": true}'
curl -s -X PATCH "$API/queue/{QID}/mitre" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"techniques": [{"techniqueId": "T1053.005", "name": "Scheduled Task", "tactic": "Persistence"}], "append": true}'
步骤8:将报告保存到队列项(对于Windows路径,使用heredoc + Node.js方法——请参见上方的"提交多行内容")
编写9节报告(请参见
references/report-format.md
),然后执行:
bash
curl -s -X PATCH "$API/queue/{QID}/report" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d @"$PAYLOAD_PATH"
步骤9:标记完成并添加结论
bash
curl -s -X PATCH "$API/queue/{QID}/complete" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"verdict": "True Positive", "verdictConfidence": 92, "escalationRequired": true, "classificationRationale": "...", "queriesExecuted": 5, "agentSource": "claude-code"}'
有效的结论值:
、
、
、
Requires Further Investigation
、
步骤10:检查队列中是否有更多告警
bash
curl -s "$API/workspaces/{workspaceId}/queue/next" -H "Authorization: Bearer $KEY"
如果
→ "所有告警已处理完毕。"
如果存在告警 → 转到步骤3(认领它)。