Skip to content

feat(sec-core): add security observability skill - #2245

Draft
yangdao479 wants to merge 1 commit into
alibaba:mainfrom
yangdao479:feature/agent-sec-core/add_cli_usage_skill
Draft

feat(sec-core): add security observability skill#2245
yangdao479 wants to merge 1 commit into
alibaba:mainfrom
yangdao479:feature/agent-sec-core/add_cli_usage_skill

Conversation

@yangdao479

Copy link
Copy Markdown
Collaborator

Why

Agent 需要一个明确的 Skill 来理解如何通过 agent-sec-cli 查询本地安全事件和会话级安全复盘结果。现有 CLI 已具备 eventsobservability report 能力,但缺少面向 Agent 的参数说明、输出结构说明和安全报告规则。

What changed

  • 新增 security-observability Skill,说明 agent-sec-cli events 的过滤参数、互斥规则、JSON/JSONL 输出结构、计数输出和事件字段语义。
  • 说明 agent-sec-cli observability report --format json 的会话报告结构,并提示不要把顶层 succeeded / failed 误解为扫描器的 pass / warn / deny
  • 明确该 Skill 通过现有 shared skills bundle 安装,不在 cosh extension 中重复打包。
  • 新增轻量契约测试,验证 cosh extension 不自带 skills、component manifest 仍整体安装 skills bundle,并验证 Skill frontmatter 与关键文档契约。

Related issue

no-issue: 补齐 agent-sec-core 安全可观测查询的 Agent 使用说明。

User / Agent impact

安装 agent-sec-core skills 后,Agent 可以调用 security-observability Skill,按结构化方式查询安全事件和会话报告。运行时 CLI、hook 和 extension 行为不变。

Risk and compatibility

  • Public CLI, API, configuration, or documented behavior changed
  • Privileged or security-sensitive behavior changed
  • Cross-component contract changed
  • Migration or rollback guidance is needed

Low risk。变更只新增 Skill 文档和对应契约测试,不修改 CLI 行为、hook 行为、配置格式或安装布局。

Validation

  • uv run --project /Users/blank/Workspace/mine_anolisa/mine_anolisa/src/agent-sec-core/agent-sec-cli pytest /Users/blank/Workspace/mine_anolisa/mine_anolisa/src/agent-sec-core/tests/unit-test/cosh_hooks/test_extension_skill.py -v — 4 passed
  • make -C /Users/blank/Workspace/mine_anolisa/mine_anolisa/src/agent-sec-core stage-skills — passed
  • make -C /Users/blank/Workspace/mine_anolisa/mine_anolisa/src/agent-sec-core stage-component-manifest — passed
  • git --no-pager diff --check -- <本次相关文件> — passed

Documentation and rollback

新增的 SKILL.md 是面向 Agent 的使用说明。回滚时删除 src/agent-sec-core/skills/security-observability/ 及对应契约测试即可,不影响现有 CLI、hook 或 component manifest。

Document read-only security event queries through agent-sec-cli events.

Document session reports for agent workflows.

Keep the skill in the shared skills bundle.

Avoid bundling it in the cosh extension so existing skill install paths distribute it.

Signed-off-by: yizheng <YiZheng.Yang@linux.alibaba.com>
@github-actions github-actions Bot added component:sec-core src/agent-sec-core/ scope:documentation ./docs/|./*.md|./NOTICE labels Aug 5, 2026
@yangdao479
yangdao479 requested a review from RemindD August 5, 2026 13:36
1. 先用 `events --summary` 或 `events --count-by` 获取概览。
2. 根据 `event_type`、`category`、关联 ID 和时间范围缩小查询。
3. 需要程序解析时使用 `--output json` 或 `--output jsonl`,不要解析 table 或 summary 文本。
4. 已知 `session_id` 或需要查看最近会话时,使用 `observability report --format json` 汇总 LLM、工具和安全事件。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还需要添加--last或者--session-id session_id可以获得session级别的统计

agent-sec-cli events --last-hours 8 --category code_scan --count
```

`--summary` 在未指定时间范围时默认查询最近 24 小时。它输出人类可读文本,只适合展示,不适合作为稳定的数据接口。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么不适合作为稳定的数据接口呢?如果不适合应该要进行改进

--output json
```

### 参数

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否通过agent-sec-cli events --help自动获取,维护两份参数列表可能会导致修改后不一致

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:sec-core src/agent-sec-core/ scope:documentation ./docs/|./*.md|./NOTICE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants