Skip to content

feat(agent): add versioned knowledge pack and knowledge_lookup tool - #522

Merged
BaaRai merged 3 commits into
mainfrom
feat/knowledge-pack
Nov 26, 2026
Merged

BaaRai merged 3 commits into
mainfrom
feat/knowledge-pack

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 24, 2026

Copy link
Copy Markdown
Owner

What

Adds a small, versioned security taxonomy pack and a read-only knowledge_lookup tool for the planner and the workers.

  • knowledge/: MITRE ATT&CK Enterprise (706 techniques), OWASP WSTG (133 tests), MITRE CWE (956 weaknesses). Each entry has an id, name, category, a capped description, a truncated flag and the canonical URL.
  • knowledge/data/sources.json: source URL, license, retrieval date, source SHA-256 and entry count for each file.
  • knowledge/NOTICE and knowledge/licenses/: attribution and the license texts. The data files keep their own licenses; the repository's AGPL-3.0 covers the code.
  • scripts/knowledge/build.py: regenerates the pack from the official sources.
  • agent/knowledge_tool.go: the knowledge_lookup tool (source, query, optional limit; exact id or keywords; max 20). It is advertised to the planner and the workers.
  • .dockerignore: only the top-level /data runtime directory is excluded, so knowledge/data stays in the build context.

Why

The planner and the workers plan in free text. Stable ids let a finding or a fact cite CWE-79, T1190 or WSTG-ATHN-01, which is the base for coverage checks, finding enrichment and RSI lessons. A large community corpus was evaluated and rejected: most of it is benchmark tarballs and duplicates, and the rest has unclear redistribution rights. This pack is built from the primary sources instead.

Tests

  • go test ./knowledge (load, exact lookup, keyword search, limit, errors, duplicate ids)
  • go test ./agent -run TestKnowledge (tool output, limit clamp, errors, read-only)
  • go build ./...
  • go vet ./knowledge ./agent
  • gofmt -l on the new files

The Docker build stage was not built locally because the Docker daemon is off. The .dockerignore change keeps knowledge/data in the context and go build ./... covers the embed.

Limits

Closes #521.

Embed MITRE ATT&CK, OWASP WSTG and MITRE CWE ids, names, categories and
capped descriptions generated by scripts/knowledge/build.py. The pack records
the source URL, license, retrieval date and SHA-256; the license texts and
attribution live in knowledge/NOTICE and knowledge/licenses.

Expose a read-only knowledge_lookup tool to the planner and the workers so an
agent can resolve an entry by id or keyword and cite the id in findings and
facts. The data files keep their own licenses; the repository's AGPL-3.0
covers the code.

Refs #521.
knowledge_lookup takes a taxonomy id or keyword, never a connection. Add it to
the intercept noTargetTools list so the target gate does not read targets from
its query. TestDomainToolsDeclareNoTarget now covers the new domain tool.

Refs #521.
@5P34R

5P34R commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Review notes

The data checks out. ATT&CK enterprise-attack.json and CWE 1000.csv match the SHA-256 values in sources.json. All 706 ATT&CK and 956 CWE entries match upstream, and all 133 WSTG entries match current upstream (upstream has since added WSTG-WASM-04). There's no hidden Unicode, no encoded blobs, and no instruction-like text aimed at the agent beyond genuine taxonomy prose. The loader has no runtime I/O or path handling, and results are capped at 20.

Small changes before merge:

  • Dead ranking code (knowledge/knowledge.go Search): strings.HasPrefix(id, strings.ToUpper(q)) runs after id was lowercased, so it's always false and a partial id like T1059. never ranks sub-techniques first. Compare lowercase to lowercase.
  • Drop knowledge/licenses/CWE-TERMS.html. It's a raw page scrape that includes Google Tag Manager and Osano consent scripts. It isn't served, but it's cruft, and CWE-TERMS.txt plus the .url file are enough.

Optional:

  • scripts/knowledge/build.py fetches upstream master branches without pinning. The WSTG hash had already drifted two days later, so the pack can't be reproduced from sources.json. Pin to release tags or commits.
  • Accept a bare CWE number (79) and the T1059/001 form.
  • In Docker, .dockerignore's data already matched only the root, so the /data change is harmless but the stated reason doesn't hold.

@BaaRai
BaaRai force-pushed the feat/knowledge-pack branch from 6e13914 to 102a008 Compare November 26, 2026 22:25
BaaRai added a commit to zombrax1/ARTEX that referenced this pull request Nov 26, 2026
@BaaRai
BaaRai force-pushed the feat/knowledge-pack branch from 102a008 to 9cbb465 Compare November 26, 2026 22:40
BaaRai added a commit to zombrax1/ARTEX that referenced this pull request Nov 26, 2026
@BaaRai
BaaRai force-pushed the feat/knowledge-pack branch from 9cbb465 to 311b712 Compare November 26, 2026 22:56
BaaRai added a commit to zombrax1/ARTEX that referenced this pull request Nov 26, 2026
@BaaRai
BaaRai force-pushed the feat/knowledge-pack branch from 311b712 to 552a635 Compare November 26, 2026 23:14
@BaaRai
BaaRai merged commit f76810a into main Nov 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a versioned knowledge pack and a knowledge_lookup tool (ATT&CK, WSTG, CWE)

2 participants