aguara
CLAUDE.md93 starsChanged 9 months agoApache-2.0View on GitHub
Aguara v0.28.0 (2026-09-10): untrusted-project defaults, audit triage and agent handoff, skill/helper and script checks, parser/report hardening, and verified September 7 embedded intelligence (35,774 record rows + 203,639 all-version entries; not unique package totals). Previous release: v0.27.0 (2026-06-12). Current tree: 24 fuzz targets, 192 YAML rules + 66 analyzer-emitted (258 cataloged), 13 YAML categories (+ analyzer categories incl. agent-trust), 14 per-file scan analyzers (pattern, ci-trust, pkgmeta, jsrisk, pyrisk, scriptrisk, rsbuild, npmpolicy, pnpmpolicy, agentpolicy, skillpolicy, NLP, toxicflow, rugpull) plus the skill-chain project…
- Installs packages
- Commits and pushes
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
26 rules. About 0 are common, 15 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 78
All fourteen implement the Analyzer interface (internal/scanner/analyzer.go): Name() string + Analyze(ctx, *Target) ([]Finding, error).
- Very specific: line 80
After per-file analysis, SkillChain (internal/engine/skillchain/) runs as a CrossFileAccumulator.
- Very specific: line 128
Always call resetFlags() at the start of each CLI test to avoid global flag state leaking.
- Very specific: line 132
Create branch release/vX.Y.Z from main
- Distinctive: line 134
Commit, push, create PR, merge
- Very specific: line 145
Start from the Dashboard: Read DOCS/Aguara/00 Dashboard.md to understand current state.
- Very specific: line 146
Follow CONVENTIONS.md: Every .md file needs frontmatter (type, tags, status, dates).
- Distinctive: line 152
When completing a distribution task (submitting a post, publishing a blog, opening a PR):
- Very specific: line 156
Update the version hub: - if content was for a specific version, confirm links in product/vX.Y.Z/_index.md.
- Distinctive: line 158
When completing a product task (fixing a bug, adding a feature, releasing a version):
- Distinctive: line 160
Update CLAUDE.md: - if rule count, test count, or version changes.
- Distinctive: line 165
When any of these values change, update ALL references across the vault:
- Very specific: line 173
Use Grep to find all occurrences before updating.
- Distinctive: line 177
All external content (blog posts, social media, Reddit, newsletters) MUST go through this 4-stage pipeline:
- Distinctive: line 197
Awesome list PRs: Create fork -> PR -> delete fork immediately after merge/close (keep garagon account clean).
- Very specific: line 198
punkpeye awesome-mcp repos: use emoji format: 🏎️ (Go), 🏠 (local), 🍎🪟🐧 (OS).
- Distinctive: line 199
wong2/awesome-mcp-servers: does NOT accept PRs - must use mcpservers.org/submit web form.
- Distinctive: line 201
OpenAlternative.co / OpenSourceAlternative.to: Don't accept CLIs. Descartados.
- Distinctive: line 203
Official MCP Registry: Only accepts npm/TypeScript packages.
- Distinctive: line 209
When reviewing external PRs:
- Very specific: line 211
Use gh pr merge <N> --merge --admin --delete-branch to bypass branch protection for verified fork PRs.
- Distinctive: line 212
After merging rule PRs, update rule count references in README.md, CONTRIBUTING.md, and CLAUDE.md.
- Very specific: line 217
Never include Co-Authored-By: Claude in commits to this repository.
- Distinctive: line 218
Never include "Generated with Claude Code" in PR descriptions.
- Distinctive: line 219
Never use em dashes (-) in LinkedIn posts or external communications.
- Distinctive: line 220
All commits and PRs are authored entirely under garagon's name.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Status
Aguara v0.28.0 (2026-09-10): untrusted-project defaults, audit triage and agent handoff, skill/helper and script checks, parser/report hardening, and verified September 7 embedded intelligence (35,774 record rows + 203,639 all-version entries; not unique package totals). Previous release: v0.27.0 (2026-06-12). Current tree: 24 fuzz targets, 192 YAML rules + 66 analyzer-emitted (258 cataloged), 13 YAML categories (+ analyzer categories incl. agent-trust), 14 per-file scan analyzers (pattern, ci-trust, pkgmeta, jsrisk, pyrisk, scriptrisk, rsbuild, npmpolicy, pnpmpolicy, agentpolicy, skillpolicy, NLP, toxicflow, rugpull) plus the skill-chain project correlation and the aguara check incident command (npm/PyPI installed trees + pre-install npm lockfiles pnpm-lock.yaml / package-lock.json / yarn.lock classic v1 / yarn.lock Berry v2+ / bun.lock text - all with npm: alias resolution to the real package - and Go/Rust/PHP/Ruby/Java/.NET lockfiles), 0 lint issues.
Distribution: install.sh (mandatory checksum verification, bounded curl + retry), Homebrew tap, Docker (GHCR, multi-arch linux/amd64+arm64, runs as non-root UID 10001, base images digest-pinned, signed at digest with Cosign + SBOM + SLSA provenance attestations), GoReleaser (releases signed via Cosign keyless, SPDX SBOM per archive, -trimpath for reproducibility), GitHub Action, go install.
GitHub: 84 stars, 15 forks. 3 awesome-list PRs pending review in external repos (sbilly/awesome-security, Puliczek/awesome-mcp-security, ottosulin/awesome-ai-security; 3 others merged, forks deleted 2026-07-01). Issue #230: external contributor building an out-of-tree ATR rule pack for --rules (welcomed; link from README when it ships).
Pattern matcher already uses an Aho-Corasick keyword prefilter (active in production since v0.14.0). Real perf is ~210ms/op on the synthetic bench (was ~770ms without AC), so do not treat "pattern matcher perf" as an open backlog item unless pprof shows a concrete regression. Pending improvements: WASM build (cmd/wasm/ incomplete), adoption/marketing.
Internal docs (gitignored) in DOCS/ as an Obsidian vault. See DOCS/Aguara/CONVENTIONS.md for vault rules and DOCS/Aguara/00 Dashboard.md for the entry point.
Key locations:
- Dashboard (MOC):
DOCS/Aguara/00 Dashboard.md - Conventions:
DOCS/Aguara/CONVENTIONS.md- frontmatter schema, types, statuses, tags, naming - Product versions:
DOCS/Aguara/product/v0.10.0/_index.md(version hub with links to all generated content; v0.11.0–v0.14.0 hubs not yet created) - Distribution channels:
DOCS/Aguara/distribution/<channel>/_index.md(each has submission log) - Growth plan:
DOCS/Aguara/product/roadmap.md - Templates:
DOCS/Aguara/templates/(channel.md, product-version.md) - Demo video project:
/Users/dev/Dev/videos/aguara-demo/(Remotion, React-based) - Oktsec docs (separate project):
DOCS/Oktsec/
Build & Test Commands
make build # Production binary with version/commit ldflags
make test # go test -race -count=1 ./...
make lint # golangci-lint run ./...
make vet # go vet ./...
make fmt # gofmt -w .
make run ARGS="scan ./path" # Development run
# Single package test
go test -race -count=1 ./internal/rules/...
# Single test function
go test -race -count=1 -run TestFunctionName ./internal/engine/pattern/...
# Benchmarks
go test -bench=. -benchtime=3x ./internal/engine/pattern/
go test -bench=. -benchtime=3x ./internal/engine/nlp/
go test -bench=. -benchtime=3x ./internal/scanner/CI requires: make build && make test && make vet && make lint all passing.
Architecture
Aguara is a deterministic static security scanner for AI agent skills and MCP servers. No LLM, no network calls. Go 1.25, module github.com/garagon/aguara.
Public Library API (aguara.go, options.go)
Root package re-exports types from internal/types and exposes: Scan(), ScanContent(), ListRules(), ExplainRule(), Discover(). Used by external consumers like aguara-mcp. Functional options pattern (WithMinSeverity(), WithWorkers(), etc.).
Analyzer wiring is centralized: add an analyzer in internal/engine/engine.go (DefaultAnalyzers + RuleMetadata) - one place, not the old four call sites. Emit-site RuleName/Severity/Category derive from each analyzer's RuleMetadata() via rulemeta.Index (no string drift).
Analysis Pipeline (13 default analyzers + rug-pull when --monitor is set, run sequentially per file)
- Pattern Matcher (
internal/engine/pattern/) - Regex/contains matching against compiled rules. 8 decoders (base64, hex, URL encoding, Unicode escapes, HTML entities, hex escapes, base32, C-style octal escapes) for encoded evasion detection. Markdown code-block severity downgrade. Dynamic confidence based on pattern hit ratio. - CI Trust (
internal/engine/ci/) - YAML parser for.github/workflows/*.yml. Detectspull_request_targetpwn-request chains, cache poisoning, OIDC token surface, and persisted-credentials checkouts. EmitsGHA_PWN_REQUEST_001/GHA_CACHE_001/GHA_OIDC_001/GHA_CHECKOUT_001. - PkgMeta (
internal/engine/pkgmeta/) - JSON parser forpackage.json. Detects npm install-time lifecycle scripts paired with git-sourced dependencies, optional-git deps, and publish-surface chains. EmitsNPM_LIFECYCLE_GIT_001/NPM_OPTIONAL_GIT_001/NPM_PUBLISH_SURFACE_001. - JSRisk (
internal/engine/jsrisk/) - Single-pass JavaScript scanner for.js/.mjs/.cjs. Detects obfuscator-shape payloads, install-time daemonization, CI secret harvesting, runner process-memory pivots, and Claude Code/VS Code persistence. EmitsJS_OBF_001/JS_DAEMON_001/JS_CI_SECRET_HARVEST_001/JS_PROC_MEM_OIDC_001/AGENT_PERSISTENCE_001. - PyRisk (
internal/engine/pyrisk/) - Flow-sensitive single-pass scanner forsetup.py/__init__.py. Binds a remote-JS fetch to anode -e/--evalexecution sink (≤2 hops, taint cleared on safe reassignment). EmitsPY_IMPORTTIME_REMOTE_JS_001(moved from a co-presence YAML rule in v0.22.0). - ScriptRisk (
internal/engine/scriptrisk/) - Evidence scanner for local Python and shell scripts. Binds decoded, character-constructed, or remotely fetched Python values toexec/eval, identifies sensitive local context paired with a bound HTTP write, detects literal world-writable permission changes through bound Python APIs or commands, resolves structured pathlib/subprocess systemd persistence, and flags real pip/npm commands using unencrypted dependency sources. EmitsPY_DECODE_EXEC_001,PY_REMOTE_FETCH_EXEC_001,PY_CONTEXT_EXFIL_001,PY_WORLD_WRITABLE_001,SC-EX-007(migrated from YAML),SHELL_UNSAFE_PIP_SOURCE_001, andSHELL_UNSAFE_NPM_SOURCE_001. - RSBuild (
internal/engine/rsbuild/) - Flow-sensitive single-pass scanner forbuild.rs. Binds a wallet/keystore read to a network send sink (the tainted value must reach a send/body argument; ≤2 hops). EmitsRS_BUILD_WALLET_EXFIL_001(moved from a co-presence YAML rule in v0.22.0). - NpmPolicy (
internal/engine/npmpolicy/) - Readspackage.json(allowScriptspolicy) and project.npmrcfor npm v12 install-trust weakenings: thedangerously-allow-all-scriptsescape hatch, unpinned approvals,allow-git/allow-remoterelaxations. Ground-truthed against npm 11.16.0 (deny entries are name-only false and never fire; quoted+comment values are inert; last-wins; empty boolean = true; manifest keys case-sensitive). Emits 4NPM_*rules (1 HIGH, 3 MEDIUM), category supply-chain. - PnpmPolicy (
internal/engine/pnpmpolicy/) - yaml.Node parser forpnpm-workspace.yaml(exact target, base name only). Flags pnpm supply-chain settings weakened below the v11 defaults; absence of a setting never fires. Only exact camelCase keys match (ground truth pnpm 11.5.2: kebab-case in pnpm-workspace.yaml is silently IGNORED by pnpm - kebab is the .npmrc spelling - so kebab must NOT fire), YAML merge keys expand (visited-set bounded), explicit beats merged, booleans follow pnpm's js-yaml 1.1 loader (yes/no/on/off ARE booleans - do not "fix" to yaml.v3 tags). Emits 9PNPM_*rules (1 HIGHPNPM_DANGEROUS_BUILDS_001, 4 MEDIUM, 3 LOW, 1 INFO), all category supply-chain. - AgentPolicy (
internal/engine/agentpolicy/) - JSON parser for Claude Code.claude/settings.json/settings.local.json(exact target via.claude/path suffix). Flags host config dangerous to inherit from a cloned repo: hooks that fetch-and-execute, code-injection env vars (NODE_OPTIONS --require, LD_PRELOAD, BASH_ENV…),bypassPermissions,enableAllProjectMcpServers, broad/secret-read allow rules, repo-relative credential helpers. Per-key independent decode (one bad block doesn't blind the rest); absence never fires; fires on dangerous value SHAPE only. Emits 8AGENTCFG_*rules (1 CRITICAL, 2 HIGH, 4 MEDIUM, 1 LOW), categoryagent-trust. - SkillPolicy (
internal/engine/skillpolicy/) - Boundedyaml.Nodeparser for the realSKILL.mdfrontmatter only. Flags an exact whole-valueallowed-toolswildcard; body examples, scoped command wildcards, malformed metadata, and similarly named keys stay quiet. EmitsAGENT_SKILL_WILDCARD_TOOLS_001(MEDIUM), categoryagent-trust. - NLP Analyzer (
internal/engine/nlp/) - Goldmark AST walker for markdown; JSON/YAML string extractor for structured files. Keyword classification with proximity weighting. Detects prompt injection, authority claims, credential+exfil combos. - ToxicFlow (
internal/engine/toxicflow/) - Single-file source/sink co-occurrence + cross-file capability correlation (crossfile.go). Detects dangerous capability combinations within and across files in the same directory. Flat-dir filter (>50 files) prevents FPs on registries. - Rug-Pull (
internal/engine/rugpull/) - SHA256-based tool description change detection. CLI via--monitor, library viaWithStateDir().
All fourteen implement the Analyzer interface (internal/scanner/analyzer.go): Name() string + Analyze(ctx, *Target) ([]Finding, error). The first thirteen run on every scan; rug-pull only joins when the caller passes --monitor (CLI) or WithStateDir (library). aguara check (internal/incident/, internal/packagecheck/) is a separate command-line entry point, not part of the scan pipeline.
After per-file analysis, SkillChain (internal/engine/skillchain/) runs as a
CrossFileAccumulator. It binds mandatory execution instructions in
SKILL.md to the exact local helper path and emits
AGENT_FORCED_HELPER_RISK_001 only when that helper contains a strong hidden
behavior. It shares the cross-file group with ToxicFlow but does not implement
the per-file Analyzer interface.
Key Package Relationships
internal/types/- Lowest layer.Finding,Severity,ScanResult. No internal imports.Severityistype int, serializes as a number in JSON (0=INFO, 1=LOW, 2=MEDIUM, 3=HIGH, 4=CRITICAL), NOT a string.Finding.DecisionImpactand catalogRule.DecisionImpactare the trust-decision layer, not a replacement for severity. Unknown and custom rule IDs default toreview; only explicitly classified context rules may avoid restricting the default audit handoff. Findings remain visible and explicit--fail-ongates remain authoritative.internal/rules/- YAML to CompiledRule.builtin/embeds 13 YAML files viago:embed.internal/scanner/- Orchestrator. Discovers files, spawns workers, runs analyzers, applies inline ignore filtering, aggregates results. Importsmeta/for post-processing.internal/meta/- Dedup, scoring, correlation. Importstypes/only (NOTscanner/- this prevents import cycles).internal/output/- Formatters (terminal, JSON, SARIF, markdown) implementingFormatterinterface. Markdown header is## Aguara Security Scan, not# Aguara Scan Report.internal/config/-.aguara.ymlloader. Supportsdisable_ruleslist andrule_overridesmap.discover/- MCP client auto-discovery.Scan(),FormatTree(),FormatMarkdown(). Public package.cmd/aguara/commands/- Cobra CLI wiring. Version/Commit injected via ldflags. Uses global package-level flag vars that leak between tests - always callresetFlags()in tests.discovercommand supports--formatflag:terminal(default, tree),json,markdown/md.
Import Cycle Constraint
scanner -> meta -> types. The meta package must never import scanner.
Rules System
193 rules in internal/rules/builtin/*.yaml across 13 files. Each rule requires:
id,name,severity,category,patterns(type:regexorcontains)match_mode:any(OR, default) orall(AND)remediation: actionable fix guidance (all 193 rules have this)examples.true_positiveandexamples.false_positive- self-tested automatically bymake test- Optional:
targets(file globs),exclude_patterns(context-based suppression)
Rule Field Placement
The remediation: field goes after match_mode: (or category:/targets: if no match_mode) and before patterns:.
Go Regexp Constraint
Go's regexp does NOT support lookaheads ((?!...)) or lookbehinds. Use exclude_patterns or match_mode: all with multiple patterns instead. For JSON keys, account for optional quotes: ["']?key["']?. Max pattern length: 4096 chars (enforced at compile time).
Testing Notes
- Race detector (
-race) is mandatory - all tests run with it. - Integration tests in
internal/scanner/integration_test.goskip whentestdata/is absent. Testdata exists locally (1275 files, gitignored) with 10 malicious + 6 benign scenarios. - NLP classifier uses Go maps - tied scores produce nondeterministic winners. Don't write tests asserting a single winner on tied scores.
- Rule self-tests validate
true_positivematches andfalse_positivenon-matches respectingmatch_mode. - CLI tests (
cmd/aguara/commands/scan_test.go) usescanToFilehelper that writes output to temp file via-oflag, since CobraSetOut()doesn't capture output fromwriteOutputwhich writes toos.Stdout. - Always call
resetFlags()at the start of each CLI test to avoid global flag state leaking.
Release Process
- Create branch
release/vX.Y.Zfrom main - Update
CHANGELOG.md - Commit, push, create PR, merge
- Tag:
git tag vX.Y.Z && git push origin vX.Y.Z - GoReleaser auto-runs: builds binaries, updates Homebrew tap (
garagon/homebrew-tap), publishes Docker image toghcr.io/garagon/aguara - Clean up: delete release branch locally and remotely
Obsidian Vault Workflow (DOCS/Aguara/)
The DOCS/Aguara/ directory is an Obsidian vault. Claude Code must follow CONVENTIONS.md when creating or editing docs.
Working with the vault
- Start from the Dashboard: Read
DOCS/Aguara/00 Dashboard.mdto understand current state. - Follow CONVENTIONS.md: Every
.mdfile needs frontmatter (type, tags, status, dates). ReadDOCS/Aguara/CONVENTIONS.mdbefore creating files. - Use templates: Copy from
DOCS/Aguara/templates/when creating new channels or product versions. - Use wikilinks: Link between docs with
[[path/to/file]]syntax (Obsidian-style).
Automatic checklist and status tracking
When completing a distribution task (submitting a post, publishing a blog, opening a PR):
- Update the submission log in the channel's
_index.md- add a row with date, action, status, URL. - Update frontmatter status - change
status: readytostatus: published, addpublished_url:andposted: YYYY-MM-DD. - Update the Dashboard - mark the channel as done in the Distribution table (
00 Dashboard.md). - Update the version hub - if content was for a specific version, confirm links in
product/vX.Y.Z/_index.md.
When completing a product task (fixing a bug, adding a feature, releasing a version):
- Update Dashboard metrics - star count, rule count, test count, coverage.
- Update CLAUDE.md - if rule count, test count, or version changes.
- Create status file -
product/vX.Y.Z/status-YYYY-MM-DD.mdfor significant milestones.
Data consistency rule
When any of these values change, update ALL references across the vault:
- Rule count (currently 192 YAML / 258 cataloged)
- Test count (currently ~750)
- Coverage (currently 82% on the Codecov badge; badge scope excludes tools/ and benchmarks/)
- Star/fork count (currently 48/6)
- Watch skill count (currently 28,000+)
- Version number (currently v0.28.0)
Use Grep to find all occurrences before updating.
Content generation workflow
All external content (blog posts, social media, Reddit, newsletters) MUST go through this 4-stage pipeline:
- Literature Scout - Research what already exists on the topic. Check competitor tools, recent posts in the target community, trending discussions. Identify gaps and angles that haven't been covered.
- Cybersecurity Analyzer - Validate every technical claim against the actual codebase. Cross-reference rule IDs, analysis layers, detection capabilities. No exaggeration, no hand-waving.
- Research Cybersecurity - Ground the content in real threat models, CVEs, attack patterns, or published research. Link claims to concrete examples (e.g., specific prompt injection techniques, real supply chain attacks).
- Editor - Final pass for tone and quality. Must read like a human wrote it - natural, accessible, didactic. No AI patterns ("leverage", "utilize", "robust", "cutting-edge", "seamlessly", "game-changing", "in today's landscape"). No em-dashes. No filler. Direct, technical, conversational.
Content must pass ALL four stages before being marked status: ready.
Review checklist (before publishing any content)
- Data check: rule count, test count, star count, Watch skill count are current
- Technical accuracy: claims match actual implementation
- No AI patterns: no "leverage", "utilize", "robust", "cutting-edge", "game-changing"
- No em-dashes: use hyphens (-) not em-dashes
- Natural voice: reads like a person wrote it
- Links work: GitHub URLs, Watch URL, install commands are correct
Growth & Visibility
- Awesome list PRs: Create fork -> PR -> delete fork immediately after merge/close (keep garagon account clean). Currently 7 forks + 7 open PRs across external repos.
- punkpeye awesome-mcp repos use emoji format:
🏎️(Go),🏠(local),🍎🪟🐧(OS). - wong2/awesome-mcp-servers does NOT accept PRs - must use mcpservers.org/submit web form.
- GitHub topics: 15 keywords max useful for SEO.
- OpenAlternative.co / OpenSourceAlternative.to: Don't accept CLIs. Descartados.
- awesome-go: Eligible 2026-07-17 (repo created 2026-02-17; requires 5-month age). Codecov badge shipped via coverage workflow; entry draft in the vault's awesome-lists channel.
- Official MCP Registry: Only accepts npm/TypeScript packages. Not applicable for Go.
- Distribution channels with submission tracking:
DOCS/Aguara/distribution/. - Demo video: Remotion project at
/Users/dev/Dev/videos/aguara-demo/. Terminal segments recorded with VHS (charmbracelet/vhs), slides as React components, rendered withnpx remotion render AguaraDemo output.mp4.
Community Contributions
When reviewing external PRs:
- CI doesn't run on fork PRs (branch protection). Pull locally and run
make build && make test && make vet && make lintbefore merging. - Use
gh pr merge <N> --merge --admin --delete-branchto bypass branch protection for verified fork PRs. - After merging rule PRs, update rule count references in README.md, CONTRIBUTING.md, and CLAUDE.md.
- Good-first-issue PRs that close issues will auto-close the linked issues on merge.
Communication Rules
- Never include
Co-Authored-By: Claudein commits to this repository. - Never include "Generated with Claude Code" in PR descriptions.
- Never use em dashes (-) in LinkedIn posts or external communications. Use hyphens (-) instead.
- All commits and PRs are authored entirely under garagon's name.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

