torusguard 1.3.5 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/.torusguard/.manifest.json +37 -36
  2. package/.torusguard/runs/report-latest.html +5862 -315
  3. package/.torusguard/runs/results-latest.sarif +20 -0
  4. package/.torusguard/runs/run-20260918-104221-audit/findings.json +1 -0
  5. package/.torusguard/runs/run-20260918-104221-audit/findings.md +8 -0
  6. package/.torusguard/runs/run-20260918-104221-audit/manifest.json +12 -0
  7. package/.torusguard/runs/run-20260918-104221-audit/summary.md +5 -0
  8. package/.torusguard/runs/run-20260918-104236-audit/findings.json +2314 -0
  9. package/.torusguard/runs/run-20260918-104236-audit/findings.md +960 -0
  10. package/.torusguard/runs/run-20260918-104236-audit/manifest.json +12 -0
  11. package/.torusguard/runs/run-20260918-104236-audit/summary.md +5 -0
  12. package/.torusguard/runs/run-20260918-105723-audit/findings.json +2382 -0
  13. package/.torusguard/runs/run-20260918-105723-audit/findings.md +960 -0
  14. package/.torusguard/runs/run-20260918-105723-audit/manifest.json +12 -0
  15. package/.torusguard/runs/run-20260918-105723-audit/summary.md +5 -0
  16. package/.torusguard/runs/run-20260918-105731-audit/findings.json +1 -0
  17. package/.torusguard/runs/run-20260918-105731-audit/findings.md +8 -0
  18. package/.torusguard/runs/run-20260918-105731-audit/manifest.json +12 -0
  19. package/.torusguard/runs/run-20260918-105731-audit/summary.md +5 -0
  20. package/.torusguard/runs/run-20260918-105940-audit/findings.json +1 -0
  21. package/.torusguard/runs/run-20260918-105940-audit/findings.md +8 -0
  22. package/.torusguard/runs/run-20260918-105940-audit/manifest.json +13 -0
  23. package/.torusguard/runs/run-20260918-105940-audit/remediation.md +7 -0
  24. package/.torusguard/runs/run-20260918-105940-audit/summary.md +5 -0
  25. package/.torusguard/runs/run-20260919-145701-audit/findings.json +1 -0
  26. package/.torusguard/runs/run-20260919-145701-audit/findings.md +8 -0
  27. package/.torusguard/runs/run-20260919-145701-audit/manifest.json +12 -0
  28. package/.torusguard/runs/run-20260919-145701-audit/summary.md +5 -0
  29. package/.torusguard/runs/run-20260919-151729-audit/findings.json +1 -0
  30. package/.torusguard/runs/run-20260919-151729-audit/findings.md +8 -0
  31. package/.torusguard/runs/run-20260919-151729-audit/manifest.json +13 -0
  32. package/.torusguard/runs/run-20260919-151729-audit/remediation.md +7 -0
  33. package/.torusguard/runs/run-20260919-151729-audit/summary.md +5 -0
  34. package/.torusguard/runs/run-20260919-152340-audit/findings.json +1 -0
  35. package/.torusguard/runs/run-20260919-152340-audit/findings.md +8 -0
  36. package/.torusguard/runs/run-20260919-152340-audit/manifest.json +12 -0
  37. package/.torusguard/runs/run-20260919-152340-audit/summary.md +5 -0
  38. package/.torusguard/runs/run-20260919-152345-audit/findings.json +1 -0
  39. package/.torusguard/runs/run-20260919-152345-audit/findings.md +8 -0
  40. package/.torusguard/runs/run-20260919-152345-audit/manifest.json +12 -0
  41. package/.torusguard/runs/run-20260919-152345-audit/summary.md +5 -0
  42. package/.torusguard/runs/run-20260919-153500-audit/findings.json +1 -0
  43. package/.torusguard/runs/run-20260919-153500-audit/findings.md +8 -0
  44. package/.torusguard/runs/run-20260919-153500-audit/manifest.json +12 -0
  45. package/.torusguard/runs/run-20260919-153500-audit/summary.md +5 -0
  46. package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  47. package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  48. package/.torusguard/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  49. package/.torusguard/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  50. package/.torusguard/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  51. package/.torusguard/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  52. package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  53. package/.torusguard/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  54. package/.torusguard/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  55. package/.torusguard/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  56. package/.torusguard/scripts/__pycache__/recipes_runner.cpython-314.pyc +0 -0
  57. package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  58. package/.torusguard/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  59. package/.torusguard/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  60. package/.torusguard/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  61. package/.torusguard/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  62. package/.torusguard/scripts/apply_runner.py +108 -9
  63. package/.torusguard/scripts/audit_runner.py +336 -24
  64. package/.torusguard/scripts/harden_runner.py +124 -70
  65. package/.torusguard/scripts/html_reporter.py +3585 -648
  66. package/.torusguard/scripts/manifest_builder.py +2 -0
  67. package/.torusguard/scripts/recheck_runner.py +5 -4
  68. package/.torusguard/scripts/recipes_runner.py +91 -8
  69. package/.torusguard/scripts/report_sync.py +496 -73
  70. package/.torusguard/scripts/sarif_exporter.py +48 -8
  71. package/.torusguard/scripts/stack_detect.py +44 -2
  72. package/.torusguard/scripts/status_runner.py +267 -0
  73. package/.torusguard/scripts/term_ui.py +1 -1
  74. package/.torusguard/skills/torusguard/SKILL.md +75 -72
  75. package/.torusguard/skills/torusguard-apply/SKILL.md +84 -80
  76. package/.torusguard/skills/torusguard-audit/SKILL.md +87 -83
  77. package/.torusguard/skills/torusguard-authorize/SKILL.md +7 -2
  78. package/.torusguard/skills/torusguard-exploit-check/SKILL.md +7 -2
  79. package/.torusguard/skills/torusguard-full/SKILL.md +7 -2
  80. package/.torusguard/skills/torusguard-harden/SKILL.md +98 -94
  81. package/.torusguard/skills/torusguard-init/SKILL.md +68 -64
  82. package/.torusguard/skills/torusguard-recheck/SKILL.md +81 -77
  83. package/.torusguard/skills/torusguard-report/SKILL.md +93 -72
  84. package/.torusguard/skills/torusguard-status/SKILL.md +62 -58
  85. package/.torusguard/skills/torusguard-verify/SKILL.md +7 -2
  86. package/.torusguard/skills/torusguard-web-validate/SKILL.md +7 -2
  87. package/.torusguard/workflows/apply.md +1 -1
  88. package/.torusguard/workflows/audit.md +1 -1
  89. package/.torusguard/workflows/authorize.md +1 -1
  90. package/.torusguard/workflows/exploit-check.md +1 -1
  91. package/.torusguard/workflows/harden.md +1 -1
  92. package/.torusguard/workflows/init.md +1 -1
  93. package/.torusguard/workflows/memory.md +1 -1
  94. package/.torusguard/workflows/recheck.md +1 -1
  95. package/.torusguard/workflows/report.md +1 -1
  96. package/.torusguard/workflows/status.md +1 -1
  97. package/.torusguard/workflows/verify.md +1 -1
  98. package/.torusguard/workflows/web-validate.md +1 -1
  99. package/README.md +115 -81
  100. package/bin/torusguard.js +244 -38
  101. package/package.json +6 -2
  102. package/skills/torusguard/SKILL.md +1 -1
  103. package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
  104. package/skills/torusguard/bootstrap.py +52 -8
  105. package/skills/torusguard/payload/.manifest.json +51 -36
  106. package/skills/torusguard/payload/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  107. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-311.pyc +0 -0
  108. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  109. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
  110. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  111. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-311.pyc +0 -0
  112. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  113. package/skills/torusguard/payload/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  114. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-311.pyc +0 -0
  115. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  116. package/skills/torusguard/payload/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  117. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-311.pyc +0 -0
  118. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  119. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-311.pyc +0 -0
  120. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  121. package/skills/torusguard/payload/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  122. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-311.pyc +0 -0
  123. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  124. package/skills/torusguard/payload/scripts/__pycache__/rules_sync.cpython-311.pyc +0 -0
  125. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-311.pyc +0 -0
  126. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  127. package/skills/torusguard/payload/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  128. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-311.pyc +0 -0
  129. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  130. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-311.pyc +0 -0
  131. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  132. package/skills/torusguard/payload/scripts/apply_runner.py +108 -9
  133. package/skills/torusguard/payload/scripts/audit_runner.py +336 -24
  134. package/skills/torusguard/payload/scripts/harden_runner.py +124 -70
  135. package/skills/torusguard/payload/scripts/html_reporter.py +3585 -648
  136. package/skills/torusguard/payload/scripts/manifest_builder.py +2 -0
  137. package/skills/torusguard/payload/scripts/recheck_runner.py +5 -4
  138. package/skills/torusguard/payload/scripts/recipes_runner.py +91 -8
  139. package/skills/torusguard/payload/scripts/report_sync.py +496 -73
  140. package/skills/torusguard/payload/scripts/sarif_exporter.py +48 -8
  141. package/skills/torusguard/payload/scripts/stack_detect.py +44 -2
  142. package/skills/torusguard/payload/scripts/status_runner.py +267 -0
  143. package/skills/torusguard/payload/scripts/term_ui.py +1 -1
  144. package/skills/torusguard/payload/skills/torusguard/SKILL.md +1 -1
  145. package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +1 -1
  146. package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +1 -1
  147. package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +1 -1
  148. package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +1 -1
  149. package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +1 -1
  150. package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +1 -1
  151. package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +1 -1
  152. package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +1 -1
  153. package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +40 -23
  154. package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +1 -1
  155. package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +1 -1
  156. package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +1 -1
  157. package/skills/torusguard/payload/workflows/apply.md +9 -1
  158. package/skills/torusguard/payload/workflows/audit.md +8 -2
  159. package/skills/torusguard/payload/workflows/authorize.md +1 -1
  160. package/skills/torusguard/payload/workflows/exploit-check.md +1 -1
  161. package/skills/torusguard/payload/workflows/harden.md +6 -1
  162. package/skills/torusguard/payload/workflows/init.md +7 -1
  163. package/skills/torusguard/payload/workflows/memory.md +1 -1
  164. package/skills/torusguard/payload/workflows/recheck.md +1 -1
  165. package/skills/torusguard/payload/workflows/recipes.md +55 -0
  166. package/skills/torusguard/payload/workflows/report.md +59 -55
  167. package/skills/torusguard/payload/workflows/status.md +4 -1
  168. package/skills/torusguard/payload/workflows/torusguard-apply.md +110 -0
  169. package/skills/torusguard/payload/workflows/torusguard-audit.md +105 -0
  170. package/skills/torusguard/payload/workflows/torusguard-authorize.md +96 -0
  171. package/skills/torusguard/payload/workflows/torusguard-exploit-check.md +98 -0
  172. package/skills/torusguard/payload/workflows/torusguard-harden.md +104 -0
  173. package/skills/torusguard/payload/workflows/torusguard-init.md +106 -0
  174. package/skills/torusguard/payload/workflows/torusguard-recheck.md +101 -0
  175. package/skills/torusguard/payload/workflows/torusguard-recipes.md +55 -0
  176. package/skills/torusguard/payload/workflows/torusguard-report.md +105 -0
  177. package/skills/torusguard/payload/workflows/torusguard-status.md +103 -0
  178. package/skills/torusguard/payload/workflows/torusguard-verify.md +100 -0
  179. package/skills/torusguard/payload/workflows/torusguard-web-validate.md +96 -0
  180. package/skills/torusguard/payload/workflows/torusguard.md +19 -0
  181. package/skills/torusguard/payload/workflows/verify.md +1 -1
  182. package/skills/torusguard/payload/workflows/web-validate.md +1 -1
  183. package/skills/torusguard-apply/SKILL.md +1 -1
  184. package/skills/torusguard-audit/SKILL.md +1 -1
  185. package/skills/torusguard-authorize/SKILL.md +1 -1
  186. package/skills/torusguard-exploit-check/SKILL.md +1 -1
  187. package/skills/torusguard-full/SKILL.md +1 -1
  188. package/skills/torusguard-harden/SKILL.md +1 -1
  189. package/skills/torusguard-init/SKILL.md +1 -1
  190. package/skills/torusguard-recheck/SKILL.md +1 -1
  191. package/skills/torusguard-report/SKILL.md +40 -23
  192. package/skills/torusguard-status/SKILL.md +1 -1
  193. package/skills/torusguard-verify/SKILL.md +1 -1
  194. package/skills/torusguard-web-validate/SKILL.md +1 -1
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-verify
3
3
  description: Verify finding evidence sufficiency, audit live code line matches, and calibrate 0–100 confidence scores.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/verify.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-web-validate
3
3
  description: Execute authorized HTTP probing against local/staging web applications — session capture, transparent audit headers, and secret redaction.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/web-validate.md
6
6
  tools: Read, Grep, Glob, Bash, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Governed patch application with pre-apply rollback snapshots and Human Gate authorization.
3
3
  tools: Read, Grep, Glob, Bash, Edit, Write
4
- version: 1.3.5
4
+ version: 1.4.0
5
5
  agent: remediator
6
6
  lifecycle-phase: Phase 5 (Patch Application)
7
7
  required-skills:
@@ -22,6 +22,14 @@ $ARGUMENTS
22
22
  ## Objective
23
23
  Governed patch application with pre-apply rollback snapshots and Human Gate authorization.
24
24
 
25
+ Supported CLI flags:
26
+ - `npx torusguard apply [--target <dir>]` : Apply candidate patches with confirmation prompt
27
+ - `npx torusguard apply --diff` : Preview unified diffs without modifying files on disk
28
+ - `npx torusguard apply --selective` : Interactively review and approve patches one by one
29
+ - `npx torusguard apply --verify` : Trigger immediate differential AST recheck post-apply
30
+ - `npx torusguard apply --list-snapshots` : List available historical pre-apply backup snapshots
31
+ - `npx torusguard apply --yes` / `-y` : Non-interactive auto-approval mode
32
+
25
33
  ---
26
34
 
27
35
  ## Mandatory Pre-Flight Context Inspection
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Static security AST scanning, stable line-shift invariant fingerprinting, root-cause clustering, and 0-100 confidence scoring.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.4.0
5
5
  agent: auditor
6
6
  lifecycle-phase: Phase 2 (Static Audit & Clustering)
7
7
  required-skills:
@@ -20,7 +20,13 @@ $ARGUMENTS
20
20
  ---
21
21
 
22
22
  ## Objective
23
- Static security AST scanning, stable fingerprinting, root-cause clustering, and 0-100 scoring.
23
+ Static security AST scanning, stable fingerprinting, root-cause clustering, throughput telemetry, and 0-100 scoring.
24
+
25
+ Supported CLI flags:
26
+ - `npx torusguard audit [--target <dir>]` : Specify project root directory
27
+ - `npx torusguard audit --watch` / `-w` : Continuous watch mode, re-scanning on file change
28
+ - `npx torusguard audit --sarif` : Automatically export OASIS SARIF v2.1.0 log
29
+ - `npx torusguard audit --severity <critical|high|medium|low>` : Floor filter for findings
24
30
 
25
31
  ---
26
32
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Legal scope definition, target ownership proof verification, and safety boundary enforcement for runtime validation.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: Phase 1 (Authorization Gate)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Safe, bounded, single-step exploitability confirmation across 5 standard verification statuses.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: validator
6
6
  lifecycle-phase: Phase 3c (Exploitability Check)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Governed remediation formulation under strict Ponytail Protocol bounds (<= 35 additions, <= 25 deletions) and bundle packaging.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.4.0
5
5
  agent: remediator
6
6
  lifecycle-phase: Phase 4 (Remediation Formulation)
7
7
  required-skills:
@@ -22,6 +22,11 @@ $ARGUMENTS
22
22
  ## Objective
23
23
  Governed remediation formulation under strict Ponytail Protocol bounds (<=35 add, <=25 del).
24
24
 
25
+ Supported CLI flags:
26
+ - `npx torusguard harden [--target <dir>]` : Specify project root directory
27
+ - `npx torusguard harden --dry-run` : Preview candidate patches without modifying disk files
28
+ - `npx torusguard harden --severity <critical|high|medium|low>` : Filter findings by minimum severity floor
29
+
25
30
  ---
26
31
 
27
32
  ## Mandatory Pre-Flight Context Inspection
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Baseline project discovery, workspace scaffolding, stack detection, and framework-tailored security rule activation.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.4.0
5
5
  agent: profiler
6
6
  lifecycle-phase: Phase 0 (Baseline Setup)
7
7
  required-skills:
@@ -20,6 +20,12 @@ $ARGUMENTS
20
20
  ## Objective
21
21
  Baseline project discovery, workspace scaffolding, stack detection, and security rule activation.
22
22
 
23
+ Supported CLI flags:
24
+ - `npx torusguard init [--target <dir>]` : Scaffold workspace into specified root directory
25
+ - `npx torusguard init --template <golang|nextjs|fastapi|express|django|react>` : Guide stack configuration explicitly
26
+ - `npx torusguard init --audit` : Run immediate baseline audit post-initialization
27
+ - `npx torusguard init --force` : Force overwrite existing workspace and re-scaffold baseline
28
+
23
29
  ---
24
30
 
25
31
  ## Mandatory Pre-Flight Context Inspection
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: TorusGuard Adaptive Security Memory Engine — view memory stats, export/import intelligence, apply TTL decay, and manage false positives.
3
3
  tools: Read, Grep, Glob, Bash
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: Intelligence / Memory
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Targeted differential AST re-scan, fix closure verification, and regression state machine transitions.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: Phase 6 (Targeted Recheck & Verification)
7
7
  required-skills:
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: Explore, search, export, and project distilled Golden Fix Recipes in persistent security memory.
3
+ tools: Read, Grep, Glob, Bash, Write
4
+ version: 1.4.0
5
+ agent: remediator
6
+ lifecycle-phase: Phase 6 (Memory & Recipes)
7
+ required-skills:
8
+ - torusguard-recipes
9
+ scripts-binding:
10
+ - .torusguard/scripts/recipes_runner.py
11
+ - .torusguard/scripts/memory_engine.py
12
+ ---
13
+
14
+ # /torusguard recipes — Golden Fix Recipe Explorer & Memory Distillation
15
+
16
+ $ARGUMENTS
17
+
18
+ ---
19
+
20
+ ## Objective
21
+ Inspect, search, export, and project reusable, verified Ponytail remediation code snippets distilled from passing security patches and persistent memory patterns.
22
+
23
+ ---
24
+
25
+ ## Command Flags & Arguments
26
+
27
+ | Mode | Command Syntax | Description |
28
+ | :--- | :--- | :--- |
29
+ | **List Recipes** | `npx torusguard recipes` | List all distilled golden fix recipes with verification counts and churn |
30
+ | **Search Filter** | `npx torusguard recipes --search <query>` | Filter recipes by keyword, rule family (e.g. `TG-SEC`), or language |
31
+ | **Inspect Detail** | `npx torusguard recipes --detail <id>` | View complete unified diff snippet for a specific recipe |
32
+ | **Export Catalog** | `npx torusguard recipes --export <file>` | Export recipes to `.json` or `.md` catalog format |
33
+ | **Apply Preview** | `npx torusguard recipes --apply <id>` | Project recipe diff onto codebase for manual review |
34
+ | **Target Directory** | `npx torusguard recipes --target <dir>` | Specify custom project root directory |
35
+
36
+ ---
37
+
38
+ ## Execution Steps
39
+
40
+ 1. **Query Memory Patterns:** Read `.torusguard/memory/patterns.json` for verified `golden_fix_recipe` entries.
41
+ 2. **Apply Filter / Search:** Match `--search` query against rule IDs, titles, diffs, and target file types.
42
+ 3. **Render 75-Column Cards:** Format recipe cards showing verified counts, rule family, and Ponytail additions/deletions.
43
+ 4. **Export / Apply:** If requested, write export file or render projected patch snippet.
44
+
45
+ ---
46
+
47
+ ## Output Card Format
48
+
49
+ ```markdown
50
+ ### 🛡️ TorusGuard Golden Fix Recipes
51
+ - **Total Distilled:** [Count] verified recipes
52
+ - **Filter:** [Query or None]
53
+ - **Ponytail Bounds:** All recipes strictly <= 35 additions, <= 25 deletions
54
+ - **Storage:** `.torusguard/memory/patterns.json`
55
+ ```
@@ -1,7 +1,7 @@
1
1
  ---
2
- description: Executive posture reporting, cluster analysis, signed compliance audit, and OASIS SARIF v2.1.0 structured export.
2
+ description: Executive posture reporting, interactive HTML dashboard generation, directory attack surface heatmap, and OASIS SARIF v2.1.0 structured export.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 2.2.0
5
5
  agent: reviewer
6
6
  lifecycle-phase: Phase 7 (Reporting & SARIF Export)
7
7
  required-skills:
@@ -11,91 +11,95 @@ scripts-binding:
11
11
  - .torusguard/scripts/report_sync.py
12
12
  - .torusguard/scripts/sarif_exporter.py
13
13
  - .torusguard/scripts/run_manager.py
14
+ - .torusguard/scripts/term_ui.py
14
15
  ---
15
16
 
16
- # /torusguard report — Unified Security Posture Report & SARIF Export
17
+ # /torusguard report — Unified Security Posture Report & SARIF / HTML Export
17
18
 
18
19
  $ARGUMENTS
19
20
 
20
21
  ---
21
22
 
22
23
  ## Objective
23
- Executive posture reporting, cluster analysis, signed compliance audit, and SARIF v2.1.0 export.
24
+ Generate an executive security posture report, interactive dark-mode HTML dashboard (`report.html`), and schema-compliant OASIS SARIF v2.1.0 log (`results.sarif`) with zero network dependencies.
24
25
 
25
26
  ---
26
27
 
27
- ## Mandatory Pre-Flight Context Inspection
28
+ ## Dual Mode Execution Syntax
28
29
 
29
- Inspect run records and reporting parameters before generating release artifacts:
30
- 1. **Active Run Records:** Ensure target run folder contains `findings.json` or `findings.md`.
31
- 2. **SARIF v2.1.0 Schema:** Validate output structure against official OASIS SARIF standard.
32
- 3. **Multi-Analysis Category:** Tag static findings under category `torusguard/static` to prevent CI collision.
33
- 4. **Secret Masking:** Ensure zero unredacted authorization tokens or API keys appear in report.
34
- 5. **Role Boundary:** Enforce reviewer agent sign-off before archiving run results.
30
+ | Target Artifact | Mode A: Terminal CLI | Mode B: AI Chat Slash Command | Output Location |
31
+ | :--- | :--- | :--- | :--- |
32
+ | **Interactive HTML Dashboard** | `npx torusguard report --html` | `/torusguard report --html` or `/torusguard-report` | `report.html` (workspace root) + `.torusguard/runs/report-latest.html` |
33
+ | **OASIS SARIF v2.1.0 Log** | `npx torusguard report --sarif` | `/torusguard report --sarif` | `.torusguard/runs/results-latest.sarif` |
34
+ | **Combined (Both)** | `npx torusguard report --html --sarif` | `/torusguard report --html --sarif` | Both `report.html` and `results-latest.sarif` in a single pass |
35
+ | **Custom Path** | `npx torusguard report --html --out <path>` | `/torusguard report --out <path>` | Specified path + latest run mirror |
36
+ | **Monorepo Subproject** | `npx torusguard report --target <dir> --html` | `/torusguard report --target <dir>` | `<dir>/report.html` |
35
37
 
36
38
  ---
37
39
 
38
- ## When to Use /torusguard report
39
-
40
- | Trigger Scenario | Recommended Action |
41
- | :--- | :--- |
42
- | Concluding a security review cycle or audit milestone | Run `/torusguard report` |
43
- | Exporting SARIF v2.1.0 logs for GitHub Code Scanning | Run `/torusguard report` |
44
- | Sharing executive posture summaries with stakeholders | Run `/torusguard report` |
45
- | Applying code modifications | Run `/torusguard apply` |
46
- | Re-checking modified files | Run `/torusguard recheck` |
47
-
48
- ---
49
-
50
- ## Living Report Invariant
51
- - Executive posture reports incorporate health scoring and metrics from `security_report.md`.
52
- - Emits visual dark-mode HTML (`--html`) and OASIS SARIF v2.1.0 (`--sarif`).
53
-
54
- ## Execution Steps
40
+ ## Mandatory Pre-Flight Context Inspection
55
41
 
56
- 1. **Aggregate Lifecycle Data:** Load all finding cards, verification traces, and recheck logs.
57
- 2. **Export OASIS SARIF v2.1.0:**
58
- ```bash
59
- python .torusguard/scripts/sarif_exporter.py --run <run_dir> --output <run_dir>/results.sarif
60
- ```
61
- 3. **Compile Executive Markdown Report:** Generate `report.md` with executive summary, posture score, and metrics.
62
- 4. **Sign Off Run Manifest:** Update `.torusguard/runs/<run_id>/manifest.json` with final status counts.
63
- 5. **Archive Results:** Confirm artifacts (`report.md`, `results.sarif`, `summary.md`) are saved on disk.
42
+ Inspect run records and reporting parameters before generating release artifacts:
43
+ 1. **Active Run Records:** Ensure target run folder or `.torusguard/runs/` contains valid run records.
44
+ 2. **Dual-Ledger Ground Truth:** Confirm that `security_report.md` at workspace root is in lockstep with findings.
45
+ 3. **SARIF v2.1.0 Schema:** Validate output structure against official OASIS SARIF standard (`sarif-schema-2.1.0.json`).
46
+ 4. **Multi-Analysis Category:** Tag static findings under category `torusguard/static` to prevent CI collisions.
47
+ 5. **Zero External CDN:** Ensure all icons, gauges, and scripts in `report.html` are 100% self-contained and offline-ready.
48
+ 6. **Secret Masking:** Ensure zero unredacted authorization tokens or API keys appear in report text.
64
49
 
65
50
  ---
66
51
 
67
- ## Failure Recovery
52
+ ## Interactive Dashboard Features (v2.2.0)
68
53
 
69
- - **SARIF Schema Error:** Re-run `sarif_exporter.py` with schema validation flag to locate invalid properties.
70
- - **Empty Findings List:** Emit valid clean report indicating zero security vulnerabilities detected.
71
- - **Missing Run Folder:** Point script to latest valid timestamped run in `.torusguard/runs/`.
72
- - **Halt Trigger:** Abort if unredacted private secrets are detected in output text.
54
+ When viewing `report.html` in any browser:
55
+ 1. **Safe Defenses vs Harmed Exposure:** Complete Defended Invariants inventory across all 74 rules in 18 architectural families. Clean codebases earn 100/100 (74 Defended, 0 Harmed).
56
+ 2. **Directory Attack Surface Heatmap:** Visual directory tree of exposure risk. Clicking any directory card filters the findings table to that specific folder.
57
+ 3. **Golden Recipe Explorer:** Distilled, verified fix patterns with before/after code templates and one-click clipboard copying.
58
+ 4. **Prescriptive Next Best Defenses:** Stack-aware security recommendations with copyable `npx torusguard harden` commands.
59
+ 5. **Client-Side Exporters:** Zero-network buttons to download OASIS SARIF v2.1.0 and CSV records directly from browser memory.
60
+ 6. **Multi-Agent AI Prompt Presets:** One-click prompts tailored for Cursor (`.cursorrules`), Claude Code (`CLAUDE.md`), Antigravity, and GitHub Copilot.
61
+ 7. **Print & PDF Styling:** Built-in high-contrast `@media print` layout for boardroom and compliance distribution.
73
62
 
74
63
  ---
75
64
 
76
- ## Hallucination Guard
65
+ ## Execution Steps
77
66
 
78
- - ❌ Never invent vulnerability counts not backed by actual findings in the run ledger.
79
- - ❌ Never generate invalid SARIF JSON with missing physical location URIs.
80
- - ✅ Always export standard-compliant SARIF v2.1.0 with AST line fingerprints.
67
+ 1. **Detect Mode & Arguments:**
68
+ - Parse `--html`, `--sarif`, `--out`, `--target`, and `--run` from `$ARGUMENTS`.
69
+ - If no format flag is specified in chat, default to generating the visual HTML dashboard (`report.html`).
70
+ 2. **Execute Reporter Scripts:**
71
+ - **For SARIF:**
72
+ ```bash
73
+ python .torusguard/scripts/sarif_exporter.py [--output <path>] [--root <target>]
74
+ ```
75
+ - **For HTML:**
76
+ ```bash
77
+ python .torusguard/scripts/html_reporter.py [--out <path>] [--root <target>]
78
+ ```
79
+ 3. **Synchronize Dual Ledger:**
80
+ - Verify `security_report.md` matches `report.html` findings and posture score.
81
+ 4. **Emit 75-Column Visual Summary Card:**
82
+ - Present markdown output card with direct clickable links to both `report.html` and `security_report.md`.
81
83
 
82
84
  ---
83
85
 
84
86
  ## Output Card Format
85
87
 
86
88
  ```markdown
87
- ### 📊 TorusGuard Security Posture Report
88
- - **Run ID:** `run-YYYYMMDD-HHMMSS`
89
- - **Total Findings:** [Count] ([Fixed] Fixed, [Open] Open)
90
- - **Security Posture Score:** [Score]/100
91
- - **SARIF v2.1.0 Export:** `.torusguard/runs/<run_id>/results.sarif`
92
- - **Executive Report:** `.torusguard/runs/<run_id>/report.md`
93
- - **Status:** COMPLETE — report published
89
+ ### 🛡️ TorusGuard Security Posture Report Emitted
90
+ - **Posture Score:** [Score]/100 ([Status Label])
91
+ - **Invariants Defended:** [N] Defended · [M] Harmed (74 Rules)
92
+ - **Living Ledger:** [security_report.md](file:///path/to/security_report.md)
93
+ - **HTML Dashboard:** [report.html](file:///path/to/report.html)
94
+ - **SARIF v2.1.0 Export:** [results-latest.sarif](file:///path/to/results-latest.sarif)
95
+ - **Status:** COMPLETE — dual-ledger synchronized
94
96
  ```
95
97
 
96
98
  ---
97
99
 
98
- ## Next Steps
100
+ ## Failure Recovery
99
101
 
100
- 1. Upload `results.sarif` to GitHub Code Scanning via `.github/workflows/`.
101
- 2. Share `report.md` with engineering stakeholders and project maintainers.
102
+ - **Missing Run Folder:** Auto-discover the latest timestamped run in `.torusguard/runs/`.
103
+ - **Windows File Lock:** `html_reporter.py` uses atomic temporary write swapping with exponential retry.
104
+ - **Missing SARIF Input:** Auto-discovers findings from the latest audit run in `.torusguard/runs/`.
105
+ - **Clean Workspace:** Emits 100/100 posture score with all 74 defended invariants listed.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Read-only diagnostic overview of workspace security posture, active configuration, rules catalog, and run history.
3
3
  tools: Read, Grep, Glob, Bash
4
- version: 1.3.5
4
+ version: 1.4.0
5
5
  agent: reviewer
6
6
  lifecycle-phase: System / Diagnostics
7
7
  required-skills:
@@ -20,6 +20,9 @@ $ARGUMENTS
20
20
  ## Objective
21
21
  Read-only diagnostic overview of workspace security posture, active configuration, and run history.
22
22
 
23
+ Supported CLI flags:
24
+ - `npx torusguard status [--target <dir>]` : Diagnostic check on specified project directory
25
+
23
26
  ---
24
27
 
25
28
  ## Mandatory Pre-Flight Context Inspection
@@ -0,0 +1,110 @@
1
+ ---
2
+ description: Governed patch application with pre-apply rollback snapshots and Human Gate authorization.
3
+ tools: Read, Grep, Glob, Bash, Edit, Write
4
+ version: 1.4.0
5
+ agent: remediator
6
+ lifecycle-phase: Phase 5 (Patch Application)
7
+ required-skills:
8
+ - torusguard-apply
9
+ scripts-binding:
10
+ - .torusguard/scripts/apply_runner.py
11
+ - .torusguard/scripts/report_sync.py
12
+ - .torusguard/scripts/run_manager.py
13
+ - .torusguard/scripts/diff_guard.py
14
+ ---
15
+
16
+ # /torusguard apply — Governed Patch Application & Rollback Snapshot
17
+
18
+ $ARGUMENTS
19
+
20
+ ---
21
+
22
+ ## Objective
23
+ Governed patch application with pre-apply rollback snapshots and Human Gate authorization.
24
+
25
+ Supported CLI flags:
26
+ - `npx torusguard apply [--target <dir>]` : Apply candidate patches with confirmation prompt
27
+ - `npx torusguard apply --diff` : Preview unified diffs without modifying files on disk
28
+ - `npx torusguard apply --selective` : Interactively review and approve patches one by one
29
+ - `npx torusguard apply --verify` : Trigger immediate differential AST recheck post-apply
30
+ - `npx torusguard apply --list-snapshots` : List available historical pre-apply backup snapshots
31
+ - `npx torusguard apply --yes` / `-y` : Non-interactive auto-approval mode
32
+
33
+ ---
34
+
35
+ ## Mandatory Pre-Flight Context Inspection
36
+
37
+ Inspect bundle validity and file safety before modifying disk code:
38
+ 1. **Bundle Verification:** Assert `patch.diff` exists in active run's remediation folder.
39
+ 2. **Pre-Apply Snapshot:** Save a byte-for-byte backup copy (`.bak` or `.torusguard/snapshots/<run_id>/`) prior to editing.
40
+ 3. **Uncommitted Changes:** Check git status; ensure target file has clean baseline.
41
+ 4. **Ponytail Check:** Re-verify that patch additions $\le 35$ and deletions $\le 25$.
42
+ 5. **Human Gate:** Confirm operator approval before committing edits to disk.
43
+ 6. **Workspace Cleanliness:** Verify git working tree has no uncommitted merge conflicts.
44
+ 7. **Execution Privilege:** Verify write access to targeted file locations.
45
+
46
+ ---
47
+
48
+ ## When to Use /torusguard apply
49
+
50
+ | Trigger Scenario | Recommended Action |
51
+ | :--- | :--- |
52
+ | Applying an approved remediation patch to disk | Run `/torusguard apply` |
53
+ | Generating patch diff without modifying disk | Run `/torusguard harden` |
54
+ | Verifying that patch eliminated flaw without regression | Run `/torusguard recheck` |
55
+ | Reverting an applied patch | Restore from `.bak` snapshot |
56
+ | Checking workspace status | Run `/torusguard status` |
57
+
58
+ ---
59
+
60
+ ## Living Report Invariant
61
+ - Applied patches create pre-apply `.bak` snapshots in `.torusguard/snapshots/<run_id>/`.
62
+ - Finding statuses transition in `security_report.md` to `APPLIED 🔵`.
63
+ - Instant rollback available via `npx torusguard rollback`.
64
+
65
+ ## Execution Steps
66
+
67
+ 1. **Load Remediation Bundle:** Read `patch.diff` and metadata from active run directory.
68
+ 2. **Audit Patch Invariants:** Run `python .torusguard/scripts/diff_guard.py <patch.diff>`.
69
+ 3. **Create Rollback Backup:** Copy target file to `.torusguard/runs/<run_id>/.torusguard/snapshots/<run_id>/<filename>.bak`.
70
+ 4. **Apply Minimal Diff:** Execute precise surgical edit using `replace_file_content` or `patch`.
71
+ 5. **Assert Syntax & Integrity:** Check that modified file compiles cleanly without syntax errors.
72
+ 6. **Log Application Ledger:** Record timestamp, original SHA-256, and patched SHA-256 in `apply-log.json`.
73
+
74
+ ---
75
+
76
+ ## Failure Recovery
77
+
78
+ - **Syntax Error After Patch:** Instantly revert target file from `.bak` backup snapshot.
79
+ - **Merge / Context Conflict:** Re-run `/torusguard harden` to regenerate diff against latest disk lines.
80
+ - **Missing Backup File:** Do not apply patch if backup copy cannot be written.
81
+ - **Halt Trigger:** Abort if git working tree is dirty on conflicting lines.
82
+
83
+ ---
84
+
85
+ ## Hallucination Guard
86
+
87
+ - ❌ Never apply code changes without creating an exact pre-apply rollback backup first.
88
+ - ❌ Never touch files not explicitly listed in the approved `patch.diff`.
89
+ - ✅ Always verify syntax compilation immediately after modifying source files.
90
+
91
+ ---
92
+
93
+ ## Output Card Format
94
+
95
+ ```markdown
96
+ ### 🚀 TorusGuard Patch Application
97
+ - **Finding Addressed:** `TG-XXX-HASH`
98
+ - **File Patched:** `src/path/to/file.py`
99
+ - **Rollback Backup:** `.torusguard/runs/<run_id>/.torusguard/snapshots/<run_id>/<file>.bak`
100
+ - **Churn Applied:** +[Additions] / -[Deletions] lines
101
+ - **Syntax Check:** PASSED (clean compile)
102
+ - **Status:** APPLIED — run `/torusguard recheck` to verify fix
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Next Steps
108
+
109
+ 1. Run `/torusguard recheck` to perform differential audit on the modified file.
110
+ 2. Run test suites to verify that business logic and regressions remain intact.
@@ -0,0 +1,105 @@
1
+ ---
2
+ description: Static security AST scanning, stable line-shift invariant fingerprinting, root-cause clustering, and 0-100 confidence scoring.
3
+ tools: Read, Grep, Glob, Bash, Write
4
+ version: 1.4.0
5
+ agent: auditor
6
+ lifecycle-phase: Phase 2 (Static Audit & Clustering)
7
+ required-skills:
8
+ - torusguard-audit
9
+ scripts-binding:
10
+ - .torusguard/scripts/audit_runner.py
11
+ - .torusguard/scripts/report_sync.py
12
+ - .torusguard/scripts/run_manager.py
13
+ - .torusguard/scripts/finding_scorer.py
14
+ ---
15
+
16
+ # /torusguard audit — Static Security Code Scan & Clustering
17
+
18
+ $ARGUMENTS
19
+
20
+ ---
21
+
22
+ ## Objective
23
+ Static security AST scanning, stable fingerprinting, root-cause clustering, throughput telemetry, and 0-100 scoring.
24
+
25
+ Supported CLI flags:
26
+ - `npx torusguard audit [--target <dir>]` : Specify project root directory
27
+ - `npx torusguard audit --watch` / `-w` : Continuous watch mode, re-scanning on file change
28
+ - `npx torusguard audit --sarif` : Automatically export OASIS SARIF v2.1.0 log
29
+ - `npx torusguard audit --severity <critical|high|medium|low>` : Floor filter for findings
30
+
31
+ ---
32
+
33
+ ## Mandatory Pre-Flight Context Inspection
34
+
35
+ Inspect workspace prerequisites before launching static audit:
36
+ 1. **Init State (`torusguard.json`):** Assert repository is initialized.
37
+ 2. **Active Rules (`rules/active/`):** Confirm rule definitions exist.
38
+ 3. **Exclusions:** Assert `node_modules/`, `.venv/`, `dist/`, `.git/` are skipped.
39
+ 4. **Run Folder:** Allocate isolated folder in `.torusguard/runs/`.
40
+ 5. **Syntax Check:** Check for syntax errors before parsing ASTs.
41
+
42
+ ---
43
+
44
+ ## When to Use /torusguard audit
45
+
46
+ | Trigger Scenario | Recommended Action |
47
+ | :--- | :--- |
48
+ | First-time scan of repository or new branch | Run `/torusguard audit` |
49
+ | Pre-commit review and PR security checks | Run `/torusguard audit` |
50
+ | Uninitialized project | Run `/torusguard init` first |
51
+ | Live endpoint or runtime probing | Run `/torusguard web-validate` |
52
+ | Differential check after patch | Run `/torusguard recheck` |
53
+
54
+ ---
55
+
56
+ ## Living Report Invariant
57
+ - Audit discoveries automatically synchronize to `security_report.md` at workspace root.
58
+ - Findings transition into `OPEN 🔴` status with stable invariant fingerprints.
59
+
60
+ ## Execution Steps
61
+
62
+ 1. **Allocate Run Folder:** Run `python .torusguard/scripts/run_manager.py create audit`.
63
+ 2. **Scan Codebase ASTs:** Match active rules against source trees.
64
+ 3. **Compute Stable Fingerprints:** Hash AST context to produce stable IDs.
65
+ 4. **Cluster Root Causes:** Group findings sharing identical sinks.
66
+ 5. **Score Confidence (0–100):** Run `python .torusguard/scripts/finding_scorer.py --run <run_dir>`.
67
+ 6. **Emit Artifacts:** Write `findings.md`, `findings.json`, and `summary.md`.
68
+
69
+ ---
70
+
71
+ ## Failure Recovery
72
+
73
+ - **Zero Rules Active:** Re-run `/torusguard init` to activate rules.
74
+ - **AST Parse Error:** Log syntax error on malformed file, skip, and continue.
75
+ - **Scorer Failure:** Ensure Python 3.10+; verify finding JSON structure.
76
+ - **Halt Trigger:** Abort if run folder cannot be allocated or disk write fails.
77
+
78
+ ---
79
+
80
+ ## Hallucination Guard
81
+
82
+ - ❌ Never invent finding IDs without AST line hashing.
83
+ - ❌ Never flag test fixtures as critical security flaws.
84
+ - ✅ Always calculate scores using `.torusguard/scripts/finding_scorer.py`.
85
+
86
+ ---
87
+
88
+ ## Output Card Format
89
+
90
+ ```markdown
91
+ ### 🔎 TorusGuard Static Audit Results
92
+ - **Run ID:** `run-YYYYMMDD-HHMMSS-audit`
93
+ - **Files Scanned:** [Count] source files
94
+ - **Total Findings:** [Count] ([Critical] Critical, [High] High)
95
+ - **Root Cause Clusters:** [Count] architectural issues
96
+ - **Confidence:** [Score]/100
97
+ - **Artifact:** `.torusguard/runs/<run_id>/findings.md`
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Next Steps
103
+
104
+ 1. Run `/torusguard verify` to validate exploitability and review evidence.
105
+ 2. Run `/torusguard harden` to generate minimal surgical remediation plans.