Skip to content

Commit 88494b1

Browse files
hyperpolymathclaude
andcommitted
feat: panicbot integration, attestation, assemblyline, SARIF, i18n, notify pipeline
Major additions from sessions 8-9: - Panicbot integration: JSON contract (PA001-PA020), bot directives, diagnostics check - Assemblyline batch scanning: rayon parallelism (17.7x speedup), BLAKE3 fingerprinting - SARIF output format for GitHub Security tab - Notification pipeline: markdown summaries, critical-only filtering, GitHub issues - Cryptographic attestation chain: intent → evidence → seal (optional Ed25519) - i18n support: ISO 639-1, 10 languages, compile-time safe catalog - Machine-verifiable readiness tests: 18 CRG grade tests (D/C/B) + justfile recipes - Manifest-first framework detection: eliminates self-referential false positives - Full documentation update: ROADMAP, TOPOLOGY, CHANGELOG, CONTRIBUTING, META.scm, ECOSYSTEM.scm, STATE.scm, AI.a2ml, CLAUDE.md, README.md, DESIGN.md, VISION.md - Zero compiler warnings, 269 tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eb3528b commit 88494b1

48 files changed

Lines changed: 6584 additions & 1581 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/CLAUDE.md

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Static analysis and bug signature detection tool. Scans source code for weak poi
1919

2020
```
2121
src/
22-
├── main.rs # CLI entry point (clap)
22+
├── main.rs # CLI entry point (clap) — 20 subcommands
2323
├── lib.rs # Library API
2424
├── types.rs # Core types (AssailReport, WeakPoint, etc.)
2525
├── assail/ # Static analysis engine
@@ -38,10 +38,29 @@ src/
3838
├── signatures/ # Logic-based bug signature detection
3939
│ ├── engine.rs # SignatureEngine (use-after-free, deadlock, etc.)
4040
│ └── rules.rs # Detection rules
41-
└── report/
42-
├── mod.rs # Report generation API
43-
├── generator.rs # AssaultReport builder
44-
└── formatter.rs # Output formatting (text + JSON)
41+
├── report/ # Report generation and output
42+
│ ├── mod.rs # Report generation API
43+
│ ├── generator.rs # AssaultReport builder
44+
│ └── formatter.rs # Output formatting (text + JSON)
45+
├── assemblyline.rs # Batch scanning with rayon parallelism + BLAKE3
46+
├── notify.rs # Designer notification pipeline (markdown + GitHub issues)
47+
├── attestation/ # Cryptographic attestation chain
48+
│ ├── mod.rs # Three-phase chain: intent → evidence → seal
49+
│ ├── intent.rs # Pre-execution commitment
50+
│ ├── evidence.rs # Rolling hash accumulator
51+
│ ├── seal.rs # Post-execution binding
52+
│ ├── chain.rs # Chain builder orchestration
53+
│ └── envelope.rs # A2ML envelope wrapper
54+
├── ambush/ # Ambient stressors + DAW-style timeline
55+
├── amuck/ # Mutation combinations
56+
├── abduct/ # Isolation + time-skew
57+
├── adjudicate/ # Campaign verdict aggregation
58+
├── axial/ # Reaction observation
59+
├── a2ml/ # AI manifest protocol
60+
├── panll/ # PanLL event-chain export
61+
├── storage/ # Filesystem + VerisimDB persistence
62+
├── i18n/ # Multi-language support (ISO 639-1, 10 languages)
63+
└── diagnostics.rs # Self-check for Hypatia/gitbot-fleet
4564
```
4665

4766
## Build & Test
@@ -79,23 +98,37 @@ The kanren module provides:
7998

8099
## Planned Features (Next Priorities)
81100

82-
1. **`sweep` subcommand**: Scan entire directory of git repos in one go
83-
2. **verisimdb integration**: Push results as hexads to verisimdb API
84-
3. **hypatia pipeline**: Feed results through rule engine for pattern detection
85-
4. **SARIF output**: GitHub Security tab integration
86-
5. **RSR compliance**: Standard workflows, docs, shell completions
101+
1. **verisimdb API integration**: Push scan results as hexads directly
102+
2. **Incremental assemblyline**: BLAKE3 delta scanning (skip unchanged repos)
103+
3. **kanren context-facts**: ~10 rules for FP suppression (~8% -> ~2-3%)
104+
4. **hypatia pipeline**: Export kanren facts as Logtalk predicates via PanLL
105+
5. **Shell completions**: bash, zsh, fish, nushell
87106

88107
## Integration Points
89108

90-
- **verisimdb**: Store scan results as hexads (document + semantic modalities)
91-
- **hypatia**: Neurosymbolic rule engine processes findings
92-
- **echidnabot**: Proof verification of scan claims
93-
- **sustainabot**: Ecological/economic code health metrics
109+
- **panicbot**: gitbot-fleet verifier bot — invokes `panic-attack assail --output-format json`, translates WeakPoints to Findings (PA001-PA020). Directives at `.machine_readable/bot_directives/panicbot.scm`
110+
- **verisimdb**: Store scan results as hexads (document + semantic modalities). File I/O works, API planned
111+
- **hypatia**: Neurosymbolic rule engine processes findings. Env var watcher in diagnostics
112+
- **panll**: Event-chain export for three-pane visualisation. Working via `panll` subcommand
113+
- **assemblyline**: Batch scanning of repo directories. Rayon parallelism, BLAKE3 fingerprinting
114+
- **notify**: Notification pipeline. Assemblyline -> markdown summaries -> GitHub issues
115+
- **attestation**: Cryptographic chain (intent/evidence/seal). Optional Ed25519 signing
116+
- **echidnabot**: Proof verification of scan claims (planned)
94117
- **hardware-crash-team**: Sibling tool (hardware diagnostics vs software analysis)
95118

119+
## Readiness Tests (CRG)
120+
121+
Machine-verifiable Component Readiness Grade tests in `tests/readiness.rs`:
122+
- **Grade D (Alpha)**: Component runs without crashing on valid input
123+
- **Grade C (Beta)**: Component produces correct output on representative input
124+
- **Grade B (RC)**: Component handles edge cases and multiple input types
125+
126+
Run with `just readiness` or `just readiness-summary`.
127+
96128
## Code Style
97129

98130
- SPDX headers on all files: `PMPL-1.0-or-later`
99-
- Author: Jonathan D.A. Jewell <jonathan.jewell@open.ac.uk>
131+
- Author: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
100132
- Use anyhow::Result for error handling
101133
- Serde derive on public types for JSON serialization
134+
- Zero compiler warnings policy (release + test builds)

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
/target
2+
/reports/
3+
/verisimdb-data/
4+
/runtime/
5+
/panll-event-chain.json

.machine_readable/ECOSYSTEM.scm

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,21 @@
4949
(relationship "consumer")
5050
(integration "bots can trigger panic-attack scans via repository_dispatch")
5151
(url "https://github.com/hyperpolymath/gitbot-fleet")
52-
(description "Repository automation bots (rhodibot, echidnabot, etc.)"))
52+
(description "Repository automation bots (rhodibot, echidnabot, panicbot, etc.)"))
53+
54+
(project
55+
(name "panicbot")
56+
(relationship "direct-consumer")
57+
(integration "invokes `panic-attack assail --output-format json`, translates WeakPoints to fleet Findings via PA001–PA020 rule mapping")
58+
(url "https://github.com/hyperpolymath/gitbot-fleet")
59+
(description "Tier-4 verifier bot in gitbot-fleet — static analysis auditing via panic-attack")
60+
(interface
61+
(protocol "subprocess")
62+
(command "panic-attack assail <target> --output-format json")
63+
(output-format "AssailReport JSON (flat or assault envelope)")
64+
(category-mapping "WeakPointCategory → PA001–PA020 rule IDs")
65+
(severity-mapping "PascalCase → lowercase → fleet severity levels")
66+
(directives ".machine_readable/bot_directives/panicbot.scm")))
5367

5468
(project
5569
(name "ambientops")
@@ -102,61 +116,43 @@
102116

103117
(dependencies
104118
(runtime
105-
(dependency
106-
(name "encoding_rs")
107-
(version "0.8")
108-
(purpose "Latin-1 fallback for non-UTF-8 files"))
109-
(dependency
110-
(name "clap")
111-
(version "4.5")
112-
(purpose "CLI argument parsing"))
113-
(dependency
114-
(name "colored")
115-
(version "2.1")
116-
(purpose "Terminal output formatting"))
117-
(dependency
118-
(name "regex")
119-
(version "1.10")
120-
(purpose "Pattern matching in source code"))
121-
(dependency
122-
(name "serde")
123-
(version "1.0")
124-
(purpose "JSON serialization"))
125-
(dependency
126-
(name "anyhow")
127-
(version "1.0")
128-
(purpose "Error handling"))
129-
(dependency
130-
(name "chrono")
131-
(version "0.4")
132-
(purpose "Timestamp generation")))
119+
(dependency (name "clap") (version "4.5") (purpose "CLI argument parsing"))
120+
(dependency (name "serde") (version "1.0") (purpose "JSON/YAML serialization"))
121+
(dependency (name "serde_json") (version "1.0") (purpose "JSON output"))
122+
(dependency (name "serde_yaml") (version "0.9") (purpose "YAML output"))
123+
(dependency (name "anyhow") (version "1.0") (purpose "Error handling"))
124+
(dependency (name "regex") (version "1.10") (purpose "Pattern matching in source code"))
125+
(dependency (name "colored") (version "2.1") (purpose "Terminal output formatting"))
126+
(dependency (name "chrono") (version "0.4") (purpose "Timestamp generation"))
127+
(dependency (name "encoding_rs") (version "0.8") (purpose "Latin-1 fallback for non-UTF-8 files"))
128+
(dependency (name "rayon") (version "1.10") (purpose "Parallel batch scanning"))
129+
(dependency (name "blake3") (version "1.5") (purpose "Source fingerprinting for incremental scans"))
130+
(dependency (name "sha2") (version "0.10") (purpose "Attestation hashing"))
131+
(dependency (name "hex") (version "0.4") (purpose "Hex encoding for attestation"))
132+
(dependency (name "getrandom") (version "0.2") (purpose "Attestation nonce generation"))
133+
(dependency (name "crossterm") (version "0.26") (purpose "TUI terminal control"))
134+
(dependency (name "eframe") (version "0.27") (purpose "GUI viewer"))
135+
(dependency (name "filetime") (version "0.2") (purpose "Abduct timestamp manipulation"))
136+
(dependency (name "ed25519-dalek") (version "2.1") (purpose "Optional Ed25519 signing for attestation")))
133137

134138
(development
135-
(dependency
136-
(name "tempfile")
137-
(version "3.8")
138-
(purpose "Temporary files in tests"))))
139+
(dependency (name "tempfile") (version "3.8") (purpose "Temporary files in tests"))))
139140

140141
(future-integrations
141-
(integration
142-
(name "sweep subcommand")
143-
(status "planned-v2.1")
144-
(description "Bulk scanning of directory-of-repos with aggregated results"))
145-
146142
(integration
147143
(name "verisimdb API push")
148144
(status "planned-v2.1")
149145
(description "Push scan results as hexads directly to verisimdb API"))
150146

151147
(integration
152148
(name "hypatia pipeline")
153-
(status "planned-v2.1")
154-
(description "Feed kanren facts as Logtalk predicates to hypatia rule engine"))
149+
(status "planned-v2.2")
150+
(description "Feed kanren facts as Logtalk predicates to hypatia rule engine via PanLL"))
155151

156152
(integration
157-
(name "SARIF output")
153+
(name "kanren context-facts")
158154
(status "planned-v2.2")
159-
(description "SARIF output for GitHub Security tab and CodeQL integration"))
155+
(description "~10 context rules for false positive suppression (8% -> 2-3%)"))
160156

161157
(integration
162158
(name "crates.io")
@@ -182,7 +178,7 @@
182178

183179
(metadata
184180
(created "2026-02-07")
185-
(updated "2026-02-09")
186-
(maintainer "Jonathan D.A. Jewell <jonathan.jewell@open.ac.uk>")
181+
(updated "2026-03-01")
182+
(maintainer "Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>")
187183
(license "PMPL-1.0-or-later")
188184
(repository "https://github.com/hyperpolymath/panic-attacker")))

.machine_readable/META.scm

Lines changed: 113 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,96 @@
136136
"Covers all languages in hyperpolymath ecosystem"
137137
"20 weak point categories (up from ~5)"
138138
"Per-file language detection with family-specific patterns"
139-
"Cross-language analysis possible via kanren engine")))
139+
"Cross-language analysis possible via kanren engine"))
140+
141+
(adr
142+
(id "ADR-011")
143+
(date "2026-03-01")
144+
(status "accepted")
145+
(title "Assemblyline batch scanning with rayon parallelism and BLAKE3 fingerprinting")
146+
(context "Need to scan 100+ repos efficiently; sequential scanning too slow")
147+
(decision "Use rayon for parallel repo scanning, BLAKE3 for source fingerprinting to enable incremental rescans")
148+
(consequences
149+
"17.7x speedup (141 repos in 39.9s vs ~705s sequential)"
150+
"BLAKE3 fingerprint infrastructure for future delta scanning"
151+
"Sorted output: riskiest repos first"
152+
"JSON aggregate report with per-repo breakdowns"))
153+
154+
(adr
155+
(id "ADR-012")
156+
(date "2026-03-01")
157+
(status "accepted")
158+
(title "SARIF output format for standardised security reporting")
159+
(context "GitHub Security tab requires SARIF for code scanning integration")
160+
(decision "Implement SARIF 2.1.0 output via --output-format sarif")
161+
(consequences
162+
"GitHub Security tab integration via codeql-action/upload-sarif"
163+
"Standard format consumed by multiple security tools"
164+
"Rules deduplicated by WeakPointCategory"))
165+
166+
(adr
167+
(id "ADR-013")
168+
(date "2026-03-01")
169+
(status "accepted")
170+
(title "Cryptographic attestation chain (intent/evidence/seal)")
171+
(context "Need to prove scans are genuine and untampered for trust chain")
172+
(decision "Three-phase model: intent (pre-commit), evidence (rolling hash), seal (post-bind)")
173+
(consequences
174+
"Scans are cryptographically bound to inputs and outputs"
175+
"Optional Ed25519 signing via --features signing"
176+
"A2ML envelope wraps attestation for transport"
177+
"Diagnostics checks signing health"))
178+
179+
(adr
180+
(id "ADR-014")
181+
(date "2026-03-01")
182+
(status "accepted")
183+
(title "i18n support using ISO 639-1 (10-language catalog)")
184+
(context "Potential for non-English-speaking users; internationalisation should be built in early")
185+
(decision "Compile-time safe catalog with t() and t_or_key() lookups, 10 languages")
186+
(consequences
187+
"All user-facing strings translatable"
188+
"Doc-tested examples ensure catalog stays valid"
189+
"ISO 639-1 validation for language codes"))
190+
191+
(adr
192+
(id "ADR-015")
193+
(date "2026-03-01")
194+
(status "accepted")
195+
(title "Notification pipeline (markdown-first, critical-only filtering)")
196+
(context "Assemblyline produces aggregate reports; need human-readable summaries and actionable alerts")
197+
(decision "notify subcommand generates markdown with severity breakdown, optional critical-only filter, optional GitHub issue creation")
198+
(consequences
199+
"Markdown output works in GitHub, email, Slack, etc."
200+
"--critical-only reduces noise to actionable items only"
201+
"GitHub issue creation automates remediation workflow"))
202+
203+
(adr
204+
(id "ADR-016")
205+
(date "2026-03-01")
206+
(status "accepted")
207+
(title "Manifest-first framework detection (fixes false positives)")
208+
(context "Source-level substring matching caused self-referential false positives (analyzer detecting its own patterns)")
209+
(decision "Primary detection from dependency manifests (Cargo.toml, mix.exs, package.json, etc.); Rust excluded from source scanning entirely")
210+
(consequences
211+
"Eliminates self-referential false positives"
212+
"Cargo.toml detection is authoritative for Rust"
213+
"Source scanning kept for BEAM, Go, Ruby, Python, JS only"
214+
"~8% overall FP rate (down from higher)"))
215+
216+
(adr
217+
(id "ADR-017")
218+
(date "2026-03-01")
219+
(status "accepted")
220+
(title "Machine-verifiable readiness tests (CRG grades D/C/B)")
221+
(context "Need automated evidence for Component Readiness Grading")
222+
(decision "tests/readiness.rs with grade-prefixed test names; justfile recipes for summary output")
223+
(consequences
224+
"CRG grades derivable from test results"
225+
"D (Alpha): component runs without crashing"
226+
"C (Beta): correct output on representative input"
227+
"B (RC): edge cases and multi-language support"
228+
"18 tests across 3 grades, automated via just readiness-summary")))
140229

141230
(development-practices
142231
(practice
@@ -150,7 +239,7 @@
150239
(description "All features must have tests")
151240
(rationale "Untested code is untrusted code")
152241
(target "80% code coverage")
153-
(current "30 tests: 16 unit + 11 analyzer + 3 integration"))
242+
(current "269 tests: unit, integration, analyzer, readiness (CRG D/C/B), SARIF, PanLL, report, assemblyline, pattern"))
154243

155244
(practice
156245
(name "RSR compliance")
@@ -168,7 +257,7 @@
168257
(rationale "Predictable releases, clear breaking changes")
169258
(policy
170259
"1.x = stable foundation, naming finalised"
171-
"2.x = major feature expansion (logic engine, 47 langs)"
260+
"2.x = major feature expansion (logic engine, 47 langs, batch scanning, attestation)"
172261
"3.0 = public release (crates.io)"))
173262

174263
(practice
@@ -184,7 +273,7 @@
184273
(name "Eat your own dogfood")
185274
(description "Run panic-attack on panic-attack itself")
186275
(rationale "Find bugs, validate thresholds, prove usefulness")
187-
(status "active: self-scan shows 3 weak points")))
276+
(status "active: self-scan shows 30 findings, ~8% false positive rate")))
188277

189278
(design-rationale
190279
(rationale
@@ -214,10 +303,22 @@
214303
(current "47 languages: BEAM, ML, Lisp, Functional, Proof, Logic, Systems, Config, Scripting, NextGen DSLs")
215304
(benefit "Cross-language vulnerability detection via kanren engine"))
216305

306+
(rationale
307+
(aspect "Manifest-first framework detection")
308+
(reasoning "Source-level substring matching causes self-referential false positives when the analyzer scans its own code")
309+
(decision "Use dependency manifests (Cargo.toml, mix.exs, etc.) as primary signal; exclude Rust from source scanning")
310+
(benefit "Eliminates FPs from string literals containing detection patterns"))
311+
312+
(rationale
313+
(aspect "Cryptographic attestation")
314+
(reasoning "Prove scans are genuine and untampered for CI/CD trust chains")
315+
(components "intent.rs (pre-commit), evidence.rs (rolling hash), seal.rs (post-bind), chain.rs (orchestration), envelope.rs (A2ML wrapper)")
316+
(benefit "Scans can be verified by echidnabot or other proof verifiers"))
317+
217318
(rationale
218319
(aspect "CLI + library")
219320
(reasoning "Useful standalone and as integration component")
220-
(benefit "src/lib.rs enables testing, hypatia integration, verisimdb pipeline")))
321+
(benefit "src/lib.rs enables testing, hypatia integration, verisimdb pipeline, panicbot subprocess invocation")))
221322

222323
(cross-cutting-concerns
223324
(concern
@@ -227,13 +328,13 @@
227328

228329
(concern
229330
(name "Performance")
230-
(approach "Reasonable defaults, search strategy optimisation via kanren")
231-
(current "Single-threaded file analysis with risk-weighted prioritisation")
232-
(future "rayon for parallel assail analysis"))
331+
(approach "Rayon parallelism for batch scanning, search strategy optimisation via kanren")
332+
(current "Parallel assemblyline scanning (17.7x speedup); single-threaded per-file analysis with risk-weighted prioritisation")
333+
(future "Incremental analysis via BLAKE3 delta fingerprinting"))
233334

234335
(concern
235336
(name "Security")
236-
(approach "cargo-audit in CI, SBOM generation, self-testing")
337+
(approach "cargo-audit in CI, SBOM generation, self-testing, attestation chain")
237338
(policy "No unsafe code in panic-attack itself except when required for FFI"))
238339

239340
(concern
@@ -246,10 +347,10 @@
246347
(name "Extensibility")
247348
(approach "Pattern library, kanren rule system, pluggable analyzers")
248349
(current "miniKanren rules for taint, cross-language, and strategy")
249-
(future "User-definable rules, plugin system")))
350+
(future "User-definable rules, plugin system, context-fact FP suppression")))
250351

251352
(metadata
252353
(created "2026-02-07")
253-
(updated "2026-02-08")
254-
(maintainer "Jonathan D.A. Jewell <jonathan.jewell@open.ac.uk>")
354+
(updated "2026-03-01")
355+
(maintainer "Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>")
255356
(license "PMPL-1.0-or-later")))

0 commit comments

Comments
 (0)